Add unsupported server version check

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
Francesco Torchia 2024-12-01 15:13:19 +01:00
parent b8a1403655
commit 9a89f45a2a
No known key found for this signature in database
GPG Key ID: E6D011B7415D4393
4 changed files with 120 additions and 0 deletions

View File

@ -39,6 +39,11 @@ generic:
basic: Basic
loading: Loading...
unsupported:
serverVersion: 'Current version: <code>{serverVersion}</code>'
description: Harvester ui only supports Harvester cluster versions greater or equal to 1.3.0
learnMore: Learn more about Harvester from the <a target="_blank" href="https://harvesterhci.io/" rel="noopener noreferrer nofollow">Harvester Web Site</a> or read the <a target="_blank" href="https://docs.harvesterhci.io/" rel="noopener noreferrer nofollow">Harvester Docs</a>
nav:
group:
networks: Networks

View File

@ -0,0 +1,85 @@
<script>
import BrandImage from '@shell/components/BrandImage';
export default {
components: { BrandImage },
computed: {
serverVersion() {
const version = this.$store.getters['harvester-common/getServerVersion']() || '';
return version.replace('v', '');
}
}
};
</script>
<template>
<div class="dashboard-root">
<div class="dashboard-content">
<main class="main-layout">
<div class="logo">
<BrandImage
file-name="harvester.png"
height="64"
/>
</div>
<div class="tagline">
<div class="description">
{{ t('unsupported.description') }}
</div>
</div>
<div class="tagline">
<div v-clean-html="t('unsupported.serverVersion', { serverVersion }, true)" />
</div>
<div class="tagline">
<div v-clean-html="t('unsupported.learnMore', {}, true)" />
</div>
</main>
</div>
</div>
</template>
<style lang="scss" scoped>
.dashboard-root {
display: flex;
flex-direction: column;
height: 100vh;
}
.dashboard-content {
display: grid;
flex-grow:1;
grid-template-areas:
"main";
grid-template-columns: auto;
grid-template-rows: auto;
}
.logo {
display: flex;
justify-content: center;
margin: 200px 0 40px 0;
}
.tagline {
display: flex;
justify-content: center;
margin-top: 30px;
> div {
font-size: 16px;
line-height: 22px;
max-width: 80%;
text-align: center;
}
}
.description {
font-size: 24px !important;
font-weight: 400;
}
</style>

View File

@ -15,8 +15,25 @@ import HarvesterAirgapUpdgrade from '../pages/c/_cluster/airgapupgrade/index.vue
import HarvesterMembers from '../pages/c/_cluster/members/index.vue';
import ProjectNamespaces from '../pages/c/_cluster/projectsnamespaces.vue';
import HarvesterAlertmanagerReceiver from '../pages/c/_cluster/alertmanagerconfig/_alertmanagerconfigid/receiver.vue';
import HarvesterUnsupported from '../pages/c/_cluster/unsupported/index.vue';
const routes = [
{
route: {
name: `${ PRODUCT_NAME }-c-cluster-unsupported-standalone`,
path: `/:product`,
component: HarvesterUnsupported
},
parent: 'blank'
},
{
route: {
name: `${ PRODUCT_NAME }-c-cluster-unsupported`,
path: `/:product`,
component: HarvesterUnsupported
},
parent: 'plain'
},
{
name: `${ PRODUCT_NAME }-c-cluster-support`,
path: `/:product/c/:cluster/support`,

View File

@ -101,6 +101,19 @@ export default {
const res: any = await allHash(hash);
const isHarvesterVersionSupported = rootGetters['harvester-common/getFeatureEnabled']('supportHarvesterClusterVersion');
if (!isHarvesterVersionSupported) {
const product = rootGetters['productId'];
this.$router?.push({
name: `${ product }-c-cluster-unsupported${ id === 'local' ? '-standalone' : '' }`,
params: { product }
});
return;
}
await dispatch('cleanNamespaces', null, { root: true });
commit('updateNamespaces', {