Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

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
@@ -1,5 +1,5 @@
<div
class="p-3 flex flex-column gap-3 border-1 surface-border border-round-xl text-color"
class="p-3 flex flex-column gap-3 border-1 surface-border border-round-xl text-color m-4"
role="region"
aria-labelledby="recent-activity-title"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ export class RegistrationRecentActivityComponent implements OnDestroy {
private readonly registrationId: string = (this.route.snapshot.params['id'] ??
this.route.parent?.snapshot.params['id']) as string;

protected currentPage = signal<number>(1);
currentPage = signal<number>(1);

protected formattedActivityLogs = select(ActivityLogsSelectors.getFormattedActivityLogs);
protected totalCount = select(ActivityLogsSelectors.getActivityLogsTotalCount);
protected isLoading = select(ActivityLogsSelectors.getActivityLogsLoading);
formattedActivityLogs = select(ActivityLogsSelectors.getFormattedActivityLogs);
totalCount = select(ActivityLogsSelectors.getActivityLogsTotalCount);
isLoading = select(ActivityLogsSelectors.getActivityLogsLoading);

protected firstIndex = computed(() => (this.currentPage() - 1) * this.pageSize);
firstIndex = computed(() => (this.currentPage() - 1) * this.pageSize);

protected actions = createDispatchMap({
actions = createDispatchMap({
getRegistrationActivityLogs: GetRegistrationActivityLogs,
clearActivityLogsStore: ClearActivityLogsStore,
});
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 @@ -117,7 +117,7 @@ export const registryRoutes: Routes = [
{
path: 'recent-activity',
loadComponent: () =>
import('./pages/recent-activity/registration-recent-activity.component').then(
import('./pages/registration-recent-activity/registration-recent-activity.component').then(
(c) => c.RegistrationRecentActivityComponent
),
},
Expand Down
5 changes: 3 additions & 2 deletions src/app/shared/mappers/activity-logs.mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ import {
ActivityLogJsonApi,
JsonApiResponseWithMeta,
LogContributor,
LogContributorJsonApi,
MetaAnonymousJsonApi,
PaginatedData,
} from '@shared/models';
import { LogContributorJsonApi } from '@shared/models/activity-logs/activity-logs-json-api.model';
} from '../models';

export class ActivityLogsMapper {
static fromActivityLogJsonApi(log: ActivityLogJsonApi, isAnonymous?: boolean): ActivityLog {
const params = log.attributes.params ?? {};
const contributors = params.contributors ?? [];

return {
id: log.id,
type: log.type,
Expand Down
1 change: 1 addition & 0 deletions src/app/shared/mappers/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './activity-logs.mapper';
export * from './addon.mapper';
export * from './citations.mapper';
export * from './collections';
Expand Down
4 changes: 2 additions & 2 deletions src/app/shared/models/activity-logs/activity-logs.model.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { IdName } from '../common';
import { LicensesOption } from '../license.model';

export interface ActivityLog {
id: string;
type: string;
action: string;
date: string;

params: {
contributors: LogContributor[];
license?: string;
tag?: string;
institution?: { id: string; name: string };
institution?: IdName;
paramsNode: { id: string; title: string };
paramsProject: null;
pointer: Pointer | null;
Expand Down
12 changes: 7 additions & 5 deletions src/app/shared/services/activity-logs/activity-logs.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@ import { map } from 'rxjs/operators';

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

import { ActivityLogsMapper } from '@shared/mappers/activity-logs.mapper';
import { ActivityLogsMapper } from '@osf/shared/mappers';
import {
ActivityLog,
ActivityLogJsonApi,
ActivityLogWithDisplay,
JsonApiResponseWithMeta,
MetaAnonymousJsonApi,
PaginatedData,
} from '@shared/models';
import { ActivityLogWithDisplay } from '@shared/models/activity-logs/activity-log-with-display.model';
import { ActivityLogDisplayService } from '@shared/services';
import { JsonApiService } from '@shared/services/json-api.service';
} from '@osf/shared/models';

import { JsonApiService } from '../json-api.service';

import { ActivityLogDisplayService } from './activity-log-display.service';

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

Expand Down
11 changes: 2 additions & 9 deletions src/app/shared/stores/activity-logs/activity-logs.model.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import { ActivityLogWithDisplay } from '@shared/models/activity-logs/activity-log-with-display.model';

export interface ActivityLogsSlice<T> {
data: T;
isLoading: boolean;
error: unknown | null;
totalCount: number;
}
import { ActivityLogWithDisplay, AsyncStateWithTotalCount } from '@osf/shared/models';

export interface ActivityLogsStateModel {
activityLogs: ActivityLogsSlice<ActivityLogWithDisplay[]>;
activityLogs: AsyncStateWithTotalCount<ActivityLogWithDisplay[]>;
}

export const ACTIVITY_LOGS_STATE_DEFAULT: ActivityLogsStateModel = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Selector } from '@ngxs/store';

import { ActivityLog, ActivityLogWithDisplay } from '@shared/models/activity-logs';
import { ActivityLog, ActivityLogWithDisplay } from '@osf/shared/models';

import { ActivityLogsStateModel } from './activity-logs.model';
import { ActivityLogsState } from './activity-logs.state';
Expand Down
3 changes: 2 additions & 1 deletion src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@
"resources": "Resources",
"components": "Components",
"links": "Links",
"institutions": "Institutions"
"institutions": "Institutions",
"recentActivity": "Recent Activity"
},
"auth": {
"common": {
Expand Down
Loading