Explicitly initialize registries

- Helps moves towards turning on banning CyclicImports

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2021-06-10 09:34:13 -04:00
1 parent c18df6bcae
commit 6d10f011e5
101 files changed
+1178 -1087

No files matched your search

@@ -0,0 +1,193 @@
/**
* Copyright (c) 2021 OpenLens Authors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import React from "react";
import * as routes from "../../common/routes";
import { CommandRegistry } from "../../extensions/registries";
import { getActiveClusterEntity } from "../api/catalog-entity-registry";
import { CommandOverlay } from "../components/command-palette";
import { createTerminalTab } from "../components/dock/terminal.store";
import { HotbarAddCommand } from "../components/hotbar/hotbar-add-command";
import { HotbarRemoveCommand } from "../components/hotbar/hotbar-remove-command";
import { HotbarSwitchCommand } from "../components/hotbar/hotbar-switch-command";
import { navigate } from "../navigation";
export function initCommandRegistry() {
CommandRegistry.getInstance()
.add([
{
id: "app.showPreferences",
title: "Preferences: Open",
scope: "global",
action: () => navigate(routes.preferencesURL())
},
{
id: "cluster.viewHelmCharts",
title: "Cluster: View Helm Charts",
scope: "entity",
action: () => navigate(routes.helmChartsURL())
},
{
id: "cluster.viewHelmReleases",
title: "Cluster: View Helm Releases",
scope: "entity",
action: () => navigate(routes.releaseURL())
},
{
id: "cluster.viewConfigMaps",
title: "Cluster: View ConfigMaps",
scope: "entity",
action: () => navigate(routes.configMapsURL())
},
{
id: "cluster.viewSecrets",
title: "Cluster: View Secrets",
scope: "entity",
action: () => navigate(routes.secretsURL())
},
{
id: "cluster.viewResourceQuotas",
title: "Cluster: View ResourceQuotas",
scope: "entity",
action: () => navigate(routes.resourceQuotaURL())
},
{
id: "cluster.viewLimitRanges",
title: "Cluster: View LimitRanges",
scope: "entity",
action: () => navigate(routes.limitRangeURL())
},
{
id: "cluster.viewHorizontalPodAutoscalers",
title: "Cluster: View HorizontalPodAutoscalers (HPA)",
scope: "entity",
action: () => navigate(routes.hpaURL())
},
{
id: "cluster.viewPodDisruptionBudget",
title: "Cluster: View PodDisruptionBudgets",
scope: "entity",
action: () => navigate(routes.pdbURL())
},
{
id: "cluster.viewServices",
title: "Cluster: View Services",
scope: "entity",
action: () => navigate(routes.servicesURL())
},
{
id: "cluster.viewEndpoints",
title: "Cluster: View Endpoints",
scope: "entity",
action: () => navigate(routes.endpointURL())
},
{
id: "cluster.viewIngresses",
title: "Cluster: View Ingresses",
scope: "entity",
action: () => navigate(routes.ingressURL())
},
{
id: "cluster.viewNetworkPolicies",
title: "Cluster: View NetworkPolicies",
scope: "entity",
action: () => navigate(routes.networkPoliciesURL())
},
{
id: "cluster.viewNodes",
title: "Cluster: View Nodes",
scope: "entity",
action: () => navigate(routes.nodesURL())
},
{
id: "cluster.viewPods",
title: "Cluster: View Pods",
scope: "entity",
action: () => navigate(routes.podsURL())
},
{
id: "cluster.viewDeployments",
title: "Cluster: View Deployments",
scope: "entity",
action: () => navigate(routes.deploymentsURL())
},
{
id: "cluster.viewDaemonSets",
title: "Cluster: View DaemonSets",
scope: "entity",
action: () => navigate(routes.daemonSetsURL())
},
{
id: "cluster.viewStatefulSets",
title: "Cluster: View StatefulSets",
scope: "entity",
action: () => navigate(routes.statefulSetsURL())
},
{
id: "cluster.viewJobs",
title: "Cluster: View Jobs",
scope: "entity",
action: () => navigate(routes.jobsURL())
},
{
id: "cluster.viewCronJobs",
title: "Cluster: View CronJobs",
scope: "entity",
action: () => navigate(routes.cronJobsURL())
},
{
id: "cluster.viewCurrentClusterSettings",
title: "Cluster: View Settings",
scope: "global",
action: () => navigate(routes.entitySettingsURL({
params: {
entityId: getActiveClusterEntity()?.id,
}
})),
isActive: (context) => !!context.entity
},
{
id: "cluster.openTerminal",
title: "Cluster: Open terminal",
scope: "entity",
action: () => createTerminalTab(),
isActive: (context) => !!context.entity
},
{
id: "hotbar.switchHotbar",
title: "Hotbar: Switch ...",
scope: "global",
action: () => CommandOverlay.open(<HotbarSwitchCommand />)
},
{
id: "hotbar.addHotbar",
title: "Hotbar: Add Hotbar ...",
scope: "global",
action: () => CommandOverlay.open(<HotbarAddCommand />)
},
{
id: "hotbar.removeHotbar",
title: "Hotbar: Remove Hotbar ...",
scope: "global",
action: () => CommandOverlay.open(<HotbarRemoveCommand />)
},
]);
}
@@ -0,0 +1,70 @@
/**
* Copyright (c) 2021 OpenLens Authors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import { EntitySettingRegistry } from "../../extensions/registries";
import * as clusterSettings from "../components/cluster-settings";
export function initEntitySettingsRegistry() {
EntitySettingRegistry.getInstance()
.add([
{
apiVersions: ["entity.k8slens.dev/v1alpha1"],
kind: "KubernetesCluster",
source: "local",
title: "General",
components: {
View: clusterSettings.GeneralSettings,
}
},
{
apiVersions: ["entity.k8slens.dev/v1alpha1"],
kind: "KubernetesCluster",
title: "Proxy",
components: {
View: clusterSettings.ProxySettings,
}
},
{
apiVersions: ["entity.k8slens.dev/v1alpha1"],
kind: "KubernetesCluster",
title: "Terminal",
components: {
View: clusterSettings.TerminalSettings,
}
},
{
apiVersions: ["entity.k8slens.dev/v1alpha1"],
kind: "KubernetesCluster",
title: "Namespaces",
components: {
View: clusterSettings.NamespacesSettings,
}
},
{
apiVersions: ["entity.k8slens.dev/v1alpha1"],
kind: "KubernetesCluster",
title: "Metrics",
components: {
View: clusterSettings.MetricsSettings,
}
}
]);
}
+28
View File
@@ -0,0 +1,28 @@
/**
* Copyright (c) 2021 OpenLens Authors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
export * from "./command-registry";
export * from "./entity-settings-registry";
export * from "./kube-object-detail-registry";
export * from "./kube-object-menu-registry";
export * from "./registries";
export * from "./welcome-menu-registry";
export * from "./workloads-overview-detail-registry";
@@ -0,0 +1,449 @@
/**
* Copyright (c) 2021 OpenLens Authors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import React from "react";
import type * as endpoints from "../api/endpoints";
import type { KubeObject } from "../api/kube-object";
import { KubeObjectDetailRegistry } from "../api/kube-object-detail-registry";
import { HpaDetails } from "../components/+config-autoscalers";
import { LimitRangeDetails } from "../components/+config-limit-ranges";
import { ConfigMapDetails } from "../components/+config-maps";
import { PodDisruptionBudgetDetails } from "../components/+config-pod-disruption-budgets";
import { ResourceQuotaDetails } from "../components/+config-resource-quotas";
import { SecretDetails } from "../components/+config-secrets";
import { CRDDetails } from "../components/+custom-resources";
import { EventDetails } from "../components/+events";
import { KubeEventDetails } from "../components/+events/kube-event-details";
import { NamespaceDetails } from "../components/+namespaces";
import { EndpointDetails } from "../components/+network-endpoints";
import { IngressDetails } from "../components/+network-ingresses";
import { NetworkPolicyDetails } from "../components/+network-policies";
import { ServiceDetails } from "../components/+network-services";
import { NodeDetails } from "../components/+nodes";
import { PodSecurityPolicyDetails } from "../components/+pod-security-policies";
import { StorageClassDetails } from "../components/+storage-classes";
import { PersistentVolumeClaimDetails } from "../components/+storage-volume-claims";
import { PersistentVolumeDetails } from "../components/+storage-volumes";
import { ClusterRoleDetails } from "../components/+user-management/+cluster-roles";
import { ClusterRoleBindingDetails } from "../components/+user-management/+cluster-role-bindings";
import { RoleDetails } from "../components/+user-management/+roles";
import { RoleBindingDetails } from "../components/+user-management/+role-bindings";
import { ServiceAccountsDetails } from "../components/+user-management/+service-accounts";
import { CronJobDetails } from "../components/+workloads-cronjobs";
import { DaemonSetDetails } from "../components/+workloads-daemonsets";
import { DeploymentDetails } from "../components/+workloads-deployments";
import { JobDetails } from "../components/+workloads-jobs";
import { PodDetails } from "../components/+workloads-pods";
import { ReplicaSetDetails } from "../components/+workloads-replicasets";
import { StatefulSetDetails } from "../components/+workloads-statefulsets";
import type { KubeObjectDetailsProps } from "../components/kube-object";
export function intiKubeObjectDetailRegistry() {
KubeObjectDetailRegistry.getInstance()
.add([
{
kind: "HorizontalPodAutoscaler",
apiVersions: ["autoscaling/v2beta1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.HorizontalPodAutoscaler>) => <HpaDetails {...props}/>,
}
},
{
kind: "HorizontalPodAutoscaler",
apiVersions: ["autoscaling/v2beta1"],
priority: 5,
components: {
Details: (props: KubeObjectDetailsProps<KubeObject>) => <KubeEventDetails {...props}/>,
}
},
{
kind: "LimitRange",
apiVersions: ["v1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.LimitRange>) => <LimitRangeDetails {...props}/>,
}
},
{
kind: "ConfigMap",
apiVersions: ["v1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.ConfigMap>) => <ConfigMapDetails {...props}/>,
}
},
{
kind: "ConfigMap",
apiVersions: ["v1"],
priority: 5,
components: {
Details: (props: KubeObjectDetailsProps<KubeObject>) => <KubeEventDetails {...props}/>,
}
},
{
kind: "PodDisruptionBudget",
apiVersions: ["policy/v1beta1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.PodDisruptionBudget>) => <PodDisruptionBudgetDetails {...props}/>,
}
},
{
kind: "ResourceQuota",
apiVersions: ["v1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.ResourceQuota>) => <ResourceQuotaDetails {...props}/>,
}
},
{
kind: "Secret",
apiVersions: ["v1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.Secret>) => <SecretDetails {...props}/>,
}
},
{
kind: "CustomResourceDefinition",
apiVersions: ["apiextensions.k8s.io/v1", "apiextensions.k8s.io/v1beta1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.CustomResourceDefinition>) => <CRDDetails {...props}/>,
}
},
{
kind: "Event",
apiVersions: ["v1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.KubeEvent>) => <EventDetails {...props}/>,
}
},
{
kind: "Namespace",
apiVersions: ["v1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.Namespace>) => <NamespaceDetails {...props}/>,
}
},
{
kind: "Endpoints",
apiVersions: ["v1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.Endpoint>) => <EndpointDetails {...props}/>,
}
},
{
kind: "Endpoints",
apiVersions: ["v1"],
priority: 5,
components: {
Details: (props: KubeObjectDetailsProps<KubeObject>) => <KubeEventDetails {...props}/>,
}
},
{
kind: "Ingress",
apiVersions: ["networking.k8s.io/v1", "extensions/v1beta1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.Ingress>) => <IngressDetails {...props}/>,
}
},
{
kind: "Ingress",
apiVersions: ["networking.k8s.io/v1", "extensions/v1beta1"],
priority: 5,
components: {
Details: (props: KubeObjectDetailsProps<KubeObject>) => <KubeEventDetails {...props}/>,
}
},
{
kind: "NetworkPolicy",
apiVersions: ["networking.k8s.io/v1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.NetworkPolicy>) => <NetworkPolicyDetails {...props}/>,
}
},
{
kind: "NetworkPolicy",
apiVersions: ["networking.k8s.io/v1"],
priority: 5,
components: {
Details: (props: KubeObjectDetailsProps<KubeObject>) => <KubeEventDetails {...props}/>,
}
},
{
kind: "Service",
apiVersions: ["v1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.Service>) => <ServiceDetails {...props}/>,
}
},
{
kind: "Service",
apiVersions: ["v1"],
priority: 5,
components: {
Details: (props: KubeObjectDetailsProps<KubeObject>) => <KubeEventDetails {...props}/>,
}
},
{
kind: "Node",
apiVersions: ["v1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.Node>) => <NodeDetails {...props}/>,
}
},
{
kind: "Node",
apiVersions: ["v1"],
priority: 5,
components: {
Details: (props: KubeObjectDetailsProps<KubeObject>) => <KubeEventDetails {...props}/>,
}
},
{
kind: "PodSecurityPolicy",
apiVersions: ["policy/v1beta1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.PodSecurityPolicy>) => <PodSecurityPolicyDetails {...props}/>,
}
},
{
kind: "StorageClass",
apiVersions: ["storage.k8s.io/v1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.StorageClass>) => <StorageClassDetails {...props}/>,
}
},
{
kind: "StorageClass",
apiVersions: ["storage.k8s.io/v1"],
priority: 5,
components: {
Details: (props: KubeObjectDetailsProps<KubeObject>) => <KubeEventDetails {...props}/>,
}
},
{
kind: "PersistentVolumeClaim",
apiVersions: ["v1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.PersistentVolumeClaim>) => <PersistentVolumeClaimDetails {...props}/>,
}
},
{
kind: "PersistentVolumeClaim",
apiVersions: ["v1"],
priority: 5,
components: {
Details: (props: KubeObjectDetailsProps<KubeObject>) => <KubeEventDetails {...props}/>,
}
},
{
kind: "PersistentVolume",
apiVersions: ["v1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.PersistentVolume>) => <PersistentVolumeDetails {...props}/>,
}
},
{
kind: "PersistentVolume",
apiVersions: ["v1"],
priority: 5,
components: {
Details: (props: KubeObjectDetailsProps<KubeObject>) => <KubeEventDetails {...props}/>,
}
},
{
kind: "Role",
apiVersions: ["rbac.authorization.k8s.io/v1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.Role>) => <RoleDetails {...props}/>,
}
},
{
kind: "Role",
apiVersions: ["rbac.authorization.k8s.io/v1"],
priority: 5,
components: {
Details: (props: KubeObjectDetailsProps<KubeObject>) => <KubeEventDetails {...props}/>,
}
},
{
kind: "ClusterRole",
apiVersions: ["rbac.authorization.k8s.io/v1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.ClusterRole>) => <ClusterRoleDetails {...props}/>,
}
},
{
kind: "ClusterRole",
apiVersions: ["rbac.authorization.k8s.io/v1"],
priority: 5,
components: {
Details: (props: KubeObjectDetailsProps<KubeObject>) => <KubeEventDetails {...props}/>,
}
},
{
kind: "RoleBinding",
apiVersions: ["rbac.authorization.k8s.io/v1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.RoleBinding>) => <RoleBindingDetails {...props}/>,
}
},
{
kind: "RoleBinding",
apiVersions: ["rbac.authorization.k8s.io/v1"],
priority: 5,
components: {
Details: (props: KubeObjectDetailsProps<KubeObject>) => <KubeEventDetails {...props}/>,
}
},
{
kind: "ClusterRoleBinding",
apiVersions: ["rbac.authorization.k8s.io/v1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.ClusterRoleBinding>) => <ClusterRoleBindingDetails {...props}/>,
}
},
{
kind: "ClusterRoleBinding",
apiVersions: ["rbac.authorization.k8s.io/v1"],
priority: 5,
components: {
Details: (props: KubeObjectDetailsProps<KubeObject>) => <KubeEventDetails {...props}/>,
}
},
{
kind: "ServiceAccount",
apiVersions: ["v1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.ServiceAccount>) => <ServiceAccountsDetails {...props}/>,
}
},
{
kind: "ServiceAccount",
apiVersions: ["v1"],
priority: 5,
components: {
Details: (props: KubeObjectDetailsProps<KubeObject>) => <KubeEventDetails {...props}/>,
}
},
{
kind: "CronJob",
apiVersions: ["batch/v1beta1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.CronJob>) => <CronJobDetails {...props}/>,
}
},
{
kind: "CronJob",
apiVersions: ["batch/v1beta1"],
priority: 5,
components: {
Details: (props: KubeObjectDetailsProps<KubeObject>) => <KubeEventDetails {...props}/>,
}
},
{
kind: "DaemonSet",
apiVersions: ["apps/v1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.DaemonSet>) => <DaemonSetDetails {...props}/>,
}
},
{
kind: "DaemonSet",
apiVersions: ["apps/v1"],
priority: 5,
components: {
Details: (props: KubeObjectDetailsProps<KubeObject>) => <KubeEventDetails {...props}/>,
}
},
{
kind: "Deployment",
apiVersions: ["apps/v1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.Deployment>) => <DeploymentDetails {...props}/>,
}
},
{
kind: "Deployment",
apiVersions: ["apps/v1"],
priority: 5,
components: {
Details: (props: KubeObjectDetailsProps<KubeObject>) => <KubeEventDetails {...props}/>,
}
},
{
kind: "Job",
apiVersions: ["batch/v1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.Job>) => <JobDetails {...props}/>,
}
},
{
kind: "Job",
apiVersions: ["batch/v1"],
priority: 5,
components: {
Details: (props: KubeObjectDetailsProps<KubeObject>) => <KubeEventDetails {...props}/>,
}
},
{
kind: "Pod",
apiVersions: ["v1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.Pod>) => <PodDetails {...props}/>,
}
},
{
kind: "Pod",
apiVersions: ["v1"],
priority: 5,
components: {
Details: (props: KubeObjectDetailsProps<KubeObject>) => <KubeEventDetails {...props}/>,
}
},
{
kind: "ReplicaSet",
apiVersions: ["apps/v1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.ReplicaSet>) => <ReplicaSetDetails {...props}/>,
}
},
{
kind: "ReplicaSet",
apiVersions: ["apps/v1"],
priority: 5,
components: {
Details: (props: KubeObjectDetailsProps<KubeObject>) => <KubeEventDetails {...props}/>,
}
},
{
kind: "StatefulSet",
apiVersions: ["apps/v1"],
components: {
Details: (props: KubeObjectDetailsProps<endpoints.StatefulSet>) => <StatefulSetDetails {...props}/>,
}
},
{
kind: "StatefulSet",
apiVersions: ["apps/v1"],
priority: 5,
components: {
Details: (props: KubeObjectDetailsProps<KubeObject>) => <KubeEventDetails {...props}/>,
}
}
]);
}
@@ -0,0 +1,68 @@
/**
* Copyright (c) 2021 OpenLens Authors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import { KubeObjectMenuRegistry } from "../../extensions/registries";
import { ServiceAccountMenu } from "../components/+user-management/+service-accounts";
import { CronJobMenu } from "../components/+workloads-cronjobs";
import { DeploymentMenu } from "../components/+workloads-deployments";
import { ReplicaSetMenu } from "../components/+workloads-replicasets";
import { StatefulSetMenu } from "../components/+workloads-statefulsets";
export function initKubeObjectMenuRegistry() {
KubeObjectMenuRegistry.getInstance()
.add([
{
kind: "ServiceAccount",
apiVersions: ["v1"],
components: {
MenuItem: ServiceAccountMenu,
}
},
{
kind: "CronJob",
apiVersions: ["batch/v1beta1"],
components: {
MenuItem: CronJobMenu
}
},
{
kind: "Deployment",
apiVersions: ["apps/v1"],
components: {
MenuItem: DeploymentMenu
}
},
{
kind: "ReplicaSet",
apiVersions: ["apps/v1"],
components: {
MenuItem: ReplicaSetMenu
}
},
{
kind: "StatefulSet",
apiVersions: ["apps/v1"],
components: {
MenuItem: StatefulSetMenu
}
}
]);
}
+39
View File
@@ -0,0 +1,39 @@
/**
* Copyright (c) 2021 OpenLens Authors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import * as registries from "../../extensions/registries";
export function initRegistries() {
registries.AppPreferenceRegistry.createInstance();
registries.CatalogEntityDetailRegistry.createInstance();
registries.ClusterPageMenuRegistry.createInstance();
registries.ClusterPageRegistry.createInstance();
registries.CommandRegistry.createInstance();
registries.EntitySettingRegistry.createInstance();
registries.GlobalPageRegistry.createInstance();
registries.KubeObjectDetailRegistry.createInstance();
registries.KubeObjectMenuRegistry.createInstance();
registries.KubeObjectStatusRegistry.createInstance();
registries.PageMenuRegistry.createInstance();
registries.StatusBarRegistry.createInstance();
registries.WelcomeMenuRegistry.createInstance();
registries.WorkloadsOverviewDetailRegistry.createInstance();
}
@@ -0,0 +1,40 @@
/**
* Copyright (c) 2021 OpenLens Authors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import { catalogURL, preferencesURL } from "../../common/routes";
import { WelcomeMenuRegistry } from "../../extensions/registries";
import { navigate } from "../navigation";
export function initWelcomeMenuRegistry() {
WelcomeMenuRegistry.getInstance()
.add([
{
title: "Browse Your Catalog",
icon: "view_list",
click: () => navigate(catalogURL())
},
{
title: "Configure Preferences",
icon: "settings",
click: () => navigate(preferencesURL())
}
]);
}
@@ -0,0 +1,45 @@
/**
* Copyright (c) 2021 OpenLens Authors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import React from "react";
import { isAllowedResource } from "../../common/rbac";
import { WorkloadsOverviewDetailRegistry } from "../../extensions/registries";
import { Events } from "../components/+events";
import { OverviewStatuses } from "../components/+workloads-overview/overview-statuses";
export function initWorkloadsOverviewDetailRegistry() {
WorkloadsOverviewDetailRegistry.getInstance()
.add([
{
components: {
Details: (props: any) => <OverviewStatuses {...props} />,
}
},
{
priority: 5,
components: {
Details: () => (
isAllowedResource("events") && <Events compact hideFilters className="box grow" />
)
}
}
]);
}