From 29e805d9729f178fde02198f1bf9e4c1f07d8d9c Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Mon, 13 Mar 2023 17:49:15 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=B7=A5=E4=BD=9C=E5=8F=B0):=20?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=B7=A5=E4=BD=9C=E5=8F=B0=E4=B8=8D=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E6=8E=A5=E5=8F=A3=E4=BB=A5=E5=8F=8A=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../frontend/src/api/definition-module.js | 5 - workstation/frontend/src/api/environment.js | 12 - workstation/frontend/src/api/home.js | 26 -- workstation/frontend/src/api/img.js | 24 -- workstation/frontend/src/api/issue.js | 17 -- workstation/frontend/src/api/license.js | 7 - workstation/frontend/src/api/performance.js | 223 +----------------- workstation/frontend/src/api/project.js | 4 - workstation/frontend/src/api/scenario.js | 140 ----------- workstation/frontend/src/api/test-plan.js | 2 - .../frontend/src/api/user-management.js | 6 - workstation/frontend/src/api/user.js | 2 +- workstation/frontend/src/api/workstation.js | 2 +- 13 files changed, 3 insertions(+), 467 deletions(-) delete mode 100644 workstation/frontend/src/api/home.js delete mode 100644 workstation/frontend/src/api/img.js delete mode 100644 workstation/frontend/src/api/license.js delete mode 100644 workstation/frontend/src/api/user-management.js diff --git a/workstation/frontend/src/api/definition-module.js b/workstation/frontend/src/api/definition-module.js index dd4e92f5d1..67fb972208 100644 --- a/workstation/frontend/src/api/definition-module.js +++ b/workstation/frontend/src/api/definition-module.js @@ -1,10 +1,5 @@ import {get, post} from "metersphere-frontend/src/plugins/request" -export function getApiModules(projectId, protocol, currentVersion) { - let url = '/api/module/list/' + projectId + '/' + protocol + (currentVersion ? '/' + currentVersion : ''); - return get(url); -} - export function getApiModuleByProjectIdAndProtocol(projectId, protocol) { let url = '/api/module/list/' + projectId + '/' + protocol; return get(url); diff --git a/workstation/frontend/src/api/environment.js b/workstation/frontend/src/api/environment.js index 5e8eced4a9..780c6fbf35 100644 --- a/workstation/frontend/src/api/environment.js +++ b/workstation/frontend/src/api/environment.js @@ -1,9 +1,5 @@ import {get, post} from 'metersphere-frontend/src/plugins/request'; -export function getEnvironmentPages(goPage, pageSize, param) { - return post(`/environment/list/${goPage}/${pageSize}`, param); -} - export function getEnvironments(projectId) { return get(`/environment/list/${projectId}`); } @@ -16,18 +12,10 @@ export function getEnvironmentGroupPages(goPage, pageSize, param) { return post(`/environment/group/list/${goPage}/${pageSize}`, param); } -export function getAllEnvironmentGroups(param) { - return post('/environment/group/get/all', param); -} - export function copyEnvironmentGroup(groupId) { return get(`/environment/group/copy/${groupId}`); } -export function delEnvironmentGroup(groupId) { - return get(`/environment/group/delete/${groupId}`); -} - export function modifyEnvironmentGroup(group) { return post('/environment/group/modify', group); } diff --git a/workstation/frontend/src/api/home.js b/workstation/frontend/src/api/home.js deleted file mode 100644 index a2c40054f4..0000000000 --- a/workstation/frontend/src/api/home.js +++ /dev/null @@ -1,26 +0,0 @@ -import {get, post} from "metersphere-frontend/src/plugins/request" - -export function apiCountByProjectId(projectId) { - return get('/home/api/count/' + projectId); -} - -export function countApiCoverageByProjectId(projectId) { - return get('/home/api/coverage/' + projectId); -} - -export function apiCaseCountByProjectId(projectId) { - return get('/home/api/case/count/' + projectId); -} - -export function scheduleTaskCountByProjectId(projectId) { - return get('/home/schedule/task/count/' + projectId); -} - -export function apiRunningTask(id, params) { - return post('/home/running/task/' + id, params); -} - -export function databaseValidate(params) { - return post('/home/database/validate', params); -} - diff --git a/workstation/frontend/src/api/img.js b/workstation/frontend/src/api/img.js deleted file mode 100644 index ae95d84e2c..0000000000 --- a/workstation/frontend/src/api/img.js +++ /dev/null @@ -1,24 +0,0 @@ -import {getUUID} from "metersphere-frontend/src/utils"; -import {get, request} from "metersphere-frontend/src/plugins/request" - - -export function uploadMarkDownImg(file) { - let param = { - id: getUUID().substring(0, 8) - }; - file.prefix = param.id; - param.fileName = file.name.substring(file.name.lastIndexOf('.')); - let config = { - method: 'POST', - url: '/plugin/add', - data: param, - headers: { - 'Content-Type': undefined - } - }; - return request(config); -} - -export function deleteMarkDownImg(file) { - return get('/resource/md/delete/' + file[1].name); -} diff --git a/workstation/frontend/src/api/issue.js b/workstation/frontend/src/api/issue.js index b9c7b41071..291e3f3095 100644 --- a/workstation/frontend/src/api/issue.js +++ b/workstation/frontend/src/api/issue.js @@ -1,29 +1,12 @@ import {get, post} from "metersphere-frontend/src/plugins/request" import {getIssueTemplate} from "metersphere-frontend/src/api/custom-field-template"; -import {hasLicense} from "metersphere-frontend/src/utils/permission"; import {getCurrentProjectID} from "metersphere-frontend/src/utils/token"; -import {getUUID} from "metersphere-frontend/src/utils"; import {getCurrentProject} from "@/api/project"; -export function getJiraIssueType(param) { - return post('/issues/jira/issuetype', param); -} - - export function getIssues(page) { return post(`issues/list/${page.currentPage}/${page.pageSize}`, page.condition); } -export function syncIssues(success) { - let url = 'issues/sync/'; - if (hasLicense()) { - url = 'xpack/issue/sync/'; - } - // 浏览器默认策略,请求同一个url,可能导致 stalled 时间过长,加个uuid防止请求阻塞 - url = url + getCurrentProjectID() + "?stamp=" + getUUID(); - return get(url, success); -} - export function getDashboardIssues(page) { return post(`issues/dashboard/list/${page.currentPage}/${page.pageSize}`, page.condition); } diff --git a/workstation/frontend/src/api/license.js b/workstation/frontend/src/api/license.js deleted file mode 100644 index 69517e20c6..0000000000 --- a/workstation/frontend/src/api/license.js +++ /dev/null @@ -1,7 +0,0 @@ -import {post} from "metersphere-frontend/src/plugins/request" - -export function saveLicense(data) { - return post("/samples/license/save", data) -} - - diff --git a/workstation/frontend/src/api/performance.js b/workstation/frontend/src/api/performance.js index 3f66371163..ce1161098d 100644 --- a/workstation/frontend/src/api/performance.js +++ b/workstation/frontend/src/api/performance.js @@ -1,226 +1,5 @@ -import {get, post, request} from "metersphere-frontend/src/plugins/request" - -export function getDashboardHeatmap() { - return get('/performance/dashboard/tests') -} - -export function getRecentTests(condition) { - return post('/performance/recent/5', condition) -} - -export function getRecentReports(condition) { - return post('/performance/report/recent/5', condition) -} - -export function getReportCount(testId) { - return get(`/performance/test/report-count/${testId}`) -} - -export function getPerformanceVersions(testId) { - return get(`/performance/versions/${testId}`) -} - -export function deleteCurrentVersionTest(test) { - return get(`performance/delete/${test.versionId}/${test.refId}`); -} +import {post} from "metersphere-frontend/src/plugins/request" export function searchTests(goPage, pageSize, condition) { return post(`/performance/list/${goPage}/${pageSize}`, condition) } - -export function copyTest(test) { - return post(`/performance/copy`, {id: test.id}) -} - -export function runTest(test) { - return post('/performance/run', {id: test.id, triggerMode: 'MANUAL'}) -} - -export function deleteTest(data) { - return post(`/performance/delete`, data) -} - -export function deleteTestBatch(data) { - return post(`/performance/delete/batch`, data) -} - -export function getTest(id) { - return get(`/performance/get/${id}`) -} - -export function getFollows(id) { - return get(`/performance/test/follow/${id}`) -} - -export function getTestVersionHistory(id) { - return get(`/performance/versions/${id}`) -} - -export function getTestByVersion(versionId, refId) { - return get(`/performance/get/${versionId}/${refId}`) -} - -export function syncScenario(param) { - return get(`/performance/sync/scenario`, param) -} - -export function saveSchedule(param) { - let url = '/performance/schedule/create'; - if (param.id) { - url = '/performance/schedule/update'; - } - return post(url, param); -} - -export function saveTest(test, formData) { - let savePath = "/performance/save" - let editPath = "/performance/edit" - - let url = test.id ? editPath : savePath; - - let config = { - method: 'POST', - url: url, - data: formData, - headers: { - 'Content-Type': undefined - } - } - return request(config); -} - -export function saveFollows(testId, param) { - return post(`/performance/test/update/follows/${testId}`, param) -} - - -export function getFiles(id) { - return get(`/performance/file/metadata/${id}`) -} - -export function getMetadataById(id) { - return get(`/performance/file/getMetadataById/${id}`) -} - -export function getResourcePools(isShare) { - let url = '/testresourcepool/list/quota/valid'; - if (isShare) { - url = '/share/testresourcepool/list/quota/valid'; - } - return get(url); -} - -export function getLoadConfig(testId, reportId, isShare) { - let url = ''; - if (testId) { - url = '/performance/get-load-config/' + testId; - } - if (reportId) { - url = '/performance/report/get-load-config/' + reportId; - } - if (!url) { - return; - } - if (isShare) { - url = '/share/performance/report/get-load-config/' + reportId; - } - - return get(url); -} - -export function getJmxContent(testId, reportId, isShare) { - let url = ''; - if (testId) { - url = '/performance/get-jmx-content/' + testId; - } - if (reportId) { - url = '/performance/report/get-jmx-content/' + reportId; - } - if (!url) { - return; - } - if (isShare) { - url = '/share/performance/report/get-jmx-content/' + reportId; - } - return get(url) -} - -export function getAdvancedConfig(type, testId, reportId, isShare, shareId) { - let url = '/performance/get-advanced-config/' + testId; - if (type) { - url = '/performance/report/get-advanced-config/' + reportId; - } - if (isShare) { - url = '/share/performance/report/get-advanced-config/' + shareId + '/' + reportId; - } - - return get(url); -} - -export function getJmxContents(jmxIds) { - return post('/performance/export/jmx', jmxIds) -} - -export function downloadFile(url, file) { - let data = { - name: file.name, - id: file.id, - }; - let config = { - url: url, - method: 'post', - data: data, - responseType: 'blob' - }; - return request(config); -} - -export function getProjectFiles(type, projectId, currentPage, pageSize, condition) { - return post(`/performance/project/${type}/${projectId}/${currentPage}/${pageSize}`, condition) -} - -export function getNoticeTasks(testId) { - return get(`/notice/search/message/${testId}`); -} - -export function getProjectFileByName(projectId, data) { - return post(`/performance/file/${projectId}/getMetadataByName`, data) -} - -export function uploadFiles(projectId, formData) { - let url = `/project/upload/files/${projectId}`; - let options = { - method: 'POST', - url: url, - data: formData, - headers: { - 'Content-Type': undefined - } - }; - return request(options); -} - -export function updateFile(fileId, formData) { - let url = `/project/upload/file/${fileId}`; - let options = { - method: 'POST', - url: url, - data: formData, - headers: { - 'Content-Type': undefined - } - }; - return request(options); -} - -export function deleteFile(fileId) { - return get(`/project/delete/file/${fileId}`) -} - -export function listSchedule(data) { - return post('/performance/list/schedule', data) -} - -export function updateSchedule(schedule) { - return post('/performance/schedule/update', schedule); -} diff --git a/workstation/frontend/src/api/project.js b/workstation/frontend/src/api/project.js index 160ff3185d..cbcc6d008d 100644 --- a/workstation/frontend/src/api/project.js +++ b/workstation/frontend/src/api/project.js @@ -9,10 +9,6 @@ export function getProject(id) { return get(`/project/get/${id}`) } -export function getProjectMemberSize(id) { - return get(`/project/member/size/${id}`) -} - export function versionEnableByProjectId(projectId) { return get('/project/version/enable/' + projectId); } diff --git a/workstation/frontend/src/api/scenario.js b/workstation/frontend/src/api/scenario.js index 1ba8330fd3..06c01a4811 100644 --- a/workstation/frontend/src/api/scenario.js +++ b/workstation/frontend/src/api/scenario.js @@ -4,151 +4,11 @@ export function getScenarioById(scenarioId) { return get("/api/automation/get/" + scenarioId); } -export function getScenarioWithBLOBsById(scenarioId) { - return get("/api/automation/scenario-details/" + scenarioId); -} - export function getScenarioList(currentPage, pageSize, condition) { let url = "/api/automation/list/" + currentPage + "/" + pageSize; return post(url, condition); } -export function getScenarioByTrash(condition) { - return post("/api/automation/list/all/trash", condition); -} - -export function getScenarioByProjectId(projectId) { - return get("/api/automation/env-project-ids/" + projectId); -} - -export function checkScenarioEnv(scenarioId) { - return get("/api/automation/env-valid" + scenarioId); -} - -export function execStop(reportId) { - return get("/api/automation/stop/" + reportId); -} - -export function execBatchStop(res) { - return post("/api/automation/stop/batch", res); -} - -export function getFollowByScenarioId(scenarioId) { - return get("/api/automation/follow/" + scenarioId); -} - -export function getScenarioVersions(scenarioId) { - return get("/api/automation/versions/" + scenarioId); -} - -export function delByScenarioId(scenarioId) { - return get("/api/automation/delete/" + scenarioId); -} - -export function delByScenarioIdAndRefId(scenarioId, refId) { - return get("/api/automation/delete/" + scenarioId + "/" + refId); -} - -export function deleteBatchByCondition(params) { - return post("/api/automation/del-batch", params); -} - -export function apiScenarioAll(params) { - return post("/api/automation/id/all", params); -} - -export function getApiScenarios(params) { - return post("/api/automation/get-scenario-list", params); -} - -export function getReference(params) { - return post("/api/automation/getReference", params); -} - -export function genPerformanceTestJmx(params) { - return post("/api/automation/gen-jmx", params); -} - -export function apiScenarioEnv(params) { - return post("/api/automation/env", params); -} - -export function getApiScenarioProjectIdByConditions(params) { - return post("/api/automation/list-project-ids", params); -} - -export function createSchedule(params) { - return post("/api/automation/schedule/create", params); -} - -export function updateSchedule(params) { - return post("/api/automation/schedule/update", params); -} - -export function setScenarioDomain(params) { - return post("/api/automation/set-domain", params); -} - -export function listWithIds(params) { - return post("/api/automation/list-blobs", params); -} - -export function getApiScenarioEnv(params) { - return post("/api/automation/scenario-env", params); -} - -export function batchEditScenario(params) { - return post("/api/automation/batch/edit", params); -} - -export function batchCopyScenario(params) { - return post("/api/automation/batch/copy", params); -} - -export function updateScenarioEnv(params) { - return post("/api/automation/batch/update/env", params); -} - -export function scenarioPlan(params) { - return post("/api/automation/scenario/plan", params); -} - -export function runBatch(params) { - return post("/api/automation/run/batch", params); -} - -export function scenarioRun(params) { - return post("/api/automation/run", params); -} - -export function scenarioReduction(params) { - return post("/api/automation/reduction", params); -} - -export function scenarioAllIds(params) { - return post("/api/automation/id/all", params); -} - -export function checkBeforeDelete(params) { - return post("/api/automation/get-del-details", params); -} - -export function removeScenarioToGcByBatch(params) { - return post("/api/automation/move-gc-batch", params); -} - -export function exportScenario(params) { - return post("/api/automation/export", params); -} - -export function batchGenPerformanceTestJmx(params) { - return post("/api/automation/gen-jmx-batch", params); -} - -export function updateScenarioFollows(id, params) { - return post("/api/automation/update/follows/" + id, params); -} - export function getScenarioReference(params) { return post("/api/automation/getReference", params); } diff --git a/workstation/frontend/src/api/test-plan.js b/workstation/frontend/src/api/test-plan.js index 94c74c0dc6..3d232b77c4 100644 --- a/workstation/frontend/src/api/test-plan.js +++ b/workstation/frontend/src/api/test-plan.js @@ -1,6 +1,4 @@ import {post,get} from "metersphere-frontend/src/plugins/request"; -import {getCurrentProjectID} from "metersphere-frontend/src/utils/token"; - export function getPlanStageOption(projectID) { return get('/test/plan/get/stage/option/' + projectID); diff --git a/workstation/frontend/src/api/user-management.js b/workstation/frontend/src/api/user-management.js deleted file mode 100644 index 04ac59c3f3..0000000000 --- a/workstation/frontend/src/api/user-management.js +++ /dev/null @@ -1,6 +0,0 @@ - -import {get} from 'metersphere-frontend/src/plugins/request' - -export function listUsers(page, size) { - return get(`/samples/user-management/list/${page}/${size}`) -} diff --git a/workstation/frontend/src/api/user.js b/workstation/frontend/src/api/user.js index e215bc343e..9c7276034f 100644 --- a/workstation/frontend/src/api/user.js +++ b/workstation/frontend/src/api/user.js @@ -1,5 +1,5 @@ /* 前后端不分离的登录方式 */ -import {get, post, put} from "metersphere-frontend/src/plugins/request" +import {get} from "metersphere-frontend/src/plugins/request" export function getProjectMember() { diff --git a/workstation/frontend/src/api/workstation.js b/workstation/frontend/src/api/workstation.js index a1d885a0de..011b1fbc01 100644 --- a/workstation/frontend/src/api/workstation.js +++ b/workstation/frontend/src/api/workstation.js @@ -1,4 +1,4 @@ -import {post,get} from "metersphere-frontend/src/plugins/request" +import {get} from "metersphere-frontend/src/plugins/request" export function getMyCreatedCaseGroupContMap(param) { return get('/workstation/creat_case_count/list/'+param);