|
-
+
{{'SHARED_LIB.PERUN.COMPONENTS.TABLE_OPTIONS.EXPORT_TO_FILE' | translate}}
-
-
- Csv
-
-
-
-
- {{'SHARED_LIB.PERUN.COMPONENTS.TABLE_OPTIONS.DISPLAYED_DATA' | translate}}
-
-
- {{'SHARED_LIB.PERUN.COMPONENTS.TABLE_OPTIONS.ALL_DATA' | translate}}
-
-
diff --git a/libs/perun/utils/src/lib/table-options/table-options.component.ts b/libs/perun/utils/src/lib/table-options/table-options.component.ts
index 41aca1559..801ecd869 100644
--- a/libs/perun/utils/src/lib/table-options/table-options.component.ts
+++ b/libs/perun/utils/src/lib/table-options/table-options.component.ts
@@ -1,4 +1,12 @@
import { Component, EventEmitter, Input, Output } from '@angular/core';
+import { MatDialog } from '@angular/material/dialog';
+import { ExportTableDialogComponent } from '../export-table-dialog/export-table-dialog.component';
+import { getDefaultDialogConfig } from '../perun-utils';
+
+interface DialogData {
+ exportType: string;
+ format: string;
+}
@Component({
selector: 'perun-web-apps-table-options',
@@ -9,4 +17,25 @@ export class TableOptionsComponent {
@Input() allowExportAll: boolean;
@Output() exportDisplayedData = new EventEmitter();
@Output() exportAllData = new EventEmitter();
+
+ constructor(private dialog: MatDialog) {}
+ openDialog(): void {
+ const config = getDefaultDialogConfig();
+ config.width = '500px';
+ config.data = {
+ allowExportAll: this.allowExportAll,
+ };
+ this.dialog
+ .open(ExportTableDialogComponent, config)
+ .afterClosed()
+ .subscribe((result: DialogData) => {
+ if (result) {
+ if (result.exportType === 'all') {
+ this.exportAllData.emit(result.format);
+ } else {
+ this.exportDisplayedData.emit(result.format);
+ }
+ }
+ });
+ }
}
|