From a5bf0d27e40721f937e4244fdf96022ffc85ee16 Mon Sep 17 00:00:00 2001 From: Vito Date: Wed, 21 Nov 2018 16:50:11 +0000 Subject: [PATCH] [ADF-3763] fixed subscription for node child and invalid node id (#3991) * [ADF-3763] fixed subscription for node child and invalid node id * [ADF-3763] removed fdescribe * [ADF-3763] added line for updating documentation --- .../tree-view/tree-view-sample.component.html | 13 ++++- .../tree-view/tree-view-sample.component.ts | 11 +++++ docs/content-services/tree-view.component.md | 1 + .../components/tree-view.component.html | 9 ++-- .../components/tree-view.component.spec.ts | 47 ++++++++++++++++++- .../components/tree-view.component.ts | 22 +++++---- .../tree-view/data/tree-view-datasource.ts | 38 ++++++++++----- 7 files changed, 112 insertions(+), 29 deletions(-) diff --git a/demo-shell/src/app/components/tree-view/tree-view-sample.component.html b/demo-shell/src/app/components/tree-view/tree-view-sample.component.html index 9dfb0850e5..ca75436205 100644 --- a/demo-shell/src/app/components/tree-view/tree-view-sample.component.html +++ b/demo-shell/src/app/components/tree-view/tree-view-sample.component.html @@ -1,10 +1,19 @@
TREE VIEW TEST
- + CLICKED NODE: {{clickedNodeName}} - + + + An Error Occurred + {{errorMessage}} + diff --git a/demo-shell/src/app/components/tree-view/tree-view-sample.component.ts b/demo-shell/src/app/components/tree-view/tree-view-sample.component.ts index fea4caae6e..512de3b858 100644 --- a/demo-shell/src/app/components/tree-view/tree-view-sample.component.ts +++ b/demo-shell/src/app/components/tree-view/tree-view-sample.component.ts @@ -25,10 +25,21 @@ import { Component } from '@angular/core'; export class TreeViewSampleComponent { clickedNodeName: string = ''; + errorMessage = ''; nodeIdSample: string = '-my-'; onClick(node) { this.clickedNodeName = node.entry.name; } + + reset() { + this.clickedNodeName = ''; + this.errorMessage = ''; + } + + onErrorOccurred(error) { + this.clickedNodeName = ''; + this.errorMessage = error; + } } diff --git a/docs/content-services/tree-view.component.md b/docs/content-services/tree-view.component.md index b94509b211..d81c0108c2 100644 --- a/docs/content-services/tree-view.component.md +++ b/docs/content-services/tree-view.component.md @@ -30,4 +30,5 @@ Shows the folder and subfolders of a node as a tree view. | Name | Type | Description | | ---- | ---- | ----------- | +| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when an invalid node id is given. | | nodeClicked | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`>` | Emitted when a node in the tree view is clicked. | diff --git a/lib/content-services/tree-view/components/tree-view.component.html b/lib/content-services/tree-view/components/tree-view.component.html index 92b1504f8b..78aaeafa44 100644 --- a/lib/content-services/tree-view/components/tree-view.component.html +++ b/lib/content-services/tree-view/components/tree-view.component.html @@ -1,9 +1,12 @@ - - + {{treeNode.name}} -