Skip to content

Commit 1488d8e

Browse files
Fix/uat draft registration (#499)
* fix(draft): registries select component * fix(stepper): update stepper validation * fix(stepper): updated touched for metadata step * fix(withdrawn): hide make decision * fix(registration): fixed withdraw
1 parent 6d7cbf4 commit 1488d8e

File tree

7 files changed

+52
-18
lines changed

7 files changed

+52
-18
lines changed

src/app/features/registry/components/registry-make-decision/registry-make-decision.component.html

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
@case (SubmissionReviewStatus.Accepted) {
99
<span class="capitalize">{{ 'moderation.submissionReview.accepted' | translate }}</span>
1010
}
11+
@case (SubmissionReviewStatus.PendingWithdrawal) {
12+
<span class="capitalize">{{ 'moderation.submissionReview.withdrawalRequested' | translate }}</span>
13+
}
1114
}
1215
<span>{{ action.dateModified | dateAgo }}</span>
1316
<span>{{ 'moderation.submissionReview.by' | translate }}</span>
@@ -20,20 +23,21 @@
2023
}
2124

2225
<form [formGroup]="requestForm" class="flex flex-column gap-3">
23-
@if (isPendingModeration || isPendingReview) {
26+
@if (isPendingModeration || isPendingReview || isPendingWithdrawal) {
2427
<div class="flex flex-column gap-2">
2528
<div class="flex gap-2">
2629
<p-radioButton
2730
[formControlName]="ModerationDecisionFormControls.Action"
2831
inputId="accept-action"
29-
[value]="
30-
isPendingReview ? ReviewActionTrigger.AcceptSubmission : SchemaResponseActionTrigger.AcceptRevision
31-
"
32+
[value]="acceptValue"
3233
></p-radioButton>
3334
<label for="accept-action" class="m-0 flex gap-2 flex-column">
3435
@if (isPendingReview) {
3536
<p class="font-bold">{{ 'moderation.makeDecision.acceptRequest' | translate }}</p>
3637
<p>{{ 'moderation.makeDecision.acceptRequestMessage' | translate }}</p>
38+
} @else if (isPendingWithdrawal) {
39+
<p class="font-bold">{{ 'moderation.makeDecision.acceptWithdrawal' | translate }}</p>
40+
<p>{{ 'moderation.makeDecision.acceptWithdrawalMessage' | translate }}</p>
3741
} @else {
3842
<p class="font-bold">{{ 'moderation.makeDecision.acceptUpdate' | translate }}</p>
3943
<p>{{ 'moderation.makeDecision.acceptUpdateMessage' | translate }}</p>
@@ -44,14 +48,15 @@
4448
<p-radioButton
4549
[formControlName]="ModerationDecisionFormControls.Action"
4650
inputId="reject-action"
47-
[value]="
48-
isPendingReview ? ReviewActionTrigger.RejectSubmission : SchemaResponseActionTrigger.RejectRevision
49-
"
51+
[value]="rejectValue"
5052
></p-radioButton>
5153
<label for="reject-action" class="m-0 flex gap-2 flex-column">
5254
@if (isPendingReview) {
5355
<p class="font-bold">{{ 'moderation.makeDecision.rejectRequest' | translate }}</p>
5456
<p>{{ 'moderation.makeDecision.rejectRequestMessage' | translate }}</p>
57+
} @else if (isPendingWithdrawal) {
58+
<p class="font-bold">{{ 'moderation.makeDecision.rejectWithdrawal' | translate }}</p>
59+
<p>{{ 'moderation.makeDecision.rejectWithdrawalMessage' | translate }}</p>
5560
} @else {
5661
<p class="font-bold">{{ 'moderation.makeDecision.rejectUpdate' | translate }}</p>
5762
<p>{{ 'moderation.makeDecision.rejectUpdateMessage' | translate }}</p>

src/app/features/registry/components/registry-make-decision/registry-make-decision.component.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ export class RegistryMakeDecisionComponent {
7878
return this.registry.reviewsState === RegistrationReviewStates.Pending;
7979
}
8080

81+
get isPendingWithdrawal(): boolean {
82+
return this.registry.reviewsState === RegistrationReviewStates.PendingWithdraw;
83+
}
84+
8185
get canWithdraw(): boolean {
8286
return (
8387
this.registry.reviewsState === RegistrationReviewStates.Accepted &&
@@ -92,6 +96,24 @@ export class RegistryMakeDecisionComponent {
9296
);
9397
}
9498

99+
get acceptValue(): string {
100+
if (this.isPendingReview) {
101+
return ReviewActionTrigger.AcceptSubmission;
102+
} else if (this.isPendingWithdrawal) {
103+
return ReviewActionTrigger.AcceptWithdrawal;
104+
}
105+
return SchemaResponseActionTrigger.AcceptRevision;
106+
}
107+
108+
get rejectValue(): string {
109+
if (this.isPendingReview) {
110+
return ReviewActionTrigger.RejectSubmission;
111+
} else if (this.isPendingWithdrawal) {
112+
return ReviewActionTrigger.RejectWithdrawal;
113+
}
114+
return SchemaResponseActionTrigger.RejectRevision;
115+
}
116+
95117
constructor() {
96118
this.initForm();
97119

@@ -122,6 +144,7 @@ export class RegistryMakeDecisionComponent {
122144
return (
123145
action === ReviewActionTrigger.RejectSubmission ||
124146
action === SchemaResponseActionTrigger.RejectRevision ||
147+
action === ReviewActionTrigger.RejectWithdrawal ||
125148
action === ReviewActionTrigger.ForceWithdraw
126149
);
127150
}

src/app/features/registry/mappers/registry-overview.mapper.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function MapRegistryOverview(data: RegistryOverviewJsonApiData): Registry
3535
middleName: contributor?.embeds?.users?.data?.attributes?.middle_names,
3636
type: contributor?.embeds?.users?.data?.type,
3737
})),
38-
identifiers: IdentifiersMapper.fromJsonApi(data.embeds.identifiers),
38+
identifiers: IdentifiersMapper.fromJsonApi(data.embeds?.identifiers),
3939
analyticsKey: data.attributes?.analytics_key,
4040
currentUserCanComment: data.attributes.current_user_can_comment,
4141
currentUserPermissions: data.attributes.current_user_permissions,
@@ -49,11 +49,11 @@ export function MapRegistryOverview(data: RegistryOverviewJsonApiData): Registry
4949
hasMaterials: data.attributes.has_materials,
5050
hasPapers: data.attributes.has_papers,
5151
hasSupplements: data.attributes.has_supplements,
52-
license: LicensesMapper.fromLicenseDataJsonApi(data.embeds.license.data),
52+
license: LicensesMapper.fromLicenseDataJsonApi(data.embeds?.license?.data),
5353
registrationSchemaLink: data.relationships.registration_schema.links.related.href,
5454
associatedProjectId: data.relationships?.registered_from?.data?.id,
5555
schemaResponses: data.embeds?.schema_responses?.data?.map((item) => RegistrationMapper.fromSchemaResponse(item)),
56-
provider: RegistrationNodeMapper.getRegistrationProviderShortInfo(data.embeds.provider.data),
56+
provider: RegistrationNodeMapper.getRegistrationProviderShortInfo(data.embeds?.provider?.data),
5757
status: MapRegistryStatus(data.attributes),
5858
revisionStatus: data.attributes.revision_state,
5959
reviewsState: data.attributes.reviews_state,
@@ -68,9 +68,9 @@ export function MapRegistryOverview(data: RegistryOverviewJsonApiData): Registry
6868

6969
export function MapRegistrationOverview(data: RegistryOverviewJsonApiData) {
7070
const registrationAttributes = RegistrationNodeMapper.getRegistrationNodeAttributes(data.id, data.attributes);
71-
const providerInfo = RegistrationNodeMapper.getRegistrationProviderShortInfo(data.embeds.provider.data);
72-
const identifiers = IdentifiersMapper.fromJsonApi(data.embeds.identifiers);
73-
const license = LicensesMapper.fromLicenseDataJsonApi(data.embeds.license.data);
71+
const providerInfo = RegistrationNodeMapper.getRegistrationProviderShortInfo(data.embeds?.provider?.data);
72+
const identifiers = IdentifiersMapper.fromJsonApi(data.embeds?.identifiers);
73+
const license = LicensesMapper.fromLicenseDataJsonApi(data.embeds?.license?.data);
7474

7575
return {
7676
...registrationAttributes,

src/app/features/registry/pages/registry-overview/registry-overview.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
</div>
3333
} @else {
3434
<div class="flex flex-column bg-white flex-1 p-4 gap-4">
35-
@if (!schemaResponse()?.isOriginalResponse && !isInitialState) {
35+
@if (schemaResponse() && !schemaResponse()?.isOriginalResponse && !isInitialState) {
3636
<p-message class="overview-message w-full" severity="warn">
3737
<ng-template #container>
3838
<div>

src/app/features/registry/pages/registry-overview/registry-overview.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,14 @@ export class RegistryOverviewComponent {
121121
readonly schemaResponse = computed(() => {
122122
const registry = this.registry();
123123
const index = this.selectedRevisionIndex();
124-
this.revisionInProgress = registry?.schemaResponses.find(
124+
this.revisionInProgress = registry?.schemaResponses?.find(
125125
(r) => r.reviewsState === RevisionReviewStates.RevisionInProgress
126126
);
127127

128128
const schemaResponses =
129129
(this.isModeration
130130
? registry?.schemaResponses
131-
: registry?.schemaResponses.filter(
131+
: registry?.schemaResponses?.filter(
132132
(r) => r.reviewsState === RevisionReviewStates.Approved || this.hasAdminAccess()
133133
)) || [];
134134

src/app/shared/mappers/identifiers.mapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Identifier, IdentifiersJsonApiData, ResponseJsonApi } from '@shared/mod
22

33
export class IdentifiersMapper {
44
static fromJsonApi(response: ResponseJsonApi<IdentifiersJsonApiData[]>): Identifier[] {
5-
return response.data.map((rawIdentifier) => {
5+
return response?.data.map((rawIdentifier) => {
66
return {
77
category: rawIdentifier.attributes.category,
88
value: rawIdentifier.attributes.value,

src/assets/i18n/en.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"confirm": "Confirm",
2121
"disconnect": "Disconnect",
2222
"revert": "Revert",
23+
2324
"next": "Next",
2425
"back": "Back",
2526
"continue": "Continue",
@@ -1355,13 +1356,17 @@
13551356
"rejectRequest": "Reject request",
13561357
"acceptUpdate": "Accept update",
13571358
"rejectUpdate": "Reject update",
1359+
"acceptWithdrawal": "Accept withdrawal",
1360+
"rejectWithdrawal": "Reject withdrawal",
13581361
"withdrawRequest": "Withdraw Request",
13591362
"forceWithdraw": "Force Withdraw",
13601363
"forceWithdrawMessage": "Registration will be withdrawn but still have a tombstone page with a justification for withdrawal and a subset of the metadata available",
13611364
"acceptRequestMessage": "Submission will appear in search results and will be associated with the collection.",
13621365
"rejectRequestMessage": "Submission will not appear in search results nor will be associated with the collection.",
13631366
"acceptUpdateMessage": "Update will be accepted and registration will be updated",
13641367
"rejectUpdateMessage": "Update will be rejected and registration will remain unchanged",
1368+
"acceptWithdrawalMessage": "Registration will be withdrawn but still have a tombstone page with a justification for withdrawal and subset of the metadata available.",
1369+
"rejectWithdrawalMessage": "Submission will remain fully public",
13651370
"withdrawRequestMessage": "Submission will be withdrawn from the collection and will no longer appear in search results.",
13661371
"remarksPlaceholder": "Add remarks to registration admins (optional)",
13671372
"submitDecision": "Submit decision",
@@ -1381,7 +1386,8 @@
13811386
"requested": "Requested",
13821387
"withdrawn": "Withdrawn",
13831388
"by": "by",
1384-
"embargoEnding": "with embargo ending"
1389+
"embargoEnding": "with embargo ending",
1390+
"withdrawalRequested": "Registration withdrawal requested"
13851391
},
13861392
"preprintReviewStatus": {
13871393
"submitted": "submitted a preprint \"{{name}}\" to",

0 commit comments

Comments
 (0)