Extract pod metrics and cluster frame context

Signed-off-by: Sami Tiilikainen <97873007+samitiilikainen@users.noreply.github.com>
This commit is contained in:
Sami Tiilikainen committed 2023-06-02 09:02:30 +03:00
1 parent 323b3759fc
commit 3c16777784
24 files changed
+133 -19

No files matched your search

+2
View File
@@ -211,11 +211,13 @@
"@k8slens/application": "^6.5.0-alpha.0",
"@k8slens/application-for-electron-main": "^6.5.0-alpha.0",
"@k8slens/button": "^1.0.0-alpha.5",
"@k8slens/cluster-frame-context": "^1.0.0-alpha.1",
"@k8slens/cluster-settings": "^6.5.0-alpha.1",
"@k8slens/cluster-sidebar": "^1.0.0",
"@k8slens/error-boundary": "^1.0.0-alpha.5",
"@k8slens/event-emitter": "^1.0.0-alpha.1",
"@k8slens/icon": "^1.0.0-alpha.7",
"@k8slens/json-api": "^1.0.0-alpha.3",
"@k8slens/kube-api": "^1.0.0-alpha.1",
"@k8slens/kube-api-specifics": "^1.0.0-alpha.1",
"@k8slens/kube-object": "^1.0.0-alpha.5",
@@ -16,7 +16,7 @@ import type { Patch } from "rfc6902";
import type { Logger } from "@k8slens/logger";
import assert from "assert";
import type { PartialDeep } from "type-fest";
import type { ClusterContext } from "../../renderer/cluster-frame-context/cluster-frame-context";
import type { ClusterContext } from "@k8slens/cluster-frame-context";
import autoBind from "auto-bind";
export type OnLoadFailure = (error: unknown) => void;
@@ -19,7 +19,7 @@ import { KubeObjectStore as InternalKubeObjectStore } from "../../common/k8s-api
import type { KubeJsonApiDataFor, KubeObject } from "@k8slens/kube-object";
import type { DerivedKubeApiOptions, KubeApiDependencies, KubeApiOptions, KubeJsonApi as InternalKubeJsonApi } from "@k8slens/kube-api";
import clusterFrameContextForNamespacedResourcesInjectable from "../../renderer/cluster-frame-context/for-namespaced-resources.injectable";
import type { ClusterContext } from "../../renderer/cluster-frame-context/cluster-frame-context";
import type { ClusterContext } from "@k8slens/cluster-frame-context";
import { logErrorInjectionToken, loggerInjectionToken, logInfoInjectionToken, logWarningInjectionToken } from "@k8slens/logger";
import { maybeKubeApiInjectable, storesAndApisCanBeCreatedInjectionToken } from "@k8slens/kube-api-specifics";
import { DeploymentApi as InternalDeploymentApi, IngressApi as InternalIngressApi, NodeApi, PersistentVolumeClaimApi, PodApi, KubeApi as InternalKubeApi } from "@k8slens/kube-api";
@@ -1,16 +0,0 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
/**
* This type is used for KubeObjectStores
*/
export interface ClusterContext {
readonly allNamespaces: string[]; // available / allowed namespaces from cluster.ts
readonly contextNamespaces: string[]; // selected by user (see: namespace-select.tsx)
readonly hasSelectedAll: boolean;
isLoadingAll(namespaces: string[]): boolean;
isGlobalWatchEnabled(): boolean;
}
@@ -2,8 +2,9 @@
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { clusterFrameContextForClusterScopedResourcesInjectionToken } from "@k8slens/cluster-frame-context";
import { getInjectable } from "@ogre-tools/injectable";
import type { ClusterContext } from "./cluster-frame-context";
import type { ClusterContext } from "@k8slens/cluster-frame-context";
const clusterFrameContextForClusterScopedResourcesInjectable = getInjectable({
id: "cluster-frame-context-for-cluster-scoped-resources",
@@ -16,6 +17,7 @@ const clusterFrameContextForClusterScopedResourcesInjectable = getInjectable({
contextNamespaces: [],
hasSelectedAll: true,
}),
injectionToken: clusterFrameContextForClusterScopedResourcesInjectionToken,
});
export default clusterFrameContextForClusterScopedResourcesInjectable;
@@ -3,7 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import type { ClusterContext } from "./cluster-frame-context";
import type { ClusterContext } from "@k8slens/cluster-frame-context";
import namespaceStoreInjectable from "../components/namespaces/store.injectable";
import hostedClusterInjectable from "./hosted-cluster.injectable";
import assert from "assert";
@@ -27,7 +27,7 @@ import type { PageParam } from "../../navigation/page-param";
import type { ToggleKubeDetailsPane } from "../kube-detail-params/toggle-details.injectable";
import kubeSelectedUrlParamInjectable from "../kube-detail-params/kube-selected-url.injectable";
import toggleKubeDetailsPaneInjectable from "../kube-detail-params/toggle-details.injectable";
import type { ClusterContext } from "../../cluster-frame-context/cluster-frame-context";
import type { ClusterContext } from "@k8slens/cluster-frame-context";
import type { GeneralKubeObjectListLayoutColumn, SpecificKubeListLayoutColumn } from "@k8slens/list-layout";
import { kubeObjectListLayoutColumnInjectionToken } from "@k8slens/list-layout";
import { sortBy } from "lodash";
@@ -11,7 +11,7 @@ import { Icon } from "@k8slens/icon";
import type { SelectOption } from "../../select";
import { observableCrate } from "@k8slens/utilities";
import type { IsMultiSelectionKey } from "./is-selection-key.injectable";
import type { ClusterContext } from "../../../cluster-frame-context/cluster-frame-context";
import type { ClusterContext } from "@k8slens/cluster-frame-context";
interface Dependencies {
context: ClusterContext;
@@ -14,7 +14,7 @@ import { cssNames } from "@k8slens/utilities";
import { Icon } from "@k8slens/icon";
import { withInjectables } from "@ogre-tools/injectable-react";
import clusterFrameContextForNamespacedResourcesInjectable from "../../cluster-frame-context/for-namespaced-resources.injectable";
import type { ClusterContext } from "../../cluster-frame-context/cluster-frame-context";
import type { ClusterContext } from "@k8slens/cluster-frame-context";
export type NamespaceSelectSort = (left: string, right: string) => number;
@@ -34,7 +34,7 @@ import jobStoreInjectable from "../workloads-jobs/store.injectable";
import statefulSetStoreInjectable from "../workloads-statefulsets/store.injectable";
import type { EventStore } from "../events/store";
import eventStoreInjectable from "../events/store.injectable";
import type { ClusterContext } from "../../cluster-frame-context/cluster-frame-context";
import type { ClusterContext } from "@k8slens/cluster-frame-context";
interface Dependencies {
detailComponents: IComputedValue<React.ElementType<{}>[]>;
@@ -8,7 +8,7 @@ import { disposer, getOrInsert, noop, WrappedAbortController } from "@k8slens/ut
import { once } from "lodash";
import type { Logger } from "@k8slens/logger";
import type { KubeObjectStoreLoadAllParams, KubeObjectStoreSubscribeParams } from "../../common/k8s-api/kube-object.store";
import type { ClusterContext } from "../cluster-frame-context/cluster-frame-context";
import type { ClusterContext } from "@k8slens/cluster-frame-context";
// Kubernetes watch-api client
// API: https://developer.mozilla.org/en-US/docs/Web/API/Streams_API/Using_readable_streams