Skip to content

Commit

Permalink
Fix: Correct file extension for XLSX export (also in Tauri App)
Browse files Browse the repository at this point in the history
  • Loading branch information
aarkue committed Jan 16, 2025
1 parent 3196240 commit 7beca08
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
10 changes: 5 additions & 5 deletions backend/shared/src/table_export/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,11 @@ impl<'a, W: std::io::Write + std::io::Seek + std::marker::Send> TableWriter<'a,
#[derive(TS)]
#[ts(export, export_to = "../../../frontend/src/types/generated/")]
pub struct TableExportOptions {
include_violation_status: bool,
include_ids: bool,
omit_header: bool,
labels: Vec<String>,
format: TableExportFormat,
pub include_violation_status: bool,
pub include_ids: bool,
pub omit_header: bool,
pub labels: Vec<String>,
pub format: TableExportFormat,
}
#[derive(Debug, Serialize, Deserialize, TS)]
#[ts(export, export_to = "../../../frontend/src/types/generated/")]
Expand Down
19 changes: 16 additions & 3 deletions tauri/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,17 @@ use ocedeclare_shared::{
binding_box::{
evaluate_box_tree, filter_ocel_box_tree, CheckWithBoxTreeRequest, EvaluateBoxTreeResult,
EvaluationResultWithCount, ExportFormat, FilterExportWithBoxTreeRequest,
}, discovery::{
},
discovery::{
auto_discover_constraints_with_options, AutoDiscoverConstraintsRequest,
AutoDiscoverConstraintsResponse,
}, get_event_info, get_object_info, ocel_graph::{get_ocel_graph, OCELGraph, OCELGraphOptions}, ocel_qualifiers::qualifiers::{get_qualifiers_for_event_types, QualifiersForEventType}, preprocessing::linked_ocel::{link_ocel_info, IndexLinkedOCEL}, table_export::{export_bindings_to_csv_writer, TableExportOptions}, EventWithIndex, IndexOrID, OCELInfo, ObjectWithIndex
},
get_event_info, get_object_info,
ocel_graph::{get_ocel_graph, OCELGraph, OCELGraphOptions},
ocel_qualifiers::qualifiers::{get_qualifiers_for_event_types, QualifiersForEventType},
preprocessing::linked_ocel::{link_ocel_info, IndexLinkedOCEL},
table_export::{export_bindings_to_csv_writer, TableExportFormat, TableExportOptions},
EventWithIndex, IndexOrID, OCELInfo, ObjectWithIndex,
};
use process_mining::{
export_ocel_json_path, export_ocel_sqlite_to_path, export_ocel_xml_path,
Expand Down Expand Up @@ -149,7 +156,13 @@ fn export_bindings_csv(
FileDialogBuilder::new()
.set_title("Save Filtered OCEL")
.add_filter("CSV Files", &["csv"])
.set_file_name("situation-table.csv")
.set_file_name(&format!(
"situation-table.{}",
match options.format {
TableExportFormat::CSV => "csv",
TableExportFormat::XLSX => "xlsx",
}
))
.save_file(move |f| {
if let Some(path) = f {
if let Ok(_file) = File::open(&path) {
Expand Down

0 comments on commit 7beca08

Please sign in to comment.