diff --git a/d.ts/configs/ts/configUtils.d.ts b/d.ts/configs/ts/configUtils.d.ts new file mode 100644 index 0000000..170ffb9 --- /dev/null +++ b/d.ts/configs/ts/configUtils.d.ts @@ -0,0 +1,4 @@ +/// +declare module Configs { + function removeElementByValue(array: Array, value: any, key?: string): void; +} diff --git a/d.ts/configs/ts/configsDataService.d.ts b/d.ts/configs/ts/configsDataService.d.ts new file mode 100644 index 0000000..3267c3b --- /dev/null +++ b/d.ts/configs/ts/configsDataService.d.ts @@ -0,0 +1,29 @@ +/// +/// +declare module Configs { + interface Block { + ip: string; + path: string; + } + interface oracleParam { + name: string; + ip: string; + port: string; + serviceName: string; + tableName: string; + status: string; + } + interface volume { + name: string; + totalSize: number; + usedSize: number; + block: Block; + folder?: Array; + } + class ConfigsModelService { + cluster: Array; + oracleParam: Array; + updateVolumeData($scope: any, $http: any): void; + getFolderByVolumeName(name: string): any[]; + } +} diff --git a/d.ts/configs/ts/configsUtils.d.ts b/d.ts/configs/ts/configsUtils.d.ts new file mode 100644 index 0000000..df2e672 --- /dev/null +++ b/d.ts/configs/ts/configsUtils.d.ts @@ -0,0 +1,5 @@ +/// +declare module Configs { + function removeElementByValue(array: Array, value: any, key?: string): void; + function removeElementsByValue(array: Array, elements: Array): void; +} diff --git a/d.ts/configs/ts/glusterfsSetting.d.ts b/d.ts/configs/ts/glusterfsSetting.d.ts new file mode 100644 index 0000000..932d1dd --- /dev/null +++ b/d.ts/configs/ts/glusterfsSetting.d.ts @@ -0,0 +1,6 @@ +/// +/// +/// +declare module Configs { + var GfsController: ng.IModule; +} diff --git a/d.ts/configs/ts/kubeClusterSetting.d.ts b/d.ts/configs/ts/kubeClusterSetting.d.ts new file mode 100644 index 0000000..0368621 --- /dev/null +++ b/d.ts/configs/ts/kubeClusterSetting.d.ts @@ -0,0 +1,7 @@ +/// +/// +/// +/// +declare module Configs { + var KubeController: ng.IModule; +} diff --git a/d.ts/configs/ts/shareController.d.ts b/d.ts/configs/ts/shareController.d.ts new file mode 100644 index 0000000..3f612af --- /dev/null +++ b/d.ts/configs/ts/shareController.d.ts @@ -0,0 +1,5 @@ +/// +/// +declare module Configs { + var EableEdit: ng.IModule; +} diff --git a/plugins/configs/html/kubeForm.html b/plugins/configs/html/kubeForm.html new file mode 100644 index 0000000..5305d1d --- /dev/null +++ b/plugins/configs/html/kubeForm.html @@ -0,0 +1,21 @@ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
diff --git a/plugins/configs/html/shareLayout.html b/plugins/configs/html/shareLayout.html new file mode 100644 index 0000000..d7aafc0 --- /dev/null +++ b/plugins/configs/html/shareLayout.html @@ -0,0 +1,18 @@ + + +
+
+
+
+
diff --git a/plugins/configs/ts/configsDataService.ts b/plugins/configs/ts/configsDataService.ts new file mode 100644 index 0000000..d9c6617 --- /dev/null +++ b/plugins/configs/ts/configsDataService.ts @@ -0,0 +1,70 @@ +/// +/// +module Configs{ + + export interface Block{ + ip:string; //存储块的机器ip地址 + path: string; //路径 + } + + export interface oracleParam{ + name: string + ip: string; + port: string; + serviceName: string; + tableName: string; + status: string; + } + + export interface volume{ + name: string; //volume的名字 + totalSize: number; //volume空间大小 + usedSize: number; // volume已使用空间大小 + block: Block; //volume中的存储块 + folder?: Array; //volume的文件 + } + + //字节大小转换成字符大小 + function getStringSize(size: number){ + var result = size; + var suffix =["B", "KB" ,"MB", "GB", "GB", "TB"]; + var count=1; + while(result > 1024){ + result = result/1024; + count ++; + } + return result + suffix[count]; + } + + + export class ConfigsModelService{ + public cluster: Array=[]; + public oracleParam: Array; + + public updateVolumeData($scope: ConfigsModelService, $http){ + console.log($scope); + $http({ + method: "POST", + url: "/java/console/api/volume/list" + }).success(function(data, status, headers, config) { + $scope.cluster.push(data); + }).error(function(data, status, headers, config) { + //$scope.voume=data; + }); + } + + public getFolderByVolumeName(name: string){ + if(this.cluster===null) + return null; + for(var i=0; i< this.cluster.length; i++){ + if(this.cluster[i].name === name) + return this.cluster[i].folder; + } + } + } + + _module.factory('ConfigsModel', ['$rootScope', '$http', '$location', '$resource', ($rootScope, $http, $location, $resource) =>{ + var $scope = new ConfigsModelService(); + return $scope; + }]); +} \ No newline at end of file diff --git a/plugins/configs/ts/configsUtils.ts b/plugins/configs/ts/configsUtils.ts new file mode 100644 index 0000000..719b88f --- /dev/null +++ b/plugins/configs/ts/configsUtils.ts @@ -0,0 +1,27 @@ +/// + +module Configs{ + export function removeElementByValue(array:Array ,value:any, key?:string ){ + if(key){ + for(var i=0; i, elements:Array){ + angular.forEach(elements, (element) =>{ + removeElementByValue(array, element.value, element.key); + }); + } +} \ No newline at end of file diff --git a/plugins/configs/ts/kubeClusterSetting.ts b/plugins/configs/ts/kubeClusterSetting.ts new file mode 100644 index 0000000..6ead577 --- /dev/null +++ b/plugins/configs/ts/kubeClusterSetting.ts @@ -0,0 +1,109 @@ +/// +/// +/// +/// +module Configs{ + + export var KubeController = controller('KubeController', ["$scope", "$templateCache", "$location", "$routeParams", "$http", "$timeout", + ($scope, $templateCache:ng.ITemplateCacheService, $location, $routeParams, $http, $timeout) => { + + $scope.model= [{ + "name": "", + "status": "OK", + "ip": "10.188.2.3", + "_id": 1 + }, + { + "name": "camel-041", + "status": "OK", + "ip": "10.188.2.20", + "_id": 2 + }, + { + "name": "activemq-004", + "status": "failed", + "ip": "10.188.2.111", + "_id": 3 + }]; + + $scope.tableConfig={ + data: "model", + selectedItems: [{ + name: "activemq-004", + status: "failed", + ip: "10.188.2.111", + _id: 2 + }], + columnDefs: [{ + field: "_id", + displayName: "序号" + }, + { + field: "name", + displayName: "名称" + }, + { + field: "ip", + displayName: "IP" + }, + { + field: "port", + displayName: "端口号" + }, + { + field: "userName", + displayName: "用户名" + }, + { + field: "password", + displayName: "密码" + }, + { + field: "serviceName", + displayName: "服务名" + }, + { + field: "status", + displayName: "连接状态" + }, + { + field: "entity", + displayName: "操作", + cellTemplate: $templateCache.get("tableEdit.html") + }], + enableRowClickSelection: true, + showSelectionCheckbox: false, + multiSelect: false, + sortInfo: { + sortBy: "_id", + ascending: true + } + } + + shareInit($scope, $location, $routeParams); + + $scope.create = () =>{ + $scope.add= true; + $scope.edit = false; + $scope.tableForm = createNewObejct($scope.tableConfig.columnDefs, null); + removeElementsByValue($scope.tableForm, [{key: "name", value: "序号"},{key: "name", value: "连接状态"},{key: "name", value: "操作"}]); + } + + $scope.onSubmit = () => { + $scope.edit = false; + $scope.add = false; + console.log($scope.tableForm); + } + + $scope.$on("editRow", (event, data) =>{ + $scope.edit = true; + $scope.add = false; + $scope.tableForm = createNewObejct($scope.tableConfig.columnDefs, data); + removeElementsByValue($scope.tableForm, [{key: "name", value: "序号"},{key: "name", value: "连接状态"},{key: "name", value: "操作"}]); + }) ; + + $scope.$on("deleteRow", (event, data) =>{ + removeElementByValue($scope.model, data._id, "_id"); + }) ; + }]); +} \ No newline at end of file diff --git a/plugins/configs/ts/shareController.ts b/plugins/configs/ts/shareController.ts new file mode 100644 index 0000000..e4b3934 --- /dev/null +++ b/plugins/configs/ts/shareController.ts @@ -0,0 +1,13 @@ +/// +/// +module Configs{ + export var EableEdit = controller('EableEdit', ['$scope', ($scope) => { + $scope.editRow = (entity)=>{ + $scope.$emit('editRow', entity); + } + + $scope.deleteRow = (entity) =>{ + $scope.$emit('deleteRow', entity); + } + }]); +} \ No newline at end of file