this repo has no description
at main 847 B view raw
1use chrono::Utc; 2use crossbeam_channel::Sender; 3 4use tauri::State; 5 6use crate::{runtime::commands::RuntimeCommand, structs::nodes::Node, utils::config::Config}; 7 8#[tauri::command] 9pub fn sync_tab( 10 graph: Vec<Node>, 11 id: String, 12 name: String, 13 save_state: bool, 14 location: Option<String>, 15 cmd: State<Sender<RuntimeCommand>>, 16 conf: State<Config>, 17) { 18 cmd 19 .send(RuntimeCommand::AddTab(graph.clone(), id.clone())) 20 .unwrap(); 21 22 let mut config = conf.store.lock().unwrap(); 23 config.loaded_tabs.insert(id, (graph, name, location, save_state)); 24 25 conf.save_prelocked(config); 26} 27 28#[tauri::command] 29pub fn discard_tab(id: String, cmd: State<Sender<RuntimeCommand>>, conf: State<Config>) { 30 cmd.send(RuntimeCommand::RemoveTab(id.clone())).unwrap(); 31 32 let mut config = conf.store.lock().unwrap(); 33 config.loaded_tabs.remove(&id); 34}