Skip to content

Commit

Permalink
bug修改
Browse files Browse the repository at this point in the history
  • Loading branch information
zhitom committed Jun 26, 2018
1 parent 88f1a1f commit 9a056cb
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 45 deletions.
8 changes: 6 additions & 2 deletions src/main/java/com/yasenagat/zkweb/web/ZkController.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,22 @@ public String queryzNodeInfo(

try {
path = URLDecoder.decode(path,"utf-8");
log.info("queryzNodeInfo : " + path);
log.info("queryzNodeInfo1111 : " + path);
if(path != null){
model.addAttribute("zkpath", path);
model.addAttribute("path",path);
model.addAttribute("cacheId", cacheId);
String data=ZkCache.get(cacheId).getData(path);
if(data==null) {
model.addAttribute("data", "");
model.addAttribute("acls", "");
return "info";
}
model.addAttribute("data", ZkCache.get(cacheId).getData(path).trim());
model.mergeAttributes(ZkCache.get(cacheId).getNodeMeta(path));
model.addAttribute("acls", ZkCache.get(cacheId).getACLs(path)); }
model.addAttribute("acls", ZkCache.get(cacheId).getACLs(path));
}
log.info("model : " + model);
} catch (Exception e) {
e.printStackTrace();
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/WEB-INF/views/home.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@

<div data-options="region:'center',split:true,collapsed:false,border:false" > <!-- height:170px;overflow: hidden; -->
<input type="hidden" id="lastRefreshConn"/>
<input type="hidden" id="isDelWelcomeTab" value="0"/>
<div class="easyui-tabs" id="zkTab" data-options="tools:'#tab-tools',toolPosition:'right',fit:true" >
<input type="hidden" id="isDelWelcomeTab" value="0"/>

<div id="nodeinfo" title="节点信息" style="padding:10px;">
<p><font color="red">
<ol>
Expand All @@ -112,7 +113,6 @@
<a href="javascript:void(0)" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-add',iconAlign:'left'" onclick="javascript:$('#zkweb_add_node').window('open');" data-locale-attr="addnodetitle" title="在当前节点下增加节点"><span data-locale-html="addnode">增加新节点</span></a>
<a href="javascript:void(0)" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-remove',iconAlign:'left'" onclick="remove()" data-locale-attr="addnodetitle" title="删除当前节点"><span data-locale-html="removenode">删除当前节点</span></a>
</div>
ZkConnectState:<span>no</span>
</div>
<!-- add -->
<div id="zkweb_add_node" class="easyui-window" title="添加节点" data-options="iconCls:'icon-add',modal:true,closed:true,maximizable:false" style="width:500px;padding:10px;">
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/resources/locale/strings.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
none=
north_title=ZK CONNECT CONFIGURATION
west_title=ZK NODE TREE
east_title=ZK STATE
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/resources/locale/strings_zh_CN.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
none=
north_title=ZK\u8fde\u63a5\u914d\u7f6e
west_title=ZK\u8282\u70b9\u6811
east_title=ZK\u72b6\u6001
Expand Down
95 changes: 54 additions & 41 deletions src/main/webapp/resources/zkweb.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,22 @@ $(function(){
});
$('#zkstate_showtype_form input[name="id"]').val(rowData.ID);
$('#jmxpanel').remove()
$.post("zk/queryZKOk", {cacheId:rowData.ID},function(data){$('#connstaterefresh').html(data);});
if($('#lastRefreshConn').val()){
clearInterval($('#lastRefreshConn').val());
$('#lastRefreshConn').val(null);
}
ref = setInterval(function(){
$.post("zk/queryZKOk", {cacheId:rowData.ID},function(data){$('#connstaterefresh').html(data);});
},5000);
$('#lastRefreshConn').val(ref);
refreshConnectState(rowData);
},
url:'zkcfg/queryZkCfg?whereSql='+encodeURI(encodeURI($('#filterValue').val())).trim()
});
}
function refreshConnectState(row){
$.post("zk/queryZKOk", {cacheId:row.ID},function(data){$('#connstaterefresh').html(data);});
if($('#lastRefreshConn').val()){
clearInterval($('#lastRefreshConn').val());
$('#lastRefreshConn').val(null);
}
ref = setInterval(function(){
$.post("zk/queryZKOk", {cacheId:row.ID},function(data){$('#connstaterefresh').html(data);});
},5000);
$('#lastRefreshConn').val(ref);
}
function ZkStateShowTypeChange(node){
//alert('hhh:'+node.name+','+node.value);
var url="zk/queryZKJMXInfo?cacheId="+$('#zkstate_showtype_form input[name="id"]').val()+"&simpleFlag="+$('#zkstate_showtype_form input[name="showtype"]:checked ').val();
Expand Down Expand Up @@ -195,15 +198,17 @@ $(function(){
}
}
var tab = $('#zkTab').tabs('getTab',row.DESC);
//$.messager.alert('提示','enter onLoadSuccess()!');
if(tab != null){
//$.messager.alert('提示','enter onLoadSuccess()!');
$('#zkTab').tabs('update', {
tab: tab,
options: {
title: row.DESC, //node.text,
href: "zk/queryZnodeInfo?path="+encodeURI(encodeURI(_path))+"&cacheId="+cacheId
}
});

// $('#zkTab').tabs('update', {
// tab: tab,
// options: {
// title: row.DESC, //node.text,
// href: "zk/queryZnodeInfo?path="+encodeURI(encodeURI(_path))+"&cacheId="+cacheId
// }
// });
tab.panel('refresh',"zk/queryZnodeInfo?path="+encodeURI(encodeURI(_path))+"&cacheId="+cacheId);
}else {
$('#zkTab').tabs('add',{
id:rowIndex,
Expand All @@ -227,22 +232,29 @@ $(function(){
var tab = $('#zkTab').tabs('getTab',row.DESC);
//var index = $('#zkTab').tabs('getTabIndex',tab);
//alert(index);
//$.messager.alert('提示',tab+'enter onClickSuccess()!'+node.attributes.path);
var _path="/"
if (node&&node.attributes)
_path = node.attributes.path ;
if(tab != null){
//tab.title=node.text;
//tab.panel('refresh', "zk/queryZnodeInfo?path="+node.attributes.path);
$('#zkTab').tabs('update', {
tab: tab,
options: {
title: row.DESC, //node.text,
href: "zk/queryZnodeInfo?path="+encodeURI(encodeURI(node.attributes.path))+"&cacheId="+cacheId
}
});
}else {
// $.messager.alert('提示',tab+'enter onClickSuccess()!'+"zk/queryZnodeInfo?path="+encodeURI(encodeURI(node.attributes.path))+"&cacheId="+cacheId );
// $('#zkTab').tabs('update', {
// tab: tab,
// options: {
// title: row.DESC, //node.text,
// href: "zk/queryZnodeInfo?path="+encodeURI(encodeURI(node.attributes.path))+"&cacheId="+cacheId
// }
// });
tab.panel('refresh',"zk/queryZnodeInfo?path="+encodeURI(encodeURI(_path))+"&cacheId="+cacheId);
}
else {
$('#zkTab').tabs('add',{
id:rowIndex,
title:row.DESC,
closable:true,
href: "zk/queryZnodeInfo?path="+encodeURI(encodeURI(node.attributes.path))+"&cacheId="+cacheId
href: "zk/queryZnodeInfo?path="+encodeURI(encodeURI(_path))+"&cacheId="+cacheId
});
}

Expand Down Expand Up @@ -275,15 +287,15 @@ $(function(){

if(_cfg){

localeMessager('confirm','title','提示', '','delete this node and all children-nodes: '+node.attributes.path+' ?', function(r){
localeMessager('confirm','title','提示', 'none','delete this node and all children-nodes: '+node.attributes.path+' ?', function(r){
if (r){
//var s = node.text;
if (node.attributes){
_path = node.attributes.path ;
$.post("zk/deleteNode", {path: _path,cacheId:_cfg.ID},
function(data){
//alert("Data Loaded: " + data);
localeMessager('alert','title','提示', '',data+',Delete Done!');
localeMessager('alert','title','提示', 'none',data+',Delete Done!');
//
//var tab = $('#zkTab').tabs('getTab',0);
//alert(tab.title);
Expand All @@ -296,14 +308,15 @@ $(function(){
//var tab = $('#zkTab').tabs('getSelected');
var tab = $('#zkTab').tabs('getTab',_cfg.DESC);
cacheId=_cfg.ID;
localeMessager('alert','title','提示','','enter refreshtab()!'+node.attributes.path);
$('#zkTab').tabs('update', {
tab: tab,
options: {
title: _cfg.DESC, //node.text,
href: "zk/queryZnodeInfo?path="+encodeURI(encodeURI(node.attributes.path))+"&cacheId="+cacheId
}
});
//localeMessager('alert','title','提示','none','enter refreshtab()!'+node.attributes.path);
// $('#zkTab').tabs('update', {
// tab: tab,
// options: {
// title: _cfg.DESC, //node.text,
// href: "zk/queryZnodeInfo?path="+encodeURI(encodeURI(node.attributes.path))+"&cacheId="+cacheId
// }
// });
tab.panel('refresh',"zk/queryZnodeInfo?path="+encodeURI(encodeURI(node.attributes.path))+"&cacheId="+cacheId);
}
);

Expand Down Expand Up @@ -401,8 +414,8 @@ $(function(){
$.post("zk/createNode", { nodeName: _nodeName, path: _path,cacheId:_cfg.ID},
function(data){
//alert("Data Loaded: " + data);
localeMessager('alert','title','提示', '',data+',Add Done!');
$('#w').window('close');
localeMessager('alert','title','提示', 'none',data+',Add Done!');
$('#zkweb_add_node').window('close');
$('#zkTree').tree('reload',node.target);
$('#zkTree').tree('collapse',node.target);
$('#zkTree').tree('expand',node.target);
Expand All @@ -427,7 +440,7 @@ $(function(){
return isValid; // return false will stop the form submission
},
success: function(data){
localeMessager('alert','title','提示', '',data+',Save Done!');
localeMessager('alert','title','提示', 'none',data+',Save Done!');
$('#zkweb_zkcfg').datagrid("reload");
$('#zkweb_add_cfg').window('close');
$.messager.progress('close'); // hide progress bar while submit successfully
Expand All @@ -449,7 +462,7 @@ $(function(){
return isValid; // return false will stop the form submission
},
success: function(data){
localeMessager('alert','title','提示', '',data+',Update Done!');
localeMessager('alert','title','提示', 'none',data+',Update Done!');
$('#zkweb_zkcfg').datagrid("reload");
$('#zkweb_up_cfg').window('close');
$.messager.progress('close'); // hide progress bar while submit successfully
Expand Down Expand Up @@ -480,7 +493,7 @@ $(function(){
if (r){
//alert('confirmed:'+r);
$.get('zkcfg/delZkCfg',{id:_cfg.ID},function(data){
localeMessager('alert','title','提示', '',data+',Delete Done!');
localeMessager('alert','title','提示', 'none',data+',Delete Done!');
});
$('#zkweb_zkcfg').datagrid("reload");
$('#zkTab').tabs('close',0);
Expand Down

0 comments on commit 9a056cb

Please sign in to comment.