diff --git a/web_src/vuepages/apis/modules/resources.js b/web_src/vuepages/apis/modules/resources.js index 4ace89959..981df8b2c 100644 --- a/web_src/vuepages/apis/modules/resources.js +++ b/web_src/vuepages/apis/modules/resources.js @@ -74,6 +74,16 @@ export const addResSpecification = (data) => { }); } +// 查询资源规格所属场景 - 下架时提醒 +export const getResSpecificationScenes = (data) => { // data => { ID: 1 } + return service({ + url: `/admin/resources/specification/scenes/${data.ID}`, + method: 'get', + params: {}, + data: {} + }); +} + // 更新资源规格 // params: action edit-编辑 on-shelf 上架 off-shelf 下架 // data: UnitPrice diff --git a/web_src/vuepages/langs/config/en-US.js b/web_src/vuepages/langs/config/en-US.js index 64da0bb5d..1d17297d0 100644 --- a/web_src/vuepages/langs/config/en-US.js +++ b/web_src/vuepages/langs/config/en-US.js @@ -129,6 +129,9 @@ const en = { point_hr: 'Point/hr', onShelfConfirm: 'Are you sure to on shelf the resources specification?', offShelfConfirm: 'Are you sure to off shelf the resources specification?', + onShelfCode1001: 'On shelf failed, the resources queues not available.', + offShelfDlgTip1: 'The resources specification has already used in scene:', + offShelfDlgTip2: 'Please confirm to off shelf?', resSceneManagement: 'Resources Scene Management', addResScene: 'Add Resources Scene', addResSceneBtn: 'Add Resources Scene', diff --git a/web_src/vuepages/langs/config/zh-CN.js b/web_src/vuepages/langs/config/zh-CN.js index abbde5dae..6952ba8f0 100644 --- a/web_src/vuepages/langs/config/zh-CN.js +++ b/web_src/vuepages/langs/config/zh-CN.js @@ -129,6 +129,9 @@ const zh = { point_hr: '积分/时', onShelfConfirm: '请确认是否上架该规格?', offShelfConfirm: '请确认是否下架该规格?', + onShelfCode1001: '上架失败,资源池(队列)不可用。', + offShelfDlgTip1: '当前资源规格已在以下场景中使用:', + offShelfDlgTip2: '请确认是否进行下架操作?', resSceneManagement: '算力资源应用场景管理', addResScene: '新建算力资源应用场景', addResSceneBtn: '新增应用场景', diff --git a/web_src/vuepages/pages/resources/components/SpecificationDialog.vue b/web_src/vuepages/pages/resources/components/SpecificationDialog.vue index f42996e9a..960ddbf89 100644 --- a/web_src/vuepages/pages/resources/components/SpecificationDialog.vue +++ b/web_src/vuepages/pages/resources/components/SpecificationDialog.vue @@ -220,9 +220,10 @@ export default { return; } const setApi = this.type === 'add' ? addResSpecification : updateResSpecification; + const action = this.editOr ? 'edit' : this.type === 'edit' ? 'on-shelf' : undefined; setApi({ ...this.dataInfo, - action: this.editOr ? 'edit' : this.type === 'edit' ? 'on-shelf' : undefined, + action: action, AccCardsNum: Number(this.dataInfo.AccCardsNum), CpuCores: Number(this.dataInfo.CpuCores), MemGiB: Number(this.dataInfo.MemGiB), @@ -239,10 +240,17 @@ export default { }); this.$emit("confirm"); } else { - this.$message({ - type: 'error', - message: this.$t('submittedFailed') - }); + if (action === 'on-shelf' && res.Code === 1001) { + this.$message({ + type: 'info', + message: this.$t('resourcesManagement.onShelfCode1001') + }); + } else { + this.$message({ + type: 'error', + message: this.$t('submittedFailed') + }); + } } }).catch(err => { console.log(err); diff --git a/web_src/vuepages/pages/resources/specification/index.vue b/web_src/vuepages/pages/resources/specification/index.vue index 629524ebe..def63bdb8 100644 --- a/web_src/vuepages/pages/resources/specification/index.vue +++ b/web_src/vuepages/pages/resources/specification/index.vue @@ -27,7 +27,7 @@ - {{ $t('edit') }} - {{ + {{ $t('resourcesManagement.toOffShelf') }} - {{ + {{ $t('resourcesManagement.toOnShelf') }} @@ -98,12 +98,29 @@ + + + + + {{ $t('resourcesManagement.offShelfDlgTip1') }} + {{ offSelfDialogContent }} + {{ $t('resourcesManagement.offShelfDlgTip2') }} + + + + {{ $t('confirm') }} + {{ $t('cancel') }} + + + +