Skip to content

Commit 3d471d1

Browse files
authored
Merge pull request #393 from epinio/feat/about-page
feat: about page conversion
2 parents c781e00 + 16ce891 commit 3d471d1

3 files changed

Lines changed: 175 additions & 3 deletions

File tree

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
<script setup lang="ts">
2+
import { onMounted, ref, computed } from 'vue';
3+
import { useStore } from 'vuex';
4+
import { MANAGEMENT } from '@shell/config/types';
5+
import { getVendor } from '@shell/config/private-label';
6+
7+
const store = useStore();
8+
9+
const version = ref<any>(null);
10+
const settings = ref<any[]>([]);
11+
12+
const t = store.getters['i18n/t'];
13+
14+
const aboutVersionsComponentString = computed(() => t('about.versions.component'));
15+
const aboutTitleString = computed(() => t('about.title'));
16+
const aboutVersionsVersionString = computed(() => t('about.versions.version'));
17+
const aboutDownloadCLIString = computed(() => t('about.downloadCLI.title'));
18+
const allPackagesString = computed(() => t('epinio.about.allPackages'));
19+
20+
21+
const fetchData = async () => {
22+
settings.value = await store.dispatch(`management/findAll`, { type: MANAGEMENT.SETTING });
23+
version.value = await store.dispatch('epinio/version');
24+
};
25+
26+
onMounted(fetchData);
27+
28+
const appName = computed(() => {
29+
const isSingleProduct = !!store.getters['isSingleProduct'];
30+
return isSingleProduct ? getVendor() : t('epinio.label');
31+
});
32+
33+
function createOSOption(label: string, icon: string, cliLink: string, imageList: any = null) {
34+
const slash = cliLink?.lastIndexOf('/');
35+
return {
36+
label,
37+
icon,
38+
imageList,
39+
cliLink,
40+
cliFile: slash >= 0 ? cliLink.substr(slash + 1) : cliLink
41+
};
42+
}
43+
44+
const downloads = computed(() => {
45+
if (!version.value) {
46+
return [];
47+
}
48+
49+
const gitUrl = `https://github.com/epinio/epinio/releases/download`;
50+
const versionStr = version.value.displayVersion;
51+
const app = appName.value.toLowerCase();
52+
53+
return [
54+
createOSOption('about.os.mac', 'icon-apple', `${gitUrl}/${versionStr}/${app}-darwin-x86_64`),
55+
createOSOption('about.os.linux', 'icon-linux', `${gitUrl}/${versionStr}/${app}-linux-x86_64`, downloadLinuxImages),
56+
createOSOption('about.os.windows', 'icon-windows', `${gitUrl}/${versionStr}/${app}-windows-x86_64.zip`)
57+
];
58+
});
59+
60+
const downloadLinuxImages = null;
61+
62+
const versionString = computed(() => {
63+
if (!version.value) return '';
64+
if (version.value.displayVersion === version.value.fullVersion) {
65+
return version.value.displayVersion;
66+
}
67+
return version.value.fullVersion;
68+
});
69+
70+
</script>
71+
72+
<template>
73+
<div class="about">
74+
<template v-if="version">
75+
<h1>
76+
{{ aboutTitleString }}
77+
</h1>
78+
<table>
79+
<thead>
80+
<tr>
81+
<th>{{ aboutVersionsComponentString }}</th>
82+
<th>{{ aboutVersionsVersionString }}</th>
83+
</tr>
84+
</thead>
85+
<tr v-if="version">
86+
<td>
87+
<a
88+
href="https://github.com/epinio/epinio"
89+
target="_blank"
90+
rel="nofollow noopener noreferrer"
91+
>
92+
{{ appName }}
93+
</a>
94+
</td>
95+
<td>{{ versionString }}</td>
96+
</tr>
97+
</table>
98+
</template>
99+
100+
<template v-if="version && downloads.length">
101+
<h3 class="pt-40">
102+
{{ aboutDownloadCLIString }}
103+
</h3>
104+
<table>
105+
<tr
106+
v-for="d in downloads"
107+
:key="d.icon"
108+
class="link"
109+
>
110+
<td>
111+
<div class="os">
112+
<i :class="`icon ${d.icon} mr-5`" /> {{ t(d.label) }}
113+
</div>
114+
</td>
115+
<td>
116+
<a
117+
v-if="d.cliLink"
118+
:href="d.cliLink"
119+
>{{ d.cliFile }}</a>
120+
</td>
121+
</tr>
122+
</table>
123+
</template>
124+
125+
<template v-if="version">
126+
<a
127+
class="mt-5"
128+
target="_blank"
129+
:href="`https://github.com/epinio/epinio/releases/tag/${version.displayVersion}`"
130+
>
131+
{{ allPackagesString }}
132+
</a>
133+
</template>
134+
</div>
135+
</template>
136+
137+
<style lang="scss" scoped>
138+
.about {
139+
table {
140+
border-collapse: collapse;
141+
overflow: hidden;
142+
border-radius: var(--border-radius);
143+
144+
tr > td:first-of-type {
145+
width: 20%;
146+
}
147+
148+
th, td {
149+
border: 1px solid var(--border);
150+
padding: 8px 5px;
151+
min-width: 150px;
152+
text-align: left;
153+
}
154+
155+
th {
156+
background-color: var(--sortable-table-top-divider);
157+
border-bottom: 1px solid var(--sortable-table-top-divider);
158+
}
159+
160+
a {
161+
cursor: pointer;
162+
}
163+
164+
.os {
165+
display: flex;
166+
align-items: center;
167+
}
168+
}
169+
}
170+
</style>

dashboard/pkg/epinio/pages/index.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ let currentCluster: EpinioCluster | null = null;
2020
let clusters: EpinioCluster[] = [];
2121
let clustersSchema: any = null;
2222
23-
// const { t } = useI18n();
23+
24+
const t = store.getters['i18n/t'];
25+
2426
2527
const loading = ref(true);
2628
@@ -31,7 +33,6 @@ onMounted(async () => {
3133
clusters = store.getters[`${EPINIO_MGMT_STORE}/all`](EPINIO_TYPES.CLUSTER)
3234
clustersSchema = store.getters[`${EPINIO_MGMT_STORE}/schemaFor`](EPINIO_TYPES.CLUSTER)
3335
34-
console.log('Clusters:', clusters)
3536
clusters.forEach((c: EpinioCluster) => testCluster(c))
3637
} catch (err) {
3738
error.value = err as Error

dashboard/pkg/epinio/routing/epinio-routing.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Don't forget to create a VueJS page called index.vue in the /pages folder!!!
22
import ListEpinio from "../pages/index.vue";
33
import Dashboard from "../pages/c/_cluster/dashboard.vue";
4+
import AboutEpinio from "../pages/c/_cluster/about.vue";
45
// import { BLANK_CLUSTER } from '../config/epinio';
56
import { EPINIO_PRODUCT_NAME } from '../types';
67

@@ -56,7 +57,7 @@ const routes = [
5657
{
5758
name: `${EPINIO_PRODUCT_NAME}-c-cluster-about`,
5859
path: `/:product/c/:cluster/about`,
59-
component: ListEpinio, //AboutEpinio,
60+
component: AboutEpinio,
6061
meta,
6162
},
6263
{

0 commit comments

Comments
 (0)