context-path 대응

This commit is contained in:
현성필
2024-01-23 14:44:00 +09:00
parent 1e059a8cf7
commit be1053d832
6 changed files with 81 additions and 37 deletions
+36 -15
View File
@@ -9,7 +9,7 @@ import VariableSnippet from "./components/VariableSnippet";
class APITester {
constructor() {
constructor(contextPath) {
this.servers = [];
this.apiTabTitleTarget = '#apiRequestTabTitle';
this.apiTabContentTarget = '#apiRequestTabContent';
@@ -26,8 +26,35 @@ class APITester {
this.apiClient = new APIClient();
this.popperContent = document.getElementById('popperContent');
this.popperInstance = null;
this.contextPath = contextPath || '/';
}
getCollectionListURL(){
return this.contextPath + 'mgmt/collections/list.do';
}
getCollectionCreateURL(){
return this.contextPath + 'mgmt/collections/create.do';
}
getCollectionUpdateURL(){
return this.contextPath + 'mgmt/collections/update.do';
}
getCollectionDeleteURL(){
return this.contextPath + 'mgmt/collections/delete.do';
}
getAPISaveURL(collectionId){
return this.contextPath + `mgmt/collections/${collectionId}/apis/save.do`;
}
getAPIDeleteURL(collectionId){
return this.contextPath + `mgmt/collections/${collectionId}/apis/delete.do`;
}
renderServers(selectedServer) {
const optionsHtml = this.servers.map(server => `
<option value="${server.id}" ${selectedServer === server.id ? 'selected' : ''} data-path="${server.basePath}">${server.name}</option>
@@ -749,12 +776,6 @@ class APITester {
start: function (event, ui) {
// You can add any additional data or styles you want when dragging starts
$(this).addClass('dragging');
const apiDetails = {
name: 'API 이름',
method: 'POST',
url: 'http://localhost:8080/api/test'
};
},
stop: function (event, ui) {
// Clean up, e.g., remove styles or data
@@ -908,7 +929,7 @@ class APITester {
loadCollections() {
const me = this;
this.currentAjaxRequest = $.ajax({
url: '/mgmt/collections/list.do',
url: this.getCollectionListURL(),
type: 'GET',
contentType: 'application/json',
success: function (data) {
@@ -936,7 +957,7 @@ class APITester {
const me = this;
me.showLoadingOverlay();
this.currentAjaxRequest = $.ajax({
url: '/mgmt/collections/create.do',
url: this.getCollectionCreateURL(),
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({name: name}),
@@ -957,7 +978,7 @@ class APITester {
const me = this;
me.showLoadingOverlay();
this.currentAjaxRequest = $.ajax({
url: '/mgmt/collections/update.do',
url: this.getCollectionUpdateURL(),
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({id: id, name: name}),
@@ -979,7 +1000,7 @@ class APITester {
const me = this;
me.showLoadingOverlay();
this.currentAjaxRequest = $.ajax({
url: '/mgmt/collections/delete.do',
url: this.getCollectionDeleteURL(),
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({id: collectionId}),
@@ -1002,7 +1023,7 @@ class APITester {
const me = this;
me.showLoadingOverlay();
this.currentAjaxRequest = $.ajax({
url: `/mgmt/collections/${model.collectionId}/apis/save.do`,
url: this.getAPISaveURL(model.collectionId),
type: 'POST',
contentType: 'application/json',
data: JSON.stringify(model),
@@ -1029,7 +1050,7 @@ class APITester {
me.showLoadingOverlay();
this.currentAjaxRequest = $.ajax({
url: `/mgmt/collections/${model.collectionId}/apis/save.do`,
url: this.getAPISaveURL(model.collectionId),
type: 'POST',
contentType: 'application/json',
data: JSON.stringify(model),
@@ -1083,7 +1104,7 @@ class APITester {
newApi.collectionName = collection.name;
this.currentAjaxRequest = $.ajax({
url: `/mgmt/collections/${collectionId}/apis/save.do`,
url: this.getAPISaveURL(collectionId),
type: 'POST',
contentType: 'application/json',
data: JSON.stringify(newApi),
@@ -1175,7 +1196,7 @@ class APITester {
}
const me = this;
this.currentAjaxRequest = $.ajax({
url: `/mgmt/collections/${collectionId}/apis/delete.do`,
url: this.getAPIDeleteURL(collectionId),
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({id: apiId}),