Implement cluster metadata detectors (#1106)

Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
Lauri Nevala authored and GitHub committed 2020-10-22 21:45:54 +03:00
1 parent 99db7aca19
commit ce995f3deb
14 files changed
+293 -49

No files matched your search

+7 -1
View File
@@ -90,13 +90,19 @@ export class BaseStore<T = any> extends Singleton {
if (ipcRenderer) {
const callback = (event: IpcRendererEvent, model: T) => {
logger.silly(`[STORE]: SYNC ${this.name} from main`, { model });
this.onSync(model);
this.onSyncFromMain(model);
};
ipcRenderer.on(this.syncChannel, callback);
this.syncDisposers.push(() => ipcRenderer.off(this.syncChannel, callback));
}
}
protected onSyncFromMain(model: T) {
this.applyWithoutSync(() => {
this.onSync(model)
})
}
unregisterIpcListener() {
ipcRenderer.removeAllListeners(this.syncChannel)
}
+1 -1
View File
@@ -30,7 +30,7 @@ export const clusterIpc = {
channel: "cluster:refresh",
handle: (clusterId: ClusterId) => {
const cluster = clusterStore.getById(clusterId);
if (cluster) return cluster.refresh();
if (cluster) return cluster.refresh({ refreshMetadata: true })
},
}),
+5
View File
@@ -20,6 +20,10 @@ export interface ClusterIconUpload {
path: string;
}
export interface ClusterMetadata {
[key: string]: string | number | boolean;
}
export interface ClusterStoreModel {
activeCluster?: ClusterId; // last opened cluster
clusters?: ClusterModel[]
@@ -32,6 +36,7 @@ export interface ClusterModel {
workspace?: WorkspaceId;
contextName?: string;
preferences?: ClusterPreferences;
metadata?: ClusterMetadata;
kubeConfigPath: string;
/** @deprecated */