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 @@ -109,7 +109,7 @@ export class JustificationReviewComponent {
next: () => {
this.toastService.showSuccess('registries.justification.successDeleteDraft');
this.actions.clearState();
this.router.navigateByUrl(`/registries/${registrationId}/overview`);
this.router.navigateByUrl(`/${registrationId}/overview`);
},
});
},
Expand All @@ -120,7 +120,7 @@ export class JustificationReviewComponent {
this.actions.handleSchemaResponse(this.revisionId, SchemaActionTrigger.Approve).subscribe({
next: () => {
this.toastService.showSuccess('registries.justification.successAccept');
this.router.navigateByUrl(`/registries/${this.schemaResponse()?.registrationId}/overview`);
this.router.navigateByUrl(`/${this.schemaResponse()?.registrationId}/overview`);
},
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class JustificationStepComponent implements OnDestroy {
this.isDraftDeleted = true;
this.actions.clearState();
this.toastService.showSuccess('registries.justification.successDeleteDraft');
this.router.navigateByUrl(`/registries/${registrationId}/overview`);
this.router.navigateByUrl(`/${registrationId}/overview`);
},
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ <h2 class="mb-2">{{ 'registries.metadata.title' | translate }}</h2>
</p-card>
</section>
<osf-contributors [control]="metadataForm.controls['contributors']"></osf-contributors>
<osf-registries-affiliated-institution></osf-registries-affiliated-institution>
<osf-registries-license [control]="metadataForm.controls['license']"></osf-registries-license>
<osf-registries-subjects [control]="metadataForm.controls['subjects']"></osf-registries-subjects>
<osf-registries-tags></osf-registries-tags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { ContributorsSelectors, SubjectsSelectors } from '@osf/shared/stores';
import { ClearState, DeleteDraft, RegistriesSelectors, UpdateDraft, UpdateStepValidation } from '../../store';

import { ContributorsComponent } from './contributors/contributors.component';
import { RegistriesAffiliatedInstitutionComponent } from './registries-affiliated-institution/registries-affiliated-institution.component';
import { RegistriesLicenseComponent } from './registries-license/registries-license.component';
import { RegistriesSubjectsComponent } from './registries-subjects/registries-subjects.component';
import { RegistriesTagsComponent } from './registries-tags/registries-tags.component';
Expand All @@ -40,6 +41,7 @@ import { RegistriesTagsComponent } from './registries-tags/registries-tags.compo
RegistriesSubjectsComponent,
RegistriesTagsComponent,
RegistriesLicenseComponent,
RegistriesAffiliatedInstitutionComponent,
Message,
],
templateUrl: './metadata.component.html',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<p-card>
<div>
<h2>{{ 'project.overview.metadata.affiliatedInstitutions' | translate }}</h2>
<p class="m-t-12">
{{ 'project.overview.metadata.affiliatedInstitutionsDescription' | translate }}
</p>
@if (userInstitutions().length) {
<div class="m-t-24">
<osf-affiliated-institution-select
[calculateSelectedItemsMode]="true"
(selectInstitutions)="institutionsSelected($event)"
/>
</div>
} @else {
<p class="m-t-24">{{ 'project.overview.metadata.noAffiliatedInstitutions' | translate }}</p>
}
</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 { RegistriesAffiliatedInstitutionComponent } from './registries-affiliated-institution.component';

describe.skip('RegistriesAffiliatedInstitutionComponent', () => {
let component: RegistriesAffiliatedInstitutionComponent;
let fixture: ComponentFixture<RegistriesAffiliatedInstitutionComponent>;

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

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

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { createDispatchMap, select } from '@ngxs/store';

import { TranslatePipe } from '@ngx-translate/core';

import { Card } from 'primeng/card';

import { ChangeDetectionStrategy, Component, inject, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';

import { AffiliatedInstitutionSelectComponent } from '@osf/shared/components';
import { ResourceType } from '@osf/shared/enums';
import { Institution } from '@osf/shared/models';
import {
FetchResourceInstitutions,
FetchUserInstitutions,
InstitutionsSelectors,
UpdateResourceInstitutions,
} from '@osf/shared/stores';

@Component({
selector: 'osf-registries-affiliated-institution',
imports: [Card, AffiliatedInstitutionSelectComponent, TranslatePipe],
templateUrl: './registries-affiliated-institution.component.html',
styleUrl: './registries-affiliated-institution.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class RegistriesAffiliatedInstitutionComponent implements OnInit {
private readonly route = inject(ActivatedRoute);
private readonly draftId = this.route.snapshot.params['id'];
readonly userInstitutions = select(InstitutionsSelectors.getUserInstitutions);
readonly areResourceInstitutionsLoading = select(InstitutionsSelectors.areResourceInstitutionsLoading);

private actions = createDispatchMap({
fetchUserInstitutions: FetchUserInstitutions,
fetchResourceInstitutions: FetchResourceInstitutions,
updateResourceInstitutions: UpdateResourceInstitutions,
});

ngOnInit() {
this.actions.fetchUserInstitutions();
this.actions.fetchResourceInstitutions(this.draftId, ResourceType.DraftRegistration);
}

institutionsSelected(institutions: Institution[]) {
this.actions.updateResourceInstitutions(this.draftId, ResourceType.DraftRegistration, institutions);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export class ReviewComponent {
.onClose.subscribe((res) => {
if (res) {
this.toastService.showSuccess('registries.review.confirmation.successMessage');
this.router.navigate([`registries/${this.newRegistration()?.id}/overview`]);
this.router.navigate([`/${this.newRegistration()?.id}/overview`]);
} else {
if (this.components()?.length) {
this.openSelectComponentsForRegistrationDialog();
Expand Down
1 change: 1 addition & 0 deletions src/app/shared/services/institutions.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class InstitutionsService {
[ResourceType.Agent, 'users'],
[ResourceType.Project, 'nodes'],
[ResourceType.Registration, 'registrations'],
[ResourceType.DraftRegistration, 'draft_registrations'],
]);

getInstitutions(pageNumber: number, pageSize: number, searchValue?: string): Observable<InstitutionsWithTotalCount> {
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@
"citeAs": "Cite as:",
"noCitationStylesFound": "No results found",
"affiliatedInstitutions": "Affiliated Institutions",
"affiliatedInstitutionsDescription": "This is a service provided by the OSF and is automatically applied to your registration. If you are not sure if your institution has signed up for this service, you can look for their name in this list.",
"noDescription": "No description",
"noLicense": "No License",
"noPublicationDoi": "No Publication DOI",
Expand Down
Loading