/// /// /// /// module Configs{ export var KubeController = controller('KubeController', ["$scope", "$templateCache", "$location", "$routeParams", "$http", "$timeout","ConfigsModel", ($scope, $templateCache:ng.ITemplateCacheService, $location, $routeParams, $http, $timeout, ConfigsModel) => { $scope.model= ConfigsModel; $scope.model.updateOracleParam(); $scope.tableConfig={ data: 'model.oracleParam', selectedItems: [], columnDefs: [{ field: "name", displayName: "名称" }, { field: "ip", displayName: "IP" }, { field: "port", displayName: "端口号" }, { field: "user", displayName: "用户名" }, { field: "password", displayName: "密码" }, { field: "databaseName", displayName: "服务名" }, { field: "tableName", displayName: "表空间名" }, { field: "suffix", displayName: "表后缀" }, { field: "status", displayName: "连接状态", cellTemplate: $templateCache.get("connectStatus.html") }, { field: "entity", displayName: "操作", cellTemplate: $templateCache.get("tableEdit.html") }], enableRowClickSelection: false, showSelectionCheckbox: false, multiSelect: false, sortInfo: { sortBy: "name", ascending: true } } shareInit($scope, $location, $routeParams); $scope.create = () =>{ $scope.add= true; $scope.edit = false; $scope.tableForm = createNewObejct($scope.tableConfig.columnDefs, null); $scope.rowId=0; removeElementsByValue($scope.tableForm, [{key: "name", value: "序号"},{key: "name", value: "连接状态"},{key: "name", value: "操作"}]); } $scope.cancel = () => { $scope.tableForm =null; $scope.add = false; $scope.edit = false; } $scope.onSubmit = () => { $scope.edit = false; $scope.add = false; oracleInfoOperate($http, "/java/console/api/oracle", OperateType.UPDATE, createOracleInfo($scope.tableForm, $scope.rowId), (result, status) => { if(status===200){ $scope.model.updateOracleParam(); }else{ throw "资源请求失败"; } }); } $scope.$on("editRow", (event, data) =>{ $scope.edit = true; $scope.add = false; $scope.rowId = data.id $scope.tableForm = createNewObejct($scope.tableConfig.columnDefs, data); removeElementsByValue($scope.tableForm, [{key: "name", value: "序号"},{key: "name", value: "连接状态"},{key: "name", value: "操作"}]); }) ; $scope.$on("deleteRow", (event, data) =>{ oracleInfoOperate($http, "/java/console/api/oracle", OperateType.DELETE, data, (result, status) => { if(status===200){ console.log("准备更新"); $scope.model.updateOracleParam(); }else{ throw "资源请求失败"; } }); //removeElementByValue($scope.model, data._id, "_id"); }); }]); }