How to hide or disable some context menus from the Theia UI

There are a few context menus in Theia that are causing issues to our users, and we’d like to disable them.

Here are 2 examples:

  • The context menu on Tree View title bars let the user show and hide some of the tree views. Because of Is Theia multi-tenant in any way?, we end up with user A hiding a tree view, and then user B is not able to find that view. So we’d like to simply disable this context menu for all users.
  • In the left side bar, there is a context menu that let the user hide a tree container icon. But when they do that, there is no way (that we could find) to show it back. In our applicaiton we’d like to prevent users from showing or hiding tree container icons, because their display state is tied to user permissions.

Since our tree views are all provided to Theia through VS Code Extensions as Theia plugins, I looked at VS Code Extension APIs to see if there was a way to disabled the context menus. However, it seems we can only contribute new context menu items, but not disable the existing ones.

Could you provide any pointers for how to achieve this maybe with a Theia extension?

Thanks

@drochgenius thank you for the discussion, the removal of the tree-view context-menus is definitely not an ideal situation for your users but if you do want to change the behavior you will likely need to re-implement the way it is done in view-container.ts as part of a custom theia extension.

Note that the context-menu is only one way the views are bound to be problematic with your use-case, the commands will still exist, users will still be able to close views entirely and so on (in addition to other issues such as debugging, terminals, etc.).

@drochgenius I think it is not correct to view the theia back end process as multi-user. That’s simply not the intent. I suspect you’ll keep running into corner cases. It’s more correct to think of the Theia back end as “multi-window”, but “single user”.
That said, I would be very interested in hearing what is lacking in making Theia back ends truly multi-tenant.

One of the problems that arise if you serve multiple users from the same back end is that you’d have to start isolating users from each other, which has security implications.

Thanks @vince-fugnitto, @tsmaeder,

I understand the intent behind Theia. Our application is highly relying on web views which are loaded from a server that lives outside of Theia. We have VS Code plugins to implement the TreeViews, but the data comes from that external server. The server manages user authentication, and permissions, and we’ve added authentication middleware to Theia back-end. It is working pretty well in fact, but Theia is not handling security directly.

We started having issues when Theia implemented the core preferences, because it seems the preferences are not only stored in the browser, but also persisted somehow on the Theia back-end. The most striking issue we initially had was with the color theme. One user would switch the color theme to dark, and suddenly all connected users would see their color theme switch to dark. And vice-versa.

I’ll see what I can do to mitigate, but I totally understand that this is going against the Theia design, and I probably won’t be able to disable all shared controls.

This said, this is a minor issue for us at the moment, and is not a showstopper for using Theia. We’re pretty satisfied with the capabilities of the Theia platform so far, and we’re very happy we chose to use Theia in the first place.

Hi Dominque @drochgenius, would you be willing to share some of your experiences or possibly collaborate. We are creating a number of ‘persona profiles’ (think basic, intermedia, advanced) and are configuring the interface based upon the user. Our data also comes from multiple disparate sources which can be cloud (eg. AWS S3, Google, Asure) or onprem via SFTP or locally mapped.

I would be curious to know about the middleware platforms that you are integrating with if not commercially sensitive. We are targeting n8n/Zapier.

Enjoy

Gavin