Skip to content

Commit 6892489

Browse files
authored
Merge pull request DSpace#2143 from CrisGuzmanS/issues/2140
disabled the posibility to change the collection for workflow items to prevent errors
2 parents 8740eaf + bb8775a commit 6892489

7 files changed

Lines changed: 32 additions & 2 deletions

src/app/submission/edit/submission-edit.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
[submissionDefinition]="submissionDefinition"
66
[submissionErrors]="submissionErrors"
77
[item]="item"
8+
[collectionModifiable]="collectionModifiable"
89
[submissionId]="submissionId"></ds-submission-form>
910
</div>

src/app/submission/edit/submission-edit.component.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ export class SubmissionEditComponent implements OnDestroy, OnInit {
3636
*/
3737
public collectionId: string;
3838

39+
/**
40+
* Checks if the collection can be modifiable by the user
41+
* @type {booelan}
42+
*/
43+
public collectionModifiable: boolean | null = null;
44+
45+
3946
/**
4047
* The list of submission's sections
4148
* @type {WorkspaceitemSectionsObject}
@@ -109,6 +116,9 @@ export class SubmissionEditComponent implements OnDestroy, OnInit {
109116
* Retrieve workspaceitem/workflowitem from server and initialize all instance variables
110117
*/
111118
ngOnInit() {
119+
120+
this.collectionModifiable = this.route.snapshot.data?.collectionModifiable ?? null;
121+
112122
this.subs.push(
113123
this.route.paramMap.pipe(
114124
switchMap((params: ParamMap) => this.submissionService.retrieveSubmission(params.get('id'))),

src/app/submission/form/collection/submission-form-collection.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
class="btn btn-outline-primary"
2626
(blur)="onClose()"
2727
(click)="onClose()"
28-
[disabled]="(processingChange$ | async)"
28+
[disabled]="(processingChange$ | async) || collectionModifiable == false"
2929
ngbDropdownToggle>
3030
<span *ngIf="(processingChange$ | async)"><i class='fas fa-circle-notch fa-spin'></i></span>
3131
<span *ngIf="!(processingChange$ | async)">{{ selectedCollectionName$ | async }}</span>

src/app/submission/form/collection/submission-form-collection.component.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ export class SubmissionFormCollectionComponent implements OnChanges, OnInit {
5252
*/
5353
@Input() currentDefinition: string;
5454

55+
/**
56+
* Checks if the collection can be modifiable by the user
57+
* @type {booelan}
58+
*/
59+
@Input() collectionModifiable: boolean | null = null;
60+
5561
/**
5662
* The submission id
5763
* @type {string}

src/app/submission/form/submission-form.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<ds-submission-form-collection [currentCollectionId]="collectionId"
1212
[currentDefinition]="definitionId"
1313
[submissionId]="submissionId"
14+
[collectionModifiable]="collectionModifiable"
1415
(collectionChange)="onCollectionChange($event)">
1516
</ds-submission-form-collection>
1617
</div>

src/app/submission/form/submission-form.component.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,16 @@ export class SubmissionFormComponent implements OnChanges, OnDestroy {
3434
* @type {string}
3535
*/
3636
@Input() collectionId: string;
37+
3738
@Input() item: Item;
3839

40+
/**
41+
* Checks if the collection can be modifiable by the user
42+
* @type {booelan}
43+
*/
44+
@Input() collectionModifiable: boolean | null = null;
45+
46+
3947
/**
4048
* The list of submission's sections
4149
* @type {WorkspaceitemSectionsObject}

src/app/workflowitems-edit-page/workflowitems-edit-page-routing.module.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ import {
3434
resolve: {
3535
breadcrumb: I18nBreadcrumbResolver
3636
},
37-
data: { title: 'workflow-item.edit.title', breadcrumbKey: 'workflow-item.edit' }
37+
data: {
38+
title: 'workflow-item.edit.title',
39+
breadcrumbKey: 'workflow-item.edit',
40+
collectionModifiable: false
41+
}
3842
},
3943
{
4044
canActivate: [AuthenticatedGuard],

0 commit comments

Comments
 (0)