threat-dragon icon indicating copy to clipboard operation
threat-dragon copied to clipboard

Open/Save/Rename for Electron

Open lreading opened this issue 3 years ago • 3 comments

Describe what problem your feature request solves The electron build requires different logic for saving directly the file system. Users should only be prompted with the save file dialogue when they are creating a new threat model (not fully implemented yet)

Describe the solution you'd like Create electron specific logic that saves the threat model whenever the user clicks a "Save" button.

Additional context Currently, this logic is triggered from the threatmodel store. Additionally, there's service/save.js which is probably a good place to split the browser vs electron logic

lreading avatar Feb 13 '22 20:02 lreading

This is a high priority for the electron desktop app - I will take this on next of that is OK? @lreading did you do any work on the local open/save of threat model files? I can not remember, but had a vague memory that you prototyped something? No problem either way, I am pretty sure that we can do this fairly easily

jgadsden avatar Mar 27 '22 15:03 jgadsden

I believe I had it working just using the browser save (ergo download) feature. In electron, it would probably be best if we used the system save dialogue. I think the main difference is that using the browser download function, it will prompt the user for the save location each time they save, and by default append a number to the end if the file already exists. In the electron app, I think it would make more sense to overwrite an opened threat model by default. :smile:

lreading avatar Mar 27 '22 15:03 lreading

Cool, thanks @lreading , I will go ahead and use the file system dialogs for open/save/silent-save from electron: https://www.electronjs.org/docs/latest/api/dialog/

also https://web.dev/file-system-access/ & https://github.com/GoogleChromeLabs/text-editor

jgadsden avatar Mar 27 '22 16:03 jgadsden