Change typing for after/before window/application start (#7342)

- Now the callback is provided with an object containing either
  `mainDi` or `windowDi` fields. This should help with confusion
  over which environment the `di` is for

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton authored and GitHub committed 2023-03-13 15:35:33 +02:00
1 parent b99b06980e
commit a63f737adb
62 files changed
+185 -189

No files matched your search

@@ -76,17 +76,17 @@ describe("Deleting a cluster", () => {
config = new KubeConfig();
builder = getApplicationBuilder();
builder.beforeApplicationStart((mainDi) => {
builder.beforeApplicationStart(({ mainDi }) => {
mainDi.override(kubectlBinaryNameInjectable, () => "kubectl");
mainDi.override(kubectlDownloadingNormalizedArchInjectable, () => "amd64");
mainDi.override(normalizedPlatformInjectable, () => "darwin");
});
builder.beforeWindowStart((windowDi) => {
builder.beforeWindowStart(({ windowDi }) => {
openDeleteClusterDialog = windowDi.inject(openDeleteClusterDialogInjectable);
});
builder.afterWindowStart(windowDi => {
builder.afterWindowStart(({ windowDi }) => {
const navigateToCatalog = windowDi.inject(navigateToCatalogInjectable);
navigateToCatalog();
@@ -26,7 +26,7 @@ describe("disable kube object detail items when cluster is not relevant", () =>
builder = getApplicationBuilder();
builder.setEnvironmentToClusterFrame();
builder.afterWindowStart((windowDi) => {
builder.afterWindowStart(({ windowDi }) => {
const apiManager = windowDi.inject(apiManagerInjectable);
const api = {
apiBase: "/apis/some-api-version/some-kind",
@@ -25,7 +25,7 @@ describe("reactively hide kube object detail item", () => {
builder.setEnvironmentToClusterFrame();
builder.afterWindowStart((windowDi) => {
builder.afterWindowStart(({ windowDi }) => {
const apiManager = windowDi.inject(apiManagerInjectable);
const api = {
apiBase: "/apis/some-api-version/some-kind",
@@ -29,7 +29,7 @@ describe("disable kube object menu items when cluster is not relevant", () => {
builder.setEnvironmentToClusterFrame();
builder.beforeWindowStart((windowDi) => {
builder.beforeWindowStart(({ windowDi }) => {
runInAction(() => {
windowDi.register(testRouteInjectable, testRouteComponentInjectable);
});
@@ -25,7 +25,7 @@ describe("reactively hide kube object menu item", () => {
builder.setEnvironmentToClusterFrame();
builder.beforeWindowStart((windowDi) => {
builder.beforeWindowStart(({ windowDi }) => {
runInAction(() => {
windowDi.register(testRouteInjectable, testRouteComponentInjectable);
});
@@ -30,7 +30,7 @@ describe("disable kube object statuses when cluster is not relevant", () => {
builder.setEnvironmentToClusterFrame();
builder.beforeWindowStart((windowDi) => {
builder.beforeWindowStart(({ windowDi }) => {
runInAction(() => {
windowDi.register(testRouteInjectable, testRouteComponentInjectable);
});
@@ -26,7 +26,7 @@ describe("reactively hide kube object status", () => {
builder.setEnvironmentToClusterFrame();
builder.beforeWindowStart((windowDi) => {
builder.beforeWindowStart(({ windowDi }) => {
runInAction(() => {
windowDi.register(testRouteInjectable, testRouteComponentInjectable);
});
@@ -93,7 +93,7 @@ describe("show status for a kube object", () => {
}),
});
builder.beforeWindowStart((windowDi) => {
builder.beforeWindowStart(({ windowDi }) => {
runInAction(() => {
windowDi.register(
testRouteInjectable,
@@ -36,7 +36,7 @@ describe("cluster/namespaces - edit namespace from new tab", () => {
builder.setEnvironmentToClusterFrame();
builder.beforeWindowStart((windowDi) => {
builder.beforeWindowStart(({ windowDi }) => {
windowDi.override(
directoryForLensLocalStorageInjectable,
() => "/some-directory-for-lens-local-storage",
@@ -26,7 +26,7 @@ describe("cluster/namespaces - edit namespaces from previously opened tab", () =
callForNamespaceMock = asyncFn();
builder.beforeWindowStart((windowDi) => {
builder.beforeWindowStart(({ windowDi }) => {
windowDi.override(
directoryForLensLocalStorageInjectable,
() => "/some-directory-for-lens-local-storage",
@@ -47,7 +47,7 @@ describe("cluster/namespaces - edit namespaces from previously opened tab", () =
let rendered: RenderResult;
beforeEach(async () => {
builder.beforeWindowStart(async (windowDi) => {
builder.beforeWindowStart(async ({ windowDi }) => {
const writeJsonFile = windowDi.inject(writeJsonFileInjectable);
await writeJsonFile(
@@ -21,7 +21,7 @@ describe("cluster - order of sidebar items", () => {
builder.setEnvironmentToClusterFrame();
builder.beforeWindowStart((windowDi) => {
builder.beforeWindowStart(({ windowDi }) => {
runInAction(() => {
windowDi.register(testSidebarItemsInjectable);
});
@@ -35,14 +35,14 @@ describe("cluster - sidebar and tab navigation for core", () => {
builder.setEnvironmentToClusterFrame();
builder.beforeWindowStart((windowDi) => {
builder.beforeWindowStart(({ windowDi }) => {
windowDi.override(storageSaveDelayInjectable, () => 250);
});
});
describe("given core registrations", () => {
beforeEach(() => {
builder.beforeWindowStart((windowDi) => {
builder.beforeWindowStart(({ windowDi }) => {
runInAction(() => {
windowDi.register(testRouteInjectable);
windowDi.register(testRouteComponentInjectable);
@@ -86,7 +86,7 @@ describe("cluster - sidebar and tab navigation for core", () => {
describe("given state for expanded sidebar items already exists, when rendered", () => {
beforeEach(async () => {
builder.beforeWindowStart(async (windowDi) => {
builder.beforeWindowStart(async ({ windowDi }) => {
const writeJsonFile = windowDi.inject(writeJsonFileInjectable);
await writeJsonFile(
@@ -122,7 +122,7 @@ describe("cluster - sidebar and tab navigation for core", () => {
describe("given state for expanded unknown sidebar items already exists, when rendered", () => {
beforeEach(async () => {
builder.beforeWindowStart(async (windowDi) => {
builder.beforeWindowStart(async ({ windowDi }) => {
const writeJsonFileFake = windowDi.inject(writeJsonFileInjectable);
await writeJsonFileFake(
@@ -152,7 +152,7 @@ describe("cluster - sidebar and tab navigation for core", () => {
describe("given empty state for expanded sidebar items already exists, when rendered", () => {
beforeEach(async () => {
builder.beforeWindowStart(async (windowDi) => {
builder.beforeWindowStart(async ({ windowDi }) => {
const writeJsonFileFake = windowDi.inject(writeJsonFileInjectable);
await writeJsonFileFake(
@@ -34,7 +34,7 @@ describe("cluster - sidebar and tab navigation for extensions", () => {
applicationBuilder.setEnvironmentToClusterFrame();
applicationBuilder.beforeWindowStart((windowDi) => {
applicationBuilder.beforeWindowStart(({ windowDi }) => {
windowDi.override(storageSaveDelayInjectable, () => 250);
windowDi.override(
@@ -171,7 +171,7 @@ describe("cluster - sidebar and tab navigation for extensions", () => {
describe("given state for expanded sidebar items already exists, when rendered", () => {
beforeEach(async () => {
applicationBuilder.beforeWindowStart(async (windowDi) => {
applicationBuilder.beforeWindowStart(async ({ windowDi }) => {
const writeJsonFileFake = windowDi.inject(writeJsonFileInjectable);
await writeJsonFileFake(
@@ -207,7 +207,7 @@ describe("cluster - sidebar and tab navigation for extensions", () => {
describe("given state for expanded unknown sidebar items already exists, when rendered", () => {
beforeEach(async () => {
applicationBuilder.beforeWindowStart(async (windowDi) => {
applicationBuilder.beforeWindowStart(async ({ windowDi }) => {
const writeJsonFileFake = windowDi.inject(writeJsonFileInjectable);
await writeJsonFileFake(
@@ -237,7 +237,7 @@ describe("cluster - sidebar and tab navigation for extensions", () => {
describe("given empty state for expanded sidebar items already exists, when rendered", () => {
beforeEach(async () => {
applicationBuilder.beforeWindowStart(async (windowDi) => {
applicationBuilder.beforeWindowStart(async ({ windowDi }) => {
const writeJsonFileFake = windowDi.inject(writeJsonFileInjectable);
await writeJsonFileFake(
@@ -24,7 +24,7 @@ describe("cluster - visibility of sidebar items", () => {
builder.setEnvironmentToClusterFrame();
builder.beforeWindowStart((windowDi) => {
builder.beforeWindowStart(({ windowDi }) => {
runInAction(() => {
windowDi.register(testRouteInjectable);
windowDi.register(testRouteComponentInjectable);
@@ -16,7 +16,7 @@ describe("order of workload overview details", () => {
beforeEach(async () => {
const builder = getApplicationBuilder();
builder.beforeWindowStart((windowDi) => {
builder.beforeWindowStart(({ windowDi }) => {
windowDi.unoverride(getRandomIdInjectable);
windowDi.permitSideEffects(getRandomIdInjectable);