zap
zap copied to clipboard
Generate flow in UI is not fulfilling the needs
The way it works now is: You click "Generate...", then you select directory, then it generates into that directory. And when you do preview, you can't do diffs, because you don't know what to diff against, since that directory is a temporary thing.
What this should do is the following: 1.) You have an UI where you can SAVE the target generation directory into the zap file itself, stored relatively against the location of the zap file. 2.) This is then always the generation destination when you hit generate. 3.) When you do a preview, you can then show diff against the files in that location.
dears if you want to change the saving file dialog box or even giving opening location for it it would need change from electron framework , as in browser there is no control to file system itself ( vue app can't have access)
there is one new feature in browser to select a file and gain control over it ( resave changes , not removing or creating new file) currently we are using messaging api to access electron capabilities( not cool for other platforms)
so my suggestion is if you surly need to do this we do it like this check if backendserver is on standalone status: save the generated file from backend and just send info of file location to show in vue app else brings back the file to vue app and download the file ...
There is something we call "renderer API". It is a communication layer between Vue app and the "renderer container". The "renderer container" is a thing that contains chromium engine.
We support 3 different renderer containers: 1.) Electron: where the renderer container is the Electron renderer process. 2.) Our own Studio IDE: where the renderer container is the JXBrowser java engine that contains chromium. 3.) Standalone chrome: where the renderer container is the actual browser.
So from Vue app perspective doing this is a renderer API call. The Vue app asks renderer to "please select a file". The following happens, corresponding to the three options above: 1.) Using renderer API, Vue tells electron renderer code to "please select a file" and electron shows the UI to select a file, and then reports it back to Vue app, also vua renderer API. 2.) Using renderer API, Vue tells eclipse java code to "please select a file" and java code shows the UI to select a file, then reports it back to Vue. 3.) Using renderer API, Vue probably pops up a standard browser "upload a file...." dialog, and chooses it.
As you notice, there is a big difference between 1,2 and the case 3: 1,2: can operate with local file paths, as a file is a file on a local filesystem. 3, however: MUST upload the file content onto the server and store it there somehow.
Our main concern right now is how to deal with 1 and 2, but we can't forget about 3 in the long run.
We probably also need two REST API entry points: 1.) The one where you just send the PATH of the file from Vue to backend. and 2.) The one where you actually send the file content to the back-end, as with usual "file upload..." cloud actions.