Showing the frontend and backend version in the settings panel.

Bumped the version to 7.6.0
This commit is contained in:
2020-10-07 23:27:54 +05:30
parent 7463846282
commit 438a98334d
10 changed files with 19 additions and 2 deletions

1
brewman/__version__.py Normal file
View File

@ -0,0 +1 @@
__version__ = "7.6.0"

View File

@ -14,6 +14,7 @@ from fastapi.responses import JSONResponse
from fastapi.security import OAuth2PasswordRequestForm from fastapi.security import OAuth2PasswordRequestForm
from sqlalchemy.orm import Session from sqlalchemy.orm import Session
from .. import __version__
from ..core.config import settings from ..core.config import settings
from ..core.security import ( from ..core.security import (
Token, Token,
@ -85,6 +86,7 @@ async def login_for_access_token(
), ),
"userId": str(user.id), "userId": str(user.id),
"lockedOut": user.locked_out, "lockedOut": user.locked_out,
"ver": __version__.__version__,
}, },
expires_delta=access_token_expires, expires_delta=access_token_expires,
) )
@ -100,6 +102,7 @@ async def refresh_token(user: UserToken = Security(get_current_active_user)):
"scopes": user.permissions, "scopes": user.permissions,
"userId": str(user.id_), "userId": str(user.id_),
"lockedOut": user.locked_out, "lockedOut": user.locked_out,
"ver": __version__.__version__,
}, },
expires_delta=access_token_expires, expires_delta=access_token_expires,
) )

View File

@ -1,6 +1,6 @@
{ {
"name": "overlord", "name": "overlord",
"version": "7.5.0", "version": "7.6.0",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"prettier": "prettier", "prettier": "prettier",

View File

@ -91,6 +91,7 @@ export class AuthService {
perms: decoded.scopes, perms: decoded.scopes,
access_token: token, access_token: token,
exp: decoded.exp, exp: decoded.exp,
ver: decoded.ver
}); });
} }

View File

@ -8,6 +8,7 @@ export class User {
isAuthenticated: boolean; isAuthenticated: boolean;
access_token?: string; access_token?: string;
exp?: number; exp?: number;
ver: string;
public constructor(init?: Partial<User>) { public constructor(init?: Partial<User>) {
Object.assign(this, init); Object.assign(this, init);

View File

@ -218,3 +218,8 @@
</mat-card> </mat-card>
</mat-tab> </mat-tab>
</mat-tab-group> </mat-tab-group>
<footer class="footer">
<p>
Backend: v{{ auth.user.ver }} / Frontend: v{{ version }}
</p>
</footer>

View File

@ -12,6 +12,7 @@ import { Product } from '../core/product';
import { debounceTime, distinctUntilChanged, map, startWith, switchMap } from 'rxjs/operators'; import { debounceTime, distinctUntilChanged, map, startWith, switchMap } from 'rxjs/operators';
import { Observable, of as observableOf } from 'rxjs'; import { Observable, of as observableOf } from 'rxjs';
import { ProductService } from '../product/product.service'; import { ProductService } from '../product/product.service';
import {environment} from '../../environments/environment';
@Component({ @Component({
selector: 'app-settings', selector: 'app-settings',
@ -30,6 +31,8 @@ export class SettingsComponent implements OnInit {
maintenance: any; maintenance: any;
version: string;
constructor( constructor(
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router, private router: Router,
@ -51,6 +54,7 @@ export class SettingsComponent implements OnInit {
this.listenToProductChanges(); this.listenToProductChanges();
this.maintenance = { enabled: false, user: '' }; this.maintenance = { enabled: false, user: '' };
this.version = environment.version;
} }
ngOnInit() { ngOnInit() {

View File

@ -1,4 +1,5 @@
export const environment = { export const environment = {
production: true, production: true,
ACCESS_TOKEN_REFRESH_MINUTES: 10, // refresh token 10 minutes before expiry ACCESS_TOKEN_REFRESH_MINUTES: 10, // refresh token 10 minutes before expiry
version: '7.6.0',
}; };

View File

@ -5,6 +5,7 @@
export const environment = { export const environment = {
production: false, production: false,
ACCESS_TOKEN_REFRESH_MINUTES: 10, // refresh token 10 minutes before expiry ACCESS_TOKEN_REFRESH_MINUTES: 10, // refresh token 10 minutes before expiry
version: '7.6.0',
}; };
/* /*

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "brewman" name = "brewman"
version = "7.5.0" version = "7.6.0"
description = "Accounting plus inventory management for a restaurant." description = "Accounting plus inventory management for a restaurant."
authors = ["tanshu <git@tanshu.com>"] authors = ["tanshu <git@tanshu.com>"]