Authored by jimi.ji

fix java config bug

... ... @@ -37,12 +37,12 @@ public class PropertiesCtrl {
@RequestMapping("/getAuthModules")
@ResponseBody
public BaseResponse getAuthModules(PageRequest req, String application, String key,String loadCommonConfig) {
public BaseResponse getAuthModules(PageRequest req, String application, String key) {
if (StringUtils.isNotBlank(key)) {
BaseResponse response = httpRestClient.defaultPost(HttpUriContants.QUERY_APP_PROFILE + "?application=" + application + "&key=" + key +"&loadCommonConfig=" +loadCommonConfig, req, BaseResponse.class);
BaseResponse response = httpRestClient.defaultPost(HttpUriContants.QUERY_APP_PROFILE + "?application=" + application + "&key=" + key , req, BaseResponse.class);
return response;
} else {
BaseResponse response = httpRestClient.defaultPost(HttpUriContants.QUERY_APP_PROFILE + "?application=" + application +"&loadCommonConfig=" +loadCommonConfig, req, BaseResponse.class);
BaseResponse response = httpRestClient.defaultPost(HttpUriContants.QUERY_APP_PROFILE + "?application=" + application , req, BaseResponse.class);
return response;
}
... ...
... ... @@ -89,13 +89,13 @@
<span class="input-group-addon">KEY:</span>
<input type="text" id="user_key" name="user_key" class="form-control" placeholder=""/>
</div>
<div class="input-group" style="float: left">
<span class="input-group-addon">加载公共配置:</span>
<select id="checkbox_select" name="checkbox_select" class="form-control">
<option value="true" selected="selected">true</option>
<option value="false" selected="selected">false</option>
</select>
</div>
<%--<div class="input-group" style="float: left">--%>
<%--<span class="input-group-addon">加载公共配置:</span>--%>
<%--<select id="checkbox_select" name="checkbox_select" class="form-control">--%>
<%--<option value="true" selected="selected">true</option>--%>
<%--<option value="false" selected="selected">false</option>--%>
<%--</select>--%>
<%--</div>--%>
<button id="btnSearch" class="btn btn-primary" style="margin-left: 10px"
onclick="btnSearch()">
搜 索
... ... @@ -109,9 +109,35 @@
</div>
</div>
</div>
<div id="authModuleTable">
<div id="infoTableDiv">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active">
<a href="#javaConfigPart" id="javaConfigPartShow" aria-controls="ipPart" role="tab" data-toggle="tab">Java Config</a>
</li>
<li role="presentation" >
<a href="#applicationPart" aria-controls="totalPart" role="tab" data-toggle="tab">Application</a>
</li>
</ul>
<div class="tab-content" style="padding-top:10px">
<div role="tabpanel" class="tab-pane fade in active" id="javaConfigPart">
<div id="javaConfigTable"></div>
</div>
<div role="tabpanel" class="tab-pane fade" id="applicationPart">
<div id="applicationTable"></div>
</div>
</div>
</div>
<%--<div id="authModuleTable">--%>
<%--</div>--%>
</div>
</div>
</div>
... ... @@ -255,21 +281,40 @@
</script>
<script type="text/javascript">
$(function () {
refreshModuleTable();
var selectname_begin = $("#cloudType").val();
var user_key_begin = $("input[name='user_key']").val();
refreshModuleTable(selectname_begin,user_key_begin);
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
// 获取已激活的标签页的名称
var activeTab = $(e.target).text();
var selectname = $("#cloudType").val();
var user_key = $("input[name='user_key']").val();
if("Java Config"==activeTab){
refreshModuleTable(selectname,user_key);
}else {
applicationTable_load(user_key);
}
});
});
$('input[id=file]').change(function () {
$('#filepath').val($(this).val());
});
function refreshModuleTable() {
var selectname = $("#cloudType").val();
var user_key = $("input[name='user_key']").val();
var is_common_show = $("#checkbox_select").val();
$("#authModuleTable").table({
function applicationTable_load(user_key) {
$("#applicationTable").table({
columnAutoWidth: false,
url: contextPath + "/properity/getAuthModules?application=" + selectname + "&key=" + user_key+"&loadCommonConfig="+is_common_show,
url: contextPath + "/properity/getAuthModules?application=application&key=" + user_key,
striped: true,
title: "JAVA配置列表",
pagination: false,
... ... @@ -278,10 +323,66 @@
return defaultLoadFilter(data);
},
columns: [{
title: "application",
field: "application",
width: "10%"
title: "key",
field: "key",
width: "20%",
}, {
title: "default",
field: "defaultValue",
width: "20%"
}, {
title: "az1",
field: "az1Value",
width: "15%"
}, {
title: "az2",
field: "az2Value",
width: "15%"
}, {
title: "操作",
formatter: function (value, rowData, rowIndex) {
var div = $("<div>");
var application = rowData.application;
var key = rowData.key;
var defaultValue = "";
var az1Value = "";
var az2Value = "";
if (rowData.defaultValue !== undefined) {
defaultValue = rowData.defaultValue;
}
if (rowData.az1Value !== undefined) {
az1Value = rowData.az1Value;
}
if (rowData.az2Value !== undefined) {
az2Value = rowData.az2Value;
}
$("<button onclick=\"locadconfigmodal(\'" + application + "\',\'" + key + "\',\'" + defaultValue + "\',\'" + az1Value + "\',\'" + az2Value + "\')\">").addClass("btn btn-xs btn-success").html("修改").appendTo(div);
div.append("&nbsp;");
$("<button onclick=\"deleteAuthModule(\'" + rowData.application + "\',\'" + rowData.key + "\')\">").addClass("btn btn-xs btn-danger").html("删除").appendTo(div);
return div;
}
}], onLoadSuccess: function () {
mergeCell($('#authModuleTable'), 0);
}
});
}
function refreshModuleTable(selectname,user_key) {
// var is_common_show = $("#checkbox_select").val();
$("#javaConfigTable").table({
columnAutoWidth: false,
url: contextPath + "/properity/getAuthModules?application=" + selectname + "&key=" + user_key,
striped: true,
title: "JAVA配置列表",
pagination: false,
pageSize: 10,
loadFilter: function (data) {
return defaultLoadFilter(data);
},
columns: [{
title: "key",
field: "key",
width: "20%",
... ... @@ -382,7 +483,10 @@
function btnSearch() {
refreshModuleTable();
var selectname_begin = $("#cloudType").val();
var user_key_begin = $("input[name='user_key']").val();
$('#javaConfigPartShow').tab('show');
refreshModuleTable(selectname_begin,user_key_begin);
}
//打开新增或修改页面
... ... @@ -402,6 +506,8 @@
$("#application_modal").prop("disabled","disabled");
$("#myModalLabel").text("修改配置信息");
}else {
$("#key_modal").prop("readonly",false);
$("#application_modal").removeAttr("disabled");
$("#myModalLabel").text("新增配置信息");
$("input[name='default_value']").val("");
$("input[name='az1_value']").val("");
... ... @@ -457,7 +563,10 @@
contentType: "application/json",
dataType: "json",
success: function (resp) {
refreshModuleTable();
var selectname_begin = $("#cloudType").val();
var user_key_begin = $("input[name='user_key']").val();
$('#javaConfigPartShow').tab('show');
refreshModuleTable(selectname_begin,user_key_begin);
}
});
}
... ... @@ -490,7 +599,10 @@
if (resp.code == 200) {
$("#myModal").modal('hide');
// alert("修改与添加成功");
refreshModuleTable();
var selectname_begin = $("#cloudType").val();
var user_key_begin = $("input[name='user_key']").val();
$('#javaConfigPartShow').tab('show');
refreshModuleTable(selectname_begin,user_key_begin);
} else {
alert("修改与添加失败");
}
... ... @@ -517,7 +629,10 @@
if (data.code == 200) {
$("#uploadModal").modal('hide');
// alert("导入成功");
refreshModuleTable();
var selectname_begin = $("#cloudType").val();
var user_key_begin = $("input[name='user_key']").val();
$('#javaConfigPartShow').tab('show');
refreshModuleTable(selectname_begin,user_key_begin);
} else {
alert("导入失败");
}
... ...