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

Clients config updates for census reporting #20125

Merged
merged 4 commits into from
Apr 13, 2023
Merged

Conversation

zofskeez
Copy link
Contributor

The following updates were made to the clients configuration edit view to accommodate census reporting:

  • Adds validation to the retention period form field. Value must be 0 or greater if reporting is disabled and a minimum of 24 with reporting enabled
  • The data collection toggle is disabled when reporting is enabled
  • Copy updates to modal when enabling data collection
  • Model validations were expanded to support a function for the message property

image

@zofskeez zofskeez added the ui label Apr 12, 2023
@zofskeez zofskeez added this to the 1.14 milestone Apr 12, 2023
Comment on lines 16 to 19
if (model.reportingEnabled) {
return 'Retention period must be a minimum of 24 months.';
}
return 'Retention period must be greater than or equal to 0.';
Copy link
Contributor

Choose a reason for hiding this comment

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

I discussed a nit I had with @zofskeez out-of-band:

These errors will be returned by the backend. If we include them statically here, we'll have to make sure they're updated if the contraints are ever updated on the backend. I wonder if there's a way to use the backend errors instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To align with the designs I wonder if we could leverage the current model validations pattern/object shape and maybe create a util that will convert API errors into the validations format that can be passed in to FormField?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think unless the errors from the API can be returned as an object with the key names mapped to the properties that have errors we won't actually know which form field to display the message on though.

Copy link
Contributor

Choose a reason for hiding this comment

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

One idea to still leverage the backend errors is to instead warn here, so submission is still possible. This deviates from the design patterns a bit, but just throwing it out there

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ya that could work but I'm not sure if it's preferable. If the backend value were to change then the form validation might warn that the minimum is 24 and then the API error would say something different like 36 in that message which may be confusing.

Copy link
Contributor

@hellobontempo hellobontempo Apr 12, 2023

Choose a reason for hiding this comment

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

Yeah, exactly. The subtext for the input also contains the minimum value, right? (Edit: nvm, those I guess were the original designs it doesn't seem like the subtext is added here) So either way we have to update the UI if/when the backend changes. Maybe a note in the backend code to update the corresponding UI code (or let the UI team know) if the value is ever changed, @mpalmi ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, that was one option I considered. Another would be to throw the minimum retention months in the config endpoint. I'm okay with either approach. I'll throw a comment in my open PR for now and we can come back to this if we ever need to!

Copy link
Contributor

@hellobontempo hellobontempo left a comment

Choose a reason for hiding this comment

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

Nice job on this! Just some questions/comments, nothing blocking 🚢

@zofskeez zofskeez merged commit f977175 into main Apr 13, 2023
@zofskeez zofskeez deleted the ui/VAULT-15304/census-config branch April 13, 2023 21:57
@zofskeez zofskeez modified the milestones: 1.14, 1.11.12 Jun 13, 2023
zofskeez added a commit that referenced this pull request Jun 13, 2023
* updates clients config view for census reporting

* adds changelog entry

* fixes issue with modal staying open and error not showing on clients config save failure

* adds min retention months to clients config model and form validation
zofskeez added a commit that referenced this pull request Jun 13, 2023
* updates clients config view for census reporting

* adds changelog entry

* fixes issue with modal staying open and error not showing on clients config save failure

* adds min retention months to clients config model and form validation
zofskeez added a commit that referenced this pull request Jun 13, 2023
* updates clients config view for census reporting

* adds changelog entry

* fixes issue with modal staying open and error not showing on clients config save failure

* adds min retention months to clients config model and form validation
zofskeez added a commit that referenced this pull request Jun 13, 2023
* updates clients config view for census reporting

* adds changelog entry

* fixes issue with modal staying open and error not showing on clients config save failure

* adds min retention months to clients config model and form validation
zofskeez added a commit that referenced this pull request Jun 14, 2023
…1.11.x (#21208)

* Clients config updates for census reporting (#20125)

* updates clients config view for census reporting

* adds changelog entry

* fixes issue with modal staying open and error not showing on clients config save failure

* adds min retention months to clients config model and form validation

* removes model-form-field decorator from clients config model
zofskeez added a commit that referenced this pull request Jun 14, 2023
* updates clients config view for census reporting

* adds changelog entry

* fixes issue with modal staying open and error not showing on clients config save failure

* adds min retention months to clients config model and form validation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants