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">
|
||||
<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>
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user