-
Notifications
You must be signed in to change notification settings - Fork 243
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
Toggle Polling from the UI #174
Toggle Polling from the UI #174
Conversation
@michelvocks I might have to pick your brain on how to go about with a Toggle button. I want to get its state and set it to green or something based on the state of the config. And then toggling that will change the config value. |
Codecov Report
@@ Coverage Diff @@
## master #174 +/- ##
==========================================
- Coverage 66.82% 66.69% -0.13%
==========================================
Files 33 35 +2
Lines 2607 2681 +74
==========================================
+ Hits 1742 1788 +46
- Misses 642 671 +29
+ Partials 223 222 -1
Continue to review full report at Codecov.
|
You can use vue-bulma-switch for this. It's pretty old and not really updated but basically all our current components are based on vue-bulma so I think it makes sense. Let me know if you need something else. |
Cool, thanks! |
Uh, we will have to eventually take this apart into smaller files or something. Navigating this view is becoming difficult. :) I don't know how vue works but that should be possible. :) |
Oh! I see how permissions did it. I'll do that same. :) Extract settings into there. Nice. |
@michelvocks This looks like shit right now. :D But actually works. :) the toggle and all work together stopping / starting the poller. :) And the button is set to on and off on mounting so it shows what the value currently is. Which is nice. :D I also tried turning it on and off a hundred times or so quickly to see if I can break the underlying channel logic. But seems to work okay. :) I'll try and come up with a design for this. And write some handler tests. :) |
@Skarlso Cool. Looking forward to trying it out. This is also a solid foundation for additional settings 👍 |
@michelvocks yeah I'm trying to work out a better way of doing this 🤔 Maybe save all the possible settings in a map pointer with string keys or something. I'll do some more thinking on it. It would be cool to have something common that all the settingon-off methods could use. You still would have get set methods for individual settings but they would use something common. But maybe it's not worth it. Don't know until I have a go at it. :) I don't want to use reflection either. |
@Skarlso I think you can just use a struct like we normally do: https://github.com/gaia-pipeline/gaia/blob/master/frontend/client/views/pipeline/create.vue#L336 |
Yes. But the settings are of different types. And I sort of thought for something like: setSetting(name, key, string) bamm, done. :D But that's not going to work. Unless we use something like, flag.Func or something like that which takes a function and would handle conversion. Not sure yet. |
I think it's easier to send all settings in a struct and check in the backend what has changed. |
I was thinking about that too to just always send everything. But I don't like that. :) I would like to keep the Json size to a bare minimum. If we always send / get everything that will increase the amount of bandwidth Gaia is using. |
Eh, I don't know. Maybe it's okay for now. I don't see how we'd change some of the other config settings like port of server address or working directory without the need to restart Gaia anyways. Maybe if another setting presents itself, then we'll consider refactoring. |
@michelvocks found a nicer button ;) Easier to change programatically too. |
Nice! 🤗 |
@michelvocks Read for you man. :) Increases coverage \o/ |
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.
One minor thing. Overall LGTM 👍
@Skarlso One additional thing we should think about: What happens when you restart Gaia or it crashes? The change you made in the UI is basically lost. |
@michelvocks Our flag implementation now supports environment files. We could write this out in that file which does take precedence. I'm reluctant to use a dB to configure start up time configuration. The Environment file is a better choice in that case I think. |
Uh, the file approach sucks because I can't really overwrite. I can search and append, or fseek. But it isn't particularly pretty. :/ I will have to resort to the DB. |
Oh yeah so the question is, which one would be used first.... I'm going with the bbolt setting being of higher importance. |
@michelvocks alright. this is ready for review again. I tested it manually too. Turned it on, quit Gaia, started it up again, and setting was still on. :) |
28becd5
to
131b37d
Compare
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.
LGTM. Thanks a lot @Skarlso 🤗
No description provided.