Commit 03565a2f authored by René Dudfield's avatar René Dudfield
Browse files

docs: Update plugin API markdown with make docs

parent e01c4cca
Showing with 162 additions and 59 deletions
+162 -59
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
\ No newline at end of file
......@@ -8,5 +8,5 @@ slug: "_index"
- [lib/k8s](modules/lib_k8s.md)
- [lib/util](modules/lib_util.md)
- [plugin](modules/plugin.md)
- [plugin/lib](modules/plugin_lib.md)
- [plugin/registry](modules/plugin_registry.md)
---
title: "Class: Headlamp"
linkTitle: "Headlamp"
slug: "plugin_lib.Headlamp"
---
[plugin/lib](../modules/plugin_lib.md).Headlamp
This class is a more convenient way for plugins to call registerPlugin in order to register
themselves.
## Constructors
### constructor
**new Headlamp**()
## Methods
### registerPlugin
`Static` **registerPlugin**(`pluginId`, `pluginObj`): `void`
Got a new plugin to add? Well, registerPlugin is your friend.
**`example`**
```javascript
const myPlugin = {
initialize: (register) => {
// do some stuff with register
// use some libraries in window.pluginLib
return true;
}
}
Headlamp.registerPlugin("aPluginIdString", myPlugin)
```
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `pluginId` | `string` | a unique id string for your plugin. |
| `pluginObj` | [`Plugin`](plugin_lib.Plugin.md) | the plugin being added. |
#### Returns
`void`
#### Defined in
[plugin/lib.ts:134](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/plugin/lib.ts#L134)
---
title: "Class: Plugin"
linkTitle: "Plugin"
slug: "plugin.Plugin"
slug: "plugin_lib.Plugin"
---
[plugin](../modules/plugin.md).Plugin
[plugin/lib](../modules/plugin_lib.md).Plugin
Plugins should call registerPlugin(pluginId: string, pluginObj: Plugin) to register themselves.
Plugins should call Headlamp.registerPlugin(pluginId: string, pluginObj: Plugin) to register themselves.
They will have their initialize(register) method called at plugin initialization time.
......@@ -38,4 +38,4 @@ initialize is called for each plugin with a Registry which gives the plugin meth
#### Defined in
plugin/index.tsx:86
[plugin/lib.ts:94](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/plugin/lib.ts#L94)
......@@ -39,7 +39,7 @@ register.registerAppBarAction('monitor', () => <MonitorLink /> );
#### Defined in
plugin/registry.tsx:101
[plugin/registry.tsx:110](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/plugin/registry.tsx#L110)
___
......@@ -70,7 +70,36 @@ register.registerDetailsViewHeaderAction('traces', (props) =>
#### Defined in
plugin/registry.tsx:82
[plugin/registry.tsx:91](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/plugin/registry.tsx#L91)
___
### registerDetailsViewSection
**registerDetailsViewSection**(`sectionName`, `sectionFunc`): `void`
Append the specified title and component to the details view.
**`example`**
```JSX
register.registerDetailsViewSection("biolatency", (resource: KubeObject) => { title: 'Block I/O Latency', component: (props) => <BioLatency {...props} resource={resource}/>});
```
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `sectionName` | `string` | a unique name for it |
| `sectionFunc` | [`sectionFunc`](../modules/plugin_registry.md#sectionfunc) | a function that returns your detail view component with props passed into it and the section title |
#### Returns
`void`
#### Defined in
[plugin/registry.tsx:126](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/plugin/registry.tsx#L126)
___
......@@ -106,7 +135,7 @@ register.registerRoute({
#### Defined in
plugin/registry.tsx:63
[plugin/registry.tsx:72](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/plugin/registry.tsx#L72)
___
......@@ -139,4 +168,4 @@ registerSidebarItem('cluster', 'traces', 'Traces', '/traces');
#### Defined in
plugin/registry.tsx:26
[plugin/registry.tsx:35](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/plugin/registry.tsx#L35)
......@@ -14,7 +14,7 @@ slug: "lib_util.FilterState"
#### Defined in
lib/util.ts:80
[lib/util.ts:81](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/lib/util.ts#L81)
___
......@@ -24,4 +24,4 @@ ___
#### Defined in
lib/util.ts:81
[lib/util.ts:82](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/lib/util.ts#L82)
......@@ -8,7 +8,7 @@ slug: "lib_k8s"
### ResourceClasses
`Const` **ResourceClasses**: `Object`
**ResourceClasses**: `Object` = `resourceClassesDict`
#### Index signature
......@@ -16,7 +16,7 @@ slug: "lib_k8s"
#### Defined in
lib/k8s/index.ts:71
[lib/k8s/index.ts:73](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/lib/k8s/index.ts#L73)
## Functions
......@@ -30,7 +30,7 @@ lib/k8s/index.ts:71
#### Defined in
lib/k8s/index.ts:143
[lib/k8s/index.ts:145](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/lib/k8s/index.ts#L145)
___
......@@ -44,7 +44,7 @@ ___
#### Defined in
lib/k8s/index.ts:126
[lib/k8s/index.ts:128](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/lib/k8s/index.ts#L128)
___
......@@ -58,7 +58,7 @@ ___
#### Defined in
lib/k8s/index.ts:78
[lib/k8s/index.ts:80](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/lib/k8s/index.ts#L80)
___
......@@ -78,4 +78,4 @@ ___
#### Defined in
lib/k8s/index.ts:149
[lib/k8s/index.ts:151](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/lib/k8s/index.ts#L151)
......@@ -12,17 +12,17 @@ slug: "lib_util"
### CLUSTER\_ACTION\_GRACE\_PERIOD
`Const` **CLUSTER\_ACTION\_GRACE\_PERIOD**: ``5000``
**CLUSTER\_ACTION\_GRACE\_PERIOD**: ``5000``
#### Defined in
lib/util.ts:17
[lib/util.ts:18](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/lib/util.ts#L18)
## Functions
### filterResource
**filterResource**(`item`, `filter`): `boolean`
**filterResource**(`item`, `filter`, `matchCriteria?`): `boolean`
#### Parameters
......@@ -30,6 +30,7 @@ lib/util.ts:17
| :------ | :------ |
| `item` | `KubeObjectInterface` |
| `filter` | [`FilterState`](../interfaces/lib_util.FilterState.md) |
| `matchCriteria?` | `string`[] |
#### Returns
......@@ -37,7 +38,7 @@ lib/util.ts:17
#### Defined in
lib/util.ts:84
[lib/util.ts:85](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/lib/util.ts#L85)
___
......@@ -51,7 +52,7 @@ ___
#### Defined in
lib/util.ts:119
[lib/util.ts:153](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/lib/util.ts#L153)
___
......@@ -63,7 +64,7 @@ ___
| Name | Type |
| :------ | :------ |
| `path?` | `string` \| ``null`` |
| `path?` | ``null`` \| `string` |
#### Returns
......@@ -71,7 +72,7 @@ ___
#### Defined in
lib/util.ts:111
[lib/util.ts:145](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/lib/util.ts#L145)
___
......@@ -92,7 +93,7 @@ ___
#### Defined in
lib/util.ts:33
[lib/util.ts:34](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/lib/util.ts#L34)
___
......@@ -112,7 +113,7 @@ ___
#### Defined in
lib/util.ts:42
[lib/util.ts:43](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/lib/util.ts#L43)
___
......@@ -134,7 +135,7 @@ ___
#### Defined in
lib/util.ts:60
[lib/util.ts:61](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/lib/util.ts#L61)
___
......@@ -155,7 +156,7 @@ ___
#### Defined in
lib/util.ts:50
[lib/util.ts:51](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/lib/util.ts#L51)
___
......@@ -175,7 +176,7 @@ ___
#### Defined in
lib/util.ts:46
[lib/util.ts:47](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/lib/util.ts#L47)
___
......@@ -195,7 +196,7 @@ ___
#### Defined in
lib/util.ts:25
[lib/util.ts:26](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/lib/util.ts#L26)
___
......@@ -215,7 +216,7 @@ ___
#### Defined in
lib/util.ts:21
[lib/util.ts:22](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/lib/util.ts#L22)
___
......@@ -235,13 +236,19 @@ ___
#### Defined in
lib/util.ts:131
[lib/util.ts:165](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/lib/util.ts#L165)
___
### useFilterFunc
**useFilterFunc**(): (`item`: `KubeObjectInterface`) => `boolean`
**useFilterFunc**(`matchCriteria?`): (`item`: `KubeObjectInterface`) => `boolean`
#### Parameters
| Name | Type |
| :------ | :------ |
| `matchCriteria?` | `string`[] |
#### Returns
......@@ -261,4 +268,4 @@ ___
#### Defined in
lib/util.ts:106
[lib/util.ts:140](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/lib/util.ts#L140)
---
title: "Module: plugin"
linkTitle: "plugin"
slug: "plugin"
---
## Classes
- [Plugin](../classes/plugin.Plugin.md)
## Functions
### initializePlugins
**initializePlugins**(): `Promise`<`unknown`\>
Load external, then local plugins. Then initialize() them in order with a Registry.
#### Returns
`Promise`<`unknown`\>
#### Defined in
plugin/index.tsx:211
---
title: "Module: plugin/lib"
linkTitle: "plugin/lib"
slug: "plugin_lib"
---
The lib.ts file should carry the bits to be used by plugins whereas
the index.ts should have the functions that Headlamp itself needs for
loading the plugins.
## Classes
- [Headlamp](../classes/plugin_lib.Headlamp.md)
- [Plugin](../classes/plugin_lib.Plugin.md)
......@@ -7,3 +7,27 @@ slug: "plugin_registry"
## Classes
- [default](../classes/plugin_registry.default.md)
## Type aliases
### sectionFunc
Ƭ **sectionFunc**: (`resource`: `KubeObject`) => `SectionFuncProps` \| ``null`` \| `undefined`
#### Type declaration
▸ (`resource`): `SectionFuncProps` \| ``null`` \| `undefined`
##### Parameters
| Name | Type |
| :------ | :------ |
| `resource` | `KubeObject` |
##### Returns
`SectionFuncProps` \| ``null`` \| `undefined`
#### Defined in
[plugin/registry.tsx:17](https://github.com/kinvolk/headlamp/blob/ab45ff9/frontend/src/plugin/registry.tsx#L17)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment