This commit is contained in:
fit2-zhao 2020-12-23 15:18:17 +08:00
commit 39cfe385c4
4 changed files with 45 additions and 117 deletions

View File

@ -47,14 +47,14 @@
<el-dialog <el-dialog
:close-on-click-modal="false" :close-on-click-modal="false"
:title="$t('test_resource_pool.create_resource_pool')" :title="form.id ? $t('test_resource_pool.update_resource_pool') : $t('test_resource_pool.create_resource_pool')"
:visible.sync="createVisible" width="70%" :visible.sync="dialogVisible" width="70%"
@closed="closeFunc" @closed="closeFunc"
:destroy-on-close="true" :destroy-on-close="true"
v-loading="result.loading" v-loading="result.loading"
> >
<el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule" <el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule"
ref="createTestResourcePoolForm"> ref="testResourcePoolForm">
<el-form-item :label="$t('commons.name')" prop="name"> <el-form-item :label="$t('commons.name')" prop="name">
<el-input v-model="form.name" autocomplete="off"/> <el-input v-model="form.name" autocomplete="off"/>
</el-form-item> </el-form-item>
@ -75,22 +75,25 @@
<div class="node-line" v-if="form.type === 'K8S'" v-xpack> <div class="node-line" v-if="form.type === 'K8S'" v-xpack>
<el-row> <el-row>
<el-col> <el-col>
<el-form-item prop="masterUrl" label="Master URL"> <el-form-item label="Master URL"
:rules="requiredRules">
<el-input v-model="item.masterUrl" autocomplete="new-password"/> <el-input v-model="item.masterUrl" autocomplete="new-password"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col> <el-col>
<el-form-item prop="password" label="Token"> <el-form-item label="Token"
:rules="requiredRules">
<el-input v-model="item.token" type="password" show-password autocomplete="new-password"/> <el-input v-model="item.token" type="password" show-password autocomplete="new-password"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col> <el-col>
<el-form-item prop="maxConcurrency" :label="$t('test_resource_pool.max_threads')"> <el-form-item :label="$t('test_resource_pool.max_threads')"
<el-input-number v-model="item.maxConcurrency" :min="1" :max="1000000000"></el-input-number> :rules="requiredRules">
<el-input-number v-model="item.maxConcurrency" :min="1" :max="1000000000"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -98,17 +101,19 @@
<div class="node-line" v-if="form.type === 'NODE'"> <div class="node-line" v-if="form.type === 'NODE'">
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item prop="ip" label="IP"> <el-form-item label="IP" :rules="requiredRules">
<el-input v-model="item.ip" autocomplete="off"/> <el-input v-model="item.ip" autocomplete="off"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item prop="port" label="Port" style="padding-left: 20px"> <el-form-item label="Port" style="padding-left: 20px"
:rules="requiredRules">
<el-input-number v-model="item.port" :min="1" :max="65535"></el-input-number> <el-input-number v-model="item.port" :min="1" :max="65535"></el-input-number>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item prop="maxConcurrency" :label="$t('test_resource_pool.max_threads')" <el-form-item :label="$t('test_resource_pool.max_threads')"
:rules="requiredRules"
style="padding-left: 20px"> style="padding-left: 20px">
<el-input-number v-model="item.maxConcurrency" :min="1" :max="1000000000"></el-input-number> <el-input-number v-model="item.maxConcurrency" :min="1" :max="1000000000"></el-input-number>
</el-form-item> </el-form-item>
@ -132,100 +137,15 @@
</el-form> </el-form>
<template v-slot:footer> <template v-slot:footer>
<ms-dialog-footer <ms-dialog-footer
@cancel="createVisible = false" v-if="form.id"
@confirm="createTestResourcePool('createTestResourcePoolForm')"/> @cancel="dialogVisible = false"
</template> @confirm="updateTestResourcePool()"/>
</el-dialog>
<el-dialog
:close-on-click-modal="false"
v-loading="result.loading"
:title="$t('test_resource_pool.update_resource_pool')" :visible.sync="updateVisible" width="70%"
:destroy-on-close="true"
@close="closeFunc">
<el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule"
ref="updateTestResourcePoolForm">
<el-form-item :label="$t('commons.name')" prop="name">
<el-input v-model="form.name" autocomplete="off"/>
</el-form-item>
<el-form-item :label="$t('commons.description')" prop="description">
<el-input v-model="form.description" autocomplete="off"/>
</el-form-item>
<el-form-item :label="$t('commons.image')" prop="image">
<el-input v-model="form.image" autocomplete="off"/>
</el-form-item>
<el-form-item :label="$t('test_resource_pool.type')" prop="type">
<el-select v-model="form.type" :placeholder="$t('test_resource_pool.select_pool_type')"
@change="changeResourceType()">
<el-option key="NODE" value="NODE" label="Node">Node</el-option>
<el-option key="K8S" value="K8S" label="Kubernetes" v-xpack>Kubernetes</el-option>
</el-select>
</el-form-item>
<div v-for="(item,index) in infoList " :key="index">
<div class="node-line" v-if="form.type === 'K8S'" v-xpack>
<el-row>
<el-col>
<el-form-item prop="masterUrl" label="Master URL">
<el-input v-model="item.masterUrl" autocomplete="off"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item prop="password" label="Token">
<el-input v-model="item.token" type="password" show-password autocomplete="off"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item prop="maxConcurrency" :label="$t('test_resource_pool.max_threads')">
<el-input-number v-model="item.maxConcurrency" :min="1" :max="1000000000"></el-input-number>
</el-form-item>
</el-col>
</el-row>
</div>
<div class="node-line" v-if="form.type === 'NODE'">
<el-row>
<el-col :span="8">
<el-form-item prop="ip" label="IP">
<el-input v-model="item.ip" autocomplete="off"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item prop="port" label="Port" style="padding-left: 20px">
<el-input-number v-model="item.port" :min="1" :max="65535"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item prop="maxConcurrency" :label="$t('test_resource_pool.max_threads')"
style="padding-left: 20px">
<el-input-number v-model="item.maxConcurrency" :min="1" :max="1000000000"></el-input-number>
</el-form-item>
</el-col>
<el-col :offset="2" :span="2">
<span class="box">
<el-button @click="addResourceInfo()" type="success" size="mini" circle>
<font-awesome-icon :icon="['fas', 'plus']"/>
</el-button>
</span>
<span class="box">
<el-button @click="removeResourceInfo(index)" type="danger" size="mini" circle>
<font-awesome-icon :icon="['fas', 'minus']"/>
</el-button>
</span>
</el-col>
</el-row>
</div>
</div>
</el-form>
<template v-slot:footer>
<ms-dialog-footer <ms-dialog-footer
@cancel="updateVisible = false" v-else
@confirm="updateTestResourcePool('updateTestResourcePoolForm')"/> @cancel="dialogVisible = false"
@confirm="createTestResourcePool()"/>
</template> </template>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
@ -235,7 +155,7 @@ import MsTablePagination from "../../common/pagination/TablePagination";
import MsTableHeader from "../../common/components/MsTableHeader"; import MsTableHeader from "../../common/components/MsTableHeader";
import MsTableOperator from "../../common/components/MsTableOperator"; import MsTableOperator from "../../common/components/MsTableOperator";
import MsDialogFooter from "../../common/components/MsDialogFooter"; import MsDialogFooter from "../../common/components/MsDialogFooter";
import {listenGoBack, removeGoBackListener} from "../../../../common/js/utils"; import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
export default { export default {
name: "MsTestResourcePool", name: "MsTestResourcePool",
@ -243,9 +163,8 @@ export default {
data() { data() {
return { return {
result: {}, result: {},
createVisible: false, dialogVisible: false,
infoList: [], infoList: [],
updateVisible: false,
queryPath: "testresourcepool/list", queryPath: "testresourcepool/list",
condition: {}, condition: {},
items: [], items: [],
@ -253,6 +172,7 @@ export default {
pageSize: 5, pageSize: 5,
total: 0, total: 0,
form: {}, form: {},
requiredRules: [{required: true, message: this.$t('test_resource_pool.fill_the_data'), trigger: 'blur'}],
rule: { rule: {
name: [ name: [
{required: true, message: this.$t('test_resource_pool.input_pool_name'), trigger: 'blur'}, {required: true, message: this.$t('test_resource_pool.input_pool_name'), trigger: 'blur'},
@ -329,11 +249,11 @@ export default {
this.initTableData(); this.initTableData();
}, },
create() { create() {
this.createVisible = true; this.dialogVisible = true;
listenGoBack(this.closeFunc); listenGoBack(this.closeFunc);
}, },
edit(row) { edit(row) {
this.updateVisible = true; this.dialogVisible = true;
this.form = JSON.parse(JSON.stringify(row)); this.form = JSON.parse(JSON.stringify(row));
this.convertResources(); this.convertResources();
listenGoBack(this.closeFunc); listenGoBack(this.closeFunc);
@ -363,8 +283,8 @@ export default {
this.$info(this.$t('commons.delete_cancel')); this.$info(this.$t('commons.delete_cancel'));
}); });
}, },
createTestResourcePool(createTestResourcePoolForm) { createTestResourcePool() {
this.$refs[createTestResourcePoolForm].validate(valid => { this.$refs.testResourcePoolForm.validate(valid => {
if (valid) { if (valid) {
let vri = this.validateResourceInfo(); let vri = this.validateResourceInfo();
if (vri.validate) { if (vri.validate) {
@ -374,7 +294,7 @@ export default {
type: 'success', type: 'success',
message: this.$t('commons.save_success') message: this.$t('commons.save_success')
}, },
this.createVisible = false, this.dialogVisible = false,
this.initTableData()); this.initTableData());
}); });
} else { } else {
@ -400,8 +320,8 @@ export default {
}); });
this.form.resources = resources; this.form.resources = resources;
}, },
updateTestResourcePool(updateTestResourcePoolForm) { updateTestResourcePool() {
this.$refs[updateTestResourcePoolForm].validate(valid => { this.$refs.testResourcePoolForm.validate(valid => {
if (valid) { if (valid) {
let vri = this.validateResourceInfo(); let vri = this.validateResourceInfo();
if (vri.validate) { if (vri.validate) {
@ -411,7 +331,7 @@ export default {
type: 'success', type: 'success',
message: this.$t('commons.modify_success') message: this.$t('commons.modify_success')
}, },
this.updateVisible = false, this.dialogVisible = false,
this.initTableData(), this.initTableData(),
self.loading = false); self.loading = false);
}); });
@ -426,8 +346,7 @@ export default {
}, },
closeFunc() { closeFunc() {
this.form = {}; this.form = {};
this.updateVisible = false; this.dialogVisible = false;
this.createVisible = false;
removeGoBackListener(this.closeFunc); removeGoBackListener(this.closeFunc);
}, },
changeSwitch(row) { changeSwitch(row) {

View File

@ -19,6 +19,7 @@
@testCaseDetail="showTestCaseDetail" @testCaseDetail="showTestCaseDetail"
@batchMove="batchMove" @batchMove="batchMove"
@refresh="refresh" @refresh="refresh"
@refreshAll="refreshAll"
@moveToNode="moveToNode" @moveToNode="moveToNode"
ref="testCaseList"> ref="testCaseList">
</test-case-list> </test-case-list>
@ -131,6 +132,10 @@ export default {
this.selectNode = {}; this.selectNode = {};
this.refreshTable(); this.refreshTable();
}, },
refreshAll() {
this.$refs.nodeTree.list();
this.refresh();
},
openRecentTestCaseEditDialog(caseId) { openRecentTestCaseEditDialog(caseId) {
if (caseId) { if (caseId) {
// this.getProjectByCaseId(caseId); // this.getProjectByCaseId(caseId);

View File

@ -204,7 +204,7 @@
if (res.success) { if (res.success) {
this.$success(this.$t('test_track.case.import.success')); this.$success(this.$t('test_track.case.import.success'));
this.dialogVisible = false; this.dialogVisible = false;
this.$emit("refresh"); this.$emit("refreshAll");
} else { } else {
this.errList = res.errList; this.errList = res.errList;
} }
@ -223,7 +223,7 @@
if (res.success) { if (res.success) {
this.$success(this.$t('test_track.case.import.success')); this.$success(this.$t('test_track.case.import.success'));
this.dialogVisible = false; this.dialogVisible = false;
this.$emit("refresh"); this.$emit("refreshAll");
} else { } else {
this.xmindErrList = res.errList; this.xmindErrList = res.errList;
} }

View File

@ -25,7 +25,7 @@
</template> </template>
<test-case-import @refresh="refresh" ref="testCaseImport"/> <test-case-import @refreshAll="refreshAll" ref="testCaseImport"/>
<el-table <el-table
border border
@ -374,6 +374,10 @@ export default {
this.selectRows.clear(); this.selectRows.clear();
this.$emit('refresh'); this.$emit('refresh');
}, },
refreshAll() {
this.selectRows.clear();
this.$emit('refreshAll');
},
showDetail(row, event, column) { showDetail(row, event, column) {
this.$emit('testCaseDetail', row); this.$emit('testCaseDetail', row);
}, },