Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

UI/hide sensitive variables #4139

Merged
merged 5 commits into from Nov 1, 2022
Merged

UI/hide sensitive variables #4139

merged 5 commits into from Nov 1, 2022

Conversation

sdav9375
Copy link
Contributor

Closes #2138

Purpose of change

This PR adds a toggle switch on the input variables create/edit form for making an input "sensitive". If the input is set as such, in the list, there will be a badge in place of the displayed which says Sensitive - write only. If the user edits the variable, the value will be hidden and only the placeholder text sensitive - write only will be visible in the text input. The user will be unable to toggle off the sensitive switch and see the variable. If they toggle sensitive off, they will need to provide a new value in the input. This behavior matches HCP. Please note this does not obscure the value from network requests.

Two component tests have been added.

Demo

Screen.Recording.2022-10-31.at.3.40.37.PM.mov

To test the change

  1. Navigate to a project
  2. Click Manage
  3. Click input variables
  4. Create input variable and mark it "sensitive"
  5. See that the variable value is hidden in the list
  6. Edit the variable and see that the value is hidden in the form

@sdav9375 sdav9375 requested a review from a team October 31, 2022 20:00
@github-actions github-actions bot added the ui label Oct 31, 2022
Copy link
Contributor

@amyrlam amyrlam left a comment

Choose a reason for hiding this comment

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

The video and code looks good so far! Left a couple of suggestions.

You'll need to address the failing tests and add a changelog too.

ui/app/components/project-input-variables/list-item.hbs Outdated Show resolved Hide resolved
@@ -150,6 +150,9 @@ form:
variable_name_placeholder: 'var_key'
variable_value: 'Value'
variable_value_placeholder: 'var_value'
variable_set_sensitive: Set as sensitive
variable_value_placeholder_sensitive: 'Sensitive - write only'
variable_form_placeholder_sensitive: 'sensitive - write only'
Copy link
Contributor

Choose a reason for hiding this comment

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

(suggestion) Have the casing for both be 'Sensitive - write only' so that they match?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the way it is in HCP and the accompanying designs so I'm just making them match.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense, but we should follow https://design-system-components-hashicorp.vercel.app/content/writing-guidelines in the future to be consistent with casing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@joshklekamp or @ryenotbread what do you think? This difference in case is how it works in TFC which is what I modeled ours on.

Choose a reason for hiding this comment

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

I think they should match and they should be sentence cased.

Choose a reason for hiding this comment

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

I agree they should match and be sentence cased.

Copy link
Contributor

@amyrlam amyrlam left a comment

Choose a reason for hiding this comment

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

👍 Looks good!

Seems like there were some non-quote auto-prettier edits, but not super important

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ui: The UI should enable users to mark variables as sensitive and hide their values
4 participants