mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
clean up
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
parent
45c65610b9
commit
b8bde06869
@ -62,13 +62,10 @@ export class ClusterStore extends BaseStore<ClusterStoreModel> {
|
|||||||
migrations: migrations,
|
migrations: migrations,
|
||||||
});
|
});
|
||||||
if (ipcRenderer) {
|
if (ipcRenderer) {
|
||||||
ipcRenderer.on("cluster:state", (event, state: ClusterState) => {
|
ipcRenderer.on("cluster:state", (event, model: ClusterState) => {
|
||||||
this.applyWithoutSync(() => {
|
this.applyWithoutSync(() => {
|
||||||
logger.debug(`[CLUSTER-STORE]: received push-state at ${location.host}`, state);
|
logger.debug(`[CLUSTER-STORE]: received push-state at ${location.host}`, model);
|
||||||
const cluster = this.getById(state.id);
|
this.getById(model.id)?.updateModel(model);
|
||||||
if (cluster) {
|
|
||||||
cluster.updateModel(state)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,7 @@ export interface IpcChannelResponse<T extends any[] = any, E = any> {
|
|||||||
error?: E;
|
error?: E;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IpcChannelInit {
|
export interface IpcChannelOptions {
|
||||||
channel: IpcChannel; // main <-> renderer communication channel name
|
channel: IpcChannel; // main <-> renderer communication channel name
|
||||||
mode?: IpcMode; // default: "async", use "sync" as last resort: https://www.electronjs.org/docs/api/ipc-renderer#ipcrenderersendsyncchannel-args
|
mode?: IpcMode; // default: "async", use "sync" as last resort: https://www.electronjs.org/docs/api/ipc-renderer#ipcrenderersendsyncchannel-args
|
||||||
handle?: (...args: any[]) => any; // main-process message handler
|
handle?: (...args: any[]) => any; // main-process message handler
|
||||||
@ -33,7 +33,7 @@ export interface IpcChannelInit {
|
|||||||
once?: boolean; // todo: add support
|
once?: boolean; // todo: add support
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createIpcChannel({ autoBind = true, mode = IpcMode.ASYNC, timeout = 0, handle, channel }: IpcChannelInit) {
|
export function createIpcChannel({ autoBind = true, mode = IpcMode.ASYNC, timeout = 0, handle, channel }: IpcChannelOptions) {
|
||||||
channel = `${mode}:${channel}`
|
channel = `${mode}:${channel}`
|
||||||
|
|
||||||
const ipcChannel = {
|
const ipcChannel = {
|
||||||
|
|||||||
@ -16,8 +16,10 @@ class MetricsRoute extends LensApi {
|
|||||||
let prometheusPath: string
|
let prometheusPath: string
|
||||||
let prometheusProvider: PrometheusProvider
|
let prometheusProvider: PrometheusProvider
|
||||||
try {
|
try {
|
||||||
prometheusPath = await cluster.contextHandler.getPrometheusPath()
|
[prometheusPath, prometheusProvider] = await Promise.all([
|
||||||
prometheusProvider = await cluster.contextHandler.getPrometheusProvider()
|
cluster.contextHandler.getPrometheusPath(),
|
||||||
|
cluster.contextHandler.getPrometheusProvider()
|
||||||
|
])
|
||||||
} catch {
|
} catch {
|
||||||
this.respondJson(response, {})
|
this.respondJson(response, {})
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user