90 lines
2.5 KiB
TypeScript
Raw Normal View History

feat: [SIG-526]: UI Integrations V0 (#4595) * feat: integrations v0 base setup routes and components * chore: typecheck fix * feat: integrations landing page changes * feat: initial header setup * feat: integrations list page setup * feat: integrations details content root setup * feat: integration detail content setup * feat: added overview tab * feat: added data tab * feat: handle configuration tab * feat: add min height for the container * feat: generate apis and hooks for usage * feat: added remove integration modal * feat: added remove integration modal * feat: added remove integration modal * feat: added test connection bars * chore: add bottom margins * feat: added test connection modal * feat: add all types of test connection * feat: add all types of test connection * fix: address review comments * fix: address review comments * feat: added get all integrations API and search bar implemnetation * feat: navigate to overview section in case of row click and configure in btn * feat: integrate get integration details api * feat: handle integration details page gracefully * feat: integrate uninstall API and the connection states * feat: add install integration API call * feat: added api error handling * feat: handle error states for list and details api * feat: handle the logs and metrics columns * feat: add TODOs for pending tasks * feat: comment from side nav * feat: added support for custom tags in react markdown * chore: revert the temporary change for merge * feat: integrate the status api calls and polling logic * chore: add markdown components and correct the polling issue * chore: handle light mode * chore: remove integrations from sideNav * fix: address review comments * fix: address review comments
2024-03-06 22:25:02 +05:30
import './IntegrationDetailPage.styles.scss';
import { Button, Modal, Typography } from 'antd';
import unInstallIntegration from 'api/Integrations/uninstallIntegration';
import { SOMETHING_WENT_WRONG } from 'constants/api';
import { useNotifications } from 'hooks/useNotifications';
import { X } from 'lucide-react';
import { useState } from 'react';
import { useMutation } from 'react-query';
interface IntergrationsUninstallBarProps {
integrationTitle: string;
integrationId: string;
refetchIntegrationDetails: () => void;
}
function IntergrationsUninstallBar(
props: IntergrationsUninstallBarProps,
): JSX.Element {
const { integrationTitle, integrationId, refetchIntegrationDetails } = props;
const { notifications } = useNotifications();
const [isModalOpen, setIsModalOpen] = useState(false);
const {
mutate: uninstallIntegration,
isLoading: isUninstallLoading,
} = useMutation(unInstallIntegration, {
onSuccess: () => {
refetchIntegrationDetails();
setIsModalOpen(false);
},
onError: () => {
notifications.error({
message: SOMETHING_WENT_WRONG,
});
},
});
const showModal = (): void => {
setIsModalOpen(true);
};
const handleOk = (): void => {
uninstallIntegration({
integration_id: integrationId,
feat: [SIG-526]: UI Integrations V0 (#4595) * feat: integrations v0 base setup routes and components * chore: typecheck fix * feat: integrations landing page changes * feat: initial header setup * feat: integrations list page setup * feat: integrations details content root setup * feat: integration detail content setup * feat: added overview tab * feat: added data tab * feat: handle configuration tab * feat: add min height for the container * feat: generate apis and hooks for usage * feat: added remove integration modal * feat: added remove integration modal * feat: added remove integration modal * feat: added test connection bars * chore: add bottom margins * feat: added test connection modal * feat: add all types of test connection * feat: add all types of test connection * fix: address review comments * fix: address review comments * feat: added get all integrations API and search bar implemnetation * feat: navigate to overview section in case of row click and configure in btn * feat: integrate get integration details api * feat: handle integration details page gracefully * feat: integrate uninstall API and the connection states * feat: add install integration API call * feat: added api error handling * feat: handle error states for list and details api * feat: handle the logs and metrics columns * feat: add TODOs for pending tasks * feat: comment from side nav * feat: added support for custom tags in react markdown * chore: revert the temporary change for merge * feat: integrate the status api calls and polling logic * chore: add markdown components and correct the polling issue * chore: handle light mode * chore: remove integrations from sideNav * fix: address review comments * fix: address review comments
2024-03-06 22:25:02 +05:30
});
};
const handleCancel = (): void => {
setIsModalOpen(false);
};
return (
<div className="uninstall-integration-bar">
<div className="unintall-integration-bar-text">
<Typography.Text className="heading">Remove Integration</Typography.Text>
<Typography.Text className="subtitle">
Removing the {integrationTitle} integration would make your workspace stop
listening for data from {integrationTitle} instances.
</Typography.Text>
</div>
<Button
className="uninstall-integration-btn"
icon={<X size={14} />}
onClick={(): void => showModal()}
>
Remove from SigNoz
</Button>
<Modal
className="remove-integration-modal"
open={isModalOpen}
title="Remove integration"
onOk={handleOk}
onCancel={handleCancel}
okText="Remove Integration"
okButtonProps={{
danger: true,
disabled: isUninstallLoading,
}}
>
<Typography.Text className="remove-integration-text">
Removing this integration makes SigNoz stop listening for data from{' '}
{integrationTitle} instances. You would still have to manually remove the
configuration in your code to stop sending data.
</Typography.Text>
</Modal>
</div>
);
}
export default IntergrationsUninstallBar;