-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Allow switching sub-environment inside Manage Environment modal #2891
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
Conversation
Wow, thanks a lot for tackling this @cobwebsonsale! 🤗 |
Requesting a review here. |
I'm sorry about the mega delays @cobwebsonsale 😞 I'll try to at least give a prelim review this this week |
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.
Thank you for the PR, QA'd locally and seems to be working as intended, and thanks for splitting up your work into individual commits which made the rename and feature easier to review. 🙌🏽
My apologies for the delays. Unfortunately the team is spread quite thin at the moment, evident by the sheer number of open-source PRs we need to get through. We currently have a code-freeze in place for migrating to typescript, but once that is done I'll come back to this PR to merge it.
Nice, that's good to know. And no worries about the delay. I want to contribute to help, not to add stress. xD So please take your time and merge this accordingly. Bumped only so it stays on the radar. Let me know when you come around to this and there are conflicts, I'm surprised there weren't already. |
Sounds good 👍🏽 This is a note to myself to double-check the caveat you describe above and whether that's a concern right now; with the testing done so far it seemed to be fine |
I updated this branch for TypeScript: it seems to be working well - https://github.com/dimitropoulos/insomnia/commits/feature/switch-env-ts The first commit is yours (please let me know if I messed up anything on the revival) and the second commit is to fix some TypeScript errors now that we're actually using types for Please take a look. If everything is ok, I can push that branch to this one and update this PR, at which point we should be ready (or nearly ready) to go. |
@dimitropoulos having Please push those changes up to |
- Show env status next to name - Add tooltip for statuses - Show env after activation
note the end of line 5. that was the reason none of these types were used before.
15f1868
to
bbee7d3
Compare
@develohpanda sure, I un-squashed the rename and pushed to the PR's branch. |
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.
Alright, double checked again and it looks good to me
Could not re-render the currently selected environment in the right-pane after activation, so showing the activated environment instead. The re-render only makes sense when Base Environment is selected, as a different active environment changes the validations on variables.
I worked through this caveat you described; it's interesting that the re-render doesn't occur but when hovering over a template tag in the base environment the sub environment in that tooltip does change but the resolved value does not. This leads me to believe there must be a bug somewhere and that it should work automatically.
Regardless, I still think what you have is fine for this iteration. 🎉
packages/insomnia-app/app/ui/components/modals/workspace-environments-edit-modal.tsx
Show resolved
Hide resolved
@@ -225,7 +261,7 @@ class WorkspaceEnvironmentsEditModal extends PureComponent<Props, State> { | |||
|
|||
// Unset active environment if it's being deleted | |||
if (activeEnvironmentId === environment._id) { | |||
await handleChangeEnvironment(null); | |||
handleChangeEnvironment(null); |
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.
Removal of this await actually shows a bug where Wrapper._handleChangeEnvironment
function swallows a promise. It should be awaited correctly so we don't proceed to delete an environment until the change is complete.
Can be handled separate to this PR
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.
Product perspective: Good addition, once merged we should probably do a design pass but that doesnt have to happen right now.
Closes #2761
activeEnvironment
toselectedEnvironment
inWorkspaceEnvironmentsEditModal
(to avoid confusion) -- separated in another commit, for easier review/revert.Caveat:
Could not re-render the currently selected environment in the right-pane after activation, so showing the activated environment instead. The re-render only makes sense when Base Environment is selected, as a different active environment changes the validations on variables. Tried:
_load
,activeEnvironmentId
tostate
insideWorkspaceEnvironmentsEditModal
and setting state, andactiveEnvironmentId
fromactiveWorkspaceMeta
inWrapper
, as that is what gets updated inhandleChangeEnvironment
Demo:
