功能完善
This commit is contained in:
parent
091edca9cc
commit
7268a3f121
|
@ -1,4 +1,5 @@
|
|||
/// <reference path="../../includes.d.ts" />
|
||||
/// <reference path="kubernetesHelpers.d.ts" />
|
||||
declare module Kubernetes {
|
||||
var hostPorts: any[];
|
||||
/**
|
||||
|
@ -59,4 +60,10 @@ 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 checkForCreateOracle(transferTasks: Array<any>, selectItems: Array<any>): any[];
|
||||
/**
|
||||
|
||||
**/
|
||||
function checkForExtract(replicationControllers: Array<any>): any[];
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -248,8 +248,8 @@ gulp.task('connect', ['watch'], function() {
|
|||
targetPath: '/hawtio/git'
|
||||
}, {
|
||||
proto: "http",
|
||||
port: "8080",
|
||||
hostname: "192.168.191.5",
|
||||
port: "8088",
|
||||
hostname: "192.168.0.110",
|
||||
path: '/java/console/api',
|
||||
targetPath: "/"
|
||||
}];
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
<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 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 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>
|
|
@ -35,14 +35,14 @@
|
|||
<th ng-show="ngDialogData.status" class="new_left sj_c_green">启用</th>
|
||||
<th ng-hide="ngDialogData.status" class="new_left sj_c_green">停止</th>
|
||||
<th colspan="10">
|
||||
<input type="text" class="sj_txt_box03 mr10" ng-model="ngDialogData.name " pattern="^\w{4,20}$" ng-disabled="!{{ngDialogData.editable}}" />
|
||||
<input type="text" class="sj_txt_box03 mr10" ng-model="ngDialogData.name " ng-disabled="!{{ngDialogData.editable}}" />
|
||||
</th>
|
||||
<th>云目录:</th>
|
||||
<th>
|
||||
<input type="text" class="sj_txt_box02 mr5" ng-model="ngDialogData.path" ng-disabled="!{{ngDialogData.editable}}" />
|
||||
</th>
|
||||
<th>
|
||||
<button ng-show="ngDialogData.status" class="sj_btn_red fl" ng-click="stopVolume(ngDialogData)">停止</button>
|
||||
<button ng-show="ngDialogData.status" class="sj_btn_blue fl" ng-click="stopVolume(ngDialogData)">停止</button>
|
||||
<button ng-hide="ngDialogData.status" class="sj_btn_red fl" ng-click="startVolume(ngDialogData)">启动</button>
|
||||
</th>
|
||||
</tr>
|
||||
|
|
|
@ -75,22 +75,5 @@ module Configs{
|
|||
showDeleteVolume.item = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* (volume) =>{
|
||||
$http({
|
||||
url: "/java/console/api/volume/delete",
|
||||
method: 'POST',
|
||||
data: volume
|
||||
}).success(function(data,header,config,status){
|
||||
/*
|
||||
|
||||
更新volume信息
|
||||
|
||||
|
||||
}).error(function(data,header,config,status){
|
||||
|
||||
});
|
||||
}*/
|
||||
}]);
|
||||
}
|
|
@ -64,14 +64,10 @@ module Developer {
|
|||
|
||||
|
||||
$scope.$on("deleteRow", (event, data) =>{
|
||||
if(data.status == 1)
|
||||
alert("无法删除正在迁移的数据");
|
||||
else{
|
||||
Configs.oracleInfoOperate($http, "/java/console/api/task/transfer", Configs.OperateType.DELETE, data, (data, status) =>{
|
||||
if(status === 200)
|
||||
console.log("删除成功");
|
||||
});
|
||||
}
|
||||
});
|
||||
}]);
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ module Developer {
|
|||
export var WorkspacesController = controller("WorkspacesController", ["$scope", "KubernetesModel", "DataModel", "ConfigsModel", "KubernetesState", "$templateCache", "$location", "$routeParams", "$http", "$timeout", "KubernetesApiURL", "$element",
|
||||
($scope, KubernetesModel: Kubernetes.KubernetesModelService, DataModel:Developer.DataModelService, ConfigsModel:Configs.ConfigsModelService, KubernetesState, $templateCache:ng.ITemplateCacheService, $location:ng.ILocationService, $routeParams, $http, $timeout, KubernetesApiURL, $element) => {
|
||||
$scope.model=DataModel;
|
||||
$scope.replicasModel = KubernetesModel;
|
||||
init($scope, $location, $routeParams);
|
||||
$scope.options = DataModel.paramOptions;
|
||||
$scope.pageSizeChoses = DataModel.paramOptions.pagerSizeOption;
|
||||
|
@ -193,6 +194,8 @@ module Developer {
|
|||
dialog: new UI.Dialog(),
|
||||
onOk: () => {
|
||||
var migrationClick = $scope.migrationClick;
|
||||
var exitedItems = Kubernetes.checkForMigration($scope.replicasModel.replicationControllers,$scope.tableConfig.selectedItems);
|
||||
if(exitedItems.length == 0){
|
||||
Configs.oracleInfoOperate($http, "/java/console/api/volume", Configs.OperateType.MOVE,
|
||||
{
|
||||
"name": migrationClick.selectedItem.name,
|
||||
|
@ -209,6 +212,13 @@ module Developer {
|
|||
$location.path("/workspaces/Overview/task");
|
||||
},250);
|
||||
migrationClick.close();
|
||||
}else{
|
||||
var name = "";
|
||||
angular.forEach(exitedItems, (item) => {
|
||||
name += item.name + "-" + item.systemName + ",";
|
||||
})
|
||||
alert("迁移数据文件失败:" + name +"数据文件正在使用....");
|
||||
}
|
||||
},
|
||||
open: (selected) =>{
|
||||
var migrationClick = $scope.migrationClick;
|
||||
|
@ -223,6 +233,8 @@ module Developer {
|
|||
};
|
||||
|
||||
$scope.createOracleService = (items) =>{
|
||||
var exitedItems = Kubernetes.checkForCreateOracle($scope.model.transferTasks, items);
|
||||
if(exitedItems.length == 0){
|
||||
angular.forEach(items,(item)=>{
|
||||
Kubernetes.createRC({
|
||||
name: item._key,
|
||||
|
@ -235,7 +247,8 @@ module Developer {
|
|||
cityName: item.cityName,
|
||||
districtName: item.districtName,
|
||||
systemName: item.systemName,
|
||||
id: item.id+""
|
||||
id: item.id+"",
|
||||
year: item.year
|
||||
},
|
||||
path: item.dataPath+"app/",
|
||||
isTarget: "false",
|
||||
|
@ -248,6 +261,13 @@ module Developer {
|
|||
$timeout(() => {
|
||||
$location.path('/kubernetes/namespace/default/replicationControllers');
|
||||
}, 200);
|
||||
}else{
|
||||
var name = "";
|
||||
angular.forEach(exitedItems, (item) => {
|
||||
name += item.name + "-" + item.systemName + ",";
|
||||
})
|
||||
alert("迁移数据文件失败:" + name +"数据文件正在使用....");
|
||||
}
|
||||
}
|
||||
|
||||
function init($scope,$location,$routeParams){
|
||||
|
|
|
@ -74,6 +74,8 @@ module Kubernetes {
|
|||
id: selected
|
||||
}];
|
||||
}
|
||||
var extractItems = checkForExtract(selected);
|
||||
if(extractItems.length == 0){
|
||||
UI.multiItemConfirmActionDialog(<UI.MultiItemConfirmActionOptions>{
|
||||
collection: selected,
|
||||
index: 'metadata.name',
|
||||
|
@ -108,6 +110,13 @@ module Kubernetes {
|
|||
cancelText: "取消",
|
||||
cancelClass: 'sj_btn_grey'
|
||||
}).open();
|
||||
}else{
|
||||
var name = "";
|
||||
angular.forEach(extractItems, (item) => {
|
||||
name += item.$oracleName + ",";
|
||||
})
|
||||
alert("删除服务失败:" + name + "服务正在执行汇总操作,不能被删除");
|
||||
}
|
||||
}
|
||||
|
||||
$scope.createRCs= () => {
|
||||
|
@ -129,7 +138,8 @@ module Kubernetes {
|
|||
id: selected
|
||||
}];
|
||||
}
|
||||
|
||||
var extractItems = checkForExtract(selected);
|
||||
if(extractItems.length == 0){
|
||||
UI.multiItemConfirmActionDialog(<UI.MultiItemConfirmActionOptions>{
|
||||
collection: selected,
|
||||
index: 'metadata.name',
|
||||
|
@ -157,6 +167,13 @@ module Kubernetes {
|
|||
cancelText: "取消",
|
||||
cancelClass: 'sj_btn_grey'
|
||||
}).open();
|
||||
}else{
|
||||
var name = "";
|
||||
angular.forEach(extractItems, (item) => {
|
||||
name += item.$oracleName + ",";
|
||||
})
|
||||
alert("停止服务失败:" + name + "服务正在执行汇总操作,不能停止");
|
||||
}
|
||||
};
|
||||
|
||||
$scope.reStartPrompt = (selected) => {
|
||||
|
|
|
@ -118,9 +118,13 @@ module Kubernetes {
|
|||
show: false,
|
||||
item: null,
|
||||
open: (entity) => {
|
||||
if(entity.status == 1)
|
||||
alert("无法删除正在迁移的数据");
|
||||
else{
|
||||
var showDeleteOne = $scope.showDeleteOne;
|
||||
showDeleteOne.show = true;
|
||||
showDeleteOne.item = entity;
|
||||
}
|
||||
},
|
||||
onOk: () => {
|
||||
var showDeleteOne = $scope.showDeleteOne;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/// <reference path="../../includes.ts"/>
|
||||
/// <reference path="./kubernetesHelpers.ts"/>
|
||||
module Kubernetes {
|
||||
export var hostPorts =[];
|
||||
|
||||
|
@ -238,4 +239,67 @@ module Kubernetes {
|
|||
}
|
||||
return trueValue;
|
||||
}
|
||||
|
||||
/*
|
||||
检查迁移,是否有已启动的oracle
|
||||
*/
|
||||
export function checkForMigration(replicationControllers:Array<KubePod>, selectItem:Array<any>){
|
||||
var result = [];
|
||||
angular.forEach(selectItem, (item) => {
|
||||
if(checkForExit(replicationControllers, item))
|
||||
result.push(item);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
function checkForExit(replicationControllers:Array<KubePod>, selectItem){
|
||||
for(var index in replicationControllers) {
|
||||
var replicas = replicationControllers[index];
|
||||
if(getName(replicas)==selectItem._key && getAnnotationValueBykey(replicas,"year") == selectItem["year"])
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function getAnnotationValueBykey(replicationController, key:string){
|
||||
var annotations = getAnnotations(replicationController);
|
||||
if(annotations && annotations != undefined){
|
||||
return annotations[key];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
启动oracle时检查是否正在迁移
|
||||
*/
|
||||
export function checkForCreateOracle(transferTasks:Array<any>, selectItems:Array<any>){
|
||||
var result = [];
|
||||
angular.forEach(selectItems, (item) => {
|
||||
if(checkForExitTask(transferTasks, item))
|
||||
result.push(item);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
function checkForExitTask(transferTasks:Array<any>, selectItem){
|
||||
for(var index in transferTasks){
|
||||
var task = transferTasks[index];
|
||||
if(task["_key"] == selectItem["_key"] && (task["status"] == "1" || task["status"] == "0") && selectItem["year"] == task.labels.dataYear){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
**/
|
||||
export function checkForExtract(replicationControllers: Array<any>){
|
||||
var result = [];
|
||||
angular.forEach(replicationControllers, (replicas) => {
|
||||
var labels = getLabels(replicas);
|
||||
if(labels["isExtract"] == "1")
|
||||
result.push(replicas);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue