Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
0cc7430
chore(157): project-addons-ui
kpetrov24exoft May 28, 2025
9797cb9
fix(project-addons): minor fixes
kpetrov24exoft Jun 2, 2025
ddd68fc
Merge branch 'main' into feat/184-project-addons-api
rnastyuk Jun 3, 2025
1e279f1
feat(project-addons-api): moved reusable addon files to the shared fo…
rnastyuk Jun 3, 2025
4d92a72
Merge branch 'main' into feat/184-project-addons-api
rnastyuk Jun 3, 2025
9cb147b
feat(profile-addons-api): added initial profile addons page structure…
rnastyuk Jun 9, 2025
988e267
Merge branch 'refs/heads/main' into feat/184-project-addons-api
rnastyuk Jun 9, 2025
2ccd258
feat(profile-addons-api): added addon configuration functionality
rnastyuk Jun 16, 2025
905ab39
Merge branch 'main' into feat/184-project-addons-api
rnastyuk Jun 16, 2025
3484429
feat(profile-addons-api): fixed connection creation bug, fixed form, …
rnastyuk Jun 18, 2025
614d12d
Merge branch 'main' into feat/184-project-addons-api
rnastyuk Jun 18, 2025
4afb7a6
feat(profile-addons-api): added breadcrumbs trimming
rnastyuk Jun 18, 2025
b040475
Merge branch 'main' into feat/184-project-addons-api
rnastyuk Jun 18, 2025
8c21899
feat(profile-addons-api): fixed comments
rnastyuk Jun 18, 2025
cd6365a
feat(profile-addons-api): changed p-select usage to reusable osf-select
rnastyuk Jun 19, 2025
3377ef7
Merge branch 'main' into feat/178-collections-api
rnastyuk Jun 20, 2025
52ef634
feat(collections-api): added get collection provider logic
rnastyuk Jun 20, 2025
b7e8669
feat(profile-addons-api): added filter logic and collections submissi…
rnastyuk Jun 25, 2025
8382bdf
feat(profile-addons-api): added dynamic rendering of the collections …
rnastyuk Jun 26, 2025
0a98a99
Merge branch 'main' into feat/178-collections-api
rnastyuk Jun 26, 2025
621bdb6
feat(add-to-collection): refactored collections routing and added bas…
rnastyuk Jun 27, 2025
b7e2dd4
feat(collections-api): refactored branding service
rnastyuk Jun 27, 2025
a7cff22
Merge branch 'feat/178-collections-api' into feat/201-add-to-collection
rnastyuk Jun 27, 2025
77bfdfb
Merge branch 'refs/heads/main' into feat/201-add-to-collection
rnastyuk Jun 30, 2025
c938d35
feat(add-to-collection): changed accordion to basic stepper
rnastyuk Jun 30, 2025
9d0d7a9
feat(add-to-collection): added stepper enum
rnastyuk Jun 30, 2025
bf3d937
Merge branch 'main' into feat/201-add-to-collection
rnastyuk Jul 2, 2025
a03e40a
feat(add-to-collection-api): changed accordion to stepper
rnastyuk Jul 3, 2025
213f8bb
Merge branch 'refs/heads/main' into feat/201-add-to-collection
rnastyuk Jul 3, 2025
dc85bf4
Merge branch 'refs/heads/main' into feat/201-add-to-collection
rnastyuk Jul 4, 2025
c13aff8
Merge branch 'refs/heads/main' into feat/201-add-to-collection
rnastyuk Jul 4, 2025
a628942
Merge branch 'refs/heads/main' into feat/201-add-to-collection
rnastyuk Jul 5, 2025
342ee27
Merge branch 'refs/heads/main' into feat/201-add-to-collection
rnastyuk Jul 8, 2025
e3a97f7
Merge branch 'refs/heads/main' into feat/201-add-to-collection
rnastyuk Jul 9, 2025
fb0f8da
feat(add-to-collection-api): added logic for submitting project to th…
rnastyuk Jul 11, 2025
6ddacb2
Merge branch 'main' into feat/201-add-to-collection
rnastyuk Jul 11, 2025
404d9bb
feat(add-to-collection-api): fixed bug with the contributor deletion
rnastyuk Jul 11, 2025
b047207
feat(add-to-collection-api): fixed input style
rnastyuk Jul 11, 2025
da69ecb
Merge branch 'main' into feat/201-add-to-collection
rnastyuk Jul 14, 2025
ffed90e
Merge remote-tracking branch 'origin/feat/201-add-to-collection' into…
rnastyuk Jul 14, 2025
525649c
feat(add-to-collection-api): fixed comments
rnastyuk Jul 14, 2025
d2606f9
Merge branch 'main' into feat/201-add-to-collection
rnastyuk Jul 14, 2025
757dcc0
Merge branch 'main' into feat/201-add-to-collection
rnastyuk Jul 14, 2025
d59b45b
feat(add-to-collection-api): added shared bookmarks service
rnastyuk Jul 14, 2025
82ce7e6
feat(add-to-collection-api): shorten import
rnastyuk Jul 14, 2025
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
5 changes: 2 additions & 3 deletions src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { provideStates } from '@ngxs/store';

import { Routes } from '@angular/router';

import { CollectionsState } from '@osf/features/collections/store/collections';
import { ProjectsState } from '@shared/stores';
import { BookmarksState, ProjectsState } from '@shared/stores';

import { MyProfileResourceFiltersOptionsState } from './features/my-profile/components/filters/store';
import { MyProfileResourceFiltersState } from './features/my-profile/components/my-profile-resource-filters/store';
Expand Down Expand Up @@ -74,7 +73,7 @@ export const routes: Routes = [
path: 'my-projects',
loadComponent: () =>
import('./features/my-projects/my-projects.component').then((mod) => mod.MyProjectsComponent),
providers: [provideStates([CollectionsState])],
providers: [provideStates([BookmarksState])],
},
{
path: 'my-projects/:id',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { AddToCollectionConfirmationDialogComponent } from './add-to-collection-confirmation-dialog.component';

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

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

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

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@use "assets/styles/variables" as var;
@use "assets/styles/mixins" as mix;

:host {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { CollectionMetadataStepComponent } from './collection-metadata-step.component';

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

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

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

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@ <h3>{{ 'collections.addToCollection.projectContributors' | translate }}</h3>
class="w-full"
[contributors]="projectContributors()"
[isLoading]="isContributorsLoading()"
[showCuratorColumn]="true"
[showCuratorColumn]="false"
(remove)="handleRemoveContributor($event)"
></osf-contributors-list>

<div class="flex justify-content-end gap-3 mt-4 w-full">
<p-button
[label]="'registries.metadata.addContributors' | translate"
severity="secondary"
[disabled]="isContributorsLoading()"
(click)="handleAddContributor()"
/>
<p-button
[loading]="isContributorsSubmitting()"
[disabled]="isContributorsLoading() || !projectContributors().length"
(click)="handleSaveContributors()"
[disabled]="!projectContributors().length"
[label]="'common.buttons.saveAndContinue' | translate"
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { ProjectContributorsStepComponent } from './project-contributors-step.component';

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

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

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

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export class ProjectContributorsStepComponent {

protected readonly projectContributors = select(ContributorsSelectors.getContributors);
protected readonly isContributorsLoading = select(ContributorsSelectors.isContributorsLoading);
protected readonly isContributorsSubmitting = select(ContributorsSelectors.isContributorsSubmitting);
protected readonly selectedProject = select(ProjectsSelectors.getSelectedProject);

private initialContributors = signal<ContributorModel[]>([]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,10 @@ <h3>{{ 'collections.addToCollection.projectMetadata' | translate }}</h3>
<ng-template class="m-0" #content>
<p class="pt-3">{{ 'collections.addToCollection.projectMetadataMessage' | translate }}</p>
<form [formGroup]="projectMetadataForm" class="flex flex-column gap-4 mt-4">
<div class="flex flex-column gap-1">
<label for="title">
{{ 'collections.addToCollection.form.title' | translate }}
</label>
<input pInputText id="title" type="text" [formControlName]="ProjectMetadataFormControls.Title" />
@let titleControl = projectMetadataForm.controls[ProjectMetadataFormControls.Title];
@if (titleControl.errors?.['required'] && (titleControl.touched || titleControl.dirty)) {
<p-message class="simple-variant flex mt-1" severity="error" variant="simple" size="small">
{{ 'collections.addToCollection.form.fieldRequired' | translate }}
</p-message>
}
</div>
<osf-text-input
label="collections.addToCollection.form.title"
[control]="projectMetadataForm.controls[ProjectMetadataFormControls.Title]"
/>

<div class="flex flex-column gap-1">
<label for="description">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { ProjectMetadataStepComponent } from './project-metadata-step.component';

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

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

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

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { Card } from 'primeng/card';
import { Chip } from 'primeng/chip';
import { DatePicker } from 'primeng/datepicker';
import { Divider } from 'primeng/divider';
import { InputText } from 'primeng/inputtext';
import { Message } from 'primeng/message';
import { Select, SelectChangeEvent } from 'primeng/select';
import { Step, StepItem, StepPanel } from 'primeng/stepper';
Expand Down Expand Up @@ -49,7 +48,6 @@ import { ProjectsSelectors } from '@shared/stores/projects/projects.selectors';
imports: [
Button,
TranslatePipe,
InputText,
ReactiveFormsModule,
Textarea,
FormsModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h3>{{ 'collections.addToCollection.selectProject' | translate }}</h3>

<p-step-panel [value]="targetStepValue()" class="p-0">
<ng-template class="m-0" #content>
<div class="mt-4 w-full md:w-6">
<div class="mt-4 w-full lg:w-6">
<p-select
class="w-full"
[loading]="isProjectsLoading()"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { SelectProjectStepComponent } from './select-project-step.component';

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

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

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

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { UserSelectors } from '@core/store/user';
import { AddToCollectionSteps } from '@osf/features/collections/enums';
import { CollectionsSelectors, GetUserCollectionSubmissions } from '@osf/features/collections/store/collections';
import { GetProjects, SetSelectedProject } from '@osf/shared/stores';
import { CustomOption } from '@shared/models';
import { Project } from '@shared/models/projects';
import { ProjectsSelectors } from '@shared/stores/projects/projects.selectors';

Expand Down Expand Up @@ -55,7 +56,7 @@ export class SelectProjectStepComponent {
stepChange = output<number>();
projectSelected = output<void>();

protected projectsOptions = signal<{ label: string; value: Project }[]>([]);
protected projectsOptions = signal<CustomOption<Project>[]>([]);

protected filterMessage = computed(() => {
const isLoading = this.isProjectsLoading() || this.isSubmissionsLoading();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@use "assets/styles/variables" as var;
@use "assets/styles/mixins" as mix;

:host {
Expand Down
32 changes: 32 additions & 0 deletions src/app/features/collections/mappers/collections.mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import {
CollectionProviderResponseJsonApi,
CollectionSubmission,
CollectionSubmissionJsonApi,
CollectionSubmissionPayload,
} from '@osf/features/collections/models';
import { CollectionSubmissionPayloadJsonApi } from '@osf/features/collections/models/collection-submission-payload-json-api.model';
import { convertToSnakeCase } from '@shared/utils';

export class CollectionsMapper {
static fromGetCollectionContributorsResponse(response: CollectionContributorJsonApi[]): CollectionContributor[] {
Expand Down Expand Up @@ -127,4 +130,33 @@ export class CollectionsMapper {
contributors: [] as CollectionContributor[],
}));
}

static toCollectionSubmissionRequest(payload: CollectionSubmissionPayload): CollectionSubmissionPayloadJsonApi {
const collectionId = payload.collectionId;
const collectionsMetadata = convertToSnakeCase(payload.collectionMetadata);

return {
data: {
type: 'collection-submissions',
attributes: {
guid: payload.projectId,
...collectionsMetadata,
},
relationships: {
collection: {
data: {
id: collectionId,
type: 'collections',
},
},
creator: {
data: {
type: 'users',
id: payload.userId,
},
},
},
},
};
}
}
30 changes: 2 additions & 28 deletions src/app/features/collections/services/add-to-collection.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import { map, Observable } from 'rxjs';
import { inject, Injectable } from '@angular/core';

import { JsonApiService } from '@core/services';
import { CollectionsMapper } from '@osf/features/collections/mappers';
import { CollectionSubmissionPayload } from '@osf/features/collections/models';
import { CollectionSubmissionPayloadJsonApi } from '@osf/features/collections/models/collection-submission-payload-json-api.model';
import { LicensesMapper } from '@shared/mappers';
import { License, LicensesResponseJsonApi } from '@shared/models';
import { convertToSnakeCase } from '@shared/utils';

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

Expand All @@ -29,32 +28,7 @@ export class AddToCollectionService {

createCollectionSubmission(payload: CollectionSubmissionPayload): Observable<void> {
const collectionId = payload.collectionId;

const collectionsMetadata = convertToSnakeCase(payload.collectionMetadata);

const metadata: CollectionSubmissionPayloadJsonApi = {
data: {
type: 'collection-submissions',
attributes: {
guid: payload.projectId,
...collectionsMetadata,
},
relationships: {
collection: {
data: {
id: collectionId,
type: 'collections',
},
},
creator: {
data: {
type: 'users',
id: payload.userId,
},
},
},
},
};
const metadata = CollectionsMapper.toCollectionSubmissionRequest(payload);

return this.jsonApiService.post(`${this.apiUrl}/collections/${collectionId}/collection_submissions/`, metadata);
}
Expand Down
Loading