fixed dropzone issues

This commit is contained in:
lotte
2021-03-11 15:41:27 +01:00
parent 66463cfc04
commit 7d774d43e8
3 changed files with 14 additions and 9 deletions

View File

@@ -146,12 +146,6 @@ export class UploaderComponent {
this.uploader.options.headers = [{ name: XSRF_REQUEST_HEADER, value: this.tokenExtractor.getToken() }]; this.uploader.options.headers = [{ name: XSRF_REQUEST_HEADER, value: this.tokenExtractor.getToken() }];
this.onBeforeUpload(); this.onBeforeUpload();
this.isOverDocumentDropZone = observableOf(false); this.isOverDocumentDropZone = observableOf(false);
// Move page target to the uploader
const config: ScrollToConfigOptions = {
target: this.uploaderId
};
this.scrollToService.scrollTo(config);
}; };
if (hasValue(this.uploadProperties)) { if (hasValue(this.uploadProperties)) {
this.uploader.onBuildItemForm = (item, form) => { this.uploader.onBuildItemForm = (item, form) => {

View File

@@ -1,5 +1,5 @@
<div class="container-fluid"> <div class="container-fluid">
<div *ngIf="!(isLoading() | async)"> <div *ngIf="!(isLoading() | async) && (uploadEnabled$ | async)">
<ds-submission-upload-files [submissionId]="submissionId" <ds-submission-upload-files [submissionId]="submissionId"
[collectionId]="collectionId" [collectionId]="collectionId"
[sectionId]="'upload'" [sectionId]="'upload'"

View File

@@ -1,7 +1,7 @@
import { ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, SimpleChanges } from '@angular/core'; import { ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, SimpleChanges } from '@angular/core';
import { Observable, of as observableOf, Subscription } from 'rxjs'; import { Observable, of as observableOf, Subscription } from 'rxjs';
import { distinctUntilChanged, filter, map, switchMap } from 'rxjs/operators'; import { distinctUntilChanged, filter, map, switchMap, tap } from 'rxjs/operators';
import { AuthService } from '../../core/auth/auth.service'; import { AuthService } from '../../core/auth/auth.service';
import { SubmissionDefinitionsModel } from '../../core/config/models/config-submission-definitions.model'; import { SubmissionDefinitionsModel } from '../../core/config/models/config-submission-definitions.model';
import { Collection } from '../../core/shared/collection.model'; import { Collection } from '../../core/shared/collection.model';
@@ -15,6 +15,8 @@ import { SubmissionObjectEntry } from '../objects/submission-objects.reducer';
import { SectionDataObject } from '../sections/models/section-data.model'; import { SectionDataObject } from '../sections/models/section-data.model';
import { SubmissionService } from '../submission.service'; import { SubmissionService } from '../submission.service';
import { Item } from '../../core/shared/item.model'; import { Item } from '../../core/shared/item.model';
import { SectionsType } from '../sections/sections-type';
import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';
/** /**
* This component represents the submission form. * This component represents the submission form.
@@ -69,6 +71,11 @@ export class SubmissionFormComponent implements OnChanges, OnDestroy {
*/ */
public loading: Observable<boolean> = observableOf(true); public loading: Observable<boolean> = observableOf(true);
/**
* Emits true when the submission config has bitstream uploading enabled in submission
*/
public uploadEnabled$ = new BehaviorSubject<boolean>(false);
/** /**
* Observable of the list of submission's sections * Observable of the list of submission's sections
* @type {Observable<WorkspaceitemSectionsObject>} * @type {Observable<WorkspaceitemSectionsObject>}
@@ -128,7 +135,11 @@ export class SubmissionFormComponent implements OnChanges, OnDestroy {
} else { } else {
return observableOf([]); return observableOf([]);
} }
})); }),
tap((sectionList) => {
this.uploadEnabled$.next(isNotEmpty(sectionList) && sectionList.some(config => config.sectionType === SectionsType.Upload));
})
);
// check if is submission loading // check if is submission loading
this.loading = this.submissionService.getSubmissionObject(this.submissionId).pipe( this.loading = this.submissionService.getSubmissionObject(this.submissionId).pipe(