mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-04 21:26:08 +08:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c562dd73ba | ||
|
|
1cd5e5ca7d | ||
|
|
1aaa8f71c4 | ||
|
|
003a09d0a9 |
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "harvester-ui-extension",
|
"name": "harvester-ui-extension",
|
||||||
"version": "1.6.0-rc4",
|
"version": "1.6.0-rc5",
|
||||||
"private": false,
|
"private": false,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=20.0.0"
|
"node": ">=20.0.0"
|
||||||
|
|||||||
@@ -297,18 +297,26 @@ export default {
|
|||||||
|
|
||||||
if (Object.keys(volumeModeAccessModes).length > 0) {
|
if (Object.keys(volumeModeAccessModes).length > 0) {
|
||||||
annotations[HCI_ANNOTATIONS.VOLUME_MODE_ACCESS_MODES] = JSON.stringify(volumeModeAccessModes);
|
annotations[HCI_ANNOTATIONS.VOLUME_MODE_ACCESS_MODES] = JSON.stringify(volumeModeAccessModes);
|
||||||
|
} else {
|
||||||
|
delete annotations[HCI_ANNOTATIONS.VOLUME_MODE_ACCESS_MODES];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.cdiSettings.volumeSnapshotClass) {
|
if (this.cdiSettings.volumeSnapshotClass) {
|
||||||
annotations[HCI_ANNOTATIONS.VOLUME_SNAPSHOT_CLASS] = this.cdiSettings.volumeSnapshotClass;
|
annotations[HCI_ANNOTATIONS.VOLUME_SNAPSHOT_CLASS] = this.cdiSettings.volumeSnapshotClass;
|
||||||
|
} else {
|
||||||
|
delete annotations[HCI_ANNOTATIONS.VOLUME_SNAPSHOT_CLASS];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.cdiSettings.cloneStrategy) {
|
if (this.cdiSettings.cloneStrategy) {
|
||||||
annotations[HCI_ANNOTATIONS.CLONE_STRATEGY] = this.cdiSettings.cloneStrategy;
|
annotations[HCI_ANNOTATIONS.CLONE_STRATEGY] = this.cdiSettings.cloneStrategy;
|
||||||
|
} else {
|
||||||
|
delete annotations[HCI_ANNOTATIONS.CLONE_STRATEGY];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.cdiSettings.filesystemOverhead) {
|
if (this.cdiSettings.filesystemOverhead) {
|
||||||
annotations[HCI_ANNOTATIONS.FILESYSTEM_OVERHEAD] = this.cdiSettings.filesystemOverhead;
|
annotations[HCI_ANNOTATIONS.FILESYSTEM_OVERHEAD] = this.cdiSettings.filesystemOverhead;
|
||||||
|
} else {
|
||||||
|
delete annotations[HCI_ANNOTATIONS.FILESYSTEM_OVERHEAD];
|
||||||
}
|
}
|
||||||
|
|
||||||
this.value.metadata.annotations = annotations;
|
this.value.metadata.annotations = annotations;
|
||||||
|
|||||||
@@ -1164,6 +1164,13 @@ export default class VirtVm extends HarvesterResource {
|
|||||||
return this.t('harvester.virtualMachine.hotplug.restartVMMessage');
|
return this.t('harvester.virtualMachine.hotplug.restartVMMessage');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const restoreConditions = this.restoreResource?.status?.conditions || [];
|
||||||
|
const restoreError = restoreConditions.find((s) => s.error === true && s.reason === 'Error' && s.type === 'Ready');
|
||||||
|
|
||||||
|
if (restoreError?.message) {
|
||||||
|
return restoreError.message;
|
||||||
|
}
|
||||||
|
|
||||||
return this.ingoreVMMessage ? '' : super.stateDescription;
|
return this.ingoreVMMessage ? '' : super.stateDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "harvester",
|
"name": "harvester",
|
||||||
"description": "Rancher UI Extension for Harvester",
|
"description": "Rancher UI Extension for Harvester",
|
||||||
"version": "1.6.0-rc4",
|
"version": "1.6.0-rc5",
|
||||||
"private": false,
|
"private": false,
|
||||||
"rancher": {
|
"rancher": {
|
||||||
"annotations": {
|
"annotations": {
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ export const docLink = (suffix, version) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export function getVersion(v) {
|
export function getVersion(v) {
|
||||||
// e.g v1.4.0
|
|
||||||
if (process.env.VUE_APP_SERVER_VERSION) {
|
if (process.env.VUE_APP_SERVER_VERSION) {
|
||||||
return process.env.VUE_APP_SERVER_VERSION;
|
return process.env.VUE_APP_SERVER_VERSION;
|
||||||
}
|
}
|
||||||
@@ -18,20 +17,21 @@ export function getVersion(v) {
|
|||||||
return `v${ semver.major(v) }.${ semver.minor(v) }.${ semver.patch(v) }`;
|
return `v${ semver.major(v) }.${ semver.minor(v) }.${ semver.patch(v) }`;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// fallback to the latest version
|
// fallback to the latest version
|
||||||
return latestVersion(Object.keys(RELEASE_FEATURES));
|
return getLatestVersion();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function latestVersion(versions) {
|
function getLatestVersion() {
|
||||||
return versions.sort((a, b) => semver.compare(a, b)).pop();
|
const allVersions = Object.keys(RELEASE_FEATURES).filter(semver.valid).sort(semver.rcompare);
|
||||||
|
|
||||||
|
return allVersions[0] || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// v1.3.3 => latest v1.3.x, v1.4.2 => latest v1.4.x
|
function getLatestCompatibleVersion(version) {
|
||||||
function latestMinorVersion(v) {
|
const allVersions = Object.keys(RELEASE_FEATURES).filter(semver.valid);
|
||||||
const minor = `v${ semver.major(v) }.${ semver.minor(v) }`;
|
const compatible = allVersions.filter((v) => semver.lte(v, version)).sort(semver.rcompare);
|
||||||
const minorVersions = Object.keys(RELEASE_FEATURES).filter((version) => version.startsWith(minor));
|
|
||||||
|
|
||||||
return latestVersion(minorVersions);
|
return compatible[0] || getLatestVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
export const featureEnabled = (featureKey, serverVersion) => {
|
export const featureEnabled = (featureKey, serverVersion) => {
|
||||||
@@ -46,12 +46,16 @@ export const featureEnabled = (featureKey, serverVersion) => {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let releasedFeatures = RELEASE_FEATURES[version];
|
const compatibleVersion = getLatestCompatibleVersion(version);
|
||||||
|
const releasedFeatures = RELEASE_FEATURES?.[compatibleVersion];
|
||||||
|
|
||||||
if (!releasedFeatures) {
|
if (!Array.isArray(releasedFeatures)) {
|
||||||
const fallback = latestMinorVersion(version);
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(
|
||||||
|
`Feature flags for version ${ version } are not defined. Please upgrade Harvester UI extension and check the support matrix.`
|
||||||
|
);
|
||||||
|
|
||||||
releasedFeatures = RELEASE_FEATURES[fallback];
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return releasedFeatures.includes(featureKey);
|
return releasedFeatures.includes(featureKey);
|
||||||
|
|||||||
Reference in New Issue
Block a user