Merge remote-tracking branch 'origin/master'

This commit is contained in:
wenyann 2020-11-05 14:55:17 +08:00
commit 5def220676
10 changed files with 43 additions and 28 deletions

View File

@ -104,9 +104,8 @@ public class APITestController {
@PostMapping("/delete")
public void delete(@RequestBody DeleteAPITestRequest request) {
String testId = request.getId();
checkownerService.checkApiTestOwner(testId);
apiTestService.delete(testId);
checkownerService.checkApiTestOwner(request.getId());
apiTestService.delete(request);
}
@PostMapping(value = "/run")

View File

@ -8,4 +8,8 @@ import lombok.Setter;
public class DeleteAPITestRequest {
private String id;
/**
* 是否强制删除删除项目时不检查关联关系强制删除资源
*/
private boolean forceDelete = false;
}

View File

@ -193,8 +193,11 @@ public class APITestService {
return extApiTestMapper.getApiTestByProjectId(projectId);
}
public void delete(String testId) {
testCaseService.checkIsRelateTest(testId);
public void delete(DeleteAPITestRequest request) {
String testId = request.getId();
if (!request.isForceDelete()) {
testCaseService.checkIsRelateTest(testId);
}
deleteFileByTestId(testId);
apiReportService.deleteByTestId(testId);
scheduleService.deleteByResourceId(testId);

View File

@ -85,7 +85,9 @@ public class PerformanceTestService {
public void delete(DeleteTestPlanRequest request) {
String testId = request.getId();
testCaseService.checkIsRelateTest(testId);
if (!request.isForceDelete()) {
testCaseService.checkIsRelateTest(testId);
}
LoadTestReportExample loadTestReportExample = new LoadTestReportExample();
loadTestReportExample.createCriteria().andTestIdEqualTo(testId);

View File

@ -1,5 +1,6 @@
package io.metersphere.service;
import io.metersphere.api.dto.DeleteAPITestRequest;
import io.metersphere.api.dto.QueryAPITestRequest;
import io.metersphere.api.service.APITestService;
import io.metersphere.base.domain.LoadTest;
@ -96,6 +97,7 @@ public class ProjectService {
loadTestIdList.forEach(loadTestId -> {
DeleteTestPlanRequest deleteTestPlanRequest = new DeleteTestPlanRequest();
deleteTestPlanRequest.setId(loadTestId);
deleteTestPlanRequest.setForceDelete(true);
performanceTestService.delete(deleteTestPlanRequest);
});
@ -122,7 +124,10 @@ public class ProjectService {
QueryAPITestRequest request = new QueryAPITestRequest();
request.setProjectId(projectId);
apiTestService.list(request).forEach(test -> {
apiTestService.delete(test.getId());
DeleteAPITestRequest deleteAPITestRequest = new DeleteAPITestRequest();
deleteAPITestRequest.setId(test.getId());
deleteAPITestRequest.setForceDelete(true);
apiTestService.delete(deleteAPITestRequest);
});
}

View File

@ -1,4 +1,13 @@
package io.metersphere.track.request.testplan;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class DeleteTestPlanRequest extends TestPlanRequest {
/**
* 是否强制删除删除项目时不检查关联关系强制删除资源
*/
private boolean forceDelete = false;
}

@ -1 +1 @@
Subproject commit 7238c00412997c529a2a28a47956977ebf83aa13
Subproject commit 597a1681d1327a622b2a38bac3f17ae9daf95442

View File

@ -34,6 +34,7 @@ import {saveLocalStorage} from "@/common/js/utils";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const header = requireComponent.keys().length > 0 ? requireComponent("./license/LicenseMessage.vue") : {};
const display = requireComponent.keys().length > 0 ? requireComponent("./display/Display.vue") : {};
export default {
name: 'app',
@ -56,6 +57,10 @@ export default {
if (header.default !== undefined) {
this.licenseHeader = "LicenseMessage";
}
//
if (display.default !== undefined) {
display.default.valid(this);
}
} else {
window.location.href = "/login"
}
@ -63,15 +68,6 @@ export default {
window.location.href = "/login"
});
},
created() {
this.$get("/display/info", response => {
this.logoId = response.data[0].paramValue;
let title = response.data[4].paramValue;
if (title) {
document.title = title;
}
})
},
components: {
MsLanguageSwitch,
MsUser,

@ -1 +1 @@
Subproject commit 119a6892443b634a30d0d599ea51274d3c412372
Subproject commit f6f172c6451d0f9c51f5e3246a66dde9edcd7a5d

View File

@ -53,6 +53,8 @@
import {saveLocalStorage} from '@/common/js/utils';
import {DEFAULT_LANGUAGE} from "@/common/js/constants";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const display = requireComponent.keys().length > 0 ? requireComponent("./display/Display.vue") : {};
export default {
name: "Login",
@ -91,6 +93,11 @@ export default {
},
beforeCreate() {
this.result = this.$get("/isLogin").then(response => {
if (display.default !== undefined) {
display.default.valid(this);
}
if (!response.data.success) {
if (response.data.message === 'sso') {
window.location.href = "/sso/login"
@ -111,16 +118,6 @@ export default {
created: function () {
// ,,
document.addEventListener("keydown", this.watchEnter);
this.result = this.$get("/display/info", response => {
this.loginLogoId = response.data[1].paramValue;
this.loginImageId = response.data[2].paramValue;
let loginTitle = response.data[3].paramValue;
if (loginTitle) {
document.title = loginTitle;
}
})
},
destroyed() {