Skip to main content

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​

Headlamp

Methods​

getProductName()​

getProductName(): string

Returns the name of the product.

Returns​

string

the name of the product.

Defined in​

src/plugin/lib.ts:172


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​

src/plugin/lib.ts:162


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​

src/plugin/lib.ts:151


registerPlugin()​

static registerPlugin(pluginId: string, pluginObj: Plugin): void

Got a new plugin to add? Well, registerPlugin is your friend.

Parameters​

ParameterTypeDescription
pluginIdstringa unique id string for your plugin.
pluginObjPluginthe 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​

src/plugin/lib.ts:106


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​

ParameterTypeDescription
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​

src/plugin/lib.ts:135


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​

ParameterTypeDescription
clusterReqClusterRequestthe cluster to be added or updated.

Returns​

Promise<any>

a promise which completes to Headlamp's configuration (showing the list of configured clusters).

Defined in​

src/plugin/lib.ts:123