fix: 没选项目报错

This commit is contained in:
chenjianxing 2020-12-25 11:17:59 +08:00
parent 8dff0e81f7
commit a923a5b55e
23 changed files with 149 additions and 40 deletions

View File

@ -16,6 +16,7 @@ import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@RestController
@ -28,18 +29,20 @@ public class ProjectController {
@GetMapping("/listAll")
public List<ProjectDTO> listAll() {
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
ProjectRequest request = new ProjectRequest();
request.setWorkspaceId(currentWorkspaceId);
return projectService.getProjectList(request);
// String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
// ProjectRequest request = new ProjectRequest();
// request.setWorkspaceId(currentWorkspaceId);
// return projectService.getProjectList(request);
return new ArrayList<>();
}
/*jenkins项目列表*/
@GetMapping("/listAll/{workspaceId}")
public List<ProjectDTO> jlistAll(@PathVariable String workspaceId) {
ProjectRequest request = new ProjectRequest();
request.setWorkspaceId(workspaceId);
return projectService.getProjectList(request);
// ProjectRequest request = new ProjectRequest();
// request.setWorkspaceId(workspaceId);
// return projectService.getProjectList(request);
return new ArrayList<>();
}
@GetMapping("/recent/{count}")

@ -1 +1 @@
Subproject commit 79343a2763b014355f91fc21b2356a95ae437973
Subproject commit 9f4a9bbf46fc1333dbcccea21f83e27e3ec10b1f

View File

@ -51,6 +51,7 @@
import {getUUID} from "@/common/js/utils";
import MsApiScenarioModule from "@/business/components/api/automation/scenario/ApiScenarioModule";
import MsEditApiScenario from "./scenario/EditApiScenario";
import {getCurrentProjectID} from "../../../../common/js/utils";
export default {
name: "ApiAutomation",
@ -70,6 +71,10 @@
watch: {},
methods: {
addTab(tab) {
if (!getCurrentProjectID()) {
this.$warning(this.$t('commons.check_project_tip'));
return;
}
if (tab.name === 'add') {
let label = this.$t('api_test.automation.add_scenario');
let name = getUUID().substring(0, 8);

View File

@ -160,10 +160,9 @@
},
methods: {
search() {
this.loading = true;
this.condition.filters = ["Prepare", "Underway", "Completed"];
this.condition.moduleIds = this.selectNodeIds;
if (this.trashEnable) {
this.condition.filters = ["Trash"];
this.condition.moduleIds = [];
@ -174,17 +173,20 @@
}
this.selection = [];
let url = "/api/automation/list/" + this.currentPage + "/" + this.pageSize;
this.$post(url, this.condition, response => {
let data = response.data;
this.total = data.itemCount;
this.tableData = data.listObject;
this.tableData.forEach(item => {
if (item.tags && item.tags.length > 0) {
item.tags = JSON.parse(item.tags);
}
})
this.loading = false;
});
if (this.condition.projectId) {
this.loading = true;
this.$post(url, this.condition, response => {
let data = response.data;
this.total = data.itemCount;
this.tableData = data.listObject;
this.tableData.forEach(item => {
if (item.tags && item.tags.length > 0) {
item.tags = JSON.parse(item.tags);
}
});
this.loading = false;
});
}
},
handleCommand(cmd) {
let table = this.$refs.scenarioTable;

View File

@ -182,6 +182,10 @@
this.$emit("refreshTable");
},
addScenario() {
if (!getCurrentProjectID()) {
this.$warning(this.$t('commons.check_project_tip'));
return;
}
this.$refs.basisScenario.open(this.currentModule);
},
enableTrash() {

View File

@ -149,6 +149,7 @@
import MsDeleteConfirm from "../../../../common/components/MsDeleteConfirm";
import {TEST_PLAN_CONFIGS} from "../../../../common/components/search/search-components";
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
import {getCurrentProjectID} from "../../../../../../common/js/utils";
export default {
name: "TestPlanList",
@ -217,6 +218,10 @@
if (this.selectNodeIds && this.selectNodeIds.length > 0) {
this.condition.nodeIds = this.selectNodeIds;
}
if (!getCurrentProjectID()) {
this.$warning(this.$t('commons.check_project_tip'));
return;
}
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {
let data = response.data;
this.total = data.itemCount;

View File

@ -180,6 +180,10 @@
}
},
handleTabAdd(e) {
if (!getCurrentProjectID()) {
this.$warning(this.$t('commons.check_project_tip'));
return;
}
let api = {
status: "Underway", method: "GET", userId: getCurrentUser().id,
url: "", protocol: this.currentProtocol, environmentId: ""
@ -211,6 +215,10 @@
this.refresh();
},
handleTabsEdit(targetName, action, api) {
if (!getCurrentProjectID()) {
this.$warning(this.$t('commons.check_project_tip'));
return;
}
if (targetName === undefined || targetName === null) {
targetName = this.$t('api_test.definition.request.title');
}

View File

@ -244,10 +244,12 @@
if (this.currentProtocol != null) {
this.condition.protocol = this.currentProtocol;
}
this.result = this.$post(this.getListUrl() + this.currentPage + "/" + this.pageSize, this.condition, response => {
this.total = response.data.itemCount;
this.tableData = response.data.listObject;
});
if (this.condition.projectId) {
this.result = this.$post(this.getListUrl() + this.currentPage + "/" + this.pageSize, this.condition, response => {
this.total = response.data.itemCount;
this.tableData = response.data.listObject;
});
}
},
buildCondition(condition) {
if (this.isPlanModel) {

View File

@ -224,10 +224,12 @@
if (this.currentProtocol != null) {
this.condition.protocol = this.currentProtocol;
}
this.result = this.$post("/api/definition/list/" + this.currentPage + "/" + this.pageSize, this.condition, response => {
this.total = response.data.itemCount;
this.tableData = response.data.listObject;
});
if (this.condition.projectId) {
this.result = this.$post("/api/definition/list/" + this.currentPage + "/" + this.pageSize, this.condition, response => {
this.total = response.data.itemCount;
this.tableData = response.data.listObject;
});
}
},
getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);

View File

@ -42,6 +42,7 @@ import {OPTIONS} from "../../model/JsonData";
import MsAddBasisApi from "../basis/AddBasisApi";
import ApiImport from "../import/ApiImport";
import ModuleTrashButton from "./ModuleTrashButton";
import {getCurrentProjectID} from "../../../../../../common/js/utils";
export default {
name: "ApiModuleHeader",
@ -83,14 +84,26 @@ export default {
case "add-module":
break;
case "import":
if (!getCurrentProjectID()) {
this.$warning(this.$t('commons.check_project_tip'));
return;
}
this.$refs.apiImport.open(this.currentModule);
break;
default:
if (!getCurrentProjectID()) {
this.$warning(this.$t('commons.check_project_tip'));
return;
}
this.$emit('exportAPI');
break;
}
},
addApi() {
if (!getCurrentProjectID()) {
this.$warning(this.$t('commons.check_project_tip'));
return;
}
this.$refs.basisApi.open(this.currentModule);
},
saveAsEdit(data) {

View File

@ -93,7 +93,7 @@ import MsTablePagination from "../../common/pagination/TablePagination";
import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer";
import MsPerformanceReportStatus from "./PerformanceReportStatus";
import {_filter, _sort} from "../../../../common/js/utils";
import {_filter, _sort, getCurrentProjectID} from "../../../../common/js/utils";
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
import ReportTriggerModeItem from "../../common/tableItem/ReportTriggerModeItem";
import {REPORT_CONFIGS} from "../../common/components/search/search-components";
@ -163,6 +163,9 @@ export default {
if (this.testId !== 'all') {
this.condition.testId = this.testId;
}
if (!getCurrentProjectID()) {
return;
}
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {
let data = response.data;
this.total = data.itemCount;

View File

@ -84,6 +84,7 @@ import {_filter, _sort} from "@/common/js/utils";
import MsTableHeader from "../../common/components/MsTableHeader";
import {TEST_CONFIGS} from "../../common/components/search/search-components";
import {LIST_CHANGE, PerformanceEvent} from "@/business/components/common/head/ListEvent";
import {getCurrentProjectID} from "../../../../common/js/utils";
export default {
components: {
@ -148,12 +149,13 @@ export default {
if (this.projectId !== 'all') {
this.condition.projectId = this.projectId;
}
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {
let data = response.data;
this.total = data.itemCount;
this.tableData = data.listObject;
});
if (this.condition.projectId) {
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {
let data = response.data;
this.total = data.itemCount;
this.tableData = data.listObject;
});
}
},
search(combine) {
this.initTableData(combine);
@ -211,6 +213,10 @@ export default {
})
},
create() {
if (!getCurrentProjectID()) {
this.$warning(this.$t('commons.check_project_tip'));
return;
}
this.$router.push('/performance/test/create');
}
}

View File

@ -51,7 +51,7 @@ import TestCaseMove from "./components/TestCaseMove";
import MsContainer from "../../common/components/MsContainer";
import MsAsideContainer from "../../common/components/MsAsideContainer";
import MsMainContainer from "../../common/components/MsMainContainer";
import {checkoutTestManagerOrTestUser, hasRoles} from "../../../../common/js/utils";
import {checkoutTestManagerOrTestUser, getCurrentProjectID, hasRoles} from "../../../../common/js/utils";
import BatchMove from "./components/BatchMove";
import TestCaseNodeTree from "../common/TestCaseNodeTree";
@ -94,6 +94,10 @@ export default {
this.testCaseReadOnly = true;
}
let caseId = this.$route.params.caseId;
if (!getCurrentProjectID()) {
this.$warning(this.$t('commons.check_project_tip'));
return;
}
this.openRecentTestCaseEditDialog(caseId);
this.$router.push('/track/case/all');
}

View File

@ -404,9 +404,17 @@ export default {
}
},
importTestCase() {
if (!getCurrentProjectID()) {
this.$warning(this.$t('commons.check_project_tip'));
return;
}
this.$refs.testCaseImport.open();
},
exportTestCase() {
if (!getCurrentProjectID()) {
this.$warning(this.$t('commons.check_project_tip'));
return;
}
let ids = Array.from(this.selectRows).map(row => row.id);
let config = {
url: '/test/case/export/testcase',

View File

@ -74,6 +74,7 @@
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem";
import PlanStageTableItem from "../../common/tableItems/plan/PlanStageTableItem";
import MsTableOperator from "../../../common/components/MsTableOperator";
import {getCurrentProjectID} from "../../../../../common/js/utils";
export default {
name: "RelatedTestPlanList",
components: {MsTableOperator, PlanStageTableItem, PlanStatusTableItem, HomeBaseComponent},
@ -88,7 +89,10 @@
},
methods: {
initTableData() {
this.result = this.$post('/test/plan/list/all/relate', this.condition, response => {
if (!getCurrentProjectID()) {
return;
}
this.result = this.$post('/test/plan/list/all/relate', {}, response => {
this.tableData = response.data;
for (let i = 0; i < this.tableData.length; i++) {
let path = "/test/plan/project/name/" + this.tableData[i].id;

View File

@ -69,6 +69,7 @@ import PlanStageTableItem from "../../common/tableItems/plan/PlanStageTableItem"
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem";
import HomeBaseComponent from "./HomeBaseComponent";
import MsTableButton from "../../../common/components/MsTableButton";
import {getCurrentProjectID} from "../../../../../common/js/utils";
export default {
name: "ReviewList",
@ -93,6 +94,9 @@ export default {
if (!type) {
type = 'reviewer'
}
if (!getCurrentProjectID()) {
return;
}
this.result = this.$get('/test/case/review/list/all/relate/' + type, response => {
this.tableData = response.data;
for (let i = 0; i < this.tableData.length; i++) {

View File

@ -61,6 +61,7 @@
import StatusTableItem from "../../common/tableItems/planview/StatusTableItem";
import TypeTableItem from "../../common/tableItems/planview/TypeTableItem";
import PriorityTableItem from "../../common/tableItems/planview/PriorityTableItem";
import {getCurrentProjectID} from "../../../../../common/js/utils";
export default {
name: "TestCaseSideList",
components: {PriorityTableItem, TypeTableItem, StatusTableItem, HomeBaseComponent},
@ -80,6 +81,9 @@
},
methods: {
initTableData() {
if (!getCurrentProjectID()) {
return;
}
this.result = this.$post('/test/plan/case/recent/10', {}, response => {
this.tableData = response.data;
});

View File

@ -19,6 +19,7 @@
import TestPlanEdit from './components/TestPlanEdit';
import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer";
import {getCurrentProjectID} from "../../../../common/js/utils";
export default {
name: "TestPlan",
@ -36,6 +37,10 @@
watch: {
'$route'(to, from) {
if (to.path.indexOf("/track/plan/create") >= 0){
if (!getCurrentProjectID()) {
this.$warning(this.$t('commons.check_project_tip'));
return;
}
this.openTestPlanEditDialog();
this.$router.push('/track/plan/all');
}

View File

@ -159,6 +159,7 @@ import TestCaseReportView from "../view/comonents/report/TestCaseReportView";
import MsDeleteConfirm from "../../../common/components/MsDeleteConfirm";
import {TEST_PLAN_CONFIGS} from "../../../common/components/search/search-components";
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
import {getCurrentProjectID} from "../../../../../common/js/utils";
export default {
name: "TestPlanList",
@ -216,6 +217,9 @@ export default {
if (this.selectNodeIds && this.selectNodeIds.length > 0) {
this.condition.nodeIds = this.selectNodeIds;
}
if (!getCurrentProjectID()) {
return;
}
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {
let data = response.data;
this.total = data.itemCount;
@ -236,6 +240,10 @@ export default {
return path + "/" + this.currentPage + "/" + this.pageSize;
},
testPlanCreate() {
if (!getCurrentProjectID()) {
this.$warning(this.$t('commons.check_project_tip'));
return;
}
this.$emit('openTestPlanEditDialog');
},
handleEdit(testPlan) {

View File

@ -18,6 +18,7 @@ import TestCaseReviewList from "./components/TestCaseReviewList";
import TestCaseReviewEdit from "./components/TestCaseReviewEdit";
import MsMainContainer from "../../common/components/MsMainContainer";
import MsContainer from "../../common/components/MsContainer";
import {getCurrentProjectID} from "../../../../common/js/utils";
export default {
name: "TestCaseReview",
@ -41,6 +42,10 @@ export default {
watch: {
'$route'(to) {
if (to.path.indexOf("/track/review/create") >= 0){
if (!getCurrentProjectID()) {
this.$warning(this.$t('commons.check_project_tip'));
return;
}
this.openCaseReviewEditDialog();
this.$router.push('/track/review/all');
}

View File

@ -87,7 +87,13 @@ import MsDialogFooter from "../../../common/components/MsDialogFooter";
import MsTableHeader from "../../../common/components/MsTableHeader";
import MsCreateBox from "../../../settings/CreateBox";
import MsTablePagination from "../../../common/pagination/TablePagination";
import {_filter, _sort, checkoutTestManagerOrTestUser, getCurrentWorkspaceId} from "../../../../../common/js/utils";
import {
_filter,
_sort,
checkoutTestManagerOrTestUser,
getCurrentProjectID,
getCurrentWorkspaceId
} from "../../../../../common/js/utils";
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem";
export default {
@ -133,6 +139,9 @@ export default {
initTableData() {
let lastWorkspaceId = getCurrentWorkspaceId();
this.condition.workspaceId = lastWorkspaceId;
if (!getCurrentProjectID()) {
return;
}
this.result = this.$post("/test/case/review/list/" + this.currentPage + "/" + this.pageSize, this.condition, response => {
let data = response.data;
this.total = data.itemCount;
@ -160,6 +169,10 @@ export default {
this.$router.push('/track/review/view/' + row.id);
},
testCaseReviewCreate() {
if (!getCurrentProjectID()) {
this.$warning(this.$t('commons.check_project_tip'));
return;
}
this.$emit('openCaseReviewEditDialog');
},
handleEdit(caseReview) {

@ -1 +1 @@
Subproject commit 8cda5c873cd9985c97adb34efacf507167fa4182
Subproject commit 010ad7a5f072a5e9d368c756a2473bbd20781433

View File

@ -126,6 +126,7 @@ export default {
modifier: '修改人',
validate: "校验",
batch_add: "批量添加",
check_project_tip: "请先创建或选择项目",
date: {
select_date: '选择日期',
start_date: '开始日期',