diff --git a/core/modules/migrate_drupal_ui/css/components/upgrade-analysis-report-tables.css b/core/modules/migrate_drupal_ui/css/components/upgrade-analysis-report-tables.css new file mode 100644 index 0000000000000000000000000000000000000000..f15ff6a4b4293c5a9f700663adf35951a33f133e --- /dev/null +++ b/core/modules/migrate_drupal_ui/css/components/upgrade-analysis-report-tables.css @@ -0,0 +1,20 @@ +/** + * @file + * Styles for the upgrade analysis report tables. + */ +.upgrade-analysis-report__status-icon:before { + content: ""; + background-size: 16px; + background-position: left center; + background-repeat: no-repeat; + width: 32px; + height: 14px; + display: inline-block; +} + +.upgrade-analysis-report__status-icon--warning:before { + background-image: url(../../../../misc/icons/e29700/warning.svg); +} +.upgrade-analysis-report__status-icon--checked:before { + background-image: url(../../../../misc/icons/73b355/check.svg); +} diff --git a/core/modules/migrate_drupal_ui/migrate_drupal_ui.libraries.yml b/core/modules/migrate_drupal_ui/migrate_drupal_ui.libraries.yml new file mode 100644 index 0000000000000000000000000000000000000000..824ee3330d9ac69a0b388cd3fe5473bfb8b49812 --- /dev/null +++ b/core/modules/migrate_drupal_ui/migrate_drupal_ui.libraries.yml @@ -0,0 +1,5 @@ +base: + version: VERSION + css: + component: + css/components/upgrade-analysis-report-tables.css: {} diff --git a/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php index d747e0ac2c9d423ff8defaa98ff2c41ccd9dadcc..eb192afe86d7daced10839565047472869bcea8e 100644 --- a/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php +++ b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php @@ -486,16 +486,23 @@ public function buildConfirmForm(array $form, FormStateInterface $form_state) { $unmigrated_source_modules = array_diff_key($system_data['module'], $table_data); // Missing migrations. - $form['missing_module_list_title'] = [ - '#type' => 'item', - '#title' => $this->t('Missing upgrade paths'), + $missing_module_list = [ + '#type' => 'details', + '#open' => TRUE, + '#title' => [ + '#type' => 'html_tag', + '#tag' => 'span', + '#value' => $this->t('Missing upgrade paths'), + '#attributes' => ['id' => ['warning']], + ], '#description' => $this->t('The following items will not be upgraded. For more information see <a href=":migrate">Upgrading from Drupal 6 or 7 to Drupal 8</a>.', [':migrate' => 'https://www.drupal.org/upgrade/migrate']), + '#weight' => 2, ]; - $form['missing_module_list'] = [ + $missing_module_list['module_list'] = [ '#type' => 'table', '#header' => [ - $this->t('Source'), - $this->t('Destination'), + $this->t('Source module: Drupal @version', ['@version' => $version]), + $this->t('Upgrade module: Drupal 8'), ], ]; $missing_count = 0; @@ -503,24 +510,39 @@ public function buildConfirmForm(array $form, FormStateInterface $form_state) { foreach ($unmigrated_source_modules as $source_module => $module_data) { if ($module_data['status']) { $missing_count++; - $form['missing_module_list'][$source_module] = [ - 'source_module' => ['#plain_text' => $source_module], + $missing_module_list['module_list'][$source_module] = [ + 'source_module' => [ + '#type' => 'html_tag', + '#tag' => 'span', + '#value' => $source_module, + '#attributes' => [ + 'class' => [ + 'upgrade-analysis-report__status-icon', + 'upgrade-analysis-report__status-icon--warning', + ], + ], + ], 'destination_module' => ['#plain_text' => 'Missing'], ]; } } // Available migrations. - $form['available_module_list'] = [ - '#tree' => TRUE, + $available_module_list = [ '#type' => 'details', - '#title' => $this->t('Available upgrade paths'), + '#title' => [ + '#type' => 'html_tag', + '#tag' => 'span', + '#value' => $this->t('Available upgrade paths'), + '#attributes' => ['id' => ['checked']], + ], + '#weight' => 3, ]; - $form['available_module_list']['module_list'] = [ + $available_module_list['module_list'] = [ '#type' => 'table', '#header' => [ - $this->t('Source'), - $this->t('Destination'), + $this->t('Source module: Drupal @version', ['@version' => $version]), + $this->t('Upgrade module: Drupal 8'), ], ]; @@ -534,21 +556,54 @@ public function buildConfirmForm(array $form, FormStateInterface $form_state) { '#plain_text' => $destination_module, ]; } - $form['available_module_list']['module_list'][$source_module] = [ - 'source_module' => ['#plain_text' => $source_module], + $available_module_list['module_list'][$source_module] = [ + 'source_module' => [ + '#type' => 'html_tag', + '#tag' => 'span', + '#value' => $source_module, + '#attributes' => [ + 'class' => [ + 'upgrade-analysis-report__status-icon', + 'upgrade-analysis-report__status-icon--checked', + ], + ], + ], 'destination_module' => $destination_details, ]; } - $form['counts'] = [ - '#title' => 'Upgrade analysis report', - '#theme' => 'item_list', - '#items' => [ - $this->formatPlural($available_count, '@count available upgrade path', '@count available upgrade paths'), - $this->formatPlural($missing_count, '@count missing upgrade path', '@count missing upgrade paths'), - ], - '#weight' => -15, + + $counters = []; + $general_info = []; + + if ($missing_count) { + $counters[] = [ + '#theme' => 'status_report_counter', + '#amount' => $missing_count, + '#text' => $this->formatPlural($missing_count, 'Missing upgrade path', 'Missing upgrade paths'), + '#severity' => 'warning', + '#weight' => 0, + ]; + $general_info[] = $missing_module_list; + } + if ($available_count) { + $counters[] = [ + '#theme' => 'status_report_counter', + '#amount' => $available_count, + '#text' => $this->formatPlural($available_count, 'Available upgrade path', 'Available upgrade paths'), + '#severity' => 'checked', + '#weight' => 1, + ]; + $general_info[] = $available_module_list; + } + + $form['status_report_page'] = [ + '#theme' => 'status_report_page', + '#counters' => $counters, + '#general_info' => $general_info, ]; + $form['#attached']['library'][] = 'migrate_drupal_ui/base'; + return $form; } @@ -599,7 +654,7 @@ protected function getDatabaseTypes() { * {@inheritdoc} */ public function getQuestion() { - return $this->t('Are you sure?'); + return $this->t('Upgrade analysis report'); } /** diff --git a/core/modules/migrate_drupal_ui/src/Tests/MigrateUpgradeTestBase.php b/core/modules/migrate_drupal_ui/src/Tests/MigrateUpgradeTestBase.php index 046f9c45ce2acee97a3214368aefa90238863586..f785a572b3774e38ef8108b4a881b5463997dac3 100644 --- a/core/modules/migrate_drupal_ui/src/Tests/MigrateUpgradeTestBase.php +++ b/core/modules/migrate_drupal_ui/src/Tests/MigrateUpgradeTestBase.php @@ -149,7 +149,7 @@ public function testMigrateUpgrade() { $this->drupalPostForm(NULL, $edits, t('Review upgrade')); $this->assertResponse(200); - $this->assertText('Are you sure?'); + $this->assertText('Upgrade analysis report'); // Ensure we get errors about missing modules. $this->assertText(t('Source module not found for module_no_annotation.')); $this->assertText(t('Source module not found for modules_available_test.')); @@ -168,7 +168,7 @@ public function testMigrateUpgrade() { $this->drupalPostForm(NULL, $edits, t('Review upgrade')); $this->assertResponse(200); - $this->assertText('Are you sure?'); + $this->assertText('Upgrade analysis report'); // Ensure there are no errors about the missing modules. $this->assertNoText(t('Source module not found for module_no_annotation.')); $this->assertNoText(t('Source module not found for modules_available_test.')); diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php index e322aa3970e1b993ea2acf5b44d5364e2bef7b6e..0b39b2bcc9c0ff388878f475fd0fdb138a62f68c 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php @@ -152,7 +152,7 @@ public function testMigrateUpgrade() { $this->drupalPostForm(NULL, $edits, t('Review upgrade')); $this->assertResponse(200); - $this->assertText('Are you sure?'); + $this->assertText('Upgrade analysis report'); // Ensure we get errors about missing modules. $this->assertSession()->pageTextContains(t('Source module not found for migration_provider_no_annotation.')); $this->assertSession()->pageTextContains(t('Source module not found for migration_provider_test.')); @@ -171,7 +171,7 @@ public function testMigrateUpgrade() { $this->drupalPostForm(NULL, $edits, t('Review upgrade')); $this->assertSession()->statusCodeEquals(200); - $this->assertSession()->pageTextContains('Are you sure?'); + $this->assertSession()->pageTextContains('Upgrade analysis report'); // Ensure there are no errors about the missing modules from the test module. $this->assertSession()->pageTextNotContains(t('Source module not found for migration_provider_no_annotation.')); $this->assertSession()->pageTextNotContains(t('Source module not found for migration_provider_test.'));