9.7.2. Create custom tabs in the web console
As a cluster administrator, you can customize the OpenShift Container Platform web console by adding customized tabs to the Virtualization page.
Prerequisites
- You have created a dynamic plugin.
- You have cluster administrator permissions.
- You have access to an OpenShift Container Platform cluster where OpenShift Virtualization is installed.
Procedure
Add the
kubevirt.tab/horizontalNavextension to theplugin-extensions.tsfile of theKubeVirtplugin:{ type: 'kubevirt.tab/horizontalNav', properties: { model: { version: 'v1', group: 'kubevirt.io', kind: 'VirtualMachine', }, page: { name: 'Kubevirt Test', href: 'kubevirt-test', }, isVisible: { $codeRef: 'isKubevirtTabVisible' }, component: { $codeRef: 'KubevirtTestTab' }, }, }-
The
componentflag that referencesKubevirtTestTabrefers to the actual tab content that you want to include. The
isVisibleflag refers to the following example code reference:import { K8sResourceCommon } from '@openshift-console/dynamic-plugin-sdk'; const isKubevirtTabVisible = ({ created, }: { created: boolean; obj: K8sResourceCommon & { cluster?: string }; }) => created; export default isKubevirtTabVisible;The
KubeVirtplugin provides this parameter, and it istrueif the referenced object has been already created. This flag ensures that the plugin author can prevent the custom tab from being displayed on certain pages, such as the Create Virtual Machine page.
-
The
Verification
- Log in to the OpenShift Container Platform web console.
- Go to the Virtualization page and verify that the custom tab you have created is visible.
- Go to the Create Virtual Machine page and verify that your custom backup actions or tabs do not appear.