[AAE-2200] Upload dialog title should match selected site. (#5648)

* [AAE-2200] content-node-selector-panel pass starting site and emit event onSiteChange

* [AAE-2200] content-node-selector handle siteChange event

* [AAE-2200] content-node-selector has good default title

* [AAE-2200] attach-file-widget-dialog handle siteChange event

* [AAE-2200] Minor fixes on attach-file-widget-dialog

* [AAE-2200] site-dropdown reload site list unfil it find its default site

* [AAE-2200] Fix title translation for attach-file-widget-dialog

* fix missing property description

* Unit test fix

* [AAE-2200] Fix title unit tests

* [AAE-2200] Fix sites-dropdown infinite loading

* [AAE-2200] Add content-node-selector-panel siteChange event unit tests

* [AAE-2200] Refactor sites-dropdown unit tests

* [AAE-2200] Refactor the 'allSitesLoaded' check

* [AAE-2200] Add sites-dorpdown default value unit tests

* [AAE-2200] Move getSiteFromNodePath method to sites service

* [create preview]

* [create preview]

* [AAE-2200] Better hasMoreItems check in sites-dropdown (fix unit test)

Co-authored-by: Eugenio Romano <eugenio.romano@alfresco.com>
Co-authored-by: Cano <david.cano.nieto@gmail.com>
Co-authored-by: Eugenio Romano <eromano@users.noreply.github.com>
This commit is contained in:
Baptiste Mahé
2020-05-14 11:38:16 +02:00
committed by GitHub
parent c26b8e046c
commit 78332449a5
21 changed files with 511 additions and 324 deletions

View File

@@ -18,7 +18,7 @@
import { Injectable } from '@angular/core';
import { Observable, from, throwError } from 'rxjs';
import { AlfrescoApiService } from './alfresco-api.service';
import { SitePaging, SiteEntry, SitesApi, SiteMembershipRequestWithPersonPaging } from '@alfresco/js-api';
import { SitePaging, SiteEntry, MinimalNode, SitesApi, SiteMembershipRequestWithPersonPaging } from '@alfresco/js-api';
import { catchError } from 'rxjs/operators';
@Injectable({
@@ -103,6 +103,24 @@ export class SitesService {
return this.apiService.getInstance().getEcmUsername();
}
/**
* Looks for a site inside the path of a Node and returns its guid if it finds one.
* (return an empty string if no site is found)
* @param node Node to look for parent site
* @returns Site guid
*/
getSiteNameFromNodePath(node: MinimalNode): string {
let siteName = '';
if (node.path && node.path.elements) {
const foundNode = node.path
.elements.find((pathNode: MinimalNode) =>
pathNode.nodeType === 'st:site' &&
pathNode.name !== 'Sites');
siteName = foundNode ? foundNode.name : '';
}
return siteName.toLocaleLowerCase();
}
/**
* Gets a list of site membership requests.
* @param opts Options supported by JS-API