This commit is contained in:
wu ming 2016-09-27 23:03:09 +08:00
parent 1fe0e27d9f
commit 091edca9cc
9 changed files with 3114 additions and 2929 deletions

View File

@ -2,4 +2,8 @@
declare module Configs {
function removeElementByValue(array: Array<any>, value: any, key?: string): void;
function removeElementsByValue(array: Array<any>, elements: Array<any>): void;
/**
*/
function deepCopy(object: any): any;
}

40
defs.d.ts vendored
View File

@ -18,6 +18,26 @@
/// <reference path="d.ts/configs/ts/kubeClusterSetting.d.ts"/>
/// <reference path="d.ts/configs/ts/regionalismCodeSearch.d.ts"/>
/// <reference path="d.ts/configs/ts/systemCodeSearch.d.ts"/>
/// <reference path="d.ts/developer/ts/developerPlugin.d.ts"/>
/// <reference path="d.ts/developer/ts/dataManagerModel.d.ts"/>
/// <reference path="d.ts/developer/ts/developerEnrichers.d.ts"/>
/// <reference path="d.ts/developer/ts/environmentPanel.d.ts"/>
/// <reference path="d.ts/developer/ts/fileMigrationTask.d.ts"/>
/// <reference path="d.ts/developer/ts/home.d.ts"/>
/// <reference path="d.ts/developer/ts/jenkinsJob.d.ts"/>
/// <reference path="d.ts/developer/ts/jenkinsJobs.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/kubernetesModel.d.ts"/>
/// <reference path="d.ts/developer/ts/jenkinsLog.d.ts"/>
/// <reference path="d.ts/developer/ts/jenkinsMetrics.d.ts"/>
/// <reference path="d.ts/developer/ts/navbar.d.ts"/>
/// <reference path="d.ts/developer/ts/pipeline.d.ts"/>
/// <reference path="d.ts/developer/ts/pipelineDirective.d.ts"/>
/// <reference path="d.ts/developer/ts/pipelines.d.ts"/>
/// <reference path="d.ts/developer/ts/project.d.ts"/>
/// <reference path="d.ts/developer/ts/projectSelector.d.ts"/>
/// <reference path="d.ts/developer/ts/projects.d.ts"/>
/// <reference path="d.ts/developer/ts/workspace.d.ts"/>
/// <reference path="d.ts/developer/ts/workspaces.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/apps.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/breadcrumbs.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/build.d.ts"/>
@ -30,7 +50,6 @@
/// <reference path="d.ts/kubernetes/ts/deploymentConfig.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/deploymentConfigs.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/events.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/kubernetesModel.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/host.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/hosts.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/imageRepositories.d.ts"/>
@ -59,23 +78,4 @@
/// <reference path="d.ts/kubernetes/ts/sharedControllers.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/tabs.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/templates.d.ts"/>
/// <reference path="d.ts/developer/ts/developerPlugin.d.ts"/>
/// <reference path="d.ts/developer/ts/dataManagerModel.d.ts"/>
/// <reference path="d.ts/developer/ts/developerEnrichers.d.ts"/>
/// <reference path="d.ts/developer/ts/environmentPanel.d.ts"/>
/// <reference path="d.ts/developer/ts/fileMigrationTask.d.ts"/>
/// <reference path="d.ts/developer/ts/home.d.ts"/>
/// <reference path="d.ts/developer/ts/jenkinsJob.d.ts"/>
/// <reference path="d.ts/developer/ts/jenkinsJobs.d.ts"/>
/// <reference path="d.ts/developer/ts/jenkinsLog.d.ts"/>
/// <reference path="d.ts/developer/ts/jenkinsMetrics.d.ts"/>
/// <reference path="d.ts/developer/ts/navbar.d.ts"/>
/// <reference path="d.ts/developer/ts/pipeline.d.ts"/>
/// <reference path="d.ts/developer/ts/pipelineDirective.d.ts"/>
/// <reference path="d.ts/developer/ts/pipelines.d.ts"/>
/// <reference path="d.ts/developer/ts/project.d.ts"/>
/// <reference path="d.ts/developer/ts/projectSelector.d.ts"/>
/// <reference path="d.ts/developer/ts/projects.d.ts"/>
/// <reference path="d.ts/developer/ts/workspace.d.ts"/>
/// <reference path="d.ts/developer/ts/workspaces.d.ts"/>
/// <reference path="d.ts/navigation/ts/navigationPlugin.d.ts"/>

File diff suppressed because one or more lines are too long

View File

@ -5,34 +5,107 @@
<div class="row">
<div hawtio-tabs></div>
</div>
<div class="container-content " >
<div class="container-content ">
<div class="row align-center mb10" ng-hide="model.oracleParam.length">
<p class="alert alert-info">当前没有配置汇总库信息,请配置,否则汇总操作将不可用!</p>
</div>
<div class="row mb10" ng-show="model.oracleParam.length">
<table class="table table-bordered table-striped sj_content_table" hawtio-simple-table="tableConfig" />
</div>
<div class="row" >
<div >
<div class="row">
<div>
<button class="btn sj_btn_green mb10" style="color:#fff;" ng-click="create()">
<span class="glyphicon glyphicon-plus"></span> 添加
</button>
</div>
</div>
<hr>
<div class="row " style="padding-top:10px;" ng-show="tableForm.length>=0 && (edit || add)" >
<h3 class="mb10" ng-show="edit" >编辑汇总库连接信息:</h3>
<h3 class="mb10" ng-show="add" >添加汇总库信息:</h3>
<div class="col-md-6 col-md-offset-1 " >
<form class="form-horizontal" ng-submit="onSubmit(validForm.$valid)" novalidate="novalidate" name="validForm">
<div class="form-group" ng-repeat="item in tableForm">
<label class="col-sm-2 control-label">{{item.name}}</label>
<div class="row " style="padding-top:10px;" ng-show="tableForm && (edit || add)">
<h3 class="mb10" ng-show="edit">编辑汇总库连接信息:</h3>
<h3 class="mb10" ng-show="add">添加汇总库信息:</h3>
<div class="col-md-6 col-md-offset-1 ">
<form class="form-horizontal" novalidate="novalidate" name="validForm" ng-submit="onSubmit(tableForm)">
<div class="form-group">
<label class="col-sm-2 control-label">名称</label>
<div class="col-sm-10 sj_form_input">
<input type="text " ng-model="item.value">
<input class="form-control " type="text" ng-model="tableForm.name" name="orcName" required="required"/>
<div class="form-error" ng-show="validForm.orcName.$invalid && submitted">
<span class="alert alert-danger" role="alert" ng-show="validForm.orcName.$error.required">IP不能为空</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">IP</label>
<div class="col-sm-10 sj_form_input">
<input class="form-control" type="text" ng-model="tableForm.ip" name="orcIP" ng-pattern="/((?:(?:25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(?:25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d))))/" required="required"/>
<div class="form-error" ng-show="validForm.orcIP.$invalid && submitted">
<span class="alert alert-danger" role="alert" ng-show="validForm.orcIP.$error.required">IP不能为空</span>
<span class="alert alert-danger" role="alert" ng-show="validForm.orcIP.$error.pattern">请输入正确的IP地址</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">端口号</label>
<div class="col-sm-10 sj_form_input">
<input class="form-control" type="text" ng-model="tableForm.port" name="orcPort" ng-pattern="/^[1-9]$|(^[1-9][0-9]$)|(^[1-9][0-9][0-9]$)|(^[1-9][0-9][0-9][0-9]$)|(^[1-6][0-5][0-5][0-3][0-5]$)/" required="required"/>
<div class="form-error" ng-show="validForm.orcPort.$invalid && submitted">
<span class="alert alert-danger" role="alert" ng-show="validForm.orcPort.$error.required">端口号不能为空</span>
<span class="alert alert-danger" role="alert" ng-show="validForm.orcPort.$error.pattern">端口号必须为1~65535的数字</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">用戶名</label>
<div class="col-sm-10 sj_form_input">
<input class="form-control" type="text" ng-model="tableForm.user" name="orcUser" ng-pattern="/^\w{2,15}$/" required="required"/>
<div class="form-error" ng-show="validForm.orcUser.$invalid && submitted">
<span class="alert alert-danger" role="alert" ng-show="validForm.orcUser.$error.required">用户名不能为空</span>
<span class="alert alert-danger" role="alert" ng-show="validForm.orcUser.$error.pattern">用户名必须为6-18个字母、数字或下划线</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">密码</label>
<div class="col-sm-10 sj_form_input">
<input class="form-control" type="text" ng-model="tableForm.password" name="orcPassword" ng-pattern="/^\w{2,15}$/" required="required"/>
<div class="form-error" ng-show="validForm.orcPassword.$invalid && submitted">
<span class="alert alert-danger" role="alert" ng-show="validForm.orcPassword.$error.required">密码不能为空</span>
<span class="alert alert-danger" role="alert" ng-show="validForm.orcPassword.$error.pattern">密码必须为6-18个字母、数字或下划线</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">服务名</label>
<div class="col-sm-10 sj_form_input">
<input class="form-control" type="text" ng-model="tableForm.databaseName" name="orcService" ng-pattern="/^[a-zA-Z]{1,10}$/" required="required"/>
<div class="form-error" ng-show="validForm.orcService.$invalid && submitted">
<span class="alert alert-danger" role="alert" ng-show="validForm.orcService.$error.required">服务名不能为空</span>
<span class="alert alert-danger" role="alert" ng-show="validForm.orcService.$error.pattern">服务名必须为1-10个字母</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">表空间名</label>
<div class="col-sm-10 sj_form_input">
<input class="form-control" type="text" ng-model="tableForm.tableName" name="orcTable" ng-pattern="/^\w{2,15}$/" required="required"/>
<div class="form-error" ng-show="validForm.orcTable.$invalid && submitted">
<span class="alert alert-danger" role="alert" ng-show="validForm.orcTable.$error.required">表空间名不能为空</span>
<span class="alert alert-danger" role="alert" ng-show="validForm.orcTable.$error.pattern">表空间名必须为1-10个字母、数字或下划线</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">表后缀名</label>
<div class="col-sm-10 sj_form_input">
<input class="form-control" type="text" ng-model="tableForm.suffix" name="orcSuffix" ng-pattern="/^\w{2,15}$/" required="required"/>
<div class="form-error" ng-show="validForm.orcSuffix.$invalid && submitted">
<span class="alert alert-danger" role="alert" ng-show="validForm.orcSuffix.$error.required">表后缀名不能为空</span>
<span class="alert alert-danger" role="alert" ng-show="validForm.orcSuffix.$error.pattern">表后缀名必须为1-10个字母、数字或下划线</span>
</div>
</div>
</div>
<div class="form-group" style="margin-left:140px;">
<button class="btn sj_btn_blue" type='submit' style="color:#fff;">
<button class="btn sj_btn_blue" type='submit' style="color:#fff;" >
<span class="glyphicon glyphicon-save "></span> 保存
</button>
<button class="btn sj_btn_grey" ng-click='cancel()'>

View File

@ -1,21 +1,65 @@
<form class="form-horizontal" ng-submit="onSubmit(validForm.$valid)" novalidate="novalidate" name="validForm" ng-init="mode=tableForm">
<div class="form-group">
<label class="col-sm-2 control-label">名称</label>
<div class="col-sm-10">
<input class="form-control " type="text" ng-model="mode.name" id="orcName" ng-minlength="4" ng-maxlength="20">
<span class="glyphicon glyphicon-ok form-control-feedback" ng-show="validForm.orcName.$valid" />
<script type="text/ng-template" id="kubeForm.html">
<form class="form-horizontal" ng-submit="onSubmit(validForm.$valid)" novalidate="novalidate" name="validForm" ng-init="mode=tableForm">
<div class="form-group">
<label class="col-sm-2 control-label">名称</label>
<div class="col-sm-10 sj_form_input">
<input class="form-control " type="text" ng-model="mode.name" id="orcName" ng-minlength="4" ng-maxlength="20" required="required">
<span class="glyphicon glyphicon-ok form-control-feedback" ng-show="validForm.orcName.$valid">请输入长度2-20个字符</span>>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">名称</label>
<div class="col-sm-10">
<input class="form-control" type="text" ng-model="mode.name" id="orcName" ng-minlength="4" ng-maxlength="20">
<span class="glyphicon glyphicon-ok form-control-feedback" ng-show="validForm.orcName.$valid" />
<div class="form-group">
<label class="col-sm-2 control-label">IP</label>
<div class="col-sm-10">
<input class="form-control" type="text" ng-model="mode.ip" id="orcIP" pattern="((?:(?:25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(?:25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d))))">
<span class="glyphicon glyphicon-ok form-control-feedback" ng-show="validForm.orcIP.$valid" />
</div>
</div>
</div>
<div class="form-group">
<button class="btn" type='submit'>
<span class="glyphicon glyphicon-save"></span> 保存
</button>
</div>
</form>
<div class="form-group">
<label class="col-sm-2 control-label">端口号</label>
<div class="col-sm-10">
<input class="form-control" type="text" ng-model="mode.port" id="orcPort" pattern="/^[1-9]$|(^[1-9][0-9]$)|(^[1-9][0-9][0-9]$)|(^[1-9][0-9][0-9][0-9]$)|(^[1-6][0-5][0-5][0-3][0-5]$)/">
<span class="glyphicon glyphicon-ok form-control-feedback" ng-show="validForm.orcPort.$valid">请输入1~65535的端口号</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">用戶名</label>
<div class="col-sm-10">
<input class="form-control" type="text" ng-model="mode.user" id="orcUser" pattern="^[a-z]{2,15}$">
<span class="glyphicon glyphicon-ok form-control-feedback" ng-show="validForm.orcUser.$valid">请输入长度为2~15个字符(a~z)的用户名</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">密码</label>
<div class="col-sm-10">
<input class="form-control" type="text" ng-model="mode.password" id="orcPassword" pattern="^\w{2,15}$">
<span class="glyphicon glyphicon-ok form-control-feedback" ng-show="validForm.orcPassword.$valid">请输入长度为2~15个字符(0~9或a~z)的密码</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">服务名</label>
<div class="col-sm-10">
<input class="form-control" type="text" ng-model="mode.databaseName" id="orcService" pattern="^[a-z]{1,10}$">
<span class="glyphicon glyphicon-ok form-control-feedback" ng-show="validForm.orcService.$valid">请输入长度为2~10个字符(0~9或a~z)的服务名</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">服务名</label>
<div class="col-sm-10">
<input class="form-control" type="text" ng-model="mode.tableName" id="orcTable" pattern="^[a-z]{1,10}$">
<span class="glyphicon glyphicon-ok form-control-feedback" ng-show="validForm.orcTable.$valid">请输入长度为2~10个字符(0~9或a~z)的服务名</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">服务名</label>
<div class="col-sm-10">
<input class="form-control" type="text" ng-model="mode.suffix" id="orcSuffix" pattern="^[a-z]{1,10}$">
<span class="glyphicon glyphicon-ok form-control-feedback" ng-show="validForm.orcSuffix.$valid">请输入长度为2~10个字符(0~9或a~z)的服务名</span>
</div>
</div>
<div class="form-group">
<button class="btn" type='submit'>
<span class="glyphicon glyphicon-save"></span> 保存
</button>
</div>
</form>
</script>

View File

@ -10,7 +10,7 @@
<div hawtio-confirm-dialog="deleteRowOne.show" title="是否删除任务?" ok-button-text="确认" cancel-button-text="取消" on-cancel="deleteRowOne.onCancelled()" on-ok="deleteRowOne.onOk()">
<div class="dialog-body">
<p>
是否删除:{{deleteRowOne.item.name}} 务?
是否删除:{{deleteRowOne.item.name}} 务?
</p>
</div>
</div>
@ -82,7 +82,7 @@
<tr>
<th>&nbsp;</th>
<th>
<button class="sj_btn_blue mr5" ng-click="save(ngDialogData)" ng-disabled="volumeForm.$invalid">保存</button>
<button class="sj_btn_blue mr5" ng-click="save(ngDialogData)" >保存</button>
</th>
<th>
<button class="sj_btn_grey mr5" ng-click="cancel()">取消</button>

View File

@ -24,7 +24,7 @@ module Configs {
return $compile(template)($scope);
});
viewRegistry['config'] = templatePath + "shareLayout.html";
viewRegistry['config'] = templatePath + "shareLayout.html";
}]);
_module.directive('gfsConfigTable', [() =>{

View File

@ -24,4 +24,28 @@ module Configs{
removeElementByValue(array, element.value, element.key);
});
}
/**
*/
export function deepCopy(object) {
var n,i;
if (object instanceof Array) {
n = [];
for (i = 0; i < object.length; ++i) {
n[i] = deepCopy(object[i]);
}
return n;
} else if (object instanceof Object) {
n = {}
for (i in object) {
n[i] = deepCopy(object[i]);
}
return n;
} else {
return object;
}
}
}

View File

@ -8,8 +8,8 @@ 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.model.updateOracleParam();
$scope.submitted = false;
$scope.tableConfig={
data: 'model.oracleParam',
@ -68,37 +68,44 @@ module Configs{
shareInit($scope, $location, $routeParams);
$scope.create = () =>{
$scope.submitted = false;
$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.tableForm = {};
$scope.tableForm["id"]=0;
}
$scope.cancel = () => {
$scope.tableForm =null;
$scope.add = false;
$scope.edit = false;
$scope.submitted = 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.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.$on("editRow", (event, data) =>{
$scope.submitted = false;
$scope.tableForm = deepCopy(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.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) =>{