Merges the functionality of "Export" and "Advanced Export" buttons to a new button. (Issue #172)

This commit is contained in:
apapachristou 2019-09-25 12:44:22 +03:00
parent dac440b140
commit 568fa17a84
12 changed files with 210 additions and 132 deletions

View File

@ -62,8 +62,26 @@
<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 (click)="advancedClicked(activity)" class="menu-item">
<mat-icon>save_alt</mat-icon>{{ 'DMP-LISTING.ACTIONS.ADV-EXP' | translate }}
<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>

View File

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

View File

@ -22,14 +22,26 @@
<button mat-menu-item *ngIf="!viewOnly && !isCopy" (click)="openConfirm(formGroup.get('label').value, formGroup.get('id').value)" class="menu-item">
<mat-icon>delete</mat-icon>{{ 'DATASET-WIZARD.ACTIONS.DELETE' | translate }}
</button>
<button mat-menu-item (click)="advancedClicked()" class="menu-item">
<mat-icon>save_alt</mat-icon>{{ 'DMP-LISTING.ACTIONS.ADV-EXP' | translate }}
</button>
<button mat-menu-item *ngIf="needsUpdate()" class="menu-item" (click)="openUpdateDatasetProfileDialogue();">{{ 'DATASET-WIZARD.ACTIONS.UPDATE-DATASET-PROFILE' | translate }}</button>
</mat-menu>
<button mat-raised-button color="primary" (click)="downloadPDF()" class="lightblue-btn ml-2 text-uppercase">
<mat-icon>save_alt</mat-icon> {{ 'DMP-LISTING.ACTIONS.EXPORT' | translate }}
<button mat-raised-button [matMenuTriggerFor]="exportMenu" color="primary" class="lightblue-btn ml-2 export-btn">
<mat-icon>save_alt</mat-icon> {{ 'DMP-LISTING.ACTIONS.EXPORT' | translate }} <mat-icon>arrow_drop_down</mat-icon>
</button>
<mat-menu #exportMenu="matMenu" xPosition="before">
<button mat-menu-item (click)="downloadPDF()">
<i class="fa fa-file-pdf-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.PDF' | translate}}</span>
</button>
<button mat-menu-item (click)="downloadDOCX()">
<i class="fa fa-file-word-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.DOC' | translate}}</span>
</button>
<button mat-menu-item (click)="downloadXML()">
<i class="fa fa-file-code-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.XML' | translate}}</span>
</button>
</mat-menu>
</div>
</div>
<form *ngIf="formGroup" (ngSubmit)="formSubmit()">

View File

@ -39,6 +39,9 @@
margin-right: 15px;
text-transform: uppercase;
}
.export-btn {
padding-right: 6px;
}
.downloadPDF {
margin-top: 15px;
margin-bottom: 15px;

View File

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

View File

@ -25,13 +25,29 @@
<button mat-menu-item (click)="delete()" class="menu-item">
<mat-icon>delete</mat-icon>{{ 'DMP-LISTING.ACTIONS.DELETE' | translate }}
</button>
<button mat-menu-item (click)="advancedClicked()" class="menu-item">
<mat-icon>save_alt</mat-icon>{{ 'DMP-LISTING.ACTIONS.ADV-EXP' | translate }}
</mat-menu>
<button mat-raised-button [matMenuTriggerFor]="exportMenu" color="primary" class="lightblue-btn export-btn ml-2">
<mat-icon>save_alt</mat-icon> {{ 'DMP-LISTING.ACTIONS.EXPORT' | translate }} <mat-icon>arrow_drop_down</mat-icon>
</button>
<mat-menu #exportMenu="matMenu" xPosition="before">
<button mat-menu-item (click)="downloadPDF(dmp.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(dmp.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(dmp.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(dmp.id)">
<i class="fa fa-file-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.JSON' | translate}}</span>
</button>
</mat-menu>
<button mat-raised-button color="primary" (click)="downloadPDF(dmp.id)" class="lightblue-btn ml-2 text-uppercase">
<mat-icon>save_alt</mat-icon> {{ 'DMP-LISTING.ACTIONS.EXPORT' | translate }}
</button>
</div>
</div>
<form *ngIf="formGroup" (ngSubmit)="formSubmit()">

View File

@ -15,6 +15,10 @@
color: #00b29f;
}
.export-btn {
padding-right: 6px;
}
::ng-deep .mat-tab-labels {
justify-content: space-between;
}

View File

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

View File

@ -26,19 +26,13 @@
<button mat-menu-item *ngIf="isDraftDmp(dmp)" (click)="deleteClicked()" class="menu-item">
<mat-icon>delete</mat-icon>{{ 'DMP-LISTING.ACTIONS.DELETE' | translate }}
</button>
<button mat-menu-item *ngIf="isDraftDmp(dmp)" (click)="advancedClicked()" class="menu-item">
<mat-icon>save_alt</mat-icon>{{ 'DMP-LISTING.ACTIONS.ADV-EXP' | translate }}
</button>
<button mat-menu-item *ngIf="isFinalizedDmp(dmp)" (click)="advancedClickedFinalized()" class="menu-item">
<mat-icon>save_alt</mat-icon>{{ 'DMP-LISTING.ACTIONS.ADV-EXP' | translate }}
</button>
</mat-menu>
<button *ngIf="isDraftDmp(dmp)" mat-raised-button color="primary" (click)="editClicked(dmp)" class="lightblue-btn ml-2">
<mat-icon>edit</mat-icon> {{ 'DMP-LISTING.ACTIONS.EDIT' | translate }}
</button>
<button mat-raised-button color="primary" (click)="downloadPDF(dmp.id)" class="lightblue-btn ml-2">
<mat-icon>save_alt</mat-icon> {{ 'DMP-LISTING.ACTIONS.EXPORT' | translate }}
<button mat-raised-button [matMenuTriggerFor]="exportMenu" color="primary" class="lightblue-btn export-btn ml-2">
<mat-icon>save_alt</mat-icon> {{ 'DMP-LISTING.ACTIONS.EXPORT' | translate }} <mat-icon>arrow_drop_down</mat-icon>
</button>
<button *ngIf="showPublishButton(dmp)" mat-raised-button (click)="publish(dmp.id)" class="lightblue-btn ml-2">
<mat-icon>public</mat-icon> {{ 'DMP-LISTING.ACTIONS.PUBLISH' | translate }}
@ -49,6 +43,25 @@
<button *ngIf="hasDoi(dmp) && isFinalizedDmp(dmp) && !this.isPublicView" mat-raised-button color="primary" (click)="getDoi(dmp)" class="lightblue-btn ml-2">
<mat-icon>archive</mat-icon> {{ 'DMP-LISTING.ACTIONS.GETDOI' | translate }}
</button>
<mat-menu #exportMenu="matMenu" xPosition="before">
<button mat-menu-item (click)="downloadPDF(dmp.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(dmp.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(dmp.id)">
<i class="fa fa-file-code-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.XML' | translate}}</span>
</button>
<button *ngIf="isDraftDmp(dmp)" mat-menu-item (click)="downloadJson(dmp.id)">
<i class="fa fa-file-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.JSON' | translate}}</span>
</button>
</mat-menu>
</div>
</div>
<div class="row ml-2">

View File

@ -17,6 +17,10 @@
color: #00b29f;
}
.export-btn {
padding-right: 6px;
}
.menu-item {
width: 248px;
}

View File

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

View File

@ -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",