mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Convert runMany and runManySync to use injectManyWithMeta + move to seperate package (#7244)
* Convert runMany and runManySync to use injectManyWithMeta Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fixup type errors due to new Runnable requirements Signed-off-by: Sebastian Malton <sebastian@malton.name> * Add documentation for verifyRunnablesAreDAG Signed-off-by: Sebastian Malton <sebastian@malton.name> * Simplify convertToWithIdWith Signed-off-by: Sebastian Malton <sebastian@malton.name> * Move all utility functions to separate package Signed-off-by: Sebastian Malton <sebastian@malton.name> * Move testing utilities to separate package Signed-off-by: Sebastian Malton <sebastian@malton.name> * Move run-many and run-many-sync to separate package Signed-off-by: Sebastian Malton <sebastian@malton.name> * Replace all internal uses of utilities with new packages Signed-off-by: Sebastian Malton <sebastian@malton.name> * Use new @k8slens/run-many package in core Signed-off-by: Sebastian Malton <sebastian@malton.name> * Add dep to open-lens Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fixup type errors Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fixup uses of @k8slens/test-utils Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fixup getGlobalOverride Signed-off-by: Sebastian Malton <sebastian@malton.name> * Move tests to new package too Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix type errors Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fixup uses of AsyncResult and autoBind Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fixup remaining import issues Signed-off-by: Sebastian Malton <sebastian@malton.name> * Finial fixups to fix build Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix lint Signed-off-by: Sebastian Malton <sebastian@malton.name> * Revert moving "testUsingFakeTime" to separate package - This fixes tests Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix integration tests Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix unit test failing due to spelling fix Signed-off-by: Sebastian Malton <sebastian@malton.name> --------- Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
ad9bafe2a5
commit
2789bcebcb
754 files changed
+2715
-2752
No files matched your search
@@ -14,7 +14,7 @@ import { Cluster } from "../../../common/cluster/cluster";
|
||||
import navigateToCatalogInjectable from "../../../common/front-end-routing/routes/catalog/navigate-to-catalog.injectable";
|
||||
import directoryForKubeConfigsInjectable from "../../../common/app-paths/directory-for-kube-configs/directory-for-kube-configs.injectable";
|
||||
import joinPathsInjectable from "../../../common/path/join-paths.injectable";
|
||||
import { advanceFakeTime } from "../../../common/test-utils/use-fake-time";
|
||||
import { advanceFakeTime } from "../../../test-utils/use-fake-time";
|
||||
|
||||
const currentClusterServerUrl = "https://localhost";
|
||||
const nonCurrentClusterServerUrl = "http://localhost";
|
||||
|
||||
+1
-1
@@ -8,8 +8,8 @@ import clusterStoreInjectable from "../../../../common/cluster-store/cluster-sto
|
||||
import directoryForLensLocalStorageInjectable from "../../../../common/directory-for-lens-local-storage/directory-for-lens-local-storage.injectable";
|
||||
import removePathInjectable from "../../../../common/fs/remove.injectable";
|
||||
import joinPathsInjectable from "../../../../common/path/join-paths.injectable";
|
||||
import { noop } from "../../../../common/utils";
|
||||
import clusterConnectionInjectable from "../../../../main/cluster/cluster-connection.injectable";
|
||||
import { noop } from "@k8slens/utilities";
|
||||
import { getRequestChannelListenerInjectable } from "../../../../main/utils/channel/channel-listeners/listener-tokens";
|
||||
import { deleteClusterChannel } from "../common/delete-channel";
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,6 @@
|
||||
import { KubeObjectStatusLevel } from "../../../common/k8s-api/kube-object-status";
|
||||
import { KubeObject } from "../../../common/k8s-api/kube-object";
|
||||
import React from "react";
|
||||
import { testUsingFakeTime } from "../../../common/test-utils/use-fake-time";
|
||||
import type { DiContainer } from "@ogre-tools/injectable";
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import type { IAtom } from "mobx";
|
||||
@@ -20,6 +19,7 @@ import { act } from "@testing-library/react";
|
||||
import { observer } from "mobx-react";
|
||||
import { kubeObjectStatusTextInjectionToken } from "../../../renderer/components/kube-object-status-icon/kube-object-status-text-injection-token";
|
||||
import { KubeObjectStatusIcon } from "../../../renderer/components/kube-object-status-icon";
|
||||
import { testUsingFakeTime } from "../../../test-utils/use-fake-time";
|
||||
|
||||
describe("show status for a kube object", () => {
|
||||
let builder: ApplicationBuilder;
|
||||
|
||||
@@ -20,9 +20,9 @@ import writeJsonFileInjectable from "../../common/fs/write-json-file.injectable"
|
||||
import pathExistsInjectable from "../../common/fs/path-exists.injectable";
|
||||
import readJsonFileInjectable from "../../common/fs/read-json-file.injectable";
|
||||
import { navigateToRouteInjectionToken } from "../../common/front-end-routing/navigate-to-route-injection-token";
|
||||
import { advanceFakeTime, testUsingFakeTime } from "../../common/test-utils/use-fake-time";
|
||||
import storageSaveDelayInjectable from "../../renderer/utils/create-storage/storage-save-delay.injectable";
|
||||
import { flushPromises } from "../../common/test-utils/flush-promises";
|
||||
import { flushPromises } from "@k8slens/test-utils";
|
||||
import { testUsingFakeTime, advanceFakeTime } from "../../test-utils/use-fake-time";
|
||||
|
||||
describe("cluster - sidebar and tab navigation for core", () => {
|
||||
let builder: ApplicationBuilder;
|
||||
|
||||
+2
-2
@@ -15,13 +15,13 @@ import pathExistsInjectable from "../../common/fs/path-exists.injectable";
|
||||
import readJsonFileInjectable from "../../common/fs/read-json-file.injectable";
|
||||
import { navigateToRouteInjectionToken } from "../../common/front-end-routing/navigate-to-route-injection-token";
|
||||
import assert from "assert";
|
||||
import { advanceFakeTime, testUsingFakeTime } from "../../common/test-utils/use-fake-time";
|
||||
import type { IObservableValue } from "mobx";
|
||||
import { runInAction, computed, observable } from "mobx";
|
||||
import storageSaveDelayInjectable from "../../renderer/utils/create-storage/storage-save-delay.injectable";
|
||||
import type { DiContainer } from "@ogre-tools/injectable";
|
||||
import { flushPromises } from "../../common/test-utils/flush-promises";
|
||||
import type { ClusterPageMenuRegistration } from "../../extensions/common-api/types";
|
||||
import { flushPromises } from "@k8slens/test-utils";
|
||||
import { testUsingFakeTime, advanceFakeTime } from "../../test-utils/use-fake-time";
|
||||
|
||||
describe("cluster - sidebar and tab navigation for extensions", () => {
|
||||
let applicationBuilder: ApplicationBuilder;
|
||||
|
||||
@@ -14,7 +14,6 @@ import emitClusterStateUpdateInjectable from "./emit-update.injectable";
|
||||
const setupClusterStateBroadcastingInjectable = getInjectable({
|
||||
id: "setup-cluster-state-broadcasting",
|
||||
instantiate: (di) => ({
|
||||
id: "setup-cluster-state-broadcasting",
|
||||
run: () => {
|
||||
const emitClusterStateUpdate = di.inject(emitClusterStateUpdateInjectable);
|
||||
const clusterStore = di.inject(clusterStoreInjectable);
|
||||
@@ -36,7 +35,7 @@ const setupClusterStateBroadcastingInjectable = getInjectable({
|
||||
}
|
||||
});
|
||||
},
|
||||
runAfter: di.inject(initClusterStoreInjectable),
|
||||
runAfter: initClusterStoreInjectable,
|
||||
}),
|
||||
injectionToken: beforeApplicationIsLoadingInjectionToken,
|
||||
});
|
||||
|
||||
@@ -11,17 +11,16 @@ import requestInitialClusterStatesInjectable from "./request-initial.injectable"
|
||||
const setupClusterStateSyncInjectable = getInjectable({
|
||||
id: "setup-cluster-state-sync",
|
||||
instantiate: (di) => ({
|
||||
id: "setup-cluster-state-sync",
|
||||
run: async () => {
|
||||
const requestInitialClusterStates = di.inject(requestInitialClusterStatesInjectable);
|
||||
const getClusterById = di.inject(getClusterByIdInjectable);
|
||||
const initalStates = await requestInitialClusterStates();
|
||||
const initialStates = await requestInitialClusterStates();
|
||||
|
||||
for (const { clusterId, state } of initalStates) {
|
||||
for (const { clusterId, state } of initialStates) {
|
||||
getClusterById(clusterId)?.setState(state);
|
||||
}
|
||||
},
|
||||
runAfter: di.inject(initClusterStoreInjectable),
|
||||
runAfter: initClusterStoreInjectable,
|
||||
}),
|
||||
injectionToken: beforeFrameStartsSecondInjectionToken,
|
||||
});
|
||||
|
||||
@@ -9,17 +9,14 @@ import initUserStoreInjectable from "../../../../main/stores/init-user-store.inj
|
||||
|
||||
const initClusterStoreInjectable = getInjectable({
|
||||
id: "init-cluster-store",
|
||||
instantiate: (di) => {
|
||||
const clusterStore = di.inject(clusterStoreInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const clusterStore = di.inject(clusterStoreInjectable);
|
||||
|
||||
return {
|
||||
id: "init-cluster-store",
|
||||
run: () => {
|
||||
clusterStore.load();
|
||||
},
|
||||
runAfter: di.inject(initUserStoreInjectable),
|
||||
};
|
||||
},
|
||||
clusterStore.load();
|
||||
},
|
||||
runAfter: initUserStoreInjectable,
|
||||
}),
|
||||
injectionToken: beforeApplicationIsLoadingInjectionToken,
|
||||
});
|
||||
|
||||
|
||||
@@ -10,13 +10,12 @@ import initUserStoreInjectable from "../../../../renderer/stores/init-user-store
|
||||
const initClusterStoreInjectable = getInjectable({
|
||||
id: "init-cluster-store",
|
||||
instantiate: (di) => ({
|
||||
id: "init-cluster-store",
|
||||
run: () => {
|
||||
const clusterStore = di.inject(clusterStoreInjectable);
|
||||
|
||||
clusterStore.load();
|
||||
},
|
||||
runAfter: di.inject(initUserStoreInjectable),
|
||||
runAfter: initUserStoreInjectable,
|
||||
}),
|
||||
injectionToken: beforeFrameStartsSecondInjectionToken,
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user