Vue migration - remove Vuew.set & this.$set; add vue-migrate script

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
Francesco Torchia
2024-10-23 17:00:48 +02:00
parent c983ed8384
commit ea12a81174
85 changed files with 938 additions and 256 deletions
@@ -73,7 +73,7 @@ export default {
selectedUser(val, old) {
if ( val.includes(_NEW)) {
this.$set(this, 'selectedUser', old);
this['selectedUser'] = old;
this.update();
this.show();
}
@@ -49,7 +49,7 @@ export default {
},
updateUser(neu) {
this.$set(this.value, 'username', neu);
this.value['username'] = neu;
this.update();
},
@@ -40,12 +40,12 @@ export default {
},
updateUser(neu) {
this.$set(this.value, 'users', neu);
this.value['users'] = neu;
this.update();
},
updateSSH(neu) {
this.$set(this.value, 'sshkeys', neu);
this.value['sshkeys'] = neu;
this.update();
},
@@ -179,7 +179,7 @@ export default {
cancel() {
this.cloudTemplate = '';
this.cloudTemplateName = '';
this.$set(this, 'errors', []);
this['errors'] = [];
this.isOpen = false;
},
@@ -138,7 +138,7 @@ export default {
handler(neu) {
const hasManagementNetwork = !!neu.some(N => N.isPod);
this.$set(this, 'hasManagementNetwork', hasManagementNetwork);
this['hasManagementNetwork'] = hasManagementNetwork;
},
immediate: true,
deep: true
@@ -146,7 +146,7 @@ export default {
isSingle(neu) {
if (!neu) {
this.$set(this.value, 'macAddress', '');
this.value['macAddress'] = '';
this.update();
}
}
@@ -164,7 +164,7 @@ export default {
this.value.isPod = false;
}
this.$set(this, 'isMasquerade', this.value.isPod);
this['isMasquerade'] = this.value.isPod;
if (this.value.isPod) {
this.value.type = 'masquerade';
@@ -134,8 +134,8 @@ export default {
},
changeRows(filterRows, parentSriov) {
this.$set(this, 'filterRows', filterRows);
this.$set(this, 'parentSriov', parentSriov);
this['filterRows'] = filterRows;
this['parentSriov'] = parentSriov;
},
sortGenerationFn() {
@@ -126,7 +126,7 @@ export default {
checkedSsh(val, old) {
if ( val.includes(_NEW)) {
this.$set(this, 'checkedSsh', old);
this['checkedSsh'] = old;
this.update();
this.show();
}
@@ -89,8 +89,8 @@ export default {
methods: {
changeRows(filterRows, parentSriov) {
this.$set(this, 'filterRows', filterRows);
this.$set(this, 'parentSriov', parentSriov);
this['filterRows'] = filterRows;
this['parentSriov'] = parentSriov;
},
sortGenerationFn() {
@@ -149,7 +149,7 @@ export default {
return V;
});
this.$set(this, 'rows', rows);
this['rows'] = rows;
},
deep: true,
immediate: true,
@@ -32,7 +32,7 @@ export default {
watch: {
'value.type'(neu) {
if (neu === 'cd-rom') {
this.$set(this.value, 'bus', 'sata');
this.value['bus'] = 'sata';
this.update();
}
},
@@ -140,7 +140,7 @@ export default {
'value.type'(neu) {
if (neu === 'cd-rom') {
this.$set(this.value, 'bus', 'sata');
this.value['bus'] = 'sata';
this.update();
}
},
@@ -100,7 +100,7 @@ export default {
watch: {
'value.type'(neu) {
if (neu === 'cd-rom') {
this.$set(this.value, 'bus', 'sata');
this.value['bus'] = 'sata';
this.update();
}
},
@@ -143,11 +143,11 @@ export default {
if (this.idx === 0) {
if (/iso$/i.test(imageResource?.imageSuffix)) {
this.$set(this.value, 'type', 'cd-rom');
this.$set(this.value, 'bus', 'sata');
this.value['type'] = 'cd-rom';
this.value['bus'] = 'sata';
} else {
this.$set(this.value, 'type', 'disk');
this.$set(this.value, 'bus', 'virtio');
this.value['type'] = 'disk';
this.value['bus'] = 'virtio';
}
}
@@ -165,7 +165,7 @@ export default {
message: this.$store.getters['i18n/t']('harvester.vmTemplate.tips.notExistImage.message')
}, { root: true });
this.$set(this.value, 'image', '');
this.value['image'] = '';
}
}
}
@@ -87,7 +87,7 @@ export default {
watch: {
'value.type'(neu) {
if (neu === 'cd-rom') {
this.$set(this.value, 'bus', 'sata');
this.value['bus'] = 'sata';
this.update();
}
},
@@ -19,17 +19,17 @@ import KeyValue from '@shell/components/form/KeyValue';
import { clear } from '@shell/utils/array';
import { clone } from '@shell/utils/object';
import { HCI } from '../../types';
import { RunStrategys } from '../../config/harvester-map';
import { saferDump } from '@shell/utils/create-yaml';
import { exceptionToErrorsArray } from '@shell/utils/error';
import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations';
import { BEFORE_SAVE_HOOKS, AFTER_SAVE_HOOKS } from '@shell/mixins/child-hook';
import VM_MIXIN from '../../mixins/harvester-vm';
import CreateEditView from '@shell/mixins/create-edit-view';
import { parseVolumeClaimTemplates } from '@pkg/utils/vm';
import VM_MIXIN from '../../mixins/harvester-vm';
import { RunStrategys } from '../../config/harvester-map';
import { HCI } from '../../types';
import RestartVMDialog from '../../dialog/RestartVMDialog';
import VirtualMachineVGpuDevices from './VirtualMachineVGpuDevices/index';
import PciDevices from './VirtualMachinePciDevices/index';
@@ -218,7 +218,7 @@ export default {
this.getInitConfig({
value: cloneVersionVM, existUserData: true, fromTemplate: true
});
this.$set(this, 'hasCreateVolumes', []); // When using the template, all volume names need to be newly created
this['hasCreateVolumes'] = []; // When using the template, all volume names need to be newly created
}
},
@@ -261,7 +261,7 @@ export default {
const diskRows = this.getDiskRows(this.value);
this.$set(this, 'diskRows', diskRows);
this['diskRows'] = diskRows;
const templateId = this.$route.query.templateId;
const templateVersionId = this.$route.query.versionId;
@@ -317,13 +317,13 @@ export default {
const cloneSpec = clone(this.spec);
for (let i = 1; i <= this.count; i++) {
this.$set(this.value, 'spec', cloneValue.spec);
this.$set(this, 'spec', cloneSpec);
this.value['spec'] = cloneValue.spec;
this['spec'] = cloneSpec;
const suffix = i < 10 ? `0${ i }` : i;
this.value.cleanForNew();
this.value.metadata.name = `${ this.namePrefix }${ join }${ suffix }`;
this.$set(this.value.spec.template.spec, 'hostname', `${ baseHostname }${ join }${ suffix }`);
this.value.spec.template.spec['hostname'] = `${ baseHostname }${ join }${ suffix }`;
this.secretName = '';
await this.parseVM();
const basicValue = await this.$store.dispatch('harvester/clone', { resource: this.value });
@@ -380,7 +380,7 @@ export default {
updateBeforeSave() {
if (this.isSingle) {
if (!this.value.spec.template.spec.hostname) {
this.$set(this.value.spec.template.spec, 'hostname', this.value.metadata.name);
this.value.spec.template.spec['hostname'] = this.value.metadata.name;
}
}
@@ -395,7 +395,7 @@ export default {
validateCount(count) {
if (count > 10) {
this.$set(this, 'count', 10);
this['count'] = 10;
}
},