Skip to content

Commit fa6e8cf

Browse files
committed
Add hub creation dialog
Closes #129
1 parent 6dcd692 commit fa6e8cf

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

src/routes/(authenticated)/hubs/+page.svelte

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import { onMount } from 'svelte';
1313
import { type Hub, columns } from './columns';
1414
import DataTableActions from './data-table-actions.svelte';
15+
import HubCreateDialog from './dialog-hub-create.svelte';
1516
1617
const isMobile = new IsMobile();
1718
@@ -48,6 +49,8 @@
4849
onMount(refreshOwnHubs);
4950
</script>
5051

52+
<HubCreateDialog bind:open={showAddHubModal} />
53+
5154
<Container>
5255
<Card.Header class="w-full">
5356
<Card.Title class="flex items-center justify-between space-x-2 text-3xl">
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<script lang="ts">
2+
import { hubManagementV1Api } from '$lib/api';
3+
import { Button } from '$lib/components/ui/button';
4+
import * as Dialog from '$lib/components/ui/dialog';
5+
import { handleApiError } from '$lib/errorhandling/apiErrorHandling';
6+
7+
interface Props {
8+
open: boolean;
9+
}
10+
11+
let { open = $bindable<boolean>() }: Props = $props();
12+
13+
function onSubmit() {
14+
hubManagementV1Api
15+
.devicesCreateDevice()
16+
.catch(handleApiError)
17+
.finally(() => (open = false));
18+
}
19+
</script>
20+
21+
<Dialog.Root bind:open={() => open, (o) => (open = o)}>
22+
<Dialog.Content>
23+
<Dialog.Header>
24+
<Dialog.Title>Create hub</Dialog.Title>
25+
</Dialog.Header>
26+
<Button onclick={onSubmit}>Create</Button>
27+
</Dialog.Content>
28+
</Dialog.Root>

0 commit comments

Comments
 (0)