1 import { Component, OnInit, ViewContainerRef } from '@angular/core'
2 import { Router } from '@angular/router'
4 import { AuthService, ServerService } 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 serverService: ServerService,
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 // Load custom data from server
44 this.serverService.loadConfig()
45 this.serverService.loadVideoCategories()
46 this.serverService.loadVideoLanguages()
47 this.serverService.loadVideoLicences()
49 // Do not display menu on small screens
50 if (window.innerWidth < 600) {
51 this.isMenuDisplayed = false
56 return this.router.url.indexOf('/admin/') !== -1
60 this.isMenuDisplayed = !this.isMenuDisplayed
63 getMainColClasses () {
70 // Take all width is the menu is not displayed
71 if (this.isMenuDisplayed === false) {
72 Object.keys(colSizes).forEach(col => colSizes[col] = 12)
75 const classes = [ 'main-col' ]
76 Object.keys(colSizes).forEach(col => classes.push(`col-${col}-${colSizes[col]}`))