[AAE-3543] Attach button enabled only when all files uploaded (#6731)

* [AAE-3543] Attach button enabled only when all files uploaded

* [AAE-3543] Add unit tests

* [AAE-3543] Corrected name of unit test

* [AAE-3543] Merged isQueueFinishedUploading() with isUploading()

* [AAE-3543] Added spacing to unit tests
This commit is contained in:
Thomas Hunter
2021-02-26 20:10:11 +01:00
committed by GitHub
parent e3029b12b7
commit a47045ab18
4 changed files with 48 additions and 5 deletions

View File

@@ -80,7 +80,7 @@
</button>
<button mat-button
[disabled]="!hasNodeSelected()"
[disabled]="isChooseButtonDisabled()"
class="adf-choose-action"
(click)="onClick()"
data-automation-id="content-node-selector-actions-choose">{{ buttonActionName | translate }}

View File

@@ -17,7 +17,7 @@
import { Component, Inject, OnInit, ViewEncapsulation } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { TranslationService, NotificationService, AllowableOperationsEnum, ContentService } from '@alfresco/adf-core';
import { TranslationService, NotificationService, AllowableOperationsEnum, ContentService, UploadService } from '@alfresco/adf-core';
import { Node } from '@alfresco/js-api';
import { ContentNodeSelectorComponentData } from './content-node-selector.component-data.interface';
@@ -44,6 +44,7 @@ export class ContentNodeSelectorComponent implements OnInit {
constructor(private translation: TranslationService,
private contentService: ContentService,
private notificationService: NotificationService,
private uploadService: UploadService,
private dialog: MatDialogRef<ContentNodeSelectorComponent>,
@Inject(MAT_DIALOG_DATA) public data: ContentNodeSelectorComponentData) {
this.action = data.actionName ? data.actionName.toUpperCase() : 'CHOOSE';
@@ -107,6 +108,10 @@ export class ContentNodeSelectorComponent implements OnInit {
this.notificationService.showError(error);
}
isChooseButtonDisabled(): boolean {
return this.uploadService.isUploading() || !this.hasNodeSelected();
}
hasNodeSelected(): boolean {
return this.chosenNode?.length > 0;
}