Class: Headlamp
plugin/lib .Headlamp
This class is a more convenient way for plugins to call registerPlugin in order to register themselves.
Constructors
constructor
• new Headlamp()
Methods
isRunningAsApp
▸ Static
isRunningAsApp(): boolean
Returns whether Headlamp is running as a desktop app.
Returns
boolean
true if Headlamp is running as a desktop app.
Defined in
registerPlugin
▸ Static
registerPlugin(pluginId
, pluginObj
): void
Got a new plugin to add? Well, registerPlugin is your friend.
example
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
|
the plugin being added. |
Returns
void
Defined in
setAppMenu
▸ Static
setAppMenu(appMenuFunc
): void
Changes the app menu. If Headlamp is not running as a desktop app, then this method prints an error and doesn’t do anything.
Parameters
Name | Type | Description |
---|---|---|
appMenuFunc |
(currentAppMenuSpec : null |
AppMenu
[]) => null |
AppMenu
[] |
A function that receives the current app menu configuration and a new one. If the function returns null, the menu is not changed. |
Returns
void
Defined in
setCluster
▸ Static
setCluster(clusterReq
): Promise
<any
>
Configure (or update) a cluster that can then be used throughout Headlamp.
If the request is successful, further calls to K8s.useClustersConf()
will show the newly configured cluster.
Important: This is only available in the desktop version and will result in a bad request when running in-cluster.
Parameters
Name | Type | Description |
---|---|---|
clusterReq |
ClusterRequest
|
the cluster to be added or updated. |
Returns
Promise
<any
>
a promise which completes to Headlamp’s configuration (showing the list of configured clusters).