mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-13 13:11:43 +00:00
Replace resource prop with resourceType prop - shell change: https://github.com/rancher/dashboard/pull/11971
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
parent
fd39fdf173
commit
2ca86930ad
@ -10,7 +10,7 @@ export default {
|
||||
components: { ButtonDropdown },
|
||||
|
||||
props: {
|
||||
resource: {
|
||||
resourceType: {
|
||||
type: Object,
|
||||
required: true,
|
||||
default: () => {
|
||||
@ -23,7 +23,7 @@ export default {
|
||||
...mapGetters({ t: 'i18n/t' }),
|
||||
|
||||
isOff() {
|
||||
return this.resource.stateDisplay === OFF;
|
||||
return this.resourceType.stateDisplay === OFF;
|
||||
},
|
||||
|
||||
options() {
|
||||
@ -46,10 +46,10 @@ export default {
|
||||
},
|
||||
|
||||
show(type) {
|
||||
let uid = this.resource.metadata?.ownerReferences?.[0]?.uid;
|
||||
let uid = this.resourceType.metadata?.ownerReferences?.[0]?.uid;
|
||||
|
||||
if (uid === undefined) {
|
||||
uid = this.resource.metadata.uid;
|
||||
uid = this.resourceType.metadata.uid;
|
||||
}
|
||||
|
||||
const host = window.location.host;
|
||||
|
||||
@ -26,7 +26,7 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
resource: {
|
||||
resourceType: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
|
||||
@ -28,7 +28,7 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
resource: {
|
||||
resourceType: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
@ -74,7 +74,7 @@ export default {
|
||||
},
|
||||
|
||||
historyUsersOptions() {
|
||||
const out = JSON.parse(this.resource?.spec?.template?.metadata?.annotations?.[HCI_ANNOTATIONS.DYNAMIC_SSHKEYS_USERS] || '[]');
|
||||
const out = JSON.parse(this.resourceType?.spec?.template?.metadata?.annotations?.[HCI_ANNOTATIONS.DYNAMIC_SSHKEYS_USERS] || '[]');
|
||||
|
||||
out.unshift({
|
||||
label: this.t('harvester.virtualMachine.accessCredentials.injectSSH.addUser'),
|
||||
@ -107,7 +107,7 @@ export default {
|
||||
sshkeys: [],
|
||||
username: '',
|
||||
newPassword: '',
|
||||
secretName: this.generateSecretName(this.resource.metadata.name),
|
||||
secretName: this.generateSecretName(this.resourceType.metadata.name),
|
||||
};
|
||||
|
||||
this.rows.push(neu);
|
||||
@ -169,7 +169,7 @@ export default {
|
||||
:is="componentFor(row.source)"
|
||||
v-model:value="rows[i]"
|
||||
:rows="rows"
|
||||
:resource="resource"
|
||||
:resourceType="resourceType"
|
||||
:user-options="userOptions"
|
||||
:mode="mode"
|
||||
:idx="i"
|
||||
|
||||
@ -15,7 +15,7 @@ export default {
|
||||
default: 'create'
|
||||
},
|
||||
|
||||
resource: {
|
||||
resourceType: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
@ -68,7 +68,7 @@ export default {
|
||||
<div class="col span-6">
|
||||
<AccessCredentialsUsers
|
||||
v-model:value="value.username"
|
||||
:resource="resource"
|
||||
:resourceType="resourceType"
|
||||
:user-options="userOptions"
|
||||
:multiple="false"
|
||||
:mode="mode"
|
||||
|
||||
@ -15,7 +15,7 @@ export default {
|
||||
default: 'create'
|
||||
},
|
||||
|
||||
resource: {
|
||||
resourceType: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
@ -65,7 +65,7 @@ export default {
|
||||
<div class="col span-6">
|
||||
<AccessCredentialsUsers
|
||||
v-model:value="value.users"
|
||||
:resource="resource"
|
||||
:resourceType="resourceType"
|
||||
:user-options="userOptions"
|
||||
:mode="mode"
|
||||
:multiple="true"
|
||||
@ -77,7 +77,7 @@ export default {
|
||||
<SSHKey
|
||||
v-model:value="value.sshkeys"
|
||||
class="mb-20"
|
||||
:namespace="resource.metadata.namespace"
|
||||
:namespace="resourceType.metadata.namespace"
|
||||
:mode="mode"
|
||||
:searchable="false"
|
||||
@update:sshKey="updateSSH"
|
||||
|
||||
@ -75,7 +75,7 @@ export default {
|
||||
required: true,
|
||||
},
|
||||
|
||||
resource: {
|
||||
resourceType: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
@ -266,7 +266,7 @@ export default {
|
||||
|
||||
needNewSecret() {
|
||||
// When creating a template it is always necessary to create a new secret.
|
||||
return this.resource === HCI.VM_VERSION || this.isCreate;
|
||||
return this.resourceType === HCI.VM_VERSION || this.isCreate;
|
||||
},
|
||||
|
||||
defaultTerminationSetting() {
|
||||
@ -300,7 +300,7 @@ export default {
|
||||
value, existUserData, fromTemplate = false, init = false
|
||||
} = config;
|
||||
|
||||
const vm = this.resource === HCI.VM ? value : this.resource === HCI.BACKUP ? this.value.status?.source : value.spec.vm;
|
||||
const vm = this.resourceType === HCI.VM ? value : this.resourceType === HCI.BACKUP ? this.value.status?.source : value.spec.vm;
|
||||
|
||||
const spec = vm?.spec;
|
||||
|
||||
@ -341,7 +341,7 @@ export default {
|
||||
|
||||
let { userData = undefined, networkData = undefined } = this.getCloudInitNoCloud(spec);
|
||||
|
||||
if (this.resource === HCI.BACKUP) {
|
||||
if (this.resourceType === HCI.BACKUP) {
|
||||
const secretBackups = this.value.status?.secretBackups;
|
||||
|
||||
if (secretBackups) {
|
||||
@ -609,7 +609,7 @@ export default {
|
||||
this.spec.template.spec.terminationGracePeriodSeconds = this.terminationGracePeriodSeconds;
|
||||
|
||||
// parse reserved memory
|
||||
const vm = this.resource === HCI.VM ? this.value : this.value.spec.vm;
|
||||
const vm = this.resourceType === HCI.VM ? this.value : this.value.spec.vm;
|
||||
|
||||
if (!this.reservedMemory) {
|
||||
delete vm.metadata.annotations[HCI_ANNOTATIONS.VM_RESERVED_MEMORY];
|
||||
@ -724,7 +724,7 @@ export default {
|
||||
delete spec.template.spec.volumes;
|
||||
}
|
||||
|
||||
if (this.resource === HCI.VM) {
|
||||
if (this.resourceType === HCI.VM) {
|
||||
if (!this.isSingle) {
|
||||
spec = this.multiVMScheduler(spec);
|
||||
}
|
||||
@ -739,7 +739,7 @@ export default {
|
||||
|
||||
this.value['spec'] = spec;
|
||||
this['spec'] = spec;
|
||||
} else if (this.resource === HCI.VM_VERSION) {
|
||||
} else if (this.resourceType === HCI.VM_VERSION) {
|
||||
this.value.spec.vm['spec'] = spec;
|
||||
this.value.spec.vm.metadata['annotations'] = {
|
||||
...this.value.spec.vm.metadata.annotations,
|
||||
@ -1177,7 +1177,7 @@ export default {
|
||||
getOwnerReferencesFromVM(resource) {
|
||||
const name = resource.metadata.name;
|
||||
const kind = resource.kind;
|
||||
const apiVersion = this.resource === HCI.VM ? 'kubevirt.io/v1' : 'harvesterhci.io/v1beta1';
|
||||
const apiVersion = this.resourceType === HCI.VM ? 'kubevirt.io/v1' : 'harvesterhci.io/v1beta1';
|
||||
const uid = resource?.metadata?.uid;
|
||||
|
||||
return [{
|
||||
@ -1491,7 +1491,7 @@ export default {
|
||||
|
||||
secretRef: {
|
||||
handler(secret) {
|
||||
if (secret && this.resource !== HCI.BACKUP) {
|
||||
if (secret && this.resourceType !== HCI.BACKUP) {
|
||||
this.secretName = secret?.metadata.name;
|
||||
}
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user