UNPKG

@openshift-console/dynamic-plugin-sdk

Version:

Provides core APIs, types and utilities used by dynamic plugins at runtime.

44 lines (43 loc) 1.76 kB
import { ExtensionK8sKindVersionModel } from '../api/common-types'; import { Extension, ExtensionDeclaration, CodeRef } from '../types'; import { K8sResourceCommon } from './console-types'; export type PageComponentProps<R extends K8sResourceCommon = K8sResourceCommon> = { filters?: any; selected?: any; match?: any; obj?: R; params?: any; customData?: any; showTitle?: boolean; fieldSelector?: string; }; /** This extension can be used to add a tab on the resource details page. */ export type HorizontalNavTab = ExtensionDeclaration<'console.tab/horizontalNav', { /** The model for which this provider show tab. */ model: ExtensionK8sKindVersionModel; /** The page to be show in horizontal tab. It takes tab name as name and href of the tab. * Note: any special characters in href are encoded, and href is treated as a single * path element. */ page: { name: string; href: string; }; /** The component to be rendered when the route matches. */ component: CodeRef<React.ComponentType<PageComponentProps>>; }>; /** Adds a tab to a horizontal nav matching the `contextId`. */ export type NavTab = ExtensionDeclaration<'console.tab', { /** Context ID assigned to the horizontal nav in which the tab will be injected. * Possible values: * - `dev-console-observe` */ contextId: string; /** The display label of the tab */ name: string; /** The href appended to the existing URL */ href: string; /** Tab content component. */ component: CodeRef<React.ComponentType<PageComponentProps>>; }>; export declare const isHorizontalNavTab: (e: Extension) => e is HorizontalNavTab; export declare const isTab: (e: Extension) => e is NavTab;