mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Update metrics feature components (#301)
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
1 parent
b8fd4040a1
commit
260de08c72
14 files changed
+187
-78
No files matched your search
@@ -150,6 +150,17 @@ export class ClusterManager {
|
||||
}
|
||||
});
|
||||
|
||||
this.promiseIpc.on("upgradeFeature", async (installReq: FeatureInstallRequest) => {
|
||||
logger.debug(`IPC: upgradeFeature for ${installReq.name}`)
|
||||
const cluster = this.clusters.get(installReq.clusterId)
|
||||
try {
|
||||
await cluster.upgradeFeature(installReq.name, installReq.config)
|
||||
return {success: true, message: ""}
|
||||
} catch(error) {
|
||||
return {success: false, message: error}
|
||||
}
|
||||
});
|
||||
|
||||
this.promiseIpc.on("uninstallFeature", async (installReq: FeatureInstallRequest) => {
|
||||
logger.debug(`IPC: uninstallFeature for ${installReq.name}`)
|
||||
const cluster = this.clusters.get(installReq.clusterId)
|
||||
|
||||
@@ -105,6 +105,11 @@ export class Cluster implements ClusterInfo {
|
||||
return this.refreshCluster()
|
||||
}
|
||||
|
||||
public async upgradeFeature(name: string, config: any) {
|
||||
await fm.upgradeFeature(name, this, config)
|
||||
return this.refreshCluster()
|
||||
}
|
||||
|
||||
public async uninstallFeature(name: string) {
|
||||
await fm.uninstallFeature(name, this)
|
||||
return this.refreshCluster()
|
||||
|
||||
@@ -40,7 +40,11 @@ export async function installFeature(name: string, cluster: Cluster, config: any
|
||||
await feature.install(cluster)
|
||||
}
|
||||
|
||||
|
||||
export async function upgradeFeature(name: string, cluster: Cluster, config: any) {
|
||||
const feature = ALL_FEATURES[name] as Feature
|
||||
// TODO Figure out how to handle config stuff
|
||||
await feature.upgrade(cluster)
|
||||
}
|
||||
|
||||
export async function uninstallFeature(name: string, cluster: Cluster) {
|
||||
const feature = ALL_FEATURES[name] as Feature
|
||||
|
||||
+1
-3
@@ -48,9 +48,7 @@ export abstract class Feature {
|
||||
});
|
||||
}
|
||||
|
||||
upgrade(): boolean {
|
||||
return true;
|
||||
}
|
||||
abstract async upgrade(cluster: Cluster): Promise<boolean>;
|
||||
|
||||
abstract async uninstall(cluster: Cluster): Promise<boolean>;
|
||||
|
||||
|
||||
Reference in new issue
Block a user