Problem/Motivation
I just attended a UX meeting and learned, among other things, that the form to collect database credentials needs some improvement. Specific items pointed out were better explanations, as in where to find the database password, and more helpful error messages.
Current
And this is the form after entering incorrect data, taken from #87 in #2562845: Validate file path on Credential form
After applying patch
Proposed resolution
Add help text as suggested in #3. This has been added by another issue.
Display database related errors in the same way as when installing Drupal.
Remaining tasks
UX Review. Apply patch goto /upgrade/credentials or /upgrade and click through to the credential form.
Commit
User interface changes
Yes, the database credential form used in Drupal upgrade, at /upgrade/credentials
API changes
N/A
Data model changes
N/A
Comment | File | Size | Author |
---|---|---|---|
#54 | 2864849-54.patch | 3.86 KB | quietone |
#45 | interdiff.txt | 2.24 KB | quietone |
#45 | 2864849-45.patch | 3.76 KB | quietone |
#43 | 2864849-27.png | 37.61 KB | quietone |
#43 | 2864849-45.png | 24.1 KB | quietone |
Comments
Comment #2
Bojhan CreditAttribution: Bojhan as a volunteer commentedNo actual change here to review?
Comment #3
yoroy CreditAttribution: yoroy commentedOne basic thing we can do to give some context is add a sentence or two of page-level help text. If there is or will be a handbook page with more detailed instructions we could link to it from there. Something like:
"Provide the information to access the database you want to upgrade. Files can be imported into the upgraded site as well. See the [a]Upgrade documentation for more detailed instructions[/a]"
This information is already there in context of the respective forms so this may not be super great addition if there's not also a docs page to link to :)
As for the error, that looks like the standard wording that mysql itself returns, which may be hard to modify?
Comment #5
quietone CreditAttribution: quietone as a volunteer commentedAdded the help text as suggested in #6 and added a screenshot. This now has a page level help, a help sentence for the Source Database section and no help for the Source Files section. I like consistency, so should we add help to the Files sections or delete the one from the Database section?
Nothing comes to mind on how to improve the error message.
Comment #6
rootworkThe only thing I can think of for improving the error message is doing some regex split on the last closing square bracket, so that we could put the description ("Unknown database...") above or before the error number ("SQLSTATE[HY000] [1049]").
Comment #7
quietone CreditAttribution: quietone as a volunteer commentedI was curious to know what happens when invalid credentials are provided at install time. Maybe this should do the same thing? Here is a screenshot.
Comment #8
heddnReviewed in the weekly migrate maintainers meeting. Tagging more appropriately. It would be super helpful if someone with a UX eye could provide some guidance on what this should look like.
Comment #10
quietone CreditAttribution: quietone as a volunteer commentedRerolled. And then added text like the install form and uploaded a new screenshot.
Comment #12
quietone CreditAttribution: quietone as a volunteer commentedOh yes, that changed the text output so the test must change too.
Comment #13
quietone CreditAttribution: quietone as a volunteer commentedThis is ready for review.
Comment #14
heddnUsually an item_list accepts an array of values that become ul/li items. I don't see that happening here.
Comment #15
quietone CreditAttribution: quietone as a volunteer commentedThat has been around since 8.1. I suspect it is there so that the errors can be displayed with the title "Resolve all the issue below ..." which is taken from update.
Comment #16
rakesh.gectcrComment #17
heddnhttps://api.drupal.org/api/drupal/core%21themes%21stable%21templates%21d... seems to have a title attribute. Perhaps we could utilize it? Also, I wonder if we should soft block this on #2562845: Validate file path on Credential form? Or have that one soft block on this. But I feel better about soft blocking this one.
Comment #18
rakesh.gectcrWe are adding title there, Please see , https://www.drupal.org/node/1842756
Comment #19
heddnBut this is still using #markup instead of just a simple list item array.
Comment #20
quietone CreditAttribution: quietone as a volunteer commentedI agree that this should be worked on after #2562845: Validate file path on Credential form. It is more important to validate those file paths than this improvement. Plus in that issue one can generate several errors so that the whole approach to getting them to display nicely can be one there. After that, this is just a wee bit more on top of that.
I don't remember what a 'soft block' means so I am not changing the status.
Comment #21
quietone CreditAttribution: quietone as a volunteer commentedForgot to set this to postponed. Postponed on #2562845: Validate file path on Credential form
Comment #22
jofitz CreditAttribution: jofitz at ComputerMinds commented#2562845: Validate file path on Credential form is now in so no longer postponed.
Comment #23
jofitz CreditAttribution: jofitz at ComputerMinds commentedI'll work on the re-roll.
Comment #24
jofitz CreditAttribution: jofitz at ComputerMinds commentedRe-rolled.
Now working on comments in #17.
Comment #25
jofitz CreditAttribution: jofitz at ComputerMinds commentedReplaced
#markup
with'#theme' => 'item_list'
.Comment #27
quietone CreditAttribution: quietone as a volunteer commentedThanks Jo Fitzgerald.
The new message is really nice but the display didn't look very good, sorry no screenshot of that. This approach removes the item_list and add inline tags to do the indenting (as seend in core/lib/Drupal/Core/Database/Install/Tasks.php). And now that there is file validation a similar sentence structure is used to display errors from Guzzle. A screenshot shows all the error messages.
Comment #29
jofitz CreditAttribution: jofitz at ComputerMinds commentedMinor test changes to match error wording changes.
Comment #30
heddnDo we still need UX review on this? And can we get a new screenshot?
Comment #31
quietone CreditAttribution: quietone as a volunteer commentedThe screenshot in #27 is the latest and it is now in the IS. The before screenshot is a out of date
Possibly does not need a UX review. There are two changes. One, is to add "The server report the following message" to the beginning of some error messages and that is the same style used in Core/Database/Install/Tasks.php, and files in Core/Database/Driver directory. Two, is to be consistent and use 'Fail' for all failures instead of 'Unable'.
Comment #32
heddnIt is unfortunate that the string in Tasks.php is only slightly different. But it includes words that are specific to an install to so we cannot take advantage of the same translation.
As far as UX review, anything to bring wording into consistency is better UX. Especially as the install process has already gone through UX review. Getting rid of the tag.
And for the same reason, marking RTBC. This is a wording only change to the forms. No functionality has adjusted. Onward and upward.
Comment #34
quietone CreditAttribution: quietone as a volunteer commentedReroll
Comment #35
quietone CreditAttribution: quietone as a volunteer commentedHere is the interdiff
Comment #37
quietone CreditAttribution: quietone as a volunteer commentedLook like I didn't change the strings for the D7 test.
Comment #38
heddnBack to RTBC again.
Comment #39
heddnComment #40
Gábor HojtsySorry to ping-pong on this, but the inline markup in the translatable string is not very good and also leads to possible errors if the translators happen to mistype a (closing) tag that eats up the whole page.
Comment #41
quietone CreditAttribution: quietone as a volunteer commentedI presume you mean this string. I changed the string by making a series of t() functions and separated out the html tags, as is done in language_help in language.module. When that is done the html tags are displayed as text and I don't know how to fix that.
In #32 heddn says that it is unfortunate that we can't use the string in Tasks.php and take advantage of the same translation because they are not the same. But they are the same string. At least, I don't see the difference. If they are the same, can we not use it here? If not, why not and how to fix it?
From Tasks.php
$this->fail(t('Failed to connect to your database server. The server reports the following message: %error.<ul><li>Is the database server running?</li><li>Does the database exist, and have you entered the correct database name?</li><li>Have you entered the correct username and password?</li><li>Have you entered the correct database hostname?</li></ul>', ['%error' => $e->getMessage()]));
Comment #42
Gábor HojtsyYeah if we already have this string, then we can use it. I was hoping we can avoid inlining HTML somehow because this is a big potential for breaking the page with translations :/ If we have no reasonable way in this system, then we can inline the HTML. The above patches attempted to use a rendering process to do that but that was changed to inline HTML without comment as to why was that not adequate. So it is not clear if that was a dead-end that did not work or just did not look good? Or was it for the string reuse?
Comment #43
quietone CreditAttribution: quietone as a volunteer commentedIn #27 I said the display of the error message was not so nice but did not include a screenshot. to correct that I applied the patch in #25 and made a screenshot, 2864849-27.png. As you can see there are multiple lines in bold.
I was able to improve that in this patch, but it still has too many bold lines. See screenshot 2864849-45.png. The patch for this is uploaded but has an extension of .txt to prevent the running of tests.
So, back in #27 is where I discovered that I wasn't able to prevent multiple bold lines in the error message. And still can't as seen in this patch. But when looking at the error messages generated during install for wrong credentials (See #7) it is possible to display the item list without the extra bold line (the #title). Since it makes sense for the error messages displayed here to be the same as error messages displayed during install I searched for how it was as during an install. The search lead me to core/lib/Drupal/Core/Database/Install/Tasks.php. The string used there to display the error messages was copied and pasted in the patch in #27. The same string is used in core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php, core/lib/Drupal/Core/Database/Driver/sqlite/Install/Tasks.php and core/lib/Drupal/Core/Database/Install/Tasks.php. And just noting that the string used in core/lib/Drupal/Core/Database/Driver/mysql/Install/Tasks.php is slightly different.
Comment #44
phenaproximaLooks great except for a couple of nitpicks. Re-tagging with the Usability tag because yes, this issue does have to do with usability.
Let's do
$error_key = $database['driver'] . '[database';
and re-use that variable.What if we put this string in a public static method somewhere in the database system, so we don't have to copy and paste it here?
Should be $msg .= ' ' . $this->t(...)
Comment #45
quietone CreditAttribution: quietone as a volunteer commented1 and 3 Fixed.
2. Can we do this in a followup? I'd rather not introduce something that will slow these UI issues down.
Didn't make new screenshots because there are no changes to the texts and I tested to be sure.
Comment #46
phenaproximaAgreed.
RTBC once green on all backends. :)
Comment #47
quietone CreditAttribution: quietone as a volunteer commentedAnd here is the follow up for 44.2, #2985563: Make translatable string public to avoid copy/paste.
Comment #49
larowlando we need this local variable?
Comment #50
quietone CreditAttribution: quietone as a volunteer commented@larowlan, The intention is to deal with that in the followup #2985563: Make translatable string public to avoid copy/paste and take up phenaproxima's suggestion (44.2),
Is that OK with you to continue along that path?
Comment #51
larowlanSounds good
Comment #52
larowlanNew title to make it clear this isn't changing the installer
Comment #53
larowlanNo longer applies :(
Comment #54
quietone CreditAttribution: quietone as a volunteer commentedAnd here is the reroll.
Comment #55
phenaproximaRTBC on green.
Comment #56
larowlanFixed on commit
Committed 61fa673 and pushed to 8.7.x. Thanks!