Skip to content

Commit 88d13c7

Browse files
[DURACOM-413] update labels, fix sync script, adapt section handling
1 parent 7f9b625 commit 88d13c7

48 files changed

Lines changed: 10836 additions & 1925 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/app/core/provide-core.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
makeEnvironmentProviders,
55
} from '@angular/core';
66
import { APP_CONFIG } from '@dspace/config/app-config.interface';
7+
import { SubmissionCustomUrl } from '@dspace/core/submission/models/submission-custom-url.model';
78

89
import { Audit } from './audit/model/audit.model';
910
import { AuthStatus } from './auth/models/auth-status.model';
@@ -230,4 +231,5 @@ export const models =
230231
StatisticsEndpoint,
231232
CorrectionType,
232233
SupervisionOrder,
234+
SubmissionCustomUrl,
233235
];

src/app/core/router/utils/dso-route.utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ export function getItemPageRoute(item: Item) {
3333
const type = item.firstMetadataValue('dspace.entity.type');
3434
let url = item.uuid;
3535

36-
if (isNotEmpty(item.metadata) && item.hasMetadata('cris.customurl')) {
37-
url = item.firstMetadataValue('cris.customurl');
36+
if (isNotEmpty(item.metadata) && item.hasMetadata('dspace.customurl')) {
37+
url = item.firstMetadataValue('dspace.customurl');
3838
}
3939

4040
return getEntityPageRoute(type, url);
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import {
2+
autoserialize,
3+
inheritSerialization,
4+
} from 'cerialize';
5+
6+
import { typedObject } from '../../cache/builders/build-decorators';
7+
import { HALResource } from '../../shared/hal-resource.model';
8+
import { ResourceType } from '../../shared/resource-type';
9+
import { excludeFromEquals } from '../../utilities/equals.decorators';
10+
import { SUBMISSION_CUSTOM_URL } from './submission-custom-url.resource-type';
11+
12+
@typedObject
13+
@inheritSerialization(HALResource)
14+
export class SubmissionCustomUrl extends HALResource {
15+
16+
static type = SUBMISSION_CUSTOM_URL;
17+
18+
/**
19+
* The object type
20+
*/
21+
@excludeFromEquals
22+
@autoserialize
23+
type: ResourceType;
24+
25+
@autoserialize
26+
url: string;
27+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { ResourceType } from '../../shared/resource-type';
2+
3+
/**
4+
* The resource type for License
5+
*
6+
* Needs to be in a separate file to prevent circular
7+
* dependencies in webpack.
8+
*/
9+
export const SUBMISSION_CUSTOM_URL = new ResourceType('submissioncustomcurl');

src/app/item-page/item-page.resolver.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ describe('itemPageResolver', () => {
102102

103103
});
104104

105-
describe('when item has cris.customurl metadata', () => {
105+
describe('when item has dspace.customurl metadata', () => {
106106

107107

108108
const customUrl = 'my-custom-item';
@@ -126,7 +126,7 @@ describe('itemPageResolver', () => {
126126
return true;
127127
},
128128
metadata: {
129-
'cris.customurl': customUrl,
129+
'dspace.customurl': customUrl,
130130
},
131131
});
132132
itemService = {
@@ -139,7 +139,7 @@ describe('itemPageResolver', () => {
139139
resolver = itemPageResolver;
140140
});
141141

142-
it('should navigate to the new custom URL if cris.customurl is defined and different from route param', (done) => {
142+
it('should navigate to the new custom URL if dspace.customurl is defined and different from route param', (done) => {
143143
spyOn(router, 'navigateByUrl').and.callThrough();
144144

145145
const route = { params: { id: uuid } } as any;
@@ -154,7 +154,7 @@ describe('itemPageResolver', () => {
154154
});
155155
});
156156

157-
it('should not navigate if cris.customurl matches the current route id', (done) => {
157+
it('should not navigate if dspace.customurl matches the current route id', (done) => {
158158
spyOn(router, 'navigateByUrl').and.callThrough();
159159

160160
const route = { params: { id: customUrl } } as any;

src/app/item-page/item-page.resolver.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ export const itemPageResolver: ResolveFn<RemoteData<Item>> = (
6161
if (rd.hasSucceeded && hasValue(rd.payload)) {
6262
const isItemEditPage = state.url.includes('/edit');
6363
let itemRoute = isItemEditPage ? state.url : router.parseUrl(getItemPageRoute(rd.payload)).toString();
64-
if (hasValue(rd.payload.metadata) && rd.payload.hasMetadata('cris.customurl')) {
65-
if (route.params.id !== rd.payload.firstMetadataValue('cris.customurl')) {
66-
const newUrl = itemRoute.replace(route.params.id,rd.payload.firstMetadataValue('cris.customurl'));
64+
if (hasValue(rd.payload.metadata) && rd.payload.hasMetadata('dspace.customurl')) {
65+
if (route.params.id !== rd.payload.firstMetadataValue('dspace.customurl')) {
66+
const newUrl = itemRoute.replace(route.params.id,rd.payload.firstMetadataValue('dspace.customurl'));
6767
router.navigateByUrl(newUrl);
6868
}
6969
} else {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
[submissionErrors]="submissionErrors"
77
[item]="item"
88
[collectionModifiable]="collectionModifiable"
9-
[submissionId]="submissionId"></ds-submission-form>
9+
[submissionId]="submissionId"
10+
[entityType]="entityType"></ds-submission-form>
1011
</div>

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ export class SubmissionEditComponent implements OnDestroy, OnInit {
6666
*/
6767
public collectionModifiable: boolean | null = null;
6868

69+
/**
70+
* The entity type of the submission
71+
* @type {string}
72+
*/
73+
public entityType: string;
6974

7075
/**
7176
* The list of submission's sections
@@ -154,6 +159,11 @@ export class SubmissionEditComponent implements OnDestroy, OnInit {
154159
this.notificationsService.info(null, this.translate.get('submission.general.cannot_submit'));
155160
this.router.navigate(['/mydspace']);
156161
} else {
162+
const collection = submissionObjectRD.payload.collection as Collection;
163+
const entityType = collection.hasMetadata('dspace.entity.type') ? collection.firstMetadataValue('dspace.entity.type') : null;
164+
if (hasValue(entityType)) {
165+
this.entityType = entityType;
166+
}
157167
const { errors } = submissionObjectRD.payload;
158168
this.submissionErrors = parseSectionErrors(errors);
159169
this.submissionId = submissionObjectRD.payload.id.toString();

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
@for (object of $any(submissionSections | async); track object) {
3737
<ds-submission-section-container [collectionId]="collectionId"
3838
[submissionId]="submissionId"
39+
[entityType]="entityType"
3940
[sectionData]="$any(object)">
4041
</ds-submission-section-container>
4142
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ export class SubmissionFormComponent implements OnChanges, OnDestroy {
115115
*/
116116
@Input() submissionId: string;
117117

118+
/**
119+
* The entity type input used to create a new submission
120+
* @type {string}
121+
*/
122+
@Input() entityType: string;
123+
118124
/**
119125
* The configuration id that define this submission
120126
* @type {string}

0 commit comments

Comments
 (0)