Path: blob/main/components/dashboard/src/repositories/detail/general/RemoveConfigurationModal.tsx
2502 views
/**1* Copyright (c) 2024 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 ConfirmationModal from "../../../components/ConfirmationModal";8import type { Configuration } from "@gitpod/public-api/lib/gitpod/v1/configuration_pb";9import { useDeleteConfiguration } from "../../../data/configurations/configuration-queries";1011type Props = {12configuration: Configuration;13onClose: () => void;14onRemoved: () => void;15};16export const RemoveConfigurationModal: FunctionComponent<Props> = ({ configuration, onClose, onRemoved }) => {17const removeConfigMutation = useDeleteConfiguration();1819const removeProject = useCallback(async () => {20removeConfigMutation.mutate(21{ configurationId: configuration.id },22{23onSuccess: () => onRemoved(),24},25);26}, [removeConfigMutation, configuration.id, onRemoved]);2728return (29<ConfirmationModal30title="Remove Configuration"31areYouSureText="Are you sure you want to remove this repository configuration from this organization? Organization members will also lose access to it."32children={{33name: configuration.name ?? "",34description: configuration.cloneUrl ?? "",35}}36buttonText="Remove Configuration"37buttonDisabled={removeConfigMutation.isLoading}38onClose={onClose}39onConfirm={removeProject}40visible41/>42);43};444546