diff --git a/.eslintrc b/.eslintrc index a2873ea5..52ca1829 100644 --- a/.eslintrc +++ b/.eslintrc @@ -67,7 +67,7 @@ "jsx-a11y/click-events-have-key-events": "warn", "jsx-a11y/no-static-element-interactions": "warn", "import/no-extraneous-dependencies": "warn", - "import/prefer-default-export": "warn", + "import/prefer-default-export": "off", "no-nested-ternary": "warn", "import/no-named-as-default": "warn" }, diff --git a/src/pages/compute/containers/Flavor/actions/StepCreate/ParamSetting.jsx b/src/pages/compute/containers/Flavor/actions/StepCreate/ParamSetting.jsx index dc24cd76..29419a61 100644 --- a/src/pages/compute/containers/Flavor/actions/StepCreate/ParamSetting.jsx +++ b/src/pages/compute/containers/Flavor/actions/StepCreate/ParamSetting.jsx @@ -87,26 +87,38 @@ export class ParamSetting extends Base { const item = (this.settingStore.list.data || []).find( (it) => it.key === 'gpu_models' ); - return item - ? item.value.map((it) => ({ - value: it, - label: it, - })) - : []; + if (item && item.value instanceof Array) { + return item.value.map((it) => ({ + value: it, + label: it, + })); + } + if (item && typeof item.value === 'object') { + return Object.keys(item.value).map((it) => ({ + label: it, + value: it, + })); + } + return []; } get usbTypes() { const item = (this.settingStore.list.data || []).find( (it) => it.key === 'usb_models' ); - return item - ? [ - { - value: item.value, - label: item.value, - }, - ] - : []; + if (item && item.value instanceof Array) { + return item.value.map((it) => ({ + value: it, + label: it, + })); + } + if (item && typeof item.value === 'object') { + return Object.keys(item.value).map((it) => ({ + label: it, + value: it, + })); + } + return []; } get vgpuTypes() {