From 272a7a151218670a7b0f6d2da54b58dc185d6281 Mon Sep 17 00:00:00 2001 From: Kyrylo Shmidt Date: Mon, 11 Mar 2024 12:26:11 +0100 Subject: [PATCH] Enable Shared environment creation if deployment is Helm --- .../RecentActivity/EnvironmentTypePanel/index.tsx | 9 +++++++-- src/components/common/App/types.ts | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/RecentActivity/EnvironmentTypePanel/index.tsx b/src/components/RecentActivity/EnvironmentTypePanel/index.tsx index 5b3487dfd..3bcfe2185 100644 --- a/src/components/RecentActivity/EnvironmentTypePanel/index.tsx +++ b/src/components/RecentActivity/EnvironmentTypePanel/index.tsx @@ -1,5 +1,7 @@ +import { useContext } from "react"; import { openURLInDefaultBrowser } from "../../../utils/openURLInDefaultBrowser"; import { sendTrackingEvent } from "../../../utils/sendTrackingEvent"; +import { ConfigContext } from "../../common/App/ConfigContext"; import { EnvironmentType } from "../../common/App/types"; import { IconTag } from "../../common/IconTag"; import { NewButton } from "../../common/NewButton"; @@ -12,6 +14,9 @@ import { EnvironmentTypeData, EnvironmentTypePanelProps } from "./types"; const DIGMA_FOR_TEAMS_URL = "https://digma.ai/digma-for-teams/"; export const EnvironmentTypePanel = (props: EnvironmentTypePanelProps) => { + const config = useContext(ConfigContext); + const isHelmDeployment = config.backendInfo?.deploymentType === "Helm"; + const handleEnvironmentTypeButtonClick = (type: EnvironmentType) => { const typeData = environmentTypes.find((x) => x.type === type); @@ -21,7 +26,7 @@ export const EnvironmentTypePanel = (props: EnvironmentTypePanelProps) => { }); } - if (type === "shared") { + if (type === "shared" && !isHelmDeployment) { openURLInDefaultBrowser(DIGMA_FOR_TEAMS_URL); return; } @@ -54,7 +59,7 @@ export const EnvironmentTypePanel = (props: EnvironmentTypePanelProps) => { button: ( handleEnvironmentTypeButtonClick("shared")} - label={"Learn more"} + label={isHelmDeployment ? "Add" : "Learn more"} buttonType={"secondary"} size={"large"} /> diff --git a/src/components/common/App/types.ts b/src/components/common/App/types.ts index 88c47052b..23d883512 100644 --- a/src/components/common/App/types.ts +++ b/src/components/common/App/types.ts @@ -24,6 +24,7 @@ export interface BackendInfo { } export enum DeploymentType { + HELM = "Helm", DOCKER_COMPOSE = "DockerCompose", DOCKER_EXTENSION = "DockerExtension" }