Add offline alert
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
parent
78e3cf74b9
commit
44ae806b30
@ -26,4 +26,9 @@
|
|||||||
<div class="user-menu">
|
<div class="user-menu">
|
||||||
<fm-user-menu [user]="user|async" [showMenu]="accountMenuVisible|async"></fm-user-menu>
|
<fm-user-menu [user]="user|async" [showMenu]="accountMenuVisible|async"></fm-user-menu>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="healthstatus-container online" [ngClass]="{'online' :(isOnline|async)}">
|
||||||
|
<div class="healthstatus alert alert-danger" >
|
||||||
|
<span i18n>No connection, check your internet connection</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -87,3 +87,21 @@ body { background: #f1f1f1; line-height: 18px; user-select:none;}
|
|||||||
.fullscreen > .user-menu {
|
.fullscreen > .user-menu {
|
||||||
top:1em;
|
top:1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.healthstatus-container {
|
||||||
|
width: 100%;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0px;
|
||||||
|
overflow: hidden;
|
||||||
|
transition: height 0.5s ease-out;
|
||||||
|
height:3.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.healthstatus {
|
||||||
|
width: 100%;
|
||||||
|
padding: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.online {
|
||||||
|
height:0;
|
||||||
|
}
|
||||||
|
@ -35,6 +35,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
public currentFolder: Observable<IListItem>;
|
public currentFolder: Observable<IListItem>;
|
||||||
public folderParents: Observable<IListItem[]>;
|
public folderParents: Observable<IListItem[]>;
|
||||||
public fullScreen: Observable<boolean>;
|
public fullScreen: Observable<boolean>;
|
||||||
|
public isOnline: Observable<boolean>;
|
||||||
public routeLoading: Observable<boolean>;
|
public routeLoading: Observable<boolean>;
|
||||||
public menuVisible: Observable<boolean>;
|
public menuVisible: Observable<boolean>;
|
||||||
public accountMenuVisible: Observable<boolean>;
|
public accountMenuVisible: Observable<boolean>;
|
||||||
@ -100,6 +101,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.fullScreen = this.store.select(appReducers.selectGetFullScreen);
|
this.fullScreen = this.store.select(appReducers.selectGetFullScreen);
|
||||||
|
this.isOnline = this.store.select(appReducers.SelectGetIsOnline);
|
||||||
this.routeLoading = this.store.select(appReducers.selectGetRouteLoading);
|
this.routeLoading = this.store.select(appReducers.selectGetRouteLoading);
|
||||||
this.menuVisible = this.store.select(appReducers.SelectGetMenuVisible);
|
this.menuVisible = this.store.select(appReducers.SelectGetMenuVisible);
|
||||||
this.accountMenuVisible = this.store.select(appReducers.SelectGetAccountMenuVisible);
|
this.accountMenuVisible = this.store.select(appReducers.SelectGetAccountMenuVisible);
|
||||||
|
@ -33,7 +33,7 @@ export const initialState: State = {
|
|||||||
menuVisible: false,
|
menuVisible: false,
|
||||||
userPackages: {},
|
userPackages: {},
|
||||||
accountMenuVisible: false,
|
accountMenuVisible: false,
|
||||||
isOnline: window.navigator.onLine
|
isOnline: true
|
||||||
}
|
}
|
||||||
|
|
||||||
export function reducer(state = initialState, action: appCommonActions.Actions ): State {
|
export function reducer(state = initialState, action: appCommonActions.Actions ): State {
|
||||||
|
@ -19,7 +19,7 @@ import { AppConfig } from "../shared/app.config";
|
|||||||
}
|
}
|
||||||
|
|
||||||
check(interval:number): Observable<boolean> {
|
check(interval:number): Observable<boolean> {
|
||||||
let retval = new BehaviorSubject<boolean>(false);
|
let retval = new BehaviorSubject<boolean>(true);
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
this.httpClient.get(`${this.ApiEndpoint()}/api/v1/healthcheck`).pipe(map(() => true),catchError((error) => of(false))).toPromise().then((status) => {
|
this.httpClient.get(`${this.ApiEndpoint()}/api/v1/healthcheck`).pipe(map(() => true),catchError((error) => of(false))).toPromise().then((status) => {
|
||||||
retval.next(status);
|
retval.next(status);
|
||||||
|
Loading…
Reference in New Issue
Block a user