mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-13 21:21:44 +00:00
fix: Harvester upgrade ISO related internal image can be selected to create VM when an upgrade is ongoing (#309)
* fix: filter out upgrade image Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com> * refactor: add label constant Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com> --------- Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
This commit is contained in:
parent
fe32b4372b
commit
796d98e61a
@ -35,6 +35,7 @@ export const HCI = {
|
|||||||
NODE_SCHEDULABLE: 'kubevirt.io/schedulable',
|
NODE_SCHEDULABLE: 'kubevirt.io/schedulable',
|
||||||
NETWORK_ROUTE: 'network.harvesterhci.io/route',
|
NETWORK_ROUTE: 'network.harvesterhci.io/route',
|
||||||
MATCHED_NODES: 'network.harvesterhci.io/matched-nodes',
|
MATCHED_NODES: 'network.harvesterhci.io/matched-nodes',
|
||||||
|
UPGRADE: 'harvesterhci.io/upgrade',
|
||||||
OS_UPGRADE_IMAGE: 'harvesterhci.io/os-upgrade-image',
|
OS_UPGRADE_IMAGE: 'harvesterhci.io/os-upgrade-image',
|
||||||
LATEST_UPGRADE: 'harvesterhci.io/latestUpgrade',
|
LATEST_UPGRADE: 'harvesterhci.io/latestUpgrade',
|
||||||
UPGRADE_STATE: 'harvesterhci.io/upgradeState',
|
UPGRADE_STATE: 'harvesterhci.io/upgradeState',
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import { Banner } from '@components/Banner';
|
|||||||
import { PVC } from '@shell/config/types';
|
import { PVC } from '@shell/config/types';
|
||||||
import { formatSi, parseSi } from '@shell/utils/units';
|
import { formatSi, parseSi } from '@shell/utils/units';
|
||||||
import { HCI } from '../../../../types';
|
import { HCI } from '../../../../types';
|
||||||
|
import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations';
|
||||||
import { VOLUME_TYPE, InterfaceOption } from '../../../../config/harvester-map';
|
import { VOLUME_TYPE, InterfaceOption } from '../../../../config/harvester-map';
|
||||||
import { _VIEW } from '@shell/config/query-params';
|
import { _VIEW } from '@shell/config/query-params';
|
||||||
import LabelValue from '@shell/components/LabelValue';
|
import LabelValue from '@shell/components/LabelValue';
|
||||||
@ -70,6 +71,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
GIBIBYTE,
|
GIBIBYTE,
|
||||||
VOLUME_TYPE,
|
VOLUME_TYPE,
|
||||||
|
HCI_ANNOTATIONS,
|
||||||
InterfaceOption,
|
InterfaceOption,
|
||||||
loading: false,
|
loading: false,
|
||||||
images: [],
|
images: [],
|
||||||
@ -90,12 +92,22 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
imagesOption() {
|
imagesOption() {
|
||||||
return this.images.filter((c) => c.isReady).sort((a, b) => a.creationTimestamp > b.creationTimestamp ? -1 : 1).map( (I) => {
|
return this.images
|
||||||
return {
|
.filter((image) => {
|
||||||
label: this.imageOptionLabel(I),
|
if (!image.isReady) return false;
|
||||||
value: I.id
|
|
||||||
};
|
// exclude internal images created during upgrade
|
||||||
});
|
const isInternalCreatedImage =
|
||||||
|
image.namespace === 'harvester-system' &&
|
||||||
|
image.labels?.[HCI_ANNOTATIONS.UPGRADE];
|
||||||
|
|
||||||
|
return !isInternalCreatedImage;
|
||||||
|
})
|
||||||
|
.sort((a, b) => (a.creationTimestamp > b.creationTimestamp ? -1 : 1))
|
||||||
|
.map((image) => ({
|
||||||
|
label: this.imageOptionLabel(image),
|
||||||
|
value: image.id,
|
||||||
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
imageName() {
|
imageName() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user