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