Fix cluster view closing sometimes

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2021-07-27 15:49:06 -04:00
1 parent c426eb9899
commit b86b118e3e
6 files changed
+67 -45

No files matched your search

@@ -91,7 +91,7 @@ export class KubernetesCluster extends CatalogEntity<KubernetesClusterMetadata,
}
async onRun() {
requestMain(navigateToClusterHandler, this.getId());
await requestMain(navigateToClusterHandler, this.getId());
}
onDetailsOpen(): void {
+14
View File
@@ -36,6 +36,20 @@ export class ClusterFrames extends Singleton {
return [...this.mapping.values()];
}
public getClusterIdFromFrameInfo(query: ClusterFrameInfo): ClusterId | undefined {
for (const [clusterId, info] of this.mapping) {
if (
info.frameId === query.frameId
&& info.processId === query.processId
&& info.windowId === query.windowId
) {
return clusterId;
}
}
return undefined;
}
public set(clusterId: ClusterId, info: ClusterFrameInfo): void {
this.mapping.set(clusterId, info);
}
+16
View File
@@ -109,6 +109,22 @@ export function* filter<T>(src: Iterable<T>, fn: (from: T) => any): Iterable<T>
}
}
/**
* Creates a new iterator that iterates (lazily) over its input and yields the
* items that are not `null` or `undefined` value from `fn`.
* @param src A type that can be iterated over
* @param fn The function that is called for each value
*/
export function* keepDefined<T>(src: Iterable<T | undefined | null>): Iterable<T> {
for (const from of src) {
if (from === null || from === undefined) {
continue;
}
yield from;
}
}
/**
* Creates a new iterator that iterates (lazily) over its input and yields the
* result of `fn` when it is `truthy`