Fix warnings show criteria

This commit is contained in:
Roman Hotsiy 2016-07-28 15:57:37 +03:00
parent 0f2189622e
commit c0f43a3d15
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0

View File

@ -11,16 +11,19 @@ import { WarningsService, OptionsService } from '../../services/index';
onPushOnly: false onPushOnly: false
}) })
export class Warnings extends BaseComponent { export class Warnings extends BaseComponent {
warnings: Array<string>; warnings: Array<string> = [];
shown: boolean; shown: boolean = false;
suppressWarnings: boolean;
constructor(specMgr:SpecManager, optionsMgr: OptionsService) { constructor(specMgr:SpecManager, optionsMgr: OptionsService) {
super(specMgr); super(specMgr);
this.shown = !optionsMgr.options.suppressWarnings; this.suppressWarnings = optionsMgr.options.suppressWarnings;
} }
init() { init() {
this.shown = !this.suppressWarnings && !!this.warnings.length;
WarningsService.warnings.subscribe((warns) => { WarningsService.warnings.subscribe((warns) => {
this.warnings = warns; this.warnings = warns;
this.shown = !this.suppressWarnings && !!warns.length;
}); });
} }