support page render
This commit is contained in:
parent
f5b00a9c9f
commit
0b06704276
|
@ -97,6 +97,11 @@ public interface DocTags {
|
||||||
*/
|
*/
|
||||||
String DOWNLOAD = "download";
|
String DOWNLOAD = "download";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* custom @page tag
|
||||||
|
*/
|
||||||
|
String PAGE = "page";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ignore ResponseBodyAdvice
|
* Ignore ResponseBodyAdvice
|
||||||
|
|
|
@ -177,6 +177,11 @@ public class ApiMethodDoc implements Serializable {
|
||||||
*/
|
*/
|
||||||
private String link;
|
private String link;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mark page
|
||||||
|
*/
|
||||||
|
private String page = "";
|
||||||
|
|
||||||
public String getMethodId() {
|
public String getMethodId() {
|
||||||
return methodId;
|
return methodId;
|
||||||
}
|
}
|
||||||
|
@ -389,6 +394,14 @@ public class ApiMethodDoc implements Serializable {
|
||||||
this.link = link;
|
this.link = link;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPage() {
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPage(String page) {
|
||||||
|
this.page = page;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
final StringBuilder sb = new StringBuilder("{");
|
final StringBuilder sb = new StringBuilder("{");
|
||||||
|
|
|
@ -165,6 +165,11 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate<ApiDoc> {
|
||||||
if (Objects.nonNull(downloadTag)) {
|
if (Objects.nonNull(downloadTag)) {
|
||||||
apiMethodDoc.setDownload(true);
|
apiMethodDoc.setDownload(true);
|
||||||
}
|
}
|
||||||
|
DocletTag pageTag = method.getTagByName(DocTags.PAGE);
|
||||||
|
if (Objects.nonNull(pageTag)) {
|
||||||
|
String pageUrl = "/" + projectBuilder.getServerUrl() + "/" + pageTag.getValue();
|
||||||
|
apiMethodDoc.setPage(UrlUtil.simplifyUrl(pageUrl));
|
||||||
|
}
|
||||||
DocletTag docletTag = method.getTagByName(DocTags.GROUP);
|
DocletTag docletTag = method.getTagByName(DocTags.GROUP);
|
||||||
if (Objects.nonNull(docletTag)) {
|
if (Objects.nonNull(docletTag)) {
|
||||||
apiMethodDoc.setGroup(docletTag.getValue());
|
apiMethodDoc.setGroup(docletTag.getValue());
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -45,6 +45,7 @@ $("button").on("click", function () {
|
||||||
const $queryElement = $("#" + id + "-query-params")
|
const $queryElement = $("#" + id + "-query-params")
|
||||||
const url = $("#" + id + "-url").data("url");
|
const url = $("#" + id + "-url").data("url");
|
||||||
const isDownload = $("#" + id + "-url").data("download");
|
const isDownload = $("#" + id + "-url").data("download");
|
||||||
|
const page = $("#" + id + "-url").data("page");
|
||||||
const method = $("#" + id + "-method").data("method");
|
const method = $("#" + id + "-method").data("method");
|
||||||
const contentType = $("#" + id + "-content-type").data("content-type");
|
const contentType = $("#" + id + "-content-type").data("content-type");
|
||||||
console.log("request-headers=>" + JSON.stringify(headersData))
|
console.log("request-headers=>" + JSON.stringify(headersData))
|
||||||
|
@ -52,15 +53,21 @@ $("button").on("click", function () {
|
||||||
|
|
||||||
console.log("body-params=>" + JSON.stringify(bodyParamData))
|
console.log("body-params=>" + JSON.stringify(bodyParamData))
|
||||||
console.log("json-body=>" + body);
|
console.log("json-body=>" + body);
|
||||||
|
let finalUrl = "";
|
||||||
let queryParamData = "";
|
let queryParamData = "";
|
||||||
|
if (page != "" || page != null) {
|
||||||
|
queryParamData = getInputData($queryElement)
|
||||||
|
finalUrl = castToGetUri(page, pathParamData, queryParamData)
|
||||||
|
window.open(finalUrl, "_blank");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (isDownload) {
|
if (isDownload) {
|
||||||
queryParamData = getInputData($queryElement);
|
queryParamData = getInputData($queryElement);
|
||||||
download(url, headersData, pathParamData, queryParamData, bodyParamData, method, contentType);
|
download(url, headersData, pathParamData, queryParamData, bodyParamData, method, contentType);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const ajaxOptions = {};
|
const ajaxOptions = {};
|
||||||
let finalUrl = "";
|
|
||||||
if ("multipart/form-data" == contentType) {
|
if ("multipart/form-data" == contentType) {
|
||||||
finalUrl = castToGetUri(url, pathParamData);
|
finalUrl = castToGetUri(url, pathParamData);
|
||||||
queryParamData = getInputData($queryElement, true)
|
queryParamData = getInputData($queryElement, true)
|
||||||
|
|
Loading…
Reference in New Issue