Skip to content

Commit 2662e01

Browse files
Merge pull request #239 from CenterForOpenScience/feat/438-registration-revisions
Feat/438 registration revisions
2 parents 28608f7 + 82ef29a commit 2662e01

56 files changed

Lines changed: 464 additions & 325 deletions

File tree

Some content is hidden

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

src/app/features/moderation/components/registry-submission-item/registry-submission-item.component.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
link
88
[label]="submission().title"
99
[routerLink]="['/registries/', submission().id, 'overview']"
10-
[queryParams]="{ mode: 'moderator', revisionId: isPendingModeration ? submission().revisionId : null }"
10+
[queryParams]="{
11+
mode: 'moderator',
12+
revisionId: isPendingModeration && !isPending ? submission().revisionId : null,
13+
}"
1114
/>
1215

1316
@if (submission().public && !submission().embargoEndDate) {

src/app/features/moderation/components/registry-submission-item/registry-submission-item.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ChangeDetectionStrategy, Component, input } from '@angular/core';
66
import { RouterLink } from '@angular/router';
77

88
import { IconComponent } from '@osf/shared/components';
9-
import { RevisionReviewStates } from '@osf/shared/enums';
9+
import { RegistrationReviewStates, RevisionReviewStates } from '@osf/shared/enums';
1010
import { DateAgoPipe } from '@osf/shared/pipes';
1111

1212
import { REGISTRY_ACTION_LABEL, ReviewStatusIcon } from '../../constants';
@@ -35,6 +35,10 @@ export class RegistrySubmissionItemComponent {
3535
return this.submission().revisionStatus === RevisionReviewStates.RevisionPendingModeration;
3636
}
3737

38+
get isPending(): boolean {
39+
return this.submission().reviewsState === RegistrationReviewStates.Pending;
40+
}
41+
3842
toggleHistory() {
3943
this.showAll = !this.showAll;
4044
}

src/app/features/registries/components/custom-step/custom-step.component.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,11 @@ import { ActivatedRoute, Router } from '@angular/router';
3030

3131
import { InfoIconComponent } from '@osf/shared/components';
3232
import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants';
33-
import { FilePayloadJsonApi, OsfFile } from '@osf/shared/models';
33+
import { FieldType } from '@osf/shared/enums';
34+
import { FilePayloadJsonApi, OsfFile, PageSchema } from '@osf/shared/models';
3435
import { CustomValidators, findChangedFields } from '@osf/shared/utils';
3536

36-
import { FieldType } from '../../enums';
3737
import { FilesMapper } from '../../mappers/files.mapper';
38-
import { PageSchema } from '../../models';
3938
import { RegistriesSelectors, SetUpdatedFields, UpdateStepValidation } from '../../store';
4039
import { FilesControlComponent } from '../files-control/files-control.component';
4140

src/app/features/registries/components/justification-review/justification-review.component.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,19 @@ <h3 class="mb-2">{{ section.title }}</h3>
3636
<p class="mb-4">{{ section.description }}</p>
3737
}
3838
@if (section.questions?.length) {
39-
<osf-review-data
39+
<osf-registration-blocks-data
4040
[questions]="section.questions"
4141
[reviewData]="schemaResponseRevisionData()"
42-
></osf-review-data>
42+
></osf-registration-blocks-data>
4343
}
4444
</div>
4545
}
4646
} @else {
4747
@if (page.questions?.length) {
48-
<osf-review-data [questions]="page.questions" [reviewData]="schemaResponseRevisionData()"></osf-review-data>
48+
<osf-registration-blocks-data
49+
[questions]="page.questions"
50+
[reviewData]="schemaResponseRevisionData()"
51+
></osf-registration-blocks-data>
4952
}
5053
}
5154
</p-card>

src/app/features/registries/components/justification-review/justification-review.component.ts

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ import { Message } from 'primeng/message';
1010
import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core';
1111
import { ActivatedRoute, Router } from '@angular/router';
1212

13+
import { RegistrationBlocksDataComponent } from '@osf/shared/components';
1314
import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants';
14-
import { RevisionReviewStates } from '@osf/shared/enums';
15+
import { FieldType, RevisionReviewStates } from '@osf/shared/enums';
1516
import { CustomConfirmationService, ToastService } from '@osf/shared/services';
1617

17-
import { FieldType, SchemaActionTrigger } from '../../enums';
18+
import { SchemaActionTrigger } from '../../enums';
1819
import { ClearState, DeleteSchemaResponse, HandleSchemaResponse, RegistriesSelectors } from '../../store';
1920
import { ConfirmContinueEditingDialogComponent } from '../confirm-continue-editing-dialog/confirm-continue-editing-dialog.component';
20-
import { ReviewDataComponent } from '../review-data/review-data.component';
2121

2222
@Component({
2323
selector: 'osf-justification-review',
24-
imports: [Button, Card, TranslatePipe, Message, ReviewDataComponent],
24+
imports: [Button, Card, TranslatePipe, Message, RegistrationBlocksDataComponent],
2525
templateUrl: './justification-review.component.html',
2626
styleUrl: './justification-review.component.scss',
2727
changeDetection: ChangeDetectionStrategy.OnPush,
@@ -62,10 +62,28 @@ export class JustificationReviewComponent {
6262
}
6363

6464
changes = computed(() => {
65+
let questions: Record<string, string> = {};
66+
this.pages().forEach((page) => {
67+
if (page.sections?.length) {
68+
questions = {
69+
...questions,
70+
...Object.fromEntries(
71+
page.sections.flatMap(
72+
(section) => section.questions?.map((q) => [q.responseKey, q.displayText || '']) || []
73+
)
74+
),
75+
};
76+
} else {
77+
questions = {
78+
...questions,
79+
...Object.fromEntries(page.questions?.map((q) => [q.responseKey, q.displayText]) || []),
80+
};
81+
}
82+
});
6583
const updatedFields = this.updatedFields();
6684
const updatedResponseKeys = this.schemaResponse()?.updatedResponseKeys || [];
6785
const uniqueKeys = new Set([...updatedResponseKeys, ...Object.keys(updatedFields)]);
68-
return Array.from(uniqueKeys);
86+
return Array.from(uniqueKeys).map((key) => questions[key]);
6987
});
7088

7189
submit(): void {

src/app/features/registries/components/justification-step/justification-step.component.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ <h2 class="mb-2">{{ 'registries.justification.title' | translate }}</h2>
1818
</p-message>
1919
}
2020
</section>
21+
<p-message class="overview-message w-full" icon="fas fa-circle-exclamation" severity="error">
22+
{{ 'registries.justification.caution' | translate }}
23+
</p-message>
2124
<div class="flex justify-content-end">
2225
<p-button
2326
[label]="'registries.justification.deleteUpdates' | translate"

src/app/features/registries/components/new-registration/new-registration.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
<section class="bg-white h-full">
1+
<section class="h-full">
22
<osf-sub-header [title]="'registries.new.addNewRegistry' | translate" />
3-
<section class="flex flex-column lg:flex-row flex-1 p-5 gap-4 w-full">
3+
<section class="flex flex-column lg:flex-row flex-1 p-5 gap-4 bg-white w-full">
44
<p>
55
{{ 'registries.new.infoText1' | translate }}
66
<a href="https://help.osf.io/"> {{ 'common.links.clickHere' | translate }}</a>
77
{{ 'registries.new.infoText2' | translate }}
88
</p>
99
</section>
10-
<section class="flex flex-column flex-1 p-5 gap-4 w-full">
10+
<section class="flex flex-column flex-1 p-5 gap-4 w-full bg-white">
1111
<p-card class="w-full">
1212
<h2 class="mb-4">{{ ('registries.new.steps.title' | translate) + '1' }}</h2>
1313
<p class="mb-4 text-lg font-bold">{{ 'registries.new.steps.step1' | translate }}</p>

src/app/features/registries/components/review-data/review-data.component.scss

Whitespace-only changes.

src/app/features/registries/components/review-data/review-data.component.spec.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/app/features/registries/components/review-data/review-data.component.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)