You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aggregation-platform/plugins/configs/ts/kubeClusterSetting.ts

118 lines
4.0 KiB

/// <reference path="../../includes.ts"/>
/// <reference path="configPlugin.ts"/>
/// <reference path="configsHelper.ts"/>
/// <reference path="configsUtils.ts"/>
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.submitted = false;
$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: "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.submitted = false;
$scope.add= true;
$scope.edit = false;
$scope.tableForm = {};
$scope.tableForm["id"]=0;
}
$scope.cancel = () => {
$scope.tableForm =null;
$scope.add = false;
$scope.edit = false;
$scope.submitted = false;
}
$scope.onSubmit = (oracle) => {
if($scope.validForm.$valid && $scope.validForm.$dirty){
$scope.edit = false;
$scope.add = false;
oracleInfoOperate($http, "/java/console/api/oracle", OperateType.UPDATE, oracle, (result, status) => {
if(status===200){
$scope.model.updateOracleParam();
}else{
throw "资源请求失败";
}
});
}else{
$scope.submitted = true;
}
}
$scope.$on("editRow", (event, data) =>{
$scope.submitted = false;
$scope.tableForm = deepCopy(data);
$scope.edit = true;
$scope.add = false;
//$scope.rowId = data.id
//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");
});
}]);
}