This commit is contained in:
chenjianxing 2021-02-19 14:37:49 +08:00
commit a003eb566e
6 changed files with 37 additions and 10 deletions

@ -1 +1 @@
Subproject commit b35af517d888268abd3a8f2b58d6ea94335138a5 Subproject commit 44bcc9893033900f95c99068cd4edec740465dfe

View File

@ -105,6 +105,13 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row>
<el-col>
<el-form-item label="nodeSelector">
<el-input v-model="item.nodeSelector" placeholder='{"disktype": "ssd",...}'/>
</el-form-item>
</el-col>
</el-row>
</div> </div>
<div class="node-line" v-if="form.type === 'NODE'"> <div class="node-line" v-if="form.type === 'NODE'">
<el-row> <el-row>
@ -243,9 +250,9 @@ export default {
if (this.infoList.length <= 0) { if (this.infoList.length <= 0) {
return {validate: false, msg: this.$t('test_resource_pool.cannot_empty')} return {validate: false, msg: this.$t('test_resource_pool.cannot_empty')}
} }
let resourcePoolType = this.form.type;
let resultValidate = {validate: true, msg: this.$t('test_resource_pool.fill_the_data')}; let resultValidate = {validate: true, msg: this.$t('test_resource_pool.fill_the_data')};
this.infoList.forEach(function (info) { this.infoList.forEach(info => {
for (let key in info) { for (let key in info) {
if (info[key] != '0' && !info[key]) { if (info[key] != '0' && !info[key]) {
resultValidate.validate = false resultValidate.validate = false
@ -257,6 +264,13 @@ export default {
resultValidate.validate = false resultValidate.validate = false
return false; return false;
} }
if (resourcePoolType === 'K8S' && info.nodeSelector) {
let validate = this.isJsonString(info.nodeSelector);
if (!validate) {
resultValidate.validate = false;
resultValidate.msg = this.$t('test_resource_pool.node_selector_invalid');
}
}
}); });
return resultValidate; return resultValidate;
@ -380,6 +394,16 @@ export default {
row.status = 'INVALID'; row.status = 'INVALID';
this.result.loading = false; this.result.loading = false;
}) })
},
isJsonString(str) {
try {
if (typeof JSON.parse(str) == "object") {
return true;
}
} catch (e) {
console.log('json invalid');
}
return false;
} }
} }
} }

@ -1 +1 @@
Subproject commit a3d469fd18f663d11e5c1c49f71ced6e3e4b292f Subproject commit 4cc8926bad84083f675a262d6766a92bb09a890a

View File

@ -1323,6 +1323,7 @@ export default {
status_change_success: 'Successfully changed the status!', status_change_success: 'Successfully changed the status!',
status_change_failed: 'Failed to change the status, resource pool is invalid!', status_change_failed: 'Failed to change the status, resource pool is invalid!',
check_in: 'Check in', check_in: 'Check in',
node_selector_invalid: 'nodeSelector must be JSON'
}, },
system_parameter_setting: { system_parameter_setting: {
mailbox_service_settings: 'Mailbox Settings', mailbox_service_settings: 'Mailbox Settings',

View File

@ -1,7 +1,7 @@
export default { export default {
commons: { commons: {
cover:'覆盖', cover: '覆盖',
not_cover:'不覆盖', not_cover: '不覆盖',
import_mode: '导入模式', import_mode: '导入模式',
import_module: '导入模块', import_module: '导入模块',
please_fill_in_the_template: '请填写模版内容', please_fill_in_the_template: '请填写模版内容',
@ -592,7 +592,7 @@ export default {
create_info: '创建', create_info: '创建',
update_info: '更新', update_info: '更新',
batch_edit: "批量编辑", batch_edit: "批量编辑",
batch_move:"批量移动", batch_move: "批量移动",
path_valid_info: "请求路径无效", path_valid_info: "请求路径无效",
other_config: "其他设置", other_config: "其他设置",
message_template: "报文模版", message_template: "报文模版",
@ -1327,6 +1327,7 @@ export default {
status_change_success: '状态修改成功!', status_change_success: '状态修改成功!',
status_change_failed: '状态修改失败, 校验不通过!', status_change_failed: '状态修改失败, 校验不通过!',
check_in: '校验中', check_in: '校验中',
node_selector_invalid: 'nodeSelector 必须是有效的JSON'
}, },
system_parameter_setting: { system_parameter_setting: {
mailbox_service_settings: '邮件设置', mailbox_service_settings: '邮件设置',

View File

@ -1,7 +1,7 @@
export default { export default {
commons: { commons: {
cover:'覆蓋', cover: '覆蓋',
not_cover:'不覆蓋', not_cover: '不覆蓋',
import_mode: '導入模式', import_mode: '導入模式',
import_module: '導入模塊', import_module: '導入模塊',
please_fill_in_the_template: '請填寫模版內容', please_fill_in_the_template: '請填寫模版內容',
@ -591,7 +591,7 @@ export default {
create_info: '創建', create_info: '創建',
update_info: '更新', update_info: '更新',
batch_edit: "批量編輯", batch_edit: "批量編輯",
batch_move:"批量移動", batch_move: "批量移動",
path_valid_info: "請求路徑無效", path_valid_info: "請求路徑無效",
other_config: "其他設置", other_config: "其他設置",
message_template: "報文模版", message_template: "報文模版",
@ -1325,6 +1325,7 @@ export default {
status_change_success: '狀態修改成功!', status_change_success: '狀態修改成功!',
status_change_failed: '狀態修改失敗, 校驗不通過!', status_change_failed: '狀態修改失敗, 校驗不通過!',
check_in: '校驗中', check_in: '校驗中',
node_selector_invalid: 'nodeSelector 必須是有效的JSON'
}, },
system_parameter_setting: { system_parameter_setting: {
mailbox_service_settings: '郵件設置', mailbox_service_settings: '郵件設置',