-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Allow users to configure what is shown on environment variable template tags #4277
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
Allow users to configure what is shown on environment variable template tags #4277
Conversation
|
@wdawson / @falondarville here's a demo of this feature (which already existed, I just added a setting for it so users can access it). https://www.loom.com/share/0fee8e05315741c5bfe3f8c8c4d19dce Here's what the title and tooltip currently show Could you please let me know if you'd like these reworded? |
Is "Show variable values" clearer for the title? The tooltip could read: "Shows the source and value of the variables instead of the variable name on the template tags" CC - @falondarville |
|
@develohpanda @wdawson thoughts? If checked, reveals the environment variable source and value in the template tag. Otherwise, hover over the template tag to see the source and value. |
|
I like that too, the fallback! It's informative. @falondarville Does that use Wils's title suggestion of "Show variable values"? |
|
Should it be "Show variable source and values"? I lean towards wanting to be explicit and we have some longer check box titles, so it won't look off |
Agree! As long as there's the space to do it. |
dimitropoulos
left a comment
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.
noticed we're missing typings in the nunjucks extension for isVariableUncovered. very tempted to add the handle render types as well, but I didn't.. heh. b87a87c did it if you wanna take a look (it's outside of the line scope of this changeset on GitHub so I can't comment on it here)
packages/insomnia-app/app/ui/components/key-value-editor/key-value-editor.tsx
Show resolved
Hide resolved
packages/insomnia-app/app/ui/components/viewers/grpc-tabbed-messages.tsx
Show resolved
Hide resolved
| await this._updateIsVariableUncovered(); | ||
| }, | ||
| ], | ||
| [hotKeyRefs.ENVIRONMENT_UNCOVER_VARIABLES, this._updateIsVariableUncovered], |
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.
so, looking at this, this won't totally work, yet, because we need to do some work to get the current restart requirement to go away, right? I'm on board with not fixing that in this PR -> just wanted to make sure I'm understanding it correctly. If that's the case, can you please make a ticket for fixing that part so we can triage for the future?
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.
| const valueAndContext = contextForKey ? `{${contextForKey}}: ${title}` : title; | ||
|
|
||
| // Swap what's shown in the tooltip vs the innerHTML | ||
| innerHTML = isVariableUncovered ? valueAndContext : cleanedStr; |
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.
I wish there was some way to not have to do all the drilling inside of this extension code. There's no "react" here so a hook selector makes no sense... so it is what it is I guess. curious, though, if you've thought of anything (even, that we could potentially try in the future) to get this extension code to be less of an ugly duckling in terms of its capabilities compared to the rest of our codebase.
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.
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.
it's really incredible. TWO HUNDRED and THIRTY NINE usages in the app before, when all we ever needed was:
- 1 usage for the settings tab in preferences (which, haha, we didn't bother having before, thanks for adding!!)
- 1 usage for the hotkey execution logic
- 2 usages in the nunjucks-tags extension
and.... that's it!
wonderful! wonderful wonderful!
I pushed some commits to https://github.com/dimitropoulos/insomnia/commits/feature/ins-1226-remove-isvariableuncovered-prop-drilling referenced in the feedback.
| <BooleanSetting | ||
| label="Show variable source and values" | ||
| help="If checked, reveals the environment variable source and value in the template tag. Otherwise, hover over the template tag to see the source and value." | ||
| setting="isVariableUncovered" |
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 to have a variable name that matches the new label somewhat, but the migration may not be worth the benefit now its usage is simpler to understand. Besides that, nice job.
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.
Great point 👍🏽 renamed to showVariableSourceAndValue. The good thing is because this didn't previously exist in the database, no migration was necessary, just a find and replace in code. 2e5d639
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.
GREAT point @jackkav. speaking personally, I think my head was too deep in the current falling sands of low-level concepts to notice this high-level thing.
|
@dimitropoulos thank you for the commits! Have pulled them in 💯 |


changelog(Improvements): Now you can configure whether values are shown for environment variable template tags
Demo
https://www.loom.com/share/0fee8e05315741c5bfe3f8c8c4d19dce
Summary
This PR does:
This PR doesn't:
In the future:
foo,host, etc)bar,https://insomnia.rest)The initial request for this came from #754, was resolved in #1274, but it got lost somewhere. Seems like a valuable thing to have. The only place this is configurable right now is via a hotkey, but I added a setting for it.
TODO:
Closes INS-1226