mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-17 15:03:07 +00:00
[CST-4878] Finished working on embargo add part of form and unit testing
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { distinctUntilChanged, filter, map } from 'rxjs/operators';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { SubmissionState } from '../../submission.reducers';
|
||||
import { isUndefined } from 'util';
|
||||
import { submissionSectionFromIdSelector, submissionSectionDataFromIdSelector } from 'src/app/submission/selectors';
|
||||
|
||||
|
||||
/**
|
||||
* A service that provides methods to handle submission's bitstream state.
|
||||
*/
|
||||
@Injectable()
|
||||
export class SectionAccessesService {
|
||||
|
||||
/**
|
||||
* Initialize service variables
|
||||
*
|
||||
* @param {Store<SubmissionState>} store
|
||||
*/
|
||||
constructor(private store: Store<SubmissionState>) { }
|
||||
|
||||
|
||||
/**
|
||||
* Return bitstream's metadata
|
||||
*
|
||||
* @param submissionId
|
||||
* The submission id
|
||||
* @param sectionId
|
||||
* The section id
|
||||
* @param fileUUID
|
||||
* The bitstream UUID
|
||||
* @returns {Observable}
|
||||
* Emits bitstream's metadata
|
||||
*/
|
||||
public getAccessesData(submissionId: string, sectionId: string): Observable<any> {
|
||||
|
||||
return this.store.select(submissionSectionDataFromIdSelector(submissionId, sectionId)).pipe(
|
||||
filter((state) => !isUndefined(state)),
|
||||
distinctUntilChanged());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user