<div class="col-lg-6 offset-lg-3">
<button class="btn btn-success btn-lg btn-block font-weight-bold"
[disabled]="isUploading || !hasNeededData()"
- (click)="upload()" i18n>Upload</button>
+ (click)="upload()">
+ <ng-container *ngIf="importSelection()" i18n>Import</ng-container>
+ <ng-container *ngIf="!importSelection()" i18n>Upload</ng-container>
+ </button>
</div>
</div>
<!-- hide instead of *ngIf so ViewChild can find the progress bars -->
// Required form data varies depending on context.
hasNeededData(): boolean {
if (this.vandelay.importSelection) {
- return this.importActionSelected();
+ // No additional form data required
+ return true;
} else {
return this.selectedQueue &&
Boolean(this.recordType) && Boolean(this.selectedFile);
importRecords(): Promise<any> {
- if (!this.importActionSelected()) {
- return Promise.resolve();
- }
-
const selection = this.vandelay.importSelection;
- if (selection && !selection.importQueue) {
- return this.importRecordQueue(selection.recordIds);
- } else {
+ if (selection) {
+ // Additional import actions are optional
+
+ if (selection.importQueue) {
+ return this.importRecordQueue();
+
+ } else {
+ // Import selected records only
+ return this.importRecordQueue(selection.recordIds);
+ }
+
+ } else if (this.importActionSelected()) {
+ // Importing a new queue requires at least one import action.
+
return this.importRecordQueue();
+ } else {
+ return Promise.resolve();
}
}