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
4 changes: 3 additions & 1 deletion src/app/core/interceptors/auth.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { Observable } from 'rxjs';

import { HttpEvent, HttpHandlerFn, HttpInterceptorFn, HttpRequest } from '@angular/common/http';

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

export const authInterceptor: HttpInterceptorFn = (
req: HttpRequest<unknown>,
next: HttpHandlerFn
Expand All @@ -12,7 +14,7 @@ export const authInterceptor: HttpInterceptorFn = (
// yZ485nN6MfhqvGrfU4Xk5BEnq0T6LM50nQ6H9VrYaMTaZUQNTuxnIwlp0Wpz879RCsK9GQ NM stage3
const localStorageToken = localStorage.getItem('authToken');
const token = localStorageToken || authToken;
if (token) {
if (token && !environment.production) {
if (!req.url.includes('/api.crossref.org/funders')) {
const authReq = req.clone({
setHeaders: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export class ReviewComponent {
protected readonly subjects = select(SubjectsSelectors.getSelectedSubjects);
protected readonly components = select(RegistriesSelectors.getRegistrationComponents);
protected readonly license = select(RegistriesSelectors.getRegistrationLicense);
protected readonly newRegistration = select(RegistriesSelectors.getRegistration);
private readonly OSF_PROVIDER_ID = 'osf';

protected readonly FieldType = FieldType;
Expand Down Expand Up @@ -192,8 +193,7 @@ export class ReviewComponent {
.onClose.subscribe((res) => {
if (res) {
this.toastService.showSuccess('registries.review.confirmation.successMessage');
// [NM] TODO: Navigate to the newly created registration page
this.router.navigate([`registries/my-registrations`]);
this.router.navigate([`registries/${this.newRegistration()?.id}/overview`]);
} else {
if (this.components()?.length) {
this.openSelectComponentsForRegistrationDialog();
Expand Down
15 changes: 14 additions & 1 deletion src/app/features/registries/store/registries.selectors.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { Selector } from '@ngxs/store';

import { DraftRegistrationModel, License, OsfFile, RegistrationCard, Resource, SchemaResponse } from '@shared/models';
import {
DraftRegistrationModel,
License,
OsfFile,
RegistrationCard,
RegistrationModel,
Resource,
SchemaResponse,
} from '@shared/models';

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

Expand Down Expand Up @@ -98,6 +106,11 @@ export class RegistriesSelectors {
return state.registration.isSubmitting || false;
}

@Selector([RegistriesState])
static getRegistration(state: RegistriesStateModel): RegistrationModel | null {
return state.registration.data;
}

@Selector([RegistriesState])
static getDraftRegistrations(state: RegistriesStateModel): RegistrationCard[] {
return state.draftRegistrations.data;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<p-card>
<div class="flex flex-column lg:flex-row">
<div class="flex flex-column lg:w-6">
<h2 class="mb-2 flex">
<osf-icon iconClass="text-red-500 fas fa-hourglass-half mr-2 text-4xl"></osf-icon>
{{ 'registry.archiving.title' | translate }}
</h2>
<p class="text-red-500 mb-2 font-bold pl-5">{{ 'registry.archiving.pleaseNote' | translate }}</p>
<p class="pl-5">
{{ 'registry.archiving.description' | translate }}
<a href="http://support.osf.io">support.osf.io</a>
{{ 'registry.archiving.descriptionEnd' | translate }}
</p>
</div>
<p-divider layout="vertical" class="hidden lg:block" />
<p-divider class="lg:hidden" />
<div class="lg:w-6">
<div class="mb-3">
<h4>{{ 'navigation.registration.contributors' | translate }}</h4>
<p>
@for (c of registration().contributors; track c.id) {
<span
>{{ c.fullName }}
<span>{{ !$last ? ', ' : '' }}</span>
</span>
}
</p>
</div>
<div class="mb-3">
<h4>{{ 'common.labels.description' | translate }}</h4>
<p>{{ registration().description }}</p>
</div>
<div class="mb-3 flex flex-wrap">
<div class="mb-3 w-6">
<h4>{{ 'registry.overview.metadata.type' | translate }}</h4>
<p>{{ registration().registrationType }}</p>
</div>
<div class="mb-3 w-6">
<h4>{{ 'registry.overview.metadata.registeredDate' | translate }}</h4>
<p>{{ registration().dateRegistered }}</p>
</div>
</div>
<div class="mb-3 flex flex-wrap">
<div class="mb-3 w-6">
<h4>{{ 'registry.archiving.createdDate' | translate }}</h4>
<p>{{ registration().dateCreated }}</p>
</div>
<div class="mb-3 w-6">
<h4>{{ 'registry.overview.metadata.associatedProject' | translate }}</h4>
<a [href]="associatedProjectUrl">{{ associatedProjectUrl }}</a>
</div>
</div>
</div>
</div>
</p-card>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { ArchivingMessageComponent } from './archiving-message.component';

describe('ArchivingMessageComponent', () => {
let component: ArchivingMessageComponent;
let fixture: ComponentFixture<ArchivingMessageComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ArchivingMessageComponent],
}).compileComponents();

fixture = TestBed.createComponent(ArchivingMessageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { TranslatePipe } from '@ngx-translate/core';

import { Card } from 'primeng/card';
import { Divider } from 'primeng/divider';

import { ChangeDetectionStrategy, Component, input } from '@angular/core';

import { IconComponent } from '@osf/shared/components';

import { RegistryOverview } from '../../models';

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

@Component({
selector: 'osf-archiving-message',
imports: [TranslatePipe, Card, IconComponent, Divider],
templateUrl: './archiving-message.component.html',
styleUrl: './archiving-message.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ArchivingMessageComponent {
registration = input.required<RegistryOverview>();
protected readonly environment = environment;

get associatedProjectUrl(): string {
return `${this.environment.webUrl}/${this.registration().associatedProjectId}`;
}
}
1 change: 1 addition & 0 deletions src/app/features/registry/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from './add-resource-dialog/add-resource-dialog.component';
export * from './archiving-message/archiving-message.component';
export * from './edit-resource-dialog/edit-resource-dialog.component';
export * from './registration-links-card/registration-links-card.component';
export * from './registry-revisions/registry-revisions.component';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export class RegistryMetadataMapper {
links: {
files: '',
},
archiving: attributes['archiving'] as boolean,
} as RegistryOverview;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,6 @@ export function MapRegistryOverview(data: RegistryOverviewJsonApiData): Registry
links: {
files: data?.embeds?.files?.data?.[0]?.relationships?.files?.links?.related?.href,
},
archiving: data.attributes.archiving,
} as RegistryOverview;
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export interface RegistryOverviewJsonApiAttributes {
revision_state: RevisionReviewStates;
reviews_state: RegistrationReviewStates;
embargoed: boolean;
archiving: boolean;
}

export type RegistrationQuestions = Record<string, string | string[] | { file_id: string; file_name: string }[]>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,5 @@ export interface RegistryOverview {
links: {
files: string;
};
archiving: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,72 +3,79 @@
class="flex flex-column justify-content-center md:flex-row md:gap-4 md:justify-content-between md:align-items-center"
>
<osf-sub-header [title]="registry()!.title" />

<div class="pb-5 pl-3 md:pr-5">
<osf-overview-toolbar
[currentResource]="toolbarResource()"
[visibilityToggle]="false"
[showViewOnlyLinks]="false"
/>
</div>
@if (!registry()?.archiving) {
<div class="pb-5 pl-3 md:pr-5">
<osf-overview-toolbar
[currentResource]="toolbarResource()"
[visibilityToggle]="false"
[showViewOnlyLinks]="false"
/>
</div>
}
</div>
<div class="flex flex-column bg-white flex-1 p-4 gap-4">
<osf-data-resources
[resourceId]="registry()?.id"
[hasData]="registry()?.hasData"
[hasAnalyticCode]="registry()?.hasAnalyticCode"
[hasMaterials]="registry()?.hasMaterials"
[hasPapers]="registry()?.hasPapers"
[hasSupplements]="registry()?.hasSupplements"
></osf-data-resources>
@if (registry()?.archiving) {
<div class="flex flex-column bg-white flex-1 p-4 gap-4">
<osf-archiving-message [registration]="registry()!"></osf-archiving-message>
</div>
} @else {
<div class="flex flex-column bg-white flex-1 p-4 gap-4">
<osf-data-resources
[resourceId]="registry()?.id"
[hasData]="registry()?.hasData"
[hasAnalyticCode]="registry()?.hasAnalyticCode"
[hasMaterials]="registry()?.hasMaterials"
[hasPapers]="registry()?.hasPapers"
[hasSupplements]="registry()?.hasSupplements"
></osf-data-resources>

<div class="flex flex-column gap-4 xl:flex-row">
<div class="left-section">
<div class="flex flex-column gap-4 md:flex-row resource">
<osf-registry-statuses [registry]="registry()"></osf-registry-statuses>
<osf-registry-revisions
[registry]="registry()"
[selectedRevisionIndex]="selectedRevisionIndex()"
(openRevision)="openRevision($event)"
>
</osf-registry-revisions>
</div>
<div class="blocks-section p-4">
@for (block of mappedSchemaBlocks(); track $index) {
@if (block.type === 'file-input' && block.files) {
<ul class="flex flex-column gap-4 ml-5">
@for (file of block.files; track $index) {
<li class="list-disc">
<a [routerLink]="['/files', file.id]">{{ file.name }}</a>
</li>
}
</ul>
} @else if (block.type === 'multi-select-input' && block.values) {
<div class="flex flex-column gap-4 p-4">
@for (value of block.values; track $index) {
@if (value) {
<p class="text-no-transform">{{ value }}</p>
<div class="flex flex-column gap-4 xl:flex-row">
<div class="left-section">
<div class="flex flex-column gap-4 md:flex-row resource">
<osf-registry-statuses [registry]="registry()"></osf-registry-statuses>
<osf-registry-revisions
[registry]="registry()"
[selectedRevisionIndex]="selectedRevisionIndex()"
(openRevision)="openRevision($event)"
>
</osf-registry-revisions>
</div>
<div class="blocks-section p-4">
@for (block of mappedSchemaBlocks(); track $index) {
@if (block.type === 'file-input' && block.files) {
<ul class="flex flex-column gap-4 ml-5">
@for (file of block.files; track $index) {
<li class="list-disc">
<a [routerLink]="['/files', file.id]">{{ file.name }}</a>
</li>
}
}
</div>
} @else if (block.type === 'page-heading' && block.value) {
<h1 class="pb-4 text-no-transform" [class.mt-4]="$index !== 0">{{ block.value }}</h1>
} @else if ((block.type === 'subsection-heading' || block.type === 'question-label') && block.value) {
<h3 class="pb-4 text-no-transform">{{ block.value }}</h3>
} @else if (block.value && block.value !== 'select-input-option') {
<p class="pb-4 text-no-transform">{{ block.value }}</p>
</ul>
} @else if (block.type === 'multi-select-input' && block.values) {
<div class="flex flex-column gap-4 p-4">
@for (value of block.values; track $index) {
@if (value) {
<p class="text-no-transform">{{ value }}</p>
}
}
</div>
} @else if (block.type === 'page-heading' && block.value) {
<h1 class="pb-4 text-no-transform" [class.mt-4]="$index !== 0">{{ block.value }}</h1>
} @else if ((block.type === 'subsection-heading' || block.type === 'question-label') && block.value) {
<h3 class="pb-4 text-no-transform">{{ block.value }}</h3>
} @else if (block.value && block.value !== 'select-input-option') {
<p class="pb-4 text-no-transform">{{ block.value }}</p>
}
}
}
</div>
</div>
<div class="flex flex-column right-section p-4">
<osf-resource-metadata
[currentResource]="resourceOverview()"
(customCitationUpdated)="onCustomCitationUpdated($event)"
/>
</div>
</div>
<div class="flex flex-column right-section p-4">
<osf-resource-metadata
[currentResource]="resourceOverview()"
(customCitationUpdated)="onCustomCitationUpdated($event)"
/>
</div>
</div>
</div>
}
} @else {
<div class="flex-1">
<osf-loading-spinner />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { MapRegistryOverview } from '@osf/shared/mappers';
import { ToolbarResource } from '@osf/shared/models';
import { GetBookmarksCollectionId } from '@shared/stores';

import { RegistryRevisionsComponent, RegistryStatusesComponent } from '../../components';
import { ArchivingMessageComponent, RegistryRevisionsComponent, RegistryStatusesComponent } from '../../components';
import { MapViewSchemaBlock } from '../../mappers';
import { RegistrationQuestions } from '../../models';
import {
Expand All @@ -39,6 +39,7 @@ import {
RegistryRevisionsComponent,
RegistryStatusesComponent,
DataResourcesComponent,
ArchivingMessageComponent,
],
templateUrl: './registry-overview.component.html',
styleUrl: './registry-overview.component.scss',
Expand Down
7 changes: 7 additions & 0 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2097,6 +2097,13 @@
"components": {
"title": "Components",
"noComponentsFound": "No components found"
},
"archiving": {
"title": "This registration is currently archiving, and no changes can be made at this time.",
"pleaseNote": "Please note",
"description": "Changes to any files (1) in the projects or components being registered, (2) uploaded or selected as prompt responses, including those connected through add-ons during archiving will result in archiving failure and loss of your registration timestamp. Please do not modify your files until after you have received email confirmation of archiving completion. If this registration has been archiving for more than 72 hours, please email ",
"descriptionEnd": " for assistance.",
"createdDate": "Date created"
}
},
"truncatedText": {
Expand Down
2 changes: 1 addition & 1 deletion src/environments/environment.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const environment = {
production: false,
production: true,
webUrl: 'https://staging4.osf.io',
downloadUrl: 'https://staging4.osf.io/download',
apiUrl: 'https://api.staging4.osf.io/v2',
Expand Down