Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/dashboard/src/repositories/detail/general/RemoveConfigurationModal.tsx
2502 views
1
/**
2
* Copyright (c) 2024 Gitpod GmbH. All rights reserved.
3
* Licensed under the GNU Affero General Public License (AGPL).
4
* See License.AGPL.txt in the project root for license information.
5
*/
6
7
import { FunctionComponent, useCallback } from "react";
8
import ConfirmationModal from "../../../components/ConfirmationModal";
9
import type { Configuration } from "@gitpod/public-api/lib/gitpod/v1/configuration_pb";
10
import { useDeleteConfiguration } from "../../../data/configurations/configuration-queries";
11
12
type Props = {
13
configuration: Configuration;
14
onClose: () => void;
15
onRemoved: () => void;
16
};
17
export const RemoveConfigurationModal: FunctionComponent<Props> = ({ configuration, onClose, onRemoved }) => {
18
const removeConfigMutation = useDeleteConfiguration();
19
20
const removeProject = useCallback(async () => {
21
removeConfigMutation.mutate(
22
{ configurationId: configuration.id },
23
{
24
onSuccess: () => onRemoved(),
25
},
26
);
27
}, [removeConfigMutation, configuration.id, onRemoved]);
28
29
return (
30
<ConfirmationModal
31
title="Remove Configuration"
32
areYouSureText="Are you sure you want to remove this repository configuration from this organization? Organization members will also lose access to it."
33
children={{
34
name: configuration.name ?? "",
35
description: configuration.cloneUrl ?? "",
36
}}
37
buttonText="Remove Configuration"
38
buttonDisabled={removeConfigMutation.isLoading}
39
onClose={onClose}
40
onConfirm={removeProject}
41
visible
42
/>
43
);
44
};
45
46