From ee61bf4ffb7c44f3edd549707fc508f628baf986 Mon Sep 17 00:00:00 2001 From: gpapavgeri Date: Tue, 30 Jun 2020 18:33:01 +0300 Subject: [PATCH 1/4] dmp overview_re-design_update --- .../dmp/overview/dmp-overview.component.html | 156 +++++---- .../dmp/overview/dmp-overview.component.scss | 316 +++++++++++------- .../ui/dmp/overview/dmp-overview.component.ts | 8 +- dmp-frontend/src/assets/i18n/en.json | 4 + dmp-frontend/src/assets/i18n/es.json | 4 + dmp-frontend/src/assets/i18n/gr.json | 4 + 6 files changed, 300 insertions(+), 192 deletions(-) diff --git a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.html b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.html index f8a92266d..49b8df844 100644 --- a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.html +++ b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.html @@ -1,28 +1,44 @@
-
+
-
- chevron_left -

{{'DMP-WIZARD.ACTIONS.BACK' | translate}}

-
+ + chevron_left +

{{'DMP-WIZARD.ACTIONS.BACK' | translate}}

+
- - {{ 'DATASET-LISTING.COLUMNS.DMP' | translate }} - +

{{ dmp.label }}

-
+
-

+

{{ roleDisplayFromList(dmp.users) }}

-
Public: {{ dmp.isPublic}}
-
Locked: {{ dmp.status}}
-
{{'GENERAL.STATUSES.EDIT' | translate}} : - {{dmp.modifiedTime | date:"longDate"}}
+ {{dmp.modifiedTime | date:"longDate"}} +
+
+
+ check + {{'DATASET-LISTING.COLUMNS.FINALIZED' | translate}} +
+
-
{{'DMP-OVERVIEW.GRANT' | translate}}
+
{{'DMP-OVERVIEW.GRANT' | translate}}
{{ dmp.grant.label }}
-
{{'DMP-OVERVIEW.RESEARCHERS' | translate}}
+
{{'DMP-OVERVIEW.RESEARCHERS' | translate}}
 
-
{{ researcher.name }},
+
{{ researcher.name }}
-
{{'DATASET-LISTING.COLUMNS.DESCRIPTION' | translate}}
-
-

{{ dmp.grant.description }}

+
{{'DATASET-LISTING.COLUMNS.DESCRIPTION' | translate}}
+
+

{{ dmp.description }}

-
{{'DMP-OVERVIEW.DATASETS-USED' | translate}}
-
+
{{'DMP-OVERVIEW.DATASETS-USED' | translate}}
+
-
+
-
- -
- - - - +
- -
- -
+
- +
- -
- -
+ +
+ +
+
diff --git a/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts b/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts index 3db57fa5a..06a3f2939 100644 --- a/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts @@ -53,6 +53,11 @@ export class DashboardComponent extends BaseComponent implements OnInit, IBreadC dmpListingItems: DmpListingModel[] = []; datasetListingItems: DatasetListingModel[] = []; + totalDatasets: number; + totalDmps: number; + totalDraftDatasets: number; + + constructor( private router: Router, private route: ActivatedRoute, @@ -185,6 +190,18 @@ export class DashboardComponent extends BaseComponent implements OnInit, IBreadC this.isVisible = false; } + onCountDmps(event): void { + this.totalDmps = event; + } + + onCountDatasets(event): void { + this.totalDatasets = event; + } + + onCountDraftDatasets(event): void { + this.totalDraftDatasets = event; + } + // viewAllPublicDmpsClicked() { // this.router.navigate(['/explore-plans']); // } diff --git a/dmp-frontend/src/app/ui/dashboard/dashboard.module.ts b/dmp-frontend/src/app/ui/dashboard/dashboard.module.ts index 01b51d79d..0d5b845a2 100644 --- a/dmp-frontend/src/app/ui/dashboard/dashboard.module.ts +++ b/dmp-frontend/src/app/ui/dashboard/dashboard.module.ts @@ -15,8 +15,8 @@ import { WizardComponent } from '@app/ui/dashboard/wizard/wizard.component'; import { CommonUiModule } from '@common/ui/common-ui.module'; import { ConfirmationDialogModule } from '@common/modules/confirmation-dialog/confirmation-dialog.module'; import { RecentEditedDatasetActivityComponent } from './recent-edited-dataset-activity/recent-edited-dataset-activity.component'; -import { DatasetCopyDialogueComponent } from '../dataset/dataset-wizard/dataset-copy-dialogue/dataset-copy-dialogue.component'; import { DatasetCopyDialogModule } from '../dataset/dataset-wizard/dataset-copy-dialogue/dataset-copy-dialogue.module'; +import { RecentEditedDmpActivityComponent } from './recent-edited-dmp-activity/recent-edited-dmp-activity.component'; @NgModule({ imports: [ @@ -38,7 +38,8 @@ import { DatasetCopyDialogModule } from '../dataset/dataset-wizard/dataset-copy- DraftsComponent, DmpInfoCounterComponent, DatasetInfoCounterComponent, - RecentEditedDatasetActivityComponent + RecentEditedDatasetActivityComponent, + RecentEditedDmpActivityComponent ], entryComponents: [ QuickWizardCreateAdd diff --git a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.css b/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.css index fd3281a27..893d3700c 100644 --- a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.css +++ b/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.css @@ -1,4 +1,181 @@ -.grey { +.latest-activity-title { + text-align: left; + font-weight: 300; + font-family: "Roboto", sans-serif; + font-size: 1.25rem; + letter-spacing: 0px; + color: #212121; + opacity: 0.6; + padding-bottom: 1.2rem; +} + +.dmp-card, +.dataset-card { + min-width: 712px; + /* min-height: 308px; */ + background: #ffffff 0% 0% no-repeat padding-box; + box-shadow: 0px 3px 6px #0000001a; + border-radius: 4px; + opacity: 1; + margin-top: 2.43rem; + margin-bottom: 1rem; +} + +.remove-border-bottom ::ng-deep .mat-tab-header { + border-bottom: none; +} + +input[type="text"] { + background: #fafafa 0% 0% no-repeat padding-box; + border: 1px solid #d1d1d1; + border-radius: 4px; + opacity: 1; + width: 347px; + height: 56px; + font-family: Arial, FontAwesome; + padding-left: 15px; +} + +.edited-date { + text-align: left; + font-weight: 300; + font-family: "Roboto", sans-serif; + line-height: 2.4; + letter-spacing: 0px; + color: #212121; + opacity: 0.6; +} + +.dmp-label { + background: #129d99 0% 0% no-repeat padding-box; + border-radius: 4px 0px; + opacity: 1; + width: 67px; + height: 37px; + color: #ffffff; + line-height: 2.4; + opacity: 0.75; +} + +.dataset-label { + width: 158px; + height: 37px; + background: #f7dd72 0% 0% no-repeat padding-box; + border-radius: 4px 0px; + text-align: left; + line-height: 2.8; + font-size: 0.875rem; + letter-spacing: 0px; + color: #212121; + opacity: 0.75; +} + +.dmp-title, +.dataset-title { + text-align: left; + font-weight: 500; + font-family: "Roboto", sans-serif; + font-size: 1rem; + opacity: 0.81; + padding-top: 0.75rem; + padding-bottom: 0.55rem; + color: #212121; +} + +.dataset-subtitle, +.dmp-subtitle { + display: flex; + flex-direction: row; + text-align: left; + font-weight: 400; + font-family: "Roboto", sans-serif; + font-size: 0.875rem; + opacity: 1; + align-items: center; + color: #848484; +} + +.dmp-title-draft { + text-align: left; + font-weight: 500; + font-family: "Roboto", sans-serif; + font-size: 1rem; + opacity: 0.81; + padding-top: 0.75rem; + padding-bottom: 0.55rem; + color: #f16868; +} + +.icon-align { + display: inline-flex; + vertical-align: middle; + padding-bottom: 0.4rem; +} + +.dataset-card-actions, +.dmp-card-actions { + display: flex; + flex-direction: row; + border-top: 1px solid #dbdbdb; + line-height: 4; + color: #848484; +} + +.dataset-card-actions a, +.dmp-card-actions a { + color: #848484 !important; + text-decoration: none !important; +} + +.dataset-card-actions a:hover, +.dmp-card-actions a:hover { + color: #129d99 !important; +} + +.dmp-dataset-descriptions-title { + color: #000000; + opacity: 0.6; + padding-top: 1.5rem; + padding-bottom: 0.8rem; +} + +.dmp-dataset-descriptions-name { + color: #000000; + opacity: 0.6; + font-weight: 700; +} + +.show-more { + color: black !important; +} + +.show-more:hover { + color: #129d99 !important; +} + +.btn-load-more { + border: 2px solid #212121; + border-radius: 30px; + opacity: 1; + width: 132px; + height: 40px; + margin-top: 4.125rem; +} + +.btn-load-more:hover { + background-color: black; + color: white; +} + +.draft { + color: #f16868; +} + +.pointer { + cursor: pointer; +} + +/* .grey { color: rgb(162, 162, 162); } @@ -66,4 +243,4 @@ td:hover .draft-desc:after { .view-all:hover { color: rgb(46, 117, 182) !important; -} +} */ diff --git a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.html b/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.html index cca60626e..767a57fb7 100644 --- a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.html +++ b/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.html @@ -1,4 +1,69 @@ -
+
+
+
+ +
+
{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}
+
{{'DATASET-LISTING.STATES.EDITED' | translate}}: {{activity.modified | date:"longDate"}}
+
+
{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}: {{activity.label}}
+
+ {{ 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}}: {{activity.dmp}}
+
+
+ + + + + + + + + + + + +
+
+
+ +
+ +
{{'GENERAL.NAMES.DATASET' | translate}}: {{ dataset.label }} {{'DRAFTS.FOR-DMP' | translate}} {{ dataset.dmp }} {{'DRAFTS.FOR-GRANT' | translate}} {{ dataset.grant }}
@@ -35,4 +97,4 @@
-
+
--> 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 1d18f127a..0d3a63409 100644 --- a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, Input } from '@angular/core'; +import { Component, OnInit, Input, EventEmitter, Output } from '@angular/core'; import { DatasetService } from '../../../core/services/dataset/dataset.service'; import { DataTableRequest } from '../../../core/model/data-table/data-table-request'; import { DatasetCriteria } from '../../../core/query/dataset/dataset-criteria'; @@ -7,32 +7,61 @@ import { AuthService } from '../../../core/services/auth/auth.service'; import { RecentActivityType } from '../../../core/common/enum/recent-activity-type'; import { Router} from '@angular/router'; import { DmpStatus } from '../../../core/common/enum/dmp-status'; +import { Principal } from '@app/core/model/auth/principal'; +import { TranslateService } from '@ngx-translate/core'; +import { takeUntil } from 'rxjs/operators'; +import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component'; +import { DatasetCopyDialogueComponent } from '@app/ui/dataset/dataset-wizard/dataset-copy-dialogue/dataset-copy-dialogue.component'; +import { FormControl } from '@angular/forms'; +import { BaseComponent } from '@common/base/base.component'; +import { MatDialog } from '@angular/material'; +import { DatasetWizardService } from '@app/core/services/dataset-wizard/dataset-wizard.service'; +import { SnackBarNotificationLevel } from '@app/core/services/notification/ui-notification-service'; +import * as FileSaver from 'file-saver'; +import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; +import { UiNotificationService } from '@app/core/services/notification/ui-notification-service'; @Component({ selector: 'app-drafts', templateUrl: './drafts.component.html', styleUrls: ['./drafts.component.css'] }) -export class DraftsComponent implements OnInit { +export class DraftsComponent extends BaseComponent implements OnInit { + + @Input() routerLink: string; + @Output() totalCountDraftDatasets: EventEmitter = new EventEmitter(); + datasetDrafts: DatasetListingModel[]; datasetDraftsTypeEnum = RecentActivityType; - @Input() routerLink: string; status: number; + totalCount: number; + startIndex: number = 4; + pageSize: number = 5; + constructor( private router: Router, private datasetService: DatasetService, - private authentication: AuthService - ) { } + private authentication: AuthService, + private language: TranslateService, + public dialog: MatDialog, + private datasetWizardService: DatasetWizardService, + public enumUtils: EnumUtils, + private uiNotificationService: UiNotificationService + ) { + super(); + } ngOnInit() { const fields: Array = []; fields.push('-modified'); - const dmpDataTableRequest: DataTableRequest = new DataTableRequest(0, 2, { fields: fields }); + const dmpDataTableRequest: DataTableRequest = new DataTableRequest(0, 5, { fields: fields }); dmpDataTableRequest.criteria = new DatasetCriteria(); dmpDataTableRequest.criteria.status = DmpStatus.Draft; this.datasetService.getPaged(dmpDataTableRequest).subscribe(response => { this.datasetDrafts = response.data; + this.totalCount = response.totalCount; + this.totalCountDraftDatasets.emit(this.totalCount); }); } @@ -63,4 +92,147 @@ export class DraftsComponent implements OnInit { if (!this.isAuthenticated()) { return; } this.router.navigate(['/datasets'], { queryParams: { status: 0 } }); } + + roleDisplay(value: any) { + const principal: Principal = this.authentication.current(); + let role: number; + if (principal) { + value.forEach(element => { + if (principal.id === element.id) { + role = element.role; + } + }); + } + if (role === 0) { + return this.language.instant('DMP-LISTING.OWNER'); + } + else if (role === 1) { + return this.language.instant('DMP-LISTING.MEMBER'); + } + else { + return this.language.instant('DMP-LISTING.OWNER'); + } + } + + openDmpSearchDialogue(dataset: DatasetListingModel) { + 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) + ); + } + }); + } + + onCallbackSuccess(id?: String): void { + this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success); + id ? this.router.navigate(['/reload']).then(() => { this.router.navigate(['/datasets', 'edit', id]); }) : this.router.navigate(['/datasets']); + } + + onCallbackError(error: any) { + // this.setErrorModel(error.error); + } + + downloadPDF(dataset: DatasetListingModel): void { + this.datasetWizardService.downloadPDF(dataset.id as string) + .pipe(takeUntil(this._destroyed)) + .subscribe(response => { + const blob = new Blob([response.body], { type: 'application/pdf' }); + const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition')); + + FileSaver.saveAs(blob, filename); + }); + } + + downloadDOCX(dataset: DatasetListingModel): 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: DatasetListingModel): 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); + }); + } + + getFilenameFromContentDispositionHeader(header: string): string { + const regex: RegExp = new RegExp(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/g); + + const matches = header.match(regex); + let filename: string; + for (let i = 0; i < matches.length; i++) { + const match = matches[i]; + if (match.includes('filename="')) { + filename = match.substring(10, match.length - 1); + break; + } else if (match.includes('filename=')) { + filename = match.substring(9); + break; + } + } + return filename; + } + + public loadMore() { + const fields: Array = ["-modified"]; + const request = new DataTableRequest(this.startIndex, this.pageSize, { fields: fields }); + + request.criteria = new DatasetCriteria(); + request.criteria.like = ""; + + this.datasetService.getPaged(request).pipe(takeUntil(this._destroyed)).subscribe(result => { + if (!result) { return []; } + this.datasetDrafts = this.datasetDrafts.concat(result.data); + }); + this.startIndex = this.startIndex + this.pageSize; + } } 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 d46bd9a1d..0cf7f52f4 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 @@ -68,6 +68,9 @@
+
+ +
diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-dataset-activity/recent-edited-dataset-activity.component.html b/dmp-frontend/src/app/ui/dashboard/recent-edited-dataset-activity/recent-edited-dataset-activity.component.html index 93a39c637..3d057a645 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-dataset-activity/recent-edited-dataset-activity.component.html +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-dataset-activity/recent-edited-dataset-activity.component.html @@ -19,9 +19,11 @@ {{'DATASET-LISTING.COLUMNS.GRANT' | translate}}: {{activity.grant}}
-
{{'DATASET-LISTING.TOOLTIP.PART-OF' | translate}}
-
{{'DATASET-LISTING.TOOLTIP.DMP' | translate}}
-
{{'DATASET-LISTING.TOOLTIP.DMP-FOR' | translate}}: {{activity.dmp}}
+
{{'DATASET-LISTING.TOOLTIP.PART-OF' | translate}} +
{{'DATASET-LISTING.TOOLTIP.DMP' | translate}}
+
+ +
{{'DATASET-LISTING.TOOLTIP.DMP-FOR' | translate}}: {{activity.dmp}}
@@ -59,5 +61,8 @@
+
+ +
diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-dataset-activity/recent-edited-dataset-activity.component.ts b/dmp-frontend/src/app/ui/dashboard/recent-edited-dataset-activity/recent-edited-dataset-activity.component.ts index d46264e0f..769780f85 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-dataset-activity/recent-edited-dataset-activity.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-dataset-activity/recent-edited-dataset-activity.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, Output, EventEmitter } from '@angular/core'; import { DatasetListingModel } from '@app/core/model/dataset/dataset-listing'; import { DatasetService } from '@app/core/services/dataset/dataset.service'; import { DataTableRequest } from '@app/core/model/data-table/data-table-request'; @@ -28,7 +28,12 @@ import { DatasetStatus } from '@app/core/common/enum/dataset-status'; }) export class RecentEditedDatasetActivityComponent extends BaseComponent implements OnInit { + @Output() totalCountDatasets: EventEmitter = new EventEmitter(); + datasetActivities: DatasetListingModel[]; + totalCount: number; + startIndex: number = 4; + pageSize: number = 5; // publicMode = false; constructor( @@ -47,17 +52,33 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen ngOnInit() { if (this.isAuthenticated()) { const fields: Array = ["-modified"]; - const datasetDataTableRequest: DataTableRequest = new DataTableRequest(0, 5, { fields: fields }); + const datasetDataTableRequest: DataTableRequest = new DataTableRequest(0, this.pageSize, { fields: fields }); datasetDataTableRequest.criteria = new DatasetCriteria(); datasetDataTableRequest.criteria.like = ""; this.datasetService .getPaged(datasetDataTableRequest) .subscribe(response => { this.datasetActivities = response.data; + this.totalCount = response.totalCount; + this.totalCountDatasets.emit(this.totalCount); }); } } + public loadMore() { + const fields: Array = ["-modified"]; + const request = new DataTableRequest(this.startIndex, this.pageSize, { fields: fields }); + + request.criteria = new DatasetCriteria(); + request.criteria.like = ""; + + this.datasetService.getPaged(request).pipe(takeUntil(this._destroyed)).subscribe(result => { + if (!result) { return []; } + this.datasetActivities = this.datasetActivities.concat(result.data); + }); + this.startIndex = this.startIndex + this.pageSize; + } + public isAuthenticated(): boolean { return !!this.authentication.current(); } diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.css b/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.css new file mode 100644 index 000000000..c2ce5bb3c --- /dev/null +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.css @@ -0,0 +1,243 @@ +.latest-activity-title { + text-align: left; + font-weight: 300; + font-family: "Roboto", sans-serif; + font-size: 1.25rem; + letter-spacing: 0px; + color: #212121; + opacity: 0.6; + padding-bottom: 1.2rem; +} + +.dmp-card, +.dataset-card { + min-width: 712px; + /* min-height: 308px; */ + background: #ffffff 0% 0% no-repeat padding-box; + box-shadow: 0px 3px 6px #0000001a; + border-radius: 4px; + opacity: 1; + margin-top: 2.43rem; + margin-bottom: 1rem; +} + +.remove-border-bottom ::ng-deep .mat-tab-header { + border-bottom: none; +} + +input[type="text"] { + background: #fafafa 0% 0% no-repeat padding-box; + border: 1px solid #d1d1d1; + border-radius: 4px; + opacity: 1; + width: 347px; + height: 56px; + font-family: Arial, FontAwesome; + padding-left: 15px; +} + +.edited-date { + text-align: left; + font-weight: 300; + font-family: "Roboto", sans-serif; + line-height: 2.4; + letter-spacing: 0px; + color: #212121; + opacity: 0.6; +} + +.dmp-label { + background: #129d99 0% 0% no-repeat padding-box; + border-radius: 4px 0px; + opacity: 1; + width: 67px; + height: 37px; + color: #ffffff; + line-height: 2.4; + opacity: 0.75; +} + +.dataset-label { + width: 158px; + height: 37px; + background: #f7dd72 0% 0% no-repeat padding-box; + border-radius: 4px 0px; + text-align: left; + line-height: 2.8; + font-size: 0.875rem; + letter-spacing: 0px; + color: #212121; + opacity: 0.75; +} + +.dmp-title, +.dataset-title { + text-align: left; + font-weight: 500; + font-family: "Roboto", sans-serif; + font-size: 1rem; + opacity: 0.81; + padding-top: 0.75rem; + padding-bottom: 0.55rem; + color: #212121; +} + +.dataset-subtitle, +.dmp-subtitle { + display: flex; + flex-direction: row; + text-align: left; + font-weight: 400; + font-family: "Roboto", sans-serif; + font-size: 0.875rem; + opacity: 1; + align-items: center; + color: #848484; +} + +.dmp-title-draft { + text-align: left; + font-weight: 500; + font-family: "Roboto", sans-serif; + font-size: 1rem; + opacity: 0.81; + padding-top: 0.75rem; + padding-bottom: 0.55rem; + color: #f16868; +} + +.icon-align { + display: inline-flex; + vertical-align: middle; + padding-bottom: 0.4rem; +} + +.dataset-card-actions, +.dmp-card-actions { + display: flex; + flex-direction: row; + border-top: 1px solid #dbdbdb; + line-height: 4; + color: #848484; +} + +.dataset-card-actions a, +.dmp-card-actions a { + color: #848484 !important; + text-decoration: none !important; +} + +.dataset-card-actions a:hover, +.dmp-card-actions a:hover { + color: #129d99 !important; +} + +.dmp-dataset-descriptions-title { + color: #000000; + opacity: 0.6; + padding-top: 1.5rem; + padding-bottom: 0.8rem; +} + +.dmp-dataset-descriptions-name { + color: #000000; + opacity: 0.6; + font-weight: 700; +} + +.show-more { + color: black !important; +} + +.show-more:hover { + color: #129d99 !important; +} + +.btn-load-more { + border: 2px solid #212121; + border-radius: 30px; + opacity: 1; + width: 132px; + height: 40px; + margin-top: 4.125rem; +} + +.btn-load-more:hover { + background-color: black; + color: white; +} + +.draft { + color: #f16868; +} + +.pointer { + cursor: pointer; +} + +/* th { + text-transform: uppercase; +} + +a { + color: #212529; +} + +.table-row { + cursor: pointer; + display: table-row; +} + +.is-public { + padding-left: 5px; + padding-right: 5px; + border: 1px solid #00b29f3b; + color: #00b29f; + background-color: #00b29f0f; + border-radius: 10em; + text-align: center; +} + +.template-name { + padding-left: 0.5em; + border: 1px solid rgb(218, 227, 243); + color: rgb(43, 104, 209); + background-color: rgb(236, 241, 249); + border-radius: 10em; + text-align: center; + max-width: 160px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.chip { + padding: 0.1em 1em; + margin-bottom: 1em; + margin-left: 2.5em; + margin-right: 2.5em; + border-radius: 10em; + background-color: #0d7489; + color: #fff; + text-transform: uppercase; + text-align: center; + font-weight: 500; + max-width: 160px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.mat-icon-button :hover { + color: rgb(120, 173, 220); +} + +.view-all { + margin-left: auto; + margin-bottom: 0px !important; + color: #6aa4d9; +} + +.view-all:hover { + color: rgb(46, 117, 182) !important; +} */ diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.html b/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.html new file mode 100644 index 000000000..76973f33e --- /dev/null +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.html @@ -0,0 +1,208 @@ +
+
+ +
+
+
+
{{ 'DMP-LISTING.DMP' | translate }}
+
{{ 'DMP-LISTING.EDITED' | translate }}: {{ activity.modifiedTime | date: "longDate" }}
+
+
{{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}}
+
+
+ {{'GENERAL.ACTIONS.SHOW-MORE' | translate}} +
+ + + + + + + + + + + + + +
+
+
+ +
+
+ + + + + + + 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 new file mode 100644 index 000000000..7cc18c095 --- /dev/null +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.ts @@ -0,0 +1,328 @@ +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'; +import { Principal } from '@app/core/model/auth/principal'; +import { DataTableRequest } from '@app/core/model/data-table/data-table-request'; +import { DmpListingModel } from '@app/core/model/dmp/dmp-listing'; +import { DmpCriteria } from '@app/core/query/dmp/dmp-criteria'; +import { AuthService } from '@app/core/services/auth/auth.service'; +import { DmpService } from '@app/core/services/dmp/dmp.service'; +import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service'; +import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; +import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component'; +import { BaseComponent } from '@common/base/base.component'; +import { TranslateService } from '@ngx-translate/core'; +import * as FileSaver from 'file-saver'; +import { takeUntil } from 'rxjs/operators'; +import { DmpInvitationDialogComponent } from '@app/ui/dmp/invitation/dmp-invitation.component'; +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'; + +@Component({ + selector: 'app-recent-edited-dmp-activity', + templateUrl: './recent-edited-dmp-activity.component.html', + styleUrls: ['./recent-edited-dmp-activity.component.css'] +}) +export class RecentEditedDmpActivityComponent extends BaseComponent implements OnInit { + + @Output() totalCountDmps: EventEmitter = new EventEmitter(); + + dmpActivities: DmpListingModel[]; + datasetActivities: DatasetListingModel[]; + // allRecentActivities: RecentActivity[] = []; + 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 language: TranslateService, + private dialog: MatDialog, + private uiNotificationService: UiNotificationService + ) { + super(); + } + + ngOnInit() { + if (this.isAuthenticated()) { + const fields: Array = ["-modified"]; + const dmpDataTableRequest: DataTableRequest = new DataTableRequest(0, 5, { fields: fields }); + dmpDataTableRequest.criteria = new DmpCriteria(); + dmpDataTableRequest.criteria.like = ""; + this.dmpService + .getPaged(dmpDataTableRequest, "listing") + .subscribe(response => { + this.dmpActivities = response.data; + this.totalCount = response.totalCount; + this.totalCountDmps.emit(this.totalCount); + // this.dmpActivities.forEach(dmpActivity => { + // const recentActivity: RecentActivity = { + // activityData: dmpActivity, + // activityType: RecentActivityType.Dmp + // }; + // this.allRecentActivities.push(recentActivity) + // }) + }); + + // const datasetDataTableRequest: DataTableRequest = 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) + // }) + // }); + } + } + + public isAuthenticated(): boolean { + return !!this.authentication.current(); + } + + isUserOwner(activity: DmpListingModel): boolean { + const principal: Principal = this.authentication.current(); + if (principal) return principal.id === activity.users.find(x => x.role === Role.Owner).id; + } + + editClicked(dmp: DmpListingModel) { + this.router.navigate(['/plans/edit/' + dmp.id]); + } + + cloneClicked(dmp: DmpListingModel) { + this.router.navigate(['/plans/clone/' + dmp.id]); + } + + deleteClicked(dmp: DmpListingModel) { + 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.dmpService.delete(dmp.id) + .pipe(takeUntil(this._destroyed)) + .subscribe( + complete => { this.onCallbackSuccess() }, + error => this.onDeleteCallbackError(error) + ); + } + }); + } + + openShareDialog(rowId: any, rowName: any) { + const dialogRef = this.dialog.open(DmpInvitationDialogComponent, { + // height: '250px', + // width: '700px', + restoreFocus: false, + data: { + dmpId: rowId, + dmpName: rowName + } + }); + } + + isDraftDmp(activity: DmpListingModel) { + return activity.status == DmpStatus.Draft; + } + + onCallbackSuccess(): void { + this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success); + this.router.navigate(['/plans']); + } + + onDeleteCallbackError(error) { + this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DELETE'), SnackBarNotificationLevel.Error); + } + + redirect(id: string, type: RecentActivityType) { + switch (type) { + case RecentActivityType.Grant: { + this.router.navigate(["grants/edit/" + id]); + return; + } + case RecentActivityType.Dataset: { + this.router.navigate(["datasets/edit/" + id]); + return; + } + case RecentActivityType.Dmp: { + this.router.navigate(["plans/overview/" + id]); + return; + } + default: + throw new Error("Unsupported Activity Type "); + } + } + + // navigateToUrl() { + // this.router.navigate(["plans/"]); + // } + + roleDisplay(value: any) { + const principal: Principal = this.authentication.current(); + let role: number; + if (principal) { + value.forEach(element => { + if (principal.id === element.id) { + role = element.role; + } + }); + } + if (role === 0) { + return this.language.instant('DMP-LISTING.OWNER'); + } + else if (role === 1) { + return this.language.instant('DMP-LISTING.MEMBER'); + } + else { + return this.language.instant('DMP-LISTING.OWNER'); + } + } + + // dmpProfileDisplay(value: any) { + // if (value != null) { + // return value; + // } + // else { + // return "--"; + // } + // } + + downloadXml(id: string) { + this.dmpService.downloadXML(id) + .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); + }); + } + + downloadDocx(id: string) { + this.dmpService.downloadDocx(id) + .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); + }); + } + + downloadPDF(id: string) { + this.dmpService.downloadPDF(id) + .pipe(takeUntil(this._destroyed)) + .subscribe(response => { + const blob = new Blob([response.body], { type: 'application/pdf' }); + const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition')); + + FileSaver.saveAs(blob, filename); + }); + } + + downloadJson(id: string) { + this.dmpService.downloadJson(id) + .pipe(takeUntil(this._destroyed)) + .subscribe(response => { + const blob = new Blob([response.body], { type: 'application/json' }); + const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition')); + FileSaver.saveAs(blob, filename); + }) + } + + getFilenameFromContentDispositionHeader(header: string): string { + const regex: RegExp = new RegExp(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/g); + + const matches = header.match(regex); + let filename: string; + for (let i = 0; i < matches.length; i++) { + const match = matches[i]; + if (match.includes('filename="')) { + filename = match.substring(10, match.length - 1); + break; + } else if (match.includes('filename=')) { + filename = match.substring(9); + break; + } + } + return filename; + } + + addDataset(activityId: String) { + this.router.navigate(['/datasets/new/' + activityId]); + } + + newVersion(id: String, label: String) { + this.router.navigate(['/plans/new_version/' + id, { dmpLabel: label }]); + } + + viewVersions(rowId: String, rowLabel: String, activity: DmpListingModel) { + if (activity.public && !this.isUserOwner) { + this.router.navigate(['/explore-plans/versions/' + rowId], { queryParams: { groupLabel: rowLabel } }); + } else { + this.router.navigate(['/plans/versions/' + rowId], { queryParams: { groupLabel: rowLabel } }); + } + } + + public loadMore() { + const fields: Array = ["-modified"]; + const request = new DataTableRequest(this.startIndex, this.pageSize, { fields: fields }); + + request.criteria = new DmpCriteria(); + request.criteria.like = ""; + + this.dmpService.getPaged(request, "listing").pipe(takeUntil(this._destroyed)).subscribe(result => { + if (!result) { return []; } + this.dmpActivities = this.dmpActivities.concat(result.data); + }); + this.startIndex = this.startIndex + this.pageSize; + } + + // advancedClicked(dmp: DmpListingModel) { + // const dialogRef = this.dialog.open(ExportMethodDialogComponent, { + // maxWidth: '500px', + // data: { + // message: "Download as:", + // XMLButton: "XML", + // documentButton: "Document", + // pdfButton: "PDF", + // jsonButton: "JSON" + + // } + // }); + // dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { + // if (result == "pdf") { + // this.downloadPDF(dmp.id); + // } else if (result == "xml") { + // this.downloadXml(dmp.id); + // } else if (result == "doc") { + // this.downloadDocx(dmp.id); + // } else if (result == "json") { + // this.downloadJson(dmp.id) + // } + // }); + // } +} From 134313eb3e2ba44f9c9c29f342a18219ac80ed7b Mon Sep 17 00:00:00 2001 From: gpapavgeri Date: Wed, 1 Jul 2020 18:32:22 +0300 Subject: [PATCH 3/4] dmp-overview_update --- .../dmp/overview/dmp-overview.component.html | 109 +++++++++++------- .../dmp/overview/dmp-overview.component.scss | 99 ++++++++++------ .../ui/dmp/overview/dmp-overview.component.ts | 59 ++++++++-- dmp-frontend/src/assets/i18n/en.json | 2 + dmp-frontend/src/assets/i18n/es.json | 2 + dmp-frontend/src/assets/i18n/gr.json | 2 + 6 files changed, 187 insertions(+), 86 deletions(-) diff --git a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.html b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.html index 49b8df844..32c2bdf7a 100644 --- a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.html +++ b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.html @@ -1,16 +1,14 @@
- + chevron_left

{{'DMP-WIZARD.ACTIONS.BACK' | translate}}

-
+
- +

{{ dmp.label }}

@@ -28,29 +26,25 @@ {{'DMP-OVERVIEW.PRIVATE' | translate}}
-
-
+
+
lock_outline {{'DMP-OVERVIEW.LOCKED' | translate}}
-
+
lock_open {{'DMP-OVERVIEW.UNLOCKED' | translate}}
-
{{'GENERAL.STATUSES.EDIT' | translate}} : {{dmp.modifiedTime | date:"longDate"}}
-
+
check {{'DATASET-LISTING.COLUMNS.FINALIZED' | translate}}
@@ -72,19 +66,33 @@ matTooltip="{{'DMP-LISTING.ACTIONS.DELETE' | translate}}" matTooltipPosition="above"> delete - --> + +
{{'DMP-OVERVIEW.GRANT' | translate}}
{{ dmp.grant.label }}
{{'DMP-OVERVIEW.RESEARCHERS' | translate}}
-
+
 
-
{{ researcher.name }}
+
{{ researcher.name }},
+
{{ researcher.name }}
{{'DATASET-LISTING.COLUMNS.DESCRIPTION' | translate}}
@@ -112,7 +120,7 @@
- @@ -127,20 +135,18 @@
-
+

{{'DMP-EDITOR.TITLE.SUBTITLE' | translate}}

-

- {{ dmp.doi }}

-

 

+

+ {{ dmp.doi }}

-
-
+
+
+
+ +

{{ 'DMP-LISTING.ACTIONS.FINALIZE' | translate }}

+
+
+
+
+
+

{{ 'DMP-LISTING.ACTIONS.DEPOSIT' | translate }}

-
+

{{ 'DMP-LISTING.ACTIONS.EXPORT' | translate }}

-
+ class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center" (click)="publish(dmp.id)"> @@ -198,23 +216,30 @@
-
-
+
+

{{ 'DMP-OVERVIEW.DMP-AUTHORS' | translate }}

-
- -
-
-

{{ user.name }}

-

{{ roleDisplay(user) }}

+
+
+
+ +
+

{{ user.name }} + ({{ 'DMP-OVERVIEW.YOU' | translate }}) +

+

{{ roleDisplay(user) }}

+
+
+ class="row mt-3 mb-3 d-flex align-items-center justify-content-center"> @@ -22,15 +20,15 @@
diff --git a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.html b/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.html index 767a57fb7..eb053a3c7 100644 --- a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.html +++ b/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.html @@ -26,7 +26,7 @@
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 0d3a63409..597925313 100644 --- a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts @@ -20,6 +20,7 @@ import { SnackBarNotificationLevel } from '@app/core/services/notification/ui-no import * as FileSaver from 'file-saver'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; import { UiNotificationService } from '@app/core/services/notification/ui-notification-service'; +import { DmpInvitationDialogComponent } from '@app/ui/dmp/invitation/dmp-invitation.component'; @Component({ selector: 'app-drafts', @@ -161,6 +162,18 @@ export class DraftsComponent extends BaseComponent implements OnInit { }); } + openShareDialog(dmpRowId: any, dmpRowName: any) { + const dialogRef = this.dialog.open(DmpInvitationDialogComponent, { + // height: '250px', + // width: '700px', + restoreFocus: false, + data: { + dmpId: dmpRowId, + dmpName: dmpRowName + } + }); + } + onCallbackSuccess(id?: String): void { this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success); id ? this.router.navigate(['/reload']).then(() => { this.router.navigate(['/datasets', 'edit', id]); }) : this.router.navigate(['/datasets']); diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-dataset-activity/recent-edited-dataset-activity.component.html b/dmp-frontend/src/app/ui/dashboard/recent-edited-dataset-activity/recent-edited-dataset-activity.component.html index 3d057a645..b555cdc02 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-dataset-activity/recent-edited-dataset-activity.component.html +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-dataset-activity/recent-edited-dataset-activity.component.html @@ -28,7 +28,7 @@
diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-dataset-activity/recent-edited-dataset-activity.component.ts b/dmp-frontend/src/app/ui/dashboard/recent-edited-dataset-activity/recent-edited-dataset-activity.component.ts index 769780f85..e163cc42d 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-dataset-activity/recent-edited-dataset-activity.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-dataset-activity/recent-edited-dataset-activity.component.ts @@ -20,6 +20,7 @@ import { ValidationErrorModel } from '@common/forms/validation/error-model/valid import { UiNotificationService } from '@app/core/services/notification/ui-notification-service'; import { SnackBarNotificationLevel } from '@common/modules/notification/ui-notification-service'; import { DatasetStatus } from '@app/core/common/enum/dataset-status'; +import { DmpInvitationDialogComponent } from '@app/ui/dmp/invitation/dmp-invitation.component'; @Component({ selector: 'app-recent-edited-dataset-activity', @@ -151,6 +152,18 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen }); } + openShareDialog(dmpRowId: any, dmpRowName: any, activity: any) { + const dialogRef = this.dialog.open(DmpInvitationDialogComponent, { + // height: '250px', + // width: '700px', + restoreFocus: false, + data: { + dmpId: dmpRowId, + dmpName: dmpRowName + } + }); + } + getFilenameFromContentDispositionHeader(header: string): string { const regex: RegExp = new RegExp(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/g); diff --git a/dmp-frontend/src/app/ui/language/language-content/language.component.ts b/dmp-frontend/src/app/ui/language/language-content/language.component.ts index 791ed94d1..9eff5109f 100644 --- a/dmp-frontend/src/app/ui/language/language-content/language.component.ts +++ b/dmp-frontend/src/app/ui/language/language-content/language.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, Output, EventEmitter } from '@angular/core'; import { Router } from '@angular/router'; import { AuthService } from '@app/core/services/auth/auth.service'; import { LanguageService } from '@app/core/services/language/language.service'; @@ -9,53 +9,55 @@ import { BaseComponent } from '@common/base/base.component'; const availableLanguages: any[] = require('../../../../assets/resources/language.json'); @Component({ - selector: 'app-language', - templateUrl: './language.component.html', - styleUrls: ['./language.component.scss'] + selector: 'app-language', + templateUrl: './language.component.html', + styleUrls: ['./language.component.scss'] }) export class LanguageComponent extends BaseComponent implements OnInit { + @Output() languageChange: EventEmitter = new EventEmitter(); languages = availableLanguages; - constructor( - private router: Router, - private authentication: AuthService, - private languageService: LanguageService, - private userService: UserService - ) { super(); } + constructor( + private router: Router, + private authentication: AuthService, + private languageService: LanguageService, + private userService: UserService + ) { super(); } - ngOnInit() { - } - - public isAuthenticated(): boolean { - return !(!this.authentication.current()); -} - - public getCurrentLanguage(): any { - const lang = this.languages.find(lang => lang.value === this.languageService.getCurrentLanguage()); - return lang; -} - - onLanguageSelected(selectedLanguage: any) { - if (this.isAuthenticated()) { - const langMap = new Map(); - langMap.set('language', selectedLanguage.value); - this.userService.updateUserSettings({language: this.languages.find(lang => lang.value === selectedLanguage.value)}) - .pipe(takeUntil(this._destroyed)) - .subscribe((response) => { - this.languageService.changeLanguage(selectedLanguage.value); - this.authentication.me() - .pipe(takeUntil(this._destroyed)) - .subscribe ( innerResponse => - {this.router.navigateByUrl(this.router.url);}); - }, - error => { - console.log(error); - }); - } else { - this.languageService.changeLanguage(selectedLanguage.value); - this.router.navigateByUrl(this.router.url); + ngOnInit() { + this.languageChange.emit(this.getCurrentLanguage().value) + } + + public isAuthenticated(): boolean { + return !(!this.authentication.current()); + } + + public getCurrentLanguage(): any { + const lang = this.languages.find(lang => lang.value === this.languageService.getCurrentLanguage()); + return lang; + } + + onLanguageSelected(selectedLanguage: any) { + if (this.isAuthenticated()) { + const langMap = new Map(); + langMap.set('language', selectedLanguage.value); + this.userService.updateUserSettings({ language: this.languages.find(lang => lang.value === selectedLanguage.value) }) + .pipe(takeUntil(this._destroyed)) + .subscribe((response) => { + this.languageService.changeLanguage(selectedLanguage.value); + this.authentication.me() + .pipe(takeUntil(this._destroyed)) + .subscribe(innerResponse => { this.router.navigateByUrl(this.router.url); }); + }, + error => { + console.log(error); + }); + } else { + this.languageService.changeLanguage(selectedLanguage.value); + this.router.navigateByUrl(this.router.url); + } + this.languageChange.emit(selectedLanguage.value); } -} } diff --git a/dmp-frontend/src/app/ui/sidebar/sidebar.component.scss b/dmp-frontend/src/app/ui/sidebar/sidebar.component.scss index 593d91ba2..0e90859e5 100644 --- a/dmp-frontend/src/app/ui/sidebar/sidebar.component.scss +++ b/dmp-frontend/src/app/ui/sidebar/sidebar.component.scss @@ -36,3 +36,8 @@ $mat-card-header-size: 30px !default; .active a i{ color: #23BCBA; } + +mat-list-item { + display: flex !important; + height: auto !important; +} diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index dccd10204..10bb1e2d2 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -1123,7 +1123,12 @@ "GRANTS": "Grants", "MY-DMPS": "My DMPs", "TITLE": "What is ARGOS?", + "DMP-QUESTION": "What is a DMP in ARGOS?", "INFO-TEXT": "ARGOS is an open extensible service that simplifies the management, validation, monitoring and maintenance and of Data Management Plans. It allows actors (researchers, managers, supervisors etc) to create actionable DMPs that may be freely exchanged among infrastructures for carrying out specific aspects of the Data management process in accordance with the intentions and commitment of Data owners.", + "INFO-DMP-TEXT": "A Data Management Plan (DMP) is a living document describing the datasets that are generated and/ or re-used during and after a research lifetime. DMPs aim to provide researchers with essential information to re-produce,re-distribute and re-purpose research results thus assuring for their validity and exploitation.", + "NEW-QUESTION": "New with DMPs? Visit", + "OPEN-AIR-GUIDE": "OpenAIRE’s Guide for Researchers", + "LEARN-MORE": "to learn more about how to create one!", "ORGANIZATIONS": "Related Organizations", "DMPS": "DMPs", "MY-DATASETS": "My Dataset Descriptions", diff --git a/dmp-frontend/src/assets/i18n/es.json b/dmp-frontend/src/assets/i18n/es.json index 9261319cd..8c67bed8f 100644 --- a/dmp-frontend/src/assets/i18n/es.json +++ b/dmp-frontend/src/assets/i18n/es.json @@ -1110,7 +1110,12 @@ "GRANTS": "Subvenciones", "MY-DMPS": "Mis PGDs", "TITLE": "¿Qué es ARGOS?", + "DMP-QUESTION": "¿Que es un DMP en ARGOS?", "INFO-TEXT": "ARGOS es un servicio extensible y abierto que simplifica la gestión, validación, monitorización y mantenimiento de los Plan de Gestión de Datos. Permite a los participantes (investigadores, gestores, supervisores, etc) crear un PGDs visible que puede ser compartido libremente entre distintas infraestructuras para llevar a cabo aspectos específicos del proceso de Gestión de Datos de acuerdo con los propósitos y el compromiso de los propietarios de los datos.", + "INFO-DMP-TEXT": "A Data Management Plan (DMP) is a living document describing the datasets that are generated and/ or re-used during and after a research lifetime. DMPs aim to provide researchers with essential information to re-produce,re-distribute and re-purpose research results thus assuring for their validity and exploitation.", + "NEW-QUESTION": "¿Nuevo con DMP? Visitar", + "OPEN-AIR-GUIDE": "Guía de OpenAIRE para investigadores", + "LEARN-MORE": "para aprender más sobre cómo crear uno!", "ORGANIZATIONS": "Organizaciones relacionadas", "DMPS": "PGDs", "MY-DATASETS": "Mis descripciones del Dataset", diff --git a/dmp-frontend/src/assets/i18n/gr.json b/dmp-frontend/src/assets/i18n/gr.json index fa4f747da..5bc65bc3d 100644 --- a/dmp-frontend/src/assets/i18n/gr.json +++ b/dmp-frontend/src/assets/i18n/gr.json @@ -1097,8 +1097,13 @@ "MY-GRANTS": "Οι Επιχορηγήσεις μου", "GRANTS": "Επιχορηγήσεις", "MY-DMPS": "Τα Σχέδια Διαχείρισης Δεδομένων μου", - "TITLE": "Τi είναι το ARGOS?", + "TITLE": "Τι είναι το ARGOS?", + "DMP-QUESTION": "Τι είναι το DMP στο ARGOS?", + "NEW-QUESTION": "Νέος με τα DMP; Επίσκεψου", + "OPEN-AIR-GUIDE": "Οδηγός για ερευνητές του OpenAIRE", + "LEARN-MORE": "για να μάθετε περισσότερα για το πώς να δημιουργήσετε ένα!", "INFO-TEXT": "Το ARGOS είναι μια ανοικτή επεκτάσιμη υπηρεσία που απλοποιεί τη διαχείριση, την επικύρωση, την παρακολούθηση και τη συντήρηση των Σχεδίων Διαχείρισης Δεδομένων. Επιτρέπει στους φορείς (ερευνητές, υπεύθυνους έρευνας, διευθυντές κλπ.) να δημιουργούν ζωντανά Σχέδια Διαχείρισης Δεδομένων που μπορούν να ανταλλάσσονται ελεύθερα μεταξύ των υποδομών για τη διεξαγωγή συγκεκριμένων πτυχών της διαδικασίας διαχείρισης Δεδομένων, σύμφωνα με τις προθέσεις και τη δέσμευση των κατόχων Δεδομένων.", + "INFO-DMP-TEXT": "A Data Management Plan (DMP) is a living document describing the datasets that are generated and/ or re-used during and after a research lifetime. DMPs aim to provide researchers with essential information to re-produce,re-distribute and re-purpose research results thus assuring for their validity and exploitation.", "ORGANIZATIONS": "Σχετικοί Οργανισμοί", "DMPS": "Σχέδια Διαχείρισης Δεδομένων", "MY-DATASETS": "Οι Περιγραφές Συνόλων Δεδομένων μου",