Hello everyone,
I’m working on a much-requested feature that I think will be useful to many people: the ability to inject a variable into scenes!
Here’s a sneak peek of the feature:
Edit: the PR:
master ← inject-scene-variables-in-other-boxes
ouvert 02:24PM - 18 Jan 21 UTC
### Pull Request check-list
To ensure your Pull Request can be accepted as fa… st as possible, make sure to review and check all of these items:
- [x] If your changes affects code, did your write the tests?
- [x] Are tests passing? (`npm test` on both front/server)
- [x] Is the linter passing? (`npm run eslint` on both front/server)
- [x] Did you run prettier? (`npm run prettier` on both front/server)
- [x] If you are adding a new features/services, did you run integration comparator? (`npm run compare-translations` on front)
- [x] If your changes modify the API (REST or Node.js), did you modify the API documentation? (Documentation is based on comments in code)
- [x] If you are adding a new features/services which needs explanation, did you modify the user documentation? See [the GitHub repo](https://github.com/GladysAssistant/v4-website) and the [website](https://gladysassistant.com).
- [x] Did you add fake requests data for the demo mode (`front/src/config/demo.json`) so that the demo website is working without a backend? (if needed) See [https://demo.gladysassistant.com](https://demo.gladysassistant.com).
NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open.
### Description of change
Please provide a description of the change here. It's always best with screenshots, so don't hesitate to add some!
(It’s WIP)
I just pushed the first POC of the feature to GitHub. I’m open to any feedback on the PR/test/UX feedback
master ← inject-scene-variables-in-other-boxes
Hi @cicoub13 @VonOx @atrovato, I would love a review from you on this PR!
Th… is is how it looks like:
https://user-images.githubusercontent.com/7365207/104939530-d229c100-59b0-11eb-93e1-87bf4c4bcfe1.mp4
Is the shortcut straightforward? (having to type " {{ " to open the variable list ?) Should we use another trigger ? Like "#" ?
This feature will be extended to basically all input field in scenes, for exemple in the HTTP request it could be super useful to automatically inject a variable into a POST body :)
Hello. I took a look at the PR and there is an initialization error with tagify
Uncaught (in promise) TypeError: _this.props.action.text is undefined
initTagify SendMessageParams.jsx:102
refreshVariables SendMessageParams.jsx:78
promise callback*SendMessageParams/_this.refreshVariables/< SendMessageParams.jsx:76
refreshVariables SendMessageParams.jsx:49
componentWillReceiveProps SendMessageParams.jsx:138
I tried in every way, with different devices or actions in the previous groups
Oh bother! Thanks for the feedback. I’ll let you know when it’s fixed
@cicoub13 normally it’s good I pushed a fix!
Let me know if you see other bugs. Don’t hesitate to brutalize the feature, it needs to be robust!
VonOx
January 22, 2021, 10:26am
7
Hi, I checked out the branch to test.
On Chromium/Firefox nothing pops up when I type {{
So I thought to myself « Vincent, you messed up, you’re not on the right branch »
Apparently yes ^^
Does it only work for sensors?
Well, maybe it’s not clear, but you must have a box that sets a variable to use variables!
Good point
Here’s an example of a scene:
Any ideas on how to make this clearer?
VonOx
January 22, 2021, 10:32am
9
Oh yes it works better ^^
Small glitch on FF
I think we need to indicate (when nothing pops up ^^) that you first need to retrieve the device value.
Because I must admit it wasn’t clear (even if it’s logical in the end).
VonOx:
Small glitch on FF
Oops. I’ll check, but it’s a ready-made library I’m using, I hope it’s not serious ^^
Good idea!
Everything works on Firefox at my place, I think it’s a problem because your box is too long!
Edit: it’s indeed a text size issue.
We could even make the box bigger to allow larger variables to fit:
Before:
After:
I think this feature request can be closed