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

fix: ds-839 block modal form submissions #517

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

cdcabrera
Copy link
Contributor

@cdcabrera cdcabrera commented Nov 14, 2024

What's included

  • fix: ds-839 block modal form submissions

Notes

  • leverages existing toast notification layout to aid in preventing modal closing after form submission
  • basic blocking for modal forms for
  • what this doesn't do
    • enhance the toast notification messages or perform inline form messaging.
    • give some level of loading indicator for the form submission

How to test

Local run check

  1. update the NPM packages with $ npm install
  2. $ npm run start:stage
  3. confirm basic form submission for
    • Add/Edit sources is blocked with a toast notification
    • Adding a scan is blocked with a toast notification
    • Adding a credential is blocked with a toast notification

Example

expected basic toast notifications
Screenshot 2024-11-14 at 2 06 55 PM (2)
Screenshot 2024-11-14 at 2 06 39 PM (2)
Screenshot 2024-11-14 at 2 06 12 PM (2)

Updates issue/story

DISCOVERY-839

@cdcabrera cdcabrera marked this pull request as ready for review November 14, 2024 20:03
@cdcabrera cdcabrera requested review from nicolearagao and a team November 14, 2024 20:04
Copy link
Contributor

@mirekdlugosz mirekdlugosz left a comment

Choose a reason for hiding this comment

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

I have tested that locally. Covered create credential modal, create source modal, edit source modal and new scan modal. Edit credential is worked on in another PR, we will need to test that modal once at least one of PRs is merged and other is rebased.

Overall it works as we intended for this stage. There are three problems I have noticed, only first of which I would consider required. I'm putting all three here in case they can be fixed cheaply while doing the required one. If not, let me know, I will create tickets for them and we will handle them in due time.

Problem 1 (required)

If I don't fill scan name, there are going to be two toast notifications.

Steps:

  1. Create credential and scan of any type
  2. Go to Sources and click "Scan" link for any source
  3. Leave "Name" field empty
  4. Click Save

Result:

Screenshot from 2024-11-18 19-11-08

Problem 2 (optional)

Error messages from server are processed before being displayed. As a result there are HTML entity codes and backslash character may be missing.

Steps:

  1. Create credential of network type
  2. Go to Sources and click "Add Source" -> "Network range"
  3. Fill all fields
  4. In "Search addresses", insert 192.1.5.1/

Result:
(note #x2F; and that there is single backslash instead of two)

Screenshot from 2024-11-18 18-34-13

Problem 3 (optional)

Field names from server errors are missing. Error messages are constructed by extractErrorMessage, but that one looks only into response values - while response object keys contain important contextual information.

At one point we have discussed introducing a copy of extractErrorMessage function, but one that would also display error keys. The idea would be that we don't want to modify existing function due to regression testing surface that would require. But not sure if it's something we can do, as I don't see extractErrorMessage called explicitly in this PR anywhere.

Steps:

  1. Go to Credentials and click "Add Credential" -> "Network range"
  2. Leave form empty and click "Save"

Result (no duplicated "This field is required.")

Screenshot from 2024-11-18 19-10-18

@cdcabrera
Copy link
Contributor Author

cdcabrera commented Nov 19, 2024

@mirekdlugosz not going to be expanding this PR

reasons

  • Technically this work still has to happen regardless of how advanced or basic the end-result work is
  • This PR is simply exposing what was already happening inside the UI. It is the exact same messages as before with slightly different behavior

Iteration to maintain timeline is the key here, expanding this PR instead would be scope creep

* edit: my internal volunteer time still needs to be considered. you all are more than welcome to iterate on this work in subsequent PRs

Copy link
Member

@nicolearagao nicolearagao left a comment

Choose a reason for hiding this comment

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

we've agreed that we will iterate on this one.

Copy link
Contributor

@mirekdlugosz mirekdlugosz left a comment

Choose a reason for hiding this comment

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

@justinkreft and @gtanzillo agree problem number 1 is not a release blocker. I have created a Jira DISCOVERY-859 so we can fix that later.

For problem number 2, I have created Jira DISCOVERY-856.

For problem number 3, I had hoped this is something we can improve cheaply before the release. Since we can't, I feel that after the release our efforts are better spent on putting these error messages near fields instead of toasts. Something like a work done in #511 . So there is no separate ticket for this.

@cdcabrera cdcabrera merged commit e9a6a5e into quipucords:main Nov 20, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants