fix: show warning for non-used in tagGroup tags

closes #215
This commit is contained in:
Roman Hotsiy 2017-02-28 22:03:03 +02:00
parent 387635b7a1
commit fb3ca07d6e
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
2 changed files with 5 additions and 4 deletions

View File

@ -3,6 +3,7 @@ import { Injectable, EventEmitter } from '@angular/core';
import { Subscription } from 'rxjs/Subscription';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { ScrollService, INVIEW_POSITION } from './scroll.service';
import { WarningsService } from './warnings.service';
import { Hash } from './hash.service';
import { SpecManager } from '../utils/spec-manager';
import { SchemaHelper } from './schema-helper.service';
@ -351,7 +352,7 @@ export class MenuService {
tags = tags.map(k => {
if (!this._tagsWithMethods[k]) {
console.warn(`Non-existing tag "${k}" is specified in tag group "${tagGroup.name}"`);
WarningsService.warn(`Non-existing tag "${k}" is added to the group "${tagGroup.name}"`);
return null;
}
this._tagsWithMethods[k].used = true;
@ -408,7 +409,7 @@ export class MenuService {
checkAllTagsUsedInGroups() {
for (let tag of Object.keys(this._tagsWithMethods)) {
if (!this._tagsWithMethods[tag].used) {
console.warn(`Tag "${tag}" is not added to any group`);
WarningsService.warn(`Tag "${tag}" is not added to any group`)
}
}
}

View File

@ -1,11 +1,11 @@
'use strict';
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
@Injectable()
export class WarningsService {
private static _warnings: Array<string> = [];
private static _warningsObs = new Subject<Array<string>>();
private static _warningsObs = new BehaviorSubject<Array<string>>([]);
static get warnings() {
return WarningsService._warningsObs;