Skip to content

Commit 3bf9384

Browse files
feat(institutions): add sso availability filter and update related models/services
1 parent 8464901 commit 3bf9384

8 files changed

Lines changed: 17 additions & 5 deletions

File tree

src/app/features/institutions/pages/institutions-list/institutions-list.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ import { ScheduledBannerComponent } from '@core/components/osf-banners/scheduled
1414
import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component';
1515
import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component';
1616
import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component';
17+
import {
18+
INSTITUTIONS_SSO_AVAILABILITY_KEY,
19+
INSTITUTIONS_SSO_AVAILABILITY_VALUE,
20+
} from '@osf/shared/constants/institutions-filters.const';
1721
import { FetchInstitutions, InstitutionsSelectors } from '@osf/shared/stores/institutions';
1822

1923
@Component({
@@ -43,7 +47,7 @@ export class InstitutionsListComponent {
4347
institutionsLoading = select(InstitutionsSelectors.isInstitutionsLoading);
4448

4549
constructor() {
46-
this.actions.getInstitutions();
50+
this.actions.getInstitutions(INSTITUTIONS_SSO_AVAILABILITY_VALUE, INSTITUTIONS_SSO_AVAILABILITY_KEY);
4751
this.setupSearchSubscription();
4852
}
4953

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const INSTITUTIONS_SSO_AVAILABILITY_VALUE = '[Public,Unavailable]';
2+
export const INSTITUTIONS_SSO_AVAILABILITY_KEY = 'sso_availability';

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export class InstitutionsMapper {
2525
logoPath: data.attributes.logo_path,
2626
userMetricsUrl: data.relationships?.user_metrics?.links?.related?.href,
2727
linkToExternalReportsArchive: data.attributes.link_to_external_reports_archive,
28+
sso_availability: data.attributes.sso_availability,
2829
};
2930
}
3031

src/app/shared/models/institutions/institution-json-api.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ interface InstitutionAttributesJsonApi {
2323
institutional_request_access_enabled: boolean;
2424
logo_path: string;
2525
link_to_external_reports_archive: string;
26+
sso_availability: string;
2627
}
2728

2829
interface InstitutionLinksJsonApi {

src/app/shared/models/institutions/institutions.models.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export interface Institution {
1616
logoPath: string;
1717
userMetricsUrl?: string;
1818
linkToExternalReportsArchive?: string;
19+
sso_availability: string;
1920
}
2021

2122
export interface InstitutionAssets {

src/app/shared/services/institutions.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ export class InstitutionsService {
3535
[ResourceType.DraftRegistration, 'draft_registrations'],
3636
]);
3737

38-
getInstitutions(searchValue?: string): Observable<InstitutionsWithTotalCount> {
38+
getInstitutions(searchValue?: string, searchKey = 'name'): Observable<InstitutionsWithTotalCount> {
3939
const params: Record<string, unknown> = {};
4040

4141
if (searchValue && searchValue.trim()) {
42-
params['filter[name]'] = searchValue.trim();
42+
params[`filter[${searchKey}]`] = searchValue.trim();
4343
}
4444

4545
return this.jsonApiService

src/app/shared/stores/institutions/institutions.actions.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ export class FetchUserInstitutions {
88
export class FetchInstitutions {
99
static readonly type = '[Institutions] Fetch Institutions';
1010

11-
constructor(public searchValue?: string) {}
11+
constructor(
12+
public searchValue?: string,
13+
public searchKey?: string
14+
) {}
1215
}
1316

1417
export class FetchResourceInstitutions {

src/app/shared/stores/institutions/institutions.state.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export class InstitutionsState {
5454
},
5555
});
5656

57-
return this.institutionsService.getInstitutions(action.searchValue).pipe(
57+
return this.institutionsService.getInstitutions(action.searchValue, action.searchKey).pipe(
5858
tap((response) => {
5959
ctx.setState(
6060
patch({

0 commit comments

Comments
 (0)