I want to remove widgets from the widget selector popup that are already on the dashboard. If I can interact with the widget selector popup, I’m sure I can do this. Is it possible to interact with the widget selector or is there another way to do this?
You can create a custom parameter in you Dashboard component called totalAvailableWidget, this should be the same as the availableWidgets in the Props of your dashboard component.
Maybe you can copy and paste it.
Later, add this script to the Add Change Script to the props.widgets of the dashboard component.
available = self.custom.totalAvailableWidgets
currentName = set([widget["name"] for widget in self.props.widgets])
newAvailableWidgets = []
for widget in available:
if widget["name"] in currentName:
continue
newAvailableWidgets.append(widget)
self.props.availableWidgets = newAvailableWidgets
1 Like