Fixes style on export file dialogs
This commit is contained in:
parent
b8e08869e5
commit
1eb9126d8c
|
@ -87,12 +87,14 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
|
|||
|
||||
advancedClicked(dmp: DmpListingModel) {
|
||||
const dialogRef = this.dialog.open(ExportMethodDialogComponent, {
|
||||
maxWidth: '400px',
|
||||
maxWidth: '500px',
|
||||
data: {
|
||||
message: "Download as:",
|
||||
XMLButton: "XML",
|
||||
documentButton: "Document",
|
||||
pdfButton: "PDF"
|
||||
pdfButton: "PDF",
|
||||
jsonButton: "JSON"
|
||||
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||
|
@ -102,6 +104,8 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
|
|||
this.downloadXml(dmp.id);
|
||||
} else if (result == "doc") {
|
||||
this.downloadDocx(dmp.id);
|
||||
} else if (result == "json") {
|
||||
this.downloadJson(dmp.id)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -199,6 +203,16 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
|
|||
});
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
@ -504,7 +504,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
|||
|
||||
advancedClicked() {
|
||||
const dialogRef = this.dialog.open(ExportMethodDialogComponent, {
|
||||
maxWidth: '400px',
|
||||
maxWidth: '500px',
|
||||
data: {
|
||||
message: "Download as:",
|
||||
XMLButton: "XML",
|
||||
|
|
|
@ -26,6 +26,10 @@ h4 {
|
|||
padding-left: 1em;
|
||||
}
|
||||
|
||||
h4 > span {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.title h4 {
|
||||
padding-left: 30px;
|
||||
line-height: 2em;
|
||||
|
|
|
@ -95,7 +95,7 @@
|
|||
</button>
|
||||
</div> -->
|
||||
<div *ngIf="this.formGroup.enabled">
|
||||
<button mat-raised-button color="primary" type="submit" [disabled]="!formGroup.valid" class="text-uppercase mr-2">
|
||||
<button mat-raised-button type="submit" [disabled]="!formGroup.valid" class="text-uppercase dark-theme mr-2" color="primary">
|
||||
{{'DMP-EDITOR.ACTIONS.SAVE' | translate}}
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
@ -314,7 +314,7 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
|
|||
|
||||
advancedClicked() {
|
||||
const dialogRef = this.dialog.open(ExportMethodDialogComponent, {
|
||||
maxWidth: '400px',
|
||||
maxWidth: '500px',
|
||||
data: {
|
||||
message: "Download as:",
|
||||
XMLButton: "XML",
|
||||
|
|
|
@ -109,12 +109,13 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
|
||||
advancedClicked() {
|
||||
const dialogRef = this.dialog.open(ExportMethodDialogComponent, {
|
||||
maxWidth: '400px',
|
||||
maxWidth: '500px',
|
||||
data: {
|
||||
message: "Download as:",
|
||||
XMLButton: "XML",
|
||||
documentButton: "Document",
|
||||
pdfButton: "PDF"
|
||||
pdfButton: "PDF",
|
||||
jsonButton: "JSON"
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||
|
@ -124,6 +125,8 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
this.downloadXml(this.dmp.id);
|
||||
} else if (result == "doc") {
|
||||
this.downloadDocx(this.dmp.id);
|
||||
} else if (result == "json") {
|
||||
this.downloadJson(this.dmp.id)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -170,6 +173,16 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
});
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue