Skip to content

Commit

Permalink
Improve storing search string in backend.
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasHeneka committed Jun 5, 2024
1 parent 91988a4 commit d9dee1a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src-tauri/src/commands/search_string_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ pub async fn get_stored_search_string(
state: tauri::State<'_, CNLState>,
page: String,
) -> Result<String, ()> {
/* TODO return string from lookup table with key page.
If present delete entry else return empty string.
*/
Ok("".parse().unwrap())
}

Expand All @@ -14,5 +17,6 @@ pub async fn store_search_string(
page: String,
string: String
) -> Result<(), ()> {
// TODO save page: string in a lookup table
Ok(())
}
2 changes: 1 addition & 1 deletion src/logging/Logging.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ function Logging({nodes}: Readonly<ExportPanelProps>) {
setRowData(rowData);

return () => {
invoke("store_search_string", {page: "export", string: searchString}).catch(console.error);
if (searchString !== "") invoke("store_search_string", {page: "export", string: searchString}).catch(console.error);
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/nodes/NodePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function NodePanel({node}: Readonly<NodePanelProps>) {
return () => {
unlistenJs();
invoke("unlisten_from_node_latest", {nodeName: node.name}).catch(console.error);
invoke("store_search_string", {page: node.name, string: searchString}).catch(console.error);
if (searchString !== "") invoke("store_search_string", {page: node.name, string: searchString}).catch(console.error);
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/trace/Trace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function Trace() {
});
return () => {
invoke("unlisten_from_trace").catch(console.error);
invoke("store_search_string", {page: "trace", string: searchString}).catch(console.error);
if (searchString !== "") invoke("store_search_string", {page: "trace", string: searchString}).catch(console.error);
unlisten();
};
}
Expand Down

0 comments on commit d9dee1a

Please sign in to comment.