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
This commit is contained in:
Reşit Demir 2022-10-18 07:12:52 +00:00 committed by Boxiang Zhu
parent 544f022a87
commit 0849ecea44
6 changed files with 19 additions and 40 deletions

View File

@ -13,7 +13,6 @@
import Base from 'components/Form'; import Base from 'components/Form';
import { inject, observer } from 'mobx-react'; import { inject, observer } from 'mobx-react';
import KeyValueInput from 'components/FormItem/KeyValueInput'; import KeyValueInput from 'components/FormItem/KeyValueInput';
import { admission_control_list } from 'resources/magnum/template';
export class StepLabel extends Base { export class StepLabel extends Base {
get title() { get title() {
@ -33,16 +32,7 @@ export class StepLabel extends Base {
} }
get defaultValue() { get defaultValue() {
const values = { const values = {};
additionalLabels: [
{
value: {
key: 'admission_control_list',
value: admission_control_list,
},
},
],
};
if (this.isEdit) { if (this.isEdit) {
const { const {
extra: { labels }, extra: { labels },
@ -70,4 +60,4 @@ export class StepLabel extends Base {
} }
} }
export default inject('rootStore')(observer(StepLabel)); export default inject('rootStore')(observer(StepLabel));

View File

@ -170,7 +170,6 @@ export class StepNetwork extends Base {
backendPageStore: this.externalNetworkStore, backendPageStore: this.externalNetworkStore,
extraParams: { extraParams: {
'router:external': true, 'router:external': true,
project_id: this.currentProjectId,
}, },
required: true, required: true,
loading: this.externalNetworkStore.list.isLoading, 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));

View File

@ -27,6 +27,7 @@ import {
export class StepNodeSpec extends Base { export class StepNodeSpec extends Base {
init() { init() {
this.getImageList(); this.getImageList();
this.getKeypairs();
} }
get title() { get title() {
@ -50,11 +51,19 @@ export class StepNodeSpec extends Base {
this.updateDefaultValue(); this.updateDefaultValue();
} }
async getKeypairs() {
await globalKeypairStore.fetchList();
}
get keypairs() {
return globalKeypairStore.list.data || [];
}
get acceptedImageOs() { get acceptedImageOs() {
const { context: { coe = '' } = {} } = this.props; const { context: { coe = '' } = {} } = this.props;
let acceptedOs = []; let acceptedOs = [];
if (coe === 'kubernetes') { if (coe === 'kubernetes') {
acceptedOs = ['fedora', 'coreos']; acceptedOs = ['fedora', 'coreos', 'others'];
} else if (['swarm', 'swarm-mode'].includes(coe)) { } else if (['swarm', 'swarm-mode'].includes(coe)) {
acceptedOs = ['fedora']; acceptedOs = ['fedora'];
} else if (['mesos', 'dcos'].includes(coe)) { } else if (['mesos', 'dcos'].includes(coe)) {
@ -83,7 +92,6 @@ export class StepNodeSpec extends Base {
return (globalImageStore.list.data || []) return (globalImageStore.list.data || [])
.filter( .filter(
(it) => (it) =>
it.owner === this.currentProjectId &&
this.acceptedImageOs.includes(it.os_distro) this.acceptedImageOs.includes(it.os_distro)
) )
.filter((it) => getImageOS(it) === imageTab); .filter((it) => getImageOS(it) === imageTab);
@ -176,7 +184,7 @@ export class StepNodeSpec extends Base {
name: 'keypairs', name: 'keypairs',
label: t('Keypair'), label: t('Keypair'),
type: 'select-table', type: 'select-table',
data: this.keypairsList, data: this.keypairs,
isLoading: globalKeypairStore.list.isLoading, isLoading: globalKeypairStore.list.isLoading,
tip: t( 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.' '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));

View File

@ -15,7 +15,6 @@
import Base from 'components/Form'; import Base from 'components/Form';
import { inject, observer } from 'mobx-react'; import { inject, observer } from 'mobx-react';
import KeyValueInput from 'components/FormItem/KeyValueInput'; import KeyValueInput from 'components/FormItem/KeyValueInput';
import { admission_control_list } from 'resources/magnum/template';
export class StepLabel extends Base { export class StepLabel extends Base {
get title() { get title() {
@ -26,20 +25,6 @@ export class StepLabel extends Base {
return t('Labels'); return t('Labels');
} }
get defaultValue() {
const values = {
additionalLabels: [
{
value: {
key: 'admission_control_list',
value: admission_control_list,
},
},
],
};
return values;
}
get formItems() { get formItems() {
return [ return [
{ {
@ -53,4 +38,4 @@ export class StepLabel extends Base {
} }
} }
export default inject('rootStore')(observer(StepLabel)); export default inject('rootStore')(observer(StepLabel));

View File

@ -100,8 +100,8 @@ export class StepCreate extends StepAction {
name: values.name, name: values.name,
labels: { labels: {
...requestLabels, ...requestLabels,
auto_healing_enabled: `${auto_healing_enabled}`, auto_healing_enabled: `${auto_healing_enabled ? true : false}`,
auto_scaling_enabled: `${auto_scaling_enabled}`, auto_scaling_enabled: `${auto_scaling_enabled ? true : false}`,
}, },
master_flavor_id: masterFlavor.selectedRowKeys[0], master_flavor_id: masterFlavor.selectedRowKeys[0],
flavor_id: flavor.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));

View File

@ -12,9 +12,6 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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) => [ export const getBaseTemplateColumns = (self) => [
{ {
title: t('ID/Name'), title: t('ID/Name'),