mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
63945: Allow bitstreams from other pages to be deleted
This commit is contained in:
@@ -150,7 +150,7 @@ export class ItemBitstreamsComponent extends AbstractItemUpdateComponent impleme
|
|||||||
submit() {
|
submit() {
|
||||||
const removedBitstreams$ = this.bitstreams$.pipe(
|
const removedBitstreams$ = this.bitstreams$.pipe(
|
||||||
toBitstreamsArray(),
|
toBitstreamsArray(),
|
||||||
switchMap((bitstreams: Bitstream[]) => this.objectUpdatesService.getFieldUpdatesExclusive(this.url, bitstreams) as Observable<FieldUpdates>),
|
switchMap((bitstreams: Bitstream[]) => this.objectUpdatesService.getFieldUpdates(this.url, bitstreams, true) as Observable<FieldUpdates>),
|
||||||
map((fieldUpdates: FieldUpdates) => Object.values(fieldUpdates).filter((fieldUpdate: FieldUpdate) => fieldUpdate.changeType === FieldChangeType.REMOVE)),
|
map((fieldUpdates: FieldUpdates) => Object.values(fieldUpdates).filter((fieldUpdate: FieldUpdate) => fieldUpdate.changeType === FieldChangeType.REMOVE)),
|
||||||
map((fieldUpdates: FieldUpdate[]) => fieldUpdates.map((fieldUpdate: FieldUpdate) => fieldUpdate.field)),
|
map((fieldUpdates: FieldUpdate[]) => fieldUpdates.map((fieldUpdate: FieldUpdate) => fieldUpdate.field)),
|
||||||
isNotEmptyOperator()
|
isNotEmptyOperator()
|
||||||
|
@@ -88,12 +88,14 @@ export class ObjectUpdatesService {
|
|||||||
* a FieldUpdates object
|
* a FieldUpdates object
|
||||||
* @param url The URL of the page for which the FieldUpdates should be requested
|
* @param url The URL of the page for which the FieldUpdates should be requested
|
||||||
* @param initialFields The initial values of the fields
|
* @param initialFields The initial values of the fields
|
||||||
|
* @param ignoreStates Ignore the fieldStates to loop over the fieldUpdates instead
|
||||||
*/
|
*/
|
||||||
getFieldUpdates(url: string, initialFields: Identifiable[]): Observable<FieldUpdates> {
|
getFieldUpdates(url: string, initialFields: Identifiable[], ignoreStates?: boolean): Observable<FieldUpdates> {
|
||||||
const objectUpdates = this.getObjectEntry(url);
|
const objectUpdates = this.getObjectEntry(url);
|
||||||
return objectUpdates.pipe(map((objectEntry) => {
|
return objectUpdates.pipe(map((objectEntry) => {
|
||||||
const fieldUpdates: FieldUpdates = {};
|
const fieldUpdates: FieldUpdates = {};
|
||||||
Object.keys(objectEntry.fieldStates).forEach((uuid) => {
|
console.log(objectEntry);
|
||||||
|
Object.keys(ignoreStates ? objectEntry.fieldUpdates : objectEntry.fieldStates).forEach((uuid) => {
|
||||||
let fieldUpdate = objectEntry.fieldUpdates[uuid];
|
let fieldUpdate = objectEntry.fieldUpdates[uuid];
|
||||||
if (isEmpty(fieldUpdate)) {
|
if (isEmpty(fieldUpdate)) {
|
||||||
const identifiable = initialFields.find((object: Identifiable) => object.uuid === uuid);
|
const identifiable = initialFields.find((object: Identifiable) => object.uuid === uuid);
|
||||||
|
Reference in New Issue
Block a user