mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-4090] [ADW - Cloud] Warning message is displayed for one second in destination picker when Upload button is enabled (#6373)
* [AAE-4090] [ADW - Cloud] Warning message is displayed for one second in destination picker when Upload button is enabled * * Added unit test
This commit is contained in:
@@ -217,6 +217,9 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
||||
@Output()
|
||||
currentFolder: EventEmitter<Node> = new EventEmitter<Node>();
|
||||
|
||||
@Output()
|
||||
folderLoaded: EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
@ViewChild('documentList', { static: true })
|
||||
documentList: DocumentListComponent;
|
||||
|
||||
@@ -519,6 +522,7 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
||||
if (!this.showingSearchResults) {
|
||||
this.attemptNodeSelection(this.documentList.folderNode);
|
||||
}
|
||||
this.folderLoaded.emit();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -21,6 +21,7 @@
|
||||
[showDropdownSiteList]="data?.showDropdownSiteList"
|
||||
[showFilesInResult]="data?.showFilesInResult"
|
||||
(currentFolder)="onCurrentFolder($event)"
|
||||
(folderLoaded)="onFolderLoaded()"
|
||||
(select)="onSelect($event)"
|
||||
(showingSearch)="onShowingSearch($event)"
|
||||
(siteChange)="onSiteChange($event)"
|
||||
@@ -43,7 +44,7 @@
|
||||
<mat-icon>warning</mat-icon>
|
||||
<span>{{ 'NODE_SELECTOR.UPLOAD_BUTTON_SEARCH_WARNING_MESSAGE' | translate }}</span>
|
||||
</div>
|
||||
<div class="adf-content-node-upload-button-warning-message" *ngIf="!hasAllowableOperations && !showingSearch">
|
||||
<div class="adf-content-node-upload-button-warning-message" *ngIf="(!hasAllowableOperations && !showingSearch) && !isLoading">
|
||||
<mat-icon>warning</mat-icon>
|
||||
<span>{{ 'NODE_SELECTOR.UPLOAD_BUTTON_PERMISSION_WARNING_MESSAGE' | translate }}</span>
|
||||
</div>
|
||||
|
@@ -303,6 +303,7 @@ describe('ContentNodeSelectorComponent', () => {
|
||||
component.data.showLocalUploadButton = true;
|
||||
component.hasAllowableOperations = false;
|
||||
component.showingSearch = false;
|
||||
component.isLoading = false;
|
||||
|
||||
fixture.detectChanges();
|
||||
const warnningMessage = fixture.debugElement.query(By.css('.adf-content-node-upload-button-warning-message span'));
|
||||
@@ -310,5 +311,17 @@ describe('ContentNodeSelectorComponent', () => {
|
||||
expect(warnningMessage).not.toBeNull();
|
||||
expect(warnningMessage.nativeElement.innerText).toEqual('NODE_SELECTOR.UPLOAD_BUTTON_PERMISSION_WARNING_MESSAGE');
|
||||
});
|
||||
|
||||
it('should not be able to show warning message while loading documents', () => {
|
||||
component.data.showLocalUploadButton = true;
|
||||
component.hasAllowableOperations = false;
|
||||
component.showingSearch = false;
|
||||
component.isLoading = true;
|
||||
|
||||
fixture.detectChanges();
|
||||
const warnningMessage = fixture.debugElement.query(By.css('.adf-content-node-upload-button-warning-message span'));
|
||||
|
||||
expect(warnningMessage).toBeNull();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -36,6 +36,7 @@ export class ContentNodeSelectorComponent {
|
||||
currentDirectoryId: string;
|
||||
showingSearch = false;
|
||||
hasAllowableOperations = false;
|
||||
isLoading = true;
|
||||
|
||||
constructor(private translation: TranslationService,
|
||||
private contentService: ContentService,
|
||||
@@ -61,6 +62,7 @@ export class ContentNodeSelectorComponent {
|
||||
|
||||
onNavigationChange(pathElement: NodeEntryEvent) {
|
||||
this.currentDirectoryId = pathElement.value.id;
|
||||
this.isLoading = true;
|
||||
}
|
||||
|
||||
onClick(): void {
|
||||
@@ -101,4 +103,8 @@ export class ContentNodeSelectorComponent {
|
||||
isNotAllowedToUpload() {
|
||||
return this.showingSearch || !this.hasAllowableOperations;
|
||||
}
|
||||
|
||||
onFolderLoaded() {
|
||||
this.isLoading = false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user