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
@@ -131,7 +131,7 @@ export default {
});
},
groupIsAllEnabled(rows = []) {
return !rows.find(device => !device.passthroughClaim);
return !rows.find((device) => !device.passthroughClaim);
},
changeRows(filterRows, parentSriov) {
@@ -162,11 +162,25 @@ export default {
:rows-per-page="10"
>
<template #group-by="{group}">
<div :ref="group.key" v-trim-whitespace class="group-tab">
<button v-if="groupIsAllEnabled(group.rows)" type="button" class="btn btn-sm role-secondary mr-5" @click="e=>{disableGroup(group.rows); e.target.blur()}">
<div
:ref="group.key"
v-trim-whitespace
class="group-tab"
>
<button
v-if="groupIsAllEnabled(group.rows)"
type="button"
class="btn btn-sm role-secondary mr-5"
@click="e=>{disableGroup(group.rows); e.target.blur()}"
>
{{ t('harvester.pci.disableGroup') }}
</button>
<button v-else type="button" class="btn btn-sm role-secondary mr-5" @click="e=>{enableGroup(group.rows); e.target.blur()}">
<button
v-else
type="button"
class="btn btn-sm role-secondary mr-5"
@click="e=>{enableGroup(group.rows); e.target.blur()}"
>
{{ t('harvester.pci.enableGroup') }}
</button>
<span v-clean-html="group.key" />
@@ -174,7 +188,10 @@ export default {
</template>
<template #cell:claimed="{row}">
<span v-if="row.isEnabled">{{ row.claimedBy }}</span>
<span v-else class="text-muted">&mdash;</span>
<span
v-else
class="text-muted"
>&mdash;</span>
</template>
<template #more-header-middle>
<FilterBySriov
@@ -60,7 +60,7 @@ export default {
if (checkName && name.includes(checkName) && !otherDevices.includes(name)) {
oldFormatDevices.push(name);
} else if (this.enabledDevices.find(device => device?.metadata?.name === name)) {
} else if (this.enabledDevices.find((device) => device?.metadata?.name === name)) {
selectedDevices.push(name);
}
});
@@ -87,7 +87,7 @@ export default {
watch: {
selectedDevices(neu) {
const formatted = neu.map((selectedDevice) => {
const deviceCRD = this.enabledDevices.find(device => device.metadata.name === selectedDevice);
const deviceCRD = this.enabledDevices.find((device) => device.metadata.name === selectedDevice);
const deviceName = deviceCRD?.status?.resourceName;
return {
@@ -153,7 +153,7 @@ export default {
this.selectedDevices.forEach((deviceUid) => {
remove(out, (nodeName) => {
const device = this.enabledDevices.find(deviceCRD => deviceCRD.metadata.name === deviceUid);
const device = this.enabledDevices.find((deviceCRD) => deviceCRD.metadata.name === deviceUid);
return device.status.nodeName !== nodeName;
});
@@ -166,7 +166,7 @@ export default {
deviceOpts() {
const filteredOptions = this.enabledDevices.filter((deviceCRD) => {
if (this.selectedDevices.length > 0) {
const selectedDevice = this.enabledDevices.find(device => device.metadata.name === this.selectedDevices[0]);
const selectedDevice = this.enabledDevices.find((device) => device.metadata.name === this.selectedDevices[0]);
return !this.devicesInUse[deviceCRD?.metadata.name] && deviceCRD.status.nodeName === selectedDevice.status.nodeName;
}
@@ -192,13 +192,13 @@ export default {
methods: {
otherDevices(vmDevices) {
return vmDevices.filter(device => !this.pciDevices.find(pci => device.name === pci.name));
return vmDevices.filter((device) => !this.pciDevices.find((pci) => device.name === pci.name));
},
nodeNameFromUid(uid) {
for (const deviceUid in this.uniqueDevices) {
const nodes = this.uniqueDevices[deviceUid].nodes;
const thisNode = nodes.find(node => node.systemUUID === uid);
const thisNode = nodes.find((node) => node.systemUUID === uid);
if (thisNode) {
return thisNode.name;
@@ -227,7 +227,10 @@ export default {
<Banner color="info">
<t k="harvester.pci.howToUseDevice" />
</Banner>
<Banner v-if="selectedDevices.length > 0" color="info">
<Banner
v-if="selectedDevices.length > 0"
color="info"
>
<t k="harvester.pci.deviceInTheSameHost" />
</Banner>
</div>
@@ -250,28 +253,52 @@ export default {
</LabeledSelect>
</div>
</div>
<div v-if="compatibleNodes.length && selectedDevices.length" class="row">
<div
v-if="compatibleNodes.length && selectedDevices.length"
class="row"
>
<div class="col span-12 text-muted">
Compatible hosts:
<!-- eslint-disable-next-line vue/no-parsing-error -->
<span v-for="(node, idx) in compatibleNodes" :key="idx">{{ node }}{{ idx < compatibleNodes.length-1 ? ', ' : '' }}</span>
<span
v-for="(node, idx) in compatibleNodes"
:key="idx"
>{{ node }}{{ idx < compatibleNodes.length-1 ? ', ' : '' }}</span>
</div>
</div>
<div v-else-if="selectedDevices.length" class="text-error">
<div
v-else-if="selectedDevices.length"
class="text-error"
>
{{ t('harvester.pci.impossibleSelection') }}
</div>
<button type="button" class="btn btn-sm role-link pl-0" @click="e=>{showMatrix = !showMatrix; e.target.blur()}">
<button
type="button"
class="btn btn-sm role-link pl-0"
@click="e=>{showMatrix = !showMatrix; e.target.blur()}"
>
{{ showMatrix ? t('harvester.pci.hideCompatibility') : t('harvester.pci.showCompatibility') }}
</button>
<div v-if="showMatrix" class="row mt-20">
<div
v-if="showMatrix"
class="row mt-20"
>
<div class="col span-12">
<CompatibilityMatrix :enabled-devices="enabledDevices" :devices-by-node="devicesByNode" :devices-in-use="devicesInUse" />
<CompatibilityMatrix
:enabled-devices="enabledDevices"
:devices-by-node="devicesByNode"
:devices-in-use="devicesInUse"
/>
</div>
</div>
</template>
<div class="row mt-20">
<div class="col span-12">
<DeviceList :schema="pciDeviceSchema" :devices="pciDevices" @submit.prevent />
<DeviceList
:schema="pciDeviceSchema"
:devices="pciDevices"
@submit.prevent
/>
</div>
</div>
</div>