From 50e87ed8db28087f93892a9b10f170e5eb181306 Mon Sep 17 00:00:00 2001 From: lucarickli Date: Sat, 11 Jan 2025 18:37:49 +0100 Subject: [PATCH] more actions --- src/lib/api/headscale.ts | 2 - .../data/acl/AccessControlInfo.svelte | 18 ++- src/lib/components/data/acl/CreateRule.svelte | 139 ++++++++++++++++++ src/lib/components/data/acl/EditRule.svelte | 98 +++++++----- src/lib/components/data/acl/RuleInfo.svelte | 5 +- .../components/data/apikey/ApikeyInfo.svelte | 4 +- src/lib/components/data/host/HostInfo.svelte | 75 ++++++++++ .../components/data/page/PageActions.svelte | 37 +++-- .../data/page/UserAndGroupInfo.svelte | 2 +- src/lib/components/data/tag/CreateTag.svelte | 4 +- src/routes/(app)/+page.svelte | 8 +- src/routes/(app)/+page.ts | 3 - 12 files changed, 324 insertions(+), 71 deletions(-) create mode 100644 src/lib/components/data/acl/CreateRule.svelte create mode 100644 src/lib/components/data/host/HostInfo.svelte diff --git a/src/lib/api/headscale.ts b/src/lib/api/headscale.ts index 7af5b39..653d219 100644 --- a/src/lib/api/headscale.ts +++ b/src/lib/api/headscale.ts @@ -716,8 +716,6 @@ export class Acl { const p: V1Policy = policy?.length ? parse(stripJsonTrailingCommas(policy)) : undefined; const comments = p as unknown as V1PolicyComments; - console.debug({ p, comments, policy }); - return { policy: p, comments, diff --git a/src/lib/components/data/acl/AccessControlInfo.svelte b/src/lib/components/data/acl/AccessControlInfo.svelte index 8b5e23a..5ab570d 100644 --- a/src/lib/components/data/acl/AccessControlInfo.svelte +++ b/src/lib/components/data/acl/AccessControlInfo.svelte @@ -4,9 +4,13 @@ import type { Acl, User } from '$lib/api'; import RuleInfo from './RuleInfo.svelte'; import Plus from 'lucide-svelte/icons/plus'; + import CreateRule from './CreateRule.svelte'; + import { createEventDispatcher } from 'svelte'; export let acl: Acl; export let users: User[] | undefined; + + const dispatch = createEventDispatcher<{ close: undefined }>(); @@ -21,16 +25,20 @@
{#each acl?.acls || [] as rule} - + {/each}
diff --git a/src/lib/components/data/acl/CreateRule.svelte b/src/lib/components/data/acl/CreateRule.svelte new file mode 100644 index 0000000..22e1fa1 --- /dev/null +++ b/src/lib/components/data/acl/CreateRule.svelte @@ -0,0 +1,139 @@ + + + + + + + + + + Create rule + + + + + + Action + + + + + + + + accept + + + + + + + + + Source + + + + + + + + Destination + + + + + + + + Description +