删除项目确认
This commit is contained in:
parent
1b35fa2b5f
commit
ad2f41f07a
|
@ -10,7 +10,5 @@ import java.util.List;
|
|||
public interface ExtApiTestMapper {
|
||||
List<APITestResult> list(@Param("request") QueryAPITestRequest request);
|
||||
|
||||
Long countByProjectId(String projectId);
|
||||
|
||||
List<ApiTest> getApiTestByProjectId(String projectId);
|
||||
}
|
||||
|
|
|
@ -44,10 +44,6 @@
|
|||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
<select id="countByProjectId" resultType="java.lang.Long">
|
||||
select count(id) from api_test
|
||||
where project_id = #{projectId}
|
||||
</select>
|
||||
<select id="getApiTestByProjectId" resultType="io.metersphere.base.domain.ApiTest">
|
||||
select id,name
|
||||
from api_test
|
||||
|
|
|
@ -10,7 +10,5 @@ import java.util.List;
|
|||
public interface ExtLoadTestMapper {
|
||||
List<LoadTestDTO> list(@Param("request") QueryTestPlanRequest params);
|
||||
|
||||
Long countByProjectId(String projectId);
|
||||
|
||||
List<LoadTest> getLoadTestByProjectId(String projectId);
|
||||
}
|
||||
|
|
|
@ -44,10 +44,6 @@
|
|||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
<select id="countByProjectId" resultType="java.lang.Long">
|
||||
select count(id) from load_test
|
||||
where project_id = #{projectId};
|
||||
</select>
|
||||
<select id="getLoadTestByProjectId" resultType="io.metersphere.base.domain.LoadTest">
|
||||
select id,name
|
||||
from load_test
|
||||
|
|
|
@ -12,6 +12,4 @@ public interface ExtTestCaseMapper {
|
|||
List<TestCase> getTestCaseNames(@Param("request") QueryTestCaseRequest request);
|
||||
|
||||
List<TestCaseDTO> list(@Param("request") QueryTestCaseRequest request);
|
||||
|
||||
Long countByProjectId(String projectId);
|
||||
}
|
||||
|
|
|
@ -53,8 +53,4 @@
|
|||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
<select id="countByProjectId" resultType="java.lang.Long">
|
||||
select count(id) from test_case
|
||||
where project_id = #{projectId}
|
||||
</select>
|
||||
</mapper>
|
|
@ -11,6 +11,4 @@ public interface ExtTestPlanMapper {
|
|||
List<TestPlanDTO> list(@Param("request") QueryTestPlanRequest params);
|
||||
|
||||
List<TestPlanDTOWithMetric> listRelate(@Param("request") QueryTestPlanRequest params);
|
||||
|
||||
Long countByProjectId(String projectId);
|
||||
}
|
||||
|
|
|
@ -58,9 +58,4 @@
|
|||
)
|
||||
order by test_plan.update_time desc
|
||||
</select>
|
||||
<select id="countByProjectId" resultType="java.lang.Long">
|
||||
select count(id) from test_plan
|
||||
where project_id = #{projectId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -9,7 +9,6 @@ import io.metersphere.commons.utils.Pager;
|
|||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.controller.request.ProjectRequest;
|
||||
import io.metersphere.dto.ProjectDTO;
|
||||
import io.metersphere.dto.ProjectRelatedResourceDTO;
|
||||
import io.metersphere.service.ProjectService;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
|
@ -72,10 +71,4 @@ public class ProjectController {
|
|||
public void updateProject(@RequestBody Project Project) {
|
||||
projectService.updateProject(Project);
|
||||
}
|
||||
|
||||
@GetMapping("/related/resource/{projectId}")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER}, logical = Logical.OR)
|
||||
public ProjectRelatedResourceDTO getRelatedResource(@PathVariable String projectId) {
|
||||
return projectService.getRelatedResource(projectId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
package io.metersphere.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ProjectRelatedResourceDTO {
|
||||
Long testCaseCount;
|
||||
Long testPlanCount;
|
||||
Long loadTestCount;
|
||||
Long apiTestCount;
|
||||
}
|
|
@ -14,7 +14,6 @@ import io.metersphere.commons.utils.ServiceUtils;
|
|||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.controller.request.ProjectRequest;
|
||||
import io.metersphere.dto.ProjectDTO;
|
||||
import io.metersphere.dto.ProjectRelatedResourceDTO;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.performance.service.PerformanceTestService;
|
||||
import io.metersphere.track.request.testcase.QueryTestPlanRequest;
|
||||
|
@ -25,12 +24,11 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class ProjectService {
|
||||
|
@ -162,13 +160,4 @@ public class ProjectService {
|
|||
public Project getProjectById(String id) {
|
||||
return projectMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public ProjectRelatedResourceDTO getRelatedResource(String projectId) {
|
||||
ProjectRelatedResourceDTO projectRelatedResource = new ProjectRelatedResourceDTO();
|
||||
projectRelatedResource.setTestCaseCount(extTestCaseMapper.countByProjectId(projectId));
|
||||
projectRelatedResource.setTestPlanCount(extTestPlanMapper.countByProjectId(projectId));
|
||||
projectRelatedResource.setLoadTestCount(extLoadTestMapperMapper.countByProjectId(projectId));
|
||||
projectRelatedResource.setApiTestCount(extApiTestMapper.countByProjectId(projectId));
|
||||
return projectRelatedResource;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
</el-table-column>
|
||||
<el-table-column :label="$t('commons.operating')">
|
||||
<template v-slot:default="scope">
|
||||
<ms-table-operator :is-tester-permission="true" @editClick="edit(scope.row)" @deleteClick="del(scope.row)"/>
|
||||
<ms-table-operator :is-tester-permission="true" @editClick="edit(scope.row)" @deleteClick="handleDelete(scope.row)"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -57,6 +57,8 @@
|
|||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<ms-delete-confirm :title="$t('project.delete')" @delete="_handleDelete" ref="deleteConfirm"/>
|
||||
|
||||
</ms-container>
|
||||
</template>
|
||||
|
||||
|
@ -70,10 +72,12 @@
|
|||
import {_sort, getCurrentUser} from "../../../common/js/utils";
|
||||
import MsContainer from "../common/components/MsContainer";
|
||||
import MsMainContainer from "../common/components/MsMainContainer";
|
||||
import MsDeleteConfirm from "../common/components/MsDeleteConfirm";
|
||||
|
||||
export default {
|
||||
name: "MsProject",
|
||||
components: {
|
||||
MsDeleteConfirm,
|
||||
MsMainContainer,
|
||||
MsContainer, MsTableOperator, MsCreateBox, MsTablePagination, MsTableHeader, MsDialogFooter},
|
||||
data() {
|
||||
|
@ -168,6 +172,15 @@
|
|||
}
|
||||
});
|
||||
},
|
||||
handleDelete(project) {
|
||||
this.$refs.deleteConfirm.open(project);
|
||||
},
|
||||
_handleDelete(project) {
|
||||
this.$get('/project/delete/' + project.id, () => {
|
||||
Message.success(this.$t('commons.delete_success'));
|
||||
this.list();
|
||||
});
|
||||
},
|
||||
del(row) {
|
||||
this.getRelatedResource(row.id).then(tip => {
|
||||
this.$confirm(tip + this.$t('project.delete_confirm'), this.$t('commons.prompt'), {
|
||||
|
@ -194,29 +207,6 @@
|
|||
this.total = data.itemCount;
|
||||
})
|
||||
},
|
||||
getRelatedResource(projectId) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.$get('/project/related/resource/' + projectId, response => {
|
||||
let data = response.data;
|
||||
let result = '';
|
||||
result = this.appendDeleteTip(result, data.testCaseCount, this.$t('test_track.case.test_case'));
|
||||
result = this.appendDeleteTip(result, data.testPlanCount, this.$t('test_track.plan.test_plan') );
|
||||
result = this.appendDeleteTip(result, data.loadTestCount, this.$t('commons.performance'));
|
||||
result = this.appendDeleteTip(result, data.apiTestCount, this.$t('commons.api'));
|
||||
if (result != '') {
|
||||
result = this.$t('project.delete_tip') + result;
|
||||
}
|
||||
resolve(result);
|
||||
});
|
||||
});
|
||||
},
|
||||
appendDeleteTip(result, count, tip) {
|
||||
if (count > 0) {
|
||||
return result + count + "个" + tip + ',';
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
},
|
||||
link(row) {
|
||||
// performance_test project link
|
||||
if (this.$route.name === 'perProject') {
|
||||
|
|
|
@ -129,6 +129,7 @@ export default {
|
|||
'recent': 'Recent Projects',
|
||||
'create': 'Create Project',
|
||||
'edit': 'Edit Project',
|
||||
'delete': 'Delete project',
|
||||
'delete_confirm': 'Are you sure you want to delete this project?',
|
||||
'delete_tip': 'These resources will be deleted:',
|
||||
'search_by_name': 'Search by name',
|
||||
|
|
|
@ -127,6 +127,7 @@ export default {
|
|||
'recent': '最近的项目',
|
||||
'create': '创建项目',
|
||||
'edit': '编辑项目',
|
||||
'delete': '删除项目',
|
||||
'delete_confirm': '确定要删除这个项目吗?',
|
||||
'delete_tip': '删除该项目,会删除以下资源:',
|
||||
'search_by_name': '根据名称搜索',
|
||||
|
|
|
@ -127,6 +127,7 @@ export default {
|
|||
'recent': '最近的項目',
|
||||
'create': '創建項目',
|
||||
'edit': '編輯項目',
|
||||
'delete': '刪除項目',
|
||||
'delete_confirm': '確定要刪除這個項目嗎?',
|
||||
'delete_tip': '刪除該項目,會刪除以下資源:',
|
||||
'search_by_name': '根據名稱搜索',
|
||||
|
|
Loading…
Reference in New Issue