Hide new functionality in kibana 8.18

Hi All
I’m trying to hide these buttons because users don’t have access to them.
ROR conf
kibana_hide_apps: [“Machine Learning”, “Management”, “Elasticsearch”, “Stack Management”]
kibana => Discover

My suggestions:**
Check out context-aware Discover -** Should be hidden when specifying Management, since the user no longer has access to the space.
Try ES|QL - Maybe we should create a feature that hides all the functionality not available in the basic subscription
**
P.S.**

When I write in kibana_hide “Management”, it doesn’t hide the “Stack Management” button. I don’t know if this is a bug or a feature. But I write “Stack Management” separately.**
**
{“customer_id”: “6c4a385b-2ae8-4f02-a9cd-ef24addfb5b3”, “subscription_id”: “32d4073f-dc2f-4056-a868-842727c637cd”}

Hello @driveirk

Check out context-aware Discover -** Should be hidden when specifying Management, since the user no longer has access to the space.

Sounds reasonable, I will add a task for it

Try ES|QL - Maybe we should create a feature that hides all the functionality not available in the basic subscription

What do you mean by basic subscription? Free Kibana Plan? As I see it’s available in a Free plan, is there any problem with ES|QL query?

When I write in kibana_hide “Management”, it doesn’t hide the “Stack Management” button. I don’t know if this is a bug or a feature. But I write “Stack Management” separately.**

That’s strange, I used the exact list as you ["Machine Learning", "Management", "Elasticsearch"], and it works as expected (I needed to replace a quote from “ to ", but maybe it’s a problem with the forum text formatting)

We require a license. Perhaps this is a problem only with cross-cluster search.
Then please tell me how to hide this button.

It looks like the problem was with the browser cache.
Now it’s hidden for me too. But yesterday, when I was setting it up and constantly changing clients, “Stack Management” kept showing up. Thanks for checking.

There is no native plugin mechanism to disable this button; however, you can write your own solution, thanks to inject custom JS in Kibana mechanism. You can define in your kibana.yml file the path to your custom JS logic

readonlyrest_kbn.kibana_custom_js_inject_file: '<PATH_TO_YOUR_FILE>' # e.g. /usr/share/kibana/custom_kibana.js

and use this js snippet

const headerAppActionMenu = document.querySelector('[data-test-subj="headerAppActionMenu"]');

const observer = new MutationObserver(mutations => {
  mutations.forEach(mutation => {
    mutation.addedNodes.forEach(() => {
      const tryEsQlButton = document.querySelector('[data-test-subj="select-text-based-language-btn"]');
      const checkOutContentAwareDiscover = document.querySelector('.kbnTopNavMenu__badgeGroup');

      if (tryEsQlButton) {
        tryEsQlButton.style.display = 'none';
      }

      if (checkOutContentAwareDiscover) {
        checkOutContentAwareDiscover.style.display = 'none';
      }
    });
  });
});

observer.observe(headerAppActionMenu, { childList: true });

Thanks to it, both Check out context-aware Discover and **Try ES|QL**will be hidden

Something doesn’t work.
There are also lines in the Kibana config:

readonlyrest_kbn.kibana_custom_css_inject: “[data-test-subj*=spacesNavSelector] { display: none !important } [data-test-subj*=homeLink] { display: none !important } [data-test-subj*=discover-addRuntimeField-popove] { display: none !important } [data-test-subj*=discoverOptionsButton] { display: none !important }”

readonlyrest_kbn.kibana_custom_js_inject: “$(‘[data-test-subj*=spacesNavSelector]’).remove() $(‘[data-test-subj*=homeLink’).remove() $(‘[data-test-subj=discover-addRuntimeField-popover’).remove() $(‘[data-test-subj*=discoverOptionsButton]’).remove()”

readonlyrest_kbn.login_html_head_inject: “ body { background: #eee !important;}.ror-logo { visibility: hidden;}.login > h1 { margin: 0 auto; background: url(‘https://host/logo.png’) no-repeat; background-position: center center; background-size: auto;}.ror-logolink { display: none !important;}#form-username, #form-password { background: none white !important; outline: 0; padding: 10px; color: #777; text-shadow: none !important; border: 1px solid #aaa !important; border-radius: 2px !important;}#form-username:focus, #form-password:focus { background: none white !important; color: #777 !important;}.loginButton { color:#fff !important; text-decoration:none; font-size:16px; width:100%; padding:10px 15px; background: #1890ff !important; border:solid 1px #1890ff !important; border-radius: 2px !important; -webkit-border-radius: 2px; -moz-border-radius: 2px}.loginButton:hover{ color:#666; border-color:#40a9ff !important; background: #40a9ff !important; border-radius:2px; -webkit-border-radius:2px; -moz-border-radius:2px}.ror-footer { background: #eee!important; color: #444 !important;}.ror-footer > div > p { visibility: hidden !important; position: relative;}.ror-footer > div > p:after { content: ‘© company’; visibility: visible; display: block; position:absolute; top: 0; left: 0; width: 100%; margin: 0 auto;} .message {color: #f7981d;}”

I tried using a different JS, but it didn’t work either.
Maybe these settings don’t work together?

I created and checked the inline version of this snippet

    readonlyrest_kbn.kibana_custom_js_inject: 'const headerAppActionMenu = document.querySelector("[data-test-subj=headerAppActionMenu]"); const observer = new MutationObserver(mutations => {mutations.forEach(mutation => {mutation.addedNodes.forEach(() => {const tryEsQlButton = document.querySelector("[data-test-subj=select-text-based-language-btn]");const checkOutContentAwareDiscover = document.querySelector(".kbnTopNavMenu__badgeGroup");if (tryEsQlButton) {tryEsQlButton.style.display = "none";}if (checkOutContentAwareDiscover) {checkOutContentAwareDiscover.style.display = "none";}});});});observer.observe(headerAppActionMenu, { childList: true });'

And it works on my side with all other custom style rules. Could you try this inline version?.

BTW. The MutationObserver approach is crucial to make this solution work since we need to listen to discover page appears on the page appears, to be able to hide it dynamically

1 Like

Yes, thank you. It works now.

1 Like