mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-02-04 15:01:46 +00:00
(cherry picked from commit 85a06feb918784752025addcb04844920999694d) Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com> Co-authored-by: Yiya Chen <yiya.chen@suse.com>
This commit is contained in:
parent
264d65cc6d
commit
8044e74102
@ -69,5 +69,6 @@ export const HCI = {
|
|||||||
DISABLE_LONGHORN_V2_ENGINE: 'node.longhorn.io/disable-v2-data-engine',
|
DISABLE_LONGHORN_V2_ENGINE: 'node.longhorn.io/disable-v2-data-engine',
|
||||||
K8S_ARCH: 'kubernetes.io/arch',
|
K8S_ARCH: 'kubernetes.io/arch',
|
||||||
IMAGE_DISPLAY_NAME: 'harvesterhci.io/imageDisplayName',
|
IMAGE_DISPLAY_NAME: 'harvesterhci.io/imageDisplayName',
|
||||||
CUSTOM_IP: 'harvesterhci.io/custom-ip'
|
CUSTOM_IP: 'harvesterhci.io/custom-ip',
|
||||||
|
IMPORTED_IMAGE: 'migration.harvesterhci.io/imported'
|
||||||
};
|
};
|
||||||
|
|||||||
@ -107,6 +107,7 @@ export default {
|
|||||||
.map((image) => ({
|
.map((image) => ({
|
||||||
label: this.imageOptionLabel(image),
|
label: this.imageOptionLabel(image),
|
||||||
value: image.id,
|
value: image.id,
|
||||||
|
disabled: image.isImportedImage
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -878,6 +878,8 @@ harvester:
|
|||||||
uploading: "{name} is uploading, please do not refresh or close the page."
|
uploading: "{name} is uploading, please do not refresh or close the page."
|
||||||
checksum: Checksum
|
checksum: Checksum
|
||||||
checksumTip: Validate the image using the SHA512 checksum, if specified.
|
checksumTip: Validate the image using the SHA512 checksum, if specified.
|
||||||
|
tooltip:
|
||||||
|
imported: Created automatically by the vm-import-controller
|
||||||
|
|
||||||
vmTemplate:
|
vmTemplate:
|
||||||
label: Templates
|
label: Templates
|
||||||
|
|||||||
@ -90,6 +90,11 @@ export default {
|
|||||||
v-if="row.isEncrypted"
|
v-if="row.isEncrypted"
|
||||||
class="icon icon-lock"
|
class="icon icon-lock"
|
||||||
/>
|
/>
|
||||||
|
<i
|
||||||
|
v-if="row.isImportedImage"
|
||||||
|
v-clean-tooltip="t('harvester.image.tooltip.imported')"
|
||||||
|
class="icon icon-info"
|
||||||
|
/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
{{ row.nameDisplay }}
|
{{ row.nameDisplay }}
|
||||||
|
|||||||
@ -82,15 +82,17 @@ export default class HciVmImage extends HarvesterResource {
|
|||||||
}
|
}
|
||||||
] : [];
|
] : [];
|
||||||
|
|
||||||
let filteredOut;
|
// imported image only allow download, download yaml and delete actions
|
||||||
|
if (this.isImportedImage) {
|
||||||
|
const custom = customActions.find((a) => a.action === 'imageDownload');
|
||||||
|
const filtered = out.filter(({ action }) => ['download', 'promptRemove'].includes(action));
|
||||||
|
|
||||||
if (customActions.length > 0) {
|
return custom ? [custom, { divider: true }, ...filtered] : filtered;
|
||||||
filteredOut = out;
|
|
||||||
} else {
|
|
||||||
// if the first item is a divider, remove it from the array
|
|
||||||
filteredOut = out[0]?.divider ? out.slice(1) : out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if the first item is a divider, remove it from the array
|
||||||
|
const filteredOut = customActions.length > 0 ? out : (out[0]?.divider ? out.slice(1) : out);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
...customActions,
|
...customActions,
|
||||||
...filteredOut
|
...filteredOut
|
||||||
@ -211,6 +213,10 @@ export default class HciVmImage extends HarvesterResource {
|
|||||||
!!this.spec.securityParameters?.sourceImageNamespace;
|
!!this.spec.securityParameters?.sourceImageNamespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isImportedImage() {
|
||||||
|
return (this.metadata?.labels?.[HCI_ANNOTATIONS.IMPORTED_IMAGE]) === 'true';
|
||||||
|
}
|
||||||
|
|
||||||
get displayNameWithNamespace() {
|
get displayNameWithNamespace() {
|
||||||
return `${ this.metadata.namespace }/${ this.spec.displayName }`;
|
return `${ this.metadata.namespace }/${ this.spec.displayName }`;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user