swagger文档支持禁用和启用
This commit is contained in:
@@ -449,6 +449,29 @@ public class MgDocumentController {
|
|||||||
return DocResponseJson.ok();
|
return DocResponseJson.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 禁用或启用/v2/api-docs
|
||||||
|
*
|
||||||
|
* @author 暮光:城中城
|
||||||
|
* @since 2018年8月21日
|
||||||
|
* @param location 文档地址
|
||||||
|
* @param disable 0=启用 1=禁用
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
@PostMapping(value = "/disableSwaggerDoc")
|
||||||
|
public ResponseJson<Object> disableSwaggerDoc(String location, Integer disable) {
|
||||||
|
List<LocationListVo> locationList = this.getLocationSet();
|
||||||
|
String locationDel = this.encodeUrlParam(location);
|
||||||
|
for (LocationListVo locationVo : locationList) {
|
||||||
|
if (Objects.equals(locationVo.getLocation(), locationDel)) {
|
||||||
|
locationVo.setDisabled(Objects.equals(1, disable) ? 1 : 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.storageSwaggerLocationList(locationList);
|
||||||
|
return DocResponseJson.ok();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取swaggerLocation列表
|
* 获取swaggerLocation列表
|
||||||
*
|
*
|
||||||
@@ -459,6 +482,7 @@ public class MgDocumentController {
|
|||||||
@PostMapping(value = "/getLocationList")
|
@PostMapping(value = "/getLocationList")
|
||||||
public ResponseJson<List<LocationListVo>> getLocationList() {
|
public ResponseJson<List<LocationListVo>> getLocationList() {
|
||||||
List<LocationListVo> locationSet = this.getLocationSet();
|
List<LocationListVo> locationSet = this.getLocationSet();
|
||||||
|
locationSet = locationSet.stream().filter(val -> val.getDisabled() == null || val.getDisabled() == 0).collect(Collectors.toList());
|
||||||
return DocResponseJson.ok(locationSet);
|
return DocResponseJson.ok(locationSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ public class LocationListVo {
|
|||||||
private String name;
|
private String name;
|
||||||
private String uuid;
|
private String uuid;
|
||||||
private String location;
|
private String location;
|
||||||
|
private Integer disabled;
|
||||||
private String resources;
|
private String resources;
|
||||||
private Integer openVisit;
|
private Integer openVisit;
|
||||||
private String customName;
|
private String customName;
|
||||||
@@ -111,4 +112,12 @@ public class LocationListVo {
|
|||||||
public void setCustomName(String customName) {
|
public void setCustomName(String customName) {
|
||||||
this.customName = customName;
|
this.customName = customName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getDisabled() {
|
||||||
|
return disabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDisabled(Integer disabled) {
|
||||||
|
this.disabled = disabled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
<td>地址</td>
|
<td>地址</td>
|
||||||
<td>开放文档地址</td>
|
<td>开放文档地址</td>
|
||||||
<td>重写域名地址</td>
|
<td>重写域名地址</td>
|
||||||
|
<td>状态</td>
|
||||||
<td>操作</td>
|
<td>操作</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -34,14 +35,17 @@
|
|||||||
<span v-else>暂未开放</span>
|
<span v-else>暂未开放</span>
|
||||||
</td>
|
</td>
|
||||||
<td>{{item.rewriteDomainUrl}}</td>
|
<td>{{item.rewriteDomainUrl}}</td>
|
||||||
|
<td>{{item.disabled==1?'已禁用':'已启用'}}</td>
|
||||||
<td>
|
<td>
|
||||||
|
<button class="btn btn-primary" type="button" @click="disableDocUrl(item.location, 0)" v-if="item.disabled==1">启用</button>
|
||||||
|
<button class="btn btn-primary" type="button" @click="disableDocUrl(item.location, 1)" v-else>禁用</button>
|
||||||
<button class="btn btn-danger" type="button" @click="deleteDocUrl(item.location)">删除</button>
|
<button class="btn btn-danger" type="button" @click="deleteDocUrl(item.location)">删除</button>
|
||||||
<button class="btn btn-info" type="button" v-on:click="editDocUrl($event)">编辑</button>
|
<button class="btn btn-info" type="button" v-on:click="editDocUrl($event)">编辑</button>
|
||||||
<!--<button class="btn btn-danger" type="button" v-on:click="syncDocData($event)">持久化</button>-->
|
<!--<button class="btn btn-danger" type="button" v-on:click="syncDocData($event)">持久化</button>-->
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="6" align="center">
|
<td colspan="7" align="center">
|
||||||
<button class="btn" type="button" v-on:click="btnRefreshList"> 刷新 </button>
|
<button class="btn" type="button" v-on:click="btnRefreshList"> 刷新 </button>
|
||||||
<button class="btn btn-primary" type="button" v-on:click="addNewDocument">增加文档</button>
|
<button class="btn btn-primary" type="button" v-on:click="addNewDocument">增加文档</button>
|
||||||
</td>
|
</td>
|
||||||
@@ -189,6 +193,14 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
disableDocUrl: function (location, disable) {
|
||||||
|
ajaxTemp(urlBase + "swagger-mg-ui/document/disableSwaggerDoc", "post", "json", {location: location, disable: disable}, function (json) {
|
||||||
|
if (validateResult(json)) {
|
||||||
|
Toast.success((disable == 1) ? "禁用成功!" : "启用成功!");
|
||||||
|
app.refreshList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
syncDocData: function (event) {
|
syncDocData: function (event) {
|
||||||
var tr = $(event.currentTarget).parents("tr");
|
var tr = $(event.currentTarget).parents("tr");
|
||||||
var index = tr.data("index");
|
var index = tr.data("index");
|
||||||
|
|||||||
Reference in New Issue
Block a user