Abstract Class: Headlamp
Defined in: plugin/lib.ts:103
This class is a more convenient way for plugins to call registerPlugin in order to register themselves.
Constructors
Constructor
new Headlamp(): Headlamp;
Returns
Headlamp
Methods
getProductName()
getProductName(): string;
Defined in: plugin/lib.ts:190
Returns the name of the product.
Returns
string
the name of the product.
getVersion()
getVersion(): object;
Defined in: plugin/lib.ts:180
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;
isRunningAsApp()
static isRunningAsApp(): boolean;
Defined in: plugin/lib.ts:169
Returns whether Headlamp is running as a desktop app.
Returns
boolean
true if Headlamp is running as a desktop app.
registerPlugin()
static registerPlugin(pluginId: string, pluginObj: Plugin): void;
Defined in: plugin/lib.ts:124
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)
setAppMenu()
static setAppMenu(appMenuFunc: (currentAppMenuSpec: AppMenu[] | null) => AppMenu[] | null): void;
Defined in: plugin/lib.ts:153
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: AppMenu[] | null) => AppMenu[] | null | 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
setCluster()
static setCluster(clusterReq: ClusterRequest): Promise<any>;
Defined in: plugin/lib.ts:141
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).