Merge branch 'dev' of github.com:fit2cloudrd/metersphere-server into dev

This commit is contained in:
Captain.B 2020-03-23 15:44:23 +08:00
commit ca66c782d8
9 changed files with 157 additions and 109 deletions

View File

@ -46,7 +46,7 @@
</el-card>
<el-dialog :title="title" :visible.sync="createVisible">
<el-form :model="form" :rules="rules" ref="form" label-position="left" label-width="100px" size="small">
<el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="100px" size="small">
<el-form-item :label="$t('commons.name')">
<el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item>

View File

@ -51,7 +51,7 @@
</el-card>
<el-dialog :title="$t('member.create')" :visible.sync="createVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-form :model="form" ref="form" :rules="rules" label-position="left" label-width="100px" size="small">
<el-form :model="form" ref="form" :rules="rules" label-position="right" label-width="100px" size="small">
<el-form-item :label="$t('commons.member')" prop="userIds">
<el-select v-model="form.userIds" multiple :placeholder="$t('member.please_choose_member')" class="select-width">
<el-option
@ -81,7 +81,7 @@
</el-dialog>
<el-dialog :title="$t('member.modify')" :visible.sync="updateVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-form :model="form" label-position="left" label-width="100px" size="small" ref="updateUserForm">
<el-form :model="form" label-position="right" label-width="100px" size="small" ref="updateUserForm">
<el-form-item label="ID" prop="id">
<el-input v-model="form.id" autocomplete="off" :disabled="true"/>
</el-form-item>

View File

@ -48,7 +48,7 @@
</el-card>
<el-dialog :title="$t('workspace.create')" :visible.sync="createVisible" width="30%">
<el-form :model="form" :rules="rules" ref="form" label-position="left" label-width="100px" size="small">
<el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="100px" size="small">
<el-form-item :label="$t('commons.name')" prop="name">
<el-input v-model="form.name" autocomplete="off"/>
</el-form-item>
@ -114,7 +114,7 @@
<!-- add workspace member dialog -->
<el-dialog :title="$t('member.create')" :visible.sync="addMemberVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-form :model="memberForm" ref="form" :rules="wsMemberRule" label-position="left" label-width="100px" size="small">
<el-form :model="memberForm" ref="form" :rules="wsMemberRule" label-position="right" label-width="100px" size="small">
<el-form-item :label="$t('commons.member')" prop="userIds">
<el-select v-model="memberForm.userIds" multiple :placeholder="$t('member.please_choose_member')" class="select-width">
<el-option
@ -145,7 +145,7 @@
<!-- update workspace member dialog -->
<el-dialog :title="$t('member.modify')" :visible.sync="updateMemberVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-form :model="memberForm" label-position="left" label-width="100px" size="small" ref="updateUserForm">
<el-form :model="memberForm" label-position="right" label-width="100px" size="small" ref="updateUserForm">
<el-form-item label="ID" prop="id">
<el-input v-model="memberForm.id" autocomplete="off" :disabled="true"/>
</el-form-item>

View File

@ -26,7 +26,7 @@
</el-table>
<el-dialog :title="$t('member.modify_personal_info')" :visible.sync="updateVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-form :model="form" label-position="left" label-width="100px" size="small" :rules="rule" ref="updateUserForm">
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule" ref="updateUserForm">
<el-form-item label="ID" prop="id">
<el-input v-model="form.id" autocomplete="off" :disabled="true"/>
</el-form-item>

View File

@ -101,7 +101,7 @@
<!-- add organization form -->
<el-dialog :title="$t('organization.create')" :visible.sync="createVisible" width="30%" @closed="closeFunc" :destroy-on-close="true">
<el-form :model="form" label-position="left" label-width="100px" size="small" :rules="rule" ref="createOrganization">
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule" ref="createOrganization">
<el-form-item :label="$t('commons.name')" prop="name">
<el-input v-model="form.name" autocomplete="off"/>
</el-form-item>
@ -116,7 +116,7 @@
<!-- update organization form -->
<el-dialog :title="$t('organization.modify')" :visible.sync="updateVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-form :model="form" label-position="left" label-width="100px" size="small" :rules="rule" ref="updateOrganizationForm">
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule" ref="updateOrganizationForm">
<el-form-item :label="$t('commons.name')" prop="name">
<el-input v-model="form.name" autocomplete="off"/>
</el-form-item>
@ -131,7 +131,7 @@
<!-- add organization member form -->
<el-dialog :title="$t('member.create')" :visible.sync="addMemberVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-form :model="memberForm" ref="form" :rules="orgMemberRule" label-position="left" label-width="100px" size="small">
<el-form :model="memberForm" ref="form" :rules="orgMemberRule" label-position="right" label-width="100px" size="small">
<el-form-item :label="$t('commons.member')" prop="userIds">
<el-select v-model="memberForm.userIds" multiple :placeholder="$t('member.please_choose_member')" class="select-width">
<el-option
@ -162,7 +162,7 @@
<!-- update organization member form -->
<el-dialog :title="$t('member.modify')" :visible.sync="updateMemberVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-form :model="memberForm" label-position="left" label-width="100px" size="small" ref="updateUserForm">
<el-form :model="memberForm" label-position="right" label-width="100px" size="small" ref="updateUserForm">
<el-form-item label="ID" prop="id">
<el-input v-model="memberForm.id" autocomplete="off" :disabled="true"/>
</el-form-item>

View File

@ -53,7 +53,7 @@
<!-- add workspace dialog -->
<el-dialog :title="$t('workspace.create')" :visible.sync="createVisible" width="30%">
<el-form :model="form" :rules="rules" ref="form" label-position="left" label-width="100px" size="small">
<el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="100px" size="small">
<el-form-item :label="$t('commons.name')" prop="name">
<el-input v-model="form.name" autocomplete="off"/>
</el-form-item>
@ -78,7 +78,7 @@
<!-- update workspace dialog -->
<el-dialog :title="$t('workspace.update')" :visible.sync="updateVisible" width="30%">
<el-form :model="form" :rules="rules" ref="updateForm" label-position="left" label-width="100px" size="small">
<el-form :model="form" :rules="rules" ref="updateForm" label-position="right" label-width="100px" size="small">
<el-form-item :label="$t('commons.name')" prop="name">
<el-input v-model="form.name" autocomplete="off"/>
</el-form-item>
@ -154,7 +154,7 @@
<!-- add workspace member dialog -->
<el-dialog :title="$t('member.create')" :visible.sync="addMemberVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-form :model="memberForm" ref="form" :rules="wsMemberRule" label-position="left" label-width="100px" size="small">
<el-form :model="memberForm" ref="form" :rules="wsMemberRule" label-position="right" label-width="100px" size="small">
<el-form-item :label="$t('commons.member')" prop="userIds">
<el-select v-model="memberForm.userIds" multiple :placeholder="$t('member.please_choose_member')" class="select-width">
<el-option
@ -185,7 +185,7 @@
<!-- update workspace member dialog -->
<el-dialog :title="$t('member.modify')" :visible.sync="updateMemberVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-form :model="memberForm" label-position="left" label-width="100px" size="small" ref="updateUserForm">
<el-form :model="memberForm" label-position="right" label-width="100px" size="small" ref="updateUserForm">
<el-form-item label="ID" prop="id">
<el-input v-model="memberForm.id" autocomplete="off" :disabled="true"/>
</el-form-item>

View File

@ -70,7 +70,7 @@
</el-card>
<el-dialog title="创建资源池" :visible.sync="createVisible" width="70%" @closed="closeFunc" :destroy-on-close="true">
<el-form :model="form" label-position="left" label-width="100px" size="small" :rules="rule"
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule"
ref="createTestResourcePoolForm">
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" autocomplete="off"/>
@ -85,46 +85,41 @@
</el-select>
</el-form-item>
<div v-for="(item,index) in infoList " :key="index">
<div class="current-row" v-if="form.type === 'K8S'">
<div style="width: 35%;float: left">
<label class="el-form-item__label">Master URL</label>
<div class="el-form-item__content" style="margin-left: 100px">
<input v-model="item.masterUrl" autocomplete="off" class="el-input__inner form-input"/>
</div>
</div>
<div style="width: 35%;float: left">
<label class="el-form-item__label" style="padding-left: 20px">Token</label>
<div class="el-form-item__content" style="margin-left: 100px">
<input v-model="item.token" autocomplete="off" class="el-input__inner form-input"/>
<div class="node-line" v-if="form.type === 'K8S'">
<div class="k8s-master">
<el-col :span="11">
</el-col>
<el-form-item prop="masterUrl" label="Master URL">
<el-input v-model="item.masterUrl" autocomplete="off"/>
</el-form-item>
</div>
<div class="k8s-token">
<el-form-item prop="token" label="Token">
<el-input v-model="item.token" show-password autocomplete="off"/>
</el-form-item>
</div>
<div style="width: 30%;float: left">
<label class="el-form-item__label" style="padding-left: 20px">最大并发数</label>
<div class="el-form-item__content" style="margin-left: 102px">
<input v-model="item.maxConcurrency" autocomplete="off" type="number"
class="el-input__inner form-input"/>
<el-form-item prop="maxConcurrency" label="最大并发数">
<el-input-number v-model="item.maxConcurrency" :min="1" :max="9999"></el-input-number>
</el-form-item>
</div>
</div>
<div class="node-line" v-if="form.type === 'NODE'">
<div style="width: 30%;float: left">
<el-form-item prop="ip" label="IP">
<el-input v-model="item.ip" autocomplete="off"/>
</el-form-item>
</div>
<div class="current-row" v-if="form.type === 'NODE'">
<div style="width: 42%;float: left">
<label class="el-form-item__label">IP</label>
<div class="el-form-item__content" style="margin-left: 100px">
<input v-model="item.ip" autocomplete="off" class="el-input__inner form-input"/>
</div>
</div>
<div style="width: 20%;float: left">
<label class="el-form-item__label" style="padding-left: 20px">port</label>
<div class="el-form-item__content" style="margin-left: 100px">
<input v-model="item.port" autocomplete="off" type="number" class="el-input__inner form-input"/>
</div>
</div>
<div style="width: 20%;float: left">
<label class="el-form-item__label" style="padding-left: 20px">最大并发数</label>
<div class="el-form-item__content" style="margin-left: 102px">
<input v-model="item.maxConcurrency" autocomplete="off" type="number"
class="el-input__inner form-input"/>
<div style="width: 30%;float: left">
<el-form-item prop="port" label="Port">
<el-input-number v-model="item.port" :min="1" :max="9999"></el-input-number>
</el-form-item>
</div>
<div style="width: 30%;float: left">
<el-form-item prop="maxConcurrency" label="最大并发数">
<el-input-number v-model="item.maxConcurrency" :min="1" :max="9999"></el-input-number>
</el-form-item>
</div>
<div class="op">
<span class="box">
@ -149,7 +144,7 @@
</el-dialog>
<el-dialog title="修改资源池" :visible.sync="updateVisible" width="70%" :destroy-on-close="true" @close="closeFunc">
<el-form :model="form" label-position="left" label-width="100px" size="small" :rules="rule"
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule"
ref="updateTestResourcePoolForm">
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" autocomplete="off"/>
@ -158,52 +153,44 @@
<el-input v-model="form.description" autocomplete="off"/>
</el-form-item>
<el-form-item label="资源类型" prop="type">
<el-select v-model="form.type" placeholder="选择资源类型">
<el-select v-model="form.type" placeholder="选择资源类型" @change="changeResourceType()">
<el-option key="K8S" value="K8S" label="Kubernetes">Kubernetes</el-option>
<el-option key="NODE" value="NODE" label="独立节点">独立节点</el-option>
</el-select>
</el-form-item>
<div v-for="(item,index) in infoList " :key="index">
<div class="current-row" v-if="form.type === 'K8S'">
<div style="width: 35%;float: left">
<label class="el-form-item__label">Master URL</label>
<div class="el-form-item__content" style="margin-left: 100px">
<input v-model="item.masterUrl" autocomplete="off" class="el-input__inner form-input"/>
</div>
</div>
<div style="width: 35%;float: left">
<label class="el-form-item__label" style="padding-left: 20px">Token</label>
<div class="el-form-item__content" style="margin-left: 100px">
<input v-model="item.token" autocomplete="off" class="el-input__inner form-input"/>
<div class="node-line" v-if="form.type === 'K8S'">
<div class="k8s-master">
<el-form-item prop="masterUrl" label="Master URL">
<el-input v-model="item.masterUrl" autocomplete="off"/>
</el-form-item>
</div>
<div class="k8s-token">
<el-form-item prop="password" label="Token" style="padding-left: 20px">
<el-input v-model="item.token" show-password autocomplete="off"/>
</el-form-item>
</div>
<div style="width: 30%;float: left">
<label class="el-form-item__label" style="padding-left: 20px">最大并发数</label>
<div class="el-form-item__content" style="margin-left: 102px">
<input v-model="item.maxConcurrency" autocomplete="off" type="number"
class="el-input__inner form-input"/>
<el-form-item prop="maxConcurrency" label="最大并发数" style="padding-left: 20px">
<el-input-number v-model="item.maxConcurrency" :min="1" :max="9999"></el-input-number>
</el-form-item>
</div>
</div>
<div class="node-line" v-if="form.type === 'NODE'">
<div style="width: 30%;float: left">
<el-form-item prop="ip" label="IP">
<el-input v-model="item.ip" autocomplete="off"/>
</el-form-item>
</div>
<div class="current-row" v-if="form.type === 'NODE'">
<div style="width: 42%;float: left">
<label class="el-form-item__label">IP</label>
<div class="el-form-item__content" style="margin-left: 100px">
<input v-model="item.ip" autocomplete="off" class="el-input__inner form-input"/>
</div>
</div>
<div style="width: 20%;float: left">
<label class="el-form-item__label" style="padding-left: 20px">port</label>
<div class="el-form-item__content" style="margin-left: 100px">
<input v-model="item.port" autocomplete="off" type="number" class="el-input__inner form-input"/>
</div>
</div>
<div style="width: 20%;float: left">
<label class="el-form-item__label" style="padding-left: 20px">最大并发数</label>
<div class="el-form-item__content" style="margin-left: 102px">
<input v-model="item.maxConcurrency" autocomplete="off" type="number"
class="el-input__inner form-input"/>
<div style="width: 30%;float: left">
<el-form-item prop="port" label="Port" style="padding-left: 20px">
<el-input-number v-model="item.port" :min="1" :max="9999"></el-input-number>
</el-form-item>
</div>
<div style="width: 30%;float: left">
<el-form-item prop="maxConcurrency" label="最大并发数" style="padding-left: 20px">
<el-input-number v-model="item.maxConcurrency" :min="1" :max="9999"></el-input-number>
</el-form-item>
</div>
<div class="op">
<span class="box">
@ -264,6 +251,9 @@
],
description: [
{max: 60, message: '最大长度 60 个字符', trigger: 'blur'}
],
type: [
{required: true, message: '请选择资源类型', trigger: 'blur'}
]
}
}
@ -303,6 +293,28 @@
});
}
},
validateResourceInfo() {
if (this.infoList.length <= 0) {
return {validate: false, msg: "资源池不能为空"}
}
let resultValidate = {validate: true, msg: "请完善数据"}
this.infoList.forEach(function (info) {
for (let key in info) {
if (info[key] != '0' && !info[key]) {
resultValidate.validate = false
return false;
}
}
if (!info.maxConcurrency) {
resultValidate.validate = false
return false;
}
});
return resultValidate;
},
buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize;
},
@ -349,6 +361,8 @@
createTestResourcePool(createTestResourcePoolForm) {
this.$refs[createTestResourcePoolForm].validate(valide => {
if (valide) {
let vri = this.validateResourceInfo();
if (vri.validate) {
this.form.info = JSON.stringify(this.infoList);
this.$post("/testresourcepool/add", this.form)
.then(() => {
@ -359,6 +373,14 @@
this.createVisible = false,
this.initTableData())
});
} else {
this.$message({
type: 'warning',
message: vri.msg
});
return false;
}
} else {
return false;
}
@ -367,6 +389,8 @@
updateTestResourcePool(updateTestResourcePoolForm) {
this.$refs[updateTestResourcePoolForm].validate(valide => {
if (valide) {
let vri = this.validateResourceInfo();
if (vri.validate) {
this.form.info = JSON.stringify(this.infoList);
this.$post("/testresourcepool/update", this.form)
.then(() => {
@ -378,6 +402,13 @@
this.initTableData(),
self.loading = false)
});
} else {
this.$message({
type: 'warning',
message: vri.msg
});
return false;
}
} else {
return false;
}
@ -414,12 +445,29 @@
}
.op {
line-height: 40px;
float: left;
width: 16%;
width: 10%;
}
.box {
padding-left: 5px;
}
.k8s-master {
width: 34%;
float: left
}
.k8s-token {
width: 36%;
float: left
}
.k8s-token .el-form-item__label {
padding-left: 20px;
}
.node-line {
clear: both;
}
</style>

View File

@ -65,7 +65,7 @@
</el-card>
<el-dialog :title="$t('user.create')" :visible.sync="createVisible" width="30%" @closed="closeFunc" :destroy-on-close="true">
<el-form :model="form" label-position="left" label-width="100px" size="small" :rules="rule" ref="createUserForm">
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule" ref="createUserForm">
<el-form-item label="ID" prop="id">
<el-input v-model="form.id" autocomplete="off"/>
</el-form-item>
@ -85,7 +85,7 @@
</el-dialog>
<el-dialog :title="$t('user.modify')" :visible.sync="updateVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-form :model="form" label-position="left" label-width="100px" size="small" :rules="rule" ref="updateUserForm">
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule" ref="updateUserForm">
<el-form-item label="ID" prop="id">
<el-input v-model="form.id" autocomplete="off" :disabled="true"/>
</el-form-item>

View File

@ -50,7 +50,7 @@
</el-card>
<el-dialog title="添加成员" :visible.sync="createVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-form :model="form" ref="form" :rules="rules" label-position="left" label-width="100px" size="small">
<el-form :model="form" ref="form" :rules="rules" label-position="right" label-width="100px" size="small">
<el-form-item label="成员" prop="userIds">
<el-select v-model="form.userIds" multiple :placeholder="$t('member.please_choose_member')" class="select-width">
<el-option
@ -80,7 +80,7 @@
</el-dialog>
<el-dialog title="修改成员" :visible.sync="updateVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-form :model="form" label-position="left" label-width="100px" size="small" ref="updateUserForm">
<el-form :model="form" label-position="right" label-width="100px" size="small" ref="updateUserForm">
<el-form-item label="ID" prop="id">
<el-input v-model="form.id" autocomplete="off" :disabled="true"/>
</el-form-item>