Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ import { ScheduledBannerComponent } from '@core/components/osf-banners/scheduled
import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component';
import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component';
import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component';
import {
INSTITUTIONS_SSO_AVAILABILITY_KEY,
INSTITUTIONS_SSO_AVAILABILITY_VALUE,
} from '@osf/shared/constants/institutions-filters.const';
import { FetchInstitutions, InstitutionsSelectors } from '@osf/shared/stores/institutions';

@Component({
Expand Down Expand Up @@ -43,7 +47,7 @@ export class InstitutionsListComponent {
institutionsLoading = select(InstitutionsSelectors.isInstitutionsLoading);

constructor() {
this.actions.getInstitutions();
this.actions.getInstitutions(INSTITUTIONS_SSO_AVAILABILITY_VALUE, INSTITUTIONS_SSO_AVAILABILITY_KEY);
this.setupSearchSubscription();
}

Expand Down
2 changes: 2 additions & 0 deletions src/app/shared/constants/institutions-filters.const.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const INSTITUTIONS_SSO_AVAILABILITY_VALUE = '[Public,Unavailable]';
export const INSTITUTIONS_SSO_AVAILABILITY_KEY = 'sso_availability';
1 change: 1 addition & 0 deletions src/app/shared/mappers/institutions/institutions.mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export class InstitutionsMapper {
logoPath: data.attributes.logo_path,
userMetricsUrl: data.relationships?.user_metrics?.links?.related?.href,
linkToExternalReportsArchive: data.attributes.link_to_external_reports_archive,
sso_availability: data.attributes.sso_availability,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ interface InstitutionAttributesJsonApi {
institutional_request_access_enabled: boolean;
logo_path: string;
link_to_external_reports_archive: string;
sso_availability: string;
}

interface InstitutionLinksJsonApi {
Expand Down
1 change: 1 addition & 0 deletions src/app/shared/models/institutions/institutions.models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface Institution {
logoPath: string;
userMetricsUrl?: string;
linkToExternalReportsArchive?: string;
sso_availability: string;
}

export interface InstitutionAssets {
Expand Down
4 changes: 2 additions & 2 deletions src/app/shared/services/institutions.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ export class InstitutionsService {
[ResourceType.DraftRegistration, 'draft_registrations'],
]);

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

if (searchValue && searchValue.trim()) {
params['filter[name]'] = searchValue.trim();
params[`filter[${searchKey}]`] = searchValue.trim();
}

return this.jsonApiService
Expand Down
5 changes: 4 additions & 1 deletion src/app/shared/stores/institutions/institutions.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ export class FetchUserInstitutions {
export class FetchInstitutions {
static readonly type = '[Institutions] Fetch Institutions';

constructor(public searchValue?: string) {}
constructor(
public searchValue?: string,
public searchKey?: string
) {}
}

export class FetchResourceInstitutions {
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/stores/institutions/institutions.state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class InstitutionsState {
},
});

return this.institutionsService.getInstitutions(action.searchValue).pipe(
return this.institutionsService.getInstitutions(action.searchValue, action.searchKey).pipe(
tap((response) => {
ctx.setState(
patch({
Expand Down
Loading