Class: abstract
Headlamp
This class is a more convenient way for plugins to call registerPlugin in order to register themselves.
Constructors
new Headlamp()
new Headlamp(): Headlamp
Returns
Methods
getProductName()
getProductName(): string
Returns the name of the product.
Returns
string
the name of the product.
Defined in
getVersion()
getVersion(): object
Returns the version of Headlamp as an object with a VERSION (application version) and GIT_VERSION (commit) fields. Like: { VERSION: 'v0.0.0', GIT_VERSION: '0000000000000}
Returns
object
the version of Headlamp.
GIT_VERSION
GIT_VERSION: any;
VERSION
VERSION: any;
Defined in
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: string, pluginObj: Plugin): void
Got a new plugin to add? Well, registerPlugin is your friend.
Parameters
Parameter | Type | Description |
---|---|---|
pluginId | string | a unique id string for your plugin. |
pluginObj | Plugin | the plugin being added. |
Returns
void
Example
const myPlugin = {
initialize: (register) => {
// do some stuff with register
// use some libraries in window.pluginLib
return true;
}
}
Headlamp.registerPlugin("aPluginIdString", myPlugin)
Defined in
setAppMenu()
static setAppMenu(appMenuFunc: (currentAppMenuSpec: null | AppMenu[]) => null | AppMenu[]): 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
Parameter | 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: ClusterRequest): 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
Parameter | 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).