This commit is contained in:
wu ming 2016-10-12 15:20:00 +08:00
parent 0a82e8674f
commit 043d548872
10 changed files with 148 additions and 13 deletions

6
d.ts/configs/ts/customAlert.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
/// <reference path="../../includes.d.ts" />
declare module Configs {
function customAlert(title: any, content: any, func: any, cancel: any, focus: any, icon: any): void;
function create_mask(): void;
function remove(): void;
}

5
d.ts/kubernetes/ts/customAlert.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
/// <reference path="../../includes.d.ts" />
/// <reference path="kubernetesHelpers.d.ts" />
declare module Kubernetes {
function customAlert(title: any, content: any, func: any, cancel: any, focus: any, icon: any): void;
}

View File

@ -95,7 +95,7 @@ declare module Kubernetes {
districtName: any;
systemName: any;
year: any;
version: string;
version: any;
};
function initShared($scope: any, $location: any, $http: any, $timeout: any, $routeParams: any, KubernetesModel: any, KubernetesState: any, KubernetesApiURL: any): void;
/**

File diff suppressed because one or more lines are too long

BIN
new/images/msgbox_error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -0,0 +1,122 @@
/// <reference path="../../includes.ts"/>
module Configs{
export function customAlert(title, content, func, cancel, focus, icon){
/*
alert框
title :
text :
func :
cancel:
focus :
icon :
*/
icon = "../../../new/images/msgbox_" + icon + ".png";
create_mask();
var temp = "<div class=\"custom-alert\" >"
+ "<div class=\"custom-alert-title\">" + title + "</div>"
+ "<table class=\"custom-alert-body\"><tr><td class=\"custom-alert-td\"><img src=\""
+ icon + "\" class=\"custom-alert-img\"></td>"
+ "<td ><div calss=\"custom-alert-content\">"
+ content + "</div></td></tr></table>"
+ "<div class=\"custom-alert-bottom\"><input type='button' "
+ " class=\"custom-alert-ok\" value='确认' id=\"msgconfirmb\" onclick=\"Configs.remove();"
+ func + ";\">";
if (null != cancel) {
temp += "&nbsp;&nbsp;&nbsp;<input type='button' class=\"custom-alert-cancel\" onClick='Configs.remove()'>";
}
temp += "</div></div>";
create_msgbox(400, 200, temp);
if (focus == 0 || focus == "0" || null == focus) {
document.getElementById("msgconfirmb").focus();
} else if (focus == 1 || focus == "1") {
document.getElementById("msgcancelb").focus();
}
}
function get_width() {
return (document.body.clientWidth + document.body.scrollLeft);
}
function get_height() {
return (document.body.clientHeight + document.body.scrollTop);
}
function get_left(w) {
var bw = document.body.clientWidth;
var bh = document.body.clientHeight;
w = parseFloat(w);
return (bw / 2 - w / 2 + document.body.scrollLeft);
}
function get_top(h) {
var bw = document.body.clientWidth;
var bh = document.body.clientHeight;
h = parseFloat(h);
return (bh / 2 - h / 2 + document.body.scrollTop);
}
export function create_mask() {
var mask = document.createElement("div");
mask.id = "mask";
mask.style.position = "absolute";
mask.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=4,opacity=25)";
mask.style.opacity = "0.4";
mask.style.background = "black";
mask.style.top = "0px";
mask.style.left = "0px";
mask.style.width = get_width() + "px";
mask.style.height = get_height() + "px";
mask.style.zIndex = "1000000000";
document.body.appendChild(mask);
}
function create_msgbox(w, h, t) {
var box = document.createElement("div");
box.id = "msgbox";
box.style.position = "absolute";
box.style.width = w + "px";
box.style.height = h + "px";
box.style.overflow = "visible";
box.innerHTML = t;
box.style.zIndex = "1000000001";
document.body.appendChild(box);
re_pos();
}
function re_mask() {
var mask = document.getElementById("mask");
if (null == mask) return;
mask.style.width = get_width() + "px";
mask.style.height = get_height() + "px";
}
function re_pos() {
var box = document.getElementById("msgbox");
if (null != box) {
var w = box.style.width;
var h = box.style.height;
box.style.left = get_left(w) + "px";
box.style.top = get_top(h) + "px";
}
}
export function remove() {
var mask = document.getElementById("mask");
var msgbox = document.getElementById("msgbox");
if (null == mask && null == msgbox) return;
document.body.removeChild(mask);
document.body.removeChild(msgbox);
}
function re_show() {
re_pos();
re_mask();
}
function load_func() {
window.onresize = re_show;
window.onscroll = re_show;
}
}

View File

@ -54,15 +54,15 @@ module Developer {
{
field: "name",
displayName: '市-区/县',
customSortField: (field) => {
return field;
customSortField: (field) => {
return field.regionalismCode;
}
},
{
field: "systemName",
displayName: '系统名称',
customSortField: (field) => {
return field;
return field.systemCode;
}
},
{

View File

@ -371,10 +371,10 @@ module Kubernetes {
return answer;
}
export function labelsFormat(replicas){
console.log(replicas);
export function labelsFormat(replicas){
var annotion = getAnnotations(replicas);
var lables = getLabels(replicas);
var lables = getLabels(replicas);
var hasChineseVersion = lables["version"].indexOf("版本") == -1 ? "版本" + lables["version"] : lables["version"] ;
return{
isExtract: lables["isExtract"],
isTarget: lables["isTarget"],
@ -384,7 +384,7 @@ module Kubernetes {
districtName: annotion["districtName"],
systemName: annotion["systemName"],
year: annotion["year"],
version: "版本" + lables["version"]
version: hasChineseVersion
}
}

View File

@ -51,6 +51,7 @@ module Kubernetes {
displayName: '服务状态',
cellTemplate: $templateCache.get("podCountsAndLinkTemplate.html"),
customSortField: (field) => {
console.log(field);
if(field.$podCounters.ready ){
return 3;
}else if(field.$podCounters.valid || field.$podCounters.waiting){