Skip to content
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

Inject scene variables in other boxes #1047

Merged
merged 11 commits into from
Jan 25, 2021

Conversation

Pierre-Gilles
Copy link
Contributor

@Pierre-Gilles Pierre-Gilles commented Jan 18, 2021

Pull Request check-list

To ensure your Pull Request can be accepted as fast as possible, make sure to review and check all of these items:

  • If your changes affects code, did your write the tests?
  • Are tests passing? (npm test on both front/server)
  • Is the linter passing? (npm run eslint on both front/server)
  • Did you run prettier? (npm run prettier on both front/server)
  • If you are adding a new features/services, did you run integration comparator? (npm run compare-translations on front)
  • If your changes modify the API (REST or Node.js), did you modify the API documentation? (Documentation is based on comments in code)
  • If you are adding a new features/services which needs explanation, did you modify the user documentation? See the GitHub repo and the website.
  • 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.

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!

@codecov
Copy link

codecov bot commented Jan 18, 2021

Codecov Report

Merging #1047 (a04d53d) into master (d6f521a) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1047      +/-   ##
==========================================
+ Coverage   94.97%   94.99%   +0.01%     
==========================================
  Files         524      524              
  Lines        6944     6950       +6     
==========================================
+ Hits         6595     6602       +7     
+ Misses        349      348       -1     
Impacted Files Coverage Δ
server/lib/scene/scene.actions.js 96.10% <100.00%> (+1.73%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d6f521a...a04d53d. Read the comment docs.

@Pierre-Gilles
Copy link
Contributor Author

Hi @cicoub13 @VonOx @atrovato, I would love a review from you on this PR!

This is how it looks like:

variable-injection.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 :)

Copy link
Contributor

@cicoub13 cicoub13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ok for me. Tested in multiple conditions 👍
On little glitch when I decided to change again the user

inject_user_glitch

{{ is ok to inject variable.

id: `${groupIndex}.${index}.${option.name}`,
text: `${groupIndex + 1}. ${index + 1}. ${option.label}`,
title: `${groupIndex + 1}. ${index + 1}. ${option.label}`,
value: `${groupIndex}.${index}.${option.name}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these values can be computed once and stored in a const instead of cumputing them n times in the loop.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mm I don't follow you

We have:

  • M rows (before this row)
    • Each rows has N boxes
      • Each box has L variables

We loop on each rows before this one, then on each box in each row, then on each variable in each box.

How could we do better?

@Pierre-Gilles
Copy link
Contributor Author

@cicoub13 zIndex problem fixed! :) Thanks!

@Pierre-Gilles Pierre-Gilles merged commit 33aeb5e into master Jan 25, 2021
@Pierre-Gilles Pierre-Gilles deleted the inject-scene-variables-in-other-boxes branch January 25, 2021 09:46
atrovato pushed a commit to atrovato/Gladys that referenced this pull request Feb 21, 2021
* First commit

* Use variable only when ready

* Use tagify directly instead of the react version

* Add test to message sending with variables

* Fix tests

* Optimize code & fix replaceAll bug

* Fix tagify behavior

* Add explanation text + fix UI bug

* Put {{ in const

* Fix zIndex problem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants