From 6d406d8a7d2bb9b5143618b029c6f06dbb616889 Mon Sep 17 00:00:00 2001 From: Urse Daniel Date: Fri, 3 Apr 2020 12:55:51 +0300 Subject: [PATCH] [ADF-4264] Fixed the breadcrumb when changing to custom site in node selector (#5589) * unit test for veryfing if changing to a custom site the current breadcrumb folder is the title of the site. * fixed the problem when changing to a custom site the breadcrumb current folder title is not changing. fixed the issue when navigating inside a node after changing to a custom site the path to the root in the breadcrumb was not the correct path. * updated the styling for the data rows to match the styling of the breadcrumb * if there is an error the loader should stop not only if there is a message. updated to fix the node-selector site problem when adding a non existing site, the loader would previously keep spinning even though in console was thrown an error but the clients never had an UI update about the issue. --- .../content-node-selector-panel.component.spec.ts | 6 ++++++ .../content-node-selector-panel.component.ts | 5 +++++ .../lib/document-list/components/document-list.component.ts | 3 +-- .../datatable/components/datatable/datatable.component.scss | 4 ++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/content-services/src/lib/content-node-selector/content-node-selector-panel.component.spec.ts b/lib/content-services/src/lib/content-node-selector/content-node-selector-panel.component.spec.ts index e40e0764ae..10d39031c4 100644 --- a/lib/content-services/src/lib/content-node-selector/content-node-selector-panel.component.spec.ts +++ b/lib/content-services/src/lib/content-node-selector/content-node-selector-panel.component.spec.ts @@ -439,6 +439,12 @@ describe('ContentNodeSelectorComponent', () => { expect(component.chosenNode).toBeNull(); })); + it('should update the breadcrumb when changing to a custom site', fakeAsync(() => { + component.siteChanged( { entry: { guid: '-mysites-', title: 'My Sites' } }); + + expect(component.breadcrumbFolderTitle).toBe('My Sites'); + })); + it('should call the search api on changing the site selectBox value', fakeAsync(() => { typeToSearchBox('vegeta'); diff --git a/lib/content-services/src/lib/content-node-selector/content-node-selector-panel.component.ts b/lib/content-services/src/lib/content-node-selector/content-node-selector-panel.component.ts index 033f8ff51d..50ab214fc3 100644 --- a/lib/content-services/src/lib/content-node-selector/content-node-selector-panel.component.ts +++ b/lib/content-services/src/lib/content-node-selector/content-node-selector-panel.component.ts @@ -394,6 +394,7 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy { onFolderChange(): void { this.showingSearchResults = false; this.infiniteScroll = false; + this.breadcrumbFolderTitle = null; this.clearSearch(); } @@ -459,6 +460,10 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy { setTitleIfCustomSite(site: SiteEntry) { if (this.customResourcesService.isCustomSource(site.entry.guid)) { this.breadcrumbFolderTitle = site.entry.title; + if (this.documentList.folderNode.path.elements) { + this.breadcrumbFolderNode.name = site.entry.title; + this.documentList.folderNode.path.elements = null; + } } else { this.breadcrumbFolderTitle = null; } diff --git a/lib/content-services/src/lib/document-list/components/document-list.component.ts b/lib/content-services/src/lib/document-list/components/document-list.component.ts index 45d2a53dd7..435a1f1a02 100644 --- a/lib/content-services/src/lib/document-list/components/document-list.component.ts +++ b/lib/content-services/src/lib/document-list/components/document-list.component.ts @@ -843,14 +843,13 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte if (err.message) { try { if (JSON.parse(err.message).error.statusCode === 403) { - this.setLoadingState(false); this.noPermission = true; } } catch (error) { } } + this.setLoadingState(false); this.error.emit(err); - } } diff --git a/lib/core/datatable/components/datatable/datatable.component.scss b/lib/core/datatable/components/datatable/datatable.component.scss index e5b53e6dfc..59b381951f 100644 --- a/lib/core/datatable/components/datatable/datatable.component.scss +++ b/lib/core/datatable/components/datatable/datatable.component.scss @@ -267,8 +267,8 @@ .adf-datatable-row { display: flex; align-items: center; - padding-left: 20px; - padding-right: 20px; + padding-left: 15px; + padding-right: 15px; .adf-datatable-checkbox { max-width: $data-table-thumbnail-width;