From 0849ecea4444f1f54dbb0452b785830aac0d63b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Re=C5=9Fit=20Demir?= Date: Tue, 18 Oct 2022 07:12:52 +0000 Subject: [PATCH] Fix : Update labels , filters , keypairs at Magnum Service Update admissionlabels Update autoheal and autoscaling labels Update retrieving keypairs Update project_id filter when retrieving external networks Change-Id: Ibe5fc650a7c0cda2516aad09d67ac4f9d40e126f --- .../actions/StepCreate/StepLabel/index.jsx | 14 ++------------ .../actions/StepCreate/StepNetwork/index.jsx | 3 +-- .../actions/StepCreate/StepNodeSpec/index.jsx | 16 ++++++++++++---- .../actions/StepCreate/StepLabel/index.jsx | 17 +---------------- .../Clusters/actions/StepCreate/index.jsx | 6 +++--- src/resources/magnum/template.js | 3 --- 6 files changed, 19 insertions(+), 40 deletions(-) diff --git a/src/pages/container-infra/containers/ClusterTemplates/actions/StepCreate/StepLabel/index.jsx b/src/pages/container-infra/containers/ClusterTemplates/actions/StepCreate/StepLabel/index.jsx index edda7057..1f55064c 100644 --- a/src/pages/container-infra/containers/ClusterTemplates/actions/StepCreate/StepLabel/index.jsx +++ b/src/pages/container-infra/containers/ClusterTemplates/actions/StepCreate/StepLabel/index.jsx @@ -13,7 +13,6 @@ import Base from 'components/Form'; import { inject, observer } from 'mobx-react'; import KeyValueInput from 'components/FormItem/KeyValueInput'; -import { admission_control_list } from 'resources/magnum/template'; export class StepLabel extends Base { get title() { @@ -33,16 +32,7 @@ export class StepLabel extends Base { } get defaultValue() { - const values = { - additionalLabels: [ - { - value: { - key: 'admission_control_list', - value: admission_control_list, - }, - }, - ], - }; + const values = {}; if (this.isEdit) { const { extra: { labels }, @@ -70,4 +60,4 @@ export class StepLabel extends Base { } } -export default inject('rootStore')(observer(StepLabel)); +export default inject('rootStore')(observer(StepLabel)); \ No newline at end of file diff --git a/src/pages/container-infra/containers/ClusterTemplates/actions/StepCreate/StepNetwork/index.jsx b/src/pages/container-infra/containers/ClusterTemplates/actions/StepCreate/StepNetwork/index.jsx index 21d3845b..99bb7960 100644 --- a/src/pages/container-infra/containers/ClusterTemplates/actions/StepCreate/StepNetwork/index.jsx +++ b/src/pages/container-infra/containers/ClusterTemplates/actions/StepCreate/StepNetwork/index.jsx @@ -170,7 +170,6 @@ export class StepNetwork extends Base { backendPageStore: this.externalNetworkStore, extraParams: { 'router:external': true, - project_id: this.currentProjectId, }, required: true, loading: this.externalNetworkStore.list.isLoading, @@ -279,4 +278,4 @@ export class StepNetwork extends Base { } } -export default inject('rootStore')(observer(StepNetwork)); +export default inject('rootStore')(observer(StepNetwork)); \ No newline at end of file diff --git a/src/pages/container-infra/containers/ClusterTemplates/actions/StepCreate/StepNodeSpec/index.jsx b/src/pages/container-infra/containers/ClusterTemplates/actions/StepCreate/StepNodeSpec/index.jsx index faa0c99f..bebe9b24 100644 --- a/src/pages/container-infra/containers/ClusterTemplates/actions/StepCreate/StepNodeSpec/index.jsx +++ b/src/pages/container-infra/containers/ClusterTemplates/actions/StepCreate/StepNodeSpec/index.jsx @@ -27,6 +27,7 @@ import { export class StepNodeSpec extends Base { init() { this.getImageList(); + this.getKeypairs(); } get title() { @@ -50,11 +51,19 @@ export class StepNodeSpec extends Base { this.updateDefaultValue(); } + async getKeypairs() { + await globalKeypairStore.fetchList(); + } + + get keypairs() { + return globalKeypairStore.list.data || []; + } + get acceptedImageOs() { const { context: { coe = '' } = {} } = this.props; let acceptedOs = []; if (coe === 'kubernetes') { - acceptedOs = ['fedora', 'coreos']; + acceptedOs = ['fedora', 'coreos', 'others']; } else if (['swarm', 'swarm-mode'].includes(coe)) { acceptedOs = ['fedora']; } else if (['mesos', 'dcos'].includes(coe)) { @@ -83,7 +92,6 @@ export class StepNodeSpec extends Base { return (globalImageStore.list.data || []) .filter( (it) => - it.owner === this.currentProjectId && this.acceptedImageOs.includes(it.os_distro) ) .filter((it) => getImageOS(it) === imageTab); @@ -176,7 +184,7 @@ export class StepNodeSpec extends Base { name: 'keypairs', label: t('Keypair'), type: 'select-table', - data: this.keypairsList, + data: this.keypairs, isLoading: globalKeypairStore.list.isLoading, tip: t( 'The SSH key is a way to remotely log in to the instance. The cloud platform only helps to keep the public key. Please keep your private key properly.' @@ -263,4 +271,4 @@ export class StepNodeSpec extends Base { } } -export default inject('rootStore')(observer(StepNodeSpec)); +export default inject('rootStore')(observer(StepNodeSpec)); \ No newline at end of file diff --git a/src/pages/container-infra/containers/Clusters/actions/StepCreate/StepLabel/index.jsx b/src/pages/container-infra/containers/Clusters/actions/StepCreate/StepLabel/index.jsx index cdd64abf..88ad2997 100644 --- a/src/pages/container-infra/containers/Clusters/actions/StepCreate/StepLabel/index.jsx +++ b/src/pages/container-infra/containers/Clusters/actions/StepCreate/StepLabel/index.jsx @@ -15,7 +15,6 @@ import Base from 'components/Form'; import { inject, observer } from 'mobx-react'; import KeyValueInput from 'components/FormItem/KeyValueInput'; -import { admission_control_list } from 'resources/magnum/template'; export class StepLabel extends Base { get title() { @@ -26,20 +25,6 @@ export class StepLabel extends Base { return t('Labels'); } - get defaultValue() { - const values = { - additionalLabels: [ - { - value: { - key: 'admission_control_list', - value: admission_control_list, - }, - }, - ], - }; - return values; - } - get formItems() { return [ { @@ -53,4 +38,4 @@ export class StepLabel extends Base { } } -export default inject('rootStore')(observer(StepLabel)); +export default inject('rootStore')(observer(StepLabel)); \ No newline at end of file diff --git a/src/pages/container-infra/containers/Clusters/actions/StepCreate/index.jsx b/src/pages/container-infra/containers/Clusters/actions/StepCreate/index.jsx index d1e1e61e..7fc6af28 100644 --- a/src/pages/container-infra/containers/Clusters/actions/StepCreate/index.jsx +++ b/src/pages/container-infra/containers/Clusters/actions/StepCreate/index.jsx @@ -100,8 +100,8 @@ export class StepCreate extends StepAction { name: values.name, labels: { ...requestLabels, - auto_healing_enabled: `${auto_healing_enabled}`, - auto_scaling_enabled: `${auto_scaling_enabled}`, + auto_healing_enabled: `${auto_healing_enabled ? true : false}`, + auto_scaling_enabled: `${auto_scaling_enabled ? true : false}`, }, master_flavor_id: masterFlavor.selectedRowKeys[0], flavor_id: flavor.selectedRowKeys[0], @@ -119,4 +119,4 @@ export class StepCreate extends StepAction { }; } -export default inject('rootStore')(observer(StepCreate)); +export default inject('rootStore')(observer(StepCreate)); \ No newline at end of file diff --git a/src/resources/magnum/template.js b/src/resources/magnum/template.js index 57e744f7..8c8697ce 100644 --- a/src/resources/magnum/template.js +++ b/src/resources/magnum/template.js @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -export const admission_control_list = - 'NodeRestriction,NamespaceLifecycle,LimitRanger,ServiceAccount,ResourceQuota,TaintNodesByCondition,Priority,DefaultTolerationSeconds,DefaultStorageClass,StorageObjectInUseProtection,PersistentVolumeClaimResize,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,RuntimeClass'; - export const getBaseTemplateColumns = (self) => [ { title: t('ID/Name'),