添加汇总时,判断汇总是否连接成

This commit is contained in:
wu ming 2016-10-11 08:50:52 +08:00
parent e7114cb8f1
commit 31cf574a6d
24 changed files with 964 additions and 330 deletions

View File

@ -7,6 +7,7 @@
/// <reference path="dataManagerHelper.d.ts" />
/// <reference path="dataManagerModel.d.ts" />
/// <reference path="../../configs/ts/ConfigsHelper.d.ts" />
/// <reference path="../../configs/ts/customAlert.d.ts" />
declare module Developer {
var WorkspacesController: ng.IModule;
}

View File

@ -1,6 +1,7 @@
/// <reference path="../../includes.d.ts" />
/// <reference path="kubernetesInterfaces.d.ts" />
/// <reference path="utilHelpers.d.ts" />
/// <reference path="../../configs/ts/customAlert.d.ts" />
/// <reference path="readPlacedivision.d.ts" />
/// <reference path="../../configs/ts/ConfigsHelper.d.ts" />
declare module Kubernetes {
@ -211,7 +212,9 @@ declare module Kubernetes {
function getOracleStatus(labels: any): number;
function getExtractStatus(labels: any): number;
function getOracleName(name: string): string;
function extractDataToOracle($http: any, selectedReplicationControllers: any, targetOracle: Configs.oracleParam): void;
function extractDataToOracle($http: any, selectedReplicationControllers: any, targetOracle: Configs.oracleParam, fn?: (data, status) => void): void;
function checkoutOracleIsRunning(rc: any): boolean;
function replicasIsCreated(replicationcontrollers: Array<any>, name: string): boolean;
function createSuccessInfo(icon: string, msg: string): void;
function removeMask(): void;
}

View File

@ -2,6 +2,7 @@
/// <reference path="kubernetesHelpers.d.ts" />
/// <reference path="kubernetesPlugin.d.ts" />
/// <reference path="kubernetesModel.d.ts" />
/// <reference path="../../configs/ts/customAlert.d.ts" />
declare module Kubernetes {
var ReplicationControllers: ng.IModule;
}

View File

@ -7,4 +7,5 @@ declare module Kubernetes {
var Labels: ng.IModule;
var Status: ng.IModule;
var TaskEdit: ng.IModule;
var LoadMask: ng.IModule;
}

View File

@ -67,4 +67,5 @@ declare module Kubernetes {
**/
function checkForExtract(replicationControllers: Array<any>): any[];
function checkIsStartSuccess(replicationControllers: Array<any>): any[];
}

3
defs.d.ts vendored
View File

@ -4,6 +4,7 @@
/// <reference path="d.ts/developer/ts/developerNavigation.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/kubernetesInterfaces.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/utilHelpers.d.ts"/>
/// <reference path="d.ts/configs/ts/customAlert.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/readPlacedivision.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/kubernetesHelpers.d.ts"/>
/// <reference path="d.ts/developer/ts/developerHelpers.d.ts"/>
@ -38,7 +39,6 @@
/// <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"/>
/// <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"/>
@ -79,3 +79,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/navigation/ts/navigationPlugin.d.ts"/>

View File

@ -206,6 +206,71 @@ legend {
.badge-remind {
background-color: Red;
}
.custom-alert {
width: 300px;
border: 2px solid #37B6D1;
background-color: #fff;
font-weight: bold;
font-size: 12px;
}
.custom-alert-title {
line-height: 25px;
padding: 0px 5px;
background-color: #37B6D1;
}
.custom-alert-body {
cellspacing: 0;
border: 0;
}
.custom-alert-td {
padding: 0px 0px 0px 20;
}
.custom-alert-img {
width: 64;
height: 64;
}
.custom-alert-content {
background-color: #fff;
font-weight: bold;
font-size: 12px;
padding: 20px 0px;
text-align: left;
}
.custom-alert-bottom {
text-align: center;
padding: 0px 0px 20px;
background-color: #fff;
}
.custom-alert-ok {
border: 1px solid #CCC;
background-color: #CCC;
width: 50px;
height: 25px;
}
.custom-alert-cancel {
border: 1px solid #CCC;
background-color: #CCC;
width: 50px;
height: 25px;
}
.load-result {
z-index: 1000000002;
top: 40%;
position: absolute;
left: 47.5%;
}
.load-result-msg {
z-index: 1000000002;
top: 48%;
position: absolute;
left: 41.5%;
}
.load-effect-msg {
position: absolute;
z-index: 1000000002;
left: 47.5%;
top: 48%;
}
.environment-row a {
color: black;

File diff suppressed because one or more lines are too long

View File

@ -248,8 +248,8 @@ gulp.task('connect', ['watch'], function() {
targetPath: '/hawtio/git'
}, {
proto: "http",
port: "8088",
hostname: "192.168.0.110",
port: "8080",
hostname: "192.168.191.5",
path: '/java/console/api',
targetPath: "/"
}];

View File

@ -29,10 +29,11 @@
<link rel="stylesheet" type="text/css" href="libs/angular-tree-control/css/tree-control-attribute.css">
<link rel="stylesheet" type="text/css" href="libs/angular-tree-control/css/tree-control.css">
<link rel="stylesheet" href="dist/hawtio-kubernetes.css" />
<link rel="stylesheet" type="text/css" href="new/sj_style.css">
<!-- ng-table-->
<link rel="stylesheet" href="libs/ng-table/dist/ng-table.min.css">
<link rel="stylesheet" type="text/css" href="new/sj_style.css">
<!-- ng-table -->
<link rel="stylesheet" href="libs/ng-table/dist/ng-table.min.css">
<!-- spin.js -->
<script src="libs/spin.js/spin.js"></script>
<!-- bower:js -->
<script src="libs/jquery/dist/jquery.js"></script>
<script src="libs/angular/angular.js"></script>
@ -100,9 +101,8 @@
<script type="text/javascript" src="libs/codemirror/mode/properties/properties.js"></script>
<script type="text/javascript" src="libs/codemirror/mode/clike/clike.js"></script>
<script type="text/javascript" src="libs/codemirror/mode/yaml/yaml.js"></script>
<!-- ng-table-->
<script type="text/javascript" src="libs/ng-table/dist/ng-table.js"></script>
<!-- ng-table-->
<script type="text/javascript" src="libs/ng-table/dist/ng-table.js"></script>
<!-- link for js when using the tree as -->
<script type="text/javascript" src="libs/angular-tree-control/angular-tree-control.js"></script>
<script src="libs/bootstrap/dist/js/bootstrap.js"></script>
@ -110,19 +110,17 @@
<script src="libs/hawtio-extension-service/dist/hawtio-extension-service.js"></script>
<script src="libs/hawtio-preferences/dist/hawtio-preferences.js"></script>
<!-- NOTE we need to make sure this is loaded much later than d3.js! -->
<script src="libs/nvd3/build/nv.d3.js"></script>
<script src="libs/nvd3/build/nv.d3.js"></script>
<style>
.navbar-brand > img {
height: 20px;
margin-top: -5px;
margin-bottom: -5px;
}
body {
/*body {
/* overwrite a top-padding from site-base.css in hawtio-ui */
padding-top: inherit;
}
/* padding-top: inherit;
}*/
.breadcrumb {
/* overwrite the bottom padding from pf's breadcrumb class */
@ -140,7 +138,7 @@
</style>
</head>
<body>
<body id="body">
<nav class="navbar navbar-fixed-top navbar-pf sj_header " role="navigation">
<a href="/" class="log fl sj_logo"><img src="new/images/logo.png" class="log-img"></a>
<ul class="nav navbar-nav navbar-primary sj_topnav " hawtio-main-nav></ul>
@ -148,7 +146,7 @@
<li class="">
<a href="/config/regionalism-code/searching" class="dropdown-toggle" data-toggle="dropdown">
<span class="glyphicon glyphicon-search"></span> 帮助
</a>
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
@ -159,15 +157,15 @@
</li>
</ul>
</nav>
<div class="sj_content_position clear" style="margin-top:70px;">
<ul >
<li class="sj_icons_home"></li>
<li>当前位置:</li>
<li><a href="#">数据汇总</a> <span>&gt;</span></li>
<li><a href="#">社保系统</a><span>&gt;</span></li>
<li><a href="#">批次A</a></li>
</ul>
</div>
<div class="sj_content_position clear" style="margin-top:70px;">
<ul>
<li class="sj_icons_home"></li>
<li>当前位置:</li>
<li><a href="#">数据汇总</a> <span>&gt;</span></li>
<li><a href="#">社保系统</a><span>&gt;</span></li>
<li><a href="#">批次A</a></li>
</ul>
</div>
<platform-sub-tabs-outlet></platform-sub-tabs-outlet>
<div id="main" class="container-fluid container-pf-nav-pf-vertical container-pf-nav-pf-vertical-with-secondary content-margin" ng-controller="HawtioNav.ViewController" hawtio-main-outlet>
<div class="row" ng-class="getClass()">
@ -179,6 +177,18 @@
</div>
</div>
<script src="dist/hawtio-kubernetes.js"></script>
<script type="text/javascript">
var screenHeight = $(window).height();
var screenWidth = $(window).width();
$("#body").css("height", screenHeight);
$("#body").css("width", screenWidth);
$(window).resize(function(){
var screenWidth = $(window).width();
var newHeight = $(window).height();
$("#body").css("height", newHeight);
$("#body").css("width", screenWidth);
});
</script>
</body>
</html>

View File

@ -5,6 +5,7 @@
<div class="row">
<div hawtio-tabs></div>
</div>
<div class="container-content sj_content">
<div class="row">
<div class="mb10">

View File

@ -5,7 +5,8 @@
<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>

View File

@ -16,6 +16,7 @@
</div>
</div>
</script>
<script type="text/ng-template" id="connectStatus.html">
<div class="ngCellText" ng-init="entity=row.entity">
<div ng-show="true" title="汇总库的连接状态">
@ -26,22 +27,21 @@
</div>
</div>
</script>
<script type="text/ng-template" id="newDialog.html">
<div class="sj_new_box">
<form name="volumeForm" class=" mb10" novalidate="novalidate">
<form name="volumeForm" class=" mb10" novalidate="novalidate">
<table class="sj_new_table clear">
<tbody>
<tr>
<tr>
<th class="new_left">云盘名</th>
<th colspan="10">
<input type="text" class="sj_txt_box03 mr10" name="volumeName" ng-model="ngDialogData.name " ng-disabled="!{{ngDialogData.editable}}" ng-pattern="/^\w{2,15}$/" required="required"/>
<input type="text" class="sj_txt_box03 mr10" name="volumeName" ng-model="ngDialogData.name " ng-disabled="!{{ngDialogData.editable}}" ng-pattern="/^\w{2,15}$/" required="required" />
</th>
<th>云目录:</th>
<th>
<input type="text" class="sj_txt_box02 mr5" name="volumePath" ng-model="ngDialogData.path" ng-disabled="!{{ngDialogData.editable}}" ng-pattern="/^(\/[a-z0-9A-Z _\-.%]+)+$/" required="required"/>
<input type="text" class="sj_txt_box02 mr5" name="volumePath" ng-model="ngDialogData.path" ng-disabled="!{{ngDialogData.editable}}" ng-pattern="/^(\/[a-z0-9A-Z _\-.%]+)+$/" required="required" />
</th>
<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>
<button ng-show="ngDialogData.status" class="sj_btn_red fl" ng-click="stopVolume(ngDialogData)">停止</button>
<button ng-hide="ngDialogData.status" class="sj_btn_blue fl" ng-click="startVolume(ngDialogData)">启动</button>
@ -50,44 +50,44 @@
<tr ng-repeat="row in ngDialogData.brick">
<th class="new_left">
<span ng-show="row.status" class="sj_icon_ok"></span>
<span ng-hide="row.status" class="sj_icon_warning">
<span ng-hide="row.status" class="sj_icon_warning"></span>
</th>
<th colspan="3">
<input type="text" class="sj_txt_box04 mr5" value="服务器 {{$index + 1}} " ng-disabled="true" />
<input type="text" class="sj_txt_box04 mr5" value="服务器 {{$index + 1}} " ng-disabled="true" />
</th>
<th>
<input type="text" class="sj_txt_box05" ng-model="row.ip[0]" name="brickIp0" ng-disabled="!{{row.editable}}" ng-pattern="/^(([0-9]|([1-9]\d)|(1\d\d)|(2([0-4]\d|5[0-5]))))$/" required="required"/>
<input type="text" class="sj_txt_box05" ng-model="row.ip[0]" name="brickIp0" ng-disabled="!{{row.editable}}" ng-pattern="/^(([0-9]|([1-9]\d)|(1\d\d)|(2([0-4]\d|5[0-5]))))$/" required="required" />
</th>
<th>.</th>
<th>
<input type="text" class="sj_txt_box05" ng-model="row.ip[1]" name="brickIp1" ng-disabled="!{{row.editable}}" ng-pattern="/^(([0-9]|([1-9]\d)|(1\d\d)|(2([0-4]\d|5[0-5]))))$/" required="required"/>
<input type="text" class="sj_txt_box05" ng-model="row.ip[1]" name="brickIp1" ng-disabled="!{{row.editable}}" ng-pattern="/^(([0-9]|([1-9]\d)|(1\d\d)|(2([0-4]\d|5[0-5]))))$/" required="required" />
</th>
<th>.</th>
<th>
<input type="text" class="sj_txt_box05" ng-model="row.ip[2]" name="brickIp2" ng-disabled="!{{row.editable}}" ng-pattern="/^(([0-9]|([1-9]\d)|(1\d\d)|(2([0-4]\d|5[0-5]))))$/" required="required"/>
<input type="text" class="sj_txt_box05" ng-model="row.ip[2]" name="brickIp2" ng-disabled="!{{row.editable}}" ng-pattern="/^(([0-9]|([1-9]\d)|(1\d\d)|(2([0-4]\d|5[0-5]))))$/" required="required" />
</th>
<th>.</th>
<th>
<input type="text" class="sj_txt_box05 mr10" ng-model="row.ip[3]" name="brickIp3" ng-disabled="!{{row.editable}}" ng-pattern="/^(([0-9]|([1-9]\d)|(1\d\d)|(2([0-4]\d|5[0-5]))))$/" required="required"/>
<input type="text" class="sj_txt_box05 mr10" ng-model="row.ip[3]" name="brickIp3" ng-disabled="!{{row.editable}}" ng-pattern="/^(([0-9]|([1-9]\d)|(1\d\d)|(2([0-4]\d|5[0-5]))))$/" required="required" />
</th>
<th>存储块:</th>
<th>
<input type="text" class="sj_txt_box02 mr5" ng-model="row.path" name="brickPath" ng-disabled="!{{row.editable}}" ng-pattern="/^(\/[a-z0-9A-Z \-_.%]+)+$/" required="required"/>
<input type="text" class="sj_txt_box02 mr5" ng-model="row.path" name="brickPath" ng-disabled="!{{row.editable}}" ng-pattern="/^(\/[a-z0-9A-Z \-_.%]+)+$/" required="required" />
</th>
<th>
<!--<button class="sj_btn_grey fl">连接</button>-->
<a href="#" class="sj_icon_del ml5 fl" ng-show="ngDialogData.brick.length>1" ng-click="deleteBrock(ngDialogData, row)"></a>
<a href="#" ng-hide ="$index < ngDialogData.brick.length-1" class="sj_icon_add ml5 fl" ng-click="addBrock(ngDialogData)"></a>
<a href="#" ng-hide="$index < ngDialogData.brick.length-1" class="sj_icon_add ml5 fl" ng-click="addBrock(ngDialogData)"></a>
</th>
</tr>
</tr>
<tr>
<th>&nbsp;</th>
<th>
<button class="sj_btn_blue mr5" ng-click="onSubmit(ngDialogData)" >保存</button>
<button class="sj_btn_blue mr5" ng-click="onSubmit(ngDialogData)">保存</button>
</th>
<th>
<button class="sj_btn_grey mr5" ng-click="cancel()">取消</button>
</th>
</th>
<!--<th>
<button class="sj_btn_grey mr5" ng-click="cancel()">取消</button>
</th>
@ -96,10 +96,11 @@
</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>
<div ng-controller="Kubernetes.TopLevel">
<div class="wiki-icon-view" ng-controller="Kubernetes.FileDropController" nv-file-drop nv-file-over uploader="uploader" over-class="ready-drop">
<div class="row kubernetes-view" ng-view></div>

View File

@ -59,7 +59,20 @@ module Configs{
}
export function shareInit($scope, $location, $routeParams){
$scope. subTabConfig = Developer.createCurrentSubNavBar($scope, $location, $routeParams);
$scope. subTabConfig = Developer.createCurrentSubNavBar($scope, $location, $routeParams);
$scope.mask = true;
/**
*/
$("#mask").css("position", "absolute");
$("#mask").css("background", "black");
$("#mask").css("opacity", 0.4);
$("#mask").css("filter", "progid:DXImageTransform.Microsoft.Alpha(style=4,opacity=25)");
$("#mask").css("top", "0px");
$("#mask").css("left", "0px");
$("#mask").css("width", document.body.clientWidth + document.body.scrollLeft);
$("#mask").css("height", document.body.clientHeight + document.body.scrollTop);
$("#mask").css("zIndex", 1000);
}
export function createNewObejct(array:Array<any>, obj){

View File

@ -19,6 +19,7 @@ module Configs{
controller:'Configs.VolumeController',
width: 1005,
scope: $scope,
closeByDocument : false,
data: {
name: '',
path: '',
@ -43,7 +44,8 @@ module Configs{
data: fVolume,
scope: $scope,
className: 'ngdialog-theme-default',
controller: 'Configs.VolumeController'
controller: 'Configs.VolumeController',
closeByDocument : false
});
}
@ -86,18 +88,36 @@ module Configs{
ip.push(brick["ip"][key]);
brick["ip"] = ip.join("\.");
}
});
});
$.ajax({
type: "POST",
url: "/java/console/api/volume/update",
timeout: 8000,
dataType: 'json',
//async: false,
data: JSON.stringify(data),
contentType: "application/json; charset=utf-8",
beforeSend: () => {
},
complete: (XMLHttpRequest, textStatus) => {
if(XMLHttpRequest.status == 200)
console.log("成功");
else
console.log("失败");
}
});
$http({
/*$http({
url: "/java/console/api/volume/update",
method: 'POST',
data: data
}).success(function(data,header,config,status){
$scope.model.updateVolumeData();
console.log("更新了");
$scope.model.updateVolumeData();
}).error(function(data,header,config,status){
});
});*/
});
}]);
}

View File

@ -3,7 +3,7 @@
/// <reference path="../../kubernetes/ts/kubernetesHelpers.ts"/>
module Developer {
export var _module = angular.module(pluginName, ['hawtio-core', 'hawtio-ui', 'ui.codemirror', 'nvd3', 'treeControl']);
export var _module = angular.module(pluginName, ['hawtio-core', 'hawtio-ui', 'ui.codemirror', 'nvd3', 'treeControl', 'ngDialog']);
export var controller = PluginHelpers.createControllerFunction(_module, pluginName);
export var route = PluginHelpers.createRoutingFunction(templatePath);
@ -21,6 +21,7 @@ module Developer {
log.debug("Running");
viewRegistry['workspaces'] = Kubernetes.templatePath + 'layoutKubernetes.html';
viewRegistry['namespaces'] = Kubernetes.templatePath + 'layoutKubernetes.html';
// viewRegistry['workspaces'] = Configs.templatePath + 'shareLayout.html';
var builder = HawtioNav.builder();

View File

@ -7,10 +7,11 @@
/// <reference path="dataManagerHelper.ts"/>
/// <reference path="dataManagerModel.ts"/>
/// <reference path="../../configs/ts/configsHelper.ts"/>
/// <reference path="../../configs/ts/customAlert.ts"/>
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) => {
export var WorkspacesController = controller("WorkspacesController", ["$scope", "KubernetesModel", "DataModel", "ConfigsModel", "KubernetesState", "$templateCache", "$location", "$routeParams", "$http", "$timeout", "KubernetesApiURL", "$element", "ngDialog",
($scope, KubernetesModel: Kubernetes.KubernetesModelService, DataModel:Developer.DataModelService, ConfigsModel:Configs.ConfigsModelService, KubernetesState, $templateCache:ng.ITemplateCacheService, $location:ng.ILocationService, $routeParams, $http, $timeout, KubernetesApiURL, $element, ngDialog) => {
$scope.model=DataModel;
$scope.replicasModel = KubernetesModel;
init($scope, $location, $routeParams);
@ -157,6 +158,15 @@ module Developer {
id: selected
}];
}
/*
使使0使
*/
var exitedItems = Kubernetes.checkForMigration($scope.replicasModel.replicationControllers,$scope.tableConfig.selectedItems);
if(exitedItems.length > 0){
Configs.customAlert("提示", "操作失败:正在使用的数据文件不能删除!", '',null, 0, "error");
return;
}
UI.multiItemConfirmActionDialog(<UI.MultiItemConfirmActionOptions>{
collection: selected,
index: 'id',
@ -194,38 +204,58 @@ module Developer {
selectedItem: {"name": "当前没有可以迁移的集群"},
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,
"selectItems": $scope.tableConfig.selectedItems,
"selectNode": $scope.selectNode
}, (result, status) => {
if(status===200){
var migrationClick = $scope.migrationClick;
/*
,$http:发生http异步请求url;
*/
Configs.oracleInfoOperate($http, "/java/console/api/volume", Configs.OperateType.MOVE,
{
"name": migrationClick.selectedItem.name,
"selectItems": $scope.tableConfig.selectedItems,
"selectNode": $scope.selectNode
}, (result, status) => {
if(status===200){
//$scope.model.updateOracleParam();
}else{
throw "资源请求失败";
}
});
$timeout(() =>{
}else
throw "资源请求失败";
});
/*
*/
$timeout(() =>{
$location.path("/workspaces/Overview/task");
},250);
migrationClick.close();
}else{
var name = "";
angular.forEach(exitedItems, (item) => {
name += item.name + "-" + item.systemName + ",";
})
alert("迁移数据文件失败:" + name +"数据文件正在使用....");
}
},250);
migrationClick.close();
},
open: (selected) =>{
var migrationClick = $scope.migrationClick;
if($scope.volumes && $scope.volumes instanceof Array && $scope.volumes.length >0)
migrationClick.selectedItem = $scope.volumes[0];
migrationClick.dialog.open();
/*
使使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){
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");
}
},
close: () => {
$scope.migrationClick.selectedItem = {"name": "当前没有可以迁移的集群"};
@ -269,8 +299,9 @@ module Developer {
var name = "";
angular.forEach(exitedItems, (item) => {
name += item.name + "-" + item.systemName + ",";
})
alert("迁移数据文件失败:" + name +"数据文件正在使用....");
});
console.log(exitedItems);
Configs.customAlert("提示", "操作失败: 正在迁移的数据不能被启动!", '', null, 0, "error");
}
}

View File

@ -265,6 +265,15 @@
<span ng-show="entity.extractStatus == 2" class="badge"> 已完成</span>
</div>
</script>
<script type="text/ng-template" id="loadingMask.html">
<div class="custom-alert">
<div id="loading">
<span ng-bind="ngDialogData.msg" />
</div>
</div>
</script>
<div ng-controller="Kubernetes.TopLevel">
<div class="wiki-icon-view" ng-controller="Kubernetes.FileDropController" nv-file-drop nv-file-over uploader="uploader" over-class="ready-drop">
<div class="row kubernetes-view" ng-view></div>

View File

@ -1,6 +1,7 @@
/// <reference path="../../includes.ts"/>
/// <reference path="kubernetesInterfaces.ts"/>
/// <reference path="utilHelpers.ts"/>
/// <reference path="../../configs/ts/customAlert.ts"/>
/// <reference path="readPlacedivision.ts"/>
/// <reference path="../../configs/ts/ConfigsHelper.ts"/>
module Kubernetes {
@ -1804,7 +1805,7 @@ module Kubernetes {
}
}
export function extractDataToOracle($http, selectedReplicationControllers, targetOracle: Configs.oracleParam){
export function extractDataToOracle($http, selectedReplicationControllers, targetOracle: Configs.oracleParam, fn?:(data, status) => void){
//console.log(targetReplicationController.length);
var answer = targetOracle && true;
var inneedOracle = [];
@ -1820,10 +1821,39 @@ module Kubernetes {
});
if(answer){
var data ={"name": targetOracle.id, "target": targetOracle, "inneed": inneedOracle};
Configs.oracleInfoOperate($http, "/java/console/api/oracle", Configs.OperateType.EXTRACT, data);
var data ={"name": targetOracle.id, "target": targetOracle, "inneed": inneedOracle};
var spinner;
$.ajax({
type: "POST",
url: UrlHelpers.join("/java/console/api/oracle", targetOracle.id+"", "extract"),
timeout: 8000,
dataType: 'json',
//async: false,
data: JSON.stringify(data),
contentType: "application/json; charset=utf-8",
beforeSend: () => {
Configs.create_mask(); //创建遮罩层
create_locadEffect("正在验证汇总库配置信息,请稍等!"); //创建数据加载效果层
var target = document.getElementById('loading')
spinner = new Spinner(loadConfigs()).spin(target);
},
complete: (XMLHttpRequest, textStatus) => {
if(XMLHttpRequest.status == 200){
//spinner.spin();
Kubernetes.createSuccessInfo("../../../new/images/msgbox_success.png", "连接汇总库成功,即将执行汇总操作!");
setTimeout("Kubernetes.removeMask()", 1500);
}
else{
//spinner.spin();
Kubernetes.createSuccessInfo("../../../new/images/msgbox_error.png", "连接汇总库失败,请检查服务集群中的汇总库配置是否正确!");
setTimeout("Kubernetes.removeMask()", 1500);
}
}
});
//Configs.oracleInfoOperate($http, "/java/console/api/oracle", Configs.OperateType.EXTRACT, data, fn);
}else{
alert("您选择的汇总数据库或需要汇总的数据库中存在未启动成功的数据库,导致汇总操作失败,请重新选择!");
//alert("您选择的汇总数据库或需要汇总的数据库中存在未启动成功的数据库,导致汇总操作失败,请重新选择!");
Configs.customAlert("提示", "操作失败:需要汇总的数据库中存在未启动成功的数据库!", '',null, 0, "error");
}
}
@ -1847,4 +1877,61 @@ module Kubernetes {
}
return result;
}
function loadConfigs(){
return {
lines: 9,
length: 0,
width: 13,
radius: 38,
scale: 1,
corners: 1,
color: '#ffffff',
opacity: 0,
rotate: 90,
direction: 1,
speed: 0.5,
trail: 50,
zIndex: 1000000002,
className: 'spinner',
top: '40%' ,
left: '50%',
shadow: false,
hwaccel: false,
position: 'absolute'
}
}
/*
*/
function create_locadEffect(msg){
var tmp = "<div id=\"loading\"></div>"
+ "<span>" + msg + "</span>";
var load = document.createElement("div");
load.id = "load";
load.innerHTML = tmp;
document.body.appendChild(load);
$("#load").addClass("load-effect-msg");
}
export function createSuccessInfo(icon:string, msg:string){
$("#load").remove();
var tmp = "<div class=\"load-result\" ><img src=\""
+ icon + "\" class=\"custom-alert-img\"></div>"
+ "<span>" + msg +"</span>";
var result = document.createElement("div");
result.id = "exe_result";
result.innerHTML = tmp;
document.body.appendChild(result);
}
export function removeMask(){
var mask = document.getElementById("mask");
var result = document.getElementById("exe_result");
if(null == mask && null == result)
return;
document.body.removeChild(mask);
document.body.removeChild(result);
}
}

View File

@ -104,6 +104,8 @@ module Kubernetes {
_module.run(['viewRegistry', 'ServiceRegistry', 'HawtioNav', 'KubernetesModel', '$templateCache', (viewRegistry, ServiceRegistry, HawtioNav, KubernetesModel, $templateCache) => {
log.debug("Running");
viewRegistry['kubernetes'] = templatePath + 'layoutKubernetes.html';
//viewRegistry['kubernetes'] = Configs.templatePath + 'shareLayout.html';
var builder = HawtioNav.builder();
var apps = builder.id('kube-apps')
.href(() => UrlHelpers.join(context, 'apps'))

View File

@ -2,7 +2,7 @@
/// <reference path="kubernetesHelpers.ts"/>
/// <reference path="kubernetesPlugin.ts"/>
/// <reference path="kubernetesModel.ts"/>
/// <reference path="../../configs/ts/customAlert.ts"/>
module Kubernetes {
export var ReplicationControllers = controller("ReplicationControllers",
@ -122,7 +122,8 @@ module Kubernetes {
angular.forEach(extractItems, (item) => {
name += item.$oracleName + ",";
})
alert("删除服务失败:" + name + "服务正在执行汇总操作,不能被删除");
//alert("删除服务失败:" + name + "服务正在执行汇总操作,不能被删除");
Configs.customAlert("提示", "操作失败:正在执行汇总操作的服务不能被删除!", '',null, 0, "error");
}
}
@ -179,7 +180,8 @@ module Kubernetes {
angular.forEach(extractItems, (item) => {
name += item.$oracleName + ",";
})
alert("停止服务失败:" + name + "服务正在执行汇总操作,不能停止");
//alert("停止服务失败:" + name + "服务正在执行汇总操作,不能停止");
Configs.customAlert("提示", "操作失败:正在执行汇总操作的服务不能被停止!", '',null, 0, "error");
}
};
@ -211,7 +213,12 @@ module Kubernetes {
open: (selected) => {
var extractClick = $scope.extractClick;
if($scope.configs && $scope.configs.oracleParam instanceof Array && $scope.configs.oracleParam.length>0)
extractClick.selectedItem = $scope.configs.oracleParam[0];
extractClick.selectedItem = $scope.configs.oracleParam[0];
var result = checkIsStartSuccess($scope.tableConfig.selectedItems);
if(result.length >0){
Configs.customAlert("提示", "操作失败:选择服务中存在未启动的数据,请先启动服务", '',null, 0, "error");
return;
}
extractClick.dialog.open();
/*extractData.selectedItem = $scope.filterReplicationControllers[0] || "";
extractData.items = selected;*/

View File

@ -139,4 +139,7 @@ module Kubernetes {
$scope.$emit('deleteRow', entity);
}*/
}]);
export var LoadMask = controller('LoadMask', ['$scope', ($scope) => {
}]);
}

View File

@ -302,4 +302,14 @@ module Kubernetes {
});
return result;
}
export function checkIsStartSuccess(replicationControllers: Array<any>){
var result = [];
angular.forEach(replicationControllers, (replicas) => {
var labels = getLabels(replicas);
if(labels["status"] != "2")
result.push(replicas);
});
return result;
}
}

View File

@ -258,3 +258,81 @@ legend {
background-color: Red;
}
.custom-alert{
width:300px;
border: 2px solid #37B6D1;
background-color: #fff;
font-weight: bold;
font-size: 12px;
}
.custom-alert-title{
line-height: 25px;
padding: 0px 5px;
background-color: #37B6D1;
}
.custom-alert-body{
cellspacing: 0;
border: 0;
}
.custom-alert-td{
padding: 0px 0px 0px 20;
}
.custom-alert-img{
width: 64;
height: 64;
}
.custom-alert-content{
background-color: #fff;
font-weight: bold;
font-size: 12px;
padding: 20px 0px;
text-align: left;
}
.custom-alert-bottom{
text-align: center;
padding: 0px 0px 20px;
background-color: #fff;
}
.custom-alert-ok{
border: 1px solid #CCC;
background-color: #CCC;
width: 50px;
height: 25px;
}
.custom-alert-cancel{
border: 1px solid #CCC;
background-color: #CCC;
width: 50px;
height: 25px;
}
.load-result{
z-index: 1000000002;
top: 40%;
position: absolute;
left: 47.5%;
}
.load-result-msg{
z-index: 1000000002;
top: 48%;
position: absolute;
left: 41.5%;
}
.load-effect-msg{
position: absolute;
z-index: 1000000002;
left: 47.5%;
top: 48%;
}