1 import { Component, OnInit, ViewContainerRef } from '@angular/core'
2 import { Router } from '@angular/router'
4 import { AuthService, ConfigService } from './core'
5 import { UserService } from './shared'
9 templateUrl: './app.component.html',
10 styleUrls: [ './app.component.scss' ]
12 export class AppComponent implements OnInit {
13 notificationOptions = {
19 showProgressBar: false,
21 preventDuplicates: false,
22 preventLastDuplicates: 'visible',
26 isMenuDisplayed = true
29 private router: Router,
30 private authService: AuthService,
31 private configService: ConfigService,
32 private userService: UserService
36 this.authService.loadClientCredentials()
38 if (this.authService.isLoggedIn()) {
39 // The service will automatically redirect to the login page if the token is not valid anymore
40 this.userService.checkTokenValidity()
43 this.configService.loadConfig()
45 // Do not display menu on small screens
46 if (window.innerWidth < 600) {
47 this.isMenuDisplayed = false
52 return this.router.url.indexOf('/admin/') !== -1
56 this.isMenuDisplayed = !this.isMenuDisplayed
59 getMainColClasses () {
66 // Take all width is the menu is not displayed
67 if (this.isMenuDisplayed === false) {
68 Object.keys(colSizes).forEach(col => colSizes[col] = 12)
71 const classes = [ 'main-col' ]
72 Object.keys(colSizes).forEach(col => classes.push(`col-${col}-${colSizes[col]}`))