[ADF-2468] add check if nodeid is present in tag components (#3076)

* add check if nodeid is present in tag components

* fix test
This commit is contained in:
Eugenio Romano
2018-03-14 13:57:57 +00:00
committed by GitHub
parent 6734a02b86
commit 1959777a52
3 changed files with 17 additions and 15 deletions

View File

@@ -67,15 +67,17 @@ export class TagActionsComponent implements OnChanges {
}
refreshTag() {
this.tagService.getTagsByNodeId(this.nodeId).subscribe((data) => {
this.tagsEntries = data.list.entries;
this.disableAddTag = false;
this.result.emit(this.tagsEntries);
}, () => {
this.tagsEntries = null;
this.disableAddTag = true;
this.result.emit(this.tagsEntries);
});
if (this.nodeId) {
this.tagService.getTagsByNodeId(this.nodeId).subscribe((data) => {
this.tagsEntries = data.list.entries;
this.disableAddTag = false;
this.result.emit(this.tagsEntries);
}, () => {
this.tagsEntries = null;
this.disableAddTag = true;
this.result.emit(this.tagsEntries);
});
}
}
addTag() {

View File

@@ -78,8 +78,6 @@ describe('TagList', () => {
});
it('Tag list relative a single node should be rendered', (done) => {
component.nodeId = 'fake-node-id';
component.result.subscribe(() => {
fixture.detectChanges();

View File

@@ -55,10 +55,12 @@ export class TagNodeListComponent implements OnChanges {
}
refreshTag() {
this.tagService.getTagsByNodeId(this.nodeId).subscribe((data) => {
this.tagsEntries = data.list.entries;
this.results.emit(this.tagsEntries);
});
if (this.nodeId) {
this.tagService.getTagsByNodeId(this.nodeId).subscribe((data) => {
this.tagsEntries = data.list.entries;
this.results.emit(this.tagsEntries);
});
}
}
removeTag(tag: string) {