bf2fc6cc711aee1a0c2a / kas-ui

Apache License 2.0
7 stars 13 forks source link

Can't have duplicate Kafka names within the organization #217

Closed christiemolloy closed 3 years ago

christiemolloy commented 3 years ago

It looks like this issue has already been Resolved. I just texted the UI and im getting an error for having a duplicate kafka name. We should fix this immediately.

https://issues.redhat.com/browse/MGDSTRM-1204?_sscc=t

christiemolloy commented 3 years ago

@jgiardino Where should the check for the duplication occur? Would you suggest in the validation when the user types in the name for their instance ?

jgiardino commented 3 years ago

There are 2 scenarios where we can display a message. I think we definitely want the 2nd one. I think the first could also be helpful (i.e. don't wait to tell me that my value isn't unique if you know already). So I would suggest implementing both of these if possible:

1. Immediately

Do we have a list of kafka instance names to check against? If so, I would suggest checking as the user types. Another option is to check onBlur. But I think both of these need a list of names to compare the user-entered value immediately against other values.

When we do display a message for this scenario, we only display the field-level message below. We should not display the form-level message before the user tries to submit the form.

2. On submit

There is still a possibility that the user enters a unique name, exits the field, and clicks Submit, and before submitting, another user in the same org created an instance with the same name. Just in case, we should keep the modal open until we have a success back that it was accepted by the server.

We can display the PF progress button in this case, after the user clicks submit. For the progress button, I'd use the text "Submitting request" and add the isDisabled prop as shown:

<Button isDisabled spinnerAriaValueText="Submitting request"
              isLoading={isPrimaryLoading}
              variant="primary"
              ...>
        Create instance
      </Button>

This variant of the button can display either until the modal closes (due to getting back a success) or until an error is returned. If an error is returned by the API, then we display both messages shown below. And the submit button returns to its default state.

The form-level message - scenario 2 ONLY

We already have this form level message that displays on submit when a required field is empty. It should display in scenario 2 for this case too (i.e. only if the user hits submit, and an error is returned).

image

The field-level message - BOTH scenarios

When either of these scenarios happen, the following message can display as helper text below the input: "The name {name} already exists. Please enter a unique name."

Note that the usual helper text would be replaced by this text.

image
jgiardino commented 3 years ago

We discussed this in standup, and will focus on scenario 2 for now. We might also need the api to send a list of names to support scenario 1, so we'll revisit this scenario in the future.