--添加Volume是否修改成功提示信息

Web_Manager_Develope
wu ming 8 years ago
parent 043d548872
commit fb07b964e8

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

@ -28,6 +28,7 @@ declare module Configs {
path: string; path: string;
editable?: boolean; editable?: boolean;
} }
function formatVolumes(volumes: Array<volume>): void;
/** /**
volumebrock volumebrock
*/ */

@ -4,6 +4,7 @@
/// <reference path="configsUtils.d.ts" /> /// <reference path="configsUtils.d.ts" />
/// <reference path="configsDataService.d.ts" /> /// <reference path="configsDataService.d.ts" />
/// <reference path="../../kubernetes/ts/term.d.ts" /> /// <reference path="../../kubernetes/ts/term.d.ts" />
/// <reference path="../../kubernetes/ts/kubernetesHelpers.d.ts" />
/// <reference path="shareController.d.ts" /> /// <reference path="shareController.d.ts" />
declare module Configs { declare module Configs {
var GfsController: ng.IModule; var GfsController: ng.IModule;

@ -226,6 +226,28 @@ declare module Kubernetes {
function extractDataToOracle($http: any, selectedReplicationControllers: any, targetOracle: Configs.oracleParam, fn?: (data, status) => void): void; function extractDataToOracle($http: any, selectedReplicationControllers: any, targetOracle: Configs.oracleParam, fn?: (data, status) => void): void;
function checkoutOracleIsRunning(rc: any): boolean; function checkoutOracleIsRunning(rc: any): boolean;
function replicasIsCreated(replicationcontrollers: Array<any>, name: string): boolean; function replicasIsCreated(replicationcontrollers: Array<any>, name: string): boolean;
function loadConfigs(): {
lines: number;
length: number;
width: number;
radius: number;
scale: number;
corners: number;
color: string;
opacity: number;
rotate: number;
direction: number;
speed: number;
trail: number;
zIndex: number;
className: string;
top: string;
left: string;
shadow: boolean;
hwaccel: boolean;
position: string;
};
function create_locadEffect(msg: any): void;
function createSuccessInfo(icon: string, msg: string): void; function createSuccessInfo(icon: string, msg: string): void;
function removeMask(): void; function removeMask(): void;
} }

File diff suppressed because one or more lines are too long

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

@ -6,7 +6,7 @@
<div hawtio-tabs></div> <div hawtio-tabs></div>
</div> </div>
<div class="container-content sj_content"> <div class="container-content sj_content" ng-model="volumes">
<div class="row"> <div class="row">
<div class="mb10"> <div class="mb10">
<button class="btn sj_btn_green" style="color:#fff; <button class="btn sj_btn_green" style="color:#fff;

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

@ -56,7 +56,7 @@ module Configs{
}) })
} }
function formatVolumes(volumes:Array<volume>){ export function formatVolumes(volumes:Array<volume>){
angular.forEach(volumes, (volume) => { angular.forEach(volumes, (volume) => {
formatVolume(volume); formatVolume(volume);
}) })
@ -114,7 +114,7 @@ module Configs{
} }
} }
}); });
this.cluster = result; this.cluster =JSON.parse(result);
formatVolumes(this.cluster); formatVolumes(this.cluster);
} }

@ -4,6 +4,7 @@
/// <reference path="configsUtils.ts"/> /// <reference path="configsUtils.ts"/>
/// <reference path="configsDataService.ts"/> /// <reference path="configsDataService.ts"/>
/// <reference path="../../kubernetes/ts/term.ts"/> /// <reference path="../../kubernetes/ts/term.ts"/>
/// <reference path="../../kubernetes/ts/kubernetesHelpers.ts"/>
/// <reference path="shareController.ts"/> /// <reference path="shareController.ts"/>
module Configs{ module Configs{
@ -60,7 +61,42 @@ module Configs{
onOk: () => { onOk: () => {
var showDeleteVolume = $scope.showDeleteVolume; var showDeleteVolume = $scope.showDeleteVolume;
$timeout(() =>{ $timeout(() =>{
$http({ var spinner;
$.ajax({
type: "POST",
url: "/java/console/api/volume/delete",
timeout: 8000,
dataType: 'json',
//async: false,
data: showDeleteVolume.item,
contentType: "application/json; charset=utf-8",
beforeSend: () => {
Configs.create_mask(); //创建遮罩层
Kubernetes.create_locadEffect("正在更新云盘信息,请稍等!"); //创建数据加载效果层
var target = document.getElementById('loading')
spinner = new Spinner(Kubernetes.loadConfigs()).spin(target);
},
complete: (XMLHttpRequest, textStatus) => {
if(XMLHttpRequest.status == 200){
Kubernetes.createSuccessInfo("../../../new/images/msgbox_success.png", "更新成功!");
setTimeout("Kubernetes.removeMask()", 1500);
//$scope.model.updateVolumeData();
}else{
Kubernetes.createSuccessInfo("../../../new/images/msgbox_error.png", "更新失败!");
setTimeout("Kubernetes.removeMask()", 1500);
}
},
success: (data) => {
if(data){
ConfigsModel.cluster = data;
Configs.formatVolumes(ConfigsModel.cluster);
$scope.$apply(() =>{
$scope.volumes = ConfigsModel.cluster;
});
}
}
});
/*$http({
url: "/java/console/api/volume/delete", url: "/java/console/api/volume/delete",
method: 'POST', method: 'POST',
data: showDeleteVolume.item data: showDeleteVolume.item
@ -68,9 +104,10 @@ module Configs{
/* /*
volume volume
*/ */
/*$scope.model.updateVolumeData();
}).error(function(data,header,config,status){ }).error(function(data,header,config,status){
Configs.customAlert("提示", "删除Volume失败", '',null, 0, "error");
}); });*/
}, 100); }, 100);
}, },
onCancel: () =>{ onCancel: () =>{
@ -90,24 +127,42 @@ module Configs{
} }
}); });
var spinner;
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "/java/console/api/volume/update", url: "/java/console/api/volume/update",
timeout: 8000, timeout: 5000,
dataType: 'json', dataType: 'json',
//async: false, //async: false,
data: JSON.stringify(data), data: JSON.stringify(data),
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
beforeSend: () => { beforeSend: () => {
Configs.create_mask(); //创建遮罩层
Kubernetes.create_locadEffect("正在更新云盘信息,请稍等!"); //创建数据加载效果层
var target = document.getElementById('loading')
spinner = new Spinner(Kubernetes.loadConfigs()).spin(target);
}, },
complete: (XMLHttpRequest, textStatus) => { complete: (XMLHttpRequest, textStatus) => {
if(XMLHttpRequest.status == 200) if(XMLHttpRequest.status == 200){
console.log("成功"); Kubernetes.createSuccessInfo("../../../new/images/msgbox_success.png", "更新成功!");
else setTimeout("Kubernetes.removeMask()", 1500);
console.log("失败"); //$scope.model.updateVolumeData();
}else{
Kubernetes.createSuccessInfo("../../../new/images/msgbox_error.png", "更新失败!");
setTimeout("Kubernetes.removeMask()", 1500);
}
},
success: (data) => {
if(data){
ConfigsModel.cluster = data;
Configs.formatVolumes(ConfigsModel.cluster);
$scope.$apply(() =>{
$scope.volumes = ConfigsModel.cluster;
});
}
} }
}); });
/*$http({ /*$http({
url: "/java/console/api/volume/update", url: "/java/console/api/volume/update",

@ -1889,7 +1889,7 @@ module Kubernetes {
return result; return result;
} }
function loadConfigs(){ export function loadConfigs(){
return { return {
lines: 9, lines: 9,
length: 0, length: 0,
@ -1916,7 +1916,7 @@ module Kubernetes {
/* /*
*/ */
function create_locadEffect(msg){ export function create_locadEffect(msg){
var tmp = "<div id=\"loading\"></div>" var tmp = "<div id=\"loading\"></div>"
+ "<span>" + msg + "</span>"; + "<span>" + msg + "</span>";
var load = document.createElement("div"); var load = document.createElement("div");

@ -36,10 +36,10 @@ module Kubernetes {
export var Labels = controller("Labels", ["$scope", "$location", ($scope, $location) => { export var Labels = controller("Labels", ["$scope", "$location", ($scope, $location) => {
$scope.labels = []; $scope.labels = [];
var labelKeyWeights = { var labelKeyWeights = {
"region": 1, "cityName": 1,
"system": 2, "districtName": 2,
"type": 3, "systemName": 3,
"batch": 4, "year": 4,
"version": 5 "version": 5
}; };
$scope.$watch('entity', (newValue, oldValue) => { $scope.$watch('entity', (newValue, oldValue) => {

Loading…
Cancel
Save