From 568fa17a84f9410289f983f6886519c051ab2da3 Mon Sep 17 00:00:00 2001 From: apapachristou Date: Wed, 25 Sep 2019 12:44:22 +0300 Subject: [PATCH] Merges the functionality of "Export" and "Advanced Export" buttons to a new button. (Issue #172) --- .../recent-edited-activity.component.html | 22 ++++- .../recent-edited-activity.component.ts | 50 +++++------ .../dataset-wizard.component.html | 22 +++-- .../dataset-wizard.component.scss | 3 + .../dataset-wizard.component.ts | 40 ++++----- .../ui/dmp/editor/dmp-editor.component.html | 26 ++++-- .../ui/dmp/editor/dmp-editor.component.scss | 4 + .../app/ui/dmp/editor/dmp-editor.component.ts | 48 +++++----- .../dmp/overview/dmp-overview.component.html | 29 +++++-- .../dmp/overview/dmp-overview.component.scss | 4 + .../ui/dmp/overview/dmp-overview.component.ts | 87 ++++++++++--------- dmp-frontend/src/assets/i18n/en.json | 7 ++ 12 files changed, 210 insertions(+), 132 deletions(-) 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 d509a1c6e..f64c48c3c 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 @@ -62,8 +62,26 @@ - + + + + + + diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts index 7599cb273..0f53c85a7 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts @@ -86,31 +86,6 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn }); } - 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) - } - }); - } - onCallbackSuccess(): void { this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success); this.router.navigate(['/plans']); @@ -233,4 +208,29 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn } return filename; } + + // 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) + // } + // }); + // } } diff --git a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.html b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.html index 92394f152..5715d2eac 100644 --- a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.html +++ b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.html @@ -22,14 +22,26 @@ - - + + + + +
diff --git a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.scss b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.scss index 02de9b7fe..1f1a86b30 100644 --- a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.scss +++ b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.scss @@ -39,6 +39,9 @@ margin-right: 15px; text-transform: uppercase; } + .export-btn { + padding-right: 6px; + } .downloadPDF { margin-top: 15px; margin-bottom: 15px; diff --git a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts index 14559773d..51d46b635 100644 --- a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts +++ b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts @@ -521,26 +521,26 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr }); } - advancedClicked() { - const dialogRef = this.dialog.open(ExportMethodDialogComponent, { - maxWidth: '500px', - data: { - message: "Download as:", - XMLButton: "XML", - documentButton: "Document", - pdfButton: "PDF" - } - }); - dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { - if (result == "pdf") { - this.downloadPDF(); - } else if (result == "xml") { - this.downloadXML(); - } else if (result == "doc") { - this.downloadDOCX(); - } - }); - } + // advancedClicked() { + // const dialogRef = this.dialog.open(ExportMethodDialogComponent, { + // maxWidth: '500px', + // data: { + // message: "Download as:", + // XMLButton: "XML", + // documentButton: "Document", + // pdfButton: "PDF" + // } + // }); + // dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { + // if (result == "pdf") { + // this.downloadPDF(); + // } else if (result == "xml") { + // this.downloadXML(); + // } else if (result == "doc") { + // this.downloadDOCX(); + // } + // }); + // } getFilenameFromContentDispositionHeader(header: string): string { const regex: RegExp = new RegExp(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/g); diff --git a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html index 919176d93..f3aadf345 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html +++ b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html @@ -25,13 +25,29 @@ - + + + + + - diff --git a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.scss b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.scss index ffe46cacf..71adf86fe 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.scss +++ b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.scss @@ -15,6 +15,10 @@ color: #00b29f; } +.export-btn { + padding-right: 6px; +} + ::ng-deep .mat-tab-labels { justify-content: space-between; } diff --git a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts index cf0edf5d4..b82dc6e9e 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts @@ -338,30 +338,6 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC this.router.navigate(['/plans/versions/' + rowId], { queryParams: { groupLabel: rowLabel } }); } - advancedClicked() { - 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(this.dmp.id); - } else if (result == "xml") { - this.downloadXml(this.dmp.id); - } else if (result == "doc") { - this.downloadDocx(this.dmp.id); - } else if (result == "json") { - this.downloadJson(this.dmp.id) - } - }); - } - downloadXml(id: string) { this.dmpService.downloadXML(id) .pipe(takeUntil(this._destroyed)) @@ -492,4 +468,28 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC } }); } + + // advancedClicked() { + // 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(this.dmp.id); + // } else if (result == "xml") { + // this.downloadXml(this.dmp.id); + // } else if (result == "doc") { + // this.downloadDocx(this.dmp.id); + // } else if (result == "json") { + // this.downloadJson(this.dmp.id) + // } + // }); + // } } 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 22230de4e..6b5fecaeb 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 @@ -26,19 +26,13 @@ - - - + + + + + + +
diff --git a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.scss b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.scss index 3d42bf895..8e5b8b8e1 100644 --- a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.scss +++ b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.scss @@ -17,6 +17,10 @@ color: #00b29f; } +.export-btn { + padding-right: 6px; +} + .menu-item { width: 248px; } diff --git a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts index ff15a9094..703c8e437 100644 --- a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts +++ b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts @@ -139,49 +139,6 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { }); } - advancedClicked() { - 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(this.dmp.id); - } else if (result == "xml") { - this.downloadXml(this.dmp.id); - } else if (result == "doc") { - this.downloadDocx(this.dmp.id); - } else if (result == "json") { - this.downloadJson(this.dmp.id) - } - }); - } - - advancedClickedFinalized() { - const dialogRef = this.dialog.open(ExportMethodDialogComponent, { - maxWidth: '250px', - data: { - message: "Download as:", - documentButton: "Document", - pdfButton: "PDF", - isFinalized: true - } - }); - dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { - if (result == "pdf") { - this.downloadPDF(this.dmp.id); - } else if (result == "doc") { - this.downloadDocx(this.dmp.id); - } - }); - } - onCallbackSuccess(): void { this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success); this.router.navigate(['/plans']); @@ -396,4 +353,48 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { viewVersions(rowId: String, rowLabel: String) { this.router.navigate(['/plans/versions/' + rowId], { queryParams: { groupLabel: rowLabel } }); } + + // advancedClicked() { + // 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(this.dmp.id); + // } else if (result == "xml") { + // this.downloadXml(this.dmp.id); + // } else if (result == "doc") { + // this.downloadDocx(this.dmp.id); + // } else if (result == "json") { + // this.downloadJson(this.dmp.id); + // } + // }); + // } + + // advancedClickedFinalized() { + // const dialogRef = this.dialog.open(ExportMethodDialogComponent, { + // maxWidth: '250px', + // data: { + // message: "Download as:", + // documentButton: "Document", + // pdfButton: "PDF", + // isFinalized: true + // } + // }); + // dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { + // if (result == "pdf") { + // this.downloadPDF(this.dmp.id); + // } else if (result == "doc") { + // this.downloadDocx(this.dmp.id); + // } + // }); + // } + } diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index 2836e9b1e..4d4921c73 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -96,6 +96,12 @@ "DATASET-UPDATE": "Update Dataset Description", "DATASET-PROFILES-NEW-VERSION": "New Version of Dataset Description Template", "DATASET-PROFILES-CLONE": "New Clone of Dataset Description Template" + }, + "FILE-TYPES": { + "PDF": "PDF", + "XML": "XML", + "JSON": "JSON", + "DOC": "Document" } }, "EMAIL-CONFIRMATION": { @@ -348,6 +354,7 @@ "PUBLISH": "Publish", "FINALIZE": "Finalize", "ADV-EXP": "Advanced Export", + "EXP-AS": "Export As", "DOWNLOAD-XML": "Download XML", "DOWNLOAD-DOCX": "Download Document", "DOWNLOAD-PDF": "Download PDF",