Skip to content

Commit 49eded8

Browse files
authored
Merge pull request #850 from nsemets/fix/merge-develop
Merged develop into feature/pbs-25-24
2 parents 6e027fe + 3b13d8b commit 49eded8

15 files changed

Lines changed: 62 additions & 64 deletions

File tree

CHANGELOG

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Changelog
2+
3+
We follow the CalVer (https://calver.org/) versioning scheme: YY.MINOR.MICRO.
4+
5+
26.1.0 (2026-01-01)
6+
===================
7+
8+
* Angular FE support for Notification Refactor Project
9+
10+
# vi: ft=markdown
11+

angular.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"styles": [
5454
"src/styles/styles.scss",
5555
"node_modules/primeflex/primeflex.css",
56+
"node_modules/@fortawesome/fontawesome-free/css/all.min.css",
5657
"node_modules/ngx-markdown-editor/assets/highlight.js/agate.min.css"
5758
],
5859
"stylePreprocessorOptions": {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "osf",
3-
"version": "25.4.0",
3+
"version": "26.1.0",
44
"scripts": {
55
"ng": "ng",
66
"analyze-bundle": "ng build --configuration=analyze-bundle && source-map-explorer dist/**/*.js --no-border-checks",

src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.html

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,27 +54,23 @@ <h3 class="text-lg text-red-500">{{ 'project.metadata.addMetadata.notPublishedTe
5454
</div>
5555
}
5656
<div class="cedar-editor-container">
57-
@if (!cedarLoaded()) {
58-
<osf-loading-spinner />
57+
@if (readonly()) {
58+
<cedar-artifact-viewer
59+
#cedarViewer
60+
[config]="cedarViewerConfig"
61+
[templateObject]="template().attributes.template"
62+
[instanceObject]="formData()"
63+
></cedar-artifact-viewer>
5964
} @else {
60-
@if (readonly()) {
61-
<cedar-artifact-viewer
62-
#cedarViewer
63-
[config]="cedarViewerConfig"
64-
[templateObject]="template().attributes.template"
65-
[instanceObject]="formData()"
66-
></cedar-artifact-viewer>
67-
} @else {
68-
<cedar-embeddable-editor
69-
#cedarEditor
70-
[config]="cedarConfig"
71-
[templateObject]="template().attributes.template"
72-
[metadata]="formData()"
73-
(change)="onCedarChange($event)"
74-
(pointerover)="validateCedarMetadata()"
75-
(keyup)="onCedarChange($event)"
76-
></cedar-embeddable-editor>
77-
}
65+
<cedar-embeddable-editor
66+
#cedarEditor
67+
[config]="cedarConfig"
68+
[templateObject]="template().attributes.template"
69+
[metadata]="formData()"
70+
(change)="onCedarChange($event)"
71+
(pointerover)="validateCedarMetadata()"
72+
(keyup)="onCedarChange($event)"
73+
></cedar-embeddable-editor>
7874
}
7975
</div>
8076

src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.spec.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
import { MockComponent } from 'ng-mocks';
2-
3-
import { PLATFORM_ID } from '@angular/core';
41
import { ComponentFixture, TestBed } from '@angular/core/testing';
52

63
import { CedarMetadataHelper } from '@osf/features/metadata/helpers';
74
import { CedarMetadataDataTemplateJsonApi } from '@osf/features/metadata/models';
8-
import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component';
95

106
import { CedarTemplateFormComponent } from './cedar-template-form.component';
117

@@ -20,8 +16,7 @@ describe('CedarTemplateFormComponent', () => {
2016

2117
beforeEach(async () => {
2218
await TestBed.configureTestingModule({
23-
imports: [CedarTemplateFormComponent, OSFTestingModule, MockComponent(LoadingSpinnerComponent)],
24-
providers: [{ provide: PLATFORM_ID, useValue: 'browser' }],
19+
imports: [CedarTemplateFormComponent, OSFTestingModule],
2520
}).compileComponents();
2621

2722
fixture = TestBed.createComponent(CedarTemplateFormComponent);
@@ -80,14 +75,10 @@ describe('CedarTemplateFormComponent', () => {
8075
expect(emitSpy).toHaveBeenCalled();
8176
});
8277

83-
it('should initialize form data with empty metadata when no existing record', async () => {
78+
it('should initialize form data with empty metadata when no existing record', () => {
8479
fixture.componentRef.setInput('existingRecord', null);
8580
fixture.detectChanges();
8681

87-
await (component as any).loadCedarLibraries();
88-
(component as any).initializeCedar();
89-
fixture.detectChanges();
90-
9182
const expectedEmptyMetadata = CedarMetadataHelper.buildEmptyMetadata();
9283
expect(component.formData()).toEqual(expectedEmptyMetadata);
9384
});

src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.ts

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Tooltip } from 'primeng/tooltip';
66

77
import { map, of } from 'rxjs';
88

9-
import { CommonModule, isPlatformBrowser } from '@angular/common';
9+
import { CommonModule } from '@angular/common';
1010
import {
1111
ChangeDetectionStrategy,
1212
Component,
@@ -16,7 +16,6 @@ import {
1616
inject,
1717
input,
1818
output,
19-
PLATFORM_ID,
2019
signal,
2120
viewChild,
2221
ViewEncapsulation,
@@ -25,7 +24,6 @@ import { toSignal } from '@angular/core/rxjs-interop';
2524
import { ActivatedRoute } from '@angular/router';
2625

2726
import { ENVIRONMENT } from '@core/provider/environment.provider';
28-
import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component';
2927

3028
import { CEDAR_CONFIG, CEDAR_VIEWER_CONFIG } from '../../constants';
3129
import { CedarMetadataHelper } from '../../helpers';
@@ -38,7 +36,7 @@ import {
3836

3937
@Component({
4038
selector: 'osf-cedar-template-form',
41-
imports: [CommonModule, Button, TranslatePipe, Tooltip, Menu, LoadingSpinnerComponent],
39+
imports: [CommonModule, Button, TranslatePipe, Tooltip, Menu],
4240
templateUrl: './cedar-template-form.component.html',
4341
styleUrl: './cedar-template-form.component.scss',
4442
schemas: [CUSTOM_ELEMENTS_SCHEMA],
@@ -65,8 +63,6 @@ export class CedarTemplateFormComponent {
6563

6664
private route = inject(ActivatedRoute);
6765
readonly environment = inject(ENVIRONMENT);
68-
private platformId = inject(PLATFORM_ID);
69-
readonly cedarLoaded = signal<boolean>(false);
7066

7167
readonly recordId = signal<string>('');
7268
readonly downloadUrl = signal<string>('');
@@ -93,15 +89,15 @@ export class CedarTemplateFormComponent {
9389
effect(() => {
9490
const tpl = this.template();
9591
if (tpl?.attributes?.template) {
96-
this.loadCedarLibraries().then(() => this.initializeCedar());
92+
this.initializeCedar();
9793
}
9894
});
9995

10096
effect(() => {
10197
const record = this.existingRecord();
10298
this.schemaName.set(record?.embeds?.template.data.attributes.schema_name || '');
10399
if (record) {
104-
this.loadCedarLibraries().then(() => this.initializeCedar());
100+
this.initializeCedar();
105101
}
106102
});
107103
}
@@ -138,19 +134,6 @@ export class CedarTemplateFormComponent {
138134
}
139135
}
140136

141-
private async loadCedarLibraries(): Promise<void> {
142-
if (!isPlatformBrowser(this.platformId) || this.cedarLoaded()) {
143-
return;
144-
}
145-
146-
try {
147-
await Promise.all([import('cedar-artifact-viewer'), import('cedar-embeddable-editor')]);
148-
this.cedarLoaded.set(true);
149-
} catch {
150-
this.cedarLoaded.set(false);
151-
}
152-
}
153-
154137
downloadMetadadaRecord() {
155138
if (this.fileGuid()) {
156139
window.open(`${this.environment.webUrl}/metadata/${this.fileGuid()}`)?.focus();

src/app/features/profile/components/profile-information/profile-information.component.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@ <h1>{{ currentUser()?.fullName }}</h1>
1414

1515
<div class="flex flex-column gap-4 min-w-0 xl:align-items-end xl:flex-1">
1616
<div class="flex flex-column gap-3 w-full md:flex-row xl:gap-4 xl:justify-content-end">
17-
@if (currentUser()?.social?.orcid) {
17+
@if (orcidId()) {
1818
<div class="flex flex-row align-items-center gap-2">
1919
<img ngSrc="assets/icons/colored/orcid.svg" width="16" height="16" alt="orcid" />
20-
<a class="dark-blue-two-link font-bold" [href]="'https://orcid.org/' + currentUser()?.social?.orcid">
21-
https://orcid.org/{{ currentUser()?.social?.orcid }}
22-
</a>
20+
<a class="font-bold" [href]="'https://orcid.org/' + orcidId()"> https://orcid.org/{{ orcidId() }} </a>
2321
</div>
2422
}
2523

src/app/features/profile/components/profile-information/profile-information.component.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ export class ProfileInformationComponent {
4343

4444
userSocials = computed(() => mapUserSocials(this.currentUser()?.social, SOCIAL_LINKS));
4545

46+
orcidId = computed(() => {
47+
const orcid = this.currentUser()?.external_identity?.ORCID;
48+
return orcid?.status?.toUpperCase() === 'VERIFIED' ? orcid.id : undefined;
49+
});
50+
4651
toProfileSettings() {
4752
this.editProfile.emit();
4853
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export enum SubscriptionFrequency {
22
Never = 'none',
33
Daily = 'daily',
4-
Instant = 'instant',
4+
Instant = 'instantly',
55
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export class UserMapper {
3232
employment: user.attributes.employment,
3333
iri: user.links.iri,
3434
social: user.attributes.social,
35+
external_identity: user.attributes.external_identity,
3536
defaultRegionId: user.relationships?.default_region?.data?.id,
3637
canViewReviews: user.attributes.can_view_reviews === true, // [NS] Do not simplify it
3738
timezone: user.attributes.timezone,

0 commit comments

Comments
 (0)