mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-02-04 06:51:44 +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 },
|
components: { ButtonDropdown },
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
resource: {
|
resourceType: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true,
|
required: true,
|
||||||
default: () => {
|
default: () => {
|
||||||
@ -23,7 +23,7 @@ export default {
|
|||||||
...mapGetters({ t: 'i18n/t' }),
|
...mapGetters({ t: 'i18n/t' }),
|
||||||
|
|
||||||
isOff() {
|
isOff() {
|
||||||
return this.resource.stateDisplay === OFF;
|
return this.resourceType.stateDisplay === OFF;
|
||||||
},
|
},
|
||||||
|
|
||||||
options() {
|
options() {
|
||||||
@ -46,10 +46,10 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
show(type) {
|
show(type) {
|
||||||
let uid = this.resource.metadata?.ownerReferences?.[0]?.uid;
|
let uid = this.resourceType.metadata?.ownerReferences?.[0]?.uid;
|
||||||
|
|
||||||
if (uid === undefined) {
|
if (uid === undefined) {
|
||||||
uid = this.resource.metadata.uid;
|
uid = this.resourceType.metadata.uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
const host = window.location.host;
|
const host = window.location.host;
|
||||||
|
|||||||
@ -26,7 +26,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
resource: {
|
resourceType: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {
|
default: () => {
|
||||||
return {};
|
return {};
|
||||||
|
|||||||
@ -28,7 +28,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
resource: {
|
resourceType: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {
|
default: () => {
|
||||||
return {};
|
return {};
|
||||||
@ -74,7 +74,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
historyUsersOptions() {
|
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({
|
out.unshift({
|
||||||
label: this.t('harvester.virtualMachine.accessCredentials.injectSSH.addUser'),
|
label: this.t('harvester.virtualMachine.accessCredentials.injectSSH.addUser'),
|
||||||
@ -107,7 +107,7 @@ export default {
|
|||||||
sshkeys: [],
|
sshkeys: [],
|
||||||
username: '',
|
username: '',
|
||||||
newPassword: '',
|
newPassword: '',
|
||||||
secretName: this.generateSecretName(this.resource.metadata.name),
|
secretName: this.generateSecretName(this.resourceType.metadata.name),
|
||||||
};
|
};
|
||||||
|
|
||||||
this.rows.push(neu);
|
this.rows.push(neu);
|
||||||
@ -169,7 +169,7 @@ export default {
|
|||||||
:is="componentFor(row.source)"
|
:is="componentFor(row.source)"
|
||||||
v-model:value="rows[i]"
|
v-model:value="rows[i]"
|
||||||
:rows="rows"
|
:rows="rows"
|
||||||
:resource="resource"
|
:resourceType="resourceType"
|
||||||
:user-options="userOptions"
|
:user-options="userOptions"
|
||||||
:mode="mode"
|
:mode="mode"
|
||||||
:idx="i"
|
:idx="i"
|
||||||
|
|||||||
@ -15,7 +15,7 @@ export default {
|
|||||||
default: 'create'
|
default: 'create'
|
||||||
},
|
},
|
||||||
|
|
||||||
resource: {
|
resourceType: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {
|
default: () => {
|
||||||
return {};
|
return {};
|
||||||
@ -68,7 +68,7 @@ export default {
|
|||||||
<div class="col span-6">
|
<div class="col span-6">
|
||||||
<AccessCredentialsUsers
|
<AccessCredentialsUsers
|
||||||
v-model:value="value.username"
|
v-model:value="value.username"
|
||||||
:resource="resource"
|
:resourceType="resourceType"
|
||||||
:user-options="userOptions"
|
:user-options="userOptions"
|
||||||
:multiple="false"
|
:multiple="false"
|
||||||
:mode="mode"
|
:mode="mode"
|
||||||
|
|||||||
@ -15,7 +15,7 @@ export default {
|
|||||||
default: 'create'
|
default: 'create'
|
||||||
},
|
},
|
||||||
|
|
||||||
resource: {
|
resourceType: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {
|
default: () => {
|
||||||
return {};
|
return {};
|
||||||
@ -65,7 +65,7 @@ export default {
|
|||||||
<div class="col span-6">
|
<div class="col span-6">
|
||||||
<AccessCredentialsUsers
|
<AccessCredentialsUsers
|
||||||
v-model:value="value.users"
|
v-model:value="value.users"
|
||||||
:resource="resource"
|
:resourceType="resourceType"
|
||||||
:user-options="userOptions"
|
:user-options="userOptions"
|
||||||
:mode="mode"
|
:mode="mode"
|
||||||
:multiple="true"
|
:multiple="true"
|
||||||
@ -77,7 +77,7 @@ export default {
|
|||||||
<SSHKey
|
<SSHKey
|
||||||
v-model:value="value.sshkeys"
|
v-model:value="value.sshkeys"
|
||||||
class="mb-20"
|
class="mb-20"
|
||||||
:namespace="resource.metadata.namespace"
|
:namespace="resourceType.metadata.namespace"
|
||||||
:mode="mode"
|
:mode="mode"
|
||||||
:searchable="false"
|
:searchable="false"
|
||||||
@update:sshKey="updateSSH"
|
@update:sshKey="updateSSH"
|
||||||
|
|||||||
@ -75,7 +75,7 @@ export default {
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
resource: {
|
resourceType: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
}
|
}
|
||||||
@ -266,7 +266,7 @@ export default {
|
|||||||
|
|
||||||
needNewSecret() {
|
needNewSecret() {
|
||||||
// When creating a template it is always necessary to create a new secret.
|
// 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() {
|
defaultTerminationSetting() {
|
||||||
@ -300,7 +300,7 @@ export default {
|
|||||||
value, existUserData, fromTemplate = false, init = false
|
value, existUserData, fromTemplate = false, init = false
|
||||||
} = config;
|
} = 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;
|
const spec = vm?.spec;
|
||||||
|
|
||||||
@ -341,7 +341,7 @@ export default {
|
|||||||
|
|
||||||
let { userData = undefined, networkData = undefined } = this.getCloudInitNoCloud(spec);
|
let { userData = undefined, networkData = undefined } = this.getCloudInitNoCloud(spec);
|
||||||
|
|
||||||
if (this.resource === HCI.BACKUP) {
|
if (this.resourceType === HCI.BACKUP) {
|
||||||
const secretBackups = this.value.status?.secretBackups;
|
const secretBackups = this.value.status?.secretBackups;
|
||||||
|
|
||||||
if (secretBackups) {
|
if (secretBackups) {
|
||||||
@ -609,7 +609,7 @@ export default {
|
|||||||
this.spec.template.spec.terminationGracePeriodSeconds = this.terminationGracePeriodSeconds;
|
this.spec.template.spec.terminationGracePeriodSeconds = this.terminationGracePeriodSeconds;
|
||||||
|
|
||||||
// parse reserved memory
|
// 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) {
|
if (!this.reservedMemory) {
|
||||||
delete vm.metadata.annotations[HCI_ANNOTATIONS.VM_RESERVED_MEMORY];
|
delete vm.metadata.annotations[HCI_ANNOTATIONS.VM_RESERVED_MEMORY];
|
||||||
@ -724,7 +724,7 @@ export default {
|
|||||||
delete spec.template.spec.volumes;
|
delete spec.template.spec.volumes;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.resource === HCI.VM) {
|
if (this.resourceType === HCI.VM) {
|
||||||
if (!this.isSingle) {
|
if (!this.isSingle) {
|
||||||
spec = this.multiVMScheduler(spec);
|
spec = this.multiVMScheduler(spec);
|
||||||
}
|
}
|
||||||
@ -739,7 +739,7 @@ export default {
|
|||||||
|
|
||||||
this.value['spec'] = spec;
|
this.value['spec'] = spec;
|
||||||
this['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['spec'] = spec;
|
||||||
this.value.spec.vm.metadata['annotations'] = {
|
this.value.spec.vm.metadata['annotations'] = {
|
||||||
...this.value.spec.vm.metadata.annotations,
|
...this.value.spec.vm.metadata.annotations,
|
||||||
@ -1177,7 +1177,7 @@ export default {
|
|||||||
getOwnerReferencesFromVM(resource) {
|
getOwnerReferencesFromVM(resource) {
|
||||||
const name = resource.metadata.name;
|
const name = resource.metadata.name;
|
||||||
const kind = resource.kind;
|
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;
|
const uid = resource?.metadata?.uid;
|
||||||
|
|
||||||
return [{
|
return [{
|
||||||
@ -1491,7 +1491,7 @@ export default {
|
|||||||
|
|
||||||
secretRef: {
|
secretRef: {
|
||||||
handler(secret) {
|
handler(secret) {
|
||||||
if (secret && this.resource !== HCI.BACKUP) {
|
if (secret && this.resourceType !== HCI.BACKUP) {
|
||||||
this.secretName = secret?.metadata.name;
|
this.secretName = secret?.metadata.name;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user