Skip to content

Commit

Permalink
add getServerVersion in harvester-common store
Browse files Browse the repository at this point in the history
  • Loading branch information
a110605 authored and torchiaf committed Nov 12, 2024
1 parent 5cc8a69 commit 86461e1
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pkg/harvester/components/UpgradeInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default {
},
upgradeLink() {
const version = this.$rootGetters['harvester-common/getServerVersion']();
const version = this.$store.getters['harvester-common/getServerVersion']();
return docLink(DOC.UPGRADE_URL, version);
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/harvester/components/settings/storage-network.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default {
computed: {
storageNetworkExampleLink() {
const version = this.$rootGetters['harvester-common/getServerVersion']();
const version = this.$store.getters['harvester-common/getServerVersion']();
return docLink(DOC.STORAGE_NETWORK_EXAMPLE, version);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default {
},
ksmtunedLink() {
const version = this.$rootGetters['harvester-common/getServerVersion']();
const version = this.$store.getters['harvester-common/getServerVersion']();
return docLink(DOC.KSMTUNED_MODE, version);
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/harvester/list/harvesterhci.io.host.vue
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export default {
},
consoleDocLink() {
const version = this.$rootGetters['harvester-common/getServerVersion']();
const version = this.$store.getters['harvester-common/getServerVersion']();
return docLink(DOC.CONSOLE_URL, version);
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/harvester/pages/c/_cluster/support/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default {
},
rancherIntegrationLink() {
const version = this.$rootGetters['harvester-common/getServerVersion']();
const version = this.$store.getters['harvester-common/getServerVersion']();
return docLink(DOC.RANCHER_INTEGRATION_URL, version);
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/harvester/store/harvester-common.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Parse from 'url-parse';
import { HCI } from '../types';
import { PRODUCT_NAME } from '../config/harvester';
import { featureEnabled, featureVersion } from '../utils/feature-flags';
import { featureEnabled, getVersion } from '../utils/feature-flags';

const state = function() {
return {
Expand Down Expand Up @@ -74,7 +74,7 @@ const getters = {
getServerVersion: (_state, _getters, _rootState, rootGetters) => () => {
const serverVersion = rootGetters['harvester/byId'](HCI.SETTING, 'server-version')?.value;

return featureVersion(serverVersion);
return getVersion(serverVersion);
},

getFeatureEnabled: (_state, _getters, _rootState, rootGetters) => (feature, version) => {
Expand Down
4 changes: 2 additions & 2 deletions pkg/harvester/utils/feature-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const docLink = (suffix, version) => {
return `https://docs.harvesterhci.io/${ docVersion }${ suffix }`;
};

export function featureVersion(v) {
export function getVersion(v) {
// e.g v1.4.0
if (process.env.VUE_APP_SERVER_VERSION) {
return process.env.VUE_APP_SERVER_VERSION;
Expand All @@ -22,7 +22,7 @@ export function featureVersion(v) {
}

export const featureEnabled = (featureKey, serverVersion) => {
const version = featureVersion(serverVersion);
const version = getVersion(serverVersion);
const releasedFeatures = RELEASE_FEATURES[version] || [];

return releasedFeatures.includes(featureKey);
Expand Down

0 comments on commit 86461e1

Please sign in to comment.