| .. | .. |
|---|
| 1 | | -import { Component, AfterViewInit } from '@angular/core'; |
|---|
| 1 | +import { Observable } from 'rxjs/Observable'; |
|---|
| 2 | +import { BaseRequestOptions, Http } from '@angular/http'; |
|---|
| 3 | +import { ToastsManager } from 'ng2-toastr/ng2-toastr'; |
|---|
| 4 | +import { AfterViewInit, Component, ViewContainerRef } from '@angular/core'; |
|---|
| 2 | 5 | import { DomSanitizer } from '@angular/platform-browser'; |
|---|
| 3 | 6 | import { MdIconRegistry } from '@angular/material'; |
|---|
| 4 | 7 | import { UserService } from './user.service'; |
|---|
| .. | .. |
|---|
| 10 | 13 | // https://teradata.github.io/covalent-quickstart/#/ |
|---|
| 11 | 14 | |
|---|
| 12 | 15 | @Component({ |
|---|
| 13 | | - selector: 'my-app', |
|---|
| 14 | | - template: `<router-outlet></router-outlet>` |
|---|
| 16 | + selector: 'app-home', |
|---|
| 17 | + templateUrl: 'src/app/app.home.html' |
|---|
| 15 | 18 | }) |
|---|
| 16 | | - |
|---|
| 17 | | - |
|---|
| 18 | | -export class AppComponent implements AfterViewInit { |
|---|
| 19 | | - |
|---|
| 19 | +export class AppHomeComponent implements AfterViewInit { |
|---|
| 20 | + securisVersion : string; |
|---|
| 20 | 21 | constructor(private userService: UserService, |
|---|
| 22 | + toaster: ToastsManager, |
|---|
| 23 | + vRef: ViewContainerRef, |
|---|
| 21 | 24 | private router: Router, |
|---|
| 25 | + http: Http, |
|---|
| 22 | 26 | private media: TdMediaService, |
|---|
| 23 | 27 | private _iconRegistry: MdIconRegistry, |
|---|
| 24 | 28 | private _domSanitizer: DomSanitizer, |
|---|
| 25 | 29 | private store: LocalStorageService) { |
|---|
| 26 | 30 | this.registerIcons(); |
|---|
| 31 | + toaster.setRootViewContainerRef(vRef); |
|---|
| 32 | + http.get("version", /* workaround to avoid OPTIONS method request*/ new BaseRequestOptions()) |
|---|
| 33 | + .map((res) => <string>res.json().version) |
|---|
| 34 | + .subscribe( |
|---|
| 35 | + version => this.securisVersion = version, |
|---|
| 36 | + err => this.securisVersion = '0.0.0' |
|---|
| 37 | + ); |
|---|
| 38 | + |
|---|
| 27 | 39 | } |
|---|
| 28 | 40 | |
|---|
| 29 | 41 | private registerIcons() : void { |
|---|
| 30 | | - this._iconRegistry.addSvgIconInNamespace('assets', 'covalent', |
|---|
| 31 | | - this._domSanitizer.bypassSecurityTrustResourceUrl('https://raw.githubusercontent.com/Teradata/covalent-quickstart/develop/src/assets/icons/covalent.svg')); |
|---|
| 32 | | - this._iconRegistry.addSvgIconInNamespace('assets', 'teradata', |
|---|
| 33 | | - this._domSanitizer.bypassSecurityTrustResourceUrl('assets/icons/teradata.svg')); |
|---|
| 34 | | - this._iconRegistry.addSvgIconInNamespace('assets', 'github', |
|---|
| 35 | | - this._domSanitizer.bypassSecurityTrustResourceUrl('assets/icons/github.svg')); |
|---|
| 36 | | - this._iconRegistry.addSvgIconInNamespace('assets', 'covalent', |
|---|
| 37 | | - this._domSanitizer.bypassSecurityTrustResourceUrl('assets/icons/covalent.svg')); |
|---|
| 38 | | - this._iconRegistry.addSvgIconInNamespace('assets', 'covalent-mark', |
|---|
| 39 | | - this._domSanitizer.bypassSecurityTrustResourceUrl('assets/icons/covalent-mark.svg')); |
|---|
| 40 | | - this._iconRegistry.addSvgIconInNamespace('assets', 'teradata-ux', |
|---|
| 41 | | - this._domSanitizer.bypassSecurityTrustResourceUrl('assets/icons/teradata-ux.svg')); |
|---|
| 42 | | - this._iconRegistry.addSvgIconInNamespace('assets', 'appcenter', |
|---|
| 43 | | - this._domSanitizer.bypassSecurityTrustResourceUrl('assets/icons/appcenter.svg')); |
|---|
| 44 | | - this._iconRegistry.addSvgIconInNamespace('assets', 'listener', |
|---|
| 45 | | - this._domSanitizer.bypassSecurityTrustResourceUrl('assets/icons/listener.svg')); |
|---|
| 46 | | - this._iconRegistry.addSvgIconInNamespace('assets', 'querygrid', |
|---|
| 47 | | - this._domSanitizer.bypassSecurityTrustResourceUrl('assets/icons/querygrid.svg')); |
|---|
| 42 | + this._iconRegistry.addSvgIconInNamespace('assets', 'logo', |
|---|
| 43 | + this._domSanitizer.bypassSecurityTrustResourceUrl('assets/securis_logo.svg')); |
|---|
| 44 | + this._iconRegistry.addSvgIconInNamespace('assets', 'logo-bw', |
|---|
| 45 | + this._domSanitizer.bypassSecurityTrustResourceUrl('assets/securis_logo_bw.svg')); |
|---|
| 46 | + this._iconRegistry.addSvgIconInNamespace('assets', 'logo-white', |
|---|
| 47 | + this._domSanitizer.bypassSecurityTrustResourceUrl('assets/securis_logo_white.svg')); |
|---|
| 48 | + this._iconRegistry.addSvgIconInNamespace('assets', 'logo-black', |
|---|
| 49 | + this._domSanitizer.bypassSecurityTrustResourceUrl('assets/securis_logo_black.svg')); |
|---|
| 48 | 50 | } |
|---|
| 49 | 51 | |
|---|
| 50 | 52 | ngAfterViewInit(): void { |
|---|