add version tag

This commit is contained in:
hay-kot 2021-03-28 16:11:12 -08:00
commit 91d132f612
3 changed files with 65 additions and 47 deletions

View file

@ -34,8 +34,8 @@
<AddRecipeFab v-if="loggedIn" /> <AddRecipeFab v-if="loggedIn" />
</v-slide-x-reverse-transition> </v-slide-x-reverse-transition>
<router-view></router-view> <router-view></router-view>
<FlashMessage :position="'right bottom'"></FlashMessage>
</v-main> </v-main>
<FlashMessage :position="'right bottom'"></FlashMessage>
</v-app> </v-app>
</template> </template>

View file

@ -72,6 +72,32 @@
<v-list-item-title>{{ nav.title }}</v-list-item-title> <v-list-item-title>{{ nav.title }}</v-list-item-title>
</v-list-item> </v-list-item>
</v-list> </v-list>
<v-list nav dense class="fixedBottom">
<v-list-item href="">
<v-list-item-icon class="mr-3 pt-1">
<v-icon :color="newVersionAvailable ? 'red--text' : ''">
mdi-information
</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>
{{ $t("settings.current") }}
{{ version }}
</v-list-item-title>
<v-list-item-subtitle>
<a
href="https://github.com/hay-kot/mealie/releases/latest"
target="_blank"
:class="newVersionAvailable ? 'red--text' : 'green--text'"
>
{{ $t("settings.latest") }}
{{ latestVersion }}
</a>
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
</v-list>
</v-navigation-drawer> </v-navigation-drawer>
</div> </div>
</template> </template>
@ -80,10 +106,14 @@
import { validators } from "@/mixins/validators"; import { validators } from "@/mixins/validators";
import { initials } from "@/mixins/initials"; import { initials } from "@/mixins/initials";
import { user } from "@/mixins/user"; import { user } from "@/mixins/user";
import api from "@/api";
import axios from "axios";
export default { export default {
mixins: [validators, initials, user], mixins: [validators, initials, user],
data() { data() {
return { return {
latestVersion: null,
version: null,
hideImage: false, hideImage: false,
showSidebar: false, showSidebar: false,
mobile: false, mobile: false,
@ -92,39 +122,39 @@ export default {
{ {
icon: "mdi-cog", icon: "mdi-cog",
to: "/admin/settings", to: "/admin/settings",
title: this.$t('settings.site-settings'), title: this.$t("settings.site-settings"),
}, },
{ {
icon: "mdi-account-group", icon: "mdi-account-group",
to: "/admin/manage-users", to: "/admin/manage-users",
title: this.$t('settings.manage-users'), title: this.$t("settings.manage-users"),
}, },
{ {
icon: "mdi-backup-restore", icon: "mdi-backup-restore",
to: "/admin/backups", to: "/admin/backups",
title: this.$t('settings.backup-and-exports'), title: this.$t("settings.backup-and-exports"),
}, },
{ {
icon: "mdi-database-import", icon: "mdi-database-import",
to: "/admin/migrations", to: "/admin/migrations",
title: this.$t('settings.migrations'), title: this.$t("settings.migrations"),
}, },
], ],
baseLinks: [ baseLinks: [
{ {
icon: "mdi-account", icon: "mdi-account",
to: "/admin/profile", to: "/admin/profile",
title: this.$t('settings.profile'), title: this.$t("settings.profile"),
}, },
{ {
icon: "mdi-format-color-fill", icon: "mdi-format-color-fill",
to: "/admin/themes", to: "/admin/themes",
title: this.$t('general.themes'), title: this.$t("general.themes"),
}, },
{ {
icon: "mdi-food", icon: "mdi-food",
to: "/admin/meal-planner", to: "/admin/meal-planner",
title: this.$t('meal-plan.meal-planner'), title: this.$t("meal-plan.meal-planner"),
}, },
], ],
}; };
@ -132,12 +162,18 @@ export default {
async mounted() { async mounted() {
this.mobile = this.viewScale(); this.mobile = this.viewScale();
this.showSidebar = !this.viewScale(); this.showSidebar = !this.viewScale();
this.getVersion();
let versionData = await api.meta.get_version();
this.version = versionData.version;
}, },
computed: { computed: {
userProfileImage() { userProfileImage() {
return `api/users/${this.user.id}/image`; return `api/users/${this.user.id}/image`;
}, },
newVersionAvailable() {
return this.latestVersion == this.version ? false : true;
},
}, },
methods: { methods: {
@ -151,9 +187,26 @@ export default {
return false; return false;
} }
}, },
async getVersion() {
let response = await axios.get(
"https://api.github.com/repos/hay-kot/mealie/releases/latest",
{
headers: {
"content-type": "application/json",
Authorization: null,
},
}
);
this.latestVersion = response.data.tag_name;
},
}, },
}; };
</script> </script>
<style> <style>
.fixedBottom {
position: fixed !important;
bottom: 0 !important;
width: 100%;
}
</style> </style>

View file

@ -1,12 +1,12 @@
<template> <template>
<div> <div>
<v-container height="100%"> <v-container>
<AdminSidebar />
<v-slide-x-transition hide-on-leave> <v-slide-x-transition hide-on-leave>
<router-view></router-view> <router-view></router-view>
</v-slide-x-transition> </v-slide-x-transition>
<AdminSidebar />
</v-container> </v-container>
<!-- <v-footer absolute> <!-- <v-footer relative padding>
<div class="flex text-center" cols="12"> <div class="flex text-center" cols="12">
{{ $t("settings.current") }} {{ $t("settings.current") }}
{{ version }} | {{ version }} |
@ -30,46 +30,11 @@
<script> <script>
import AdminSidebar from "@/components/Admin/AdminSidebar"; import AdminSidebar from "@/components/Admin/AdminSidebar";
import axios from "axios";
import api from "@/api";
export default { export default {
components: { components: {
AdminSidebar, AdminSidebar,
}, },
data() {
return {
latestVersion: null,
version: null,
};
},
async mounted() {
this.getVersion();
let versionData = await api.meta.get_version();
this.version = versionData.version;
},
computed: {
newVersion() {
if ((this.latestVersion != null) & (this.latestVersion != this.version)) {
return true;
} else {
return false;
}
},
},
methods: {
async getVersion() {
let response = await axios.get(
"https://api.github.com/repos/hay-kot/mealie/releases/latest",
{
headers: {
"content-type": "application/json",
Authorization: null,
},
}
);
this.latestVersion = response.data.tag_name;
},
},
}; };
</script> </script>