Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
7f61428
feat(search): added generic search component
volodyayakubovskyy Aug 4, 2025
c1fb0e7
feat(search): improved search for institutions
volodyayakubovskyy Aug 5, 2025
7184e54
feat(search): remove unused files
volodyayakubovskyy Aug 5, 2025
055fbe3
feat(search): fixed some issues
volodyayakubovskyy Aug 5, 2025
1ac38d4
Merge remote-tracking branch 'origin/main' into feat/398
nsemets Aug 6, 2025
8b55a14
fix(search): removed comments
nsemets Aug 6, 2025
ecfab6d
Merge remote-tracking branch 'origin/main' into feat/398
nsemets Aug 11, 2025
c98a37a
fix(profile): renamed it to profile
nsemets Aug 19, 2025
a264fca
Merge remote-tracking branch 'origin/feat/398' into fix/search-updates
nsemets Aug 19, 2025
b6fca34
fix(updates): updates
nsemets Aug 20, 2025
ed5f60b
Merge branch 'refs/heads/main' into fix/search-updates
rrromchIk Aug 22, 2025
c228a8a
Merge branch 'refs/heads/main' into fix/search-updates
rrromchIk Aug 22, 2025
0c5db72
Merge branch 'refs/heads/main' into fix/search-updates
rrromchIk Aug 22, 2025
e75f063
fix(branding): Minor fixed regarding provider hero for preprints and …
rrromchIk Aug 22, 2025
f7a9a44
refactor(search-results-container): Encapsulated some logic, reduced …
rrromchIk Aug 22, 2025
4dd8a34
refactor(search-results-container): Encapsulated tabs logic
rrromchIk Aug 22, 2025
1c0e7d1
refactor(search): Refactored partly search section for preprints and …
rrromchIk Aug 22, 2025
a452b61
refactor(search): Refactored search logic for global, institutions pa…
rrromchIk Aug 28, 2025
bb70182
Merge branch 'refs/heads/main' into fix/search-updates
rrromchIk Aug 28, 2025
ff0211b
refactor(search): Refactored search logic for global, institutions pa…
rrromchIk Aug 28, 2025
4d52403
refactor(search): Refactored search logic for profile
rrromchIk Aug 28, 2025
c35d955
feat(profile): Implemented my-profile and user/:id pages
rrromchIk Aug 29, 2025
c2e6ac7
refactor(preprint-provider-discover): Removed search section that use…
rrromchIk Aug 29, 2025
84540fd
refactor(search): Create shared component that encapsulates search lo…
rrromchIk Aug 31, 2025
de72321
refactor(shared-search): Extracted state model. Reduced duplications.…
rrromchIk Sep 1, 2025
81aa4f4
refactor(search): Using ResourceType instead of ResourceTab. Fixed pa…
rrromchIk Sep 1, 2025
ccf4b0a
Merge branch 'main' into fix/search-updates
rrromchIk Sep 1, 2025
17392f7
refactor(search-models): Cleaned up models - renamed files, moved mod…
rrromchIk Sep 2, 2025
9496e2c
Merge branch 'main' into fix/search-updates
rrromchIk Sep 2, 2025
30bac9e
refactor(index-card-search): Refactored models
rrromchIk Sep 2, 2025
dd07529
fix(resource-card): Fixed resource-card component
rrromchIk Sep 3, 2025
1bb26ba
fix(resource-card-secondary-metadata): Fixed resource-card component
rrromchIk Sep 3, 2025
702d618
Merge branch 'main' into fix/search-updates
rrromchIk Sep 3, 2025
9af6bb9
fix(search): Fixed PR comments and conflicts after merge
rrromchIk Sep 4, 2025
53bd68c
refactor(search): Renamed OsfSearch- to GlobalSearch-
rrromchIk Sep 4, 2025
636bb94
fix(unit-tests): fixed unit tests
nsemets Sep 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
23 changes: 12 additions & 11 deletions src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,11 @@ import { BookmarksState, ProjectsState } from '@shared/stores';
import { authGuard, redirectIfLoggedInGuard } from './core/guards';
import { isProjectGuard } from './core/guards/is-project.guard';
import { isRegistryGuard } from './core/guards/is-registry.guard';
import { MyProfileResourceFiltersOptionsState } from './features/my-profile/components/filters/store';
import { MyProfileResourceFiltersState } from './features/my-profile/components/my-profile-resource-filters/store';
import { MyProfileState } from './features/my-profile/store';
import { PreprintState } from './features/preprints/store/preprint';
import { ProfileState } from './features/profile/store';
import { RegistriesState } from './features/registries/store';
import { LicensesHandlers, ProjectsHandlers, ProvidersHandlers } from './features/registries/store/handlers';
import { FilesHandlers } from './features/registries/store/handlers/files.handlers';
import { ResourceFiltersOptionsState } from './features/search/components/filters/store';
import { ResourceFiltersState } from './features/search/components/resource-filters/store';
import { SearchState } from './features/search/store';
import { LicensesService } from './shared/services';

export const routes: Routes = [
Expand Down Expand Up @@ -71,7 +66,6 @@ export const routes: Routes = [
{
path: 'search',
loadComponent: () => import('./features/search/search.component').then((mod) => mod.SearchComponent),
providers: [provideStates([ResourceFiltersState, ResourceFiltersOptionsState, SearchState])],
},
{
path: 'my-projects',
Expand Down Expand Up @@ -119,12 +113,19 @@ export const routes: Routes = [
},
{
path: 'my-profile',
loadComponent: () => import('./features/my-profile/my-profile.component').then((mod) => mod.MyProfileComponent),
providers: [
provideStates([MyProfileResourceFiltersState, MyProfileResourceFiltersOptionsState, MyProfileState]),
],
loadComponent: () =>
import('./features/profile/pages/my-profile/my-profile.component').then((mod) => mod.MyProfileComponent),
providers: [provideStates([ProfileState])],
canActivate: [authGuard],
},
{
path: 'user/:id',
loadComponent: () =>
import('./features/profile/pages/user-profile/user-profile.component').then(
(mod) => mod.UserProfileComponent
),
providers: [provideStates([ProfileState])],
},
{
path: 'institutions',
loadChildren: () => import('./features/institutions/institutions.routes').then((r) => r.routes),
Expand Down
2 changes: 2 additions & 0 deletions src/app/core/constants/ngxs-states.constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { MetadataState } from '@osf/features/metadata/store';
import { ProjectOverviewState } from '@osf/features/project/overview/store';
import { RegistrationsState } from '@osf/features/project/registrations/store';
import { AddonsState, CurrentResourceState, WikiState } from '@osf/shared/stores';
import { GlobalSearchState } from '@shared/stores/global-search';
import { InstitutionsState } from '@shared/stores/institutions';
import { LicensesState } from '@shared/stores/licenses';
import { MyResourcesState } from '@shared/stores/my-resources';
Expand All @@ -26,4 +27,5 @@ export const STATES = [
FilesState,
MetadataState,
CurrentResourceState,
GlobalSearchState,
];
22 changes: 16 additions & 6 deletions src/app/core/guards/is-project.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import { map, switchMap } from 'rxjs/operators';
import { inject } from '@angular/core';
import { CanMatchFn, Route, Router, UrlSegment } from '@angular/router';

import { CurrentResourceType } from '../../shared/enums';
import { CurrentResourceSelectors, GetResource } from '../../shared/stores';
import { UserSelectors } from '@core/store/user';
import { CurrentResourceType } from '@shared/enums';
import { CurrentResourceSelectors, GetResource } from '@shared/stores';

export const isProjectGuard: CanMatchFn = (route: Route, segments: UrlSegment[]) => {
const store = inject(Store);
Expand All @@ -19,8 +20,9 @@ export const isProjectGuard: CanMatchFn = (route: Route, segments: UrlSegment[])
}

const currentResource = store.selectSnapshot(CurrentResourceSelectors.getCurrentResource);
const currentUser = store.selectSnapshot(UserSelectors.getCurrentUser);

if (currentResource && currentResource.id === id) {
if (currentResource && !id.startsWith(currentResource.id)) {
if (currentResource.type === CurrentResourceType.Projects && currentResource.parentId) {
router.navigate(['/', currentResource.parentId, 'files', id]);
return true;
Expand All @@ -32,7 +34,11 @@ export const isProjectGuard: CanMatchFn = (route: Route, segments: UrlSegment[])
}

if (currentResource.type === CurrentResourceType.Users) {
router.navigate(['/profile', id]);
if (currentUser && currentUser.id === currentResource.id) {
router.navigate(['/profile']);
} else {
router.navigate(['/user', id]);
}
return false;
}

Expand All @@ -42,7 +48,7 @@ export const isProjectGuard: CanMatchFn = (route: Route, segments: UrlSegment[])
return store.dispatch(new GetResource(id)).pipe(
switchMap(() => store.select(CurrentResourceSelectors.getCurrentResource)),
map((resource) => {
if (!resource || resource.id !== id) {
if (!resource || !id.startsWith(resource.id)) {
return false;
}

Expand All @@ -57,7 +63,11 @@ export const isProjectGuard: CanMatchFn = (route: Route, segments: UrlSegment[])
}

if (resource.type === CurrentResourceType.Users) {
router.navigate(['/user', id]);
if (currentUser && currentUser.id === resource.id) {
router.navigate(['/profile']);
} else {
router.navigate(['/user', id]);
}
return false;
}

Expand Down
22 changes: 16 additions & 6 deletions src/app/core/guards/is-registry.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import { map, switchMap } from 'rxjs/operators';
import { inject } from '@angular/core';
import { CanMatchFn, Route, Router, UrlSegment } from '@angular/router';

import { CurrentResourceType } from '../../shared/enums';
import { CurrentResourceSelectors, GetResource } from '../../shared/stores';
import { UserSelectors } from '@core/store/user';
import { CurrentResourceType } from '@shared/enums';
import { CurrentResourceSelectors, GetResource } from '@shared/stores';

export const isRegistryGuard: CanMatchFn = (route: Route, segments: UrlSegment[]) => {
const store = inject(Store);
Expand All @@ -19,8 +20,9 @@ export const isRegistryGuard: CanMatchFn = (route: Route, segments: UrlSegment[]
}

const currentResource = store.selectSnapshot(CurrentResourceSelectors.getCurrentResource);
const currentUser = store.selectSnapshot(UserSelectors.getCurrentUser);

if (currentResource && currentResource.id === id) {
if (currentResource && !id.startsWith(currentResource.id)) {
if (currentResource.type === CurrentResourceType.Registrations && currentResource.parentId) {
router.navigate(['/', currentResource.parentId, 'files', id]);
return true;
Expand All @@ -32,7 +34,11 @@ export const isRegistryGuard: CanMatchFn = (route: Route, segments: UrlSegment[]
}

if (currentResource.type === CurrentResourceType.Users) {
router.navigate(['/user', id]);
if (currentUser && currentUser.id === currentResource.id) {
router.navigate(['/profile']);
} else {
router.navigate(['/user', id]);
}
return false;
}

Expand All @@ -42,7 +48,7 @@ export const isRegistryGuard: CanMatchFn = (route: Route, segments: UrlSegment[]
return store.dispatch(new GetResource(id)).pipe(
switchMap(() => store.select(CurrentResourceSelectors.getCurrentResource)),
map((resource) => {
if (!resource || resource.id !== id) {
if (!resource || !id.startsWith(resource.id)) {
return false;
}

Expand All @@ -57,7 +63,11 @@ export const isRegistryGuard: CanMatchFn = (route: Route, segments: UrlSegment[]
}

if (resource.type === CurrentResourceType.Users) {
router.navigate(['/profile', id]);
if (currentUser && currentUser.id === resource.id) {
router.navigate(['/profile']);
} else {
router.navigate(['/user', id]);
}
return false;
}

Expand Down
14 changes: 10 additions & 4 deletions src/app/core/services/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import {
ProfileSettingsUpdate,
User,
UserData,
UserDataJsonApi,
UserDataResponseJsonApi,
UserGetResponse,
UserResponseJsonApi,
UserSettings,
UserSettingsGetResponse,
} from '@osf/shared/models';

import { JsonApiService } from '../../shared/services';
import { JsonApiService } from '@shared/services';

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

Expand All @@ -25,6 +25,12 @@ import { environment } from 'src/environments/environment';
export class UserService {
jsonApiService = inject(JsonApiService);

getUserById(userId: string): Observable<User> {
return this.jsonApiService
.get<UserResponseJsonApi>(`${environment.apiUrl}/users/${userId}/`)
.pipe(map((response) => UserMapper.fromUserGetResponse(response.data)));
}

getCurrentUser(): Observable<UserData> {
return this.jsonApiService
.get<UserDataResponseJsonApi>(`${environment.apiUrl}/`)
Expand All @@ -49,7 +55,7 @@ export class UserService {
const patchedData = key === ProfileSettingsKey.User ? data : { [key]: data };

return this.jsonApiService
.patch<UserGetResponse>(`${environment.apiUrl}/users/${userId}/`, {
.patch<UserDataJsonApi>(`${environment.apiUrl}/users/${userId}/`, {
data: { type: 'users', id: userId, attributes: patchedData },
})
.pipe(map((response) => UserMapper.fromUserGetResponse(response)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { provideHttpClientTesting } from '@angular/common/http/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ActivatedRoute, Router } from '@angular/router';

import { InstitutionsSearchState } from '@osf/shared/stores/institutions-search';
import { LoadingSpinnerComponent, SelectComponent } from '@shared/components';
import { InstitutionsSearchState } from '@shared/stores';

import { AdminInstitutionsComponent } from './admin-institutions.component';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ChangeDetectionStrategy, Component, inject, OnInit } from '@angular/cor
import { ActivatedRoute, Router, RouterOutlet } from '@angular/router';

import { Primitive } from '@osf/shared/helpers';
import { FetchInstitutionById, InstitutionsSearchSelectors } from '@osf/shared/stores';
import { FetchInstitutionById, InstitutionsSearchSelectors } from '@osf/shared/stores/institutions-search';
import { LoadingSpinnerComponent, SelectComponent } from '@shared/components';

import { resourceTabOptions } from './constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { ActivatedRoute, Router } from '@angular/router';

import { AdminTableComponent } from '@osf/features/admin-institutions/components';
import { InstitutionsAdminState } from '@osf/features/admin-institutions/store';
import { InstitutionsSearchState } from '@osf/shared/stores/institutions-search';
import { LoadingSpinnerComponent } from '@shared/components';
import { InstitutionsSearchState } from '@shared/stores';

import { InstitutionsPreprintsComponent } from './institutions-preprints.component';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { TABLE_PARAMS } from '@osf/shared/constants';
import { SortOrder } from '@osf/shared/enums';
import { Institution, QueryParams } from '@osf/shared/models';
import { InstitutionsSearchSelectors } from '@osf/shared/stores';
import { InstitutionsSearchSelectors } from '@osf/shared/stores/institutions-search';

import { AdminTableComponent } from '../../components';
import { preprintsTableColumns } from '../../constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { ActivatedRoute } from '@angular/router';
import { AdminTableComponent } from '@osf/features/admin-institutions/components';
import { InstitutionsAdminState } from '@osf/features/admin-institutions/store';
import { ToastService } from '@osf/shared/services';
import { InstitutionsSearchState } from '@osf/shared/stores/institutions-search';
import { LoadingSpinnerComponent } from '@shared/components';
import { InstitutionsSearchState } from '@shared/stores';

import { InstitutionsProjectsComponent } from './institutions-projects.component';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { TABLE_PARAMS } from '@osf/shared/constants';
import { SortOrder } from '@osf/shared/enums';
import { Institution, QueryParams } from '@osf/shared/models';
import { ToastService } from '@osf/shared/services';
import { InstitutionsSearchSelectors } from '@osf/shared/stores';
import { InstitutionsSearchSelectors } from '@osf/shared/stores/institutions-search';

import { AdminTableComponent } from '../../components';
import { projectTableColumns } from '../../constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { ActivatedRoute, Router } from '@angular/router';

import { AdminTableComponent } from '@osf/features/admin-institutions/components';
import { InstitutionsAdminState } from '@osf/features/admin-institutions/store';
import { InstitutionsSearchState } from '@osf/shared/stores/institutions-search';
import { LoadingSpinnerComponent } from '@shared/components';
import { InstitutionsSearchState } from '@shared/stores';

import { InstitutionsRegistrationsComponent } from './institutions-registrations.component';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { TABLE_PARAMS } from '@osf/shared/constants';
import { SortOrder } from '@osf/shared/enums';
import { Institution, QueryParams } from '@osf/shared/models';
import { InstitutionsSearchSelectors } from '@osf/shared/stores';
import { InstitutionsSearchSelectors } from '@osf/shared/stores/institutions-search';

import { AdminTableComponent } from '../../components';
import { registrationTableColumns } from '../../constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { UserState } from '@core/store/user';
import { AdminTableComponent } from '@osf/features/admin-institutions/components';
import { InstitutionsAdminState } from '@osf/features/admin-institutions/store';
import { ToastService } from '@osf/shared/services';
import { InstitutionsSearchState } from '@osf/shared/stores';
import { InstitutionsSearchState } from '@osf/shared/stores/institutions-search';
import { LoadingSpinnerComponent, SelectComponent } from '@shared/components';
import { TranslateServiceMock } from '@shared/mocks';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { SortOrder } from '@osf/shared/enums';
import { Primitive } from '@osf/shared/helpers';
import { QueryParams } from '@osf/shared/models';
import { ToastService } from '@osf/shared/services';
import { InstitutionsSearchSelectors } from '@osf/shared/stores';
import { InstitutionsSearchSelectors } from '@osf/shared/stores/institutions-search';

import { AdminTableComponent } from '../../components';
import { departmentOptions, userTableColumns } from '../../constants';
Expand Down
2 changes: 1 addition & 1 deletion src/app/features/files/mappers/resource-metadata.mapper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ResourceMetadata } from '@osf/shared/models';
import { ResourceMetadata } from '@shared/models';

import { GetResourceCustomMetadataResponse } from '../models/get-resource-custom-metadata-response.model';
import { GetResourceShortInfoResponse } from '../models/get-resource-short-info-response.model';
Expand Down
3 changes: 1 addition & 2 deletions src/app/features/files/store/files.state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import { catchError, finalize, forkJoin, tap } from 'rxjs';

import { inject, Injectable } from '@angular/core';

import { MapResourceMetadata } from '@osf/features/files/mappers';
import { handleSectionError } from '@osf/shared/helpers';
import { FilesService, ToastService } from '@shared/services';

import { MapResourceMetadata } from '../mappers/resource-metadata.mapper';

import {
CreateFolder,
DeleteEntry,
Expand Down
2 changes: 1 addition & 1 deletion src/app/features/institutions/institutions.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { provideStates } from '@ngxs/store';
import { Routes } from '@angular/router';

import { authGuard } from '@core/guards';
import { InstitutionsSearchState } from '@osf/shared/stores';
import { InstitutionsSearchState } from '@shared/stores/institutions-search';

import { InstitutionsComponent } from './institutions.component';
import { InstitutionsListComponent, InstitutionsSearchComponent } from './pages';
Expand Down
Loading
Loading