import { Button, Group, Modal, Title } from '@mantine/core'; import { showNotification, updateNotification } from '@mantine/notifications'; import { IconCheck, IconPlayerPlay, IconPlayerStop, IconPlus, IconRefresh, IconRotateClockwise, IconTrash, } from '@tabler/icons'; import axios from 'axios'; import Dockerode from 'dockerode'; import { tryMatchService } from '../../tools/addToHomarr'; import { AddAppShelfItemForm } from '../../components/AppShelf/AddAppShelfItem'; import { useState } from 'react'; function sendDockerCommand( action: string, containerId: string, containerName: string, reload: () => void ) { showNotification({ id: containerId, loading: true, title: `${action}ing container ${containerName}`, message: undefined, autoClose: false, disallowClose: true, }); axios .get(`/api/docker/container/${containerId}?action=${action}`) .then((res) => { updateNotification({ id: containerId, title: `Container ${containerName} ${action}ed`, message: `Your container was successfully ${action}ed`, icon: , autoClose: 2000, }); }) .catch((err) => { updateNotification({ id: containerId, color: 'red', title: 'There was an error', message: err.response.data.reason, autoClose: 2000, }); }) .finally(() => { reload(); }); } export interface ContainerActionBarProps { selected: Dockerode.ContainerInfo[]; reload: () => void; } export default function ContainerActionBar({ selected, reload }: ContainerActionBarProps) { const [opened, setOpened] = useState(false); return ( setOpened(false)} title="Add service" > ); }