From 52662f33f44f368fdc88665be1ed461b150d70fd Mon Sep 17 00:00:00 2001 From: apapachristou Date: Thu, 2 Jul 2020 19:34:27 +0300 Subject: [PATCH] Adds all recent activity --- .../recent-activity/recent-activity.model.ts | 6 + .../recent-dmp-activity.model.ts | 2 - .../services/dashboard/dashboard.service.ts | 12 +- .../app/ui/dashboard/dashboard.component.html | 17 +- .../app/ui/dashboard/dashboard.component.scss | 6 +- .../app/ui/dashboard/dashboard.component.ts | 5 + .../ui/dashboard/drafts/drafts.component.ts | 4 +- .../recent-edited-activity.component.html | 219 ++++++++++-------- .../recent-edited-activity.component.ts | 171 +++++++++++--- ...ecent-edited-dataset-activity.component.ts | 5 +- .../recent-edited-dmp-activity.component.html | 141 +---------- .../recent-edited-dmp-activity.component.ts | 5 +- .../src/app/ui/sidebar/sidebar.component.scss | 4 + dmp-frontend/src/styles.scss | 2 +- 14 files changed, 314 insertions(+), 285 deletions(-) diff --git a/dmp-frontend/src/app/core/model/recent-activity/recent-activity.model.ts b/dmp-frontend/src/app/core/model/recent-activity/recent-activity.model.ts index b195e63b2..7bf5eecdb 100644 --- a/dmp-frontend/src/app/core/model/recent-activity/recent-activity.model.ts +++ b/dmp-frontend/src/app/core/model/recent-activity/recent-activity.model.ts @@ -1,3 +1,6 @@ +import { RecentActivityType } from '@app/core/common/enum/recent-activity-type'; +import { UserInfoListingModel } from '../user/user-info-listing'; + export class RecentActivityModel { id: String; title: String; @@ -12,5 +15,8 @@ export class RecentActivityModel { finalizedAt: Date; publishedAt: Date; profile: String; + type: RecentActivityType; + users: UserInfoListingModel[]; + public: boolean; } diff --git a/dmp-frontend/src/app/core/model/recent-activity/recent-dmp-activity.model.ts b/dmp-frontend/src/app/core/model/recent-activity/recent-dmp-activity.model.ts index 88045ace9..a1ab59124 100644 --- a/dmp-frontend/src/app/core/model/recent-activity/recent-dmp-activity.model.ts +++ b/dmp-frontend/src/app/core/model/recent-activity/recent-dmp-activity.model.ts @@ -10,6 +10,4 @@ export class RecentDmpModel extends RecentActivityModel { associatedProfiles: DmpAssociatedProfileModel[]; organisations: String; groupId: string; - users: UserInfoListingModel[]; - isPublic: boolean; } diff --git a/dmp-frontend/src/app/core/services/dashboard/dashboard.service.ts b/dmp-frontend/src/app/core/services/dashboard/dashboard.service.ts index a10a33131..c85881a86 100644 --- a/dmp-frontend/src/app/core/services/dashboard/dashboard.service.ts +++ b/dmp-frontend/src/app/core/services/dashboard/dashboard.service.ts @@ -7,6 +7,8 @@ import { BaseHttpService } from '../http/base-http.service'; import { ConfigurationService } from '../configuration/configuration.service'; import { RecentActivityModel } from '@app/core/model/recent-activity/recent-activity.model'; import { RecentActivityCriteria } from '@app/core/query/recent-activity/recent-activity-criteria'; +import { DataTableData } from '@app/core/model/data-table/data-table-data'; +import { DataTableRequest } from '@app/core/model/data-table/data-table-request'; @Injectable() export class DashboardService { @@ -19,6 +21,10 @@ export class DashboardService { this.actionUrl = configurationService.server + 'dashboard/'; } + getPaged(dataTableRequest: DataTableRequest): Observable> { + return this.http.post>(this.actionUrl + 'paged', dataTableRequest); + } + getStatistics(): Observable { return this.http.get(this.actionUrl + 'getStatistics', { headers: this.headers }); } @@ -27,7 +33,7 @@ export class DashboardService { return this.http.get(this.actionUrl + 'me/getStatistics', { headers: this.headers }); } - getRecentAcitvity(criteria: RecentActivityCriteria): Observable { - return this.http.post(this.actionUrl + 'recentActivity', criteria, {headers: this.headers}); - } + // getRecentAcitvity(criteria: RecentActivityCriteria): Observable { + // return this.http.post(this.actionUrl + 'recentActivity', criteria, {headers: this.headers}); + // } } diff --git a/dmp-frontend/src/app/ui/dashboard/dashboard.component.html b/dmp-frontend/src/app/ui/dashboard/dashboard.component.html index d50ae2413..55867cb5b 100644 --- a/dmp-frontend/src/app/ui/dashboard/dashboard.component.html +++ b/dmp-frontend/src/app/ui/dashboard/dashboard.component.html @@ -5,21 +5,21 @@ && dashboardStatisticsData?.totalGrantCount === 0 && dashboardStatisticsData?.totalOrganisationCount === 0">
-
+
-

{{'DASHBOARD.DMP-QUESTION' | translate}}

+

{{'DASHBOARD.DMP-QUESTION' | translate}}

{{'DASHBOARD.INFO-DMP-TEXT' | translate}}

{{'DASHBOARD.NEW-QUESTION' | translate}} {{'DASHBOARD.OPEN-AIR-GUIDE' | translate}} {{'DASHBOARD.LEARN-MORE' | translate}}

- +
-
+
{{'DASHBOARD.PERSONAL-USAGE' | translate}}
0
{{'DASHBOARD.DMPS' | translate}} @@ -36,10 +36,9 @@ || dashboardStatisticsData?.totalDataSetCount !== 0 || dashboardStatisticsData?.totalGrantCount !== 0 || dashboardStatisticsData?.totalOrganisationCount !== 0"> -
-
+
clear

{{'DASHBOARD.DMP-ABOUT-BEG' | translate}} @@ -51,9 +50,9 @@

Latest activity
- +
- +
@@ -69,7 +68,7 @@
-
+
{{'DASHBOARD.PERSONAL-USAGE' | translate}}
{{dashboardStatisticsData?.totalDataManagementPlanCount}}
diff --git a/dmp-frontend/src/app/ui/dashboard/dashboard.component.scss b/dmp-frontend/src/app/ui/dashboard/dashboard.component.scss index 914d21664..eb221e931 100644 --- a/dmp-frontend/src/app/ui/dashboard/dashboard.component.scss +++ b/dmp-frontend/src/app/ui/dashboard/dashboard.component.scss @@ -1,6 +1,6 @@ .main-content { background-color: #f5f5f5; - padding-top: 3.68rem; + padding-top: 4.68rem; padding-bottom: 3rem; // padding-left: 3.31rem; padding-left: 1rem; @@ -303,6 +303,10 @@ input[type="text"] { color: #f16868; } +.stats { + padding: 0rem 7em 4rem 3rem; +} + ::ng-deep .mat-tab-group.mat-primary .mat-ink-bar, .mat-tab-nav-bar.mat-primary .mat-ink-bar { background: #129d99; diff --git a/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts b/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts index 06a3f2939..f7e728b46 100644 --- a/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts @@ -56,6 +56,7 @@ export class DashboardComponent extends BaseComponent implements OnInit, IBreadC totalDatasets: number; totalDmps: number; totalDraftDatasets: number; + totalRecents: number; constructor( @@ -202,6 +203,10 @@ export class DashboardComponent extends BaseComponent implements OnInit, IBreadC this.totalDraftDatasets = event; } + onCountAllRecent(event): void { + this.totalRecents = event; + } + // viewAllPublicDmpsClicked() { // this.router.navigate(['/explore-plans']); // } diff --git a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts b/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts index 597925313..c15803bbe 100644 --- a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts @@ -62,7 +62,8 @@ export class DraftsComponent extends BaseComponent implements OnInit { this.datasetService.getPaged(dmpDataTableRequest).subscribe(response => { this.datasetDrafts = response.data; this.totalCount = response.totalCount; - this.totalCountDraftDatasets.emit(this.totalCount); + this.totalCountDraftDatasets.emit(this.pageSize); + // this.totalCountDraftDatasets.emit(this.totalCount); }); } @@ -247,5 +248,6 @@ export class DraftsComponent extends BaseComponent implements OnInit { this.datasetDrafts = this.datasetDrafts.concat(result.data); }); this.startIndex = this.startIndex + this.pageSize; + this.totalCountDraftDatasets.emit(this.startIndex + 1); } } diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.html b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.html index 0cf7f52f4..4975212cb 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.html +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.html @@ -1,107 +1,140 @@ -
-
- -
-
-
-
{{ 'DMP-LISTING.DMP' | translate }}
-
{{ 'DMP-LISTING.EDITED' | translate }}: {{ activity.modifiedTime | date: "longDate" }}
+
+
+
+
+
+
+
{{ 'DMP-LISTING.DMP' | translate }}
+
{{ 'DMP-LISTING.EDITED' | translate }}: {{ activity.modified | date: "longDate" }}
+
+
{{activity.title}}
+
+ {{ roleDisplay(activity.users) }} + . + public{{'TYPES.DMP-VISIBILITY.PUBLIC' | translate}} + done{{ enumUtils.toDmpStatusString(activity.status) }} + create{{ enumUtils.toDmpStatusString(activity.status) }} + . + {{'DMP-LISTING.VERSION' | translate}} {{activity.version}} + . + {{ 'DMP-LISTING.GRANT' | translate }}: {{activity.grant}} +
+
{{'DMP-LISTING.CONTAINED-DATASETS' | translate}}: ({{ getDatasets(activity).length }}) +
+
+
+
{{dataset.title}},
+
{{dataset.title}}
+
+
+ {{'GENERAL.ACTIONS.SHOW-MORE' | translate}}
-
{{activity.label}}
-
- {{ roleDisplay(activity.users) }} - . - public{{'TYPES.DMP-VISIBILITY.PUBLIC' | translate}} - done{{ enumUtils.toDmpStatusString(activity.status) }} - create{{ enumUtils.toDmpStatusString(activity.status) }} - . - {{'DMP-LISTING.VERSION' | translate}} {{activity.version}} - . - {{ 'DMP-LISTING.GRANT' | translate }}: {{activity.grant}} + -
{{'DMP-LISTING.CONTAINED-DATASETS' | translate}}: ({{activity.datasets.length}}) -
-
-
-
{{dataset.label}},
-
{{dataset.label}}
+ + + + + + + + + + + + +
+
+
+
+
+ +
+
{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}
+
{{'DATASET-LISTING.STATES.EDITED' | translate}}: {{activity.modified | date:"longDate"}}
+
+
{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}: {{activity.title}}
+
+ {{ roleDisplay(activity.users) }} + . + public{{'DATASET-LISTING.STATES.PUBLIC' | translate}} + done{{ enumUtils.toDmpStatusString(activity.status) }} + create{{ enumUtils.toDmpStatusString(activity.status) }} + . + {{'DATASET-LISTING.COLUMNS.GRANT' | translate}}: {{activity.grant}} +
+
+
{{'DATASET-LISTING.TOOLTIP.PART-OF' | translate}} +
{{'DATASET-LISTING.TOOLTIP.DMP' | translate}}
+
+ +
{{'DATASET-LISTING.TOOLTIP.DMP-FOR' | translate}}: {{ getDmp(activity) }}
- {{'GENERAL.ACTIONS.SHOW-MORE' | translate}} -
- + + + + + + - - - - - - - - - - - + + + + + +
- +
- - -
@@ -19,12 +18,12 @@ . {{ 'DMP-LISTING.GRANT' | translate }}: {{activity.grant}}
-
{{'DMP-LISTING.CONTAINED-DATASETS' | translate}}: ({{activity.datasets.length}}) +
{{'DMP-LISTING.CONTAINED-DATASETS' | translate}}: ({{ activity.datasets.length }})
-
{{dataset.label}},
-
{{dataset.label}}
+
{{dataset.label}},
+
{{dataset.label}}
{{'GENERAL.ACTIONS.SHOW-MORE' | translate}} @@ -72,137 +71,3 @@
- - - - - - - diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.ts b/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.ts index 7cc18c095..5d1299cac 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.ts @@ -64,7 +64,8 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O .subscribe(response => { this.dmpActivities = response.data; this.totalCount = response.totalCount; - this.totalCountDmps.emit(this.totalCount); + this.totalCountDmps.emit(this.pageSize); + // this.totalCountDmps.emit(this.totalCount); // this.dmpActivities.forEach(dmpActivity => { // const recentActivity: RecentActivity = { // activityData: dmpActivity, @@ -299,6 +300,8 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O this.dmpActivities = this.dmpActivities.concat(result.data); }); this.startIndex = this.startIndex + this.pageSize; + + this.totalCountDmps.emit(this.startIndex + 1); } // advancedClicked(dmp: DmpListingModel) { diff --git a/dmp-frontend/src/app/ui/sidebar/sidebar.component.scss b/dmp-frontend/src/app/ui/sidebar/sidebar.component.scss index 0e90859e5..cf2df085a 100644 --- a/dmp-frontend/src/app/ui/sidebar/sidebar.component.scss +++ b/dmp-frontend/src/app/ui/sidebar/sidebar.component.scss @@ -41,3 +41,7 @@ mat-list-item { display: flex !important; height: auto !important; } + +::ng-deep .mat-list-item-content { + width: 100% !important; +} diff --git a/dmp-frontend/src/styles.scss b/dmp-frontend/src/styles.scss index 6f8546081..ba53ff116 100644 --- a/dmp-frontend/src/styles.scss +++ b/dmp-frontend/src/styles.scss @@ -162,7 +162,7 @@ .main-content { background-color: #f5f5f5; - padding-top: 3.68rem; + padding-top: 4.68rem; padding-bottom: 3rem; // padding-left: 3.31rem; padding-left: 1rem;