import pluginId from '../../pluginId'; import Config from '../../../../types/Config'; import { Table, TFooter, Thead, Tbody, Tr, Td, Th, Flex, Box, IconButton, Main, } from '@strapi/design-system'; import { Plus, Trash } from '@strapi/icons'; import { useState } from 'react'; import { getFetchClient } from '@strapi/helper-plugin'; import { Link } from 'react-router-dom'; import useFormattedLabel from '../../hooks/useFormattedLabel'; import PageLoading from '../PageLoading'; import useFetch from '../../hooks/useFetch'; import { ConfirmDialog } from '../ConfirmDialog'; export default function ConfigsTable() { const [data, isDataLoading, refetchData] = useFetch(`/${pluginId}/config`); const { del } = getFetchClient(); const [isConfirmDialogOpen, setIsConformDialogOpen] = useState(false); const CONFIRM_DELETE_MESSAGE = useFormattedLabel('settings.table.confirmDelete.message'); async function handleDetete(id: string) { const deleteConfirm = await del(`/${pluginId}/config/${id}`); if (deleteConfirm) { try { refetchData(); } catch (err) { console.error(err); } } } const toggleConfirmDialog = () => { setIsConformDialogOpen((prev) => !prev); }; const COL_COUNT = 4; const FooterButton = () => { const FOOTER_LABEL = useFormattedLabel('settings.table.footer.label'); return ( ({ ...location, pathname: `${location.pathname}/new-workflow` })} style={{ textDecoration: 'none' }} icon={} > {FOOTER_LABEL} ); }; return isDataLoading ? ( ) : (
}> {data && data.map((config) => ( ))}
Id GitHub Account Repo Branch Workflow
{config.id} {config.githubAccount} {config.repo} {config.branch} {config.workflow} handleDetete(`${config.id}`)} />
); }