mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-01 03:36:04 +08:00
Lint fixes
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
@@ -71,7 +71,7 @@ export default class PCIDevice extends SteveModel {
|
||||
get passthroughClaim() {
|
||||
const passthroughClaims = this.$getters['all'](HCI.PCI_CLAIM) || [];
|
||||
|
||||
return !!this.status && passthroughClaims.find(req => req?.spec?.nodeName === this.status?.nodeName && req?.spec?.address === this.status?.address);
|
||||
return !!this.status && passthroughClaims.find((req) => req?.spec?.nodeName === this.status?.nodeName && req?.spec?.address === this.status?.address);
|
||||
}
|
||||
|
||||
// this is an id for each 'type' of device - there may be multiple instances of device CRs
|
||||
|
||||
@@ -84,8 +84,8 @@ export default class SRIOVDevice extends SteveModel {
|
||||
if (!!schema) {
|
||||
const vGpuDevices = this.$rootGetters[`${ inStore }/all`](HCI.VGPU_DEVICE) || [];
|
||||
const vGpuDevicesEnabled = vGpuDevices
|
||||
.filter(f => f.labels[HCI_ANNOTATIONS.PARENT_SRIOV_GPU] === this.id && f.spec?.enabled)
|
||||
.map(m => m.id);
|
||||
.filter((f) => f.labels[HCI_ANNOTATIONS.PARENT_SRIOV_GPU] === this.id && f.spec?.enabled)
|
||||
.map((m) => m.id);
|
||||
|
||||
if (vGpuDevicesEnabled.length > 0) {
|
||||
this.$dispatch('growl/error', {
|
||||
@@ -115,7 +115,7 @@ export default class SRIOVDevice extends SteveModel {
|
||||
const inStore = this.$rootGetters['currentProduct'].inStore;
|
||||
const nodeName = this.spec?.nodeName;
|
||||
const nodes = this.$rootGetters[`${ inStore }/all`](NODE);
|
||||
const node = nodes.find(N => N.id === nodeName);
|
||||
const node = nodes.find((N) => N.id === nodeName);
|
||||
|
||||
return node?.nameDisplay || '';
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ export default class SRIOVGpuDevice extends SteveModel {
|
||||
const inStore = this.$rootGetters['currentProduct'].inStore;
|
||||
const nodeName = this.spec?.nodeName;
|
||||
const nodes = this.$rootGetters[`${ inStore }/all`](NODE);
|
||||
const node = nodes.find(N => N.id === nodeName);
|
||||
const node = nodes.find((N) => N.id === nodeName);
|
||||
|
||||
return node?.nameDisplay || '';
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ export default class USBDevice extends SteveModel {
|
||||
get passthroughClaim() {
|
||||
const passthroughClaims = this.$getters['all'](HCI.USB_CLAIM) || [];
|
||||
|
||||
return !!this.status && passthroughClaims.find(req => req?.status?.nodeName === this.status?.nodeName && req?.metadata?.name === this.metadata?.name);
|
||||
return !!this.status && passthroughClaims.find((req) => req?.status?.nodeName === this.status?.nodeName && req?.metadata?.name === this.metadata?.name);
|
||||
}
|
||||
|
||||
// this is an id for each 'type' of device - there may be multiple instances of device CRs
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ export default class HciAddonConfig extends HarvesterResource {
|
||||
}
|
||||
|
||||
get stateDescription() {
|
||||
const failedCondition = (this.status?.conditions || []).find(C => C.type === 'OperationFailed');
|
||||
const failedCondition = (this.status?.conditions || []).find((C) => C.type === 'OperationFailed');
|
||||
|
||||
return failedCondition?.message || super.stateDescription;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ export default class HciBlockDevice extends HarvesterResource {
|
||||
}
|
||||
|
||||
get isChildPartProvisioned() {
|
||||
const parts = this.childParts.filter(p => p.isProvisioned) || [];
|
||||
const parts = this.childParts.filter((p) => p.isProvisioned) || [];
|
||||
|
||||
return parts.length > 0;
|
||||
}
|
||||
@@ -55,7 +55,7 @@ export default class HciBlockDevice extends HarvesterResource {
|
||||
|
||||
get isFormatting() {
|
||||
const conditions = this?.status?.conditions || [];
|
||||
const formatting = conditions.find(c => c.type === 'Formatting') || {};
|
||||
const formatting = conditions.find((c) => c.type === 'Formatting') || {};
|
||||
|
||||
return formatting.status === 'True';
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import { HARVESTER_NAME, HARVESTER_NAME as VIRTUAL } from '@shell/config/feature
|
||||
import { SETTING } from '@shell/config/settings';
|
||||
|
||||
export default class HciCluster extends ProvCluster {
|
||||
|
||||
get stateObj() {
|
||||
return this._stateObj;
|
||||
}
|
||||
@@ -167,12 +166,12 @@ export default class HciCluster extends ProvCluster {
|
||||
|
||||
async goToCluster() {
|
||||
this.currentRouter().push({
|
||||
name: `${ VIRTUAL }-c-cluster-resource`,
|
||||
params: {
|
||||
cluster: this.status.clusterName,
|
||||
product: VIRTUAL,
|
||||
resource: HCI.DASHBOARD // Go directly to dashboard to avoid blip of components on screen
|
||||
}
|
||||
});
|
||||
name: `${ VIRTUAL }-c-cluster-resource`,
|
||||
params: {
|
||||
cluster: this.status.clusterName,
|
||||
product: VIRTUAL,
|
||||
resource: HCI.DASHBOARD // Go directly to dashboard to avoid blip of components on screen
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ export default class ScheduleVmBackup extends HarvesterResource {
|
||||
}
|
||||
|
||||
get stateDescription() {
|
||||
const suspendedCondition = (this.status?.conditions || []).find(c => c.type === 'BackupSuspend');
|
||||
const suspendedCondition = (this.status?.conditions || []).find((c) => c.type === 'BackupSuspend');
|
||||
|
||||
return ucFirst(suspendedCondition?.message) || super.stateDescription;
|
||||
}
|
||||
|
||||
@@ -21,17 +21,17 @@ export default class HciSetting extends HarvesterResource {
|
||||
});
|
||||
|
||||
// Change the label on the first action (edit)
|
||||
const editAction = out.find(action => action.action === 'goToEdit');
|
||||
const editAction = out.find((action) => action.action === 'goToEdit');
|
||||
|
||||
if (editAction) {
|
||||
editAction.label = this.t('advancedSettings.edit.label');
|
||||
}
|
||||
|
||||
const schema = this.$getters['schemaFor'](HCI.UPGRADE);
|
||||
const hasUpgradeAccess = !!schema?.collectionMethods.find(x => ['post'].includes(x.toLowerCase()));
|
||||
const hasUpgradeAccess = !!schema?.collectionMethods.find((x) => ['post'].includes(x.toLowerCase()));
|
||||
|
||||
if (this.id === HCI_SETTING.SERVER_VERSION && hasUpgradeAccess) {
|
||||
const latestUpgrade = this.$getters['all'](HCI.UPGRADE).find(upgrade => upgrade.isLatestUpgrade);
|
||||
const latestUpgrade = this.$getters['all'](HCI.UPGRADE).find((upgrade) => upgrade.isLatestUpgrade);
|
||||
|
||||
out.unshift({
|
||||
action: 'goToAirgapUpgrade',
|
||||
|
||||
@@ -37,7 +37,7 @@ export default class HciUpgrade extends HarvesterResource {
|
||||
|
||||
get stateDisplay() {
|
||||
const conditions = this?.status?.conditions || [];
|
||||
const completedCondition = conditions.find( cond => cond.type === 'Completed');
|
||||
const completedCondition = conditions.find( (cond) => cond.type === 'Completed');
|
||||
const status = completedCondition?.status;
|
||||
|
||||
if (status === 'True') {
|
||||
@@ -100,7 +100,7 @@ export default class HciUpgrade extends HarvesterResource {
|
||||
|
||||
get createRepo() {
|
||||
const conditions = this?.status?.conditions || [];
|
||||
const repoCondition = conditions.find( cond => cond.type === 'RepoReady');
|
||||
const repoCondition = conditions.find( (cond) => cond.type === 'RepoReady');
|
||||
const isReady = repoCondition?.status === 'True';
|
||||
|
||||
return {
|
||||
@@ -111,7 +111,7 @@ export default class HciUpgrade extends HarvesterResource {
|
||||
|
||||
get overallMessage() {
|
||||
const conditions = this?.status?.conditions || [];
|
||||
const completedCondition = conditions.find( cond => cond.type === 'Completed');
|
||||
const completedCondition = conditions.find( (cond) => cond.type === 'Completed');
|
||||
const hasError = completedCondition?.status === 'False';
|
||||
const message = completedCondition?.message || completedCondition?.reason;
|
||||
|
||||
@@ -120,7 +120,7 @@ export default class HciUpgrade extends HarvesterResource {
|
||||
|
||||
get upgradeImageMessage() {
|
||||
const conditions = this?.status?.conditions || [];
|
||||
const imageReady = conditions.find( cond => cond.type === 'ImageReady');
|
||||
const imageReady = conditions.find( (cond) => cond.type === 'ImageReady');
|
||||
const success = imageReady?.status === 'True';
|
||||
const message = imageReady?.message || imageReady?.reason;
|
||||
|
||||
@@ -152,7 +152,7 @@ export default class HciUpgrade extends HarvesterResource {
|
||||
}
|
||||
|
||||
for (const node of this.nodes) {
|
||||
const hasNode = message.find( O => O.name === node.id);
|
||||
const hasNode = message.find( (O) => O.name === node.id);
|
||||
|
||||
if (!hasNode) {
|
||||
message.push({
|
||||
@@ -175,7 +175,7 @@ export default class HciUpgrade extends HarvesterResource {
|
||||
|
||||
out = Math.floor(out / this.nodeUpgradeMessage.length);
|
||||
const conditions = this?.status?.conditions || [];
|
||||
const nodeUpgradedCondition = conditions.find( cond => cond.type === 'NodesUpgraded');
|
||||
const nodeUpgradedCondition = conditions.find( (cond) => cond.type === 'NodesUpgraded');
|
||||
|
||||
if (out === 100 && !nodeUpgradedCondition) {
|
||||
out = 99;
|
||||
|
||||
@@ -59,7 +59,7 @@ export default class HciVmBackup extends HarvesterResource {
|
||||
const schema = this.$getters['schemaFor'](HCI.VM);
|
||||
let canCreateVM = true;
|
||||
|
||||
if ( schema && !schema?.collectionMethods.find(x => ['post'].includes(x.toLowerCase())) ) {
|
||||
if ( schema && !schema?.collectionMethods.find((x) => ['post'].includes(x.toLowerCase())) ) {
|
||||
canCreateVM = false;
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ export default class HciVmBackup extends HarvesterResource {
|
||||
get attachVmExisting() {
|
||||
const vmList = this.$rootGetters['harvester/all'](HCI.VM);
|
||||
|
||||
return !!vmList.find( V => V.metadata.name === this.attachVM);
|
||||
return !!vmList.find( (V) => V.metadata.name === this.attachVM);
|
||||
}
|
||||
|
||||
remove() {
|
||||
|
||||
@@ -22,7 +22,7 @@ function isReady() {
|
||||
function getStatusConditionOfType(type, defaultValue = []) {
|
||||
const conditions = Array.isArray(get(this, 'status.conditions')) ? this.status.conditions : defaultValue;
|
||||
|
||||
return conditions.find( cond => cond.type === type);
|
||||
return conditions.find( (cond) => cond.type === type);
|
||||
}
|
||||
|
||||
const initialized = getStatusConditionOfType.call(this, 'Initialized');
|
||||
@@ -40,12 +40,12 @@ export default class HciVmImage extends HarvesterResource {
|
||||
let out = super._availableActions;
|
||||
const toFilter = ['goToEditYaml'];
|
||||
|
||||
out = out.filter( A => !toFilter.includes(A.action));
|
||||
out = out.filter( (A) => !toFilter.includes(A.action));
|
||||
|
||||
const schema = this.$getters['schemaFor'](HCI.VM);
|
||||
let canCreateVM = true;
|
||||
|
||||
if ( schema && !schema?.collectionMethods.find(x => ['post'].includes(x.toLowerCase())) ) {
|
||||
if ( schema && !schema?.collectionMethods.find((x) => ['post'].includes(x.toLowerCase())) ) {
|
||||
canCreateVM = false;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ export default class HciVmImage extends HarvesterResource {
|
||||
name: `${ HARVESTER_PRODUCT }-c-cluster-resource-create`,
|
||||
params: { resource: HCI.IMAGE },
|
||||
query: {
|
||||
image: JSON.stringify({metadata: { name: this.metadata.name, namespace: this.metadata.namespace }}),
|
||||
image: JSON.stringify({ metadata: { name: this.metadata.name, namespace: this.metadata.namespace } }),
|
||||
fromPage: HCI.IMAGE,
|
||||
sourceType: 'clone',
|
||||
cryptoOperation: 'encrypt'
|
||||
@@ -103,7 +103,7 @@ export default class HciVmImage extends HarvesterResource {
|
||||
name: `${ HARVESTER_PRODUCT }-c-cluster-resource-create`,
|
||||
params: { resource: HCI.IMAGE },
|
||||
query: {
|
||||
image: JSON.stringify({metadata: { name: this.metadata.name, namespace: this.metadata.namespace }}),
|
||||
image: JSON.stringify({ metadata: { name: this.metadata.name, namespace: this.metadata.namespace } }),
|
||||
fromPage: HCI.IMAGE,
|
||||
sourceType: 'clone',
|
||||
cryptoOperation: 'decrypt'
|
||||
@@ -205,9 +205,9 @@ export default class HciVmImage extends HarvesterResource {
|
||||
}
|
||||
|
||||
const conditions = this?.status?.conditions || [];
|
||||
const initialized = conditions.find( cond => cond.type === 'Initialized');
|
||||
const imported = conditions.find( cond => cond.type === 'Imported');
|
||||
const retryLimitExceeded = conditions.find( cond => cond.type === 'RetryLimitExceeded');
|
||||
const initialized = conditions.find( (cond) => cond.type === 'Initialized');
|
||||
const imported = conditions.find( (cond) => cond.type === 'Imported');
|
||||
const retryLimitExceeded = conditions.find( (cond) => cond.type === 'RetryLimitExceeded');
|
||||
const message = initialized?.message || imported?.message || retryLimitExceeded?.message;
|
||||
|
||||
return ucFirst(message);
|
||||
@@ -262,7 +262,7 @@ export default class HciVmImage extends HarvesterResource {
|
||||
getStatusConditionOfType(type, defaultValue = []) {
|
||||
const conditions = Array.isArray(get(this, 'status.conditions')) ? this.status.conditions : defaultValue;
|
||||
|
||||
return conditions.find( cond => cond.type === type);
|
||||
return conditions.find( (cond) => cond.type === type);
|
||||
}
|
||||
|
||||
get stateObj() {
|
||||
|
||||
@@ -7,7 +7,7 @@ export default class HciVmRestore extends HarvesterResource {
|
||||
|
||||
get pvcNames() {
|
||||
const restores = this?.status?.restores || [];
|
||||
const out = restores.map( O => O?.persistentVolumeClaimSpec?.name);
|
||||
const out = restores.map( (O) => O?.persistentVolumeClaimSpec?.name);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ export default class HciVmTemplate extends HarvesterResource {
|
||||
const schema = this.$getters['schemaFor'](HCI.VM);
|
||||
let canCreateVM = true;
|
||||
|
||||
if ( schema && !schema?.collectionMethods.find(x => ['post'].includes(x.toLowerCase())) ) {
|
||||
if ( schema && !schema?.collectionMethods.find((x) => ['post'].includes(x.toLowerCase())) ) {
|
||||
canCreateVM = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ export default class HciVmTemplateVersion extends HarvesterResource {
|
||||
const schema = this.$getters['schemaFor'](HCI.VM);
|
||||
let canCreateVM = true;
|
||||
|
||||
if ( schema && !schema?.collectionMethods.find(x => ['post'].includes(x.toLowerCase())) ) {
|
||||
if ( schema && !schema?.collectionMethods.find((x) => ['post'].includes(x.toLowerCase())) ) {
|
||||
canCreateVM = false;
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ export default class HciVmTemplateVersion extends HarvesterResource {
|
||||
}
|
||||
|
||||
get currentTemplate() {
|
||||
return find(this.templates, T => T.id === this.templateId);
|
||||
return find(this.templates, (T) => T.id === this.templateId);
|
||||
}
|
||||
|
||||
async setDefaultVersion(moreQuery = {}) {
|
||||
@@ -212,7 +212,7 @@ export default class HciVmTemplateVersion extends HarvesterResource {
|
||||
|
||||
get defaultVersion() {
|
||||
const templates = this.$rootGetters['harvester/all'](HCI.VM_TEMPLATE);
|
||||
const template = templates.find(T => this.templateId === T.id);
|
||||
const template = templates.find((T) => this.templateId === T.id);
|
||||
|
||||
return template?.status?.defaultVersion;
|
||||
}
|
||||
|
||||
@@ -92,9 +92,9 @@ export default class VirtVm extends HarvesterResource {
|
||||
|
||||
// VM attached with Longhorn V2 volume doesn't support clone feature
|
||||
if (this.longhornV2Volumes.length > 0) {
|
||||
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 = 'goToCloneVM';
|
||||
@@ -465,7 +465,7 @@ export default class VirtVm extends HarvesterResource {
|
||||
get networksName() {
|
||||
const interfaces = this.spec.template.spec.domain.devices?.interfaces || [];
|
||||
|
||||
return interfaces.map(I => I.name);
|
||||
return interfaces.map((I) => I.name);
|
||||
}
|
||||
|
||||
get isOff() {
|
||||
@@ -507,7 +507,7 @@ export default class VirtVm extends HarvesterResource {
|
||||
if (
|
||||
this.status?.printableStatus === 'ErrorUnschedulable' &&
|
||||
conditions.find(
|
||||
C => C.message && C.message.includes(IgnoreMessages)
|
||||
(C) => C.message && C.message.includes(IgnoreMessages)
|
||||
)
|
||||
) {
|
||||
return true;
|
||||
@@ -518,7 +518,7 @@ export default class VirtVm extends HarvesterResource {
|
||||
default:
|
||||
changeRequests = new Set(
|
||||
(this.status?.stateChangeRequests || []).map(
|
||||
chRequest => chRequest?.action
|
||||
(chRequest) => chRequest?.action
|
||||
)
|
||||
);
|
||||
|
||||
@@ -558,7 +558,7 @@ export default class VirtVm extends HarvesterResource {
|
||||
|
||||
get isPaused() {
|
||||
const conditions = this.vmi?.status?.conditions || [];
|
||||
const isPause = conditions.filter(cond => cond.type === PAUSED).length > 0;
|
||||
const isPause = conditions.filter((cond) => cond.type === PAUSED).length > 0;
|
||||
|
||||
return isPause ? {
|
||||
status: PAUSED,
|
||||
@@ -584,7 +584,7 @@ export default class VirtVm extends HarvesterResource {
|
||||
const inStore = this.productInStore;
|
||||
const allResQuotas = this.$rootGetters[`${ inStore }/all`](HCI.RESOURCE_QUOTA);
|
||||
|
||||
return allResQuotas.find( RQ => RQ.namespace === this.metadata.namespace);
|
||||
return allResQuotas.find( (RQ) => RQ.namespace === this.metadata.namespace);
|
||||
}
|
||||
|
||||
get snapshotSizeQuota() {
|
||||
@@ -596,29 +596,29 @@ export default class VirtVm extends HarvesterResource {
|
||||
|
||||
const vmis = this.$rootGetters[`${ inStore }/all`](HCI.VMI);
|
||||
|
||||
return vmis.find(VMI => VMI.id === this.id);
|
||||
return vmis.find((VMI) => VMI.id === this.id);
|
||||
}
|
||||
|
||||
get volumes() {
|
||||
const pvcs = this.$rootGetters[`${ this.productInStore }/all`](PVC);
|
||||
|
||||
const volumeClaimNames = this.spec.template.spec.volumes?.map(v => v.persistentVolumeClaim?.claimName).filter(v => !!v) || [];
|
||||
const volumeClaimNames = this.spec.template.spec.volumes?.map((v) => v.persistentVolumeClaim?.claimName).filter((v) => !!v) || [];
|
||||
|
||||
return pvcs.filter(pvc => volumeClaimNames.includes(pvc.metadata.name));
|
||||
return pvcs.filter((pvc) => volumeClaimNames.includes(pvc.metadata.name));
|
||||
}
|
||||
|
||||
get lvmVolumes() {
|
||||
return this.volumes.filter(volume => volume.storageClass.provisioner === LVM_DRIVER);
|
||||
return this.volumes.filter((volume) => volume.storageClass.provisioner === LVM_DRIVER);
|
||||
}
|
||||
|
||||
get longhornV2Volumes() {
|
||||
return this.volumes.filter(volume => volume.storageClass.isLonghornV2);
|
||||
return this.volumes.filter((volume) => volume.storageClass.isLonghornV2);
|
||||
}
|
||||
|
||||
get encryptedVolumeType() {
|
||||
if (this.volumes.every(vol => vol.isEncrypted)) {
|
||||
if (this.volumes.every((vol) => vol.isEncrypted)) {
|
||||
return 'all';
|
||||
} else if (this.volumes.some(vol => vol.isEncrypted)) {
|
||||
} else if (this.volumes.some((vol) => vol.isEncrypted)) {
|
||||
return 'partial';
|
||||
} else {
|
||||
return 'none';
|
||||
@@ -709,7 +709,7 @@ export default class VirtVm extends HarvesterResource {
|
||||
|
||||
get isUnschedulable() {
|
||||
if (this.isBeingStopped || this.isStarting) {
|
||||
const condition = this.status?.conditions?.find(c => c.reason === UNSCHEDULABLE);
|
||||
const condition = this.status?.conditions?.find((c) => c.reason === UNSCHEDULABLE);
|
||||
|
||||
if (!!condition) {
|
||||
return {
|
||||
@@ -765,14 +765,14 @@ export default class VirtVm extends HarvesterResource {
|
||||
|
||||
const allRestore = this.$rootGetters[`${ inStore }/all`](HCI.RESTORE);
|
||||
|
||||
const res = allRestore.find(O => O.id === id);
|
||||
const res = allRestore.find((O) => O.id === id);
|
||||
|
||||
if (res) {
|
||||
const allBackups = this.$rootGetters[`${ inStore }/all`](HCI.BACKUP);
|
||||
|
||||
res.fromSnapshot = !!allBackups
|
||||
.filter(b => b.spec?.type !== BACKUP_TYPE.BACKUP)
|
||||
.find(s => s.id === `${ res.spec?.virtualMachineBackupNamespace }/${ res.spec?.virtualMachineBackupName }`);
|
||||
.filter((b) => b.spec?.type !== BACKUP_TYPE.BACKUP)
|
||||
.find((s) => s.id === `${ res.spec?.virtualMachineBackupNamespace }/${ res.spec?.virtualMachineBackupName }`);
|
||||
}
|
||||
|
||||
return res;
|
||||
@@ -981,7 +981,7 @@ export default class VirtVm extends HarvesterResource {
|
||||
.map((O) => {
|
||||
return O?.persistentVolumeClaim?.claimName;
|
||||
})
|
||||
.filter(name => !!name);
|
||||
.filter((name) => !!name);
|
||||
}
|
||||
|
||||
get rootImageId() {
|
||||
@@ -998,7 +998,7 @@ export default class VirtVm extends HarvesterResource {
|
||||
|
||||
if (!isNoExistingVolume) {
|
||||
const existingVolume = pvcs.find(
|
||||
P => P.id === `${ this.metadata.namespace }/${ firstVolumeName }`
|
||||
(P) => P.id === `${ this.metadata.namespace }/${ firstVolumeName }`
|
||||
);
|
||||
|
||||
if (existingVolume) {
|
||||
@@ -1063,7 +1063,7 @@ export default class VirtVm extends HarvesterResource {
|
||||
|
||||
get attachNetwork() {
|
||||
const networks = this.spec?.template?.spec?.networks || [];
|
||||
const hasMultus = networks.find(N => N.multus);
|
||||
const hasMultus = networks.find((N) => N.multus);
|
||||
|
||||
return !!hasMultus;
|
||||
}
|
||||
@@ -1090,11 +1090,11 @@ export default class VirtVm extends HarvesterResource {
|
||||
|
||||
return (
|
||||
ignoreConditions.find(
|
||||
condition => condition.name === state?.name &&
|
||||
(condition) => condition.name === state?.name &&
|
||||
condition.error === state?.error &&
|
||||
condition.vmState
|
||||
) ||
|
||||
IgnoreMessages.find(M => super.stateDescription?.includes(M)) ||
|
||||
IgnoreMessages.find((M) => super.stateDescription?.includes(M)) ||
|
||||
this.isOff
|
||||
);
|
||||
}
|
||||
@@ -1112,7 +1112,7 @@ export default class VirtVm extends HarvesterResource {
|
||||
|
||||
get isQemuInstalled() {
|
||||
const conditions = this.vmi?.status?.conditions || [];
|
||||
const qemu = conditions.find(cond => cond.type === AGENT_CONNECTED);
|
||||
const qemu = conditions.find((cond) => cond.type === AGENT_CONNECTED);
|
||||
|
||||
return qemu?.status === 'True';
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ export default class VirtVmInstance extends HarvesterResource {
|
||||
|
||||
get vmimResource() {
|
||||
const all = this.$rootGetters['harvester/all'](HCI.VMIM) || [];
|
||||
const vmimList = all.filter(vmim => vmim.spec?.vmiName === this.metadata?.name);
|
||||
const vmimList = all.filter((vmim) => vmim.spec?.vmiName === this.metadata?.name);
|
||||
|
||||
if (vmimList.length === 0) {
|
||||
return [];
|
||||
@@ -88,7 +88,7 @@ export default class VirtVmInstance extends HarvesterResource {
|
||||
|
||||
get isPaused() {
|
||||
const conditions = this?.status?.conditions || [];
|
||||
const isPause = conditions.filter(cond => cond.type === PAUSED).length > 0;
|
||||
const isPause = conditions.filter((cond) => cond.type === PAUSED).length > 0;
|
||||
|
||||
return isPause ? {
|
||||
status: PAUSED,
|
||||
@@ -107,7 +107,7 @@ export default class VirtVmInstance extends HarvesterResource {
|
||||
get isTerminated() {
|
||||
const conditions = this?.status?.conditions || [];
|
||||
|
||||
return conditions.find(cond => cond.type === 'Ready')?.status === 'False';
|
||||
return conditions.find((cond) => cond.type === 'Ready')?.status === 'False';
|
||||
}
|
||||
|
||||
get getVMIApiPath() {
|
||||
|
||||
@@ -38,19 +38,19 @@ export default class HciLB extends HarvesterResource {
|
||||
get subnetDisplay() {
|
||||
const ranges = this.spec?.ranges || [];
|
||||
|
||||
return ranges.map(r => r.subnet).join(', ');
|
||||
return ranges.map((r) => r.subnet).join(', ');
|
||||
}
|
||||
|
||||
get startIPDisplay() {
|
||||
const ranges = this.spec?.ranges || [];
|
||||
|
||||
return ranges.filter(r => r.startIP).map(r => r.startIP).join(', ');
|
||||
return ranges.filter((r) => r.startIP).map((r) => r.startIP).join(', ');
|
||||
}
|
||||
|
||||
get endIPDisplay() {
|
||||
const ranges = this.spec?.ranges || [];
|
||||
|
||||
return ranges.filter(r => r.endIP).map(r => r.endIP).join(', ');
|
||||
return ranges.filter((r) => r.endIP).map((r) => r.endIP).join(', ');
|
||||
}
|
||||
|
||||
get details() {
|
||||
@@ -81,7 +81,7 @@ export default class HciLB extends HarvesterResource {
|
||||
}
|
||||
|
||||
get isReady() {
|
||||
const readyCondition = (this?.status?.conditions || []).find(c => c.type === 'Ready') || {};
|
||||
const readyCondition = (this?.status?.conditions || []).find((c) => c.type === 'Ready') || {};
|
||||
|
||||
return readyCondition?.status === 'True';
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ export default class HciLB extends HarvesterResource {
|
||||
}
|
||||
|
||||
get isReady() {
|
||||
const readyCondition = (this?.status?.conditions || []).find(c => c.type === 'Ready') || {};
|
||||
const readyCondition = (this?.status?.conditions || []).find((c) => c.type === 'Ready') || {};
|
||||
|
||||
return readyCondition?.status === 'True';
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ export default class LonghornNode extends SteveModel {
|
||||
get used() {
|
||||
let out = 0;
|
||||
|
||||
this.disks.filter(d => d.allowScheduling).map((disk) => {
|
||||
this.disks.filter((d) => d.allowScheduling).map((disk) => {
|
||||
if (disk?.storageAvailable && disk?.storageMaximum) {
|
||||
out += disk.storageMaximum - disk.storageAvailable;
|
||||
}
|
||||
@@ -22,8 +22,8 @@ export default class LonghornNode extends SteveModel {
|
||||
|
||||
return Object.keys(diskSpec).map((key) => {
|
||||
const conditions = diskStatus[key]?.conditions || [];
|
||||
const readyCondition = conditions.find(c => c.type === 'Ready') || {};
|
||||
const schedulableCondition = conditions.find(c => c.type === 'Schedulable') || {};
|
||||
const readyCondition = conditions.find((c) => c.type === 'Ready') || {};
|
||||
const schedulableCondition = conditions.find((c) => c.type === 'Schedulable') || {};
|
||||
|
||||
let state;
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ export default class HciClusterNetwork extends HarvesterResource {
|
||||
}
|
||||
|
||||
get isReady() {
|
||||
const readyCondition = (this?.status?.conditions || []).find(c => c.type === 'ready') || {};
|
||||
const readyCondition = (this?.status?.conditions || []).find((c) => c.type === 'ready') || {};
|
||||
|
||||
return readyCondition?.status === 'True';
|
||||
}
|
||||
@@ -44,12 +44,12 @@ export default class HciClusterNetwork extends HarvesterResource {
|
||||
const nodes = this.$rootGetters[`${ this.inStore }/all`](NODE);
|
||||
|
||||
// filter out witness nodes and unschedulable nodes
|
||||
return nodes.filter(n => !n.isUnSchedulable && n.isEtcd !== 'true');
|
||||
return nodes.filter((n) => !n.isUnSchedulable && n.isEtcd !== 'true');
|
||||
}
|
||||
|
||||
get vlanStatuses() {
|
||||
const vlanStatuses = this.$rootGetters[`${ this.inStore }/all`](HCI.VLAN_STATUS);
|
||||
const nodeIds = this.nodes.map(n => n.id);
|
||||
const nodeIds = this.nodes.map((n) => n.id);
|
||||
|
||||
return vlanStatuses.filter((s) => {
|
||||
return nodeIds.includes(s?.status?.node) &&
|
||||
@@ -61,7 +61,7 @@ export default class HciClusterNetwork extends HarvesterResource {
|
||||
if (this.id === 'mgmt') {
|
||||
return true;
|
||||
} else {
|
||||
const readyStatuses = this.vlanStatuses.filter(s => s.isReady) || [];
|
||||
const readyStatuses = this.vlanStatuses.filter((s) => s.isReady) || [];
|
||||
|
||||
return readyStatuses.length === this.nodes.length && this.isReady;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ export default class HciVlanConfig extends HarvesterResource {
|
||||
}
|
||||
|
||||
get vlanStatuses() {
|
||||
const nodes = this.nodes.map(n => n.id) || [];
|
||||
const nodes = this.nodes.map((n) => n.id) || [];
|
||||
const vlanStatuses = this.$rootGetters[`${ this.inStore }/all`](HCI.VLAN_STATUS);
|
||||
|
||||
return vlanStatuses.filter((s) => {
|
||||
@@ -107,16 +107,16 @@ export default class HciVlanConfig extends HarvesterResource {
|
||||
if (isEmpty(nodeSelector)) {
|
||||
return nodes;
|
||||
} else if (nodeSelector[HOSTNAME] && Object.keys(nodeSelector).length === 1) {
|
||||
return nodes.filter(n => n.id === nodeSelector[HOSTNAME]) || [];
|
||||
return nodes.filter((n) => n.id === nodeSelector[HOSTNAME]) || [];
|
||||
} else {
|
||||
const matchNodes = matching(nodes || [], nodeSelector).map(n => n.id);
|
||||
const matchNodes = matching(nodes || [], nodeSelector).map((n) => n.id);
|
||||
|
||||
return nodes.filter(n => matchNodes.includes(n.id));
|
||||
return nodes.filter((n) => matchNodes.includes(n.id));
|
||||
}
|
||||
}
|
||||
|
||||
get nodes() {
|
||||
return this.selectedNodes.filter(n => !n.isUnSchedulable && n.isEtcd !== 'true');
|
||||
return this.selectedNodes.filter((n) => !n.isUnSchedulable && n.isEtcd !== 'true');
|
||||
}
|
||||
|
||||
get stateDisplay() {
|
||||
|
||||
Reference in New Issue
Block a user