fix KubeApi's not being registered

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2022-05-04 08:47:20 -04:00
1 parent 8499f26707
commit 25796b736d
7 files changed
+78 -43

No files matched your search

+12
View File
@@ -46,6 +46,7 @@ import assert from "assert";
import openDeleteClusterDialogInjectable from "./components/delete-cluster-dialog/open.injectable";
import { init } from "@sentry/electron/renderer";
import kubernetesClusterCategoryInjectable from "../common/catalog/categories/kubernetes-cluster.injectable";
import autoRegistrationInjectable from "../common/k8s-api/api-manager/auto-registration.injectable";
configurePackages(); // global packages
registerCustomThemes(); // monaco editor themes
@@ -78,6 +79,17 @@ export async function bootstrap(di: DiContainer) {
const rootNode = createRoot(rootElem);
const logPrefix = `[BOOTSTRAP-${process.isMainFrame ? "ROOT" : "CLUSTER"}-FRAME]:`;
/**
* This is injected here to initialize it for the side effect.
*
* The side effect CANNOT be within `apiManagerInjectable` itself since that causes circular
* dependencies with the current need for legacy di use.
*
* This also MUST be done before anything else so that it can start listening for the events for
* auto initialization.
*/
di.inject(autoRegistrationInjectable);
// TODO: Remove temporal dependencies to make timing of initialization not important
di.inject(userStoreInjectable);
@@ -103,14 +103,16 @@ class NonInjectedKubeObjectMenu<TKubeObject extends KubeObject, Props extends Ku
}
render() {
const { remove, update, renderRemoveMessage, isEditable, isRemovable } = this;
const { remove, update, renderRemoveMessage, isEditable, isRemovable, store } = this;
const { className, editable, removable, object, ...menuProps } = this.props;
console.log(object, store);
return (
<MenuActions
className={cssNames("KubeObjectMenu", className)}
updateAction={object && isEditable ? (() => update(object)) : undefined}
removeAction={object && isRemovable ? (() => remove(object)) : undefined}
updateAction={(object && isEditable) ? (() => update(object)) : undefined}
removeAction={(object && isRemovable) ? (() => remove(object)) : undefined}
removeConfirmationMessage={renderRemoveMessage}
{...menuProps}
>
@@ -11,7 +11,6 @@ import hostedClusterInjectable from "../../../../common/cluster-store/hosted-clu
import appEventBusInjectable from "../../../../common/app-event-bus/app-event-bus.injectable";
import clusterFrameContextInjectable from "../../../cluster-frame-context/cluster-frame-context.injectable";
import assert from "assert";
import autoRegistrationInjectable from "../../../../common/k8s-api/api-manager/auto-registration.injectable";
const initClusterFrameInjectable = getInjectable({
id: "init-cluster-frame",
@@ -21,14 +20,6 @@ const initClusterFrameInjectable = getInjectable({
assert(hostedCluster, "This can only be injected within a cluster frame");
/**
* This is injected here to initialize it for the side effect.
*
* The side effect CANNOT be within `apiManagerInjectable` itself since that causes circular
* dependencies with the current need for legacy di use
*/
di.inject(autoRegistrationInjectable);
return initClusterFrame({
hostedCluster,
loadExtensions: di.inject(extensionLoaderInjectable).loadOnClusterRenderer,