2016-07-27 18:57:23 +03:00
|
|
|
'use strict';
|
|
|
|
|
2016-08-30 18:38:13 +03:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
2016-08-22 12:12:13 +03:00
|
|
|
import { SpecManager, BaseComponent } from '../base';
|
2016-07-27 18:57:23 +03:00
|
|
|
import { WarningsService, OptionsService } from '../../services/index';
|
|
|
|
|
2016-08-22 12:12:13 +03:00
|
|
|
@Component({
|
2016-07-27 18:57:23 +03:00
|
|
|
selector: 'warnings',
|
|
|
|
styleUrls: ['./warnings.css'],
|
2016-08-30 18:38:13 +03:00
|
|
|
templateUrl: './warnings.html'
|
2016-07-27 18:57:23 +03:00
|
|
|
})
|
2016-08-28 21:46:10 +03:00
|
|
|
export class Warnings extends BaseComponent implements OnInit {
|
2016-07-28 15:57:37 +03:00
|
|
|
warnings: Array<string> = [];
|
|
|
|
shown: boolean = false;
|
|
|
|
suppressWarnings: boolean;
|
2016-07-27 18:57:23 +03:00
|
|
|
constructor(specMgr:SpecManager, optionsMgr: OptionsService) {
|
|
|
|
super(specMgr);
|
2016-07-28 15:57:37 +03:00
|
|
|
this.suppressWarnings = optionsMgr.options.suppressWarnings;
|
2016-07-27 18:57:23 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
init() {
|
2016-07-28 15:57:37 +03:00
|
|
|
this.shown = !this.suppressWarnings && !!this.warnings.length;
|
2016-07-27 18:57:23 +03:00
|
|
|
WarningsService.warnings.subscribe((warns) => {
|
|
|
|
this.warnings = warns;
|
2016-07-28 15:57:37 +03:00
|
|
|
this.shown = !this.suppressWarnings && !!warns.length;
|
2016-07-27 18:57:23 +03:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
close() {
|
|
|
|
this.shown = false;
|
|
|
|
}
|
2016-08-28 21:46:10 +03:00
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
this.preinit();
|
|
|
|
}
|
2016-07-27 18:57:23 +03:00
|
|
|
}
|