-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
app: frontend: plugins: Add runCommand for shell commands in Electron app #1677
Conversation
… app So that some local shell commands can be run from inside a plugin. This communicates the process interaction with the Electron app render process via ipc. The interface exposed is a subset of the node spawn() which is what is used on the app side. It only implements the parts which are already used by the plugin we have in mind. The interface supports streaming stdout and stderr, and getting exit codes. Note, this supports running multiple commands at the same time. The complexities of this are hidden to the user of runCommand. It limits the commands that can be run to only minikube and az so far. If there is a need for more this can be extended later. This is intended as a way to limit potential misuse. The app-menu example plugin has been extended to add a minikube menu which displays minikube status. Signed-off-by: René Dudfield <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @illume. Some question/suggestions. Yet to test it.
Thanks for the review :) I'll make those changes. |
@knrt10 thanks, I addressed your notes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work @illume . Tested it.
Note: Not in the scope of this PR, but maybe we can edit the plugin later to show app menu for the current cluster that it is in. i.e. if there are multiple clusters when open it should show its status.
For example, here knrt10 cluster is opened it should show it's status
Again, it's not in the scope of this PR, just something we could improve later.
fixes #1670 |
So that some local shell commands can be run from inside a plugin.
This communicates the process interaction with the Electron app render process via ipc.
The interface exposed is a subset of the node spawn() which is what is used on the app side. It only implements the parts which are already used by the plugin we have in mind.
The interface supports streaming stdout and stderr, and getting exit codes.
Note, this supports running multiple commands at the same time. The complexities of this are hidden to the user of runCommand.
It limits the commands that can be run to only minikube and az so far. If there is a need for more this can be extended later. This is intended as a way to limit potential misuse.
How to test?
The app-menu example plugin has been extended to add a minikube menu which displays minikube status.
Now in a separate terminal
cd app npm i npm start
Now with the app-menus example plugin there should be a minikube menu shown which when extended shows minikube status.
For the create cluster feature #1682