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
Show dialog errors at the top #17221
Conversation
@garrett : Is this the direction that you had in mind? I can't say I like it (it makes the dialog contents jump around), but PF makes this rather clear. So I'm mostly asking whether I am missing something in general, before I spend more time to fix the rest. They all need to be tested individually, e.g. one dialog didn't have a |
@jelly : Thanks for spotting -- I suppose that's another case of missing a |
Yup, it's missing a |
@jelly : Sure, why not -- then let's block this PR on your's as well. |
Yes. And I agree about not liking the contents jump around; I don't like that either and it's probably why it was on the bottom. But, yes, PF is very clear about this. And this is why we should, in most cases, have errors situated at the origin of error (as in: the widget that has problematic data, such as inputs with invalid entries) whenever possible. However, in every single example above, there's no amount of changing the values that can affect the outcome. There's no permission or something going wrong when saving, so there's really no problem pushing down the form which cannot fix the problem anyway... at least in these examples.
Yeah, thankfully we caught that. Forms really should have a If an element is not nested within in a form, then a form association can be attached. Otherwise, its form association is null (which was the case here): (This is about browser implementations and fallbacks.) Here's MDN specifically pointing out It's best to just nest within a
But then note:
(But it should be associated with a form. Ideally nested within. But rare circumstances require the use of the form attribute instead.) |
FWIW: We would ideally have this PR, #17221, and PRs similar to the machines one for modals in Cockpit, Cockpit-Podman, etc. all land in the same release. |
Just checking in: What's the status of this PR? Is it waiting on anything or anyone? (It's still marked as draft, FWIW.) The screenshots look good to me, so I'm happy with what I see so far. Triggering all the errors might be a bit difficult to see it aside from the screenshots, however. |
@garrett : Not blocked, I just didn't find the time to look into this again. This is a huge piece of work, but splitting it up into several independent PRs runs the risk of being inconsistent in a release. |
Whew. I was worried that I was blocking it. 😅 👍
Yep. This is definitely one of those massive PRs that touches a lot of the codebase and needs to be all-in-one. |
Can we get this looked at again and merged soon, please? Thanks! ✨ |
@KKoukiou : Thank you! This may also affect some pixel tests, or don't we have any errors there? |
I will wait for the test results and see :) |
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.
Self approving - but I would love someone else to take a look as well :)
Thanks @KKoukiou for finishing this! The first few changes in the pixel test comparison look like acceptable noise. However, the "Switch to administrative access" dialog got a lot of extra space now, which looks sad. Is this easy to fix? |
Thanks for the comparison screenshots! It's not the only one with extra space, for example: And there's extra space here, too (also above "these changes"; the differentiating space below is due to the scroll region content being different): (And there are a bunch of others, but I think most are variants.) Additionally, there's a bug in the dark theme as seen here: (The white in the table becomes black, whereas the white in the modal becomes dark grey.) ...but it's not a problem in this PR itself; it's just visible here. This one particular bug with the dark theme lists should be fixed elsewhere. |
Nothing uses the footer outside of the Dialog class, and it's not an API that makes much sense on its own. Likewise, the Dialog class is very hard to use standalone without `show_modal_dialog()`, and nothing imports it. Make these private, so that we can change their implementation.
Thanks @KKoukiou ! LGTM, but I can't approve as it's my PR |
Approved! |
isDisabled={ !dialogLoggerValue } | ||
onChange={enable => setDialogProxyValue(enable)} /> | ||
<Stack hasGutter> | ||
{ dialogError && <ModalError dialogError={ _("Failed to configure PCP") } dialogErrorDetail={dialogError} /> } |
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.
This added line is not executed by any test. Details
@@ -71,10 +71,11 @@ const onDialogDone = function(success) { | |||
document.getElementById("demo-dialog-result").textContent = "Dialog closed: " + result + "(" + action + ")"; | |||
}; | |||
|
|||
const onStandardDemoClicked = function(staticError) { | |||
const onStandardDemoClicked = (staticError) => { |
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.
This added line is not executed by any test. Details
const dialogProps = { | ||
title: "This shouldn't be seen", | ||
body: React.createElement(PatternDialogBody, { clickNested: onStandardDemoClicked }), | ||
static_error: staticError, |
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.
This added line is not executed by any test. Details
@@ -316,14 +316,12 @@ const UnlockKey = ({ keyName, load, onClose }) => { | |||
<Button variant='link' onClick={onClose}>{_("Cancel")}</Button> | |||
</> | |||
}> | |||
<> | |||
<Form onSubmit={e => { e.preventDefault(); return false }} isHorizontal> |
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.
This added line is not executed by any test. Details
@@ -278,7 +280,10 @@ class AddMachine extends React.Component { | |||
</Button> | |||
</>} | |||
> | |||
{body} | |||
<Stack hasGutter> | |||
{ this.props.dialogError && <ModalError dialogError={this.props.dialogError} />} |
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.
This added line is not executed by any test. Details
<p>{_("Your browser will remember your access level across sessions.")}</p> | ||
</> | ||
<Stack hasGutter> | ||
{error && <ModalError dialogError={error} />} |
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.
This added line is not executed by any test. Details
@@ -183,6 +182,7 @@ const CryptoPolicyDialog = ({ | |||
</> | |||
} | |||
> | |||
{error && <ModalError dialogError={typeof error == 'string' ? error : error.message} />} |
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.
This added line is not executed by any test. Details
<ModalError dialogError={error} | ||
dialogErrorDetail={errorDetail} />} |
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.
These 2 added lines are not executed by any test. Details
{dialogError && <ModalError dialogError={_("Timer deletion failed")} dialogErrorDetail={dialogError} />} | ||
{reason} | ||
<Stack hasGutter> | ||
{dialogError && <ModalError dialogError={_("Timer deletion failed")} dialogErrorDetail={dialogError} />} |
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.
This added line is not executed by any test. Details
@@ -314,6 +313,7 @@ const TunedDialog = ({ | |||
</> | |||
} | |||
> | |||
{error && <ModalError dialogError={typeof error == 'string' ? error : error.message} />} |
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.
This added line is not executed by any test. Details
See @garrett's review in #17214 (review) . This makes our dialogs comply with PatternFly form validation design.
On main they look like this:
With this PR they look like this:
Initial draft which just converts cockpit-components-dialog and a few
<ModalError>
instances.