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

This commit is contained in:
wu ming 2016-10-13 13:58:14 +08:00
parent 043d548872
commit fb07b964e8
12 changed files with 184 additions and 75 deletions

View File

@ -18,8 +18,6 @@ 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 formatVolumes(volumes: Array<volume>): Array<formatedVolume>;
interface formatedVolume {
name: string;
path: string;

View File

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

View File

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

View File

@ -226,6 +226,28 @@ declare module Kubernetes {
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 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 removeMask(): void;
}

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.7",
path: '/java/console/api',
targetPath: "/"
}];

View File

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

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({
@ -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> = [];
angular.forEach(volumes, (volume) => {
result.push(formatVolume(volume));
});
return result;
}
}*/
export interface formatedVolume{
name: string

View File

@ -56,8 +56,8 @@ module Configs{
})
}
function formatVolumes(volumes:Array<volume>){
angular.forEach(volumes, (volume) => {
export function formatVolumes(volumes:Array<volume>){
angular.forEach(volumes, (volume) => {
formatVolume(volume);
})
}
@ -114,7 +114,7 @@ module Configs{
}
}
});
this.cluster = result;
this.cluster =JSON.parse(result);
formatVolumes(this.cluster);
}
@ -141,7 +141,7 @@ module Configs{
type : "POST",
url : "/java/console/api/oracle/list",
success : function(data) {
if(data){
if(data){
result = data;
}
}

View File

@ -4,6 +4,7 @@
/// <reference path="configsUtils.ts"/>
/// <reference path="configsDataService.ts"/>
/// <reference path="../../kubernetes/ts/term.ts"/>
/// <reference path="../../kubernetes/ts/kubernetesHelpers.ts"/>
/// <reference path="shareController.ts"/>
module Configs{
@ -60,17 +61,53 @@ module Configs{
onOk: () => {
var showDeleteVolume = $scope.showDeleteVolume;
$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",
method: 'POST',
data: showDeleteVolume.item
}).success(function(data,header,config,status){
/*
volume信息
*/
}).error(function(data,header,config,status){
});
*/
/*$scope.model.updateVolumeData();
}).error(function(data,header,config,status){
Configs.customAlert("提示", "删除Volume失败", '',null, 0, "error");
});*/
}, 100);
},
onCancel: () =>{
@ -90,24 +127,42 @@ module Configs{
}
});
var spinner;
$.ajax({
type: "POST",
url: "/java/console/api/volume/update",
timeout: 8000,
timeout: 5000,
dataType: 'json',
//async: false,
data: JSON.stringify(data),
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)
console.log("成功");
else
console.log("失败");
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/update",

View File

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

View File

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