Problem/Motivation

Uninstalling a module deletes dashboards that have a block provided by that module

Steps to reproduce

  1. Install Drupal CMS.
  2. Uninstall the Announcement module.
  3. Your welcome dashboard is deleted.

Proposed resolution

Instead of delete the dependent dashboard, the dashboard should show a broken block.
Instead of delete the dependent dashboard, the dashboard should remove the broken block (or section).

Remaining tasks

Fix the dependency calculation so it doesn't delete the dashboard.

User interface changes

None.

API changes

None.

Data model changes

None.

CommentFileSizeAuthor
#2 module-uninstall.png61.65 KBpenyaskito

Issue fork dashboard-3512768

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

penyaskito created an issue. See original summary.

penyaskito’s picture

StatusFileSize
new61.65 KB

I'm not 100% sure if the proposed solution is the right UX.

The user has a confirmation form where it's informed that this would happen. They could always go to the dashboard, remove the offending blocks, and try to uninstall again.

Uninstall confirm form showing the dashboard that will be deleted

catch’s picture

I think this could use ConfigEntityInterface::onDependencyRemoval()

penyaskito’s picture

Issue summary: View changes

Good call, Probably we should do just as in \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay::onDependencyRemoval and remove the block or section affected.

penyaskito’s picture

Issue tags: +Needs tests

That MR is straight copypaste from LayoutBuilderEntityViewDisplay and works as expected. This needs tests tho.

penyaskito’s picture

Status: Active » Needs work
penyaskito’s picture

Assigned: Unassigned » plopesc
Status: Needs work » Needs review
plopesc’s picture

Status: Needs review » Reviewed & tested by the community

Code LGTM!

tested manually and the blocks from the uninstalled dependencies are removed, leaving the rest of the dashboard unaffected.

Marrking as RTBC.

plopesc’s picture

Out of the scope this issue but I wonder if would be worth to open a core issue where these methods would be moved to a trait for scenarios like this.

penyaskito’s picture

Issue tags: -Needs tests
penyaskito’s picture

Issue tags: +Needs followup

Not opening a follow-up now for #10 in core, but tagging this for being able to find it later.

penyaskito’s picture

Title: Uninstalling a module deletes dashboards that have a block provided by that module » Fix uninstalling a module deleting dashboards that have a block provided by that module

  • penyaskito committed a091783e on 2.x
    Issue #3512768 by penyaskito, plopesc, catch: Fix uninstalling a module...
penyaskito’s picture

Status: Reviewed & tested by the community » Fixed

Thanks!

Status: Fixed » Closed (fixed)

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