1 import { Component, OnInit, ViewContainerRef } from '@angular/core';
2 import { Router } from '@angular/router';
4 import { AuthService, ConfigService } from './core';
5 import { VideoService } from './videos';
6 import { UserService } from './shared';
10 templateUrl: './app.component.html',
11 styleUrls: [ './app.component.scss' ]
13 export class AppComponent implements OnInit {
14 notificationOptions = {
20 showProgressBar: false,
22 preventDuplicates: false,
23 preventLastDuplicates: 'visible',
27 isMenuDisplayed = true;
30 private router: Router,
31 private authService: AuthService,
32 private configService: ConfigService,
33 private userService: UserService,
34 private videoService: VideoService,
35 viewContainerRef: ViewContainerRef
39 if (this.authService.isLoggedIn()) {
40 // The service will automatically redirect to the login page if the token is not valid anymore
41 this.userService.checkTokenValidity();
44 this.configService.loadConfig();
45 this.videoService.loadVideoCategories();
46 this.videoService.loadVideoLicences();
47 this.videoService.loadVideoLanguages();
51 return this.router.url.indexOf('/admin/') !== -1;
55 this.isMenuDisplayed = !this.isMenuDisplayed;
65 // Take all width is the menu is not displayed
66 if (this.isMenuDisplayed === false) {
67 Object.keys(colSizes).forEach(col => colSizes[col] = 12);
70 const classes = [ "main-col" ];
71 Object.keys(colSizes).forEach(col => classes.push(`col-${col}-${colSizes[col]}`));