Adds all recent activity

This commit is contained in:
apapachristou 2020-07-02 19:34:27 +03:00
parent 626b499ecc
commit 52662f33f4
14 changed files with 314 additions and 285 deletions

View File

@ -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;
}

View File

@ -10,6 +10,4 @@ export class RecentDmpModel extends RecentActivityModel {
associatedProfiles: DmpAssociatedProfileModel[];
organisations: String;
groupId: string;
users: UserInfoListingModel[];
isPublic: boolean;
}

View File

@ -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<RecentActivityCriteria>): Observable<DataTableData<RecentActivityModel>> {
return this.http.post<DataTableData<RecentActivityModel>>(this.actionUrl + 'paged', dataTableRequest);
}
getStatistics(): Observable<DashboardStatisticsModel> {
return this.http.get<DashboardStatisticsModel>(this.actionUrl + 'getStatistics', { headers: this.headers });
}
@ -27,7 +33,7 @@ export class DashboardService {
return this.http.get<DashboardStatisticsModel>(this.actionUrl + 'me/getStatistics', { headers: this.headers });
}
getRecentAcitvity(criteria: RecentActivityCriteria): Observable<RecentActivityModel[]> {
return this.http.post<RecentActivityModel[]>(this.actionUrl + 'recentActivity', criteria, {headers: this.headers});
}
// getRecentAcitvity(criteria: RecentActivityCriteria): Observable<RecentActivityModel[]> {
// return this.http.post<RecentActivityModel[]>(this.actionUrl + 'recentActivity', criteria, {headers: this.headers});
// }
}

View File

@ -5,21 +5,21 @@
&& dashboardStatisticsData?.totalGrantCount === 0
&& dashboardStatisticsData?.totalOrganisationCount === 0">
<div class="main-content">
<div class="col-md-8">
<div class="col-auto">
<div class="card" [style.display]="isVisible ? 'block' : 'none'">
<!-- <a class="col-auto d-flex" (click)="closeCard()"><span class="ml-auto pt-3 material-icons clear-icon">clear</span></a> -->
<p class="card-title mb-0">{{'DASHBOARD.DMP-QUESTION' | translate}}</p>
<p class="card-title mb-0 pt-3">{{'DASHBOARD.DMP-QUESTION' | translate}}</p>
<p class="card-content mb-0">{{'DASHBOARD.INFO-DMP-TEXT' | translate}}</p>
<p class="card-content pt-3 mb-0">
{{'DASHBOARD.NEW-QUESTION' | translate}} <a><u>{{'DASHBOARD.OPEN-AIR-GUIDE' | translate}}</u></a> {{'DASHBOARD.LEARN-MORE' | translate}}
</p>
<div class="d-flex">
<button type="button" class="col-auto align-self-center normal-btn">Start your first DMP</button>
<img class="col-auto ml-auto" src="../../assets/img/laptop.png" width="116" height="139">
<img class="col-auto ml-auto" src="../../../assets/splash/assets/img/laptop.png" width="116" height="139">
</div>
</div>
</div>
<div class="col-md-4">
<div class="col pt-4 mt-3 pl-4">
<div class="personal-usage">{{'DASHBOARD.PERSONAL-USAGE' | translate}}</div>
<div class="counter-zero">0</div>
<a href="#" class="link">{{'DASHBOARD.DMPS' | translate}}</a>
@ -36,10 +36,9 @@
|| dashboardStatisticsData?.totalDataSetCount !== 0
|| dashboardStatisticsData?.totalGrantCount !== 0
|| dashboardStatisticsData?.totalOrganisationCount !== 0">
<div class="main-content">
<div class="col">
<div class="card" [style.display]="isVisible ? 'block' : 'none'">
<div class="card mt-0" [style.display]="isVisible ? 'block' : 'none'">
<a class="col-auto d-flex" (click)="closeCard()"><span class="ml-auto pt-3 material-icons clear-icon">clear</span></a>
<p class="card-content mb-0 pt-0">
{{'DASHBOARD.DMP-ABOUT-BEG' | translate}}
@ -51,9 +50,9 @@
</div>
<div class="latest-activity-title">Latest activity</div>
<mat-tab-group mat-align-tabs="start" class="remove-border-bottom">
<mat-tab label="All">
<mat-tab label="All ({{this.totalRecents}})">
<div class="col-auto pt-3"><input type="text" class="d-flex ml-auto" placeholder="&nbsp;&nbsp;&#xf002;&nbsp;&nbsp;Search"></div>
<app-recent-edited-activity></app-recent-edited-activity>
<app-recent-edited-activity (totalCountRecentEdited)="onCountAllRecent($event)"></app-recent-edited-activity>
</mat-tab>
<mat-tab label="{{'DASHBOARD.DRAFTS' | translate}} ({{this.totalDraftDatasets}})">
<div class="col-auto pt-3"><input type="text" class="d-flex ml-auto" placeholder="&nbsp;&nbsp;&#xf002;&nbsp;&nbsp;Search"></div>
@ -69,7 +68,7 @@
</mat-tab>
</mat-tab-group>
</div>
<div class="col-auto">
<div class="col-auto stats">
<div class="personal-usage">{{'DASHBOARD.PERSONAL-USAGE' | translate}}</div>
<div [ngClass]="{'counter': dashboardStatisticsData?.totalDataManagementPlanCount != 0, 'counter-zero': dashboardStatisticsData?.totalDataManagementPlanCount == 0}">
{{dashboardStatisticsData?.totalDataManagementPlanCount}}</div>

View File

@ -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;

View File

@ -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']);
// }

View File

@ -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);
}
}

View File

@ -1,107 +1,140 @@
<div *ngIf="dmpActivities != null">
<div *ngFor="let activity of dmpActivities">
<!-- if dmp -->
<div class="dmp-card">
<div [routerLink]="['../plans/overview/' + activity.id]" class="pointer">
<div class="d-flex flex-direction-row">
<div class="col-auto dmp-label">{{ 'DMP-LISTING.DMP' | translate }}</div>
<div class="col-auto ml-auto edited-date">{{ 'DMP-LISTING.EDITED' | translate }}: {{ activity.modifiedTime | date: "longDate" }}</div>
<div *ngIf="allRecentActivities != null">
<div *ngFor="let activity of allRecentActivities">
<div *ngIf="activity && activity.type === recentActivityTypeEnum.Dmp">
<div class="dmp-card">
<div [routerLink]="['../plans/overview/' + activity.id]" class="pointer">
<div class="d-flex flex-direction-row">
<div class="col-auto dmp-label">{{ 'DMP-LISTING.DMP' | translate }}</div>
<div class="col-auto ml-auto edited-date">{{ 'DMP-LISTING.EDITED' | translate }}: {{ activity.modified | date: "longDate" }}</div>
</div>
<div class="col-auto" [ngClass]="{'dmp-title': !isDraft, 'dmp-title-draft': isDraft}">{{activity.title}}</div>
<div class="dmp-subtitle">
<span class="col-auto">{{ roleDisplay(activity.users) }}</span>
<span>.</span>
<span class="col-auto" *ngIf="activity.status === 1 && activity.public === true"><span class="material-icons icon-align">public</span>{{'TYPES.DMP-VISIBILITY.PUBLIC' | translate}}</span>
<span *ngIf="activity.status === 1 && activity.public === false" class="col-auto"><span class="material-icons icon-align">done</span>{{ enumUtils.toDmpStatusString(activity.status) }}</span>
<span *ngIf="activity.status === 0" class=" col-auto draft"><span class="material-icons icon-align">create</span>{{ enumUtils.toDmpStatusString(activity.status) }}</span>
<span>.</span>
<span class="col-auto">{{'DMP-LISTING.VERSION' | translate}} {{activity.version}}</span>
<span>.</span>
<span class="col">{{ 'DMP-LISTING.GRANT' | translate }}: {{activity.grant}}</span>
</div>
<div class="col-auto dmp-dataset-descriptions-title">{{'DMP-LISTING.CONTAINED-DATASETS' | translate}}: ({{ getDatasets(activity).length }})
</div>
<div *ngFor="let dataset of getDatasets(activity); let i = index; let last = last" [ngClass]="{'pb-3': i === activity.datasets.length - 1}">
<div *ngIf="i < 3">
<div class="col-auto dmp-dataset-descriptions-name" *ngIf="!last && i !== 2">{{dataset.title}},</div>
<div class="col-auto dmp-dataset-descriptions-name" *ngIf="last || i == 2">{{dataset.title}}</div>
</div>
</div>
<a class="d-flex justify-content-center pb-3 show-more" *ngIf="getDatasets(activity).length > 3" [routerLink]="['../plans/overview/' + activity.id]"><u>{{'GENERAL.ACTIONS.SHOW-MORE' | translate}}</u></a>
</div>
<div class="col-auto" [ngClass]="{'dmp-title': !isDraft, 'dmp-title-draft': isDraft}">{{activity.label}}</div>
<div class="dmp-subtitle">
<span class="col-auto">{{ roleDisplay(activity.users) }}</span>
<span>.</span>
<span class="col-auto" *ngIf="activity.status === 1 && activity.public === true"><span class="material-icons icon-align">public</span>{{'TYPES.DMP-VISIBILITY.PUBLIC' | translate}}</span>
<span *ngIf="activity.status === 1 && activity.public === false" class="col-auto"><span class="material-icons icon-align">done</span>{{ enumUtils.toDmpStatusString(activity.status) }}</span>
<span *ngIf="activity.status === 0" class=" col-auto draft"><span class="material-icons icon-align">create</span>{{ enumUtils.toDmpStatusString(activity.status) }}</span>
<span>.</span>
<span class="col-auto">{{'DMP-LISTING.VERSION' | translate}} {{activity.version}}</span>
<span>.</span>
<span class="col">{{ 'DMP-LISTING.GRANT' | translate }}: {{activity.grant}}</span>
<div class="dmp-card-actions">
<a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DMP-LISTING.ACTIONS.EXPORT' | translate}}</a>
<a class="col-auto border-right pointer" (click)="addDataset(activity.id)"><span class="material-icons icon-align">add</span>{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" (click)="openShareDialog(activity.id, activity.title)"><span class="material-icons icon-align pr-2">group_add</span>{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" (click)="cloneClicked(activity)"><span class="material-icons icon-align pr-2">filter_none</span>{{'DMP-LISTING.ACTIONS.CLONE' | translate}}</a>
<a class="col-auto pointer" [matMenuTriggerFor]="actionsMenu"><span class="material-icons icon-align pl-2">more_horiz</span></a>
</div>
<div class="col-auto dmp-dataset-descriptions-title">{{'DMP-LISTING.CONTAINED-DATASETS' | translate}}: ({{activity.datasets.length}})
</div>
<div *ngFor="let dataset of activity.datasets; let i = index; let last = last" [ngClass]="{'pb-3': i === activity.datasets.length - 1}">
<div *ngIf="i < 3">
<div class="col-auto dmp-dataset-descriptions-name" *ngIf="!last">{{dataset.label}},</div>
<div class="col-auto dmp-dataset-descriptions-name" *ngIf="last">{{dataset.label}}</div>
<mat-menu #exportMenu="matMenu" xPosition="before">
<button mat-menu-item (click)="downloadPDF(activity.id)">
<i class="fa fa-file-pdf-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.PDF' | translate}}</span>
</button>
<button mat-menu-item (click)="downloadDocx(activity.id)">
<i class="fa fa-file-word-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.DOC' | translate}}</span>
</button>
<button mat-menu-item (click)="downloadXml(activity.id)">
<i class="fa fa-file-code-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.XML' | translate}}</span>
</button>
<button mat-menu-item (click)="downloadJson(activity.id)">
<i class="fa fa-file-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.JSON' | translate}}</span>
</button>
</mat-menu>
<mat-menu #actionsMenu="matMenu" xPosition="before">
<button *ngIf="isUserOwner(activity)" mat-menu-item (click)="newVersion(activity.id, activity.title)">
<mat-icon>queue</mat-icon>{{'DMP-LISTING.ACTIONS.NEW-VERSION' | translate}}
</button>
<button mat-menu-item (click)="viewVersions(getGroupId(activity), activity.title)">
<mat-icon>library_books</mat-icon>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}}
</button>
<button mat-menu-item *ngIf="isDraftDmp(activity) && isUserOwner(activity)" (click)="deleteClicked()" class="menu-item">
<mat-icon>delete</mat-icon>{{ 'DMP-LISTING.ACTIONS.DELETE' | translate }}
</button>
</mat-menu>
</div>
</div>
<div *ngIf="activity && activity.type === recentActivityTypeEnum.Dataset">
<div class="dataset-card">
<div>
<!-- <div [routerLink]="['../datasets/overview/' + activity.id]"> -->
<div class="d-flex flex-direction-row">
<div class="col-auto dataset-label">{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}</div>
<div class="col-auto ml-auto edited-date">{{'DATASET-LISTING.STATES.EDITED' | translate}}: {{activity.modified | date:"longDate"}}</div>
</div>
<div class="col-auto dataset-title">{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}: {{activity.title}}</div>
<div class="dataset-subtitle">
<span class="col-auto">{{ roleDisplay(activity.users) }}</span>
<span>.</span>
<span class="col-auto" *ngIf="activity.status === 1 && activity.public === true"><span class="material-icons icon-align">public</span>{{'DATASET-LISTING.STATES.PUBLIC' | translate}}</span>
<span *ngIf="activity.status === 1 && activity.public === false" class="col-auto"><span class="material-icons icon-align">done</span>{{ enumUtils.toDmpStatusString(activity.status) }}</span>
<span *ngIf="activity.status === 0" class=" col-auto draft"><span class="material-icons icon-align">create</span>{{ enumUtils.toDmpStatusString(activity.status) }}</span>
<span>.</span>
<span class="col">{{'DATASET-LISTING.COLUMNS.GRANT' | translate}}: {{activity.grant}}</span>
</div>
<div class="d-flex flex-direction-row pt-3 pb-3">
<div class="col-auto dataset-subtitle">{{'DATASET-LISTING.TOOLTIP.PART-OF' | translate}}
<div class="col-auto dmp-label ml-4">{{'DATASET-LISTING.TOOLTIP.DMP' | translate}}</div>
</div>
<!-- <div class="col-auto dmp-label">{{'DATASET-LISTING.TOOLTIP.DMP' | translate}}</div> -->
<div class="col dmp-title">{{'DATASET-LISTING.TOOLTIP.DMP-FOR' | translate}}: {{ getDmp(activity) }}</div>
</div>
</div>
<a class="d-flex justify-content-center pb-3 show-more" *ngIf="activity.datasets.length > 3" [routerLink]="['../plans/overview/' + activity.id]"><u>{{'GENERAL.ACTIONS.SHOW-MORE' | translate}}</u></a>
</div>
<div class="dmp-card-actions">
<a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DMP-LISTING.ACTIONS.EXPORT' | translate}}</a>
<a class="col-auto border-right pointer" (click)="addDataset(activity.id)"><span class="material-icons icon-align">add</span>{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" (click)="openShareDialog(activity.id, activity.label)"><span class="material-icons icon-align pr-2">group_add</span>{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" (click)="cloneClicked(activity)"><span class="material-icons icon-align pr-2">filter_none</span>{{'DMP-LISTING.ACTIONS.CLONE' | translate}}</a>
<a class="col-auto pointer" [matMenuTriggerFor]="actionsMenu"><span class="material-icons icon-align pl-2">more_horiz</span></a>
</div>
<div class="dataset-card-actions">
<a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DATASET-LISTING.ACTIONS.EXPORT' | translate}}</a>
<a class="col-auto border-right pointer" (click)="openShareDialog(getDmpId(activity), getDmp(activity))"><span class="material-icons icon-align pr-2">group_add</span>{{'DATASET-LISTING.ACTIONS.INVITE-COLLABORATORS' | translate}}</a>
<a class="col-auto pointer" [matMenuTriggerFor]="actionsMenu"><span class="material-icons icon-align pl-2">more_horiz</span></a>
<!-- <a class="col-auto" [matMenuTriggerFor]="actionsMenu" *ngIf="!publicMode"><span class="material-icons icon-align pl-2">more_horiz</span></a> -->
</div>
<mat-menu #actionsMenu="matMenu">
<button mat-menu-item (click)="openDmpSearchDialogue(activity)" class="menu-item">
<mat-icon>file_copy</mat-icon>{{'DATASET-WIZARD.ACTIONS.COPY-DATASET' | translate}}
</button>
<button mat-menu-item (click)="openConfirm(activity.id)" class="menu-item">
<mat-icon>delete</mat-icon>{{ 'DATASET-WIZARD.ACTIONS.DELETE' | translate }}
</button>
<!-- <button mat-menu-item *ngIf="needsUpdate(activity)" class="menu-item" (click)="openUpdateDatasetProfileDialogue(activity.id);">
<mat-icon>update</mat-icon>
{{ 'DATASET-WIZARD.ACTIONS.UPDATE-DATASET-PROFILE' | translate }}
</button> -->
</mat-menu>
<mat-menu #exportMenu="matMenu" xPosition="before">
<button mat-menu-item (click)="downloadPDF(activity.id)">
<i class="fa fa-file-pdf-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.PDF' | translate}}</span>
</button>
<button mat-menu-item (click)="downloadDocx(activity.id)">
<i class="fa fa-file-word-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.DOC' | translate}}</span>
</button>
<button mat-menu-item (click)="downloadXml(activity.id)">
<i class="fa fa-file-code-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.XML' | translate}}</span>
</button>
<button mat-menu-item (click)="downloadJson(activity.id)">
<i class="fa fa-file-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.JSON' | translate}}</span>
</button>
</mat-menu>
<mat-menu #actionsMenu="matMenu" xPosition="before">
<button *ngIf="isUserOwner(activity)" mat-menu-item (click)="newVersion(activity.id, activity.label)">
<mat-icon>queue</mat-icon>{{'DMP-LISTING.ACTIONS.NEW-VERSION' | translate}}
</button>
<button mat-menu-item (click)="viewVersions(activity.groupId, activity.label)">
<mat-icon>library_books</mat-icon>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}}
</button>
<button mat-menu-item *ngIf="isDraftDmp(activity) && isUserOwner(activity)" (click)="deleteClicked()" class="menu-item">
<mat-icon>delete</mat-icon>{{ 'DMP-LISTING.ACTIONS.DELETE' | translate }}
</button>
</mat-menu>
<mat-menu #exportMenu="matMenu" xPosition="before">
<button mat-menu-item (click)="downloadPDF(activity)">
<i class="fa fa-file-pdf-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.PDF' | translate}}</span>
</button>
<button mat-menu-item (click)="downloadDOCX(activity)">
<i class="fa fa-file-word-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.DOC' | translate}}</span>
</button>
<button mat-menu-item (click)="downloadXML(activity)">
<i class="fa fa-file-code-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.XML' | translate}}</span>
</button>
</mat-menu>
</div>
</div>
</div>
<div class="d-flex justify-content-center">
<button type="button" class="btn-load-more">{{'GENERAL.ACTIONS.LOAD-MORE' | translate}}</button>
<button type="button" class="btn-load-more" (click)="loadMore()">{{'GENERAL.ACTIONS.LOAD-MORE' | translate}}</button>
</div>
</div>
<!-- if dataset -->
<!-- <div *ngIf="true" class="dataset-card">
<div class="d-flex flex-direction-row">
<div class="col-auto dataset-label">Dataset Description</div>
<div class="col-auto ml-auto edited-date">Edited: 9 May 2020</div>
</div>
<div class="col-auto dataset-title">Dataset description: Horizon 2020 for Grant DMP of
Dataset description</div>
<div class="dataset-subtitle">
<span class="col-auto">Owner</span>
<span>.</span>
<span class="col-auto"><span class="material-icons icon-align">done</span>Finalized</span>
<span>.</span>
<span class="col-auto">Grant: NEANIAS Project</span>
</div>
<div class="d-flex flex-direction-row pt-3 pb-3">
<div class="col-auto dataset-subtitle">Part of</div>
<div class="col-auto dmp-label">DMP</div>
<div class="col-auto dmp-title">DMP for: Horizon 2020 for Grant DMP of the NEANIAS
DMP plan</div>
</div>
<div class="dataset-card-actions">
<a href="#" class="col-auto border-right"><span class="material-icons icon-align pr-2">open_in_new</span>Export</a>
<a href="#" class="col-auto border-right"><span class="material-icons icon-align pr-2">group_add</span>Invite
collaborators</a>
<a href="#" class="col-auto"><span class="material-icons icon-align pl-2">more_horiz</span></a>
</div>
</div> -->
<!-- Old version of dashboard -->
<!-- <div class="card">

View File

@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, Output, EventEmitter } from '@angular/core';
import { MatDialog } from '@angular/material';
import { Router } from '@angular/router';
import { RecentActivityType } from '@app/core/common/enum/recent-activity-type';
@ -20,6 +20,15 @@ import { DmpStatus } from '@app/core/common/enum/dmp-status';
import { DatasetService } from '@app/core/services/dataset/dataset.service';
import { DatasetListingModel } from '@app/core/model/dataset/dataset-listing';
import { Role } from '@app/core/common/enum/role';
import { RecentActivityModel } from '@app/core/model/recent-activity/recent-activity.model';
import { DashboardService } from '@app/core/services/dashboard/dashboard.service';
import { RecentActivityCriteria } from '@app/core/query/recent-activity/recent-activity-criteria';
import { RecentDmpModel } from '@app/core/model/recent-activity/recent-dmp-activity.model';
import { RecentDatasetModel } from '@app/core/model/recent-activity/recent-dataset-activity.model';
import { UserInfoListingModel } from '@app/core/model/user/user-info-listing';
import { DatasetWizardService } from '@app/core/services/dataset-wizard/dataset-wizard.service';
import { FormControl } from '@angular/forms';
import { DatasetCopyDialogueComponent } from '@app/ui/dataset/dataset-wizard/dataset-copy-dialogue/dataset-copy-dialogue.component';
@Component({
selector: 'app-recent-edited-activity',
@ -27,21 +36,26 @@ import { Role } from '@app/core/common/enum/role';
styleUrls: ['./recent-edited-activity.component.css']
})
export class RecentEditedActivityComponent extends BaseComponent implements OnInit {
dmpActivities: DmpListingModel[];
datasetActivities: DatasetListingModel[];
// allRecentActivities: RecentActivity[] = [];
@Output() totalCountRecentEdited: EventEmitter<any> = new EventEmitter();
allRecentActivities:RecentActivityModel[];
recentActivityTypeEnum = RecentActivityType;
isDraft: boolean;
totalCount: number;
startIndex: number = 4;
pageSize: number = 5;
constructor(
private router: Router,
public enumUtils: EnumUtils,
private authentication: AuthService,
private dmpService: DmpService,
private datasetService: DatasetService,
private dashboardService: DashboardService,
private language: TranslateService,
private dialog: MatDialog,
private uiNotificationService: UiNotificationService
private uiNotificationService: UiNotificationService,
private datasetWizardService: DatasetWizardService
) {
super();
}
@ -49,40 +63,42 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
ngOnInit() {
if (this.isAuthenticated()) {
const fields: Array<string> = ["-modified"];
const dmpDataTableRequest: DataTableRequest<DmpCriteria> = new DataTableRequest(0, 5, { fields: fields });
dmpDataTableRequest.criteria = new DmpCriteria();
dmpDataTableRequest.criteria.like = "";
this.dmpService
.getPaged(dmpDataTableRequest, "listing")
const allDataTableRequest: DataTableRequest<RecentActivityCriteria> = new DataTableRequest(0, 5, { fields: fields });
allDataTableRequest.criteria = new RecentActivityCriteria();
allDataTableRequest.criteria.like = "";
this.dashboardService
.getPaged(allDataTableRequest)
.subscribe(response => {
this.dmpActivities = response.data;
// this.dmpActivities.forEach(dmpActivity => {
// const recentActivity: RecentActivity = {
// activityData: dmpActivity,
// activityType: RecentActivityType.Dmp
// };
// this.allRecentActivities.push(recentActivity)
// })
this.allRecentActivities = response.data;
this.totalCountRecentEdited.emit(this.pageSize);
});
// const datasetDataTableRequest: DataTableRequest<DatasetCriteria> = new DataTableRequest(0, 5, { fields: fields });
// datasetDataTableRequest.criteria = new DatasetCriteria();
// datasetDataTableRequest.criteria.like = "";
// this.datasetService
// .getPaged(datasetDataTableRequest)
// .subscribe(response => {
// this.datasetActivities = response.data;
// this.datasetActivities.forEach(datasetActivity => {
// const recentActivity: RecentActivity = {
// activityData: datasetActivity,
// activityType: RecentActivityType.Dataset
// };
// this.allRecentActivities.push(recentActivity)
// })
// });
}
}
getDatasets(activity: RecentDmpModel): RecentDatasetModel[] {
return activity.datasets;
}
getGroupId(activity: RecentDmpModel): string {
return activity.groupId;
}
getDmp(activity: RecentDatasetModel): String {
return activity.dmp;
}
getDmpId(activity: RecentDatasetModel): String {
return activity.dmpId;
}
// getPublic(activity: RecentDmpModel): boolean {
// return activity.isPublic;
// }
// getUsers(activity: RecentDmpModel): UserInfoListingModel[] {
// return activity.users;
// }
public isAuthenticated(): boolean {
return !!this.authentication.current();
}
@ -278,6 +294,91 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
}
}
openDmpSearchDialogue(dataset: RecentDatasetModel) {
const formControl = new FormControl();
const dialogRef = this.dialog.open(DatasetCopyDialogueComponent, {
width: '500px',
restoreFocus: false,
data: {
formControl: formControl,
datasetId: dataset.id,
datasetProfileId: dataset.profile,
datasetProfileExist: false,
confirmButton: this.language.instant('DATASET-WIZARD.DIALOGUE.COPY'),
cancelButton: this.language.instant('DATASET-WIZARD.DIALOGUE.CANCEL')
}
});
dialogRef.afterClosed().pipe(takeUntil(this._destroyed))
.subscribe(result => {
if (result && result.datasetProfileExist) {
const newDmpId = result.formControl.value.id
this.router.navigate(['/datasets/copy/' + result.datasetId], { queryParams: { newDmpId: newDmpId } });
}
});
}
openConfirm(id: string): void {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '300px',
restoreFocus: false,
data: {
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-ITEM'),
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.DELETE'),
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
isDeleteConfirmation: true
}
});
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
if (result) {
this.datasetWizardService.delete(id)
.pipe(takeUntil(this._destroyed))
.subscribe(
complete => this.onCallbackSuccess(),
// error => this.onCallbackError(error)
);
}
});
}
downloadDOCX(dataset: RecentDatasetModel): void {
this.datasetWizardService.downloadDOCX(dataset.id as string)
.pipe(takeUntil(this._destroyed))
.subscribe(response => {
const blob = new Blob([response.body], { type: 'application/msword' });
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
FileSaver.saveAs(blob, filename);
});
}
downloadXML(dataset: RecentDatasetModel): void {
this.datasetWizardService.downloadXML(dataset.id as string)
.pipe(takeUntil(this._destroyed))
.subscribe(response => {
const blob = new Blob([response.body], { type: 'application/xml' });
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
FileSaver.saveAs(blob, filename);
});
}
public loadMore() {
const fields: Array<string> = ["-modified"];
const request = new DataTableRequest<RecentActivityCriteria>(this.startIndex, this.pageSize, { fields: fields });
request.criteria = new RecentActivityCriteria();
request.criteria.like = "";
this.dashboardService.getPaged(request).pipe(takeUntil(this._destroyed)).subscribe(result => {
if (!result) { return []; }
this.allRecentActivities = this.allRecentActivities.concat(result.data);
});
this.startIndex = this.startIndex + this.pageSize;
this.totalCountRecentEdited.emit(this.startIndex + 1);
}
// advancedClicked(dmp: DmpListingModel) {
// const dialogRef = this.dialog.open(ExportMethodDialogComponent, {
// maxWidth: '500px',

View File

@ -61,7 +61,8 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
.subscribe(response => {
this.datasetActivities = response.data;
this.totalCount = response.totalCount;
this.totalCountDatasets.emit(this.totalCount);
this.totalCountDatasets.emit(this.pageSize);
// this.totalCountDatasets.emit(this.totalCount);
});
}
}
@ -78,6 +79,8 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
this.datasetActivities = this.datasetActivities.concat(result.data);
});
this.startIndex = this.startIndex + this.pageSize;
this.totalCountDatasets.emit(this.startIndex + 1);
}
public isAuthenticated(): boolean {

View File

@ -1,6 +1,5 @@
<div *ngIf="dmpActivities != null">
<div *ngFor="let activity of dmpActivities">
<!-- if dmp -->
<div class="dmp-card">
<div [routerLink]="['../plans/overview/' + activity.id]" class="pointer">
<div class="d-flex flex-direction-row">
@ -19,12 +18,12 @@
<span>.</span>
<span class="col">{{ 'DMP-LISTING.GRANT' | translate }}: {{activity.grant}}</span>
</div>
<div class="col-auto dmp-dataset-descriptions-title">{{'DMP-LISTING.CONTAINED-DATASETS' | translate}}: ({{activity.datasets.length}})
<div class="col-auto dmp-dataset-descriptions-title">{{'DMP-LISTING.CONTAINED-DATASETS' | translate}}: ({{ activity.datasets.length }})
</div>
<div *ngFor="let dataset of activity.datasets; let i = index; let last = last" [ngClass]="{'pb-3': i === activity.datasets.length - 1}">
<div *ngIf="i < 3">
<div class="col-auto dmp-dataset-descriptions-name" *ngIf="!last">{{dataset.label}},</div>
<div class="col-auto dmp-dataset-descriptions-name" *ngIf="last">{{dataset.label}}</div>
<div class="col-auto dmp-dataset-descriptions-name" *ngIf="!last && i !== 2">{{dataset.label}},</div>
<div class="col-auto dmp-dataset-descriptions-name" *ngIf="last || i == 2">{{dataset.label}}</div>
</div>
</div>
<a class="d-flex justify-content-center pb-3 show-more" *ngIf="activity.datasets.length > 3" [routerLink]="['../plans/overview/' + activity.id]"><u>{{'GENERAL.ACTIONS.SHOW-MORE' | translate}}</u></a>
@ -72,137 +71,3 @@
<button type="button" class="btn-load-more" (click)="loadMore()">{{'GENERAL.ACTIONS.LOAD-MORE' | translate}}</button>
</div>
</div>
<!-- if dataset -->
<!-- <div *ngIf="true" class="dataset-card">
<div class="d-flex flex-direction-row">
<div class="col-auto dataset-label">Dataset Description</div>
<div class="col-auto ml-auto edited-date">Edited: 9 May 2020</div>
</div>
<div class="col-auto dataset-title">Dataset description: Horizon 2020 for Grant DMP of
Dataset description</div>
<div class="dataset-subtitle">
<span class="col-auto">Owner</span>
<span>.</span>
<span class="col-auto"><span class="material-icons icon-align">done</span>Finalized</span>
<span>.</span>
<span class="col-auto">Grant: NEANIAS Project</span>
</div>
<div class="d-flex flex-direction-row pt-3 pb-3">
<div class="col-auto dataset-subtitle">Part of</div>
<div class="col-auto dmp-label">DMP</div>
<div class="col-auto dmp-title">DMP for: Horizon 2020 for Grant DMP of the NEANIAS
DMP plan</div>
</div>
<div class="dataset-card-actions">
<a href="#" class="col-auto border-right"><span class="material-icons icon-align pr-2">open_in_new</span>Export</a>
<a href="#" class="col-auto border-right"><span class="material-icons icon-align pr-2">group_add</span>Invite
collaborators</a>
<a href="#" class="col-auto"><span class="material-icons icon-align pl-2">more_horiz</span></a>
</div>
</div> -->
<!-- Old version of dashboard -->
<!-- <div class="card">
<div class="card-header card-header-plain">
<div class="card-desc">
<h4 class="card-title">
{{ 'RECENT-ACTIVITY.LAST-EDITED-DMP' | translate}}
</h4>
</div>
<a class="view-all" [class.clickable]="isAuthenticated()" [routerLink]="['/plans/']">
{{ 'GENERAL.ACTIONS.VIEW-ALL' | translate}}</a>
</div>
<div class="card-body table-responsive">
<table class="table table-hover">
<thead class="text-default">
<th>{{ 'DATASET-PROFILE-LISTING.COLUMNS.NAME' | translate}}</th>
<th>{{ 'DATASET-PROFILE-LISTING.COLUMNS.TEMPLATE' | translate }}</th>
<th>{{ 'DATASET-PROFILE-LISTING.COLUMNS.GRANT' | translate }}</th>
<th>{{ 'DATASET-PROFILE-LISTING.COLUMNS.ROLE' | translate }}</th>
<th>{{ 'DATASET-PROFILE-LISTING.COLUMNS.ORGANIZATION' | translate }}</th>
<th>{{ 'DATASET-PROFILE-LISTING.COLUMNS.STATUS' | translate }}</th>
<th>{{ 'DATASET-PROFILE-LISTING.COLUMNS.EDITED' | translate }}</th>
<th></th>
</thead>
<tbody *ngIf="dmpActivities != null">
<a *ngFor="let activity of dmpActivities" class="table-row" [routerLink]="['../plans/overview/' + activity.id]">
<td>{{ activity.label }}</td>
<td>
<div *ngIf="activity.profile" matTooltip="{{ activity.profile }}" class="template-name">
{{ activity.profile }}
</div>
<div *ngIf="!(activity.profile)" class="template-name">--</div>
</td>
<td>{{ activity.grant }}</td>
<td>{{ roleDisplay(activity.users)}}</td>
<td>{{ activity.organisations }}</td>
<td *ngIf="activity.status === 1 && activity.public === true">
<div class="is-public">
{{'TYPES.DMP-VISIBILITY.PUBLIC' | translate}}
</div>
</td>
<td *ngIf="activity.status === 1 && activity.public === false" class="text-center">
{{ enumUtils.toDmpStatusString(activity.status) }}
</td>
<td *ngIf="activity.status === 0" class="text-center">
{{ enumUtils.toDmpStatusString(activity.status) }}
</td>
<td>
{{ activity.modifiedTime | date: "shortDate" }}
</td>
<td>
<button mat-icon-button [matMenuTriggerFor]="actionsMenu" class="ml-auto more-icon" (click)="$event.preventDefault(); $event.stopPropagation();">
<mat-icon class="more-horiz">more_horiz</mat-icon>
</button>
<mat-menu #actionsMenu="matMenu">
<button mat-menu-item (click)="editClicked(activity)" class="menu-item">
<mat-icon>edit</mat-icon>{{ 'DMP-LISTING.ACTIONS.EDIT' | translate }}
</button>
<button mat-menu-item (click)="cloneClicked(activity)" class="menu-item">
<mat-icon>add</mat-icon>{{ 'DMP-LISTING.ACTIONS.CLONE' | translate }}
</button>
<button mat-menu-item (click)="deleteClicked(activity)" class="menu-item">
<mat-icon>delete</mat-icon>{{ 'DMP-LISTING.ACTIONS.DELETE' | translate }}
</button>
<button mat-menu-item [matMenuTriggerFor]="exportMethod" class="menu-item">
<mat-icon>save_alt</mat-icon>{{ 'DMP-LISTING.ACTIONS.EXP-AS' | translate }}
</button>
</mat-menu>
<mat-menu #exportMethod>
<button mat-menu-item (click)="downloadPDF(activity.id)">
<i class="fa fa-file-pdf-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.PDF' | translate}}</span>
</button>
<button mat-menu-item (click)="downloadDocx(activity.id)">
<i class="fa fa-file-word-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.DOC' | translate}}</span>
</button>
<button mat-menu-item (click)="downloadXml(activity.id)">
<i class="fa fa-file-code-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.XML' | translate}}</span>
</button>
<button mat-menu-item (click)="downloadJson(activity.id)">
<i class="fa fa-file-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.JSON' | translate}}</span>
</button>
</mat-menu>
</td>
</a>
</tbody>
<tbody *ngIf="dmpActivities == null">
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div> -->

View File

@ -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) {

View File

@ -41,3 +41,7 @@ mat-list-item {
display: flex !important;
height: auto !important;
}
::ng-deep .mat-list-item-content {
width: 100% !important;
}

View File

@ -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;