mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-10-01 14:41:32 +00:00
[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:
@@ -21,7 +21,9 @@ import {
|
||||
UserPreferencesService,
|
||||
PaginationModel,
|
||||
UserPreferenceValues,
|
||||
InfinitePaginationComponent, PaginatedComponent
|
||||
InfinitePaginationComponent, PaginatedComponent,
|
||||
NodesApiService,
|
||||
SitesService
|
||||
} from '@alfresco/adf-core';
|
||||
import { FormControl } from '@angular/forms';
|
||||
import { Node, NodePaging, Pagination, SiteEntry, SitePaging } from '@alfresco/js-api';
|
||||
@@ -176,6 +178,10 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
||||
@Output()
|
||||
select: EventEmitter<Node[]> = new EventEmitter<Node[]>();
|
||||
|
||||
/** Emitted when the select site changes. */
|
||||
@Output()
|
||||
siteChange: EventEmitter<string> = new EventEmitter<string>();
|
||||
|
||||
@ViewChild('documentList')
|
||||
documentList: DocumentListComponent;
|
||||
|
||||
@@ -191,6 +197,7 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
||||
_chosenNode: Node = null;
|
||||
folderIdToShow: string | null = null;
|
||||
breadcrumbFolderTitle: string | null = null;
|
||||
startSiteGuid: string | null = null;
|
||||
|
||||
pagination: PaginationModel = this.DEFAULT_PAGINATION;
|
||||
|
||||
@@ -207,7 +214,9 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
||||
|
||||
constructor(private contentNodeSelectorService: ContentNodeSelectorService,
|
||||
private customResourcesService: CustomResourcesService,
|
||||
private userPreferencesService: UserPreferencesService) {
|
||||
private userPreferencesService: UserPreferencesService,
|
||||
private nodesApiService: NodesApiService,
|
||||
private sitesService: SitesService) {
|
||||
}
|
||||
|
||||
set chosenNode(value: Node) {
|
||||
@@ -238,6 +247,9 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
||||
|
||||
this.target = this.documentList;
|
||||
this.folderIdToShow = this.currentFolderId;
|
||||
if (this.currentFolderId) {
|
||||
this.getStartSite();
|
||||
}
|
||||
|
||||
this.breadcrumbTransform = this.breadcrumbTransform ? this.breadcrumbTransform : null;
|
||||
this.isSelectionValid = this.isSelectionValid ? this.isSelectionValid : defaultValidation;
|
||||
@@ -248,6 +260,19 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
private getStartSite() {
|
||||
this.nodesApiService.getNode(this.currentFolderId).subscribe((startNodeEntry) => {
|
||||
this.startSiteGuid = this.sitesService.getSiteNameFromNodePath(startNodeEntry);
|
||||
if (this.startSiteGuid) {
|
||||
this.sitesService.getSite(this.startSiteGuid).subscribe((startSiteEntry) => {
|
||||
if (startSiteEntry instanceof SiteEntry) {
|
||||
this.siteChange.emit(startSiteEntry.entry.title);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private createRowFilter(filter?: RowFilter) {
|
||||
if (!filter) {
|
||||
filter = () => true;
|
||||
@@ -280,8 +305,8 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
||||
siteChanged(chosenSite: SiteEntry): void {
|
||||
this.siteId = chosenSite.entry.guid;
|
||||
this.setTitleIfCustomSite(chosenSite);
|
||||
this.siteChange.emit(chosenSite.entry.title);
|
||||
this.updateResults();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user