+1
src-tauri/capabilities/default.json
+1
src-tauri/capabilities/default.json
+1
-1
src-tauri/src/frontend_calls/load_previous_tabs.rs
+1
-1
src-tauri/src/frontend_calls/load_previous_tabs.rs
···
5
5
use crate::{ structs::nodes::Node, utils::config::Config };
6
6
7
7
#[tauri::command]
8
-
pub fn load_previous_tabs( conf: State<Config> ) -> HashMap<String, Vec<Node>> {
8
+
pub fn load_previous_tabs( conf: State<Config> ) -> HashMap<String, ( Vec<Node>, String, Option<String> )> {
9
9
let config = conf.store.lock().unwrap();
10
10
11
11
let tabs = config.loaded_tabs.clone();
+2
-2
src-tauri/src/frontend_calls/sync_tab.rs
+2
-2
src-tauri/src/frontend_calls/sync_tab.rs
···
5
5
use crate::{ runtime::commands::RuntimeCommand, structs::nodes::Node, utils::config::Config };
6
6
7
7
#[tauri::command]
8
-
pub fn sync_tab( graph: Vec<Node>, id: String, cmd: State<Sender<RuntimeCommand>>, conf: State<Config> ){
8
+
pub fn sync_tab( graph: Vec<Node>, id: String, name: String, location: Option<String>, cmd: State<Sender<RuntimeCommand>>, conf: State<Config> ){
9
9
cmd.send(RuntimeCommand::AddTab(graph.clone(), id.clone())).unwrap();
10
10
11
11
let mut config = conf.store.lock().unwrap();
12
-
config.loaded_tabs.insert(id, graph);
12
+
config.loaded_tabs.insert(id, ( graph, name, location ));
13
13
drop(config);
14
14
15
15
conf.save();
+1
-1
src-tauri/src/utils/config.rs
+1
-1
src-tauri/src/utils/config.rs
+7
-11
src/Mangers/NodeManager.tsx
+7
-11
src/Mangers/NodeManager.tsx
···
31
31
invoke('load_previous_tabs').then(async ( tabs: any ) => {
32
32
let version = await getVersion();
33
33
34
-
for(let tab of Object.entries(tabs)){
34
+
for(let tab of Object.entries<any>(tabs)){
35
35
console.log(tab);
36
36
37
-
await this._loadFromConfig(null, tab[0], JSON.stringify({
38
-
tab_name: 'test',
37
+
await this._loadFromConfig(tab[1][2], tab[0], JSON.stringify({
38
+
tab_name: tab[1][1],
39
39
version,
40
-
graph: tab[1]
40
+
graph: tab[1][0]
41
41
}));
42
42
};
43
43
});
···
45
45
(async () => {
46
46
let window = await getCurrentWindow();
47
47
48
-
window.onCloseRequested(async ev => {
49
-
ev.preventDefault();
50
-
48
+
window.onCloseRequested(async _ => {
51
49
let tabs = Object.values(this._tabs);
52
50
let tabsNeedingSaving = tabs.filter(x => x.needsSave());
53
51
···
72
70
)
73
71
});
74
72
}
75
-
76
-
window.close();
77
73
});
78
74
})();
79
75
}
···
198
194
tab.saveLocation ||
199
195
await save({ defaultPath: tab.name + '.macro', filters: [ { name: 'Macro Files', extensions: [ 'macro' ] } ] });
200
196
201
-
if(!path)return;
197
+
if(!path)throw new Error("Cannot save");
202
198
203
199
tab.saveLocation = path;
204
200
tab.setNeedsSave(false);
···
251
247
if(!tab)return;
252
248
253
249
if(tab.refuseSync)return;
254
-
invoke('sync_tab', { graph: this._generateTabGraph(tab.id)[0], id: tab.id });
250
+
invoke('sync_tab', { graph: this._generateTabGraph(tab.id)[0], id: tab.id, name: tab.name, location: tab.saveLocation });
255
251
256
252
if(needsSave)tab.setNeedsSave(true);
257
253
}