mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-19 07:53:02 +00:00
Merge remote-tracking branch 'origin/main' into more-eslint
This commit is contained in:
@@ -1,22 +1,6 @@
|
||||
import {
|
||||
ChangeDetectorRef,
|
||||
Component,
|
||||
Inject,
|
||||
} from '@angular/core';
|
||||
import {
|
||||
BehaviorSubject,
|
||||
combineLatest as observableCombineLatest,
|
||||
Observable,
|
||||
Subscription,
|
||||
} from 'rxjs';
|
||||
import {
|
||||
distinctUntilChanged,
|
||||
filter,
|
||||
map,
|
||||
mergeMap,
|
||||
switchMap,
|
||||
tap,
|
||||
} from 'rxjs/operators';
|
||||
import { ChangeDetectorRef, Component, Inject } from '@angular/core';
|
||||
import { BehaviorSubject, combineLatest as observableCombineLatest, combineLatest, Observable, Subscription } from 'rxjs';
|
||||
import { distinctUntilChanged, filter, map, mergeMap, switchMap, tap } from 'rxjs/operators';
|
||||
|
||||
import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
|
||||
import { AccessConditionOption } from '../../../core/config/models/config-access-condition-option.model';
|
||||
@@ -31,18 +15,14 @@ import { ResourcePolicyDataService } from '../../../core/resource-policy/resourc
|
||||
import { Collection } from '../../../core/shared/collection.model';
|
||||
import { getFirstSucceededRemoteData } from '../../../core/shared/operators';
|
||||
import { AlertType } from '../../../shared/alert/alert-type';
|
||||
import {
|
||||
hasValue,
|
||||
isNotEmpty,
|
||||
isNotUndefined,
|
||||
isUndefined,
|
||||
} from '../../../shared/empty.util';
|
||||
import { hasValue, isNotEmpty, isNotUndefined, isUndefined } from '../../../shared/empty.util';
|
||||
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
||||
import { SubmissionObjectEntry } from '../../objects/submission-objects.reducer';
|
||||
import { SubmissionService } from '../../submission.service';
|
||||
import { SectionModelComponent } from '../models/section.model';
|
||||
import { SectionDataObject } from '../models/section-data.model';
|
||||
import { SectionsService } from '../sections.service';
|
||||
import { WorkspaceitemSectionUploadObject } from 'src/app/core/submission/models/workspaceitem-section-upload.model';
|
||||
import { renderSectionFor } from '../sections-decorator';
|
||||
import { SectionsType } from '../sections-type';
|
||||
import { SectionUploadService } from './section-upload.service';
|
||||
@@ -73,10 +53,10 @@ export class SubmissionSectionUploadComponent extends SectionModelComponent {
|
||||
public AlertTypeEnum = AlertType;
|
||||
|
||||
/**
|
||||
* The array containing the keys of file list array
|
||||
* The uuid of primary bitstream file
|
||||
* @type {Array}
|
||||
*/
|
||||
public fileIndexes: string[] = [];
|
||||
public primaryBitstreamUUID: string | null = null;
|
||||
|
||||
/**
|
||||
* The file list
|
||||
@@ -209,29 +189,20 @@ export class SubmissionSectionUploadComponent extends SectionModelComponent {
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}),
|
||||
|
||||
// retrieve submission's bitstreams from state
|
||||
observableCombineLatest(this.configMetadataForm$,
|
||||
this.bitstreamService.getUploadedFileList(this.submissionId, this.sectionData.id)).pipe(
|
||||
filter(([configMetadataForm, fileList]: [SubmissionFormsModel, any[]]) => {
|
||||
return isNotEmpty(configMetadataForm) && isNotUndefined(fileList);
|
||||
|
||||
// retrieve submission's bitstream data from state
|
||||
combineLatest([this.configMetadataForm$,
|
||||
this.bitstreamService.getUploadedFilesData(this.submissionId, this.sectionData.id)]).pipe(
|
||||
filter(([configMetadataForm, { files }]: [SubmissionFormsModel, WorkspaceitemSectionUploadObject]) => {
|
||||
return isNotEmpty(configMetadataForm) && isNotEmpty(files);
|
||||
}),
|
||||
distinctUntilChanged())
|
||||
.subscribe(([configMetadataForm, fileList]: [SubmissionFormsModel, any[]]) => {
|
||||
this.fileList = [];
|
||||
this.fileIndexes = [];
|
||||
this.fileNames = [];
|
||||
this.changeDetectorRef.detectChanges();
|
||||
if (isNotUndefined(fileList) && fileList.length > 0) {
|
||||
fileList.forEach((file) => {
|
||||
this.fileList.push(file);
|
||||
this.fileIndexes.push(file.uuid);
|
||||
this.fileNames.push(this.getFileName(configMetadataForm, file));
|
||||
});
|
||||
.subscribe(([configMetadataForm, { primary, files }]: [SubmissionFormsModel, WorkspaceitemSectionUploadObject]) => {
|
||||
this.primaryBitstreamUUID = primary;
|
||||
this.fileList = files;
|
||||
this.fileNames = Array.from(files, file => this.getFileName(configMetadataForm, file));
|
||||
}
|
||||
|
||||
this.changeDetectorRef.detectChanges();
|
||||
},
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user