Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
link
[label]="submission().title"
[routerLink]="['/registries/', submission().id, 'overview']"
[queryParams]="{ mode: 'moderator', revisionId: isPendingModeration ? submission().revisionId : null }"
[queryParams]="{
mode: 'moderator',
revisionId: isPendingModeration && !isPending ? submission().revisionId : null,
}"
/>

@if (submission().public && !submission().embargoEndDate) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ChangeDetectionStrategy, Component, input } from '@angular/core';
import { RouterLink } from '@angular/router';

import { IconComponent } from '@osf/shared/components';
import { RevisionReviewStates } from '@osf/shared/enums';
import { RegistrationReviewStates, RevisionReviewStates } from '@osf/shared/enums';
import { DateAgoPipe } from '@osf/shared/pipes';

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

get isPending(): boolean {
return this.submission().reviewsState === RegistrationReviewStates.Pending;
}

toggleHistory() {
this.showAll = !this.showAll;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ import { ActivatedRoute, Router } from '@angular/router';

import { InfoIconComponent } from '@osf/shared/components';
import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants';
import { FilePayloadJsonApi, OsfFile } from '@osf/shared/models';
import { FieldType } from '@osf/shared/enums';
import { FilePayloadJsonApi, OsfFile, PageSchema } from '@osf/shared/models';
import { CustomValidators, findChangedFields } from '@osf/shared/utils';

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,19 @@ <h3 class="mb-2">{{ section.title }}</h3>
<p class="mb-4">{{ section.description }}</p>
}
@if (section.questions?.length) {
<osf-review-data
<osf-registration-blocks-data
[questions]="section.questions"
[reviewData]="schemaResponseRevisionData()"
></osf-review-data>
></osf-registration-blocks-data>
}
</div>
}
} @else {
@if (page.questions?.length) {
<osf-review-data [questions]="page.questions" [reviewData]="schemaResponseRevisionData()"></osf-review-data>
<osf-registration-blocks-data
[questions]="page.questions"
[reviewData]="schemaResponseRevisionData()"
></osf-registration-blocks-data>
}
}
</p-card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ import { Message } from 'primeng/message';
import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';

import { RegistrationBlocksDataComponent } from '@osf/shared/components';
import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants';
import { RevisionReviewStates } from '@osf/shared/enums';
import { FieldType, RevisionReviewStates } from '@osf/shared/enums';
import { CustomConfirmationService, ToastService } from '@osf/shared/services';

import { FieldType, SchemaActionTrigger } from '../../enums';
import { SchemaActionTrigger } from '../../enums';
import { ClearState, DeleteSchemaResponse, HandleSchemaResponse, RegistriesSelectors } from '../../store';
import { ConfirmContinueEditingDialogComponent } from '../confirm-continue-editing-dialog/confirm-continue-editing-dialog.component';
import { ReviewDataComponent } from '../review-data/review-data.component';

@Component({
selector: 'osf-justification-review',
imports: [Button, Card, TranslatePipe, Message, ReviewDataComponent],
imports: [Button, Card, TranslatePipe, Message, RegistrationBlocksDataComponent],
templateUrl: './justification-review.component.html',
styleUrl: './justification-review.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
Expand Down Expand Up @@ -62,10 +62,28 @@ export class JustificationReviewComponent {
}

changes = computed(() => {
let questions: Record<string, string> = {};
this.pages().forEach((page) => {
if (page.sections?.length) {
questions = {
...questions,
...Object.fromEntries(
page.sections.flatMap(
(section) => section.questions?.map((q) => [q.responseKey, q.displayText || '']) || []
)
),
};
} else {
questions = {
...questions,
...Object.fromEntries(page.questions?.map((q) => [q.responseKey, q.displayText]) || []),
};
}
});
const updatedFields = this.updatedFields();
const updatedResponseKeys = this.schemaResponse()?.updatedResponseKeys || [];
const uniqueKeys = new Set([...updatedResponseKeys, ...Object.keys(updatedFields)]);
return Array.from(uniqueKeys);
return Array.from(uniqueKeys).map((key) => questions[key]);
});

submit(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ <h2 class="mb-2">{{ 'registries.justification.title' | translate }}</h2>
</p-message>
}
</section>
<p-message class="overview-message w-full" icon="fas fa-circle-exclamation" severity="error">
{{ 'registries.justification.caution' | translate }}
</p-message>
<div class="flex justify-content-end">
<p-button
[label]="'registries.justification.deleteUpdates' | translate"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<section class="bg-white h-full">
<section class="h-full">
<osf-sub-header [title]="'registries.new.addNewRegistry' | translate" />
<section class="flex flex-column lg:flex-row flex-1 p-5 gap-4 w-full">
<section class="flex flex-column lg:flex-row flex-1 p-5 gap-4 bg-white w-full">
<p>
{{ 'registries.new.infoText1' | translate }}
<a href="https://help.osf.io/"> {{ 'common.links.clickHere' | translate }}</a>
{{ 'registries.new.infoText2' | translate }}
</p>
</section>
<section class="flex flex-column flex-1 p-5 gap-4 w-full">
<section class="flex flex-column flex-1 p-5 gap-4 w-full bg-white">
<p-card class="w-full">
<h2 class="mb-4">{{ ('registries.new.steps.title' | translate) + '1' }}</h2>
<p class="mb-4 text-lg font-bold">{{ 'registries.new.steps.step1' | translate }}</p>
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h4 class="mb-2">{{ 'common.labels.description' | translate }}</h4>
</div>

<div class="mb-4">
<h4 class="mb-2">{{ 'navigation.registration.contributors' | translate }}</h4>
<h4 class="mb-2">{{ 'navigation.contributors' | translate }}</h4>
<div class="flex flex-wrap gap-2">
@for (contributor of contributors(); let last = $last; track contributor.id) {
<span>
Expand Down Expand Up @@ -101,13 +101,19 @@ <h3 class="mb-2">{{ section.title }}</h3>
<p class="mb-4">{{ section.description }}</p>
}
@if (section.questions?.length) {
<osf-review-data [questions]="section.questions" [reviewData]="stepsData()"></osf-review-data>
<osf-registration-blocks-data
[questions]="section.questions"
[reviewData]="stepsData()"
></osf-registration-blocks-data>
}
</div>
}
} @else {
@if (page.questions?.length) {
<osf-review-data [questions]="page.questions" [reviewData]="stepsData()"></osf-review-data>
<osf-registration-blocks-data
[questions]="page.questions"
[reviewData]="stepsData()"
></osf-registration-blocks-data>
}
}
</p-card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ import { ChangeDetectionStrategy, Component, computed, effect, inject } from '@a
import { toSignal } from '@angular/core/rxjs-interop';
import { ActivatedRoute, Router, RouterLink } from '@angular/router';

import { RegistrationBlocksDataComponent } from '@osf/shared/components';
import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants';
import { ResourceType } from '@osf/shared/enums';
import { FieldType, ResourceType } from '@osf/shared/enums';
import { InterpolatePipe } from '@osf/shared/pipes';
import { CustomConfirmationService, ToastService } from '@osf/shared/services';
import {
Expand All @@ -26,10 +27,8 @@ import {
SubjectsSelectors,
} from '@osf/shared/stores';

import { FieldType } from '../../enums';
import { ClearState, DeleteDraft, FetchLicenses, FetchProjectChildren, RegistriesSelectors } from '../../store';
import { ConfirmRegistrationDialogComponent } from '../confirm-registration-dialog/confirm-registration-dialog.component';
import { ReviewDataComponent } from '../review-data/review-data.component';
import { SelectComponentsDialogComponent } from '../select-components-dialog/select-components-dialog.component';

@Component({
Expand All @@ -46,7 +45,7 @@ import { SelectComponentsDialogComponent } from '../select-components-dialog/sel
AccordionHeader,
AccordionPanel,
InterpolatePipe,
ReviewDataComponent,
RegistrationBlocksDataComponent,
],
templateUrl: './review.component.html',
styleUrl: './review.component.scss',
Expand Down
2 changes: 0 additions & 2 deletions src/app/features/registries/enums/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export * from './block-type.enum';
export * from './field-type.enum';
export * from './registration-tab.enum';
export * from './schema-action-trigger.enum';
export * from './submit-type.enum';
1 change: 0 additions & 1 deletion src/app/features/registries/mappers/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './licenses.mapper';
export * from './page-schema.mapper';
export * from './projects.mapper';
export * from './providers.mapper';
2 changes: 0 additions & 2 deletions src/app/features/registries/models/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
export * from './page-schema.model';
export * from './project';
export * from './projects-json-api.model';
export * from './provider-schema.model';
export * from './registry-provider.model';
export * from './registry-provider-json-api.model';
export * from './schema-blocks-json-api.model';
6 changes: 3 additions & 3 deletions src/app/features/registries/services/registries.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@ import { inject, Injectable } from '@angular/core';

import { JsonApiResponseWithPaging } from '@osf/core/models';
import { JsonApiService } from '@osf/core/services';
import { RegistrationMapper } from '@osf/shared/mappers/registration';
import { PageSchemaMapper, RegistrationMapper } from '@osf/shared/mappers/registration';
import {
DraftRegistrationDataJsonApi,
DraftRegistrationModel,
DraftRegistrationRelationshipsJsonApi,
DraftRegistrationResponseJsonApi,
PageSchema,
RegistrationAttributesJsonApi,
RegistrationCard,
RegistrationDataJsonApi,
RegistrationModel,
RegistrationResponseJsonApi,
SchemaBlocksResponseJsonApi,
SchemaResponse,
SchemaResponseDataJsonApi,
SchemaResponseJsonApi,
SchemaResponsesJsonApi,
} from '@osf/shared/models';

import { SchemaActionTrigger } from '../enums';
import { PageSchemaMapper } from '../mappers';
import { PageSchema, SchemaBlocksResponseJsonApi } from '../models';

import { environment } from 'src/environments/environment';

Expand Down
3 changes: 2 additions & 1 deletion src/app/features/registries/store/registries.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import {
DraftRegistrationModel,
License,
OsfFile,
PageSchema,
RegistrationCard,
RegistrationModel,
Resource,
SchemaResponse,
} from '@shared/models';

import { PageSchema, Project, ProviderSchema } from '../models';
import { Project, ProviderSchema } from '../models';

export interface RegistriesStateModel {
providerSchemas: AsyncStateModel<ProviderSchema[]>;
Expand Down
3 changes: 2 additions & 1 deletion src/app/features/registries/store/registries.selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import {
DraftRegistrationModel,
License,
OsfFile,
PageSchema,
RegistrationCard,
RegistrationModel,
Resource,
SchemaResponse,
} from '@shared/models';

import { PageSchema, Project, ProviderSchema } from '../models';
import { Project, ProviderSchema } from '../models';

import { RegistriesStateModel } from './registries.model';
import { RegistriesState } from './registries.state';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@
}

<form [formGroup]="requestForm" class="flex flex-column gap-3">
@if (isPendingModeration) {
@if (isPendingModeration || isPendingReview) {
<div class="flex flex-column gap-2">
<div class="flex gap-2">
<p-radioButton
[formControlName]="ModerationDecisionFormControls.Action"
[inputId]="TriggerAction.Accept"
[value]="TriggerAction.Accept"
inputId="accept-action"
[value]="
isPendingReview ? ReviewActionTrigger.AcceptSubmission : SchemaResponseActionTrigger.AcceptRevision
"
></p-radioButton>
<label [for]="TriggerAction.Accept" class="m-0 flex gap-2 flex-column">
<label for="accept-action" class="m-0 flex gap-2 flex-column">
@if (isPendingReview) {
<p class="font-bold">{{ 'moderation.makeDecision.acceptRequest' | translate }}</p>
<p>{{ 'moderation.makeDecision.acceptRequestMessage' | translate }}</p>
Expand All @@ -41,11 +43,13 @@
<div class="flex gap-2">
<p-radioButton
[formControlName]="ModerationDecisionFormControls.Action"
[inputId]="TriggerAction.Reject"
[value]="TriggerAction.Reject"
inputId="reject-action"
[value]="
isPendingReview ? ReviewActionTrigger.RejectSubmission : SchemaResponseActionTrigger.RejectRevision
"
></p-radioButton>
<label [for]="TriggerAction.Reject" class="m-0 flex gap-2 flex-column">
@if (registry.reviewsState === RegistrationReviewStates.Pending) {
<label for="reject-action" class="m-0 flex gap-2 flex-column">
@if (isPendingReview) {
<p class="font-bold">{{ 'moderation.makeDecision.rejectRequest' | translate }}</p>
<p>{{ 'moderation.makeDecision.rejectRequestMessage' | translate }}</p>
} @else {
Expand All @@ -70,10 +74,10 @@
<div class="flex gap-2">
<p-radioButton
[formControlName]="ModerationDecisionFormControls.Action"
[inputId]="TriggerAction.ForceWithdraw"
[value]="TriggerAction.ForceWithdraw"
[inputId]="ReviewActionTrigger.ForceWithdraw"
[value]="ReviewActionTrigger.ForceWithdraw"
></p-radioButton>
<label [for]="TriggerAction.ForceWithdraw" class="m-0 flex gap-2 flex-column">
<label [for]="ReviewActionTrigger.ForceWithdraw" class="m-0 flex gap-2 flex-column">
<p class="font-bold">{{ 'moderation.makeDecision.forceWithdraw' | translate }}</p>
<p>{{ 'moderation.makeDecision.forceWithdrawMessage' | translate }}</p>
</label>
Expand Down
Loading