Lint fixes

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
Francesco Torchia
2024-11-12 11:50:20 +01:00
parent 19b11aac2c
commit 4626d56acd
214 changed files with 3162 additions and 1298 deletions
@@ -13,7 +13,9 @@ import Loading from '@shell/components/Loading';
import { _CREATE, _VIEW } from '@shell/config/query-params';
import { mapFeature, UNSUPPORTED_STORAGE_DRIVERS } from '@shell/store/features';
import { STORAGE_CLASS, LONGHORN, LONGHORN_DRIVER, SECRET, NAMESPACE } from '@shell/config/types';
import {
STORAGE_CLASS, LONGHORN, LONGHORN_DRIVER, SECRET, NAMESPACE
} from '@shell/config/types';
import { allHash } from '@shell/utils/promise';
import { clone } from '@shell/utils/object';
import { CSI_DRIVER } from '../../types';
@@ -84,7 +86,7 @@ export default {
}
];
const allowedTopologies = clone(this.value.allowedTopologies?.[0]?.matchLabelExpressions || []).filter(t => t.key !== LVM_TOPOLOGY_LABEL);
const allowedTopologies = clone(this.value.allowedTopologies?.[0]?.matchLabelExpressions || []).filter((t) => t.key !== LVM_TOPOLOGY_LABEL);
this.value['parameters'] = this.value.parameters || {};
this.value['provisioner'] = this.value.provisioner || LONGHORN_DRIVER;
@@ -200,7 +202,7 @@ export default {
let parameters = {};
if (provisioner === LVM_DRIVER) {
const matchLabelExpressions = (this.value.allowedTopologies?.[0]?.matchLabelExpressions || []).filter(t => t.key !== LVM_TOPOLOGY_LABEL);
const matchLabelExpressions = (this.value.allowedTopologies?.[0]?.matchLabelExpressions || []).filter((t) => t.key !== LVM_TOPOLOGY_LABEL);
if (matchLabelExpressions.length > 0) {
this.value['allowedTopologies'] = [{ matchLabelExpressions }];
@@ -246,8 +248,8 @@ export default {
},
formatAllowedTopoloties() {
const neu = this.allowedTopologies.filter(t => t.key !== LVM_TOPOLOGY_LABEL);
const lvmMatchExpression = (this.value.allowedTopologies?.[0]?.matchLabelExpressions || []).filter(t => t.key === LVM_TOPOLOGY_LABEL);
const neu = this.allowedTopologies.filter((t) => t.key !== LVM_TOPOLOGY_LABEL);
const lvmMatchExpression = (this.value.allowedTopologies?.[0]?.matchLabelExpressions || []).filter((t) => t.key === LVM_TOPOLOGY_LABEL);
if (!neu || neu.length === 0) {
if (lvmMatchExpression.length > 0) {
@@ -259,7 +261,7 @@ export default {
return;
}
const matchLabelExpressions = neu.filter(R => !!R.key.trim() && (R.values.length > 0 && !R.values.find(V => !V.trim())));
const matchLabelExpressions = neu.filter((R) => !!R.key.trim() && (R.values.length > 0 && !R.values.find((V) => !V.trim())));
if (matchLabelExpressions.length > 0) {
this.value.allowedTopologies = [{ matchLabelExpressions: [...matchLabelExpressions, ...lvmMatchExpression] }];
@@ -287,9 +289,9 @@ export default {
<NameNsDescription
:namespaced="false"
:value="value"
@update:value="$emit('update:value', $event)"
:mode="mode"
:register-before-hook="registerBeforeHook"
@update:value="$emit('update:value', $event)"
/>
<LabeledSelect
v-model:value="provisioner"
@@ -302,7 +304,11 @@ export default {
class="mb-20"
/>
<Tabbed :side-tabs="true">
<Tab name="parameters" :label="t('storageClass.parameters.label')" :weight="2">
<Tab
name="parameters"
:label="t('storageClass.parameters.label')"
:weight="2"
>
<component
:is="getComponent(provisioner)"
:key="provisioner"
@@ -311,7 +317,10 @@ export default {
:real-mode="realMode"
/>
</Tab>
<Tab name="customize" :label="t('storageClass.customize.label')">
<Tab
name="customize"
:label="t('storageClass.customize.label')"
>
<div class="row mt-20">
<div class="col span-6">
<RadioGroup
@@ -78,7 +78,7 @@ export default {
const allSecrets = this.$store.getters[`${ inStore }/all`](SECRET);
// only show non-system secret to user to select
return allSecrets.filter(secret => secret.isSystem === false);
return allSecrets.filter((secret) => secret.isSystem === false);
},
longhornNodes() {
@@ -124,7 +124,7 @@ export default {
},
secretOptions() {
return this.secrets.map(secret => secret.id);
return this.secrets.map((secret) => secret.id);
},
volumeEncryptionOptions() {
@@ -282,7 +282,10 @@ export default {
:mode="mode"
>
<template #no-options="{ searching }">
<span v-if="!searching" class="text-muted">
<span
v-if="!searching"
class="text-muted"
>
{{ t('harvester.storage.parameters.nodeSelector.no-options', null, true) }}
</span>
</template>
@@ -298,7 +301,10 @@ export default {
:mode="mode"
>
<template #no-options="{ searching }">
<span v-if="!searching" class="text-muted">
<span
v-if="!searching"
class="text-muted"
>
{{ t('harvester.storage.parameters.diskSelector.no-options', null, true) }}
</span>
</template>
@@ -323,7 +329,10 @@ export default {
:options="volumeEncryptionOptions"
/>
</div>
<div v-if="value.parameters.encrypted === 'true'" class="row mt-20">
<div
v-if="value.parameters.encrypted === 'true'"
class="row mt-20"
>
<div class="col span-6">
<LabeledSelect
v-model:value="secret"
@@ -78,7 +78,7 @@ export default {
const allSecrets = this.$store.getters[`${ inStore }/all`](SECRET);
// only show non-system secret to user to select
return allSecrets.filter(secret => secret.isSystem === false);
return allSecrets.filter((secret) => secret.isSystem === false);
},
longhornNodes() {
@@ -124,7 +124,7 @@ export default {
},
secretOptions() {
return this.secrets.map(secret => secret.id);
return this.secrets.map((secret) => secret.id);
},
volumeEncryptionOptions() {
@@ -282,7 +282,10 @@ export default {
:mode="mode"
>
<template #no-options="{ searching }">
<span v-if="!searching" class="text-muted">
<span
v-if="!searching"
class="text-muted"
>
{{ t('harvester.storage.parameters.nodeSelector.no-options', null, true) }}
</span>
</template>
@@ -298,7 +301,10 @@ export default {
:mode="mode"
>
<template #no-options="{ searching }">
<span v-if="!searching" class="text-muted">
<span
v-if="!searching"
class="text-muted"
>
{{ t('harvester.storage.parameters.diskSelector.no-options', null, true) }}
</span>
</template>
@@ -325,7 +331,10 @@ export default {
:disabled="true"
/>
</div>
<div v-if="value.parameters.encrypted === 'true'" class="row mt-20">
<div
v-if="value.parameters.encrypted === 'true'"
class="row mt-20"
>
<div class="col span-6">
<LabeledSelect
v-model:value="secret"
@@ -52,7 +52,7 @@ export default {
},
data() {
const node = (this.value.allowedTopologies?.[0]?.matchLabelExpressions || []).find(t => t.key === LVM_TOPOLOGY_LABEL)?.values[0];
const node = (this.value.allowedTopologies?.[0]?.matchLabelExpressions || []).find((t) => t.key === LVM_TOPOLOGY_LABEL)?.values[0];
return {
volumeGroupTypes: ['striped', 'dm-thin'],
@@ -77,7 +77,7 @@ export default {
const inStore = this.$store.getters['currentProduct'].inStore;
const nodes = this.$store.getters[`${ inStore }/all`](NODE) || [];
return nodes.filter(n => n.labels[LVM_TOPOLOGY_LABEL] === n.name).map(n => n.name);
return nodes.filter((n) => n.labels[LVM_TOPOLOGY_LABEL] === n.name).map((n) => n.name);
},
volumeGroups() {
@@ -85,8 +85,8 @@ export default {
const lvmVolumeGroups = this.$store.getters[`${ inStore }/all`](HCI.LVM_VOLUME_GROUP) || [];
return lvmVolumeGroups
.filter(group => group.spec.nodeName === this.node)
.map(g => g.spec.vgName);
.filter((group) => group.spec.nodeName === this.node)
.map((g) => g.spec.vgName);
},
parameters: {
@@ -119,7 +119,10 @@ export default {
:required="true"
>
<template #no-options="{ searching }">
<span v-if="!searching" class="text-muted">
<span
v-if="!searching"
class="text-muted"
>
{{ t('harvester.storage.parameters.diskSelector.no-options', null, true) }}
</span>
</template>
@@ -136,7 +139,10 @@ export default {
:required="true"
>
<template #no-options="{ searching }">
<span v-if="!searching" class="text-muted">
<span
v-if="!searching"
class="text-muted"
>
{{ t('harvester.storage.parameters.lvmVolumeGroup.no-options', null, true) }}
</span>
</template>