Module: plugin/registry
Enumerations
Classes
Interfaces
Type aliases
AppBarActionProcessorType
Ƭ AppBarActionProcessorType: (info
: AppBarActionsProcessorArgs
) => AppBarAction
[]
Type declaration
▸ (info
): AppBarAction
[]
Parameters
Name | Type |
---|---|
info |
AppBarActionsProcessorArgs |
Returns
AppBarAction
[]
Defined in
redux/actionButtonsSlice.ts:57
AppLogoType
Ƭ AppLogoType: React.ComponentType
<
AppLogoProps
> | ReactElement
| typeof React.Component
| null
Defined in
ClusterChooserType
Ƭ ClusterChooserType: React.ComponentType
<
ClusterChooserProps
> | ReactElement
| null
Defined in
components/cluster/ClusterChooser.tsx:10
DetailsViewHeaderActionType
Ƭ DetailsViewHeaderActionType: HeaderActionType
Defined in
DetailsViewHeaderActionsProcessor
Ƭ DetailsViewHeaderActionsProcessor: HeaderActionsProcessor
Defined in
DetailsViewSectionType
Ƭ DetailsViewSectionType: ComponentType
<
DetailsViewSectionProps
> | ReactElement
| null
Defined in
components/DetailsViewSection/DetailsViewSection.tsx:9
sectionFunc
Ƭ sectionFunc: (resource
:
KubeObject
) =>
SectionFuncProps
| null
| undefined
Type declaration
▸ (resource
):
SectionFuncProps
| null
| undefined
deprecated
please used DetailsViewSectionType and registerDetailViewSection
Parameters
Name | Type |
---|---|
resource |
KubeObject
|
Returns
SectionFuncProps
| null
| undefined
Defined in
Variables
DetailsViewDefaultHeaderActions
• DetailsViewDefaultHeaderActions: typeof DefaultHeaderAction
= DefaultHeaderAction
Defined in
Functions
getHeadlampAPIHeaders
▸ getHeadlampAPIHeaders(): Object
Returns headers for making API calls to the headlamp-server backend.
Returns
Object
Defined in
registerAppBarAction
▸ registerAppBarAction(headerAction
): void
Add a component into the app bar (at the top of the app).
example
import { registerAppBarAction } from '@kinvolk/headlamp-plugin/lib';
import { Button } from '@material-ui/core';
function ConsoleLogger() {
return (
<Button
onClick={() => {
console.log('Hello from ConsoleLogger!')
}}
>
Print Log
</Button>
);
}
registerAppBarAction(ConsoleLogger);
Parameters
Name | Type | Description |
---|---|---|
headerAction |
AppBarAction | AppBarActionsProcessor |
AppBarActionProcessorType
| AppBarActionType |
The action (link) to put in the app bar. |
Returns
void
Defined in
registerAppLogo
▸ registerAppLogo(logo
): void
Add a logo for Headlamp to use instead of the default one.
example
import { registerAppLogo } from '@kinvolk/headlamp-plugin/lib';
registerAppLogo(<p>my logo</p>)
More complete logo example in plugins/examples/change-logo:
Parameters
Name | Type | Description |
---|---|---|
logo |
AppLogoType
|
is a React Component that takes two required props logoType which is a constant string literal that accepts either of the two values small or large depending on whether the sidebar is in shrink or expanded state so that you can change your logo from small to large and the other optional prop is the themeName which is a string with two values ‘light’ and ‘dark’ base on which theme is selected. |
Returns
void
Defined in
registerClusterChooser
▸ registerClusterChooser(chooser
): void
Use a custom cluster chooser button
example
import { ClusterChooserProps, registerClusterChooser } from '@kinvolk/headlamp-plugin/lib';
registerClusterChooser(({ clickHandler, cluster }: ClusterChooserProps) => {
return <button onClick={clickHandler}>my chooser Current cluster: {cluster}</button>;
})
Parameters
Name | Type | Description |
---|---|---|
chooser |
ClusterChooserType
|
is a React Component that takes one required props clickHandler which is the action handler that happens when the custom chooser button component click event occurs |
Returns
void
Defined in
registerDetailsViewHeaderAction
▸ registerDetailsViewHeaderAction(headerAction
): void
Add a component into the details view header.
example
import { ActionButton } from '@kinvolk/headlamp-plugin/lib/CommonComponents';
import { registerDetailsViewHeaderAction } from '@kinvolk/headlamp-plugin/lib';
function IconAction() {
return (
<ActionButton
description="Launch"
icon="mdi:comment-quote"
onClick={() => console.log('Hello from IconAction!')}
/>
)
}
registerDetailsViewHeaderAction(IconAction);
Parameters
Name | Type | Description |
---|---|---|
headerAction |
HeaderActionType |
The action (link) to put in the app bar. |
Returns
void
Defined in
registerDetailsViewHeaderActionsProcessor
▸ registerDetailsViewHeaderActionsProcessor(processor
): void
Add a processor for the details view header actions. Allowing the modification of header actions.
example
import { registerDetailsViewHeaderActionsProcessor, DetailsViewDefaultHeaderActions } from '@kinvolk/headlamp-plugin/lib';
// Processor that removes the default edit action.
registerDetailsViewHeaderActionsProcessor((resource, headerActions) => {
return headerActions.filter(action => action.name !== DetailsViewDefaultHeaderActions.EDIT);
});
More complete detail view example in plugins/examples/details-view:
@see [Detail View Example](http://github.com/kinvolk/headlamp/plugins/examples/details-view/)
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `processor` | `HeaderActionsProcessor` \| `HeaderActionFuncType` | The processor to add. Receives a resource (for which we are processing the header actions) and the current header actions and returns the new header actions. Return an empty array to remove all header actions. |
#### Returns
`void`
#### Defined in
[plugin/registry.tsx:320](https://github.com/headlamp-k8s/headlamp/blob/1ae27053/frontend/src/plugin/registry.tsx#L320)
___
### registerDetailsViewSection
▸ **registerDetailsViewSection**(`viewSection`): `void`
Append a component to the details view for a given resource.
**`example`**
```tsx
import {
registerDetailsViewSection,
DetailsViewSectionProps
} from '@kinvolk/headlamp-plugin/lib';
registerDetailsViewSection(({ resource }: DetailsViewSectionProps) => {
if (resource.kind === 'Pod') {
return (
<SectionBox title="A very fine section title">
The body of our Section for {resource.kind}
</SectionBox>
);
}
return null;
});
Parameters
Name | Type | Description |
---|---|---|
viewSection |
DetailsViewSectionType
|
The section to add on different view screens. |
Returns
void
Defined in
registerGetTokenFunction
▸ registerGetTokenFunction(override
): void
Override headlamp getToken method
example
registerGetTokenFunction(() => {
// set token logic here
});
Parameters
Name | Type | Description |
---|---|---|
override |
(cluster : string ) => undefined | string |
The getToken override method to use. |
Returns
void
Defined in
registerResourceTableColumnsProcessor
▸ registerResourceTableColumnsProcessor(processor
): void
Add a processor for the resource table columns. Allowing the modification of what tables show.
example
import { registerResourceTableColumnsProcessor } from '@kinvolk/headlamp-plugin/lib';
// Processor that adds a column to show how many init containers pods have (in the default pods' list table).
registerResourceTableColumnsProcessor(function ageRemover({ id, columns }) {
if (id === 'headlamp-pods') {
columns.push({
label: 'Init Containers',
getter: (pod: Pod) => {
return pod.spec.initContainers.length;
},
});
}
return columns;
});
Parameters
Name | Type | Description |
---|---|---|
processor |
TableColumnsProcessor | (args : { columns : (ResourceTableColumn | ColumnType )[] ; id : string }) => (ResourceTableColumn | ColumnType )[] |
The processor ID and function. See #TableColumnsProcessor. |
Returns
void
Defined in
registerRoute
▸ registerRoute(routeSpec
): void
Add a Route for a component.
example
import { registerRoute } from '@kinvolk/headlamp-plugin/lib';
// Add a route that will display the given component and select
// the "traces" sidebar item.
registerRoute({
path: '/traces',
sidebar: 'traces',
component: () => <TraceList />
});
see
Route examples
see
Sidebar Example
Parameters
Name | Type | Description |
---|---|---|
routeSpec |
Route
|
details of URL, highlighted sidebar and component to use. |
Returns
void
Defined in
registerRouteFilter
▸ registerRouteFilter(filterFunc
): void
Remove routes.
example
import { registerRouteFilter } from '@kinvolk/headlamp-plugin/lib';
registerRouteFilter(route => (route.path === '/workloads' ? null : route));
Parameters
Name | Type | Description |
---|---|---|
filterFunc |
(entry :
Route
) => null |
Route
|
a function for filtering routes. |
Returns
void
Defined in
registerSetTokenFunction
▸ registerSetTokenFunction(override
): void
Override headlamp setToken method
example
registerSetTokenFunction((cluster: string, token: string | null) => {
// set token logic here
});
Parameters
Name | Type | Description |
---|---|---|
override |
(cluster : string , token : null | string ) => void |
The setToken override method to use. |
Returns
void
Defined in
registerSidebarEntry
▸ registerSidebarEntry(__namedParameters
): void
Add a Sidebar Entry to the menu (on the left side of Headlamp).
example
import { registerSidebarEntry } from '@kinvolk/headlamp-plugin/lib';
registerSidebarEntry({ parent: 'cluster', name: 'traces', label: 'Traces', url: '/traces' });
see
Sidebar Example
Parameters
Name | Type |
---|---|
__namedParameters |
SidebarEntryProps
|
Returns
void
Defined in
registerSidebarEntryFilter
▸ registerSidebarEntryFilter(filterFunc
): void
Remove sidebar menu items.
example
import { registerSidebarEntryFilter } from '@kinvolk/headlamp-plugin/lib';
registerSidebarEntryFilter(entry => (entry.name === 'workloads' ? null : entry));
Parameters
Name | Type | Description |
---|---|---|
filterFunc |
(entry :
SidebarEntryProps
) => null |
SidebarEntryProps
|
a function for filtering sidebar entries. |
Returns
void