Skip to content

Commit

Permalink
[AAE-4090] [ADW - Cloud] Warning message is displayed for one second …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
sivakumar414ram committed Nov 24, 2020
1 parent 3ea094c commit 67b9b88
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -519,6 +522,7 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
if (!this.showingSearchResults) {
this.attemptNodeSelection(this.documentList.folderNode);
}
this.folderLoaded.emit();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ <h2>{{title}}</h2>
[showDropdownSiteList]="data?.showDropdownSiteList"
[showFilesInResult]="data?.showFilesInResult"
(currentFolder)="onCurrentFolder($event)"
(folderLoaded)="onFolderLoaded()"
(select)="onSelect($event)"
(showingSearch)="onShowingSearch($event)"
(siteChange)="onSiteChange($event)"
Expand All @@ -43,7 +44,7 @@ <h2>{{title}}</h2>
<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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,25 @@ 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'));

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();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class ContentNodeSelectorComponent {
currentDirectoryId: string;
showingSearch = false;
hasAllowableOperations = false;
isLoading = true;

constructor(private translation: TranslationService,
private contentService: ContentService,
Expand All @@ -61,6 +62,7 @@ export class ContentNodeSelectorComponent {

onNavigationChange(pathElement: NodeEntryEvent) {
this.currentDirectoryId = pathElement.value.id;
this.isLoading = true;
}

onClick(): void {
Expand Down Expand Up @@ -101,4 +103,8 @@ export class ContentNodeSelectorComponent {
isNotAllowedToUpload() {
return this.showingSearch || !this.hasAllowableOperations;
}

onFolderLoaded() {
this.isLoading = false;
}
}

0 comments on commit 67b9b88

Please sign in to comment.