2016-07-27 18:57:23 +03:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
import { SpecManager, RedocComponent, BaseComponent } from '../base';
|
|
|
|
import { WarningsService, OptionsService } from '../../services/index';
|
|
|
|
|
|
|
|
@RedocComponent({
|
|
|
|
selector: 'warnings',
|
|
|
|
styleUrls: ['./warnings.css'],
|
|
|
|
templateUrl: './warnings.html',
|
|
|
|
detect: true,
|
|
|
|
onPushOnly: false
|
|
|
|
})
|
|
|
|
export class Warnings extends BaseComponent {
|
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;
|
|
|
|
}
|
|
|
|
}
|