refactor: 接口定义和场景删除支持选择全部版本和选中版本
--bug=1009731 --user=刘瑞斌 【接口定义】列表里删除一个低版本的接口,新版本的同时被删掉了 https://www.tapd.cn/55049933/s/1094080
This commit is contained in:
parent
9443960c61
commit
aa6dd0961b
|
@ -283,12 +283,14 @@
|
||||||
:dialog-title="$t('test_track.case.batch_edit_case')"/>
|
:dialog-title="$t('test_track.case.batch_edit_case')"/>
|
||||||
<batch-move @refresh="search" @moveSave="moveSave" ref="testBatchMove"/>
|
<batch-move @refresh="search" @moveSave="moveSave" ref="testBatchMove"/>
|
||||||
<ms-run-mode @handleRunBatch="handleRunBatch" :request="runRequest" ref="runMode"/>
|
<ms-run-mode @handleRunBatch="handleRunBatch" :request="runRequest" ref="runMode"/>
|
||||||
<ms-run :debug="true" :environment="projectEnvMap" @runRefresh="runRefresh" :reportId="reportId" :saved="true" :executeType="'Saved'"
|
<ms-run :debug="true" :environment="projectEnvMap" @runRefresh="runRefresh" :reportId="reportId" :saved="true"
|
||||||
|
:executeType="'Saved'"
|
||||||
:environment-type="environmentType" :environment-group-id="envGroupId"
|
:environment-type="environmentType" :environment-group-id="envGroupId"
|
||||||
:run-data="debugData" ref="runTest"/>
|
:run-data="debugData" ref="runTest"/>
|
||||||
<ms-task-center ref="taskCenter" :show-menu="false"/>
|
<ms-task-center ref="taskCenter" :show-menu="false"/>
|
||||||
<relationship-graph-drawer :graph-data="graphData" ref="relationshipGraph"/>
|
<relationship-graph-drawer :graph-data="graphData" ref="relationshipGraph"/>
|
||||||
|
<!-- 删除接口提示 -->
|
||||||
|
<api-delete-confirm ref="apiDeleteConfirm" @handleDelete="_handleDelete"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -314,6 +316,7 @@ import axios from "axios";
|
||||||
import {getGraphByCondition} from "@/network/graph";
|
import {getGraphByCondition} from "@/network/graph";
|
||||||
import MsTableSearchBar from "@/business/components/common/components/MsTableSearchBar";
|
import MsTableSearchBar from "@/business/components/common/components/MsTableSearchBar";
|
||||||
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
|
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
|
||||||
|
import ApiDeleteConfirm from "@/business/components/api/definition/components/list/ApiDeleteConfirm";
|
||||||
|
|
||||||
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
||||||
const relationshipGraphDrawer = requireComponent.keys().length > 0 ? requireComponent("./graph/RelationshipGraphDrawer.vue") : {};
|
const relationshipGraphDrawer = requireComponent.keys().length > 0 ? requireComponent("./graph/RelationshipGraphDrawer.vue") : {};
|
||||||
|
@ -321,6 +324,7 @@ const relationshipGraphDrawer = requireComponent.keys().length > 0 ? requireComp
|
||||||
export default {
|
export default {
|
||||||
name: "MsApiScenarioList",
|
name: "MsApiScenarioList",
|
||||||
components: {
|
components: {
|
||||||
|
ApiDeleteConfirm,
|
||||||
MsTableAdvSearchBar,
|
MsTableAdvSearchBar,
|
||||||
MsTableSearchBar,
|
MsTableSearchBar,
|
||||||
MsTable,
|
MsTable,
|
||||||
|
@ -1126,30 +1130,42 @@ export default {
|
||||||
param.ids = [row.id];
|
param.ids = [row.id];
|
||||||
this.$post('/api/automation/checkBeforeDelete/', param, response => {
|
this.$post('/api/automation/checkBeforeDelete/', param, response => {
|
||||||
let checkResult = response.data;
|
let checkResult = response.data;
|
||||||
let alertMsg = this.$t('load_test.delete_threadgroup_confirm') + " ?";
|
let alertMsg = this.$t('load_test.delete_threadgroup_confirm');
|
||||||
if (!checkResult.deleteFlag) {
|
if (!checkResult.deleteFlag) {
|
||||||
alertMsg = "";
|
alertMsg = "";
|
||||||
checkResult.checkMsg.forEach(item => {
|
checkResult.checkMsg.forEach(item => {
|
||||||
alertMsg += item;
|
alertMsg += item;
|
||||||
});
|
});
|
||||||
if (alertMsg === "") {
|
if (alertMsg === "") {
|
||||||
alertMsg = this.$t('load_test.delete_threadgroup_confirm') + " ?";
|
alertMsg = this.$t('load_test.delete_threadgroup_confirm');
|
||||||
} else {
|
} else {
|
||||||
alertMsg += this.$t('api_test.is_continue') + " ?";
|
alertMsg += this.$t('api_test.is_continue');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.$alert(alertMsg, '', {
|
//
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
// 删除提供列表删除和全部版本删除
|
||||||
cancelButtonText: this.$t('commons.cancel'),
|
this.$refs.apiDeleteConfirm.open(row, alertMsg);
|
||||||
callback: (action) => {
|
});
|
||||||
if (action === 'confirm') {
|
}
|
||||||
this.$post('/api/automation/removeToGcByBatch/', param, () => {
|
},
|
||||||
this.$success(this.$t('commons.delete_success'));
|
_handleDelete(api, deleteCurrentVersion) {
|
||||||
this.search();
|
// 删除指定版本
|
||||||
});
|
if (deleteCurrentVersion) {
|
||||||
}
|
this.$get('/api/automation/delete/' + api.versionId + '/' + api.refId, () => {
|
||||||
}
|
this.$success(this.$t('commons.delete_success'));
|
||||||
});
|
this.$refs.apiDeleteConfirm.close();
|
||||||
|
this.search();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 删除全部版本
|
||||||
|
else {
|
||||||
|
let param = {};
|
||||||
|
this.buildBatchParam(param);
|
||||||
|
param.ids = [api.id];
|
||||||
|
this.$post('/api/automation/removeToGcByBatch/', param, () => {
|
||||||
|
this.$success(this.$t('commons.delete_success'));
|
||||||
|
this.$refs.apiDeleteConfirm.close();
|
||||||
|
this.search();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
:title="title"
|
||||||
|
:visible.sync="deleteApiVisible"
|
||||||
|
:show-close="false"
|
||||||
|
width="30%"
|
||||||
|
>
|
||||||
|
<el-radio-group v-model="deleteCurrentVersion">
|
||||||
|
<el-radio :label="true">{{ $t('commons.delete_current_version') }}</el-radio>
|
||||||
|
<el-radio :label="false">{{ $t('commons.delete_all_version') }}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
|
||||||
|
<template v-slot:footer>
|
||||||
|
<ms-dialog-footer
|
||||||
|
@cancel="close"
|
||||||
|
@confirm="handleDelete">
|
||||||
|
</ms-dialog-footer>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "ApiDeleteConfirm",
|
||||||
|
components: {MsDialogFooter},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
deleteApiVisible: false,
|
||||||
|
title: null,
|
||||||
|
deleteCurrentVersion: true,
|
||||||
|
api: {}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
open(api, title) {
|
||||||
|
this.api = api;
|
||||||
|
this.deleteCurrentVersion = true;
|
||||||
|
this.title = title + ' ' + api.name + '?';
|
||||||
|
this.deleteApiVisible = true;
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.deleteApiVisible = false;
|
||||||
|
},
|
||||||
|
handleDelete() {
|
||||||
|
this.$emit('handleDelete', this.api, this.deleteCurrentVersion);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
|
@ -206,7 +206,8 @@
|
||||||
<case-batch-move @refresh="initTable" @moveSave="moveSave" ref="testCaseBatchMove"/>
|
<case-batch-move @refresh="initTable" @moveSave="moveSave" ref="testCaseBatchMove"/>
|
||||||
|
|
||||||
<relationship-graph-drawer :graph-data="graphData" ref="relationshipGraph"/>
|
<relationship-graph-drawer :graph-data="graphData" ref="relationshipGraph"/>
|
||||||
|
<!-- 删除接口提示 -->
|
||||||
|
<api-delete-confirm ref="apiDeleteConfirm" @handleDelete="_handleDelete"/>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
@ -246,6 +247,7 @@ import {Body} from "@/business/components/api/definition/model/ApiTestModel";
|
||||||
import {editApiDefinitionOrder} from "@/network/api";
|
import {editApiDefinitionOrder} from "@/network/api";
|
||||||
import {getProtocolFilter} from "@/business/components/api/definition/api-definition";
|
import {getProtocolFilter} from "@/business/components/api/definition/api-definition";
|
||||||
import {getGraphByCondition} from "@/network/graph";
|
import {getGraphByCondition} from "@/network/graph";
|
||||||
|
import ApiDeleteConfirm from "@/business/components/api/definition/components/list/ApiDeleteConfirm";
|
||||||
|
|
||||||
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
||||||
const relationshipGraphDrawer = requireComponent.keys().length > 0 ? requireComponent("./graph/RelationshipGraphDrawer.vue") : {};
|
const relationshipGraphDrawer = requireComponent.keys().length > 0 ? requireComponent("./graph/RelationshipGraphDrawer.vue") : {};
|
||||||
|
@ -254,6 +256,7 @@ const relationshipGraphDrawer = requireComponent.keys().length > 0 ? requireComp
|
||||||
export default {
|
export default {
|
||||||
name: "ApiList",
|
name: "ApiList",
|
||||||
components: {
|
components: {
|
||||||
|
ApiDeleteConfirm,
|
||||||
HeaderLabelOperate,
|
HeaderLabelOperate,
|
||||||
CaseBatchMove,
|
CaseBatchMove,
|
||||||
ApiStatus,
|
ApiStatus,
|
||||||
|
@ -812,20 +815,29 @@ export default {
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + api.name + " ?", '', {
|
// 删除提供列表删除和全部版本删除
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
this.$refs.apiDeleteConfirm.open(api, this.$t('api_test.definition.request.delete_confirm'));
|
||||||
callback: (action) => {
|
},
|
||||||
if (action === 'confirm') {
|
_handleDelete(api, deleteCurrentVersion) {
|
||||||
let ids = [api.id];
|
// 删除指定版本
|
||||||
this.$post('/api/definition/removeToGc/', ids, () => {
|
if (deleteCurrentVersion) {
|
||||||
this.$success(this.$t('commons.delete_success'));
|
this.$get('/api/definition/delete/' + api.versionId + '/' + api.refId, () => {
|
||||||
// this.initTable();
|
this.$success(this.$t('commons.delete_success'));
|
||||||
this.$emit("refreshTable");
|
this.$refs.apiDeleteConfirm.close();
|
||||||
this.$refs.caseList.apiCaseClose();
|
this.$emit("refreshTable");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
// 删除全部版本
|
||||||
});
|
else {
|
||||||
|
let ids = [api.id];
|
||||||
|
this.$post('/api/definition/removeToGc/', ids, () => {
|
||||||
|
this.$success(this.$t('commons.delete_success'));
|
||||||
|
// this.initTable();
|
||||||
|
this.$refs.apiDeleteConfirm.close();
|
||||||
|
this.$emit("refreshTable");
|
||||||
|
this.$refs.caseList.apiCaseClose();
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getColor(enable, method) {
|
getColor(enable, method) {
|
||||||
|
|
|
@ -423,6 +423,8 @@ export default {
|
||||||
form_config: "Form config",
|
form_config: "Form config",
|
||||||
form_content: "Form content",
|
form_content: "Form content",
|
||||||
sync_other_info: "Sync other config",
|
sync_other_info: "Sync other config",
|
||||||
|
delete_current_version: 'Current version',
|
||||||
|
delete_all_version: 'All versions',
|
||||||
},
|
},
|
||||||
login: {
|
login: {
|
||||||
normal_Login: "Normal Login",
|
normal_Login: "Normal Login",
|
||||||
|
|
|
@ -425,6 +425,8 @@ export default {
|
||||||
form_config: "表单配置",
|
form_config: "表单配置",
|
||||||
form_content: "表单内容",
|
form_content: "表单内容",
|
||||||
sync_other_info: "同步以下信息到新版本",
|
sync_other_info: "同步以下信息到新版本",
|
||||||
|
delete_current_version: '列表版本',
|
||||||
|
delete_all_version: '全部版本',
|
||||||
},
|
},
|
||||||
login: {
|
login: {
|
||||||
normal_Login: "普通登录",
|
normal_Login: "普通登录",
|
||||||
|
|
|
@ -425,6 +425,8 @@ export default {
|
||||||
form_config: "表單配置",
|
form_config: "表單配置",
|
||||||
form_content: "表單內容",
|
form_content: "表單內容",
|
||||||
sync_other_info: "同步以下信息到新版本",
|
sync_other_info: "同步以下信息到新版本",
|
||||||
|
delete_current_version: '列表版本',
|
||||||
|
delete_all_version: '全部版本',
|
||||||
},
|
},
|
||||||
login: {
|
login: {
|
||||||
normal_Login: "普通登錄",
|
normal_Login: "普通登錄",
|
||||||
|
|
Loading…
Reference in New Issue