Skip to content

Commit 2dcffc5

Browse files
committed
Work on more
1 parent 32b3e36 commit 2dcffc5

3 files changed

Lines changed: 25 additions & 5 deletions

File tree

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script lang="ts">
2+
import { Plus } from '@lucide/svelte';
23
import RotateCcw from '@lucide/svelte/icons/rotate-ccw';
34
import type { SortingState } from '@tanstack/table-core';
45
import Container from '$lib/components/Container.svelte';
@@ -38,16 +39,28 @@
3839
});
3940
let sorting = $state<SortingState>([]);
4041
42+
let showAddHubModal = $state<boolean>(false);
43+
4144
onMount(refreshOwnHubs);
4245
</script>
4346

4447
<Container>
4548
<Card.Header class="w-full">
4649
<Card.Title class="flex items-center justify-between space-x-2 text-3xl">
4750
Hubs
51+
<div>
52+
<Button onclick={() => (showAddHubModal = true)}>
53+
<Plus />
54+
Add Hub
55+
</Button>
56+
<Button onclick={refreshOwnHubs}>
57+
<RotateCcw />
58+
Refresh
59+
</Button>
60+
</div>
4861
<Button class="btn variant-filled-primary text-xl" onclick={() => {}}>
4962
<RotateCcw />
50-
<span> Refresh </span>
63+
<span> Add </span>
5164
</Button>
5265
</Card.Title>
5366
<Card.Description>This is a list of all hubs you own.</Card.Description>

src/routes/(authenticated)/hubs/dialog-hub-delete.svelte

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<script lang="ts">
2+
import { hubManagementV1Api } from '$lib/api';
23
import Button from '$lib/components/ui/button/button.svelte';
34
import * as Dialog from '$lib/components/ui/dialog';
5+
import { handleApiError } from '$lib/errorhandling/apiErrorHandling';
46
import type { Hub } from './columns';
57
68
interface Props {
@@ -11,7 +13,10 @@
1113
let { open = $bindable<boolean>(), hub }: Props = $props();
1214
1315
function deleteHub() {
14-
console.log('deleteHub');
16+
hubManagementV1Api
17+
.devicesRemoveDevice(hub.id)
18+
.then(() => (open = false))
19+
.catch(handleApiError);
1520
}
1621
</script>
1722

@@ -20,7 +25,8 @@
2025
<Dialog.Header>
2126
<Dialog.Title>Delete hub</Dialog.Title>
2227
<Dialog.Description>
23-
Are you sure you want to delete <strong>{hub.name}</strong>?
28+
Are you sure you want to delete <strong>{hub.name}</strong>?<br />
29+
<strong>This action is irreversible.</strong>
2430
</Dialog.Description>
2531
</Dialog.Header>
2632
<Button variant="destructive" onclick={deleteHub}>Delete</Button>

src/routes/(authenticated)/settings/api-tokens/+page.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script lang="ts">
2+
import Plus from '@lucide/svelte/icons/plus';
23
import RotateCcw from '@lucide/svelte/icons/rotate-ccw';
34
import type { SortingState } from '@tanstack/table-core';
45
import type { TokenResponse } from '$lib/api/internal/v1';
@@ -40,8 +41,8 @@
4041
API Tokens
4142
<div>
4243
<Button onclick={() => (showGenerateTokenModal = true)}>
43-
<RotateCcw />
44-
<span> Generate Token </span>
44+
<Plus />
45+
Generate Token
4546
</Button>
4647
<Button onclick={refreshApiTokens}>
4748
<RotateCcw />

0 commit comments

Comments
 (0)