Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 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
1b3533b
fix(add-to-collection-api): added deactivate guard and clearing store
rnastyuk Jul 14, 2025
c66bb5c
fix(add-to-collection-api): moved guard
rnastyuk Jul 14, 2025
435a4db
Merge branch 'main' into fix/add-to-collection
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
2 changes: 2 additions & 0 deletions src/app/features/collections/collections.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Routes } from '@angular/router';

import { AddToCollectionState } from '@osf/features/collections/store/add-to-collection';
import { CollectionsState } from '@osf/features/collections/store/collections';
import { ConfirmLeavingGuard } from '@shared/guards';
import { ContributorsState, ProjectsState } from '@shared/stores';

import { ModeratorsState } from '../moderation/store/moderation';
Expand Down Expand Up @@ -40,6 +41,7 @@ export const collectionsRoutes: Routes = [
(mod) => mod.AddToCollectionComponent
),
providers: [provideStates([ProjectsState, CollectionsState, AddToCollectionState, ContributorsState])],
canDeactivate: [ConfirmLeavingGuard],
},
{
path: ':id/moderation',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { Button } from 'primeng/button';
import { DialogService } from 'primeng/dynamicdialog';
import { Stepper } from 'primeng/stepper';

import { Observable } from 'rxjs';

import {
ChangeDetectionStrategy,
Component,
Expand All @@ -27,6 +29,7 @@ import {
} from '@osf/features/collections/store/add-to-collection/add-to-collection.actions';
import { CollectionsSelectors, GetCollectionProvider } from '@osf/features/collections/store/collections';
import { LoadingSpinnerComponent } from '@shared/components';
import { CanDeactivateComponent } from '@shared/models';
import { ProjectsSelectors } from '@shared/stores/projects/projects.selectors';

import {
Expand Down Expand Up @@ -55,7 +58,7 @@ import {
providers: [DialogService],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AddToCollectionComponent {
export class AddToCollectionComponent implements CanDeactivateComponent {
private readonly router = inject(Router);
private readonly route = inject(ActivatedRoute);
private readonly destroyRef = inject(DestroyRef);
Expand All @@ -70,6 +73,7 @@ export class AddToCollectionComponent {
protected selectedProject = select(ProjectsSelectors.getSelectedProject);
protected currentUser = select(UserSelectors.getCurrentUser);
protected providerId = signal<string>('');
protected isSubmitted = signal<boolean>(false);
protected projectMetadataSaved = signal<boolean>(false);
protected projectContributorsSaved = signal<boolean>(false);
protected collectionMetadataSaved = signal<boolean>(false);
Expand Down Expand Up @@ -123,6 +127,7 @@ export class AddToCollectionComponent {
collectionMetadata: this.collectionMetadataForm.value || {},
userId: this.currentUser()?.id || '',
};
this.isSubmitted.set(true);

const dialogRef = this.dialogService.open(AddToCollectionConfirmationDialogComponent, {
width: '500px',
Expand All @@ -136,6 +141,7 @@ export class AddToCollectionComponent {

dialogRef.onClose.subscribe((result) => {
if (result) {
this.isSubmitted.set(false);
this.router.navigate(['/my-projects', this.selectedProject()?.id, 'overview']);
}
});
Expand Down Expand Up @@ -165,4 +171,8 @@ export class AddToCollectionComponent {
$event.preventDefault();
return false;
}

canDeactivate(): Observable<boolean> | boolean {
return this.isSubmitted();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { License } from '@shared/models';
import { Project } from '@shared/models/projects';
import { InterpolatePipe } from '@shared/pipes';
import { ToastService } from '@shared/services';
import { GetAllContributors, UpdateProjectMetadata } from '@shared/stores';
import { ClearProjects, GetAllContributors, UpdateProjectMetadata } from '@shared/stores';
import { ProjectsSelectors } from '@shared/stores/projects/projects.selectors';

@Component({
Expand Down Expand Up @@ -95,6 +95,7 @@ export class ProjectMetadataStepComponent {
updateCollectionSubmissionMetadata: UpdateProjectMetadata,
getAllContributors: GetAllContributors,
getCollectionLicenses: GetCollectionLicenses,
clearProjects: ClearProjects,
});

protected readonly projectMetadataForm: FormGroup<ProjectMetadataForm> = this.formService.createForm();
Expand Down Expand Up @@ -231,5 +232,11 @@ export class ProjectMetadataStepComponent {
this.initialProjectMetadataFormValues.set(JSON.stringify(formValue));
}
});

effect(() => {
this.destroyRef.onDestroy(() => {
this.actions.clearProjects();
});
});
}
}
1 change: 1 addition & 0 deletions src/app/features/collections/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { AddToCollectionComponent } from './add-to-collection/add-to-collection.component';
export { CollectionsFilterChipsComponent } from './collections-filter-chips/collections-filter-chips.component';
export { CollectionsFiltersComponent } from './collections-filters/collections-filters.component';
export { CollectionsHelpDialogComponent } from './collections-help-dialog/collections-help-dialog.component';
Expand Down
1 change: 0 additions & 1 deletion src/app/features/preprints/guards/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/app/features/preprints/models/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './can-deactivate.interface';
export * from './preprint.models';
export * from './preprint-json-api.models';
export * from './preprint-licenses-json-api.models';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,14 @@ import {
} from '@osf/features/preprints/components';
import { submitPreprintSteps } from '@osf/features/preprints/constants';
import { PreprintSteps } from '@osf/features/preprints/enums';
import { CanDeactivateComponent } from '@osf/features/preprints/models';
import { GetPreprintProviderById, PreprintProvidersSelectors } from '@osf/features/preprints/store/preprint-providers';
import {
DeletePreprint,
PreprintStepperSelectors,
ResetState,
SetSelectedPreprintProviderId,
} from '@osf/features/preprints/store/preprint-stepper';
import { StepOption } from '@osf/shared/models';
import { CanDeactivateComponent, StepOption } from '@osf/shared/models';
import { StepperComponent } from '@shared/components';
import { BrandService } from '@shared/services';
import { BrowserTabHelper, HeaderStyleHelper, IS_WEB } from '@shared/utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import {
} from '@osf/features/preprints/components';
import { updatePreprintSteps } from '@osf/features/preprints/constants';
import { PreprintSteps } from '@osf/features/preprints/enums';
import { CanDeactivateComponent } from '@osf/features/preprints/models';
import { GetPreprintProviderById, PreprintProvidersSelectors } from '@osf/features/preprints/store/preprint-providers';
import {
FetchPreprintById,
Expand All @@ -39,7 +38,7 @@ import {
SetSelectedPreprintProviderId,
} from '@osf/features/preprints/store/preprint-stepper';
import { StepperComponent } from '@shared/components';
import { StepOption } from '@shared/models';
import { CanDeactivateComponent, StepOption } from '@shared/models';
import { BrandService } from '@shared/services';
import { BrowserTabHelper, HeaderStyleHelper, IS_WEB } from '@shared/utils';

Expand Down
2 changes: 1 addition & 1 deletion src/app/features/preprints/preprints.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { provideStates } from '@ngxs/store';

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

import { ConfirmLeavingGuard } from '@osf/features/preprints/guards';
import { PreprintsComponent } from '@osf/features/preprints/preprints.component';
import { PreprintProvidersState } from '@osf/features/preprints/store/preprint-providers';
import { PreprintStepperState } from '@osf/features/preprints/store/preprint-stepper';
import { PreprintsDiscoverState } from '@osf/features/preprints/store/preprints-discover';
import { PreprintsResourcesFiltersState } from '@osf/features/preprints/store/preprints-resources-filters';
import { PreprintsResourcesFiltersOptionsState } from '@osf/features/preprints/store/preprints-resources-filters-options';
import { ConfirmLeavingGuard } from '@shared/guards';
import { ResourceType } from '@shared/enums';
import { ContributorsState, SubjectsState } from '@shared/stores';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { Subject } from 'rxjs';
import { inject } from '@angular/core';
import { CanDeactivateFn } from '@angular/router';

import { SubmitPreprintStepperComponent } from '@osf/features/preprints/pages/submit-preprint-stepper/submit-preprint-stepper.component';
import { CanDeactivateComponent } from '@shared/models';
import { CustomConfirmationService } from '@shared/services';

export const ConfirmLeavingGuard: CanDeactivateFn<SubmitPreprintStepperComponent> = (component) => {
export const ConfirmLeavingGuard: CanDeactivateFn<CanDeactivateComponent> = (component) => {
const confirmationService = inject(CustomConfirmationService);
const confirmationResultSubject = new Subject<boolean>();
const confirmationResultObservable = confirmationResultSubject.asObservable();
Expand Down
1 change: 1 addition & 0 deletions src/app/shared/guards/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { ConfirmLeavingGuard } from './confirm-leaving.guard';
1 change: 1 addition & 0 deletions src/app/shared/models/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export * from './addons';
export * from './brand.json-api.model';
export * from './brand.model';
export * from './can-deactivate.interface';
export * from './charts';
export * from './confirmation-options.model';
export * from './contributors';
Expand Down
4 changes: 4 additions & 0 deletions src/app/shared/stores/projects/projects.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ export class UpdateProjectMetadata {

constructor(public metadata: ProjectMetadataUpdatePayload) {}
}

export class ClearProjects {
static readonly type = '[Projects] Clear Selected Project';
}
41 changes: 27 additions & 14 deletions src/app/shared/stores/projects/projects.state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,31 @@ import { inject, Injectable } from '@angular/core';

import { handleSectionError } from '@core/handlers';
import { ProjectsService } from '@shared/services/projects.service';
import { GetProjects, ProjectsStateModel, SetSelectedProject, UpdateProjectMetadata } from '@shared/stores';
import {
ClearProjects,
GetProjects,
ProjectsStateModel,
SetSelectedProject,
UpdateProjectMetadata,
} from '@shared/stores';

const PROJECTS_DEFAULTS: ProjectsStateModel = {
projects: {
data: [],
isLoading: false,
error: null,
},
selectedProject: {
data: null,
isLoading: false,
isSubmitting: false,
error: null,
},
};

@State<ProjectsStateModel>({
name: 'projects',
defaults: {
projects: {
data: [],
isLoading: false,
error: null,
},
selectedProject: {
data: null,
isLoading: false,
isSubmitting: false,
error: null,
},
},
defaults: PROJECTS_DEFAULTS,
})
@Injectable()
export class ProjectsState {
Expand Down Expand Up @@ -89,4 +97,9 @@ export class ProjectsState {
catchError((error) => handleSectionError(ctx, 'selectedProject', error))
);
}

@Action(ClearProjects)
clearProjects(ctx: StateContext<ProjectsStateModel>) {
ctx.patchState(PROJECTS_DEFAULTS);
}
}