Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AAE-4090] [ADW - Cloud] Warning message is displayed for one second in destination picker when Upload button is enabled #6373

Merged
merged 2 commits into from
Nov 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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;
}
}