UNPKG

@openshift-console/dynamic-plugin-sdk

Version:

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

1,931 lines (928 loc) 94.4 kB
# OpenShift Console API | API kind | Exposed APIs | | -------- | ------------ | | Variable (82) | [ActionServiceProvider](#actionserviceprovider), [BlueInfoCircleIcon](#blueinfocircleicon), [CamelCaseWrap](#camelcasewrap), [checkAccess](#checkaccess), [CodeEditor](#codeeditor), [consoleFetch](#consolefetch), [consoleFetchJSON](#consolefetchjson), [consoleFetchText](#consolefetchtext), [DocumentTitle](#documenttitle), [ErrorBoundaryFallbackPage](#errorboundaryfallbackpage), [ErrorStatus](#errorstatus), [GenericStatus](#genericstatus), [getAPIVersionForModel](#getapiversionformodel), [getGroupVersionKindForModel](#getgroupversionkindformodel), [getGroupVersionKindForResource](#getgroupversionkindforresource), [GreenCheckCircleIcon](#greencheckcircleicon), [HorizontalNav](#horizontalnav), [InfoStatus](#infostatus), [InventoryItem](#inventoryitem), [InventoryItemBody](#inventoryitembody), [InventoryItemLoading](#inventoryitemloading), [InventoryItemStatus](#inventoryitemstatus), [InventoryItemTitle](#inventoryitemtitle), [isAllNamespacesKey](#isallnamespaceskey), [k8sCreate](#k8screate), [k8sDelete](#k8sdelete), [k8sGet](#k8sget), [k8sList](#k8slist), [k8sListItems](#k8slistitems), [k8sPatch](#k8spatch), [k8sUpdate](#k8supdate), [ListPageBody](#listpagebody), [ListPageCreate](#listpagecreate), [ListPageCreateButton](#listpagecreatebutton), [ListPageCreateDropdown](#listpagecreatedropdown), [ListPageCreateLink](#listpagecreatelink), [ListPageHeader](#listpageheader), [NamespaceBar](#namespacebar), [Overview](#overview), [OverviewGrid](#overviewgrid), [PopoverStatus](#popoverstatus), [ProgressStatus](#progressstatus), [QueryBrowser](#querybrowser), [RedExclamationCircleIcon](#redexclamationcircleicon), [ResourceEventStream](#resourceeventstream), [ResourceIcon](#resourceicon), [ResourceLink](#resourcelink), [ResourceStatus](#resourcestatus), [ResourceYAMLEditor](#resourceyamleditor), [StatusComponent](#statuscomponent), [StatusIconAndText](#statusiconandtext), [StatusPopupItem](#statuspopupitem), [StatusPopupSection](#statuspopupsection), [SuccessStatus](#successstatus), [TableData](#tabledata), [Timestamp](#timestamp), [useAccessReview](#useaccessreview), [useActiveColumns](#useactivecolumns), [useActiveNamespace](#useactivenamespace), [useActivePerspective](#useactiveperspective), [useAnnotationsModal](#useannotationsmodal), [useDeleteModal](#usedeletemodal), [useFlag](#useflag), [useK8sModel](#usek8smodel), [useK8sModels](#usek8smodels), [useK8sWatchResource](#usek8swatchresource), [useK8sWatchResources](#usek8swatchresources), [useLabelsModal](#uselabelsmodal), [useOverlay](#useoverlay), [usePrometheusPoll](#useprometheuspoll), [useQuickStartContext](#usequickstartcontext), [useResolvedExtensions](#useresolvedextensions), [useUserSettings](#useusersettings), [YellowExclamationTriangleIcon](#yellowexclamationtriangleicon), [ListPageFilter](#listpagefilter), [PerspectiveContext](#perspectivecontext), [useAccessReviewAllowed](#useaccessreviewallowed), [useListPageFilter](#uselistpagefilter), [useModal](#usemodal), [useSafetyFirst](#usesafetyfirst), [VirtualizedTable](#virtualizedtable), [YAMLEditor](#yamleditor) | | TypeAlias (28) | [Alert](#alert), [Alerts](#alerts), [AlwaysOnExtension](#alwaysonextension), [ColoredIconProps](#colorediconprops), [DiscoveryResources](#discoveryresources), [ExtensionHook](#extensionhook), [ExtensionHookResult](#extensionhookresult), [ExtensionK8sGroupKindModel](#extensionk8sgroupkindmodel), [ExtensionK8sGroupModel](#extensionk8sgroupmodel), [ExtensionK8sKindVersionModel](#extensionk8skindversionmodel), [ExtensionK8sModel](#extensionk8smodel), [K8sModel](#k8smodel), [K8sVerb](#k8sverb), [MatchExpression](#matchexpression), [MatchLabels](#matchlabels), [ModalComponent](#modalcomponent), [OverlayComponent](#overlaycomponent), [PerspectiveContextType](#perspectivecontexttype), [PrometheusAlert](#prometheusalert), [PrometheusLabels](#prometheuslabels), [PrometheusRule](#prometheusrule), [PrometheusRulesResponse](#prometheusrulesresponse), [PrometheusValue](#prometheusvalue), [ResolvedExtension](#resolvedextension), [Rule](#rule), [Selector](#selector), [Silence](#silence), [K8sKind](#k8skind) | | Interface (1) | [ModelDefinition](#modeldefinition) | | Enum (6) | [AlertSeverity](#alertseverity), [AlertStates](#alertstates), [Operator](#operator), [PrometheusEndpoint](#prometheusendpoint), [RuleStates](#rulestates), [SilenceStates](#silencestates) | --- ## `ActionServiceProvider` ### Summary Component that allows to receive contributions from other plugins for the `console.action/provider` extension type.<br/>See docs: https://github.com/openshift/console/blob/master/frontend/packages/console-dynamic-plugin-sdk/docs/console-extensions.md#consoleactionprovider ### Example ```tsx const context: ActionContext = { 'a-context-id': { dataFromDynamicPlugin } }; ... <ActionServiceProvider context={context}> {({ actions, options, loaded }) => loaded && ( <ActionMenu actions={actions} options={options} variant={ActionMenuVariant.DROPDOWN} /> ) } </ActionServiceProvider> ``` ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `context` | Object with contextId and optional plugin data | ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts) --- ## `Alert` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts) --- ## `Alerts` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts) --- ## `AlertSeverity` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts) --- ## `AlertStates` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts) --- ## `AlwaysOnExtension` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts) --- ## `BlueInfoCircleIcon` ### Summary Component for displaying a blue info circle icon. ### Example ```tsx <BlueInfoCircleIcon title="Info" /> ``` ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `className` | (optional) additional class name for the component | | `title` | (optional) icon title | | `size` | (optional) icon size: ('sm', 'md', 'lg', 'xl') | ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/app/components/status/icons.tsx`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/app/components/status/icons.tsx) --- ## `CamelCaseWrap` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/app/components/utils/camel-case-wrap.tsx`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/app/components/utils/camel-case-wrap.tsx) --- ## `checkAccess` ### Summary Provides information about user access to a given resource. ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `resourceAttributes` | resource attributes for access review | | `impersonate` | impersonation details | ### Returns Object with resource access information. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/app/components/utils/rbac.tsx`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/app/components/utils/rbac.tsx) --- ## `CodeEditor` ### Summary A basic lazy loaded Code editor with hover help and completion. ### Example ```tsx <React.Suspense fallback={<LoadingBox />}> <CodeEditor value={code} language="yaml" /> </React.Suspense> ``` ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `value` | String representing the yaml code to render. | | `language` | String representing the language of the editor. | | `options` | Monaco editor options. For more details, please, visit https://microsoft.github.io/monaco-editor/docs.html#interfaces/editor.IStandaloneEditorConstructionOptions.html. | | `minHeight` | Minimum editor height in valid CSS height values. | | `showShortcuts` | Boolean to show shortcuts on top of the editor. | | `toolbarLinks` | Array of ReactNode rendered on the toolbar links section on top of the editor. | | `onChange` | Callback for on code change event. | | `onSave` | Callback called when the command CTRL / CMD + S is triggered. | | `ref` | React reference to `{ editor?: IStandaloneCodeEditor }`. Using the 'editor' property, you are able to access to all methods to control the editor. For more information, visit https://microsoft.github.io/monaco-editor/docs.html#interfaces/editor.IStandaloneCodeEditor.html. | ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts) --- ## `ColoredIconProps` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/app/components/status/icons.tsx`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/app/components/status/icons.tsx) --- ## `consoleFetch` ### Summary A custom wrapper around `fetch` that adds console-specific headers and allows for retries and timeouts.<br/>It also validates the response status code and throws an appropriate error or logs out the user if required. ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `url` | The URL to fetch | | `options` | The options to pass to fetch | | `timeout` | The timeout in milliseconds | ### Returns A promise that resolves to the response. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/utils/fetch/console-fetch.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/utils/fetch/console-fetch.ts) --- ## `consoleFetchJSON` ### Summary A custom wrapper around `fetch` that adds console-specific headers and allows for retries and timeouts.<br/>It also validates the response status code and throws an appropriate error or logs out the user if required.<br/>It returns the response as a JSON object.<br/>Uses consoleFetch internally. ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `url` | The URL to fetch | | `method` | The HTTP method to use. Defaults to GET | | `options` | The options to pass to fetch | | `timeout` | The timeout in milliseconds | ### Returns A promise that resolves to the response as text or JSON object. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/utils/fetch/console-fetch.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/utils/fetch/console-fetch.ts) --- ## `consoleFetchText` ### Summary A custom wrapper around `fetch` that adds console-specific headers and allows for retries and timeouts.<br/>It also validates the response status code and throws an appropriate error or logs out the user if required.<br/>It returns the response as a text.<br/>Uses `consoleFetch` internally. ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `url` | The URL to fetch | | `options` | The options to pass to fetch | | `timeout` | The timeout in milliseconds | ### Returns A promise that resolves to the response as text or JSON object. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/utils/fetch/console-fetch.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/utils/fetch/console-fetch.ts) --- ## `DiscoveryResources` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts) --- ## `DocumentTitle` ### Summary A component to change the document title of the page. ### Example ```tsx <DocumentTitle>My Page Title</DocumentTitle> ``` This will change the title to "My Page Title · [Product Name]" ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `children` | The title to display | ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts) --- ## `ErrorBoundaryFallbackPage` ### Summary Creates a full page ErrorBoundaryFallbackPage component to display the "Something wrong happened" message along with the stack trace and other helpful debugging information.<br/>This is to be used in conjunction with an `ErrorBoundary` component. ### Example ```tsx //in ErrorBoundary component return ( if (this.state.hasError) { return <ErrorBoundaryFallbackPage errorMessage={errorString} componentStack={componentStackString} stack={stackTraceString} title={errorString}/>; } return this.props.children; } ) ``` ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `errorMessage` | text description of the error message | | `componentStack` | component trace of the exception | | `stack` | stack trace of the exception | | `title` | title to render as the header of the error boundary page | ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts) --- ## `ErrorStatus` ### Summary Component for displaying an error status popover. ### Example ```tsx <ErrorStatus title={errorMsg} /> ``` ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `title` | (optional) status text | | `iconOnly` | (optional) if true, only displays icon | | `noTooltip` | (optional) if true, tooltip is not displayed | | `className` | (optional) additional class name for the component | | `popoverTitle` | (optional) title for popover | ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/app/components/status/statuses.tsx`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/app/components/status/statuses.tsx) --- ## `ExtensionHook` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts) --- ## `ExtensionHookResult` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts) --- ## `ExtensionK8sGroupKindModel` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts) --- ## `ExtensionK8sGroupModel` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts) --- ## `ExtensionK8sKindVersionModel` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts) --- ## `ExtensionK8sModel` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts) --- ## `GenericStatus` ### Summary Component for a generic status popover ### Example ```tsx <GenericStatus Icon={CircleIcon} /> ``` ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `title` | (optional) status text | | `iconOnly` | (optional) if true, only displays icon | | `noTooltip` | (optional) if true, tooltip won't be displayed | | `className` | (optional) additional class name for the component | | `popoverTitle` | (optional) title for popover | | `Icon` | icon to be displayed | | `children` | (optional) children for the component | ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/app/components/status/GenericStatus.tsx`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/app/components/status/GenericStatus.tsx) --- ## `getAPIVersionForModel` ### Summary Provides `apiVersion` for a Kubernetes model. ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `model` | Kubernetes model | ### Returns The apiVersion for the model i.e `group/version`. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/k8s-ref.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/k8s-ref.ts) --- ## `getGroupVersionKindForModel` ### Summary Provides a group, version, and kind for a k8s model. ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `model` | Kubernetes model | ### Returns The group, version, kind for the provided model.<br/>If the model does not have an apiGroup, group `core` will be returned. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/k8s-ref.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/k8s-ref.ts) --- ## `getGroupVersionKindForResource` ### Summary Provides a group, version, and kind for a resource. ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `resource` | Kubernetes resource | ### Returns The group, version, kind for the provided resource.<br/>If the resource does not have an API group, the group `core` is returned.<br/>If the resource has an invalid apiVersion then it'll throw Error. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/k8s-ref.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/k8s-ref.ts) --- ## `GreenCheckCircleIcon` ### Summary Component for displaying a green check mark circle icon. ### Example ```tsx <GreenCheckCircleIcon title="Healthy" /> ``` ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `className` | (optional) additional class name for the component | | `title` | (optional) icon title | | `size` | (optional) icon size: ('sm', 'md', 'lg', 'xl', '2xl', '3xl', 'headingSm', 'headingMd', 'headingLg', 'headingXl', 'heading_2xl', 'heading_3xl', 'bodySm', 'bodyDefault', 'bodyLg') | ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/app/components/status/icons.tsx`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/app/components/status/icons.tsx) --- ## `HorizontalNav` ### Summary A component that creates a Navigation bar for a page.<br/>Routing is handled as part of the component.<br/>`console.tab/horizontalNav` can be used to add additional content to any horizontal nav. ### Example ```ts const HomePage: React.FC = (props) => { const page = { href: '/home', name: 'Home', component: ({customData}) => <>{customData.color} Home</> } return <HorizontalNav pages={[page]} customData={ color: 'Red'} /> } ``` ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `resource` | (optional) the resource associated with this Navigation, an object of K8sResourceCommon type | | `pages` | an array of page objects | | `customData` | (optional) custom data to be shared between the pages in the navigation. | ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts) --- ## `InfoStatus` ### Summary Component for displaying an information status popover. ### Example ```tsx <InfoStatus title={infoMsg} /> ``` ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `title` | (optional) status text | | `iconOnly` | (optional) if true, only displays icon | | `noTooltip` | (optional) if true, tooltip is not displayed | | `className` | (optional) additional class name for the component | | `popoverTitle` | (optional) title for popover | ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/app/components/status/statuses.tsx`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/app/components/status/statuses.tsx) --- ## `InventoryItem` ### Summary Creates an inventory card item. ### Example ```tsx return ( <InventoryItem> <InventoryItemTitle>{title}</InventoryItemTitle> <InventoryItemBody error={loadError}> {loaded && <InventoryItemStatus count={workerNodes.length} icon={<MonitoringIcon />} />} </InventoryItemBody> </InventoryItem> ) ``` ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `children` | elements to render inside the item | ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts) --- ## `InventoryItemBody` ### Summary Creates the body of an inventory card. Used within `InventoryCard` and can be used with `InventoryTitle`. ### Example ```tsx return ( <InventoryItem> <InventoryItemTitle>{title}</InventoryItemTitle> <InventoryItemBody error={loadError}> {loaded && <InventoryItemStatus count={workerNodes.length} icon={<MonitoringIcon />} />} </InventoryItemBody> </InventoryItem> ) ``` ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `children` | elements to render inside the inventory card or title | | `error` | elements of the div | ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts) --- ## `InventoryItemLoading` ### Summary Creates a skeleton container for when an inventory card is loading. Used with `InventoryItem` and related components. ### Example ```tsx if (loadError) { title = <Link to={workerNodesLink}>{t('Worker Nodes')}</Link>; } else if (!loaded) { title = <><InventoryItemLoading /><Link to={workerNodesLink}>{t('Worker Nodes')}</Link></>; } return ( <InventoryItem> <InventoryItemTitle>{title}</InventoryItemTitle> </InventoryItem> ) ``` ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts) --- ## `InventoryItemStatus` ### Summary Creates a count and icon for an inventory card with optional link address. Used within `InventoryItemBody`. ### Example ```tsx return ( <InventoryItem> <InventoryItemTitle>{title}</InventoryItemTitle> <InventoryItemBody error={loadError}> {loaded && <InventoryItemStatus count={workerNodes.length} icon={<MonitoringIcon />} />} </InventoryItemBody> </InventoryItem> ) ``` ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `count` | count for display | | `icon` | icon for display | | `linkTo` | (optional) link address | ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts) --- ## `InventoryItemTitle` ### Summary Creates a title for an inventory card item. Used within `InventoryItem`. ### Example ```tsx return ( <InventoryItem> <InventoryItemTitle>{title}</InventoryItemTitle> <InventoryItemBody error={loadError}> {loaded && <InventoryItemStatus count={workerNodes.length} icon={<MonitoringIcon />} />} </InventoryItemBody> </InventoryItem> ) ``` ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `children` | elements to render inside the title | ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts) --- ## `isAllNamespacesKey` ### Summary Returns true if the provided value represents the special "all" namespaces option key. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/utils.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/utils.ts) --- ## `k8sCreate` ### Summary It creates a resource in the cluster, based on the provided options. ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `options` | Which are passed as key-value pairs in the map | | `` | options.model - Kubernetes model | | `` | options.data - payload for the resource to be created | | `` | options.path - Appends as subpath if provided | | `` | options.queryParams - The query parameters to be included in the URL. | ### Returns A promise that resolves to the response of the resource created.<br/>In case of failure, the promise gets rejected with HTTP error response. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/k8s-resource.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/k8s-resource.ts) --- ## `k8sDelete` ### Summary It deletes resources from the cluster, based on the provided model and resource.<br/>The garbage collection works based on 'Foreground' | 'Background', can be configured with `propagationPolicy` property in provided model or passed in json. ### Example ``` { kind: 'DeleteOptions', apiVersion: 'v1', propagationPolicy } ``` ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `options` | which are passed as key-value pair in the map. | | `` | options.model - Kubernetes model | | `` | options.resource - The resource to be deleted. | | `` | options.path - Appends as subpath if provided. | | `` | options.queryParams - The query parameters to be included in the URL. | | `` | options.requestInit - The fetch init object to use. This can have request headers, method, redirect, etc. See more https://microsoft.github.io/PowerBI-JavaScript/interfaces/_node_modules_typedoc_node_modules_typescript_lib_lib_dom_d_.requestinit.html | | `` | options.json - Can control garbage collection of resources explicitly if provided else will default to model's `propagationPolicy`. | ### Returns A promise that resolves to the response of kind Status.<br/>In case of failure promise gets rejected with HTTP error response. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/k8s-resource.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/k8s-resource.ts) --- ## `k8sGet` ### Summary It fetches a resource from the cluster, based on the provided options.<br/>If the name is provided it returns resource, else it returns all the resources matching the model. ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `options` | Which are passed as key-value pairs in the map | | `` | options.model - Kubernetes model | | `` | options.name - The name of the resource, if not provided then it looks for all the resources matching the model. | | `` | options.ns - The namespace to look into, should not be specified for cluster-scoped resources. | | `` | options.path - Appends as subpath if provided | | `` | options.queryParams - The query parameters to be included in the URL. | | `` | options.requestInit - The fetch init object to use. This can have request headers, method, redirect, etc. See more https://microsoft.github.io/PowerBI-JavaScript/interfaces/_node_modules_typedoc_node_modules_typescript_lib_lib_dom_d_.requestinit.html | ### Returns A promise that resolves to the response as JSON object with a resource if the name is provided, else it returns all the resources matching the model. In case of failure, the promise gets rejected with HTTP error response. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/k8s-resource.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/k8s-resource.ts) --- ## `k8sList` ### Summary It lists the resources as an array in the cluster, based on the provided options. ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `options` | Which are passed as key-value pairs in the map. | | `` | options.model - Kubernetes model | | `` | options.queryParams - The query parameters to be included in the URL. It can also pass label selectors by using the `labelSelector` key. | | `` | options.requestInit - The fetch init object to use. This can have request headers, method, redirect, and so forth. See more https://microsoft.github.io/PowerBI-JavaScript/interfaces/_node_modules_typedoc_node_modules_typescript_lib_lib_dom_d_.requestinit.html | ### Returns A promise that resolves to the response ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/k8s-resource.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/k8s-resource.ts) --- ## `k8sListItems` ### Summary Same interface as k8sListResource but returns the sub items. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/k8s-resource.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/k8s-resource.ts) --- ## `K8sModel` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts) --- ## `k8sPatch` ### Summary It patches any resource in the cluster, based on the provided options.<br/>When a client needs to perform the partial update, the client can use k8sPatch.<br/>Alternatively, the client can use k8sUpdate to replace an existing resource entirely.<br/>See more https://datatracker.ietf.org/doc/html/rfc6902 ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `options` | Which are passed as key-value pairs in the map. | | `` | options.model - Kubernetes model | | `` | options.resource - The resource to be patched. | | `` | options.data - Only the data to be patched on existing resource with the operation, path, and value. | | `` | options.path - Appends as subpath if provided. | | `` | options.queryParams - The query parameters to be included in the URL. | ### Returns A promise that resolves to the response of the resource patched.<br/>In case of failure promise gets rejected with HTTP error response. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/k8s-resource.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/k8s-resource.ts) --- ## `k8sUpdate` ### Summary It updates the entire resource in the cluster, based on the provided options.<br/>When a client needs to replace an existing resource entirely, the client can use k8sUpdate.<br/>Alternatively, the client can use k8sPatch to perform the partial update. ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `options` | which are passed as key-value pair in the map | | `` | options.model - Kubernetes model | | `` | options.data - payload for the Kubernetes resource to be updated | | `` | options.ns - namespace to look into, it should not be specified for cluster-scoped resources. | | `` | options.name - resource name to be updated. | | `` | options.path - appends as subpath if provided. | | `` | options.queryParams - The query parameters to be included in the URL. | ### Returns A promise that resolves to the response of the resource updated.<br/>In case of failure promise gets rejected with HTTP error response. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/k8s-resource.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/k8s-resource.ts) --- ## `K8sVerb` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts) --- ## `ListPageBody` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/app/components/factory/ListPage/ListPageBody.tsx`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/app/components/factory/ListPage/ListPageBody.tsx) --- ## `ListPageCreate` ### Summary Component for adding a create button for a specific resource kind that automatically generates a link to the create YAML for this resource. ### Example ```ts const exampleList: React.FC<MyProps> = () => { return ( <> <ListPageHeader title="Example List Page"/> <ListPageCreate groupVersionKind={{ group: 'app'; version: 'v1'; kind: 'Deployment' }}>Create Deployment</ListPageCreate> </ListPageHeader> </> ); }; ``` ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `groupVersionKind` | group, version, kind of k8s resource `K8sGroupVersionKind` is preferred alternatively can pass reference for group, version, kind which is deprecated i.e `group~version~kind` `K8sResourceKindReference`. Core resources with no API group should leave off the `group` property | ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts) --- ## `ListPageCreateButton` ### Summary Component for creating button. ### Example ```ts const exampleList: React.FC<MyProps> = () => { return ( <> <ListPageHeader title="Example Pod List Page"/> <ListPageCreateButton createAccessReview={access}>Create Pod</ListPageCreateButton> </ListPageHeader> </> ); }; ``` ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `createAccessReview` | (optional) object with namespace and kind used to determine access | | `pfButtonProps` | (optional) Patternfly Button props | ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts) --- ## `ListPageCreateDropdown` ### Summary Component for creating a dropdown wrapped with permissions check. ### Example ```ts const exampleList: React.FC<MyProps> = () => { const items = { SAVE: 'Save', DELETE: 'Delete', } return ( <> <ListPageHeader title="Example Pod List Page"/> <ListPageCreateDropdown createAccessReview={access} items={items}>Actions</ListPageCreateDropdown> </ListPageHeader> </> ); }; ``` ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `items` | key:ReactNode pairs of items to display in dropdown component | | `onClick` | callback function for click on dropdown items | | `createAccessReview` | (optional) object with namespace and kind used to determine access | | `children` | (optional) children for the dropdown toggle | ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts) --- ## `ListPageCreateLink` ### Summary Component for creating a stylized link. ### Example ```ts const exampleList: React.FC<MyProps> = () => { return ( <> <ListPageHeader title="Example Pod List Page"/> <ListPageCreateLink to={'/link/to/my/page'}>Create Item</ListPageCreateLink> </ListPageHeader> </> ); }; ``` ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `to` | string location where link should direct | | `createAccessReview` | (optional) object with namespace and kind used to determine access | | `children` | (optional) children for the component | ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts) --- ## `ListPageHeader` ### Summary Component for generating a page header ### Example ```ts const exampleList: React.FC = () => { return ( <> <ListPageHeader title="Example List Page"/> </> ); }; ``` ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `title` | The heading title. If no title is set, only the `children`, `badge`, and `helpAlert` props will be rendered. | | `badge` | (optional) A badge that is displayed next to the title of the heading | | `helpAlert` | (optional) An alert placed below the heading in the same PageSection. | | `helpText` | (optional) A subtitle placed below the title. | | `hideFavoriteButton` | (optional) The "Add to favourites" button is shown by default while in the admin perspective. This prop allows you to hide the button. It should be hidden when `ListPageHeader` is not the primary page header to avoid having multiple favourites buttons. | | `children` | (optional) A primary action that is always rendered. | ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts) --- ## `MatchExpression` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts) --- ## `MatchLabels` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts) --- ## `ModalComponent` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/app/modal-support/ModalProvider.tsx`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/app/modal-support/ModalProvider.tsx) --- ## `ModelDefinition` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts) --- ## `NamespaceBar` ### Summary A component that renders a horizontal toolbar with a namespace dropdown menu in the leftmost position. Additional components can be passed in as children and will be rendered to the right of the namespace dropdown. This component is designed to be used at the top of the page. It should be used on pages where the user needs to be able to change the active namespace, such as on pages with k8s resources. ### Example ```tsx const logNamespaceChange = (namespace) => console.log(`New namespace: ${namespace}`); ... <NamespaceBar onNamespaceChange={logNamespaceChange}> <NamespaceBarApplicationSelector /> </NamespaceBar> <Page> ... ``` ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `onNamespaceChange` | (optional) A function that is executed when a namespace option is selected. It accepts the new namespace in the form of a string as its only argument. The active namespace is updated automatically when an option is selected, but additional logic can be applied through this function. When the namespace is changed, the namespace parameter in the URL will be changed from the previous namespace to the newly selected namespace. | | `isDisabled` | (optional) A boolean flag that disables the namespace dropdown if set to true. This option only applies to the namespace dropdown and has no effect on child components. | | `children` | (optional) Additional elements to be rendered inside the toolbar to the right of the namespace dropdown. | ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts) --- ## `Operator` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts) --- ## `OverlayComponent` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/app/modal-support/OverlayProvider.tsx`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/app/modal-support/OverlayProvider.tsx) --- ## `Overview` ### Summary Creates a wrapper component for a dashboard. ### Example ```tsx <Overview> <OverviewGrid mainCards={mainCards} leftCards={leftCards} rightCards={rightCards} /> </Overview> ``` ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `className` | (optional) style class for div | | `children` | (optional) elements of the dashboard | ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts) --- ## `OverviewGrid` ### Summary Creates a grid of card elements for a dashboard. Used within `Overview`. ### Example ```tsx <Overview> <OverviewGrid mainCards={mainCards} leftCards={leftCards} rightCards={rightCards} /> </Overview> ``` ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `mainCards` | cards for grid | | `leftCards` | (optional) cards for left side of grid | | `rightCards` | (optional) cards for right side of grid | ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/dynamic-core-api.ts) --- ## `PerspectiveContextType` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/perspective/perspective-context.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/perspective/perspective-context.ts) --- ## `PopoverStatus` ### Summary Component for creating a status popover item ### Example ```tsx <PopoverStatus title={title} statusBody={statusBody}> {children} </PopoverStatus> ``` ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `statusBody` | content displayed within the popover. | | `onHide` | (optional) function invoked when popover begins to transition out | | `onShow` | (optional) function invoked when popover begins to appear | | `title` | (optional) title for the popover | | `hideHeader` | (optional) when true, header text is hidden | | `isVisible` | (optional) when true, the popover is displayed | | `shouldClose` | (optional) callback function invoked when the popover is closed only if isVisible is also controlled | | `children` | (optional) children for the component | ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/app/components/status/PopoverStatus.tsx`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/app/components/status/PopoverStatus.tsx) --- ## `ProgressStatus` ### Summary Component for displaying a progressing status popover. ### Example ```tsx <ProgressStatus title={progressMsg} /> ``` ### Parameters | Parameter Name | Description | | -------------- | ----------- | | `title` | (optional) status text | | `iconOnly` | (optional) if true, only displays icon | | `noTooltip` | (optional) if true, tooltip is not displayed | | `className` | (optional) additional class name for the component | | `popoverTitle` | (optional) title for popover | ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/app/components/status/statuses.tsx`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/app/components/status/statuses.tsx) --- ## `PrometheusAlert` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts) --- ## `PrometheusEndpoint` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts) --- ## `PrometheusLabels` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts) --- ## `PrometheusRule` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts) --- ## `PrometheusRulesResponse` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts) --- ## `PrometheusValue` ### Summary Documentation is not available, please refer to the implementation. ### Source [`frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts`](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/src/api/common-types.ts) --- ## `QueryBrowser` ### Summary A component that renders a graph of the results from a Prometheus PromQL query along with controls for intera