diff --git a/src/locales/en.json b/src/locales/en.json index 3e4ab7ef..4211cc54 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -2342,6 +2342,7 @@ "The host name of this container": "The host name of this container", "The http_proxy address to use for nodes in cluster": "The http_proxy address to use for nodes in cluster", "The https_proxy address to use for nodes in cluster": "The https_proxy address to use for nodes in cluster", + "The image is not existed": "The image is not existed", "The instance architecture diagram mainly shows the overall architecture composition of the instance. If you need to view the network topology of the instance, please go to: ": "The instance architecture diagram mainly shows the overall architecture composition of the instance. If you need to view the network topology of the instance, please go to: ", "The instance deleted immediately cannot be restored": "The instance deleted immediately cannot be restored", "The instance has been locked. If you want to do more, please unlock it first.": "The instance has been locked. If you want to do more, please unlock it first.", diff --git a/src/locales/zh.json b/src/locales/zh.json index b3be5e4d..944e677e 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -2342,6 +2342,7 @@ "The host name of this container": "容器的主机名", "The http_proxy address to use for nodes in cluster": "用于集群中节点的HTTP代理地址", "The https_proxy address to use for nodes in cluster": "用于集群中节点的HTTPS代理地址", + "The image is not existed": "镜像资源不存在", "The instance architecture diagram mainly shows the overall architecture composition of the instance. If you need to view the network topology of the instance, please go to: ": "云主机架构图主要展示云主机的总体架构组成。如果需要查看云主机的网络拓扑,请转到:", "The instance deleted immediately cannot be restored": "立即删除的云主机无法恢复", "The instance has been locked. If you want to do more, please unlock it first.": "该云主机已被锁定。如果要做更多操作,请先解锁。", diff --git a/src/pages/container-service/containers/Containers/actions/Rebuild.jsx b/src/pages/container-service/containers/Containers/actions/Rebuild.jsx index fcb40377..7083a108 100644 --- a/src/pages/container-service/containers/Containers/actions/Rebuild.jsx +++ b/src/pages/container-service/containers/Containers/actions/Rebuild.jsx @@ -14,6 +14,7 @@ import { inject, observer } from 'mobx-react'; import { ModalAction } from 'containers/Action'; import globalContainersStore from 'src/stores/zun/containers'; import { checkItemAction } from 'resources/zun/container'; +import { ImageStore } from 'stores/glance/image'; export class RebuildContainer extends ModalAction { static id = 'rebuild'; @@ -58,6 +59,16 @@ export class RebuildContainer extends ModalAction { type: 'input', placeholder: t('Name or ID og the container image'), required: true, + validator: (rule, value) => { + return new ImageStore() + .fetchDetail({ id: value }) + .then(() => { + return Promise.resolve(true); + }) + .catch(() => { + return Promise.reject(new Error(t('The image is not existed'))); + }); + }, }, { name: 'image_driver', diff --git a/src/pages/container-service/containers/Containers/actions/StepCreate/StepNetworks/index.jsx b/src/pages/container-service/containers/Containers/actions/StepCreate/StepNetworks/index.jsx index e48d92c2..722fc19a 100644 --- a/src/pages/container-service/containers/Containers/actions/StepCreate/StepNetworks/index.jsx +++ b/src/pages/container-service/containers/Containers/actions/StepCreate/StepNetworks/index.jsx @@ -15,6 +15,7 @@ import { SecurityGroupStore } from 'stores/neutron/security-group'; import { PortStore } from 'stores/neutron/port-extension'; import Base from 'components/Form'; import { inject, observer } from 'mobx-react'; +import { toJS } from 'mobx'; import { portColumns, portFilters } from 'src/resources/neutron/port'; import { securityGroupColumns, @@ -26,6 +27,7 @@ export class StepNetworks extends Base { init() { this.portStore = new PortStore(); this.securityGroupStore = new SecurityGroupStore(); + this.getPorts(); } get title() { @@ -36,6 +38,17 @@ export class StepNetworks extends Base { return t('Networks'); } + getPorts() { + this.portStore.fetchList({ + project_id: this.currentProjectId, + status: 'DOWN', + }); + } + + get ports() { + return (toJS(this.portStore.list.data) || []).filter((it) => !it.device_id); + } + get formItems() { const { networks = [] } = this.state; const { @@ -58,8 +71,8 @@ export class StepNetworks extends Base { name: 'ports', type: 'select-table', label: t('Ports'), - extraParams: { project_id: this.currentProjectId, status: 'DOWN' }, - backendPageStore: this.portStore, + data: this.ports, + isLoading: this.portStore.list.isLoading, isMulti: true, header: t( 'Ports provide extra communication channels to your instances. You can select ports instead of networks or a mix of both (The port executes its own security group rules by default).'