Path: blob/main/components/dashboard/src/teams/variables/OrganizationRemoveEnvvarModal.tsx
2506 views
/**1* Copyright (c) 2025 Gitpod GmbH. All rights reserved.2* Licensed under the GNU Affero General Public License (AGPL).3* See License.AGPL.txt in the project root for license information.4*/56import { FunctionComponent, useCallback } from "react";7import { useToast } from "../../components/toasts/Toasts";8import ConfirmationModal from "../../components/ConfirmationModal";9import type { OrganizationEnvironmentVariable } from "@gitpod/public-api/lib/gitpod/v1/envvar_pb";10import { useDeleteOrganizationEnvironmentVariable } from "../../data/organizations/org-envvar-queries";1112type Props = {13variable: OrganizationEnvironmentVariable;14organizationId: string;15onClose(): void;16};17export const OrganizationRemoveEnvvarModal: FunctionComponent<Props> = ({ variable, organizationId, onClose }) => {18const deleteVariable = useDeleteOrganizationEnvironmentVariable();19const { toast } = useToast();2021const handleConfirmation = useCallback(() => {22deleteVariable.mutate(23{ variableId: variable.id, organizationId },24{25onSuccess: () => {26toast("Your variable was deleted");27onClose();28},29onError: (err) => {30toast(`Could not delete variable: ${err.message}`);31},32},33);34}, [organizationId, deleteVariable, onClose, toast, variable.id]);3536return (37<ConfirmationModal38title="Delete variable"39areYouSureText="Are you sure you want to delete this variable?"40children={{41name: variable.name,42}}43buttonText="Delete variable"44warningText={deleteVariable.isError ? "There was a problem deleting this variable." : undefined}45onClose={onClose}46onConfirm={handleConfirmation}47visible48/>49);50};515253