[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

@@ -34,7 +34,7 @@ export class ContentNodeSelectorComponent {
buttonActionName: string;
chosenNode: Node[];
constructor(public translation: TranslationService,
constructor(private translation: TranslationService,
@Inject(MAT_DIALOG_DATA) public data: ContentNodeSelectorComponentData) {
this.action = data.actionName ? data.actionName.toUpperCase() : 'CHOOSE';
this.buttonActionName = `NODE_SELECTOR.${this.action}`;
@@ -47,7 +47,10 @@ export class ContentNodeSelectorComponent {
onSelect(nodeList: Node[]) {
this.chosenNode = nodeList;
this.updateTitle(nodeList);
}
onSiteChange(siteTitle: string) {
this.updateTitle(siteTitle);
}
onClick(): void {
@@ -55,13 +58,13 @@ export class ContentNodeSelectorComponent {
this.data.select.complete();
}
updateTitle(nodeList: Node[]): void {
if (this.action === 'CHOOSE' && nodeList) {
this.title = this.getTitleTranslation(this.action, nodeList[0].name);
updateTitle(siteTitle: string) {
if (this.action === 'CHOOSE' && siteTitle) {
this.title = this.getTitleTranslation(this.action, siteTitle);
}
}
getTitleTranslation(action: string, name: string): string {
return this.translation.instant(`NODE_SELECTOR.${action}_ITEM`, { name });
return this.translation.instant(`NODE_SELECTOR.${action}_ITEM`, { name: this.translation.instant(name) });
}
}