mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Explicitly initialize registries
- Helps moves towards turning on banning CyclicImports Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
c18df6bcae
commit
6d10f011e5
101 files changed
+1178
-1087
No files matched your search
@@ -21,140 +21,93 @@
|
||||
|
||||
import React from "react";
|
||||
import { ClusterStore } from "../../../common/cluster-store";
|
||||
import { ClusterProxySetting } from "./components/cluster-proxy-setting";
|
||||
import { ClusterNameSetting } from "./components/cluster-name-setting";
|
||||
import { ClusterHomeDirSetting } from "./components/cluster-home-dir-setting";
|
||||
import { ClusterAccessibleNamespaces } from "./components/cluster-accessible-namespaces";
|
||||
import { ClusterMetricsSetting } from "./components/cluster-metrics-setting";
|
||||
import { ShowMetricsSetting } from "./components/show-metrics";
|
||||
import { ClusterPrometheusSetting } from "./components/cluster-prometheus-setting";
|
||||
import { ClusterKubeconfig } from "./components/cluster-kubeconfig";
|
||||
import { entitySettingRegistry } from "../../../extensions/registries";
|
||||
import type { EntitySettingViewProps } from "../../../extensions/registries";
|
||||
import type { CatalogEntity } from "../../api/catalog-entity";
|
||||
|
||||
import * as components from "./components";
|
||||
|
||||
function getClusterForEntity(entity: CatalogEntity) {
|
||||
return ClusterStore.getInstance().getById(entity.metadata.uid);
|
||||
}
|
||||
|
||||
entitySettingRegistry.add([
|
||||
{
|
||||
apiVersions: ["entity.k8slens.dev/v1alpha1"],
|
||||
kind: "KubernetesCluster",
|
||||
source: "local",
|
||||
title: "General",
|
||||
group: "Settings",
|
||||
components: {
|
||||
View: (props: { entity: CatalogEntity }) => {
|
||||
const cluster = getClusterForEntity(props.entity);
|
||||
export function GeneralSettings({ entity }: EntitySettingViewProps) {
|
||||
const cluster = getClusterForEntity(entity);
|
||||
|
||||
if (!cluster) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<section>
|
||||
<section>
|
||||
<ClusterNameSetting cluster={cluster} />
|
||||
</section>
|
||||
<section>
|
||||
<ClusterKubeconfig cluster={cluster} />
|
||||
</section>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
apiVersions: ["entity.k8slens.dev/v1alpha1"],
|
||||
kind: "KubernetesCluster",
|
||||
title: "Proxy",
|
||||
group: "Settings",
|
||||
components: {
|
||||
View: (props: { entity: CatalogEntity }) => {
|
||||
const cluster = getClusterForEntity(props.entity);
|
||||
|
||||
if (!cluster) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<section>
|
||||
<ClusterProxySetting cluster={cluster} />
|
||||
</section>
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
apiVersions: ["entity.k8slens.dev/v1alpha1"],
|
||||
kind: "KubernetesCluster",
|
||||
title: "Terminal",
|
||||
group: "Settings",
|
||||
components: {
|
||||
View: (props: { entity: CatalogEntity }) => {
|
||||
const cluster = getClusterForEntity(props.entity);
|
||||
|
||||
if (!cluster) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<section>
|
||||
<ClusterHomeDirSetting cluster={cluster} />
|
||||
</section>
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
apiVersions: ["entity.k8slens.dev/v1alpha1"],
|
||||
kind: "KubernetesCluster",
|
||||
title: "Namespaces",
|
||||
group: "Settings",
|
||||
components: {
|
||||
View: (props: { entity: CatalogEntity }) => {
|
||||
const cluster = getClusterForEntity(props.entity);
|
||||
|
||||
if (!cluster) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<section>
|
||||
<ClusterAccessibleNamespaces cluster={cluster} />
|
||||
</section>
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
apiVersions: ["entity.k8slens.dev/v1alpha1"],
|
||||
kind: "KubernetesCluster",
|
||||
title: "Metrics",
|
||||
group: "Settings",
|
||||
components: {
|
||||
View: (props: { entity: CatalogEntity }) => {
|
||||
const cluster = getClusterForEntity(props.entity);
|
||||
|
||||
if (!cluster) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<section>
|
||||
<section>
|
||||
<ClusterPrometheusSetting cluster={cluster} />
|
||||
</section>
|
||||
<section>
|
||||
<ClusterMetricsSetting cluster={cluster}/>
|
||||
</section>
|
||||
<section>
|
||||
<ShowMetricsSetting cluster={cluster}/>
|
||||
</section>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
}
|
||||
if (!cluster) {
|
||||
return null;
|
||||
}
|
||||
]);
|
||||
|
||||
return (
|
||||
<section>
|
||||
<section>
|
||||
<components.ClusterNameSetting cluster={cluster} />
|
||||
</section>
|
||||
<section>
|
||||
<components.ClusterKubeconfig cluster={cluster} />
|
||||
</section>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export function ProxySettings({ entity }: EntitySettingViewProps) {
|
||||
const cluster = getClusterForEntity(entity);
|
||||
|
||||
if (!cluster) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<section>
|
||||
<components.ClusterProxySetting cluster={cluster} />
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export function TerminalSettings({ entity }: EntitySettingViewProps) {
|
||||
const cluster = getClusterForEntity(entity);
|
||||
|
||||
if (!cluster) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<section>
|
||||
<components.ClusterHomeDirSetting cluster={cluster} />
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export function NamespacesSettings({ entity }: EntitySettingViewProps) {
|
||||
const cluster = getClusterForEntity(entity);
|
||||
|
||||
if (!cluster) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<section>
|
||||
<components.ClusterAccessibleNamespaces cluster={cluster} />
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export function MetricsSettings({ entity }: EntitySettingViewProps) {
|
||||
const cluster = getClusterForEntity(entity);
|
||||
|
||||
if (!cluster) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<section>
|
||||
<section>
|
||||
<components.ClusterPrometheusSetting cluster={cluster} />
|
||||
</section>
|
||||
<section>
|
||||
<components.ClusterMetricsSetting cluster={cluster} />
|
||||
</section>
|
||||
<section>
|
||||
<components.ShowMetricsSetting cluster={cluster} />
|
||||
</section>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
File renamed without changes.
+8
-16
@@ -19,19 +19,11 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { navigate } from "../../navigation";
|
||||
import { commandRegistry } from "../../../extensions/registries/command-registry";
|
||||
import { getActiveClusterEntity } from "../../api/catalog-entity-registry";
|
||||
import { entitySettingsURL } from "../../../common/routes";
|
||||
|
||||
commandRegistry.add({
|
||||
id: "cluster.viewCurrentClusterSettings",
|
||||
title: "Cluster: View Settings",
|
||||
scope: "global",
|
||||
action: () => navigate(entitySettingsURL({
|
||||
params: {
|
||||
entityId: getActiveClusterEntity()?.id,
|
||||
}
|
||||
})),
|
||||
isActive: (context) => !!context.entity
|
||||
});
|
||||
export * from "./cluster-accessible-namespaces";
|
||||
export * from "./cluster-home-dir-setting";
|
||||
export * from "./cluster-kubeconfig";
|
||||
export * from "./cluster-metrics-setting";
|
||||
export * from "./cluster-name-setting";
|
||||
export * from "./cluster-prometheus-setting";
|
||||
export * from "./cluster-proxy-setting";
|
||||
export * from "./cluster-show-metrics";
|
||||
@@ -20,4 +20,3 @@
|
||||
*/
|
||||
|
||||
export * from "./cluster-settings";
|
||||
export * from "./cluster-settings.command";
|
||||
Reference in new issue
Block a user