增加debug参数管理,代码优化
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
* @since 2017年5月7日
|
||||
*/
|
||||
(function($){
|
||||
$.fn.mgResizebleHeight = function(options) {
|
||||
$.fn.mgResizableHeight = function(options) {
|
||||
var defaults = {prev:this,next:this, prevHtMin:0, prevHtMax:999, nextHtMin:0, nextHtMax:999};
|
||||
var opts = $.extend(defaults, options);
|
||||
var disY = 0, prevH = 0, nextH = 0, isStart = false;
|
||||
@@ -52,7 +52,7 @@
|
||||
/**
|
||||
* 改变宽度的功能,只是实现各种消息的通知,实际改变大小需要在回调里面自己操作
|
||||
*/
|
||||
$.fn.mgResizebleWidth = function(options) {
|
||||
$.fn.mgResizableWidth = function(options) {
|
||||
var defaults = {prev:this,next:this, prevWtMin:0, prevWtMax:999, nextWtMin:0, nextWtMax:999};
|
||||
var opts = $.extend(defaults, options);
|
||||
var disX = 0, prevW = 0, nextW = 0, isStart = false;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @since 2017年5月7日
|
||||
*/
|
||||
(function($){
|
||||
$.fn.mgResizebleHeight = function(options) {
|
||||
$.fn.mgResizableHeight = function(options) {
|
||||
var defaults = {prev:this,next:this, prevHtMin:0, prevHtMax:999, nextHtMin:0, nextHtMax:999};
|
||||
var opts = $.extend(defaults, options);
|
||||
var disY = 0, prevH = 0, nextH = 0, isStart = false;
|
||||
@@ -52,7 +52,7 @@
|
||||
/**
|
||||
* 改变宽度的功能,只是实现各种消息的通知,实际改变大小需要在回调里面自己操作
|
||||
*/
|
||||
$.fn.mgResizebleWidth = function(options) {
|
||||
$.fn.mgResizableWidth = function(options) {
|
||||
var defaults = {prev:this,next:this, prevWtMin:0, prevWtMax:999, nextWtMin:0, nextWtMax:999};
|
||||
var opts = $.extend(defaults, options);
|
||||
var disX = 0, prevW = 0, nextW = 0, isStart = false;
|
||||
|
||||
@@ -46,7 +46,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
String loginPage = "/statics/manage/login.html";
|
||||
|
||||
http.authorizeRequests().antMatchers("/login/**", "/document.html").permitAll()//为了测试其他功能,设置“ /** ”允许所有请求
|
||||
http.authorizeRequests().antMatchers("/login/**").permitAll()//为了测试其他功能,设置“ /** ”允许所有请求
|
||||
.antMatchers("/document.html").hasAuthority("DOC_ALL")
|
||||
// 其他地址的访问均需登录
|
||||
.anyRequest().authenticated().and()
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @since 2017年5月7日
|
||||
*/
|
||||
(function($){
|
||||
$.fn.mgResizebleHeight = function(options) {
|
||||
$.fn.mgResizableHeight = function(options) {
|
||||
var defaults = {prev:this,next:this, prevHtMin:0, prevHtMax:999, nextHtMin:0, nextHtMax:999};
|
||||
var opts = $.extend(defaults, options);
|
||||
var disY = 0, prevH = 0, nextH = 0, isStart = false;
|
||||
@@ -52,7 +52,7 @@
|
||||
/**
|
||||
* 改变宽度的功能,只是实现各种消息的通知,实际改变大小需要在回调里面自己操作
|
||||
*/
|
||||
$.fn.mgResizebleWidth = function(options) {
|
||||
$.fn.mgResizableWidth = function(options) {
|
||||
var defaults = {prev:this,next:this, prevWtMin:0, prevWtMax:999, nextWtMin:0, nextWtMax:999};
|
||||
var opts = $.extend(defaults, options);
|
||||
var disX = 0, prevW = 0, nextW = 0, isStart = false;
|
||||
|
||||
@@ -59,7 +59,7 @@ public class MgStorageController {
|
||||
}
|
||||
|
||||
@PostMapping(value = "/like")
|
||||
public DocResponseJson<Object> like(String key, String value) {
|
||||
public DocResponseJson<List<MgStorage>> like(String key, String value) {
|
||||
List<MgStorage> likeList = storageService.like(key, value);
|
||||
return DocResponseJson.ok(likeList);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="resizebleLeftRight" class="ui-resizable-handle mgresizebleW"></div>
|
||||
<div id="resizableLeftRight" class="ui-resizable-handle mgresizableW"></div>
|
||||
<div class="right-container" id="rightContent">
|
||||
<div class="right-container" id="rightContentMask"></div>
|
||||
<div class="tab-page tab-home-page">
|
||||
@@ -74,25 +74,6 @@
|
||||
<div class="tab-page tab-zpages hide">
|
||||
<div class="tabs" id="rightZpages"></div>
|
||||
</div>
|
||||
<!-- 在线调试配置 -->
|
||||
<div class="tab-page tab-online-debug-page hide">
|
||||
<div class="title-info">
|
||||
<div class="text">
|
||||
每次点击在线调试的发送请求后,都会默认保存一次请求的form、header、body数据到网页的本地存储中,以备下次使用,在此页面可以管理这些数据。
|
||||
一般浏览都有5M左右存储空间,如果存储过多有可能会导致部分功能异常,请随时清理一下不再使用的。
|
||||
</div>
|
||||
<button class="btn btn-primary refresh" type="button"><i class="icon icon-refresh"></i> 刷新</button>
|
||||
<button class="btn btn-primary expand-all" type="button"><i class="icon icon-expand-full"></i> 全部展开</button>
|
||||
<button class="btn btn-primary collapse-all" type="button"><i class="icon icon-collapse-full"></i> 全部收起</button>
|
||||
<button class="btn btn-danger del-all-param" type="button"><i class="icon icon-remove-sign"></i> 全部删除</button>
|
||||
</div>
|
||||
<table class="table table-bordered" id="onlineDebugParamTable">
|
||||
<thead>
|
||||
<tr><th>接口地址</th><th>参数配置</th><th>操作</th></tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="tab-page tab-document hide">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a data-tab href="#tabDocInfo">接口说明</a></li>
|
||||
|
||||
@@ -31,9 +31,9 @@ label{font-weight: normal;}
|
||||
.setting-table tr .info{text-align: right; max-width: 150px;}
|
||||
.show-doc span{color: #aaa;}
|
||||
|
||||
.mgresizebleW{z-index: 90;height: 100%; width: 10px; cursor: e-resize;}
|
||||
.mgresizableW{z-index: 90;height: 100%; width: 10px; cursor: e-resize;}
|
||||
.ui-resizable-handle {display: block;font-size: 0.1px;position: absolute;}
|
||||
#resizebleLeftRight{left: 360px;}
|
||||
#resizableLeftRight{left: 360px;}
|
||||
.unselect{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}
|
||||
|
||||
#homePageDashboard{overflow-y: auto;bottom: 0;top: 0;right: 0;left: 0;position: absolute;overflow-x: hidden;padding: 10px;}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="resizebleLeftRight" class="ui-resizable-handle mgresizebleW"></div>
|
||||
<div id="resizableLeftRight" class="ui-resizable-handle mgresizableW"></div>
|
||||
<div class="right-container" id="rightContent">
|
||||
<div class="tab-page tab-home-page">
|
||||
<div id="homePageDashboard" class="dashboard dashboard-draggable" data-height="290">
|
||||
@@ -195,7 +195,7 @@
|
||||
<script type="text/javascript" src="js/formatjson.js"></script>
|
||||
<script type="text/javascript" src="js/toast.js"></script>
|
||||
<script type="text/javascript" src="js/common.js"></script>
|
||||
<script type="text/javascript" src="js/mgResizeble.js"></script>
|
||||
<script type="text/javascript" src="js/mgResizable.js"></script>
|
||||
<script type="text/javascript" src="js/mg-ui-tree.js"></script>
|
||||
<script type="text/javascript" src="js/mg-ui-tag.js"></script>
|
||||
<script type="text/javascript" src="js/mg-ui-debug.js"></script>
|
||||
|
||||
@@ -71,7 +71,7 @@ $(document).ready(function(){
|
||||
/**
|
||||
* 自由拖动改变左右框架的宽度
|
||||
*/
|
||||
$("#resizebleLeftRight").mgResizebleWidth({
|
||||
$("#resizableLeftRight").mgResizableWidth({
|
||||
prev:"#leftContent",
|
||||
prevWtMin: 120, prevWtMax: 999999,
|
||||
nextWtMin: 360, nextWtMax: 999999,
|
||||
@@ -585,7 +585,7 @@ function createDefinitionsMapByJson(json) {
|
||||
*/
|
||||
function changeContentWidth(width) {
|
||||
$("#leftContent").css("width", width + 'px');
|
||||
$("#resizebleLeftRight").css("left", width + 'px');
|
||||
$("#resizableLeftRight").css("left", width + 'px');
|
||||
$("#rightContent").css("left", width + 'px');
|
||||
var logoText = "swagger-mg-ui";
|
||||
if(width < 270 && width > 140){
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @since 2017年5月7日
|
||||
*/
|
||||
(function($){
|
||||
$.fn.mgResizebleHeight = function(options) {
|
||||
$.fn.mgResizableHeight = function(options) {
|
||||
var defaults = {prev:this,next:this, prevHtMin:0, prevHtMax:999, nextHtMin:0, nextHtMax:999};
|
||||
var opts = $.extend(defaults, options);
|
||||
var disY = 0, prevH = 0, nextH = 0, isStart = false;
|
||||
@@ -52,7 +52,7 @@
|
||||
/**
|
||||
* 改变宽度的功能,只是实现各种消息的通知,实际改变大小需要在回调里面自己操作
|
||||
*/
|
||||
$.fn.mgResizebleWidth = function(options) {
|
||||
$.fn.mgResizableWidth = function(options) {
|
||||
var defaults = {prev:this,next:this, prevWtMin:0, prevWtMax:999, nextWtMin:0, nextWtMax:999};
|
||||
var opts = $.extend(defaults, options);
|
||||
var disX = 0, prevW = 0, nextW = 0, isStart = false;
|
||||
|
||||
@@ -13,10 +13,6 @@ ul{list-style: none;list-style-type: none;}
|
||||
.table td, .table th {vertical-align: middle;}
|
||||
#tabDocInfo{position: absolute; bottom: 0;top: 60px;overflow-y: auto; right: 0; left: 10px;}
|
||||
#tabOnlineDebug .param-response-box{position: absolute; bottom: 0;top: 100px;overflow-y: auto; right: 0; left: 10px;}
|
||||
.tab-online-debug-page{overflow-y: auto;position: absolute; bottom: 0;top: 10px; right: 0; left: 10px;}
|
||||
.tab-online-debug-page .title-info{padding-bottom: 10px;}
|
||||
.tab-online-debug-page .title-info .btn{margin-right: 20px;}
|
||||
.tab-online-debug-page .title-info .text{padding-bottom: 10px;}
|
||||
|
||||
.local-storage{display: none;}
|
||||
|
||||
@@ -31,9 +27,9 @@ label{font-weight: normal;}
|
||||
.setting-table tr .info{text-align: right; max-width: 150px;}
|
||||
.show-doc span{color: #aaa;}
|
||||
|
||||
.mgresizebleW{z-index: 90;height: 100%; width: 10px; cursor: e-resize;}
|
||||
.mgresizableW{z-index: 90;height: 100%; width: 10px; cursor: e-resize;}
|
||||
.ui-resizable-handle {display: block;font-size: 0.1px;position: absolute;}
|
||||
#resizebleLeftRight{left: 360px;}
|
||||
#resizableLeftRight{left: 360px;}
|
||||
.unselect{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}
|
||||
|
||||
#homePageDashboard{overflow-y: auto;bottom: 0;top: 0;right: 0;left: 0;position: absolute;overflow-x: hidden;padding: 10px;}
|
||||
|
||||
@@ -13,7 +13,7 @@ function serialize(value) {
|
||||
|
||||
function deserialize(value) {
|
||||
if (typeof value !== 'string' || isEmpty(value)) {
|
||||
return undefined;
|
||||
return value;
|
||||
}
|
||||
try {
|
||||
return JSON.parse(value);
|
||||
@@ -266,6 +266,29 @@ String.prototype.startWith = function(str) {
|
||||
return (this.substr(0, str.length) == str);
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取数据,异步的操作
|
||||
*/
|
||||
function getStorageLike(key, success, fail) {
|
||||
var start = (typeof urlBase === 'string') ? urlBase : '';
|
||||
ajaxTemp(start + "swagger-mg-ui/storage/like", "post", "json", {key: key}, function(json){
|
||||
if(json.errCode == 200) {
|
||||
if(typeof success == "function") {
|
||||
var result = deserialize(json.data);
|
||||
success(result);
|
||||
}
|
||||
} else {
|
||||
if(typeof fail == "function") {
|
||||
fail();
|
||||
}
|
||||
}
|
||||
}, function(msg){
|
||||
if(typeof fail == "function") {
|
||||
fail();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据,异步的操作
|
||||
*/
|
||||
@@ -313,6 +336,29 @@ function setStorage(key, value, success, fail) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
function deleteStorage(key, success, fail) {
|
||||
var start = (typeof urlBase === 'string') ? urlBase : '';
|
||||
ajaxTemp(start + "swagger-mg-ui/storage/delete", "post", "json", {key: key}, function(json){
|
||||
if(json.errCode == 200) {
|
||||
if(typeof success == "function") {
|
||||
success();
|
||||
}
|
||||
} else {
|
||||
if(typeof fail == "function") {
|
||||
fail(getNotEmptyStr(json.errMsg));
|
||||
}
|
||||
}
|
||||
}, function(msg){
|
||||
if(typeof fail == "function") {
|
||||
fail("");
|
||||
}
|
||||
console.log("存储数据到服务器失败,请检查");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取父窗口的exports
|
||||
* @returns
|
||||
|
||||
@@ -2,4 +2,5 @@ var cacheKeys = {
|
||||
userSettings: 'userSettings',
|
||||
swaggerResourcesList: 'swagger-resources-list',
|
||||
globalParamList: 'zyplayer-doc-global-param-list',
|
||||
pRequestObjStart: 'p-request-obj-',
|
||||
}
|
||||
@@ -133,7 +133,7 @@ function addDocumentByService(choiseDocList) {
|
||||
/**
|
||||
* 自由拖动改变左右框架的宽度
|
||||
*/
|
||||
$("#resizebleLeftRight").mgResizebleWidth({
|
||||
$("#resizableLeftRight").mgResizableWidth({
|
||||
prev:"#leftContent",
|
||||
prevWtMin: 120, prevWtMax: 999999,
|
||||
nextWtMin: 360, nextWtMax: 999999,
|
||||
@@ -851,7 +851,7 @@ function getRequestParamObj(responsesObj, prevRef) {
|
||||
*/
|
||||
function changeContentWidth(width) {
|
||||
$("#leftContent").css("width", width + 'px');
|
||||
$("#resizebleLeftRight").css("left", width + 'px');
|
||||
$("#resizableLeftRight").css("left", width + 'px');
|
||||
$("#rightContent").css("left", width + 'px');
|
||||
var logoText = "zyplayer-doc-swagger";
|
||||
if(width < 370 && width > 290){
|
||||
@@ -995,7 +995,6 @@ function updateUserSettingsUi() {
|
||||
$("input[name='showParamType'][value='"+userSettings.showParamType+"']").prop("checked",true);
|
||||
$("input[name='onlyUseLastParam'][value='"+userSettings.onlyUseLastParam+"']").prop("checked",true);
|
||||
$("input[name='autoFillParam'][value='"+userSettings.autoFillParam+"']").prop("checked",true);
|
||||
//$(".local-storage").show();// 服务器存储了就不用管理了
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @since 2017年5月7日
|
||||
*/
|
||||
(function($){
|
||||
$.fn.mgResizebleHeight = function(options) {
|
||||
$.fn.mgResizableHeight = function(options) {
|
||||
var defaults = {prev:this,next:this, prevHtMin:0, prevHtMax:999, nextHtMin:0, nextHtMax:999};
|
||||
var opts = $.extend(defaults, options);
|
||||
var disY = 0, prevH = 0, nextH = 0, isStart = false;
|
||||
@@ -52,7 +52,7 @@
|
||||
/**
|
||||
* 改变宽度的功能,只是实现各种消息的通知,实际改变大小需要在回调里面自己操作
|
||||
*/
|
||||
$.fn.mgResizebleWidth = function(options) {
|
||||
$.fn.mgResizableWidth = function(options) {
|
||||
var defaults = {prev:this,next:this, prevWtMin:0, prevWtMax:999, nextWtMin:0, nextWtMax:999};
|
||||
var opts = $.extend(defaults, options);
|
||||
var disX = 0, prevW = 0, nextW = 0, isStart = false;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<html xmlns:v-on="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
@@ -9,27 +9,84 @@
|
||||
|
||||
<body>
|
||||
<div id="app">
|
||||
调试数据管理
|
||||
<div class="title-info">
|
||||
<div class="alert alert-primary">
|
||||
<div class="content">Tips:每次点击在线调试的发送请求后,都会默认保存一次请求的form、header、body数据,以备下次使用,在此页面可以管理这些数据</div>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-bordered" id="onlineDebugParamTable">
|
||||
<thead>
|
||||
<tr><th>接口地址</th><th>参数配置</th><th>操作</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(item,index) in debugDataList" :key="item.id" :data-id="item.id" :data-index="index" >
|
||||
<td>{{item.key}}</td>
|
||||
<td>{{item.value}}</td>
|
||||
<td>
|
||||
<button class="btn btn-danger" type="button" v-on:click="deleteDebugData($event)">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" align="center">
|
||||
<button class="btn" type="button" v-on:click="btnRefreshList"> 刷新 </button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
<script src="../zui/js/zui.min.js"></script>
|
||||
<script src="../mg-ui/js/jquery-3.1.0.min.js"></script>
|
||||
<script src="../zui/js/zui.min.js"></script>
|
||||
<script src="../mg-ui/js/common.js"></script>
|
||||
<script src="../mg-ui/js/mg-ui-cache-keys.js"></script>
|
||||
<script src="../vue/vue.js"></script>
|
||||
<script src="../mg-ui/js/toast.js"></script>
|
||||
|
||||
<script>
|
||||
var urlBase = "../../";
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
userId: "",
|
||||
debugDataList: [],
|
||||
},
|
||||
mounted: function(){
|
||||
this.refreshList();
|
||||
},
|
||||
methods: {
|
||||
|
||||
btnRefreshList: function(){
|
||||
this.refreshList();
|
||||
Toast.success("刷新成功!");
|
||||
},
|
||||
deleteDebugData: function(event){
|
||||
if(!confirm("确定要删除吗?")) {
|
||||
return;
|
||||
}
|
||||
var tr = $(event.currentTarget).parents("tr");
|
||||
var index = tr.data("index");
|
||||
var delKey = app.debugDataList[index].key;
|
||||
var newDebugList = [];
|
||||
for(var i=0;i<app.debugDataList.length;i++){
|
||||
if(i != index) {
|
||||
newDebugList.push(app.debugDataList[i]);
|
||||
}
|
||||
}
|
||||
deleteStorage(delKey, function(data){
|
||||
app.debugDataList = newDebugList;
|
||||
Toast.success("删除成功!");
|
||||
});
|
||||
},
|
||||
refreshList: function () {
|
||||
getStorageLike(cacheKeys.pRequestObjStart, function(data){
|
||||
// console.log(data);
|
||||
app.debugDataList = data;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
#app{padding-top: 10px;}
|
||||
</style>
|
||||
</html>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user