Add Vanilla JavaScript actions#1438
Merged
ArturoManzoli merged 3 commits intobluerobotics:masterfrom Nov 12, 2024
Merged
Conversation
29cd35c to
38ee5bb
Compare
ArturoManzoli
requested changes
Nov 11, 2024
Contributor
ArturoManzoli
left a comment
There was a problem hiding this comment.
Since there is no 'auto save', if the user is typing its code on the dialog and accidentally clicks on the backdrop, the dialog will close and all code will be lost.
Make the v-dialog persistent using a prop with this name, or make the text persistent on the 'JavaScript Code' input field.
Comment on lines
+319
to
20
| import JavascriptActionConfig from '@/components/configuration/JavascriptActionConfig.vue' | ||
| import MavlinkMessageActionConfig from '@/components/configuration/MavlinkMessageActionConfig.vue' |
Contributor
There was a problem hiding this comment.
Since you have made the atomization for the JavascriptActionConfig and MavlinkMessageActionConfig components, placing them inside src/components, I think would be nice to also do the same with the 'HTTP Request Actions' part on this template.
Member
Author
There was a problem hiding this comment.
Definitely! Will do that now.
This way free JavaScript functions, for example, can take advantage of them.
With this, the user can create vanilla JavaScript methods that can be called from anywhere in the application. This basically allows one to extend Cockpit capabilities to anything.
For the sake of code maintainability.
38ee5bb to
be48112
Compare
ArturoManzoli
approved these changes
Nov 12, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With this, the user can create vanilla JavaScript methods that can be called from anywhere in the application.
This basically allows one to extend Cockpit capabilities to the infinite and beyond.
I also exposed the cockpit-actions and data-lake methods globally, so the user can call those from their functions. They are accessible under
window.cockpit.Once we merge the DIY widget, I will change the current
v-text-fieldwith a proper Monaco editor.Fix #569