>;
+
+ /**
+ * Initialize instance variables
+ *
+ * @param {ActivatedRoute} route
+ */
+ constructor(
+ private route: ActivatedRoute
+ ) {
+ }
+
+ /**
+ * Initialize the component, setting up the collection
+ */
+ ngOnInit(): void {
+ this.dsoRD$ = this.route.data.pipe(first(), map((data) => data.bitstream));
+ }
+}
diff --git a/src/app/+bitstream-page/bitstream-page-routing.module.ts b/src/app/+bitstream-page/bitstream-page-routing.module.ts
index bbbd65f279..284f29f7b4 100644
--- a/src/app/+bitstream-page/bitstream-page-routing.module.ts
+++ b/src/app/+bitstream-page/bitstream-page-routing.module.ts
@@ -4,8 +4,14 @@ import { EditBitstreamPageComponent } from './edit-bitstream-page/edit-bitstream
import { AuthenticatedGuard } from '../core/auth/authenticated.guard';
import { BitstreamPageResolver } from './bitstream-page.resolver';
import { BitstreamDownloadPageComponent } from '../shared/bitstream-download-page/bitstream-download-page.component';
+import { ResourcePolicyTargetResolver } from '../shared/resource-policies/resolvers/resource-policy-target.resolver';
+import { ResourcePolicyCreateComponent } from '../shared/resource-policies/create/resource-policy-create.component';
+import { ResourcePolicyResolver } from '../shared/resource-policies/resolvers/resource-policy.resolver';
+import { ResourcePolicyEditComponent } from '../shared/resource-policies/edit/resource-policy-edit.component';
+import { BitstreamAuthorizationsComponent } from './bitstream-authorizations/bitstream-authorizations.component';
const EDIT_BITSTREAM_PATH = ':id/edit';
+const EDIT_BITSTREAM_AUTHORIZATIONS_PATH = ':id/authorizations';
/**
* Routing module to help navigate Bitstream pages
@@ -27,6 +33,36 @@ const EDIT_BITSTREAM_PATH = ':id/edit';
bitstream: BitstreamPageResolver
},
canActivate: [AuthenticatedGuard]
+ },
+ {
+ path: EDIT_BITSTREAM_AUTHORIZATIONS_PATH,
+
+ children: [
+ {
+ path: 'create',
+ resolve: {
+ resourcePolicyTarget: ResourcePolicyTargetResolver
+ },
+ component: ResourcePolicyCreateComponent,
+ data: { title: 'resource-policies.create.page.title', showBreadcrumbs: true }
+ },
+ {
+ path: 'edit',
+ resolve: {
+ resourcePolicy: ResourcePolicyResolver
+ },
+ component: ResourcePolicyEditComponent,
+ data: { title: 'resource-policies.edit.page.title', showBreadcrumbs: true }
+ },
+ {
+ path: '',
+ resolve: {
+ bitstream: BitstreamPageResolver
+ },
+ component: BitstreamAuthorizationsComponent,
+ data: { title: 'bitstream.edit.authorizations.title', showBreadcrumbs: true }
+ }
+ ]
}
])
],
diff --git a/src/app/+bitstream-page/bitstream-page.module.ts b/src/app/+bitstream-page/bitstream-page.module.ts
index 24b4cd512f..80e5ad14e3 100644
--- a/src/app/+bitstream-page/bitstream-page.module.ts
+++ b/src/app/+bitstream-page/bitstream-page.module.ts
@@ -3,6 +3,7 @@ import { CommonModule } from '@angular/common';
import { SharedModule } from '../shared/shared.module';
import { EditBitstreamPageComponent } from './edit-bitstream-page/edit-bitstream-page.component';
import { BitstreamPageRoutingModule } from './bitstream-page-routing.module';
+import { BitstreamAuthorizationsComponent } from './bitstream-authorizations/bitstream-authorizations.component';
/**
* This module handles all components that are necessary for Bitstream related pages
@@ -14,6 +15,7 @@ import { BitstreamPageRoutingModule } from './bitstream-page-routing.module';
BitstreamPageRoutingModule
],
declarations: [
+ BitstreamAuthorizationsComponent,
EditBitstreamPageComponent
]
})
diff --git a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.html b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.html
index fd13e249a0..cbb587cca4 100644
--- a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.html
+++ b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.html
@@ -19,7 +19,11 @@
[submitLabel]="'form.save'"
(submitForm)="onSubmit()"
(cancel)="onCancel()"
- (dfChange)="onChange($event)">
+ (dfChange)="onChange($event)">
+
+
diff --git a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts
index 2e7eb4e1d1..9c2cb3a093 100644
--- a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts
+++ b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts
@@ -18,12 +18,8 @@ import { hasValue } from '../../shared/empty.util';
import { FormControl, FormGroup } from '@angular/forms';
import { FileSizePipe } from '../../shared/utils/file-size-pipe';
import { VarDirective } from '../../shared/utils/var.directive';
-import {
- createSuccessfulRemoteDataObject,
- createSuccessfulRemoteDataObject$
-} from '../../shared/remote-data.utils';
-import { RouterStub } from '../../shared/testing/router.stub';
-import { getEntityEditRoute, getItemEditRoute } from '../../+item-page/item-page-routing-paths';
+import { createSuccessfulRemoteDataObject, createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
+import { getEntityEditRoute } from '../../+item-page/item-page-routing-paths';
import { createPaginatedList } from '../../shared/testing/utils.test';
import { Item } from '../../core/shared/item.model';
@@ -39,7 +35,6 @@ let bitstream: Bitstream;
let selectedFormat: BitstreamFormat;
let allFormats: BitstreamFormat[];
let router: Router;
-let routerStub;
describe('EditBitstreamPageComponent', () => {
let comp: EditBitstreamPageComponent;
@@ -129,10 +124,6 @@ describe('EditBitstreamPageComponent', () => {
findAll: createSuccessfulRemoteDataObject$(createPaginatedList(allFormats))
});
- const itemPageUrl = `fake-url/some-uuid`;
- routerStub = Object.assign(new RouterStub(), {
- url: `${itemPageUrl}`
- });
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), RouterTestingModule],
declarations: [EditBitstreamPageComponent, FileSizePipe, VarDirective],
@@ -142,7 +133,6 @@ describe('EditBitstreamPageComponent', () => {
{ provide: ActivatedRoute, useValue: { data: observableOf({ bitstream: createSuccessfulRemoteDataObject(bitstream) }), snapshot: { queryParams: {} } } },
{ provide: BitstreamDataService, useValue: bitstreamService },
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatService },
- { provide: Router, useValue: routerStub },
ChangeDetectorRef
],
schemas: [NO_ERRORS_SCHEMA]
@@ -154,7 +144,8 @@ describe('EditBitstreamPageComponent', () => {
fixture = TestBed.createComponent(EditBitstreamPageComponent);
comp = fixture.componentInstance;
fixture.detectChanges();
- router = (comp as any).router;
+ router = TestBed.inject(Router);
+ spyOn(router, 'navigate');
});
describe('on startup', () => {
@@ -241,14 +232,14 @@ describe('EditBitstreamPageComponent', () => {
it('should redirect to the item edit page on the bitstreams tab with the itemId from the component', () => {
comp.itemId = 'some-uuid1';
comp.navigateToItemEditBitstreams();
- expect(routerStub.navigate).toHaveBeenCalledWith([getEntityEditRoute(null, 'some-uuid1'), 'bitstreams']);
+ expect(router.navigate).toHaveBeenCalledWith([getEntityEditRoute(null, 'some-uuid1'), 'bitstreams']);
});
});
describe('when navigateToItemEditBitstreams is called, and the component does not have an itemId', () => {
it('should redirect to the item edit page on the bitstreams tab with the itemId from the bundle links ', () => {
comp.itemId = undefined;
comp.navigateToItemEditBitstreams();
- expect(routerStub.navigate).toHaveBeenCalledWith([getEntityEditRoute(null, 'some-uuid'), 'bitstreams']);
+ expect(router.navigate).toHaveBeenCalledWith([getEntityEditRoute(null, 'some-uuid'), 'bitstreams']);
});
});
});
diff --git a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts
index 8a4d584647..4ad0aac7ef 100644
--- a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts
+++ b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts
@@ -19,10 +19,10 @@ import { cloneDeep } from 'lodash';
import { BitstreamDataService } from '../../core/data/bitstream-data.service';
import {
getAllSucceededRemoteDataPayload,
- getFirstSucceededRemoteDataPayload,
- getRemoteDataPayload,
+ getFirstCompletedRemoteData,
getFirstSucceededRemoteData,
- getFirstCompletedRemoteData
+ getFirstSucceededRemoteDataPayload,
+ getRemoteDataPayload
} from '../../core/shared/operators';
import { NotificationsService } from '../../shared/notifications/notifications.service';
import { BitstreamFormatDataService } from '../../core/data/bitstream-format-data.service';
@@ -131,15 +131,6 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
rows: 10
});
- /**
- * The Dynamic Input Model for the file's embargo (disabled on this page)
- */
- embargoModel = new DynamicInputModel({
- id: 'embargo',
- name: 'embargo',
- disabled: true
- });
-
/**
* The Dynamic Input Model for the selected format
*/
@@ -159,7 +150,7 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
/**
* All input models in a simple array for easier iterations
*/
- inputModels = [this.fileNameModel, this.primaryBitstreamModel, this.descriptionModel, this.embargoModel, this.selectedFormatModel, this.newFormatModel];
+ inputModels = [this.fileNameModel, this.primaryBitstreamModel, this.descriptionModel, this.selectedFormatModel, this.newFormatModel];
/**
* The dynamic form fields used for editing the information of a bitstream
@@ -179,12 +170,6 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
this.descriptionModel
]
}),
- new DynamicFormGroupModel({
- id: 'embargoContainer',
- group: [
- this.embargoModel
- ]
- }),
new DynamicFormGroupModel({
id: 'formatContainer',
group: [
@@ -243,11 +228,6 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
host: 'row'
}
},
- embargoContainer: {
- grid: {
- host: 'row'
- }
- },
formatContainer: {
grid: {
host: 'row'
diff --git a/src/app/shared/form/form.component.html b/src/app/shared/form/form.component.html
index 39ccda360f..de24880b3b 100644
--- a/src/app/shared/form/form.component.html
+++ b/src/app/shared/form/form.component.html
@@ -48,7 +48,7 @@
-
+
diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5
index 3e2cc67ecb..c6f22eb598 100644
--- a/src/assets/i18n/en.json5
+++ b/src/assets/i18n/en.json5
@@ -532,6 +532,12 @@
+ "bitstream.edit.authorizations.link": "Edit bitstream's Policies",
+
+ "bitstream.edit.authorizations.title": "Edit bitstream's Policies",
+
+ "bitstream.edit.return": "Back",
+
"bitstream.edit.bitstream": "Bitstream: ",
"bitstream.edit.form.description.hint": "Optionally, provide a brief description of the file, for example \"Main article\" or \"Experiment data readings\".",
@@ -1823,8 +1829,6 @@
"item.page.description": "Description",
- "item.page.edit": "Edit this item",
-
"item.page.journal-issn": "Journal ISSN",
"item.page.journal-title": "Journal Title",