API & Client - get application version from API

This commit is contained in:
Sam 2021-11-01 10:33:34 +01:00
parent 7f6f33a6aa
commit 9380034d37
14 changed files with 36 additions and 13 deletions

View File

@ -11,6 +11,7 @@ from flask_sqlalchemy import SQLAlchemy
from fittrackee.emails.email import Email from fittrackee.emails.email import Email
VERSION = __version__ = '0.4.9'
db = SQLAlchemy() db = SQLAlchemy()
bcrypt = Bcrypt() bcrypt = Bcrypt()
migrate = Migrate() migrate = Migrate()

View File

@ -44,6 +44,7 @@ def get_application_config() -> Union[Dict, HttpResponse]:
"max_zip_file_size": 10485760, "max_zip_file_size": 10485760,
"max_users": 0, "max_users": 0,
"map_attribution": "&copy; <a href=http://www.openstreetmap.org/copyright>OpenStreetMap</a> contributors" "map_attribution": "&copy; <a href=http://www.openstreetmap.org/copyright>OpenStreetMap</a> contributors"
"version": "0.4.9"
}, },
"status": "success" "status": "success"
} }

View File

@ -7,7 +7,7 @@ from sqlalchemy.ext.declarative import DeclarativeMeta
from sqlalchemy.orm.mapper import Mapper from sqlalchemy.orm.mapper import Mapper
from sqlalchemy.orm.session import Session from sqlalchemy.orm.session import Session
from fittrackee import db from fittrackee import VERSION, db
from fittrackee.users.models import User from fittrackee.users.models import User
BaseModel: DeclarativeMeta = db.Model BaseModel: DeclarativeMeta = db.Model
@ -40,6 +40,7 @@ class AppConfig(BaseModel):
'max_zip_file_size': self.max_zip_file_size, 'max_zip_file_size': self.max_zip_file_size,
'max_users': self.max_users, 'max_users': self.max_users,
'map_attribution': self.map_attribution, 'map_attribution': self.map_attribution,
'version': VERSION,
} }

View File

@ -64,7 +64,7 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
"url": "/img/workouts/mountains.svg" "url": "/img/workouts/mountains.svg"
}, },
{ {
"revision": "45170abcbb428b727d6c19c2ad2b035e", "revision": "1bdce419e10d1064c38aceeaeb2222fd",
"url": "/index.html" "url": "/index.html"
}, },
{ {
@ -80,8 +80,8 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
"url": "/static/css/admin.c784857e.css" "url": "/static/css/admin.c784857e.css"
}, },
{ {
"revision": "08e51982ad17cd69b5d3", "revision": "7d41f2082ed42273f277",
"url": "/static/css/app.6f17ce7a.css" "url": "/static/css/app.fc944b83.css"
}, },
{ {
"revision": "82c1118c918377daaa71a320ab8eea42", "revision": "82c1118c918377daaa71a320ab8eea42",
@ -196,8 +196,8 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
"url": "/static/js/admin.b2c267a7.js" "url": "/static/js/admin.b2c267a7.js"
}, },
{ {
"revision": "08e51982ad17cd69b5d3", "revision": "7d41f2082ed42273f277",
"url": "/static/js/app.cbc2c869.js" "url": "/static/js/app.f769a5c1.js"
}, },
{ {
"revision": "bd7d183c9f68e5f4027d", "revision": "bd7d183c9f68e5f4027d",

View File

@ -14,7 +14,7 @@
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js"); importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
importScripts( importScripts(
"/precache-manifest.2384a8066007a7b5a9dea87ccb53b3f8.js" "/precache-manifest.33b1081ef2ad6d2cfdbc250d48cb556e.js"
); );
workbox.core.setCacheNameDetails({prefix: "fittrackee_client"}); workbox.core.setCacheNameDetails({prefix: "fittrackee_client"});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2,6 +2,7 @@ import json
from flask import Flask from flask import Flask
import fittrackee
from fittrackee.users.models import User from fittrackee.users.models import User
from ..api_test_case import ApiTestCaseMixin from ..api_test_case import ApiTestCaseMixin
@ -31,6 +32,7 @@ class TestGetConfig(ApiTestCaseMixin):
'target="_blank" rel="noopener noreferrer">OpenStreetMap</a> ' 'target="_blank" rel="noopener noreferrer">OpenStreetMap</a> '
'contributors' 'contributors'
) )
assert data['data']['version'] == fittrackee.__version__
def test_it_returns_error_if_application_has_no_config( def test_it_returns_error_if_application_has_no_config(
self, app_no_config: Flask, user_1_admin: User self, app_no_config: Flask, user_1_admin: User

View File

@ -19,7 +19,7 @@
<i class="fa fa-chevron-up" aria-hidden="true"></i> <i class="fa fa-chevron-up" aria-hidden="true"></i>
</div> </div>
</div> </div>
<Footer /> <Footer v-if="appConfig" :version="appConfig ? appConfig.version : ''" />
</template> </template>
<script lang="ts"> <script lang="ts">

View File

@ -1,7 +1,10 @@
<template> <template>
<div id="footer"> <div id="footer">
<div class="footer-items"> <div class="footer-items">
<div class="footer-item"><strong>FitTrackee</strong> vx.xx</div> <div class="footer-item">
<strong>FitTrackee</strong>
v{{ version }}
</div>
<div class="footer-item bullet"></div> <div class="footer-item bullet"></div>
<div class="footer-item"> <div class="footer-item">
<a <a
@ -34,6 +37,20 @@
</div> </div>
</template> </template>
<script lang="ts">
import { defineComponent } from 'vue'
export default defineComponent({
name: 'Footer',
props: {
version: {
type: String,
required: true,
},
},
})
</script>
<style scoped lang="scss"> <style scoped lang="scss">
@import '~@/scss/base'; @import '~@/scss/base';

View File

@ -14,6 +14,7 @@ export type TAppConfig = {
max_single_file_size: number max_single_file_size: number
max_users: number max_users: number
max_zip_file_size: number max_zip_file_size: number
version: string
} }
export interface IApplication { export interface IApplication {