[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() { refreshTag() {
this.tagService.getTagsByNodeId(this.nodeId).subscribe((data) => { if (this.nodeId) {
this.tagsEntries = data.list.entries; this.tagService.getTagsByNodeId(this.nodeId).subscribe((data) => {
this.disableAddTag = false; this.tagsEntries = data.list.entries;
this.result.emit(this.tagsEntries); this.disableAddTag = false;
}, () => { this.result.emit(this.tagsEntries);
this.tagsEntries = null; }, () => {
this.disableAddTag = true; this.tagsEntries = null;
this.result.emit(this.tagsEntries); this.disableAddTag = true;
}); this.result.emit(this.tagsEntries);
});
}
} }
addTag() { addTag() {

View File

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

View File

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