Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ops
/
monitor-ui
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
bblu
8 years ago
Commit
0193ffaef2e91efbb50695a6e816ffc3a8c38e29
1 parent
647008d4
修改
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
149 additions
and
65 deletions
monitor-ui-web/src/main/webapp/jsp/switch/lbSwitch.jsp
monitor-ui-web/src/main/webapp/jsp/switch/limitSwitch.jsp
monitor-ui-web/src/main/webapp/jsp/switch/luaSwitch.jsp
monitor-ui-web/src/main/webapp/script/nginx_switch.js
monitor-ui-web/src/main/webapp/jsp/switch/lbSwitch.jsp
View file @
0193ffa
...
...
@@ -122,10 +122,14 @@
</script>
<script
type=
"text/javascript"
>
var
dialog1
,
dialog2
,
dialog3
;
/**
* "开启/关闭"按钮点击事件,打开确认操作对话框
* @param status
*/
function
initSwitch
(
status
)
{
dialog1
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog1
.
dialog
({
var
dialog
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog
.
dialog
({
title
:
"你确定切换吗"
,
backdrop
:
"static"
,
content
:
"你确定要"
+
(
0
===
status
?
"关闭"
:
(
1
===
status
?
"开启"
:
""
))
+
"直连吗?"
,
...
...
@@ -133,7 +137,7 @@
text
:
"否"
,
className
:
"btn-danger"
,
onclick
:
function
()
{
$
(
dialog1
)
.
dialog
(
"hide"
);
dialog
.
dialog
(
"hide"
);
}
},
{
text
:
"是"
,
...
...
@@ -143,17 +147,20 @@
status
:
status
};
sendAjax
(
"post"
,
"viewToChangeLbConf"
,
param
,
"text"
,
viewToChangeSuccess
,
errorFunc
);
dialog
.
dialog
(
"hide"
);
}
}]
});
}
/**
* 打开对话框,展示切换后的配置
* @param resp 切换后的响应数据
*/
function
viewToChangeSuccess
(
resp
)
{
$
(
dialog1
).
dialog
(
"hide"
);
var
data
=
JSON
.
parse
(
resp
);
dialog2
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog2
.
dialog
({
var
dialog
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog
.
dialog
({
title
:
"切换结果"
,
backdrop
:
"static"
,
content
:
"<pre>"
+
data
.
data
+
"</pre>"
,
...
...
@@ -161,7 +168,7 @@
text
:
"否"
,
className
:
"btn-danger"
,
onclick
:
function
()
{
$
(
dialog2
)
.
dialog
(
"hide"
);
dialog
.
dialog
(
"hide"
);
}
},
{
text
:
"确定"
,
...
...
@@ -169,7 +176,7 @@
onclick
:
function
()
{
sendAjax
(
"post"
,
"switchConf"
,
{},
"text"
,
switchSuccess
,
errorFunc
);
$
(
dialog2
)
.
dialog
(
"hide"
);
dialog
.
dialog
(
"hide"
);
toWait
();
}
}]
...
...
@@ -178,10 +185,22 @@
});
}
/**
* 切换配置成功,跳转回首页
*/
function
switchSuccess
()
{
window
.
location
.
href
=
contextPath
+
"/lbSwitch/toLbSwitch"
;
}
/**
* 发送ajax请求
* @param type 请求方法post/get
* @param url 请求url
* @param data 请求参数数据
* @param dataType 请求参数类型
* @param success 请求成功回调函数
* @param error 请求异常回调函数
*/
function
sendAjax
(
type
,
url
,
data
,
dataType
,
success
,
error
)
{
$
.
ajax
({
type
:
type
,
...
...
@@ -193,13 +212,18 @@
});
}
/**
* ajax请求异常回调函数
*/
function
errorFunc
()
{
layer
.
msg
(
"Token异常"
,
{
icon
:
2
});
}
/**
* 打开等待对话框
*/
function
toWait
()
{
dialog3
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog3
.
dialog
({
$
(
"<div>"
).
appendTo
(
$
(
"body"
)).
dialog
({
title
:
"提示"
,
backdrop
:
"static"
,
content
:
"正在切换,请稍后..."
...
...
monitor-ui-web/src/main/webapp/jsp/switch/limitSwitch.jsp
View file @
0193ffa
...
...
@@ -135,11 +135,6 @@
<script
type=
"text/javascript"
>
/**
* 对话框对象
*/
var
dialog1
,
dialog2
,
dialog3
,
dialog4
;
/**
* 按钮“调整”点击事件,打开设置对话框并初始化数据
*/
function
initSwitch
()
{
...
...
@@ -168,8 +163,8 @@
html
+=
"</ul></dd>"
;
html
+=
"</dl></div>"
;
dialog1
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog1
.
dialog
({
var
dialog
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog
.
dialog
({
title
:
"限流调整"
,
backdrop
:
"static"
,
content
:
html
,
...
...
@@ -177,12 +172,14 @@
text
:
"取消"
,
className
:
"btn-danger"
,
onclick
:
function
()
{
$
(
dialog1
)
.
dialog
(
"hide"
);
dialog
.
dialog
(
"hide"
);
}
},
{
text
:
"提交"
,
className
:
"btn-success"
,
onclick
:
toSubmit
onclick
:
function
()
{
toSubmit
(
dialog
);
}
}]
}).
find
(
".modal-body"
).
css
({
height
:
"650px"
...
...
@@ -192,7 +189,7 @@
/**
* ajax提交编辑后的数据
*/
function
toSubmit
()
{
function
toSubmit
(
dialog
)
{
var
toSendAjaxFlag
=
false
;
var
openLimitFlow
=
$
(
"#open_limit_flow_a"
).
find
(
"input"
).
val
();
...
...
@@ -223,6 +220,7 @@
limitServiceConfig
:
JSON
.
stringify
(
limitServiceConfig
)
};
sendAjax
(
"post"
,
"viewToChangeLimitConf"
,
param
,
"text"
,
viewToChangeSuccess
,
errorFunc
);
dialog
.
dialog
(
"hide"
);
}
}
...
...
@@ -230,11 +228,9 @@
* 弹出调整后数据对话框
*/
function
viewToChangeSuccess
(
resp
)
{
$
(
dialog1
).
dialog
(
"hide"
);
var
data
=
JSON
.
parse
(
resp
);
dialog2
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog2
.
dialog
({
var
dialog
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog
.
dialog
({
title
:
"切换结果"
,
backdrop
:
"static"
,
content
:
"<pre>"
+
data
.
data
+
"</pre>"
,
...
...
@@ -242,7 +238,7 @@
text
:
"否"
,
className
:
"btn-danger"
,
onclick
:
function
()
{
$
(
dialog2
)
.
dialog
(
"hide"
);
dialog
.
dialog
(
"hide"
);
}
},
{
text
:
"确定"
,
...
...
@@ -250,7 +246,7 @@
onclick
:
function
()
{
sendAjax
(
"post"
,
"switchConf"
,
{},
"text"
,
switchSuccess
,
errorFunc
);
$
(
dialog2
)
.
dialog
(
"hide"
);
dialog
.
dialog
(
"hide"
);
toWait
();
}
}]
...
...
@@ -283,6 +279,15 @@
$
(
btn
).
parent
().
remove
();
}
/**
* 发送ajax请求
* @param type 请求方法post/get
* @param url 请求url
* @param data 请求参数数据
* @param dataType 请求参数类型
* @param success 请求成功回调函数
* @param error 请求异常回调函数
*/
function
sendAjax
(
type
,
url
,
data
,
dataType
,
success
,
error
)
{
$
.
ajax
({
type
:
type
,
...
...
@@ -294,13 +299,18 @@
});
}
/**
* ajax请求异常回调函数
*/
function
errorFunc
()
{
layer
.
msg
(
"Token异常"
,
{
icon
:
2
});
}
/**
* 打开等待对话框
*/
function
toWait
()
{
dialog4
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog4
.
dialog
({
$
(
"<div>"
).
appendTo
(
$
(
"body"
)).
dialog
({
title
:
"提示"
,
backdrop
:
"static"
,
content
:
"正在切换,请稍后..."
...
...
@@ -309,12 +319,12 @@
/**
* 打开提示对话框
* @param title
* @param content
* @param title 标题
* @param content 内容
*/
function
prompt
(
title
,
content
)
{
dialog3
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog3
.
dialog
({
var
dialog
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog
.
dialog
({
title
:
title
,
backdrop
:
"static"
,
content
:
content
,
...
...
@@ -322,7 +332,7 @@
text
:
"确定"
,
className
:
"btn-success"
,
onclick
:
function
()
{
$
(
dialog3
)
.
dialog
(
"hide"
);
dialog
.
dialog
(
"hide"
);
}
}]
});
...
...
monitor-ui-web/src/main/webapp/jsp/switch/luaSwitch.jsp
View file @
0193ffa
...
...
@@ -122,10 +122,14 @@
</script>
<script
type=
"text/javascript"
>
var
dialog1
,
dialog2
,
dialog3
;
/**
* "*切换"按钮点击事件,打开确认操作对话框
* @param cloudName 目标中心名称
*/
function
initSwitch
(
cloudName
)
{
dialog1
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog1
.
dialog
({
var
dialog
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog
.
dialog
({
title
:
"你确定切换吗"
,
backdrop
:
"static"
,
content
:
"你确定要将脚本切换至"
+
cloudName
+
"吗?"
,
...
...
@@ -133,7 +137,7 @@
text
:
"否"
,
className
:
"btn-danger"
,
onclick
:
function
()
{
$
(
dialog1
)
.
dialog
(
"hide"
);
dialog
.
dialog
(
"hide"
);
}
},
{
text
:
"是"
,
...
...
@@ -143,17 +147,20 @@
cloudName
:
cloudName
};
sendAjax
(
"post"
,
"viewToChangeLuaConf"
,
param
,
"text"
,
viewToChangeSuccess
,
errorFunc
);
dialog
.
dialog
(
"hide"
);
}
}]
});
}
/**
* 打开对话框,展示切换后的配置
* @param resp 切换后的响应数据
*/
function
viewToChangeSuccess
(
resp
)
{
$
(
dialog1
).
dialog
(
"hide"
);
var
data
=
JSON
.
parse
(
resp
);
dialog2
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog2
.
dialog
({
var
dialog
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog
.
dialog
({
title
:
"切换结果"
,
backdrop
:
"static"
,
content
:
"<pre>"
+
data
.
data
+
"</pre>"
,
...
...
@@ -161,7 +168,7 @@
text
:
"否"
,
className
:
"btn-danger"
,
onclick
:
function
()
{
$
(
dialog2
)
.
dialog
(
"hide"
);
dialog
.
dialog
(
"hide"
);
}
},
{
text
:
"确定"
,
...
...
@@ -169,7 +176,7 @@
onclick
:
function
()
{
sendAjax
(
"post"
,
"switchConf"
,
{},
"text"
,
switchSuccess
,
errorFunc
);
$
(
dialog2
)
.
dialog
(
"hide"
);
dialog
.
dialog
(
"hide"
);
toWait
();
}
}]
...
...
@@ -178,10 +185,22 @@
});
}
/**
* 切换配置成功,跳转回首页
*/
function
switchSuccess
()
{
window
.
location
.
href
=
contextPath
+
"/luaswitch/toLuaSwitch"
;
}
/**
* 发送ajax请求
* @param type 请求方法post/get
* @param url 请求url
* @param data 请求参数数据
* @param dataType 请求参数类型
* @param success 请求成功回调函数
* @param error 请求异常回调函数
*/
function
sendAjax
(
type
,
url
,
data
,
dataType
,
success
,
error
)
{
$
.
ajax
({
type
:
type
,
...
...
@@ -193,13 +212,18 @@
});
}
/**
* ajax请求异常回调函数
*/
function
errorFunc
()
{
layer
.
msg
(
"Token异常"
,
{
icon
:
2
});
}
/**
* 打开等待对话框
*/
function
toWait
()
{
dialog3
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog3
.
dialog
({
$
(
"<div>"
).
appendTo
(
$
(
"body"
)).
dialog
({
title
:
"提示"
,
backdrop
:
"static"
,
content
:
"正在切换,请稍后..."
...
...
monitor-ui-web/src/main/webapp/script/nginx_switch.js
View file @
0193ffa
$
(
function
()
{});
$
(
function
()
{
});
var
dialog1
,
dialog2
,
dialog3
,
dialog4
;
/**
* "切向*"按钮点击事件,打开确认操作对话框
* @param cloudName 源中心名称
* @param target 目标中心名称
* @param onlineOrGray 切换:线上/灰度
*/
function
initSwitch
(
cloudName
,
target
,
onlineOrGray
)
{
var
arr
=
getNoChangeIpArr
(
cloudName
,
onlineOrGray
);
if
(
undefined
===
arr
||
null
===
arr
||
0
===
arr
.
length
)
{
...
...
@@ -8,8 +14,8 @@ function initSwitch(cloudName, target, onlineOrGray) {
return
;
}
dialog2
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog2
.
dialog
({
var
dialog
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog
.
dialog
({
title
:
"你确定切换吗"
,
backdrop
:
"static"
,
content
:
"你确定要将"
+
cloudName
+
"上的"
+
onlineOrGray
+
"流量切向"
+
target
+
"吗?"
,
...
...
@@ -17,7 +23,7 @@ function initSwitch(cloudName, target, onlineOrGray) {
text
:
"否"
,
className
:
"btn-danger"
,
onclick
:
function
()
{
$
(
dialog2
)
.
dialog
(
"hide"
);
dialog
.
dialog
(
"hide"
);
}
},
{
text
:
"是"
,
...
...
@@ -30,17 +36,20 @@ function initSwitch(cloudName, target, onlineOrGray) {
noChangeIps
:
JSON
.
stringify
(
arr
)
};
sendAjax
(
"post"
,
"viewToChangeNginxConf"
,
param
,
"text"
,
viewToChangeSuccess
,
errorFunc
);
dialog
.
dialog
(
"hide"
);
}
}]
});
}
/**
* 打开对话框,展示切换后的配置
* @param resp 切换后的响应数据
*/
function
viewToChangeSuccess
(
resp
)
{
$
(
dialog2
).
dialog
(
"hide"
);
var
data
=
JSON
.
parse
(
resp
);
dialog3
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog3
.
dialog
({
var
dialog
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog
.
dialog
({
title
:
"切换结果"
,
backdrop
:
"static"
,
content
:
"<pre>"
+
data
.
data
.
result
+
"</pre>"
,
...
...
@@ -48,7 +57,7 @@ function viewToChangeSuccess(resp) {
text
:
"否"
,
className
:
"btn-danger"
,
onclick
:
function
()
{
$
(
dialog3
)
.
dialog
(
"hide"
);
dialog
.
dialog
(
"hide"
);
}
},
{
text
:
"确定"
,
...
...
@@ -59,7 +68,7 @@ function viewToChangeSuccess(resp) {
};
sendAjax
(
"post"
,
"switchNginxConf"
,
param
,
"text"
,
switchSuccess
,
errorFunc
);
$
(
dialog3
)
.
dialog
(
"hide"
);
dialog
.
dialog
(
"hide"
);
toWait
();
}
}]
...
...
@@ -68,6 +77,9 @@ function viewToChangeSuccess(resp) {
});
}
/**
* 切换配置成功,跳转回首页
*/
function
switchSuccess
()
{
window
.
location
.
href
=
getUrlBasePath
()
+
"/nginxswitch/toNginxSwitch"
;
}
...
...
@@ -92,12 +104,12 @@ function getNoChangeIpArr(cloudName, onlineOrGray) {
/**
* 提示函数
* @param title
* @param content
* @param title 标题
* @param content 内容
*/
function
prompt
(
title
,
content
)
{
dialog1
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog1
.
dialog
({
var
dialog
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog
.
dialog
({
title
:
title
,
backdrop
:
"static"
,
content
:
content
,
...
...
@@ -105,12 +117,21 @@ function prompt(title, content) {
text
:
"确定"
,
className
:
"btn-success"
,
onclick
:
function
()
{
$
(
dialog1
)
.
dialog
(
"hide"
);
dialog
.
dialog
(
"hide"
);
}
}]
});
}
/**
* 发送ajax请求
* @param type 请求方法post/get
* @param url 请求url
* @param data 请求参数数据
* @param dataType 请求参数类型
* @param success 请求成功回调函数
* @param error 请求异常回调函数
*/
function
sendAjax
(
type
,
url
,
data
,
dataType
,
success
,
error
)
{
$
.
ajax
({
type
:
type
,
...
...
@@ -122,13 +143,18 @@ function sendAjax(type, url, data, dataType, success, error) {
});
}
/**
* ajax请求异常回调函数
*/
function
errorFunc
()
{
layer
.
msg
(
"Token异常"
,
{
icon
:
2
});
}
/**
* 打开等待对话框
*/
function
toWait
()
{
dialog4
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog4
.
dialog
({
$
(
"<div>"
).
appendTo
(
$
(
"body"
)).
dialog
({
title
:
"提示"
,
backdrop
:
"static"
,
content
:
"正在切换,请稍后..."
...
...
Please
register
or
login
to post a comment