Skip to content

feat(dashboards-ng): support bulk add from widget catalog#2033

Open
chintankavathia wants to merge 1 commit into
mainfrom
feat/dashboards-ng/bulk-add
Open

feat(dashboards-ng): support bulk add from widget catalog#2033
chintankavathia wants to merge 1 commit into
mainfrom
feat/dashboards-ng/bulk-add

Conversation

@chintankavathia

@chintankavathia chintankavathia commented May 11, 2026

Copy link
Copy Markdown
Member

Adds an opt-in multi-select mode to the widget catalog, letting users pick several widgets and add them to a dashboard in one go instead of opening the catalog once per widget.


Documentation.
Examples.
Dashboards Demo.
Playwright report.

Coverage Reports:

Code Coverage

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a bulk selection feature to the widget catalog, allowing users to add multiple widgets to the dashboard simultaneously. The implementation includes UI updates for bulk mode, state management using signals, and updated event emitters. Feedback focuses on ensuring the parent component correctly binds to the new bulk output, preventing unintended selection toggles during search or initialization, and refining the CdkListbox integration and type definitions for better type safety and accessibility.

@chintankavathia chintankavathia force-pushed the feat/dashboards-ng/bulk-add branch 6 times, most recently from 3683127 to 6f608d6 Compare May 12, 2026 05:34
@chintankavathia chintankavathia marked this pull request as ready for review May 12, 2026 05:54
@chintankavathia chintankavathia requested review from a team as code owners May 12, 2026 05:54
@chintankavathia

Copy link
Copy Markdown
Member Author

@panch1739 Please have a look.

@panch1739 panch1739 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chintankavathia Question, the bulk action button is just for demo purposes? Otherwise we should just have the checkboxes always there 🤔

@chintankavathia

Copy link
Copy Markdown
Member Author

@chintankavathia Question, the bulk action button is just for demo purposes? Otherwise we should just have the checkboxes always there 🤔

No its part of the component. I had to keep that explicitly because widgets which requires configurations can not be selected for bulk add. Let me know if you have a better way to handle that situation

@chintankavathia chintankavathia force-pushed the feat/dashboards-ng/bulk-add branch 5 times, most recently from 68b050a to 213675f Compare May 27, 2026 05:40
@chintankavathia chintankavathia added the breaking-changes Marks issues and PRs that are breaking the API label May 27, 2026
@chintankavathia chintankavathia added this to the 50.0.0 milestone May 27, 2026
@chintankavathia chintankavathia force-pushed the feat/dashboards-ng/bulk-add branch 2 times, most recently from a465285 to 3b38089 Compare June 2, 2026 07:24
Adds an opt-in multi-select mode to the widget catalog, letting users
pick several widgets and add them to a dashboard in one go instead of
opening the catalog once per widget.

To enable it, set `enableMultiSelect` on `<si-flexible-dashboard>`:

```
  <si-flexible-dashboard
    [widgetCatalog]="widgets"
    [enableMultiSelect]="true"
  />
```

When enabled, the catalog shows selectable items and a confirmation
action that adds all chosen widgets to the dashboard at once. The
default single-select behavior is unchanged when the flag is omitted.

To support widgets that need configuration before they can render, a
new optional `setupPending` property has been added to `WidgetConfig`.
When `setupPending` is `true`, the dashboard renders a placeholder for
that widget and prompts the user to complete setup. Once the user
confirms the configuration, `setupPending` flips to `false` and the
placeholder is replaced by the actual widget instance. This keeps the
bulk-add flow fast while still allowing widgets that require user
input to be configured afterwards.

DEPRECATED: `SiWidgetCatalogComponent.selected` is deprecated in favor
of `selectedWidgets` and `hasSelection`. The old property only ever
holds the first selected widget and is not updated in multi-select
mode. It will be removed in one of the next major releases. Only
relevant if you extend `SiWidgetCatalogComponent`.
```

BREAKING CHANGE: `SiWidgetCatalogComponent.closed` signature changed
from `output<Omit<WidgetConfig, 'id'> | undefined>` to
`output<Omit<WidgetConfig, 'id'>[] | undefined>`. In single-select mode
the array always contains exactly one entry.

This only affects code that either:
  - subclasses `SiWidgetCatalogComponent` and overrides `closed` or
    calls `this.closed.emit(...)`, or
  - uses `<si-widget-catalog>` directly in a template and subscribes
    to `(closed)`.

Migration for subclasses:
  - Update overridden output type to
    `Omit<WidgetConfig, 'id'>[] | undefined`.
  - Wrap `emit(config)` calls as `emit([config])`.

Migration for direct template consumers:

  Before:

```
    onClosed(config: Omit<WidgetConfig, 'id'> | undefined) {
      if (config) this.addWidget(config);
    }
```

  After:

```
    onClosed(configs: Omit<WidgetConfig, 'id'>[] | undefined) {
      configs?.forEach(config => this.addWidget(config));
    }
```
@chintankavathia chintankavathia force-pushed the feat/dashboards-ng/bulk-add branch from 3b38089 to cef677c Compare June 11, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-changes Marks issues and PRs that are breaking the API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants