Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h2 class="mb-2">{{ 'shared.license.title' | translate }}</h2>
<p class="mb-1">{{ 'shared.license.description' | translate }}</p>
<p>
{{ 'shared.license.helpText' | translate }}
<a href="https://help.osf.io/article/148-licensing">{{ 'common.links.helpGuide' | translate }}</a
<a href="https://help.osf.io/article/148-licensing" target="_blank">{{ 'common.links.helpGuide' | translate }}</a
>.
</p>
<osf-license
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export class ProjectOverviewMapper {
currentUserIsContributorOrGroupMember: response.attributes.current_user_is_contributor_or_group_member,
wikiEnabled: response.attributes.wiki_enabled,
customCitation: response.attributes.custom_citation,
subjects: response.attributes.subjects?.map((subjectArray) => subjectArray[0]),
contributors:
response.embeds.bibliographic_contributors?.data?.map((contributor) => ({
id: contributor.embeds.users.data.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export interface ProjectOverview {
currentUserIsContributor: boolean;
currentUserIsContributorOrGroupMember: boolean;
wikiEnabled: boolean;
subjects: ProjectOverviewSubject[];
contributors: ProjectOverviewContributor[];
customCitation: string | null;
region?: IdTypeModel;
Expand All @@ -66,11 +65,6 @@ export interface ProjectOverview {
rootParentId?: string;
}

export interface ProjectOverviewSubject {
id: string;
text: string;
}

export interface ProjectOverviewWithMeta {
project: ProjectOverview;
meta?: MetaAnonymousJsonApi;
Expand Down Expand Up @@ -104,7 +98,6 @@ export interface ProjectOverviewGetResponseJsonApi {
current_user_is_contributor: boolean;
current_user_is_contributor_or_group_member: boolean;
wiki_enabled: boolean;
subjects: ProjectOverviewSubject[][];
custom_citation: string | null;
};
embeds: {
Expand Down
15 changes: 13 additions & 2 deletions src/app/features/project/overview/project-overview.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ import {
ClearWiki,
CollectionsSelectors,
CurrentResourceSelectors,
FetchSelectedSubjects,
GetBookmarksCollectionId,
GetCollectionProvider,
GetConfiguredStorageAddons,
GetHomeWiki,
GetLinkedResources,
GetResourceWithChildren,
SubjectsSelectors,
} from '@osf/shared/stores';
import { GetActivityLogs } from '@osf/shared/stores/activity-logs';
import {
Expand Down Expand Up @@ -119,6 +121,8 @@ export class ProjectOverviewComponent extends DataciteTrackerComponent implement
isReviewActionsLoading = select(CollectionsModerationSelectors.getCurrentReviewActionLoading);
components = select(CurrentResourceSelectors.getResourceWithChildren);
areComponentsLoading = select(CurrentResourceSelectors.isResourceWithChildrenLoading);
subjects = select(SubjectsSelectors.getSelectedSubjects);
areSubjectsLoading = select(SubjectsSelectors.areSelectedSubjectsLoading);

readonly activityPageSize = 5;
readonly activityDefaultPage = 1;
Expand All @@ -141,6 +145,7 @@ export class ProjectOverviewComponent extends DataciteTrackerComponent implement
getComponentsTree: GetResourceWithChildren,
getRootFolders: GetRootFolders,
getConfiguredStorageAddons: GetConfiguredStorageAddons,
getSubjects: FetchSelectedSubjects,
});

currentProject = select(ProjectOverviewSelectors.getProject);
Expand Down Expand Up @@ -178,14 +183,19 @@ export class ProjectOverviewComponent extends DataciteTrackerComponent implement

resourceOverview = computed(() => {
const project = this.currentProject();
const subjects = this.subjects();
if (project) {
return MapProjectOverview(project, this.isAnonymous());
return MapProjectOverview(project, subjects, this.isAnonymous());
}
return null;
});

isLoading = computed(
() => this.isProjectLoading() || this.isCollectionProviderLoading() || this.isReviewActionsLoading()
() =>
this.isProjectLoading() ||
this.isCollectionProviderLoading() ||
this.isReviewActionsLoading() ||
this.areSubjectsLoading()
);

currentResource = computed(() => {
Expand Down Expand Up @@ -221,6 +231,7 @@ export class ProjectOverviewComponent extends DataciteTrackerComponent implement
if (currentProject) {
const rootParentId = currentProject.rootParentId ?? currentProject.id;
this.actions.getComponentsTree(rootParentId, currentProject.id, ResourceType.Project);
this.actions.getSubjects(currentProject.id, ResourceType.Project);
}
});
}
Expand Down
1 change: 1 addition & 0 deletions src/app/features/project/project.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const projectRoutes: Routes = [
CollectionsState,
CollectionsModerationState,
ActivityLogsState,
SubjectsState,
]),
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ <h2 class="mb-2">{{ 'shared.license.title' | translate }}</h2>
<p class="mb-1">{{ 'shared.license.description' | translate }}</p>
<p>
{{ 'shared.license.helpText' | translate }}
<a href="https://help.osf.io/article/148-licensing">{{ 'common.links.helpGuide' | translate }}</a
<a href="https://help.osf.io/article/148-licensing" target="_blank">{{ 'common.links.helpGuide' | translate }}</a
>.
</p>
<osf-license
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions src/app/features/registry/models/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export * from './bibliographic-contributors.models';
export * from './get-registry-overview-json-api.model';
export * from './get-resource-subjects-json-api.model';
export * from './linked-nodes.models';
export * from './linked-nodes-json-api.model';
export * from './linked-registrations-json-api.model';
Expand All @@ -10,5 +9,4 @@ export * from './registry-components-json-api.model';
export * from './registry-contributor-json-api.model';
export * from './registry-metadata.models';
export * from './registry-overview.models';
export * from './registry-subject.model';
export * from './resources';
5 changes: 3 additions & 2 deletions src/app/features/registry/models/registry-overview.models.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { ProjectOverviewContributor } from '@osf/features/project/overview/models';
import { RegistrationQuestions, RegistrySubject } from '@osf/features/registry/models';
import { RegistrationQuestions } from '@osf/features/registry/models';
import {
IdTypeModel,
LicenseModel,
LicensesOption,
MetaAnonymousJsonApi,
ProviderModel,
SchemaResponse,
SubjectModel,
} from '@osf/shared/models';
import { RegistrationReviewStates, RegistryStatus, RevisionReviewStates } from '@shared/enums';

Expand Down Expand Up @@ -45,7 +46,7 @@ export interface RegistryOverview {
currentUserIsContributorOrGroupMember: boolean;
wikiEnabled: boolean;
region?: IdTypeModel;
subjects?: RegistrySubject[];
subjects?: SubjectModel[];
customCitation: string;
hasData: boolean;
hasAnalyticCode: boolean;
Expand Down
4 changes: 0 additions & 4 deletions src/app/features/registry/models/registry-subject.model.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@if (!isRegistryLoading() && !isSubjectsLoading() && !isInstitutionsLoading() && !isSchemaBlocksLoading()) {
@if (!isLoading()) {
<div
class="flex flex-column justify-content-center flex-wrap md:flex-row md:justify-content-between md:align-items-center"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { hasViewOnlyParam, toCamelCase } from '@osf/shared/helpers';
import { MapRegistryOverview } from '@osf/shared/mappers';
import { SchemaResponse, ToolbarResource } from '@osf/shared/models';
import { ToastService } from '@osf/shared/services';
import { GetBookmarksCollectionId } from '@osf/shared/stores';
import { FetchSelectedSubjects, GetBookmarksCollectionId, SubjectsSelectors } from '@osf/shared/stores';
import { ViewOnlyLinkMessageComponent } from '@shared/components/view-only-link-message/view-only-link-message.component';

import { ArchivingMessageComponent, RegistryRevisionsComponent, RegistryStatusesComponent } from '../../components';
Expand All @@ -36,7 +36,6 @@ import {
GetRegistryById,
GetRegistryInstitutions,
GetRegistryReviewActions,
GetRegistrySubjects,
RegistryOverviewSelectors,
SetRegistryCustomCitation,
} from '../../store/registry-overview';
Expand Down Expand Up @@ -76,8 +75,8 @@ export class RegistryOverviewComponent {
readonly registry = select(RegistryOverviewSelectors.getRegistry);
readonly isRegistryLoading = select(RegistryOverviewSelectors.isRegistryLoading);
readonly isAnonymous = select(RegistryOverviewSelectors.isRegistryAnonymous);
readonly subjects = select(RegistryOverviewSelectors.getSubjects);
readonly isSubjectsLoading = select(RegistryOverviewSelectors.isSubjectsLoading);
readonly subjects = select(SubjectsSelectors.getSelectedSubjects);
readonly areSubjectsLoading = select(SubjectsSelectors.areSelectedSubjectsLoading);
readonly institutions = select(RegistryOverviewSelectors.getInstitutions);
readonly isInstitutionsLoading = select(RegistryOverviewSelectors.isInstitutionsLoading);
readonly schemaBlocks = select(RegistryOverviewSelectors.getSchemaBlocks);
Expand All @@ -87,6 +86,15 @@ export class RegistryOverviewComponent {
readonly isSchemaResponseLoading = select(RegistriesSelectors.getSchemaResponseLoading);
revisionInProgress: SchemaResponse | undefined;

isLoading = computed(
() =>
this.isRegistryLoading() ||
this.isInstitutionsLoading() ||
this.isSchemaBlocksLoading() ||
this.isSchemaResponseLoading() ||
this.areSubjectsLoading()
);

readonly schemaResponse = computed(() => {
const registry = this.registry();
const index = this.selectedRevisionIndex();
Expand Down Expand Up @@ -141,7 +149,7 @@ export class RegistryOverviewComponent {
private readonly actions = createDispatchMap({
getRegistryById: GetRegistryById,
getBookmarksId: GetBookmarksCollectionId,
getSubjects: GetRegistrySubjects,
getSubjects: FetchSelectedSubjects,
getInstitutions: GetRegistryInstitutions,
setCustomCitation: SetRegistryCustomCitation,
getRegistryReviewActions: GetRegistryReviewActions,
Expand Down Expand Up @@ -179,7 +187,7 @@ export class RegistryOverviewComponent {
return !this.registry()?.withdrawn;
}),
tap(() => {
this.actions.getSubjects(id);
this.actions.getSubjects(id, ResourceType.Registration);
this.actions.getInstitutions(id);
})
)
Expand All @@ -201,7 +209,6 @@ export class RegistryOverviewComponent {
}

navigateToFile(fileId: string): void {
// [NM] TODO: add logic to handle fileId
this.router.navigate(['/files', fileId]);
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/features/registry/registry.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const registryRoutes: Routes = [
loadComponent: () =>
import('./pages/registry-overview/registry-overview.component').then((c) => c.RegistryOverviewComponent),
providers: [
provideStates([RegistriesState, CitationsState]),
provideStates([RegistriesState, SubjectsState, CitationsState]),
ProvidersHandlers,
ProjectsHandlers,
LicensesHandlers,
Expand Down
13 changes: 0 additions & 13 deletions src/app/features/registry/services/registry-overview.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ import { ReviewAction, ReviewActionsResponseJsonApi } from '@osf/features/modera
import { MapRegistryOverview } from '@osf/features/registry/mappers';
import {
GetRegistryOverviewJsonApi,
GetResourceSubjectsJsonApi,
RegistryOverview,
RegistryOverviewJsonApiData,
RegistryOverviewWithMeta,
RegistrySubject,
} from '@osf/features/registry/models';
import { InstitutionsMapper, ReviewActionsMapper } from '@osf/shared/mappers';
import { PageSchemaMapper } from '@osf/shared/mappers/registration';
Expand Down Expand Up @@ -48,17 +46,6 @@ export class RegistryOverviewService {
.pipe(map((response) => ({ registry: MapRegistryOverview(response.data), meta: response.meta })));
}

getSubjects(registryId: string): Observable<RegistrySubject[]> {
const params = {
'page[size]': 100,
page: 1,
};

return this.jsonApiService
.get<GetResourceSubjectsJsonApi>(`${this.apiUrl}/registrations/${registryId}/subjects/`, params)
.pipe(map((response) => response.data.map((subject) => ({ id: subject.id, text: subject.attributes.text }))));
}

getInstitutions(registryId: string): Observable<Institution[]> {
const params = {
'page[size]': 100,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ export class GetRegistryById {
) {}
}

export class GetRegistrySubjects {
static readonly type = '[Registry Overview] Get Registry Subjects';

constructor(public registryId: string) {}
}

export class GetRegistryInstitutions {
static readonly type = '[Registry Overview] Get Registry Institutions';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { ReviewAction } from '@osf/features/moderation/models';
import { RegistryOverview, RegistrySubject } from '@osf/features/registry/models';
import { RegistryOverview } from '@osf/features/registry/models';
import { Institution, PageSchema } from '@osf/shared/models';
import { AsyncStateModel } from '@shared/models';

export interface RegistryOverviewStateModel {
registry: AsyncStateModel<RegistryOverview | null>;
subjects: AsyncStateModel<RegistrySubject[] | null>;
institutions: AsyncStateModel<Institution[] | null>;
schemaBlocks: AsyncStateModel<PageSchema[] | null>;
moderationActions: AsyncStateModel<ReviewAction[]>;
Expand All @@ -18,11 +17,6 @@ export const REGISTRY_OVERVIEW_DEFAULTS: RegistryOverviewStateModel = {
isLoading: false,
error: null,
},
subjects: {
data: [],
isLoading: false,
error: null,
},
institutions: {
data: [],
isLoading: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Selector } from '@ngxs/store';

import { ReviewAction } from '@osf/features/moderation/models';
import { RegistryOverview, RegistrySubject } from '@osf/features/registry/models';
import { RegistryOverview } from '@osf/features/registry/models';
import { Institution, PageSchema } from '@osf/shared/models';

import { RegistryOverviewStateModel } from './registry-overview.model';
Expand All @@ -23,16 +23,6 @@ export class RegistryOverviewSelectors {
return state.isAnonymous;
}

@Selector([RegistryOverviewState])
static getSubjects(state: RegistryOverviewStateModel): RegistrySubject[] | null {
return state.subjects.data;
}

@Selector([RegistryOverviewState])
static isSubjectsLoading(state: RegistryOverviewStateModel): boolean {
return state.subjects.isLoading;
}

@Selector([RegistryOverviewState])
static getInstitutions(state: RegistryOverviewStateModel): Institution[] | null {
return state.institutions.data;
Expand Down
Loading
Loading