资源池国际化0.1

This commit is contained in:
Captain.B 2020-04-07 18:34:29 +08:00
parent f9ced9a788
commit 0b8e26e77b
3 changed files with 73 additions and 50 deletions

View File

@ -5,26 +5,27 @@
<template v-slot:header> <template v-slot:header>
<div> <div>
<el-row type="flex" justify="space-between" align="middle"> <el-row type="flex" justify="space-between" align="middle">
<span class="title">测试资源池 <span class="title">{{$t('commons.test_resource_pool')}}
<ms-create-box :tips="btnTips" :exec="create"/> <ms-create-box :tips="btnTips" :exec="create"/>
</span> </span>
<span class="search"> <span class="search">
<el-input type="text" size="small" placeholder="根据名称搜索" prefix-icon="el-icon-search" <el-input type="text" size="small" :placeholder="$t('test_resource_pool.search_by_name')"
prefix-icon="el-icon-search"
maxlength="60" v-model="condition" @change="search" clearable/> maxlength="60" v-model="condition" @change="search" clearable/>
</span> </span>
</el-row> </el-row>
</div> </div>
</template> </template>
<el-table :data="items" style="width: 100%"> <el-table :data="items" style="width: 100%">
<el-table-column prop="name" label="名称"/> <el-table-column prop="name" :label="$t('commons.name')"/>
<el-table-column prop="description" label="描述"/> <el-table-column prop="description" :label="$t('commons.description')"/>
<el-table-column prop="type" label="类型"> <el-table-column prop="type" :label="$t('test_resource_pool.type')">
<template v-slot:default="scope"> <template v-slot:default="scope">
<span v-if="scope.row.type === 'NODE'">独立节点</span> <span v-if="scope.row.type === 'NODE'">Single Docker</span>
<span v-if="scope.row.type === 'K8S'">Kubernetes</span> <span v-if="scope.row.type === 'K8S'">Kubernetes</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="status" label="启用/禁用"> <el-table-column prop="status" :label="$t('test_resource_pool.enable_disable')">
<template v-slot:default="scope"> <template v-slot:default="scope">
<el-switch v-model="scope.row.status" <el-switch v-model="scope.row.status"
active-color="#13ce66" active-color="#13ce66"
@ -35,12 +36,12 @@
/> />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="createTime" label="创建时间" width="180"> <el-table-column prop="createTime" :label="$t('commons.create_time')" width="180">
<template v-slot:default="scope"> <template v-slot:default="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span> <span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="updateTime" label="更新时间" width="180"> <el-table-column prop="updateTime" :label="$t('commons.update_time')" width="180">
<template v-slot:default="scope"> <template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span> <span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template> </template>
@ -71,20 +72,22 @@
</div> </div>
</el-card> </el-card>
<el-dialog title="创建资源池" :visible.sync="createVisible" width="70%" @closed="closeFunc" <el-dialog :title="$t('test_resource_pool.create_resource_pool')" :visible.sync="createVisible" width="70%"
@closed="closeFunc"
:destroy-on-close="true"> :destroy-on-close="true">
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule" <el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule"
ref="createTestResourcePoolForm"> ref="createTestResourcePoolForm">
<el-form-item label="名称" 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>
<el-form-item label="描述" prop="description"> <el-form-item :label="$t('commons.description')" prop="description">
<el-input v-model="form.description" autocomplete="off"/> <el-input v-model="form.description" autocomplete="off"/>
</el-form-item> </el-form-item>
<el-form-item label="资源类型" prop="type"> <el-form-item :label="$t('test_resource_pool.type')" prop="type">
<el-select v-model="form.type" placeholder="选择资源类型" @change="changeResourceType()"> <el-select v-model="form.type" :placeholder="$t('test_resource_pool.select_pool_type')"
@change="changeResourceType()">
<el-option key="K8S" value="K8S" label="Kubernetes">Kubernetes</el-option> <el-option key="K8S" value="K8S" label="Kubernetes">Kubernetes</el-option>
<el-option key="NODE" value="NODE" label="独立节点">独立节点</el-option> <el-option key="NODE" value="NODE" label="Node">Single Docker</el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<div v-for="(item,index) in infoList " :key="index"> <div v-for="(item,index) in infoList " :key="index">
@ -103,7 +106,7 @@
</el-form-item> </el-form-item>
</div> </div>
<div style="width: 30%;float: left"> <div style="width: 30%;float: left">
<el-form-item prop="maxConcurrency" label="最大并发数"> <el-form-item prop="maxConcurrency" :label="$t('test_resource_pool.max_threads')">
<el-input-number v-model="item.maxConcurrency" :min="1" :max="9999"></el-input-number> <el-input-number v-model="item.maxConcurrency" :min="1" :max="9999"></el-input-number>
</el-form-item> </el-form-item>
</div> </div>
@ -120,7 +123,7 @@
</el-form-item> </el-form-item>
</div> </div>
<div style="width: 30%;float: left"> <div style="width: 30%;float: left">
<el-form-item prop="maxConcurrency" label="最大并发数"> <el-form-item prop="maxConcurrency" :label="$t('test_resource_pool.max_threads')">
<el-input-number v-model="item.maxConcurrency" :min="1" :max="9999"></el-input-number> <el-input-number v-model="item.maxConcurrency" :min="1" :max="9999"></el-input-number>
</el-form-item> </el-form-item>
</div> </div>
@ -143,25 +146,27 @@
<template v-slot:footer> <template v-slot:footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button type="primary" @click="createTestResourcePool('createTestResourcePoolForm')" <el-button type="primary" @click="createTestResourcePool('createTestResourcePoolForm')"
size="medium">创建</el-button> size="medium">{{$t('commons.create')}}</el-button>
</span> </span>
</template> </template>
</el-dialog> </el-dialog>
<el-dialog title="修改资源池" :visible.sync="updateVisible" width="70%" :destroy-on-close="true" <el-dialog :title="$t('test_resource_pool.update_resource_pool')" :visible.sync="updateVisible" width="70%"
:destroy-on-close="true"
@close="closeFunc"> @close="closeFunc">
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule" <el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule"
ref="updateTestResourcePoolForm"> ref="updateTestResourcePoolForm">
<el-form-item label="名称" 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>
<el-form-item label="描述" prop="description"> <el-form-item :label="$t('commons.description')" prop="description">
<el-input v-model="form.description" autocomplete="off"/> <el-input v-model="form.description" autocomplete="off"/>
</el-form-item> </el-form-item>
<el-form-item label="资源类型" prop="type"> <el-form-item :label="$t('test_resource_pool.type')" prop="type">
<el-select v-model="form.type" placeholder="选择资源类型" @change="changeResourceType()"> <el-select v-model="form.type" :placeholder="$t('test_resource_pool.select_pool_type')"
@change="changeResourceType()">
<el-option key="K8S" value="K8S" label="Kubernetes">Kubernetes</el-option> <el-option key="K8S" value="K8S" label="Kubernetes">Kubernetes</el-option>
<el-option key="NODE" value="NODE" label="独立节点">独立节点</el-option> <el-option key="NODE" value="NODE" label="Node">Single Docker</el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<div v-for="(item,index) in infoList " :key="index"> <div v-for="(item,index) in infoList " :key="index">
@ -177,7 +182,8 @@
</el-form-item> </el-form-item>
</div> </div>
<div style="width: 30%;float: left"> <div style="width: 30%;float: left">
<el-form-item prop="maxConcurrency" label="最大并发数" style="padding-left: 20px"> <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="9999"></el-input-number> <el-input-number v-model="item.maxConcurrency" :min="1" :max="9999"></el-input-number>
</el-form-item> </el-form-item>
</div> </div>
@ -194,7 +200,8 @@
</el-form-item> </el-form-item>
</div> </div>
<div style="width: 30%;float: left"> <div style="width: 30%;float: left">
<el-form-item prop="maxConcurrency" label="最大并发数" style="padding-left: 20px"> <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="9999"></el-input-number> <el-input-number v-model="item.maxConcurrency" :min="1" :max="9999"></el-input-number>
</el-form-item> </el-form-item>
</div> </div>
@ -216,7 +223,7 @@
<template v-slot:footer> <template v-slot:footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button type="primary" @click="updateTestResourcePool('updateTestResourcePoolForm')" <el-button type="primary" @click="updateTestResourcePool('updateTestResourcePoolForm')"
size="medium">修改</el-button> size="medium">{{$t('commons.save')}}</el-button>
</span> </span>
</template> </template>
</el-dialog> </el-dialog>
@ -238,8 +245,8 @@
infoList: [], infoList: [],
updateVisible: false, updateVisible: false,
btnTips: "添加资源池", btnTips: "添加资源池",
btnTipsAdd: "添加", btnTipsAdd: this.$t("commons.add"),
btnTipsDel: "删除", btnTipsDel: this.$t("commons.delete"),
queryPath: "testresourcepool/list", queryPath: "testresourcepool/list",
condition: "", condition: "",
items: [], items: [],
@ -381,16 +388,15 @@
if (vri.validate) { if (vri.validate) {
this.testLoading = true; this.testLoading = true;
this.convertSubmitResources(); this.convertSubmitResources();
this.$post("/testresourcepool/add", this.form) this.$post("/testresourcepool/add", this.form, () => {
.then(() => { this.$message({
this.$message({ type: 'success',
type: 'success', message: '添加成功!'
message: '添加成功!' },
}, this.createVisible = false,
this.createVisible = false, this.initTableData());
this.initTableData()); this.testLoading = false;
this.testLoading = false; });
});
} else { } else {
this.$message({ this.$message({
type: 'warning', type: 'warning',
@ -424,17 +430,16 @@
let vri = this.validateResourceInfo(); let vri = this.validateResourceInfo();
if (vri.validate) { if (vri.validate) {
this.convertSubmitResources(); this.convertSubmitResources();
this.$post("/testresourcepool/update", this.form) this.$post("/testresourcepool/update", this.form, () => {
.then(() => { this.$message({
this.$message({ type: 'success',
type: 'success', message: this.$t('commons.modify_success')
message: this.$t('commons.modify_success') },
}, this.updateVisible = false,
this.updateVisible = false, this.initTableData(),
this.initTableData(), self.loading = false);
self.loading = false); this.testLoading = false;
this.testLoading = false; });
});
} else { } else {
this.$message({ this.$message({
type: 'warning', type: 'warning',

View File

@ -237,6 +237,15 @@ export default {
'select_execute_result': 'Select execute result', 'select_execute_result': 'Select execute result',
'save': 'Save' 'save': 'Save'
}, },
'test_resource_pool': {
'type': 'type',
'enable_disable': 'Enable / disable',
'search_by_name': 'Search by name',
'create_resource_pool': 'Create resource pool',
'update_resource_pool': 'Create resource pool',
'select_pool_type': 'Select resource type',
'max_threads': 'Maximum concurrent number',
},
i18n: { i18n: {
'home': 'Home' 'home': 'Home'
} }

View File

@ -239,6 +239,15 @@ export default {
'save': '保 存' 'save': '保 存'
}, },
'test_resource_pool': {
'type': '类型',
'enable_disable': '启用/禁用',
'search_by_name': '根据名称搜索',
'create_resource_pool': '创建资源池',
'update_resource_pool': '创建资源池',
'select_pool_type': '选择资源类型',
'max_threads': '最大并发数',
},
i18n: { i18n: {
'home': '首页' 'home': '首页'
} }