Add offline alert
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good Details

2022.01
Willem Dantuma 2020-07-23 11:28:07 +02:00
parent 78e3cf74b9
commit 44ae806b30
5 changed files with 27 additions and 2 deletions

View File

@ -26,4 +26,9 @@
<div class="user-menu">
<fm-user-menu [user]="user|async" [showMenu]="accountMenuVisible|async"></fm-user-menu>
</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>

View File

@ -87,3 +87,21 @@ body { background: #f1f1f1; line-height: 18px; user-select:none;}
.fullscreen > .user-menu {
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;
}

View File

@ -35,6 +35,7 @@ export class AppComponent implements OnInit, OnDestroy {
public currentFolder: Observable<IListItem>;
public folderParents: Observable<IListItem[]>;
public fullScreen: Observable<boolean>;
public isOnline: Observable<boolean>;
public routeLoading: Observable<boolean>;
public menuVisible: Observable<boolean>;
public accountMenuVisible: Observable<boolean>;
@ -100,6 +101,7 @@ export class AppComponent implements OnInit, OnDestroy {
ngOnInit() {
this.fullScreen = this.store.select(appReducers.selectGetFullScreen);
this.isOnline = this.store.select(appReducers.SelectGetIsOnline);
this.routeLoading = this.store.select(appReducers.selectGetRouteLoading);
this.menuVisible = this.store.select(appReducers.SelectGetMenuVisible);
this.accountMenuVisible = this.store.select(appReducers.SelectGetAccountMenuVisible);

View File

@ -33,7 +33,7 @@ export const initialState: State = {
menuVisible: false,
userPackages: {},
accountMenuVisible: false,
isOnline: window.navigator.onLine
isOnline: true
}
export function reducer(state = initialState, action: appCommonActions.Actions ): State {

View File

@ -19,7 +19,7 @@ import { AppConfig } from "../shared/app.config";
}
check(interval:number): Observable<boolean> {
let retval = new BehaviorSubject<boolean>(false);
let retval = new BehaviorSubject<boolean>(true);
setInterval(() => {
this.httpClient.get(`${this.ApiEndpoint()}/api/v1/healthcheck`).pipe(map(() => true),catchError((error) => of(false))).toPromise().then((status) => {
retval.next(status);