Skip to content
Merged
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 @@ -123,10 +123,12 @@
}
</a>
} @else {
@if (col.dateFormat) {
@if (col.dateFormat && rowData[col.field]) {
{{ getCellValue(rowData[col.field]) | date: col.dateFormat }}
} @else {
} @else if (!col.dateFormat && rowData[col.field]) {
{{ getCellValue(rowData[col.field]) }}
} @else {
{{ rowData[col.field] ?? '-' }}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TableColumn } from '@osf/features/admin-institutions/models';
import { TableColumn } from '../models';

export const userTableColumns: TableColumn[] = [
{
Expand All @@ -20,4 +20,24 @@ export const userTableColumns: TableColumn[] = [
{ field: 'publicRegistrationCount', header: 'adminInstitutions.summary.publicRegistrations', sortable: true },
{ field: 'embargoedRegistrationCount', header: 'adminInstitutions.summary.embargoedRegistrations', sortable: true },
{ field: 'publishedPreprintCount', header: 'adminInstitutions.institutionUsers.preprints', sortable: true },
{ field: 'publicFileCount', header: 'adminInstitutions.institutionUsers.filesOnOsf', sortable: true },
{ field: 'totalDataStored', header: 'adminInstitutions.institutionUsers.totalDataStored', sortable: true },
{
field: 'accountCreationDate',
header: 'adminInstitutions.institutionUsers.accountCreated',
sortable: true,
dateFormat: 'dd/MM/yyyy',
},
{
field: 'monthLasLogin',
header: 'adminInstitutions.institutionUsers.lastLogin',
sortable: true,
dateFormat: 'dd/MM/yyyy',
},
{
field: 'monthLastActive',
header: 'adminInstitutions.institutionUsers.lastActive',
sortable: true,
dateFormat: 'dd/MM/yyyy',
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,10 @@ export function mapUserToTableCellData(user: InstitutionUser): TableCellData {
publicRegistrationCount: user.publicRegistrationCount,
embargoedRegistrationCount: user.embargoedRegistrationCount,
publishedPreprintCount: user.publishedPreprintCount,
publicFileCount: user.publicFileCount,
totalDataStored: user.storageByteCount ? `${(user.storageByteCount / (1024 * 1024)).toFixed(1)} MB` : '0 B',
monthLasLogin: user.monthLasLogin,
monthLastActive: user.monthLastActive,
accountCreationDate: user.accountCreationDate,
};
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import {
InstitutionUser,
InstitutionUserDataJsonApi,
InstitutionUsersJsonApi,
} from '@osf/features/admin-institutions/models';
import { InstitutionUser, InstitutionUserDataJsonApi, InstitutionUsersJsonApi } from '../models';

export function mapInstitutionUsers(jsonApiData: InstitutionUsersJsonApi): InstitutionUser[] {
return jsonApiData.data.map((user: InstitutionUserDataJsonApi) => ({
Expand All @@ -16,5 +12,11 @@ export function mapInstitutionUsers(jsonApiData: InstitutionUsersJsonApi): Insti
publicRegistrationCount: user.attributes.public_registration_count,
embargoedRegistrationCount: user.attributes.embargoed_registration_count,
publishedPreprintCount: user.attributes.published_preprint_count,
monthLasLogin: user.attributes.month_last_login,
monthLastActive: user.attributes.month_last_active,
accountCreationDate: user.attributes.account_creation_date,
storageByteCount: user.attributes.storage_byte_count,
reportYearMonth: user.attributes.report_yearmonth,
publicFileCount: user.attributes.public_file_count,
}));
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,10 @@ export interface InstitutionUser {
publicRegistrationCount: number;
embargoedRegistrationCount: number;
publishedPreprintCount: number;
monthLasLogin: string;
monthLastActive: string;
accountCreationDate: string;
storageByteCount: number;
publicFileCount: number;
reportYearMonth: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ export interface InstitutionUserAttributesJsonApi {
public_registration_count: number;
embargoed_registration_count: number;
published_preprint_count: number;
account_creation_date: string;
contacts: unknown[];
month_last_active: string;
month_last_login: string;
public_file_count: number;
report_yearmonth: string;
storage_byte_count: number;
}

export interface InstitutionUserRelationshipDataJsonApi {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ export class InstitutionsSummaryComponent implements OnInit {
];

this.osfProjectsLabels = [
'resourceCard.labels.publicRegistrations',
'adminInstitutions.summary.publicRegistrations',
'adminInstitutions.summary.embargoedRegistrations',
'resourceCard.labels.publicProjects',
'adminInstitutions.summary.publicProjects',
'adminInstitutions.summary.privateProjects',
'common.search.tabs.preprints',
].map((el) => this.translateService.instant(el));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ export class InstitutionsUsersComponent {

currentUser = select(UserSelectors.getCurrentUser);

tableData = computed(() => {
return this.users().map((user: InstitutionUser): TableCellData => mapUserToTableCellData(user));
});
tableData = computed(() => this.users().map((user: InstitutionUser): TableCellData => mapUserToTableCellData(user)));

amountText = computed(() => {
const count = this.totalCount();
Expand Down
11 changes: 8 additions & 3 deletions src/app/shared/components/bar-chart/bar-chart.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ <h4>{{ title() | translate }}</h4>
<p-accordion-content>
<div class="content">
@for (label of labels(); let i = $index; track i) {
<li class="flex align-items-center mb-2 gap-2">
<div class="w-1rem h-1rem" [style.background-color]="getColor(i)"></div>
<span>{{ label }}</span>
<li class="flex align-items-center justify-content-between gap-3 mb-2">
<div class="flex align-items-center gap-2">
<div class="w-1rem h-1rem" [style.background-color]="getColor(i)"></div>
<span>{{ label }}</span>
</div>
@if (datasets().length) {
<span>{{ datasets()[0].data[i] }}</span>
}
</li>
}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ <h4>{{ title() | translate }}</h4>
<p-accordion-content>
<div class="content">
@for (label of labels(); let i = $index; track i) {
<li class="flex align-items-center mb-2 gap-2">
<div class="w-1rem h-1rem" [style.background-color]="getColor(i)"></div>
<span>{{ label }}</span>
<li class="flex align-items-center justify-content-between gap-3 mb-2">
<div class="flex align-items-center gap-2">
<div class="w-1rem h-1rem" [style.background-color]="getColor(i)"></div>
<span>{{ label }}</span>
</div>
@if (datasets().length) {
<span>{{ datasets()[0].data[i] }}</span>
}
</li>
}
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2708,8 +2708,8 @@
"totalStorageInGb": "Total Storage in GB",
"embargoedRegistrations": "Embargoed registrations",
"privateProjects": "Private projects",
"publicProjects": "Public Projects",
"publicRegistrations": "Public Registrations"
"publicProjects": "Public projects",
"publicRegistrations": "Public registrations"
},
"contact": {
"requestAccess": "Request Access",
Expand All @@ -2724,8 +2724,8 @@
"lastActive": "Last Active",
"accountCreated": "Account Created",
"preprints": "Preprints",
"publicFiles": "Public Files",
"storageBytes": "Storage (Bytes)",
"filesOnOsf": "Files on OSF",
"totalDataStored": "Total data stored on OSF",
"contacts": "Contacts",
"customize": "Customize",
"sendEmail": "Send Email",
Expand Down
Loading