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
unknown
7 years ago
Commit
14697bd0e3ee60afa26e66eb0db7f53e33b0eed2
1 parent
79db3866
配置中心
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
16 deletions
monitor-ui-common/src/main/java/com/ui/contants/HttpUriContants.java
monitor-ui-ctrl/src/main/java/com/ui/ctrl/ConfigCenterCtrl.java
monitor-ui-web/src/main/webapp/jsp/zkConfigCenter/zkConfigCenterList.jsp
monitor-ui-common/src/main/java/com/ui/contants/HttpUriContants.java
View file @
14697bd
...
...
@@ -79,6 +79,7 @@ public class HttpUriContants {
public
static
final
String
BATCHIMPORT_ZK_ROOT_CONFIGCENTER
=
"/configCenter/batchImport"
;
public
static
final
String
ADD_ZK_ROOT
=
"/configCenter/addZkConfigRoot"
;
public
static
final
String
GET_ZK_LIST
=
"/configCenter/getZkConfigList"
;
public
static
final
String
GET_ZK_LIST_EXPORT
=
"/configCenter/export"
;
public
static
final
String
ADD_ZKCONFIG_MULTI
=
"/configCenter/addZkCongfigMulti"
;
/***
...
...
monitor-ui-ctrl/src/main/java/com/ui/ctrl/ConfigCenterCtrl.java
View file @
14697bd
...
...
@@ -5,6 +5,7 @@ import com.ui.http.HttpRestClient;
import
com.ui.model.BaseResponse
;
import
com.ui.model.req.ZkDetailReq
;
import
com.ui.model.req.ZkTreeReq
;
import
org.apache.http.HttpResponse
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -14,6 +15,9 @@ import org.springframework.web.bind.annotation.RequestParam;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.util.Properties
;
/**
...
...
@@ -58,6 +62,37 @@ public class ConfigCenterCtrl {
return
response
;
}
@RequestMapping
(
"/export"
)
@ResponseBody
public
void
export
(
ZkDetailReq
req
,
HttpServletResponse
response
){
log
.
info
(
"export with req is {}"
,
req
);
req
.
setExport
(
true
);
Properties
res
=
httpClient
.
defaultPost
(
HttpUriContants
.
GET_ZK_LIST_EXPORT
,
req
,
Properties
.
class
);
if
(
null
==
res
)
{
res
=
new
Properties
();
}
response
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setContentType
(
"application/x-download"
);
response
.
addHeader
(
"Content-Disposition"
,
"attachment;filename=config.properties"
);
OutputStream
out
=
null
;
try
{
out
=
response
.
getOutputStream
();
res
.
store
(
out
,
"export config info from zk!"
);
out
.
flush
();
}
catch
(
IOException
e
)
{
log
.
error
(
"export with req is {}"
,
req
,
e
);
}
finally
{
if
(
out
!=
null
)
{
try
{
out
.
close
();
}
catch
(
Exception
e
)
{
}
}
}
}
@RequestMapping
(
"/editDetail"
)
@ResponseBody
public
BaseResponse
editDetail
(
ZkDetailReq
req
){
...
...
monitor-ui-web/src/main/webapp/jsp/zkConfigCenter/zkConfigCenterList.jsp
View file @
14697bd
...
...
@@ -104,6 +104,7 @@
</div>
<button
id=
"searchConfigInfoBtn"
class=
"btn btn-primary"
style=
"margin-left: 18px;"
>
查询
</button>
<button
id=
"importConfigInfoBtn"
class=
"btn btn-warning"
style=
"margin-left: 18px;"
>
导入
</button>
<button
id=
"exportConfigInfoBtn"
class=
"btn btn-grey"
style=
"margin-left: 18px;"
>
导出
</button>
<button
id=
"addRootBtn"
class=
"btn btn-success"
style=
"margin-left: 18px;"
>
新增服务
</button>
<button
id=
"addConfigBtn"
class=
"btn btn-danger"
style=
"margin-left: 18px;"
>
新增配置
</button>
</div>
...
...
@@ -116,6 +117,12 @@
</div>
</div>
</div>
<form
id=
"form_export"
name=
"form_export"
method=
"post"
target=
"hidden_frame"
>
<input
type=
"hidden"
id=
"exIp"
name=
"ip"
>
<input
type=
"hidden"
id=
"exZkPath"
name=
"zkPath"
>
<input
type=
"hidden"
id=
"exConfigName"
name=
"configName"
>
</form>
<iframe
name=
'hidden_frame'
id=
"hidden_frame"
style=
"display: none"
></iframe>
</body>
<script
src=
"<%=basePath %>script/common/genarate_left_panel.js"
></script>
<script>
...
...
@@ -127,6 +134,7 @@
$
(
function
()
{
$
(
"#importConfigInfoBtn"
).
bind
(
"click"
,
importFile
);
$
(
"#exportConfigInfoBtn"
).
bind
(
"click"
,
doExport
);
$
(
"#addRootBtn"
).
bind
(
"click"
,
addRoot
);
$
(
"#addConfigBtn"
).
bind
(
"click"
,
addMObject
);
//获取环境下拉列表
...
...
@@ -183,22 +191,7 @@
},
{
title
:
"环境"
,
width
:
"8%"
,
field
:
"ip"
,
formatter
:
function
(
value
,
rowData
,
rowIndex
)
{
if
(
value
==
"all"
){
return
"全部"
;
}
else
if
(
value
==
"zookeeper_aws"
){
return
"aws"
;
}
else
if
(
value
==
"zookeeper_qq"
){
return
"qCloud"
;
}
else
if
(
value
==
"gray_qq"
){
return
"gray"
;
}
else
if
(
value
==
"dev"
){
return
"dev"
;
}
else
{
return
"全部"
;
}
}
field
:
"ip"
},
{
title
:
"配置值"
,
width
:
"15%"
,
...
...
@@ -587,5 +580,18 @@
'configName'
:
configName
});
});
//导出
function
doExport
()
{
var
ip
=
$
(
"#envType"
).
val
();
var
zkPath
=
$
(
"#zkPath"
).
val
();
var
configName
=
$
(
"#configName"
).
val
();
$
(
"#exIp"
).
val
(
ip
);
$
(
"#exZkPath"
).
val
(
zkPath
);
$
(
"#exConfigName"
).
val
(
configName
);
$
(
"#form_export"
).
attr
(
"action"
,
contextPath
+
"configCenter/export"
);
$
(
"#form_export"
).
submit
();
}
</script>
</html>
\ No newline at end of file
...
...
Please
register
or
login
to post a comment