How to disable inpect Action from visualisations context menu options

Hi ,

I have been working on a custom kibana plugin to render a dashboard.
I am using dashboard.getDashboardContainerByValueRenderer(); to render the dashboard.

I want to disable some actions from the context menu of the visualisations.
-Logs-Web-Traffic-Elastic

I am able to pass id's of the actions that needs to be disabled as disabledActions: ["action-id-1",""] to the explicitInput of the panel JSON.
I am able to disable all actions in the dashboard except "Inspect" action , which is part of Universal/Base Actions.
Is there any way by which Inspect Action with ID "openInspector" can be disabled ?

Thanks

@sanskar-panchal-gith What version of the stack are you using? Dashboards and visualizations have changed quite a lot over the most recent minors and grouping was added to a while ago to 8.0.0.

@cheiligers , I am using version 7.17.1

@sanskar-panchal-gith I reached out to the team who owns the domain and they confirmed that disabling the Inspect option would require a code change in your plugin.
They also recommend that the best fix would be to be able to exclude actions from the default actions using disabledActions.

cc @devon.thomson

@devon.thomson @cheiligers
I am able to disable all other actions by passing action_ids into disabledActions array.
But for inspect action it is not getting disable by passing the id "openinspector".

I checked the code which removes actions based on the ids provided in disabledActions array,
there after removing actions passed in disabledActions array from panel context menu then inspect action is added to the panel context menu.

This is the function which has the code :
in file : src/plugins/embeddable/public/lib/panel/embeddable_panel.tsx

private getActionContextMenuPanel = async () => {
    let regularActions = await this.props.getActions(CONTEXT_MENU_TRIGGER, {
      embeddable: this.props.embeddable,
    });

    const { disabledActions } = this.props.embeddable.getInput();
    if (disabledActions) {
      const removeDisabledActions = removeById(disabledActions);
      regularActions = regularActions.filter(removeDisabledActions);
    }

    let sortedActions = regularActions
      .concat(Object.values(this.state.universalActions || {}) as Array<Action<object>>)
      .sort(sortByOrderField);

    if (this.props.actionPredicate) {
      sortedActions = sortedActions.filter(({ id }) => this.props.actionPredicate!(id));
    }

    return await buildContextMenuForActions({
      actions: sortedActions.map((action) => ({
        action,
        context: { embeddable: this.props.embeddable },
        trigger: contextMenuTrigger,
      })),
      closeMenu: this.closeMyContextMenuPanel,
    });
  };

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.