feature/#42-display-version #51

Merged
jkeffects merged 4 commits from feature/#42-display-version into develop 2025-01-23 10:59:18 +00:00
6 changed files with 166 additions and 4 deletions
Showing only changes of commit e4c6ae836d - Show all commits

View file

@ -652,6 +652,11 @@ const router = createRouter({
name: "account-administration",
component: () => import("@/views/account/Administration.vue"),
},
{
path: "version",
name: "account-version",
component: () => import("@/views/account/VersionDisplay.vue"),
},
{
path: ":pathMatch(.*)*",
name: "account-404",

View file

@ -0,0 +1,21 @@
export interface Release {
creator: string;
title: string;
link: string;
pubDate: string;
author: string;
"content:encoded": string;
"content:encodedSnippet": string;
content: string;
contentSnippet: string;
guid: string;
isoDate: string;
}
export interface Releases {
items: Release[];
title: string;
description: string;
pubDate: string;
link: string;
}

View file

@ -15,7 +15,9 @@
<div class="relative mt-1">
<ComboboxInput
class="rounded-md shadow-sm relative block w-full px-3 py-2 border border-gray-300 focus:border-primary placeholder-gray-500 text-gray-900 rounded-b-md focus:outline-none focus:ring-0 focus:z-10 sm:text-sm resize-none"
:displayValue="(person) => person.firstname + ' ' + person.lastname"
:displayValue="
(person) => (person as UserViewModel)?.firstname + ' ' + (person as UserViewModel)?.lastname
"
@input="query = $event.target.value"
/>
<ComboboxButton class="absolute inset-y-0 right-0 flex items-center pr-2">

View file

@ -0,0 +1,124 @@
<template>
<MainTemplate :useStagedOverviewLink="false">
<template #topBar>
<div class="flex flex-row items-center justify-between pt-5 pb-3 px-7">
<h1 class="font-bold text-xl h-8">Versions-Kontrolle</h1>
</div>
</template>
<template #diffMain>
<div class="h-full flex flex-col gap-4 px-7 overflow-hidden">
<div class="h-1/2 flex flex-col gap-2 p-2 border border-gray-300 rounded-md">
<div class="flex flex-row justify-between border-b-2 border-gray-300">
<h1 class="text-lg font-semibold">Client</h1>
<p>V{{ clientVersion }}</p>
</div>
<div class="grow flex flex-col gap-2 overflow-y-scroll">
{{ newerClientVersions }}
</div>
</div>
<div class="h-1/2 flex flex-col gap-2 p-2 border border-gray-300 rounded-md">
<div class="flex flex-row justify-between border-b-2 border-gray-300">
<h1 class="text-lg font-semibold">Server</h1>
<p>V{{ serverVersion }}</p>
</div>
<div class="grow flex flex-col gap-2 overflow-y-scroll">
{{ newerServerVersions }}
</div>
</div>
</div>
</template>
</MainTemplate>
</template>
<script setup lang="ts">
import { defineComponent } from "vue";
import MainTemplate from "@/templates/Main.vue";
import clientPackage from "../../../package.json";
import type { Releases } from "../../viewmodels/version.models";
</script>
<script lang="ts">
export default defineComponent({
data() {
return {
serverVersion: "" as string,
serverRss: null as null | Releases,
clientVersion: "" as string,
clientRss: null as null | Releases,
};
},
computed: {
newerServerVersions() {
if (!this.serverRss) return [];
return this.serverRss.items.filter((i) => this.compareVersionStrings(this.serverVersion, i.title) < 0);
},
newerClientVersions() {
if (!this.clientRss) return [];
return this.clientRss.items.filter((i) => this.compareVersionStrings(this.clientVersion, i.title) < 0);
},
},
mounted() {
this.clientVersion = clientPackage.version;
this.getServerVersion();
this.getServerFeed();
this.getClientFeed();
},
methods: {
getServerVersion() {
this.$http
.get("/server/version")
.then((res) => {
this.serverVersion = res.data.version;
})
.catch(() => {});
},
async getServerFeed() {
this.$http
.get("/server/serverrss")
.then((res) => {
this.serverRss = res.data;
})
.catch(() => {});
},
async getClientFeed() {
this.$http
.get("/server/clientrss")
.then((res) => {
this.clientRss = res.data;
})
.catch(() => {});
},
compareVersionStrings(activeVersion: string, compareVersion: string) {
const parseVersion = (version: string) => {
const [main, tag] = version.split("-");
const [major, minor, patch] = main.split(".").map(Number);
return { major, minor, patch, tag };
};
if (!activeVersion || !compareVersion) return 0;
const versionA = parseVersion(activeVersion);
const versionB = parseVersion(compareVersion);
if (versionA.major !== versionB.major) {
return versionA.major - versionB.major;
}
if (versionA.minor !== versionB.minor) {
return versionA.minor - versionB.minor;
}
if (versionA.patch !== versionB.patch) {
return versionA.patch - versionB.patch;
}
if (versionA.tag && !versionB.tag) return -1;
if (!versionA.tag && versionB.tag) return 1;
if (versionA.tag && versionB.tag) {
const tags = ["alpha", "beta", ""];
return tags.indexOf(versionA.tag) - tags.indexOf(versionB.tag);
}
return 0;
},
},
});
</script>

View file

@ -1,13 +1,22 @@
<template>
<SidebarLayout>
<template #sidebar>
<SidebarTemplate mainTitle="Mein Account" :topTitle="config.app_name_overwrite || 'FF Admin'" :showTopList="isOwner">
<SidebarTemplate
mainTitle="Mein Account"
:topTitle="config.app_name_overwrite || 'FF Admin'"
:showTopList="isOwner"
>
<template v-if="isOwner" #topList>
<RoutingLink
title="Administration"
:link="{ name: 'account-administration' }"
:active="activeRouteName == 'account-administration'"
/>
<RoutingLink
title="Versions-Verwaltung"
:link="{ name: 'account-version' }"
:active="activeRouteName == 'account-version'"
/>
</template>
<template #list>
<RoutingLink title="Mein Account" :link="{ name: 'account-me' }" :active="activeRouteName == 'account-me'" />
@ -38,7 +47,7 @@ import SidebarTemplate from "@/templates/Sidebar.vue";
import RoutingLink from "@/components/admin/RoutingLink.vue";
import { RouterView } from "vue-router";
import { useAbilityStore } from "@/stores/ability";
import { config } from "@/config"
import { config } from "@/config";
</script>
<script lang="ts">

View file

@ -1,9 +1,10 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue", "config.example.ts", "config.ts"],
"include": ["env.d.ts", "src/**/*", "src/**/*.vue", "package.json", "config.example.ts", "config.ts"],
"exclude": ["src/**/__tests__/*"],
"compilerOptions": {
"composite": true,
"resolveJsonModule": true,
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"baseUrl": ".",