mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-01 03:36:04 +08:00
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:
@@ -1,4 +1,3 @@
|
||||
import Vue from 'vue';
|
||||
import { _CLONE } from '@shell/config/query-params';
|
||||
import pick from 'lodash/pick';
|
||||
import { PV, LONGHORN } from '@shell/config/types';
|
||||
@@ -21,12 +20,12 @@ export default class HciPv extends HarvesterResource {
|
||||
const storageClassName =
|
||||
realMode === _CLONE ? this.spec.storageClassName : '';
|
||||
|
||||
Vue.set(this, 'spec', {
|
||||
this['spec'] = {
|
||||
accessModes,
|
||||
storageClassName,
|
||||
volumeName: '',
|
||||
resources: { requests: { storage } }
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
get availableActions() {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import Vue from 'vue';
|
||||
import {
|
||||
DESCRIPTION,
|
||||
ANNOTATIONS_TO_IGNORE_REGEX,
|
||||
@@ -64,8 +63,8 @@ export default class HciVmImage extends HarvesterResource {
|
||||
|
||||
applyDefaults(resources = this, realMode) {
|
||||
if (realMode !== _CLONE) {
|
||||
Vue.set(this.metadata, 'labels', { [HCI_ANNOTATIONS.OS_TYPE]: '', [HCI_ANNOTATIONS.IMAGE_SUFFIX]: '' });
|
||||
Vue.set(this.metadata, 'annotations', { [HCI_ANNOTATIONS.STORAGE_CLASS]: '' });
|
||||
this.metadata['labels'] = { [HCI_ANNOTATIONS.OS_TYPE]: '', [HCI_ANNOTATIONS.IMAGE_SUFFIX]: '' };
|
||||
this.metadata['annotations'] = { [HCI_ANNOTATIONS.STORAGE_CLASS]: '' };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import Vue from 'vue';
|
||||
import { find, pickBy, omitBy } from 'lodash';
|
||||
import {
|
||||
AS, MODE, _VIEW, _CONFIG, _UNFLAG, _EDIT
|
||||
@@ -110,7 +109,7 @@ export default class HciVmTemplateVersion extends HarvesterResource {
|
||||
}
|
||||
};
|
||||
|
||||
Vue.set(this, 'spec', spec);
|
||||
this['spec'] = spec;
|
||||
}
|
||||
|
||||
get canDelete() {
|
||||
@@ -272,6 +271,6 @@ export default class HciVmTemplateVersion extends HarvesterResource {
|
||||
return matchesSomeRegex(key, LABELS_TO_IGNORE_REGEX);
|
||||
});
|
||||
|
||||
Vue.set(this.spec.vm.spec.template.metadata, 'labels', { ...wasIgnored, ...val });
|
||||
this.spec.vm.spec.template.metadata['labels'] = { ...wasIgnored, ...val };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import Vue from 'vue';
|
||||
import SteveModel from '@shell/plugins/steve/steve-class';
|
||||
import { HCI } from '@shell/config/labels-annotations';
|
||||
|
||||
@@ -16,7 +15,7 @@ export default class NetworkAttachmentDef extends SteveModel {
|
||||
})
|
||||
};
|
||||
|
||||
Vue.set(this, 'spec', spec);
|
||||
this.spec = spec;
|
||||
}
|
||||
|
||||
get parseConfig() {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import Vue from 'vue';
|
||||
import { load } from 'js-yaml';
|
||||
import { omitBy, pickBy } from 'lodash';
|
||||
|
||||
@@ -264,8 +263,8 @@ export default class VirtVm extends HarvesterResource {
|
||||
};
|
||||
|
||||
if (realMode !== _CLONE) {
|
||||
Vue.set(this.metadata, 'annotations', { [HCI_ANNOTATIONS.VOLUME_CLAIM_TEMPLATE]: '[]' });
|
||||
Vue.set(this, 'spec', spec);
|
||||
this.metadata['annotations'] = { [HCI_ANNOTATIONS.VOLUME_CLAIM_TEMPLATE]: '[]' };
|
||||
this['spec'] = spec;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1057,6 +1056,6 @@ export default class VirtVm extends HarvesterResource {
|
||||
return matchesSomeRegex(key, LABELS_TO_IGNORE_REGEX);
|
||||
});
|
||||
|
||||
Vue.set(this.spec.template.metadata, 'labels', { ...wasIgnored, ...val });
|
||||
this.spec.template.metadata['labels'] = { ...wasIgnored, ...val };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import Vue from 'vue';
|
||||
import { clone } from '@shell/utils/object';
|
||||
import HarvesterResource from '@pkg/harvester/models/harvester';
|
||||
import { HCI } from '@pkg/harvester/types';
|
||||
@@ -14,8 +13,8 @@ export default class HciLB extends HarvesterResource {
|
||||
spec.selector = spec.selector || {};
|
||||
spec.selector.network = spec.selector.network || '';
|
||||
|
||||
Vue.set(this, 'spec', spec);
|
||||
Vue.set(this, 'metadata', meta);
|
||||
this['spec'] = spec;
|
||||
this['metadata'] = meta;
|
||||
}
|
||||
|
||||
get customValidationRules() {
|
||||
|
||||
Reference in New Issue
Block a user