-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
246 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { FileSlidersIcon } from "lucide-react"; | ||
import { | ||
CommandDialog, | ||
CommandEmpty, | ||
CommandGroup, | ||
CommandInput, | ||
CommandItem, | ||
CommandList, | ||
CommandSeparator, | ||
} from "../ui/command"; | ||
import NewServiceItem from "./NewServiceItem"; | ||
import { ServiceDto } from "@/services/getServicesApi"; | ||
|
||
type CommandModalProps = { | ||
open: boolean; | ||
services: ServiceDto[]; | ||
setOpen: (open: boolean) => void; | ||
createService: (serviceId: string) => void; | ||
}; | ||
|
||
export default function CommandModal({ | ||
open, | ||
setOpen, | ||
services, | ||
createService, | ||
}: CommandModalProps) { | ||
return ( | ||
<CommandDialog open={open} onOpenChange={setOpen}> | ||
<CommandInput placeholder="Type to search and lauch a service in the list..." /> | ||
<CommandList onSelect={() => setOpen(false)}> | ||
<CommandEmpty>No results found.</CommandEmpty> | ||
<CommandGroup heading="Local Config"> | ||
<CommandItem className="flex gap-3" value="compose"> | ||
<FileSlidersIcon className="w-5"></FileSlidersIcon> | ||
<span className="h-4">From your docker-compose file</span> | ||
</CommandItem> | ||
</CommandGroup> | ||
<CommandSeparator /> | ||
<CommandGroup heading="Other sercices"> | ||
{services.map((s) => ( | ||
<NewServiceItem key={s.name} service={s} onSelect={createService} /> | ||
))} | ||
{/* TODO: command item to add new service link to github issue template */} | ||
</CommandGroup> | ||
</CommandList> | ||
</CommandDialog> | ||
); | ||
} |
72 changes: 72 additions & 0 deletions
72
web/src/components/databaseServices/DeleteServiceAlert.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { deleteServiceApi } from "@/services/deleteServiceApi"; | ||
import { | ||
Dialog, | ||
DialogContent, | ||
DialogDescription, | ||
DialogTitle, | ||
} from "@radix-ui/react-dialog"; | ||
import { DialogFooter, DialogHeader } from "../ui/dialog"; | ||
import { Button } from "../ui/button"; | ||
import { Service } from "@/services/getServicesByDeployId"; | ||
|
||
type DeleteServiceAlertProps = { | ||
deployId: string; | ||
serviceToDelete: Service | null; | ||
fetchServiceList: () => Promise<void>; | ||
setServiceToDelete: (service: Service | null) => void; | ||
}; | ||
|
||
export default function DeleteServiceAlert({ | ||
deployId, | ||
serviceToDelete, | ||
fetchServiceList, | ||
setServiceToDelete, | ||
}: DeleteServiceAlertProps) { | ||
async function deleteService() { | ||
const serviceId = serviceToDelete?.id; | ||
|
||
if (!serviceId) { | ||
return; | ||
} | ||
try { | ||
await deleteServiceApi(deployId, serviceId); | ||
await fetchServiceList(); | ||
} catch (e) { | ||
console.error(e); | ||
} | ||
setServiceToDelete(null); | ||
} | ||
|
||
return ( | ||
<Dialog | ||
open={serviceToDelete !== null} | ||
onOpenChange={(open) => { | ||
if (open) { | ||
return; | ||
} else { | ||
setServiceToDelete(null); | ||
} | ||
}} | ||
> | ||
<DialogContent> | ||
<DialogHeader> | ||
<DialogTitle> | ||
Are you sure you want to delete this service? | ||
</DialogTitle> | ||
</DialogHeader> | ||
<DialogDescription> | ||
<div> | ||
This action is irreversible. Deleting this service will remove all | ||
data associated with it. | ||
</div> | ||
</DialogDescription> | ||
<DialogFooter> | ||
<Button onClick={() => setServiceToDelete(null)}>Cancel</Button> | ||
<Button variant="destructive" onClick={deleteService}> | ||
Delete | ||
</Button> | ||
</DialogFooter> | ||
</DialogContent> | ||
</Dialog> | ||
); | ||
} |
7 changes: 5 additions & 2 deletions
7
web/src/components/DatabaseCard.tsx → ...nents/databaseServices/NewServiceItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.