# How to disable inpect Action from visualisations context menu options

**URL:** <https://discuss.elastic.co/t/how-to-disable-inpect-action-from-visualisations-context-menu-options/313857>\
**Category:** Kibana\
**Tags:** kibana-plugin-development\
**Created:** [September 7, 2022, 7:55am UTC](https://discuss.elastic.co/t/how-to-disable-inpect-action-from-visualisations-context-menu-options/313857 "2022-09-07T07:55:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanskar-panchal-gith](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sanskar-panchal-gith/32/103339_2.png) [@sanskar-panchal-gith](https://discuss.elastic.co/u/sanskar-panchal-gith)\
**Post date:** [September 7, 2022, 7:55am UTC](https://discuss.elastic.co/t/how-to-disable-inpect-action-from-visualisations-context-menu-options/313857/1 "2022-09-07T07:55:11Z")

</div>

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](https://us1.discourse-cdn.com/elastic/original/3X/2/d/2d778b61e60fff69d9a8710d98f1f0d0065d33cc.png)

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

---

<div class="post-metadata">

**Author:** ![cheiligers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cheiligers/32/73114_2.png) [@cheiligers](https://discuss.elastic.co/u/cheiligers)\
**Post date:** [September 28, 2022, 5:22pm UTC](https://discuss.elastic.co/t/how-to-disable-inpect-action-from-visualisations-context-menu-options/313857/2 "2022-09-28T17:22:17Z")

</div>

@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](https://github.com/elastic/kibana/pull/76497) was added to a while ago to 8.0.0.

---

<div class="post-metadata">

**Author:** ![sanskar-panchal-gith](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sanskar-panchal-gith/32/103339_2.png) [@sanskar-panchal-gith](https://discuss.elastic.co/u/sanskar-panchal-gith)\
**Post date:** [October 3, 2022, 5:29am UTC](https://discuss.elastic.co/t/how-to-disable-inpect-action-from-visualisations-context-menu-options/313857/3 "2022-10-03T05:29:03Z")

</div>

@cheiligers , I am using version 7.17.1

---

<div class="post-metadata">

**Author:** ![cheiligers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cheiligers/32/73114_2.png) [@cheiligers](https://discuss.elastic.co/u/cheiligers)\
**Post date:** [October 5, 2022, 3:21pm UTC](https://discuss.elastic.co/t/how-to-disable-inpect-action-from-visualisations-context-menu-options/313857/4 "2022-10-05T15:21:03Z")

</div>

@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

---

<div class="post-metadata">

**Author:** ![sanskar-panchal-gith](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sanskar-panchal-gith/32/103339_2.png) [@sanskar-panchal-gith](https://discuss.elastic.co/u/sanskar-panchal-gith)\
**Post date:** [October 6, 2022, 7:49am UTC](https://discuss.elastic.co/t/how-to-disable-inpect-action-from-visualisations-context-menu-options/313857/5 "2022-10-06T07:49:41Z")

</div>

@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

```auto
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,
    });
  };

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 3, 2022, 7:49am UTC](https://discuss.elastic.co/t/how-to-disable-inpect-action-from-visualisations-context-menu-options/313857/6 "2022-11-03T07:49:44Z")

</div>

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