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

CommentFileSizeAuthor
#54 2864849-54.patch3.86 KBquietone
#45 interdiff.txt2.24 KBquietone
#45 2864849-45.patch3.76 KBquietone
#43 2864849-27.png37.61 KBquietone
#43 2864849-45.png24.1 KBquietone
#37 2864849-37.patch2.98 KBquietone
#37 interdiff.txt941 bytesquietone
#35 interdiff.txt698 bytesquietone
#34 2864849-34.patch2.7 KBquietone
#29 2864849-29.patch2.97 KBjofitz
#29 interdiff-27-29.txt1.09 KBjofitz
#27 Selection_018.png34.4 KBquietone
#27 interdiff.txt2.42 KBquietone
#27 2864849-27.patch1.89 KBquietone
#25 2864849-25.patch1.32 KBjofitz
#25 interdiff-24-25.txt1.51 KBjofitz
#24 2864849-24.patch1.25 KBjofitz
#16 Screen Shot 2018-03-21 at 10.44.58.png52.5 KBrakesh.gectcr
#16 interdiff-2864849-12-16.txt1.65 KBrakesh.gectcr
#16 2864849-16.patch3.31 KBrakesh.gectcr
#12 interdiff.txt1.1 KBquietone
#12 2864849-12.patch3.08 KBquietone
#10 Screenshot from 2018-03-18 22-46-24.png34.55 KBquietone
#10 2864849-10.patch1.79 KBquietone
#7 Selection_005.png31.39 KBquietone
#5 Selection_003.png47.67 KBquietone
#5 2864849-5.patch861 bytesquietone
Selection_003.png28.33 KBquietone
Selection_006.png33.88 KBquietone
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quietone created an issue. See original summary.

Bojhan’s picture

Issue tags: -Needs usability review

No actual change here to review?

yoroy’s picture

Issue tags: +Usability

One 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?

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

quietone’s picture

Status: Active » Needs review
FileSize
861 bytes
47.67 KB

Added 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.

rootwork’s picture

Issue summary: View changes

The 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]").

quietone’s picture

FileSize
31.39 KB

I 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.

heddn’s picture

Status: Needs review » Needs work
Issue tags: -Usability +Needs UX review

Reviewed 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.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

quietone’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
1.79 KB
34.55 KB

Rerolled. And then added text like the install form and uploaded a new screenshot.

Status: Needs review » Needs work

The last submitted patch, 10: 2864849-10.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
FileSize
3.08 KB
1.1 KB

Oh yes, that changed the text output so the test must change too.

quietone’s picture

Issue summary: View changes

This is ready for review.

heddn’s picture

Status: Needs review » Needs work
+++ b/core/modules/migrate_drupal_ui/src/Form/CredentialForm.php
@@ -217,10 +222,11 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
+      $msg = $this->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()]);
...
+        '#items' => [$msg],

Usually an item_list accepts an array of values that become ul/li items. I don't see that happening here.

quietone’s picture

That 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.

rakesh.gectcr’s picture

Status: Needs work » Needs review
FileSize
3.31 KB
1.65 KB
52.5 KB

heddn’s picture

Status: Needs review » Needs work

https://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.

rakesh.gectcr’s picture

$error_message = [
        '#title' => $this->t('Resolve all issues below to continue the upgrade.'),
        '#theme' => 'item_list',
        '#items' => $msg,
      ];

We are adding title there, Please see , https://www.drupal.org/node/1842756

heddn’s picture

+++ b/core/modules/migrate_drupal_ui/src/Form/CredentialForm.php
@@ -222,11 +222,24 @@
+        '#markup' => $this->t('Failed to connect to your database server. The server reports the following message: %error', ['%error' => $e->getMessage()]),
...
+            '#markup' => $this->t('Does the database exist, and have you entered the correct database name?'),

But this is still using #markup instead of just a simple list item array.

quietone’s picture

I 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.

quietone’s picture

Status: Needs work » Postponed

Forgot to set this to postponed. Postponed on #2562845: Validate file path on Credential form

jofitz’s picture

Status: Postponed » Needs work

#2562845: Validate file path on Credential form is now in so no longer postponed.

jofitz’s picture

Assigned: Unassigned » jofitz
Issue tags: +Needs reroll

I'll work on the re-roll.

jofitz’s picture

Re-rolled.

Now working on comments in #17.

jofitz’s picture

Assigned: jofitz » Unassigned
Status: Needs work » Needs review
FileSize
1.51 KB
1.32 KB

Replaced #markup with '#theme' => 'item_list'.

The last submitted patch, 24: 2864849-24.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

quietone’s picture

Thanks 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.

Status: Needs review » Needs work

The last submitted patch, 27: 2864849-27.patch, failed testing. View results

jofitz’s picture

Status: Needs work » Needs review
FileSize
1.09 KB
2.97 KB

Minor test changes to match error wording changes.

heddn’s picture

Do we still need UX review on this? And can we get a new screenshot?

quietone’s picture

Issue summary: View changes

The 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'.

heddn’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs UX review

It 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.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 29: 2864849-29.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
FileSize
2.7 KB

Reroll

quietone’s picture

FileSize
698 bytes

Here is the interdiff

Status: Needs review » Needs work

The last submitted patch, 34: 2864849-34.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
FileSize
941 bytes
2.98 KB

Look like I didn't change the strings for the D7 test.

heddn’s picture

Back to RTBC again.

heddn’s picture

Status: Needs review » Reviewed & tested by the community
Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Needs work

Sorry 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.

quietone’s picture

+++ b/core/modules/migrate_drupal_ui/src/Form/CredentialForm.php
@@ -245,7 +245,8 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
+        $msg = $this->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()]);

I 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()]));

Gábor Hojtsy’s picture

Yeah 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?

quietone’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
24.1 KB
37.61 KB

In #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.

phenaproxima’s picture

Status: Needs review » Needs work
Issue tags: +Usability

Looks great except for a couple of nitpicks. Re-tagging with the Usability tag because yes, this issue does have to do with usability.

  1. +++ b/core/modules/migrate_drupal_ui/src/Form/CredentialForm.php
    @@ -245,7 +245,8 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
    -        $this->errors[$database['driver'] . '][database'] = $e->getMessage();
    

    Let's do $error_key = $database['driver'] . '[database'; and re-use that variable.

  2. +++ b/core/modules/migrate_drupal_ui/src/Form/CredentialForm.php
    @@ -245,7 +245,8 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
    +        $msg = $this->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()]);
    

    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?

  3. +++ b/core/modules/migrate_drupal_ui/src/Form/CredentialForm.php
    @@ -265,13 +266,14 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
    +          $msg = $msg . ' ' . $this->t('The server reports the following message: %error.', ['%error' => $e->getMessage()]);
    

    Should be $msg .= ' ' . $this->t(...)

quietone’s picture

1 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.

phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community

Can we do this in a followup? I'd rather not introduce something that will slow these UI issues down.

Agreed.

RTBC once green on all backends. :)

quietone’s picture

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

larowlan’s picture

+++ b/core/modules/migrate_drupal_ui/src/Form/CredentialForm.php
@@ -226,11 +226,12 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
       try {

@@ -245,7 +246,8 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
+        $msg = $this->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()]);
+        $this->errors[$error_key] = $msg;

do we need this local variable?

quietone’s picture

@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),

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?

Is that OK with you to continue along that path?

larowlan’s picture

Sounds good

larowlan’s picture

Title: Improve database credential form » Improve migrate UI database credential form

New title to make it clear this isn't changing the installer

larowlan’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

No longer applies :(

error: patch failed: core/modules/migrate_drupal_ui/src/Form/CredentialForm.php:226
error: core/modules/migrate_drupal_ui/src/Form/CredentialForm.php: patch does not apply
make: *** [patch87] Error 1
quietone’s picture

And here is the reroll.

phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community

RTBC on green.

larowlan’s picture

Status: Reviewed & tested by the community » Fixed

Fixed on commit

diff --git a/core/modules/migrate_drupal_ui/src/Form/CredentialForm.php b/core/modules/migrate_drupal_ui/src/Form/CredentialForm.php
index 57549b9e10..74b542525e 100644
--- a/core/modules/migrate_drupal_ui/src/Form/CredentialForm.php
+++ b/core/modules/migrate_drupal_ui/src/Form/CredentialForm.php
@@ -3,7 +3,6 @@
 namespace Drupal\migrate_drupal_ui\Form;

 use Drupal\Component\Utility\UrlHelper;
-use Drupal\Core\Database\DatabaseException;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\TempStore\PrivateTempStoreFactory;
 use Drupal\migrate\Exception\RequirementsException;

Committed 61fa673 and pushed to 8.7.x. Thanks!

  • larowlan committed 61fa673 on 8.7.x
    Issue #2864849 by quietone, Jo Fitzgerald, rakesh.gectcr, heddn, yoroy:...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.