[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:
siva kumar
2020-11-24 15:25:06 +05:30
committed by GitHub
parent 3ea094cff2
commit 67b9b884fd
4 changed files with 25 additions and 1 deletions

View File

@@ -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();
}
/**

View File

@@ -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>

View File

@@ -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();
});
});
});

View File

@@ -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;
}
}