Lint fixes

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
Francesco Torchia committed 2024-11-12 11:50:20 +01:00
1 parent 19b11aac2c
commit 4626d56acd
214 files changed
+3162 -1298

No files matched your search

@@ -56,7 +56,7 @@ export default class HarvesterNetworkAttachmentDef extends NetworkAttachmentDef
get clusterNetworkResource() {
const clusterNetworks = this.$rootGetters[`${ this.inStore }/all`](HCI.CLUSTER_NETWORK);
return clusterNetworks.find(c => c.id === this.clusterNetwork);
return clusterNetworks.find((c) => c.id === this.clusterNetwork);
}
get clusterNetworkErrorMessage() {
@@ -63,7 +63,7 @@ export default class HarvesterLogFlow extends Flow {
return FLOW_TYPE.AUDIT;
}
if ((this.spec.match || []).find(M => !!M?.select?.labels?.['app.kubernetes.io/name'])) {
if ((this.spec.match || []).find((M) => !!M?.select?.labels?.['app.kubernetes.io/name'])) {
return FLOW_TYPE.EVENT;
}
+3 -3
View File
@@ -25,7 +25,7 @@ const OBSCURE_NAMESPACE_PREFIX = [
export default class HciNamespace extends namespace {
get _availableActions() {
const out = super._availableActions;
const remove = out.findIndex(a => a.action === 'promptRemove');
const remove = out.findIndex((a) => a.action === 'promptRemove');
const promptRemove = {
action: 'promptRemove',
@@ -76,7 +76,7 @@ export default class HciNamespace extends namespace {
const inStore = this.$rootGetters['currentProduct'].inStore;
const allResQuotas = this.$rootGetters[`${ inStore }/all`](HCI.RESOURCE_QUOTA);
return allResQuotas.find( RQ => RQ.metadata.namespace === this.id);
return allResQuotas.find( (RQ) => RQ.metadata.namespace === this.id);
}
get snapshotSizeQuota() {
@@ -111,7 +111,7 @@ export default class HciNamespace extends namespace {
}
const isSettingSystemNamespace = this.$rootGetters['systemNamespaces'].includes(this.metadata.name);
const isObscurePrefix = !!OBSCURE_NAMESPACE_PREFIX.some(prefix => this.metadata.name.startsWith(prefix));
const isObscurePrefix = !!OBSCURE_NAMESPACE_PREFIX.some((prefix) => this.metadata.name.startsWith(prefix));
return isSettingSystemNamespace || isObscurePrefix;
}
+7 -7
View File
@@ -292,7 +292,7 @@ export default class HciNode extends HarvesterResource {
get internalIp() {
const addresses = this.status?.addresses || [];
return findLast(addresses, address => address.type === 'InternalIP')
return findLast(addresses, (address) => address.type === 'InternalIP')
?.address;
}
@@ -444,7 +444,7 @@ export default class HciNode extends HarvesterResource {
const pods = this.$rootGetters[`${ inStore }/all`](POD) || [];
return pods.filter(
p => p?.spec?.nodeName === this.id && p?.metadata?.name !== 'removing'
(p) => p?.spec?.nodeName === this.id && p?.metadata?.name !== 'removing'
);
}
@@ -475,7 +475,7 @@ export default class HciNode extends HarvesterResource {
const nodeId = this.id;
const vlanStatuses = this.$rootGetters[`${ inStore }/all`](HCI.VLAN_STATUS);
return vlanStatuses.filter(s => s?.status?.node === nodeId) || [];
return vlanStatuses.filter((s) => s?.status?.node === nodeId) || [];
}
get blockDevices() {
@@ -483,17 +483,17 @@ export default class HciNode extends HarvesterResource {
const nodeId = this.id;
const blockDevices = this.$rootGetters[`${ inStore }/all`](HCI.BLOCK_DEVICE);
return blockDevices.filter(s => s?.spec?.nodeName === nodeId) || [];
return blockDevices.filter((s) => s?.spec?.nodeName === nodeId) || [];
}
get unProvisionedDisks() {
const blockDevices = this.blockDevices || [];
return blockDevices.filter(d => d?.isProvisioned && d?.status?.provisionPhase !== 'Provisioned');
return blockDevices.filter((d) => d?.isProvisioned && d?.status?.provisionPhase !== 'Provisioned');
}
get diskStatusCount() {
const errorBlockDevices = this.unProvisionedDisks.filter(b => b.metadata.state.error) || [];
const errorBlockDevices = this.unProvisionedDisks.filter((b) => b.metadata.state.error) || [];
let errorCount = 0;
@@ -639,7 +639,7 @@ export default class HciNode extends HarvesterResource {
const inStore = this.$rootGetters['currentProduct'].inStore;
const inventories = this.$rootGetters[`${ inStore }/all`](HCI.INVENTORY) || [];
return inventories.find(inv => inv.id === `harvester-system/${ this.id }`);
return inventories.find((inv) => inv.id === `harvester-system/${ this.id }`);
}
get warningMessages() {
@@ -1,6 +1,6 @@
import { _CLONE } from '@shell/config/query-params';
import pick from 'lodash/pick';
import { PV, LONGHORN, STORAGE_CLASS } from '@shell/config/types';
import { PV, LONGHORN, STORAGE_CLASS, LONGHORN_DRIVER } from '@shell/config/types';
import { DESCRIPTION } from '@shell/config/labels-annotations';
import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations';
import { findBy } from '@shell/utils/array';
@@ -10,7 +10,6 @@ import { HCI, VOLUME_SNAPSHOT } from '../../types';
import HarvesterResource from '../harvester';
import { PRODUCT_NAME as HARVESTER_PRODUCT } from '../../config/harvester';
import { LONGHORN_DRIVER } from '@shell/config/types';
import { DATA_ENGINE_V2 } from '../../edit/harvesterhci.io.storage/index.vue';
const DEGRADED_ERRORS = ['replica scheduling failed', 'precheck new replica failed'];
@@ -23,10 +22,12 @@ export default class HciPv extends HarvesterResource {
const storageClassName =
realMode === _CLONE ? this.spec.storageClassName : '';
this['spec'] = {accessModes,
this['spec'] = {
accessModes,
storageClassName,
volumeName: '',
resources: { requests: { storage } }};
resources: { requests: { storage } }
};
}
get availableActions() {
@@ -34,9 +35,9 @@ export default class HciPv extends HarvesterResource {
// Longhorn V2 provisioner do not support volume clone feature yet
if (this.storageClass.longhornVersion === DATA_ENGINE_V2) {
out = out.filter(action => action.action !== 'goToClone');
out = out.filter((action) => action.action !== 'goToClone');
} else {
const clone = out.find(action => action.action === 'goToClone');
const clone = out.find((action) => action.action === 'goToClone');
if (clone) {
clone.action = 'goToCloneVolume';
@@ -109,7 +110,7 @@ export default class HciPv extends HarvesterResource {
get storageClass() {
const inStore = this.$rootGetters['currentProduct'].inStore;
return this.$rootGetters[`${ inStore }/all`](STORAGE_CLASS).find(sc => sc.name === this.spec.storageClassName);
return this.$rootGetters[`${ inStore }/all`](STORAGE_CLASS).find((sc) => sc.name === this.spec.storageClassName);
}
get canUpdate() {
@@ -203,7 +204,7 @@ export default class HciPv extends HarvesterResource {
const attachVolumes = vm.spec.template?.spec?.volumes || [];
if (vm.namespace === this.namespace && attachVolumes.length > 0) {
return attachVolumes.find(vol => vol.persistentVolumeClaim?.claimName === this.name);
return attachVolumes.find((vol) => vol.persistentVolumeClaim?.claimName === this.name);
}
return null;
@@ -241,13 +242,13 @@ export default class HciPv extends HarvesterResource {
get longhornVolume() {
const inStore = this.$rootGetters['currentProduct'].inStore;
return this.$rootGetters[`${ inStore }/all`](LONGHORN.VOLUMES).find(v => v.metadata?.name === this.spec?.volumeName);
return this.$rootGetters[`${ inStore }/all`](LONGHORN.VOLUMES).find((v) => v.metadata?.name === this.spec?.volumeName);
}
get longhornEngine() {
const inStore = this.$rootGetters['currentProduct'].inStore;
return this.$rootGetters[`${ inStore }/all`](LONGHORN.ENGINES).find(v => v.spec?.volumeName === this.spec?.volumeName);
return this.$rootGetters[`${ inStore }/all`](LONGHORN.ENGINES).find((v) => v.spec?.volumeName === this.spec?.volumeName);
}
// https://github.com/longhorn/longhorn-manager/blob/master/api/model.go#L1151
@@ -255,7 +256,7 @@ export default class HciPv extends HarvesterResource {
let ready = true;
const longhornVolume = this.longhornVolume || {};
const scheduledCondition = (longhornVolume?.status?.conditions || []).find(c => c.type === 'Scheduled' || c.type === 'scheduled') || {};
const scheduledCondition = (longhornVolume?.status?.conditions || []).find((c) => c.type === 'Scheduled' || c.type === 'scheduled') || {};
if ((longhornVolume?.spec?.nodeID === '' && longhornVolume?.status?.state !== 'detached') ||
(longhornVolume?.status?.state === 'detached' && scheduledCondition.status !== 'True') ||
@@ -282,7 +283,7 @@ export default class HciPv extends HarvesterResource {
get originalSnapshot() {
if (this.spec?.dataSource) {
return this.$rootGetters['harvester/all'](VOLUME_SNAPSHOT).find(V => V.metadata?.name === this.spec.dataSource.name);
return this.$rootGetters['harvester/all'](VOLUME_SNAPSHOT).find((V) => V.metadata?.name === this.spec.dataSource.name);
} else {
return null;
}
@@ -299,7 +300,7 @@ export default class HciPv extends HarvesterResource {
}
get relatedPV() {
return this.$rootGetters['harvester/all'](PV).find(pv => pv.metadata?.name === this.spec?.volumeName);
return this.$rootGetters['harvester/all'](PV).find((pv) => pv.metadata?.name === this.spec?.volumeName);
}
get resourceExternalLink() {
+2 -2
View File
@@ -113,7 +113,7 @@ export default class HciPod extends HarvesterResource {
return (containerStatus) => {
if (containerStatus) {
const stateName = Object.getOwnPropertyNames(containerStatus.state).find(
pn => !!containerStatus.state[pn].reason,
(pn) => !!containerStatus.state[pn].reason,
);
if (stateName) {
@@ -180,6 +180,6 @@ export default class HciPod extends HarvesterResource {
get getPodFalseStatusConditions() {
const conditions = get(this, 'status.conditions') || [];
return conditions.filter(condition => condition.status !== 'True');
return conditions.filter((condition) => condition.status !== 'True');
}
}
+1 -1
View File
@@ -56,7 +56,7 @@ export default class HciSecret extends Secret {
get isSystem() {
const inStore = this.$rootGetters['currentProduct'].inStore;
const systemNs = this.$rootGetters[`${ inStore }/all`](NAMESPACE).filter(ns => ns.isSystem === true).map(ns => ns.metadata.name);
const systemNs = this.$rootGetters[`${ inStore }/all`](NAMESPACE).filter((ns) => ns.isSystem === true).map((ns) => ns.metadata.name);
return systemNs.includes(this.metadata.namespace);
}