完善数据管理功能

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; getPageSizeNum(): number;
} }
class DataModelService { class DataModelService {
data: any[]; data: Array<any>;
paramOptions: OptionsParams; paramOptions: OptionsParams;
transferTasks: Array<any>;
constructor(); constructor();
protected getDataModel(paramOptions: any): any; protected getDataModel(paramOptions: any): any;
initParamOptions(): void; initParamOptions(): void;
@ -29,5 +30,6 @@ declare module Developer {
maybeFormat(): void; maybeFormat(): void;
updateParamOption(option: string, value: any): void; updateParamOption(option: string, value: any): void;
getParamOption(key: string): any; 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", proto: "http",
port: "8080", port: "8080",
hostname: "192.168.0.181", hostname: "192.168.0.101",
path: '/java/console/api', path: '/java/console/api',
targetPath: "/" targetPath: "/"
}]; }];

View File

@ -92,7 +92,7 @@ module Configs{
} }
_module.factory('ConfigsModel', ['$rootScope', '$http', '$location', '$resource', ($rootScope, $http, $location, $resource) =>{ _module.factory('ConfigsModel', ['$rootScope', '$http', '$location', '$resource', ($rootScope, $http, $location, $resource) =>{
var $scope = new ConfigsModelService(); var $scope = new ConfigsModelService();
return $scope; return $scope;
}]); }]);
} }

View File

@ -78,6 +78,14 @@
</label> </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 " /> <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>
<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> <div>
<treecontrol class="tree-classic" tree-model="migrationClick.selectedItem.folder" options="treeOptions" on-selection="showSelected(node)" selected-node="selectNode"> <treecontrol class="tree-classic" tree-model="migrationClick.selectedItem.folder" options="treeOptions" on-selection="showSelected(node)" selected-node="selectNode">
{{node.name}} {{node.name}}

View File

@ -100,8 +100,9 @@ module Developer{
} }
export class DataModelService{ export class DataModelService{
public data = []; public data:Array<any> = [];
public paramOptions = new OptionsParams(); public paramOptions: OptionsParams = new OptionsParams();
public transferTasks: Array<any> = [];
constructor(){ constructor(){
this.updateModel(); this.updateModel();
@ -148,15 +149,38 @@ module Developer{
//根据key获取用户选择参数 //根据key获取用户选择参数
public getParamOption(key:string){ public getParamOption(key:string){
return this.paramOptions[key]; 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(); var $scope = new DataModelService();
return $scope; $scope.startIntervalTask($interval, $http);
return $scope;
}]); }]);
} }

View File

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

View File

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