mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Revert "Renderer file logging through IPC" (#7393)
This reverts commit 48db54ec9e.
This commit is contained in:
1 parent
48db54ec9e
commit
5409324236
24 files changed
+72
-832
No files matched your search
+49
-38
@@ -22,51 +22,62 @@ interface Dependencies {
|
||||
|
||||
const logPrefix = "[CLUSTER-FRAME]:";
|
||||
|
||||
export const initClusterFrame =
|
||||
({
|
||||
hostedCluster,
|
||||
loadExtensions,
|
||||
catalogEntityRegistry,
|
||||
frameRoutingId,
|
||||
emitAppEvent,
|
||||
logger,
|
||||
showErrorNotification,
|
||||
}: Dependencies) =>
|
||||
async () => {
|
||||
export const initClusterFrame = ({
|
||||
hostedCluster,
|
||||
loadExtensions,
|
||||
catalogEntityRegistry,
|
||||
frameRoutingId,
|
||||
emitAppEvent,
|
||||
logger,
|
||||
showErrorNotification,
|
||||
}: Dependencies) =>
|
||||
async (unmountRoot: () => void) => {
|
||||
// TODO: Make catalogEntityRegistry already initialized when passed as dependency
|
||||
catalogEntityRegistry.init();
|
||||
catalogEntityRegistry.init();
|
||||
|
||||
logger.info(
|
||||
`${logPrefix} Init dashboard, clusterId=${hostedCluster.id}, frameId=${frameRoutingId}`,
|
||||
);
|
||||
logger.info(
|
||||
`${logPrefix} Init dashboard, clusterId=${hostedCluster.id}, frameId=${frameRoutingId}`,
|
||||
);
|
||||
|
||||
await requestSetClusterFrameId(hostedCluster.id);
|
||||
await when(() => hostedCluster.ready.get()); // cluster.activate() is done at this point
|
||||
await requestSetClusterFrameId(hostedCluster.id);
|
||||
await when(() => hostedCluster.ready.get()); // cluster.activate() is done at this point
|
||||
|
||||
catalogEntityRegistry.activeEntity = hostedCluster.id;
|
||||
catalogEntityRegistry.activeEntity = hostedCluster.id;
|
||||
|
||||
// Only load the extensions once the catalog has been populated.
|
||||
// Note that the Catalog might still have unprocessed entities until the extensions are fully loaded.
|
||||
when(
|
||||
() => catalogEntityRegistry.items.get().length > 0,
|
||||
() => loadExtensions(),
|
||||
{
|
||||
timeout: 15_000,
|
||||
onError: (error) => {
|
||||
logger.warn("[CLUSTER-FRAME]: error from activeEntity when()", error);
|
||||
// Only load the extensions once the catalog has been populated.
|
||||
// Note that the Catalog might still have unprocessed entities until the extensions are fully loaded.
|
||||
when(
|
||||
() => catalogEntityRegistry.items.get().length > 0,
|
||||
() =>
|
||||
loadExtensions(),
|
||||
{
|
||||
timeout: 15_000,
|
||||
onError: (error) => {
|
||||
logger.warn(
|
||||
"[CLUSTER-FRAME]: error from activeEntity when()",
|
||||
error,
|
||||
);
|
||||
|
||||
showErrorNotification("Failed to get KubernetesCluster for this view. Extensions will not be loaded.");
|
||||
},
|
||||
showErrorNotification("Failed to get KubernetesCluster for this view. Extensions will not be loaded.");
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
setTimeout(() => {
|
||||
emitAppEvent({
|
||||
name: "cluster",
|
||||
action: "open",
|
||||
params: {
|
||||
clusterId: hostedCluster.id,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
window.onbeforeunload = () => {
|
||||
logger.info(
|
||||
`${logPrefix} Unload dashboard, clusterId=${(hostedCluster.id)}, frameId=${frameRoutingId}`,
|
||||
);
|
||||
|
||||
setTimeout(() => {
|
||||
emitAppEvent({
|
||||
name: "cluster",
|
||||
action: "open",
|
||||
params: {
|
||||
clusterId: hostedCluster.id,
|
||||
},
|
||||
});
|
||||
});
|
||||
unmountRoot();
|
||||
};
|
||||
};
|
||||
@@ -9,6 +9,7 @@ import lensProtocolRouterRendererInjectable from "../../protocol-handler/lens-pr
|
||||
import catalogEntityRegistryInjectable from "../../api/catalog/entity/registry.injectable";
|
||||
import registerIpcListenersInjectable from "../../ipc/register-ipc-listeners.injectable";
|
||||
import loadExtensionsInjectable from "../load-extensions.injectable";
|
||||
import loggerInjectable from "../../../common/logger.injectable";
|
||||
import { delay } from "@k8slens/utilities";
|
||||
import { broadcastMessage } from "../../../common/ipc";
|
||||
import { bundledExtensionsLoaded } from "../../../common/ipc/extension-handling";
|
||||
@@ -22,8 +23,9 @@ const initRootFrameInjectable = getInjectable({
|
||||
const bindProtocolAddRouteHandlers = di.inject(bindProtocolAddRouteHandlersInjectable);
|
||||
const lensProtocolRouterRenderer = di.inject(lensProtocolRouterRendererInjectable);
|
||||
const catalogEntityRegistry = di.inject(catalogEntityRegistryInjectable);
|
||||
const logger = di.inject(loggerInjectable);
|
||||
|
||||
return async () => {
|
||||
return async (unmountRoot: () => void) => {
|
||||
catalogEntityRegistry.init();
|
||||
|
||||
try {
|
||||
@@ -54,6 +56,12 @@ const initRootFrameInjectable = getInjectable({
|
||||
window.addEventListener("online", () => broadcastMessage("network:online"));
|
||||
|
||||
registerIpcListeners();
|
||||
|
||||
window.addEventListener("beforeunload", () => {
|
||||
logger.info("[ROOT-FRAME]: Unload app");
|
||||
|
||||
unmountRoot();
|
||||
});
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user