完善数据管理功能

This commit is contained in:
wu ming 2016-09-12 16:30:17 +08:00
parent 566cd7c3ad
commit 86256d2a0d
8 changed files with 94 additions and 30 deletions

View File

@ -20,8 +20,9 @@ declare module Developer {
getPageSizeNum(): number;
}
class DataModelService {
data: any[];
data: Array<any>;
paramOptions: OptionsParams;
transferTasks: Array<any>;
constructor();
protected getDataModel(paramOptions: any): any;
initParamOptions(): void;
@ -29,5 +30,6 @@ declare module Developer {
maybeFormat(): void;
updateParamOption(option: string, value: any): void;
getParamOption(key: string): any;
startIntervalTask($interval: any, $http: any): void;
}
}

File diff suppressed because one or more lines are too long

View File

@ -249,7 +249,7 @@ gulp.task('connect', ['watch'], function() {
}, {
proto: "http",
port: "8080",
hostname: "192.168.0.181",
hostname: "192.168.0.101",
path: '/java/console/api',
targetPath: "/"
}];

View File

@ -78,6 +78,14 @@
</label>
<select ng-model="migrationClick.selectedItem " class="col-sm-3 sj_modal_select" title="name of the new namespace " id="selectedItem " ng-options="x.name for x in volumes " />
</div>
<div class="form-group">
<div class="col-sm-12 alert alert-warning">
<span class="help-block" ng-show="!volumes || volumes.length == 0">
当前没有可以迁移的集群,请在数据集群配置页面进行配置!
</span>
</div>
</div>
<div>
<treecontrol class="tree-classic" tree-model="migrationClick.selectedItem.folder" options="treeOptions" on-selection="showSelected(node)" selected-node="selectNode">
{{node.name}}

View File

@ -100,8 +100,9 @@ module Developer{
}
export class DataModelService{
public data = [];
public paramOptions = new OptionsParams();
public data:Array<any> = [];
public paramOptions: OptionsParams = new OptionsParams();
public transferTasks: Array<any> = [];
constructor(){
this.updateModel();
@ -150,13 +151,36 @@ module Developer{
return this.paramOptions[key];
}
public startIntervalTask($interval, $http){
var result;
var timer = $interval(() => {
$.ajax({
async: false,
type : "POST",
url : "/java/console/api/task/transfer/list",
success : function(data) {
if(data){
result = data;
}
}
});
this.transferTasks = result;
},1500);
timer.then(() =>{
console.log("Done!");
}, () =>{
console.log("error");
}, () =>{
console.log("每次都更新");
});
}
}
//创建数据模型服务
_module.factory("DataModel", ['$rootScope', '$http', '$location', '$resource', ($rootScope, $http, $location, $resource) => {
_module.factory("DataModel", ['$rootScope', '$http', '$interval', '$location', '$resource', ($rootScope, $http, $interval, $location, $resource) => {
var $scope = new DataModelService();
$scope.startIntervalTask($interval, $http);
return $scope;
}]);
}

View File

@ -14,13 +14,8 @@ module Developer {
$scope.model=DataModel;
init($scope, $location, $routeParams);
$scope.options = DataModel.paramOptions;
console.log($scope.options);
$scope.pageSizeChoses = DataModel.paramOptions.pagerSizeOption;
$scope.options.dataType = getDataType($location);
console.log($scope.volumes);
//console.log(JSON.stringify($scope.volumes[0].folderNode));
$scope.treeOptions = {
nodeChildren: "childNodes",
@ -160,7 +155,7 @@ module Developer {
$scope.migrationClick = {
items:null,
selectedItem: $scope.volumes[0] || {"name": "当前没有可以迁移的集群"},
selectedItem: {"name": "当前没有可以迁移的集群"},
dialog: new UI.Dialog(),
onOk: () => {
var migrationClick = $scope.migrationClick;
@ -180,9 +175,12 @@ module Developer {
},
open: (selected) =>{
var migrationClick = $scope.migrationClick;
if($scope.volumes && $scope.volumes instanceof Array && $scope.volumes.length >0)
migrationClick.selectedItem = $scope.volumes[0];
migrationClick.dialog.open();
},
close: () => {
$scope.migrationClick.selectedItem = {"name": "当前没有可以迁移的集群"};
$scope.migrationClick.dialog.close();
}
};

View File

@ -177,7 +177,7 @@ module Kubernetes {
$scope.extractClick = {
items: null,
selectedItem: $scope.configs.oracleParam[0] || {name: "当前没有可用的汇总库"},
selectedItem: {name: "当前没有可用的汇总库"},
dialog: new UI.Dialog(),
onOk: () => {
var extractClick = $scope.extractClick;
@ -188,6 +188,8 @@ module Kubernetes {
},
open: (selected) => {
var extractClick = $scope.extractClick;
if($scope.configs && $scope.configs.oracleParam instanceof Array && $scope.configs.oracleParam.length>0)
extractClick.selectedItem = $scope.configs.oracleParam[0];
extractClick.dialog.open();
/*extractData.selectedItem = $scope.filterReplicationControllers[0] || "";
extractData.items = selected;*/
@ -196,6 +198,7 @@ module Kubernetes {
}, 50);
},
close: () => {
$scope.extractClick.selectedItem = {name: "当前没有可用的汇总库"};
$scope.extractClick.dialog.close();
}
};