This commit is contained in:
wu ming 2016-10-14 11:22:49 +08:00
parent fb07b964e8
commit 7183b0bfdd
13 changed files with 201 additions and 118 deletions

View File

@ -18,6 +18,8 @@ declare module Configs {
function createNewObejct(array: Array<any>, obj: any): any[];
function oracleInfoOperate($http: any, url: string, operate: string, resource: any, fn?: (data, status) => void): void;
function createConfigHelperNavBar($scope: any, $location: any, $routeParams: any): any;
function formatVolume(volume: volume): formatedVolume;
function volumesFormat(volumes: Array<volume>): Array<formatedVolume>;
interface formatedVolume {
name: string;
path: string;

View File

@ -60,7 +60,6 @@ declare module Kubernetes {
function isFilterRC(rc: any): boolean;
function isInclude(rcs: any, rc: any): boolean;
function labelChangeToChines(value: string, key: string): string;
function checkForMigration(replicationControllers: Array<KubePod>, selectItem: Array<any>): any[];
function checkForExit(replicationControllers: Array<KubePod>, selectItem: any): boolean;
function checkForCreateOracle(transferTasks: Array<any>, selectItems: Array<any>): any[];
/**
@ -68,4 +67,6 @@ declare module Kubernetes {
**/
function checkForExtract(replicationControllers: Array<any>): any[];
function checkIsStartSuccess(replicationControllers: Array<any>): any[];
function checkForMigration(replicationControllers: Array<KubePod>, transferTasks: Array<any>, selectItem: Array<any>): string;
function eliminateChechBoxClick(): 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",
port: "8080",
hostname: "192.168.191.7",
hostname: "192.168.191.5",
path: '/java/console/api',
targetPath: "/"
}];

View File

@ -29,9 +29,9 @@
<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.name" name="orcName" ng-minlength="2" ng-maxlength="6" required="required"/>
<input class="form-control " type="text" ng-model="tableForm.name" name="orcName" ng-minlength="2" ng-maxlength="20" 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">名称不能为空</span> <span class="alert alert-danger" role="alert" ng-show="validForm.orcName.$invalid">请输入输入2-10个字符的数据名称</span>
<span class="alert alert-danger" role="alert" ng-show="validForm.orcName.$error.required">名称不能为空</span> <span class="alert alert-danger" role="alert" ng-show="!validForm.orcName.$error.required && validForm.orcName.$invalid">请输入输入2-20个字符的数据名称</span>
</div>
</div>
</div>
@ -48,7 +48,7 @@
<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"/>
<input class="form-control" type="text" ng-model="tableForm.port" name="orcPort" ng-pattern="/^([0-9]|[1-9]\d|[1-9]\d{2}|[1-9]\d{3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[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>
@ -61,7 +61,7 @@
<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>
<span class="alert alert-danger" role="alert" ng-show="validForm.orcUser.$error.pattern">用户名必须为2-15个字母、数字或下划线</span>
</div>
</div>
</div>
@ -71,7 +71,7 @@
<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>
<span class="alert alert-danger" role="alert" ng-show="validForm.orcPassword.$error.pattern">密码必须为2-15个字母、数字或下划线</span>
</div>
</div>
</div>
@ -88,17 +88,17 @@
<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"/>
<input class="form-control" type="text" ng-model="tableForm.tableName" name="orcTable" ng-pattern="/^\w{1,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>
<span class="alert alert-danger" role="alert" ng-show="validForm.orcTable.$error.pattern">表空间名必须为1-15个字母、数字或下划线</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"/>
<input class="form-control" type="text" ng-model="tableForm.suffix" name="orcSuffix" ng-pattern="/^\w{1,10}$/" 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>

View File

@ -96,7 +96,7 @@
</tbody>
</table>
<div class="alert alert-warning" role="alert" ng-show="showMessage">"删除存储块失败:集群中至少包含一个存储块!"</div>
<div class="alert alert-warning" role="alert" ng-show="volumeForm.$invalid && submitted">云盘的名称、路径或Ip输入不正确</div>
<div class="alert alert-warning" role="alert" ng-show="volumeForm.$invalid && submitted">云盘的名称、路径或IP输入不正确</div>
</form>
</div>
</script>

View File

@ -137,7 +137,7 @@ module Configs{
]);
}
/*export function formatVolume(volume: volume): formatedVolume{
export function formatVolume(volume: volume): formatedVolume{
var brick:Array<Brick> = [];
angular.forEach(volume.brick, (block:Block) => {
brick.push({
@ -162,7 +162,7 @@ module Configs{
result.push(formatVolume(volume));
});
return result;
}*/
}
export interface formatedVolume{
name: string

View File

@ -61,6 +61,7 @@ module Configs{
onOk: () => {
var showDeleteVolume = $scope.showDeleteVolume;
$timeout(() =>{
console.log(showDeleteVolume.item);
var spinner;
$.ajax({
type: "POST",
@ -68,7 +69,7 @@ module Configs{
timeout: 8000,
dataType: 'json',
//async: false,
data: showDeleteVolume.item,
data: JSON.stringify(showDeleteVolume.item),
contentType: "application/json; charset=utf-8",
beforeSend: () => {
Configs.create_mask(); //创建遮罩层
@ -78,11 +79,11 @@ module Configs{
},
complete: (XMLHttpRequest, textStatus) => {
if(XMLHttpRequest.status == 200){
Kubernetes.createSuccessInfo("../../../new/images/msgbox_success.png", "更新成功!");
Kubernetes.createSuccessInfo("success", "更新成功!");
setTimeout("Kubernetes.removeMask()", 1500);
//$scope.model.updateVolumeData();
}else{
Kubernetes.createSuccessInfo("../../../new/images/msgbox_error.png", "更新失败!");
Kubernetes.createSuccessInfo("error", "更新失败!");
setTimeout("Kubernetes.removeMask()", 1500);
}
},
@ -145,11 +146,11 @@ module Configs{
},
complete: (XMLHttpRequest, textStatus) => {
if(XMLHttpRequest.status == 200){
Kubernetes.createSuccessInfo("../../../new/images/msgbox_success.png", "更新成功!");
Kubernetes.createSuccessInfo("success", "更新成功!");
setTimeout("Kubernetes.removeMask()", 1500);
//$scope.model.updateVolumeData();
}else{
Kubernetes.createSuccessInfo("../../../new/images/msgbox_error.png", "更新失败!");
Kubernetes.createSuccessInfo("error", "更新失败!");
setTimeout("Kubernetes.removeMask()", 1500);
}
},

View File

@ -16,7 +16,7 @@
<p class="alert alert-info">当前没有可以查看的数据.</p>
</div>
<div ng-show="model.data.length">
<table class="table table-striped table-bordered sj_content_table" hawtio-simple-table="tableConfig"></table>
<table class="table table-striped table-bordered sj_content_table" hawtio-simple-table="tableConfig" id="tableConfig"></table>
<div class="row clear">
<div class=" fl">
<!--<input type="checkbox" class="fl mr5 " style="margin-top: 8px;" />
@ -35,7 +35,7 @@
</button>
</div>
<ul class="fr sj_table_bottom">
<li class="mr5 ">当前显示1~7行共7行。</li>
<li class="mr5 ">当前显示1~{{model.data.length}}行,共{{model.data.length}}行。</li>
<li class="mr5 ">每页显示
<select ng-options="value for value in pageSizeChoses" ng-change="selectAction()" ng-model="options.currentTableSize"></select>
</li>

View File

@ -117,9 +117,10 @@ module Developer {
$scope.first = () => {
var idx = $scope.model.getParamOption("currentPageNum");
if(idx >1)
if(idx >1){
$scope.model.updateParamOption("currentPageNum", 1);
}
}
$scope.last = () =>{
var idx = $scope.model.getParamOption("currentPageNum");
@ -138,9 +139,11 @@ module Developer {
$scope.next = () =>{
var length =$scope.options.getPageSizeNum();
var idx = $scope.model.getParamOption("currentPageNum");
if(idx < length)
if(idx < length){
//Kubernetes.eliminateChechBoxClick();
$scope.model.updateParamOption("currentPageNum", idx+1);
}
}
$scope.$watch('options', (newValue, oldValue) => {
if(newValue){
@ -165,11 +168,11 @@ module Developer {
}];
}
/*
使使0使
使
*/
var exitedItems = Kubernetes.checkForMigration($scope.replicasModel.replicationControllers,$scope.tableConfig.selectedItems);
if(exitedItems.length > 0){
Configs.customAlert("提示", "操作失败:正在使用的数据文件不能删除!", '',null, 0, "error");
var message = Kubernetes.checkForMigration($scope.replicasModel.replicationControllers, $scope.model.transferTasks , $scope.tableConfig.selectedItems);
if(message != ""){
Configs.customAlert("提示", "操作失败:" + message + ",不能删除!", '',null, 0, "error");
return;
}
@ -237,30 +240,16 @@ module Developer {
open: (selected) =>{
var migrationClick = $scope.migrationClick;
/*
使使0使
使
*/
var exitedItems = Kubernetes.checkForMigration($scope.replicasModel.replicationControllers,$scope.tableConfig.selectedItems);
/*
*/
var result = [];
angular.forEach($scope.tableConfig.selectedItem, (item) => {
if(item.dataPath == $scope.selectNode["path"])
result.push(item);
});
/*
*/
if(exitedItems.length == 0 && result.length == 0){
var message = Kubernetes.checkForMigration($scope.replicasModel.replicationControllers, $scope.model.transferTasks , $scope.tableConfig.selectedItems);
if(message == ""){
if($scope.volumes && $scope.volumes instanceof Array && $scope.volumes.length >0)
migrationClick.selectedItem = $scope.volumes[0];
migrationClick.dialog.open();
}else if(exitedItems.length == 0 && result.length >0){ //任何数据文件都未被挂载使用,当有部分数据文件已存在所选迁移目录
Configs.customAlert("提示", "操作失败: 部分数据文件已在当前目录存在!", '',null, 0, "error");
}else if(exitedItems.length > 0 && result.length == 0){
Configs.customAlert("提示", "操作失败:正在使用的数据文件不能被迁移!", '',null, 0, "error");
}else{
Configs.customAlert("提示", "操作失败:部分数据文件正被使用且有部分数据文件已在当前目录存在", '',null, 0, "error");
Configs.customAlert("提示", "操作失败:" + message + ", 不能迁移!", '',null, 0, "error");
}
},
close: () => {
@ -306,7 +295,6 @@ module Developer {
angular.forEach(exitedItems, (item) => {
name += item.name + "-" + item.systemName + ",";
});
console.log(exitedItems);
Configs.customAlert("提示", "操作失败: 正在迁移的数据不能被启动!", '', null, 0, "error");
}
}

View File

@ -1851,12 +1851,12 @@ module Kubernetes {
complete: (XMLHttpRequest, textStatus) => {
if(XMLHttpRequest.status == 200){
//spinner.spin();
Kubernetes.createSuccessInfo("../../../new/images/msgbox_success.png", "连接汇总库成功,即将执行汇总操作!");
Kubernetes.createSuccessInfo("succes", "连接汇总库成功,即将执行汇总操作!");
setTimeout("Kubernetes.removeMask()", 1500);
}
else{
//spinner.spin();
Kubernetes.createSuccessInfo("../../../new/images/msgbox_error.png", "连接汇总库失败,请检查服务集群中的汇总库配置是否正确!");
Kubernetes.createSuccessInfo("error", "连接汇总库失败,请检查服务集群中的汇总库配置是否正确!");
setTimeout("Kubernetes.removeMask()", 1500);
}
}
@ -1928,22 +1928,23 @@ module Kubernetes {
export function createSuccessInfo(icon:string, msg:string){
$("#load").remove();
var tmp = "<div class=\"load-result\" ><img src=\""
Configs.customAlert("提示", msg, '',null, 0, icon);
/*var tmp = "<div class=\"load-result\" ><img src=\""
+ icon + "\" class=\"custom-alert-img\"></div>"
+ "<span class=\"load-result-msg\">" + msg +"</span>";
var result = document.createElement("div");
result.id = "exe_result";
result.innerHTML = tmp;
document.body.appendChild(result);
document.body.appendChild(result);*/
}
export function removeMask(){
var mask = document.getElementById("mask");
var result = document.getElementById("exe_result");
if(null == mask && null == result)
//var result = document.getElementById("exe_result");
if(null == mask)
return;
document.body.removeChild(mask);
document.body.removeChild(result);
//document.body.removeChild(result);
}
}

View File

@ -118,7 +118,7 @@ module Kubernetes {
item: null,
open: (entity) => {
if(entity.status == 1)
alert("无法删除正在迁移的数据");
Configs.customAlert("提示", "操作失败: 正在迁移的任务,不能迁移!", '',null, 0, "error");
else{
var showDeleteOne = $scope.showDeleteOne;
showDeleteOne.show = true;

View File

@ -242,7 +242,7 @@ module Kubernetes {
/*
,oracle
*/
export function checkForMigration(replicationControllers:Array<KubePod>, selectItem:Array<any>){
var result = [];
angular.forEach(selectItem, (item) => {
@ -250,7 +250,7 @@ module Kubernetes {
result.push(item);
});
return result;
}
} */
export function checkForExit(replicationControllers:Array<KubePod>, selectItem){
for(var index in replicationControllers) {
@ -311,5 +311,45 @@ module Kubernetes {
result.push(replicas);
});
return result;
};
/*
使
*/
export function checkForMigration(replicationControllers:Array<KubePod>, transferTasks: Array<any>, selectItem:Array<any>){
var message = "";
for (var index in selectItem) {
var item = selectItem[index];
/*
使
*/
for (var i in replicationControllers) {
var labels = getLabels(replicationControllers[i]);
if(getName(replicationControllers[i]) == item._key && getAnnotationValueBykey(replicationControllers[i],"year") == item["year"] && labels.version == item.labels.version){
message = "数据正在使用";
return message;
}
}
/*
*/
for(i in transferTasks){
if(transferTasks[i]["_key"] == item["_key"] && (transferTasks[i]["status"] == "1" || transferTasks[i]["status"] == "0") && item["year"] == transferTasks[i].labels.dataYear && item.labels.version == transferTasks[i].labels.dataVersion){
message = "数据正在迁移"
return message;
}
}
}
return message;
}
export function eliminateChechBoxClick(){
console.log($("#tableConfig thead tr td input:checkbox"));
if($("#tableConfig thead tr td input:checkbox").is(':checked')){
}
}
}