mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-07-16 09:38:49 +02:00
feat:#72 add footer and commit id injection
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@ workspace.xml
|
|||||||
**/.idea/
|
**/.idea/
|
||||||
.sass-cache/
|
.sass-cache/
|
||||||
/services/pb_data/
|
/services/pb_data/
|
||||||
|
.env
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
docker build --pull \
|
docker build --pull \
|
||||||
-t $IMAGE_TAG \
|
-t $IMAGE_TAG \
|
||||||
-f $DOCKERFILE \
|
-f $DOCKERFILE \
|
||||||
|
--build-arg COMMIT_HASH=$CI_COMMIT_SHORT_SHA \
|
||||||
--target $BUILD_TARGET \
|
--target $BUILD_TARGET \
|
||||||
$BUILD_PATH
|
$BUILD_PATH
|
||||||
- docker push "$IMAGE_TAG"
|
- docker push "$IMAGE_TAG"
|
||||||
|
@ -43,6 +43,8 @@ services:
|
|||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
context: ./frontend
|
context: ./frontend
|
||||||
target: prod
|
target: prod
|
||||||
|
args:
|
||||||
|
- COMMIT_HASH=${COMMIT_HASH}
|
||||||
# open port 8000
|
# open port 8000
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
|
@ -17,17 +17,25 @@
|
|||||||
# build stage
|
# build stage
|
||||||
FROM docker.io/node:lts-alpine AS build
|
FROM docker.io/node:lts-alpine AS build
|
||||||
|
|
||||||
|
ARG COMMIT_HASH
|
||||||
|
ENV COMMIT_HASH=$COMMIT_HASH
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm ci
|
RUN npm ci
|
||||||
COPY / ./
|
COPY / ./
|
||||||
|
RUN echo "COMMIT_HASH=$COMMIT_HASH" >> .env.commit
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# development stage
|
# development stage
|
||||||
FROM docker.io/node:lts-alpine AS dev
|
FROM docker.io/node:lts-alpine AS dev
|
||||||
|
|
||||||
|
ARG COMMIT_HASH
|
||||||
|
ENV COMMIT_HASH=$COMMIT_HASH
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
|
RUN echo "COMMIT_HASH=$COMMIT_HASH" >> .env.commit
|
||||||
RUN npm install
|
RUN npm install
|
||||||
COPY . ./
|
COPY . ./
|
||||||
|
|
||||||
|
@ -664,7 +664,7 @@ $contrastMessageTextColor: $contrastButtonTextColor !default;
|
|||||||
$contrastMessageIconColor: $contrastButtonTextColor !default;
|
$contrastMessageIconColor: $contrastButtonTextColor !default;
|
||||||
|
|
||||||
//overlays
|
//overlays
|
||||||
$overlayContentBorder: 0 none !default;
|
$overlayContentBorder: 0px solid $shade300 !default;
|
||||||
$overlayContentBg: $panelContentBg !default;
|
$overlayContentBg: $panelContentBg !default;
|
||||||
$overlayContainerShadow: 0 1px 3px rgba(0, 0, 0, 0.3) !default;
|
$overlayContainerShadow: 0 1px 3px rgba(0, 0, 0, 0.3) !default;
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -18,6 +18,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import MenuBar from "./components/MenuBar.vue";
|
import MenuBar from "./components/MenuBar.vue";
|
||||||
|
import Footer from "./components/Footer.vue";
|
||||||
import { RouteRecordName, RouterView, useRoute, useRouter } from "vue-router";
|
import { RouteRecordName, RouterView, useRoute, useRouter } from "vue-router";
|
||||||
import { useHead, useServerHead, useServerSeoMeta } from "@unhead/vue";
|
import { useHead, useServerHead, useServerSeoMeta } from "@unhead/vue";
|
||||||
import CalendarPreview from "./components/CalendarPreview.vue";
|
import CalendarPreview from "./components/CalendarPreview.vue";
|
||||||
@ -27,6 +28,7 @@ import { VueQueryDevtools } from "@tanstack/vue-query-devtools";
|
|||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
const { t } = useI18n({ useScope: "global" });
|
const { t } = useI18n({ useScope: "global" });
|
||||||
|
|
||||||
|
// Pages to be disabled for the calendar preview
|
||||||
const disabledPages = [
|
const disabledPages = [
|
||||||
"room-finder",
|
"room-finder",
|
||||||
"faq",
|
"faq",
|
||||||
@ -116,6 +118,8 @@ if (!import.meta.env.SSR) window.addEventListener("resize", updateMobile);
|
|||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
</RouterView>
|
</RouterView>
|
||||||
|
<!-- show footer with development information -->
|
||||||
|
<Footer />
|
||||||
<!-- show CalendarPreview but only on specific router views -->
|
<!-- show CalendarPreview but only on specific router views -->
|
||||||
<CalendarPreview v-if="isDisabled(route.name)" />
|
<CalendarPreview v-if="isDisabled(route.name)" />
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ const columns = computed(() => [
|
|||||||
</Dialog>
|
</Dialog>
|
||||||
<SpeedDial
|
<SpeedDial
|
||||||
v-if="previewOn && !dialogVisible"
|
v-if="previewOn && !dialogVisible"
|
||||||
:style="{ position: 'fixed', bottom: '2rem', left: '2rem' }"
|
:style="{ position: 'fixed', bottom: '3rem', left: '2rem' }"
|
||||||
>
|
>
|
||||||
<template #button>
|
<template #button>
|
||||||
<Button
|
<Button
|
||||||
|
92
frontend/src/components/Footer.vue
Normal file
92
frontend/src/components/Footer.vue
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
<!--
|
||||||
|
Calendar implementation for the HTWK Leipzig timetable. Evaluation and display of the individual dates in iCal format.
|
||||||
|
Copyright (C) 2024 HTWKalender support@htwkalender.de
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { computed, ref } from "vue";
|
||||||
|
import { useI18n } from "vue-i18n";
|
||||||
|
import OverlayPanel from "primevue/overlaypanel";
|
||||||
|
const { t } = useI18n({ useScope: "global" });
|
||||||
|
|
||||||
|
const commit = computed(() => ([
|
||||||
|
{
|
||||||
|
name: t("footer.commitInfo.components.frontend"),
|
||||||
|
value: __COMMIT_HASH__,
|
||||||
|
},
|
||||||
|
//{
|
||||||
|
// name: t("footer.commitInfo.components.backend"),
|
||||||
|
// value: import.meta.env.BACKEND_COMMIT_HASH || "unknown",
|
||||||
|
//},
|
||||||
|
]));
|
||||||
|
|
||||||
|
const commitOverlay = ref<OverlayPanel | null>(null);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Menubar class="footer-bar justify-content-between flex-wrap">
|
||||||
|
<template #start>
|
||||||
|
<div class="flex align-items-stretch justify-content-center">
|
||||||
|
<Button
|
||||||
|
severity="primary"
|
||||||
|
class="p-button-text p-button-sm"
|
||||||
|
icon="pi pi-fw pi-hashtag"
|
||||||
|
v-tooltip="t('footer.commitInfo.tooltip')"
|
||||||
|
@click="commitOverlay?.toggle($event)"
|
||||||
|
>
|
||||||
|
</Button>
|
||||||
|
<OverlayPanel class="overlay-panel" ref="commitOverlay" :showCloseIcon="true" :dismissable="true">
|
||||||
|
<div class="flex flex-column w-25rem">
|
||||||
|
<b>{{ t('footer.commitInfo.title') }}</b>
|
||||||
|
<p>{{ t('footer.commitInfo.description') }}</p>
|
||||||
|
<DataTable
|
||||||
|
id="commit-table"
|
||||||
|
:value="commit"
|
||||||
|
:paginator="false"
|
||||||
|
:rows="commit.length"
|
||||||
|
class="w-full"
|
||||||
|
>
|
||||||
|
<Column field="name" :header="t('footer.commitInfo.component')" />
|
||||||
|
<Column field="value" :header="t('footer.commitInfo.hash')" />
|
||||||
|
</DataTable>
|
||||||
|
</div>
|
||||||
|
</OverlayPanel>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</Menubar>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.footer-bar {
|
||||||
|
background-color: transparent;
|
||||||
|
border: none;
|
||||||
|
box-shadow: none;
|
||||||
|
margin: 0;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-bar > * {
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.overlay-panel {
|
||||||
|
background: yellow;
|
||||||
|
}
|
||||||
|
</style>
|
@ -272,5 +272,17 @@
|
|||||||
},
|
},
|
||||||
"notFound": "Nicht gefunden, wonach du suchst?",
|
"notFound": "Nicht gefunden, wonach du suchst?",
|
||||||
"contact": "Kontakt aufnehmen"
|
"contact": "Kontakt aufnehmen"
|
||||||
|
},
|
||||||
|
"footer": {
|
||||||
|
"commitInfo": {
|
||||||
|
"tooltip": "Version",
|
||||||
|
"title": "Version",
|
||||||
|
"description": "Zeigt die Commit-ID der verwendeten Frontend-Version des HTWKalenders an. Für Debbugger und Entwickler.",
|
||||||
|
"hash": "Commit-Hash",
|
||||||
|
"component": "Komponente",
|
||||||
|
"components":{
|
||||||
|
"frontend": "Frontend"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -272,5 +272,17 @@
|
|||||||
},
|
},
|
||||||
"notFound": "Not finding what you're looking for?",
|
"notFound": "Not finding what you're looking for?",
|
||||||
"contact": "Get in touch"
|
"contact": "Get in touch"
|
||||||
|
},
|
||||||
|
"footer": {
|
||||||
|
"commitInfo": {
|
||||||
|
"tooltip": "application version",
|
||||||
|
"title": "application version",
|
||||||
|
"description": "Shows the commit id of the deployed frontend version of the HTWKalender. For debuggers and developers.",
|
||||||
|
"hash": "commit hash",
|
||||||
|
"component": "component",
|
||||||
|
"components":{
|
||||||
|
"frontend": "frontend"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,8 @@ import ProgressSpinner from "primevue/progressspinner";
|
|||||||
import Checkbox from "primevue/checkbox";
|
import Checkbox from "primevue/checkbox";
|
||||||
import Skeleton from "primevue/skeleton";
|
import Skeleton from "primevue/skeleton";
|
||||||
import Calendar from "primevue/calendar";
|
import Calendar from "primevue/calendar";
|
||||||
|
import OverlayPanel from "primevue/overlaypanel";
|
||||||
|
import Tooltip from "primevue/tooltip";
|
||||||
import i18n from "./i18n";
|
import i18n from "./i18n";
|
||||||
import { VueQueryPlugin } from "@tanstack/vue-query";
|
import { VueQueryPlugin } from "@tanstack/vue-query";
|
||||||
import { Router } from "vue-router";
|
import { Router } from "vue-router";
|
||||||
@ -144,6 +146,8 @@ export const createApp = ViteSSG(
|
|||||||
app.component("Checkbox", Checkbox);
|
app.component("Checkbox", Checkbox);
|
||||||
app.component("Skeleton", Skeleton);
|
app.component("Skeleton", Skeleton);
|
||||||
app.component("Calendar", Calendar);
|
app.component("Calendar", Calendar);
|
||||||
|
app.component("OverlayPanel", OverlayPanel);
|
||||||
|
app.directive("tooltip", Tooltip);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
3
frontend/src/vite-env.d.ts
vendored
3
frontend/src/vite-env.d.ts
vendored
@ -15,3 +15,6 @@
|
|||||||
//along with this program. If not, see <https://www.gnu.org/licenses/>.
|
//along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
/// <reference types="vite/client" />
|
/// <reference types="vite/client" />
|
||||||
|
|
||||||
|
// __COMMIT_HASH__ is replaced by the commit hash at build time
|
||||||
|
declare const __COMMIT_HASH__: string;
|
||||||
|
@ -23,9 +23,18 @@ import terser from "@rollup/plugin-terser";
|
|||||||
import generateSitemap from "vite-ssg-sitemap";
|
import generateSitemap from "vite-ssg-sitemap";
|
||||||
import vueDevTools from "vite-plugin-vue-devtools";
|
import vueDevTools from "vite-plugin-vue-devtools";
|
||||||
import { ViteSSGOptions } from "vite-ssg";
|
import { ViteSSGOptions } from "vite-ssg";
|
||||||
|
import fs from "fs";
|
||||||
|
|
||||||
const hostname = "https://cal.htwk-leipzig.de";
|
const hostname = "https://cal.htwk-leipzig.de";
|
||||||
|
|
||||||
|
// fallback
|
||||||
|
let commitHash = "unknown"
|
||||||
|
if (fs.existsSync('.env.commit')) {
|
||||||
|
const env = fs.readFileSync('.env.commit', 'utf-8')
|
||||||
|
const match = env.match(/COMMIT_HASH=(.+)/)
|
||||||
|
if (match) commitHash = match[1]
|
||||||
|
}
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [vue(), resolve(), terser(), vueDevTools()],
|
plugins: [vue(), resolve(), terser(), vueDevTools()],
|
||||||
@ -45,6 +54,9 @@ export default defineConfig({
|
|||||||
".scss",
|
".scss",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
define: {
|
||||||
|
__COMMIT_HASH__: JSON.stringify(commitHash),
|
||||||
|
},
|
||||||
ssgOptions: <ViteSSGOptions>{
|
ssgOptions: <ViteSSGOptions>{
|
||||||
script: "async",
|
script: "async",
|
||||||
formatting: "minify",
|
formatting: "minify",
|
||||||
|
Reference in New Issue
Block a user