diff --git a/src/app/core/shared/context.model.ts b/src/app/core/shared/context.model.ts
index dbe5a64552..acc3313bb7 100644
--- a/src/app/core/shared/context.model.ts
+++ b/src/app/core/shared/context.model.ts
@@ -16,4 +16,5 @@ export enum Context {
AdminWorkflowSearch = 'adminWorkflowSearch',
SideBarSearchModal = 'sideBarSearchModal',
SideBarSearchModalCurrent = 'sideBarSearchModalCurrent',
+ Bitstream = 'bitstream',
}
diff --git a/src/app/item-page/edit-item-page/edit-item-page.module.ts b/src/app/item-page/edit-item-page/edit-item-page.module.ts
index 65862b3de8..fb46697c7d 100644
--- a/src/app/item-page/edit-item-page/edit-item-page.module.ts
+++ b/src/app/item-page/edit-item-page/edit-item-page.module.ts
@@ -43,6 +43,10 @@ import {
AccessControlArrayFormModule
} from '../../shared/access-control-array-form/access-control-array-form.component';
import { UiSwitchModule } from 'ngx-ui-switch';
+import {
+ ItemAccessControlSelectBitstreamsModalComponent
+} from './item-access-control/item-access-control-select-bitstreams-modal/item-access-control-select-bitstreams-modal.component';
+import { ResultsBackButtonModule } from '../../shared/results-back-button/results-back-button.module';
/**
@@ -62,6 +66,7 @@ import { UiSwitchModule } from 'ngx-ui-switch';
DsoSharedModule,
AccessControlArrayFormModule,
UiSwitchModule,
+ ResultsBackButtonModule,
],
declarations: [
EditItemPageComponent,
@@ -89,7 +94,8 @@ import { UiSwitchModule } from 'ngx-ui-switch';
ItemAuthorizationsComponent,
IdentifierDataComponent,
ItemRegisterDoiComponent,
- ItemAccessControlComponent
+ ItemAccessControlComponent,
+ ItemAccessControlSelectBitstreamsModalComponent
],
providers: [
BundleDataService,
diff --git a/src/app/item-page/edit-item-page/item-access-control/item-access-control-select-bitstreams-modal/item-access-control-select-bitstreams-modal.component.html b/src/app/item-page/edit-item-page/item-access-control/item-access-control-select-bitstreams-modal/item-access-control-select-bitstreams-modal.component.html
new file mode 100644
index 0000000000..e4159f3505
--- /dev/null
+++ b/src/app/item-page/edit-item-page/item-access-control/item-access-control-select-bitstreams-modal/item-access-control-select-bitstreams-modal.component.html
@@ -0,0 +1,33 @@
+
+
+
+ 0"
+ [config]="paginationConfig"
+ [context]="context"
+ [objects]="data"
+ [selectable]="true"
+ [selectionConfig]="{ repeatable: true, listId: LIST_ID }"
+ [showPaginator]="true"
+ (pageChange)="loadForPage($event)">
+
+
+
+ {{'browse.empty' | translate}}
+
+
+
+
+
diff --git a/src/app/item-page/edit-item-page/item-access-control/item-access-control-select-bitstreams-modal/item-access-control-select-bitstreams-modal.component.scss b/src/app/item-page/edit-item-page/item-access-control/item-access-control-select-bitstreams-modal/item-access-control-select-bitstreams-modal.component.scss
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/app/item-page/edit-item-page/item-access-control/item-access-control-select-bitstreams-modal/item-access-control-select-bitstreams-modal.component.spec.ts b/src/app/item-page/edit-item-page/item-access-control/item-access-control-select-bitstreams-modal/item-access-control-select-bitstreams-modal.component.spec.ts
new file mode 100644
index 0000000000..7716bda735
--- /dev/null
+++ b/src/app/item-page/edit-item-page/item-access-control/item-access-control-select-bitstreams-modal/item-access-control-select-bitstreams-modal.component.spec.ts
@@ -0,0 +1,25 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { ItemAccessControlSelectBitstreamsModalComponent } from './item-access-control-select-bitstreams-modal.component';
+
+describe('ItemAccessControlSelectBitstreamsModalComponent', () => {
+ let component: ItemAccessControlSelectBitstreamsModalComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [ ItemAccessControlSelectBitstreamsModalComponent ]
+ })
+ .compileComponents();
+ });
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(ItemAccessControlSelectBitstreamsModalComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/item-page/edit-item-page/item-access-control/item-access-control-select-bitstreams-modal/item-access-control-select-bitstreams-modal.component.ts b/src/app/item-page/edit-item-page/item-access-control/item-access-control-select-bitstreams-modal/item-access-control-select-bitstreams-modal.component.ts
new file mode 100644
index 0000000000..dbae803c44
--- /dev/null
+++ b/src/app/item-page/edit-item-page/item-access-control/item-access-control-select-bitstreams-modal/item-access-control-select-bitstreams-modal.component.ts
@@ -0,0 +1,62 @@
+import { Component, Input, OnInit } from '@angular/core';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
+import { PaginationService } from '../../../../core/pagination/pagination.service';
+import { TranslateService } from '@ngx-translate/core';
+import { BitstreamDataService } from '../../../../core/data/bitstream-data.service';
+import { BehaviorSubject } from 'rxjs';
+import { Item } from '../../../../core/shared/item.model';
+import { getFirstCompletedRemoteData } from '../../../../core/shared/operators';
+import { PaginatedList } from '../../../../core/data/paginated-list.model';
+import { Bitstream } from '../../../../core/shared/bitstream.model';
+import { RemoteData } from '../../../../core/data/remote-data';
+import { PaginationComponentOptions } from '../../../../shared/pagination/pagination-component-options.model';
+import { hasValue } from '../../../../shared/empty.util';
+import { Context } from '../../../../core/shared/context.model';
+
+export const ITEM_ACCESS_CONTROL_SELECT_BITSTREAMS_LIST_ID = 'item-access-control-select-bitstreams'
+
+@Component({
+ selector: 'ds-item-access-control-select-bitstreams-modal',
+ templateUrl: './item-access-control-select-bitstreams-modal.component.html',
+ styleUrls: [ './item-access-control-select-bitstreams-modal.component.scss' ]
+})
+export class ItemAccessControlSelectBitstreamsModalComponent implements OnInit {
+
+ LIST_ID = ITEM_ACCESS_CONTROL_SELECT_BITSTREAMS_LIST_ID;
+
+ @Input() item!: Item;
+ @Input() selectedBitstreams: string[] = [];
+
+ data$ = new BehaviorSubject> | null>(null);
+ paginationConfig: PaginationComponentOptions;
+ pageSize = 5;
+
+ context: Context = Context.Bitstream;
+
+ constructor(
+ private bitstreamService: BitstreamDataService,
+ protected paginationService: PaginationService,
+ protected translateService: TranslateService,
+ public activeModal: NgbActiveModal
+ ) { }
+
+ ngOnInit() {
+ this.loadForPage(1);
+
+ this.paginationConfig = new PaginationComponentOptions();
+ this.paginationConfig.id = 'iacsbm';
+ this.paginationConfig.currentPage = 1;
+ if (hasValue(this.pageSize)) {
+ this.paginationConfig.pageSize = this.pageSize;
+ }
+ }
+
+ loadForPage(page: number) {
+ this.bitstreamService.findAllByItemAndBundleName(this.item, 'ORIGINAL', { currentPage: page}, false)
+ .pipe(
+ getFirstCompletedRemoteData(),
+ )
+ .subscribe(this.data$);
+ }
+
+}
diff --git a/src/app/item-page/edit-item-page/item-access-control/item-access-control.component.html b/src/app/item-page/edit-item-page/item-access-control/item-access-control.component.html
index 4e72d0905f..6b65f2fe8b 100644
--- a/src/app/item-page/edit-item-page/item-access-control/item-access-control.component.html
+++ b/src/app/item-page/edit-item-page/item-access-control/item-access-control.component.html
@@ -87,6 +87,14 @@
diff --git a/src/app/item-page/edit-item-page/item-access-control/item-access-control.component.ts b/src/app/item-page/edit-item-page/item-access-control/item-access-control.component.ts
index 5bd614537a..29f1d55ada 100644
--- a/src/app/item-page/edit-item-page/item-access-control/item-access-control.component.ts
+++ b/src/app/item-page/edit-item-page/item-access-control/item-access-control.component.ts
@@ -1,22 +1,42 @@
-import { Component, OnInit, ViewChild } from '@angular/core';
+import { ChangeDetectorRef, Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
import {
AccessControlArrayFormComponent
} from '../../../shared/access-control-array-form/access-control-array-form.component';
-import { shareReplay } from 'rxjs';
+import { concatMap, Observable, shareReplay } from 'rxjs';
import { ItemAccessControlService } from './item-access-control.service';
+import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
+import {
+ ITEM_ACCESS_CONTROL_SELECT_BITSTREAMS_LIST_ID,
+ ItemAccessControlSelectBitstreamsModalComponent
+} from './item-access-control-select-bitstreams-modal/item-access-control-select-bitstreams-modal.component';
+import { map, take } from 'rxjs/operators';
+import { getFirstSucceededRemoteData } from '../../../core/shared/operators';
+import { RemoteData } from '../../../core/data/remote-data';
+import { Item } from '../../../core/shared/item.model';
+import { ActivatedRoute } from '@angular/router';
+import { SelectableListService } from '../../../shared/object-list/selectable-list/selectable-list.service';
+import { ListableObject } from '../../../shared/object-collection/shared/listable-object.model';
@Component({
selector: 'ds-item-access-control',
templateUrl: './item-access-control.component.html',
- styleUrls: ['./item-access-control.component.scss'],
- providers: [ItemAccessControlService]
+ styleUrls: [ './item-access-control.component.scss' ],
+ providers: [ ItemAccessControlService ]
})
-export class ItemAccessControlComponent implements OnInit {
+export class ItemAccessControlComponent implements OnInit, OnDestroy {
+
+ itemRD$: Observable>;
@ViewChild('bitstreamAccessCmp', { static: true }) bitstreamAccessCmp: AccessControlArrayFormComponent;
@ViewChild('itemAccessCmp', { static: true }) itemAccessCmp: AccessControlArrayFormComponent;
- constructor(private itemAccessControlService: ItemAccessControlService) {}
+ constructor(
+ private itemAccessControlService: ItemAccessControlService,
+ private selectableListService: SelectableListService,
+ protected modalService: NgbModal,
+ private route: ActivatedRoute,
+ private cdr: ChangeDetectorRef
+ ) {}
state = initialState;
@@ -25,7 +45,9 @@ export class ItemAccessControlComponent implements OnInit {
);
ngOnInit(): void {
-
+ this.itemRD$ = this.route.parent.parent.data.pipe(
+ map((data) => data.dso)
+ ).pipe(getFirstSucceededRemoteData()) as Observable>;
}
reset() {
@@ -52,6 +74,24 @@ export class ItemAccessControlComponent implements OnInit {
active ? this.itemAccessCmp.enable() : this.itemAccessCmp.disable();
}
}
+
+ openSelectBitstreamsModal(item: Item) {
+ const ref = this.modalService.open(ItemAccessControlSelectBitstreamsModalComponent);
+ ref.componentInstance.selectedBitstreams = this.state.bitstream.selectedBitstreams;
+ ref.componentInstance.item = item;
+
+ ref.closed.pipe(
+ concatMap(() => this.selectableListService.getSelectableList(ITEM_ACCESS_CONTROL_SELECT_BITSTREAMS_LIST_ID)),
+ take(1)
+ ).subscribe((list) => {
+ this.state.bitstream.selectedBitstreams = list.selection;
+ this.cdr.detectChanges();
+ });
+ }
+
+ ngOnDestroy(): void {
+ this.selectableListService.deselectAll(ITEM_ACCESS_CONTROL_SELECT_BITSTREAMS_LIST_ID);
+ }
}
const initialState = {
@@ -63,6 +103,6 @@ const initialState = {
toggleStatus: false,
accessMode: '',
changesLimit: '', // 'all' | 'selected'
- selectedBitstreams: []
+ selectedBitstreams: [] as ListableObject[],
},
};
diff --git a/src/app/shared/object-list/bitstream-list-item/bitstream-list-item.component.html b/src/app/shared/object-list/bitstream-list-item/bitstream-list-item.component.html
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/app/shared/object-list/bitstream-list-item/bitstream-list-item.component.scss b/src/app/shared/object-list/bitstream-list-item/bitstream-list-item.component.scss
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/app/shared/object-list/bitstream-list-item/bitstream-list-item.component.spec.ts b/src/app/shared/object-list/bitstream-list-item/bitstream-list-item.component.spec.ts
new file mode 100644
index 0000000000..25d6a56295
--- /dev/null
+++ b/src/app/shared/object-list/bitstream-list-item/bitstream-list-item.component.spec.ts
@@ -0,0 +1,25 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { BitstreamListItemComponent } from './bitstream-list-item.component';
+
+describe('BitstreamListItemComponent', () => {
+ let component: BitstreamListItemComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [ BitstreamListItemComponent ]
+ })
+ .compileComponents();
+ });
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(BitstreamListItemComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/shared/object-list/bitstream-list-item/bitstream-list-item.component.ts b/src/app/shared/object-list/bitstream-list-item/bitstream-list-item.component.ts
new file mode 100644
index 0000000000..f281c0bd77
--- /dev/null
+++ b/src/app/shared/object-list/bitstream-list-item/bitstream-list-item.component.ts
@@ -0,0 +1,17 @@
+import { Component } from '@angular/core';
+import { listableObjectComponent } from '../../object-collection/shared/listable-object/listable-object.decorator';
+import { ViewMode } from '../../../core/shared/view-mode.model';
+import {
+ AbstractListableElementComponent
+} from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
+import { Bitstream } from '../../../core/shared/bitstream.model';
+import { Context } from '../../../core/shared/context.model';
+
+
+@listableObjectComponent(Bitstream, ViewMode.ListElement, Context.Bitstream)
+@Component({
+ selector: 'ds-bitstream-list-item',
+ template: ` {{object.name}} `,
+ styleUrls: ['./bitstream-list-item.component.scss']
+})
+export class BitstreamListItemComponent extends AbstractListableElementComponent{}
diff --git a/src/app/shared/object-list/themed-object-list.component.ts b/src/app/shared/object-list/themed-object-list.component.ts
index 4d7b5ca77b..4a04061a5c 100644
--- a/src/app/shared/object-list/themed-object-list.component.ts
+++ b/src/app/shared/object-list/themed-object-list.component.ts
@@ -48,7 +48,7 @@ export class ThemedObjectListComponent extends ThemedComponent