diff --git a/frontend/src/routes/admin/+page.svelte b/frontend/src/routes/admin/+page.svelte index a40ca891..75d458f2 100644 --- a/frontend/src/routes/admin/+page.svelte +++ b/frontend/src/routes/admin/+page.svelte @@ -1,66 +1,14 @@
@@ -107,466 +55,20 @@ async function backfillFileHashes() { {/if} {#if activeTab === 'users'} -
-
-

{m.admin_section_users()}

- - - - - {m.admin_btn_new_user()} - -
- - - - - - - - - - - - {#each data.users as user (user.id)} - - - - - - - {/each} - -
{m.admin_col_login()}{m.admin_col_full_name()}{m.admin_col_groups()}{m.admin_col_actions()}
- {user.username} - - {#if user.firstName || user.lastName} - {user.firstName ?? ''} {user.lastName ?? ''} - {:else} - - {/if} - -
- {#if user.groups && user.groups.length > 0} - {#each user.groups as group (group.id)} - - {group.name} - - {/each} - {:else} - {m.admin_no_groups()} - {/if} -
-
-
- - {m.btn_edit()} - - -
{ - if (!confirm(m.admin_user_delete_confirm({ username: user.username }))) { - cancel(); - } - return async ({ update }) => { - await update(); - }; - }} - class="flex items-center" - > - - -
-
-
+
+
{:else if activeTab === 'tags'} -
-
-

{m.admin_section_tags()}

-

- {m.admin_tags_warning()} -

-
- -
    - {#each data.tags as tag (tag.id)} -
  • - {#if editingTagId === tag.id} -
    - async ({ update }) => { - await update(); - cancelEditTag(); - }} - class="flex flex-1 items-center gap-2" - > - - - - -
    - {:else} - - {tag.name} - -
    - -
    { - if ( - !confirm(m.admin_tag_delete_confirm()) - ) { - cancel(); - } - return async ({ update }) => { - await update(); - }; - }} - class="inline" - > - - -
    -
    - {/if} -
  • - {/each} -
+
+
{:else if activeTab === 'groups'} -
-
-

{m.admin_section_groups()}

-
- - - - - - - - - - - {#each data.groups as group (group.id)} - - {#if editingGroupId === group.id} - - - {:else} - - - - - {/if} - - {/each} - -
{m.admin_col_name()}{m.admin_col_permissions()}{m.admin_col_actions()}
-
- async ({ update }) => { - await update(); - cancelEditGroup(); - }} - class="flex w-full flex-col items-start gap-4 sm:flex-row" - > - - -
- -
- -
- {#each availablePermissions as perm (perm)} - - {/each} -
- -
- - -
-
-
- {group.name} - -
- {#each group.permissions as perm (perm)} - - {perm} - - {/each} -
-
-
- - -
{ - if (!confirm(m.admin_group_delete_confirm())) { - cancel(); - } - return async ({ update }) => { - await update(); - }; - }} - > - - -
-
-
- - -
-

- {m.admin_section_new_group()} -

-
-
- -
- -
- {#each availablePermissions as perm (perm)} - - {/each} -
- - -
-
+
+
{:else if activeTab === 'system'} -
-

{m.admin_system_backfill_heading()}

-

{m.admin_system_backfill_description()}

- - {#if backfillResult !== null} -

- {m.admin_system_backfill_success({ count: backfillResult })} -

- {/if} -
- -
-

- {m.admin_system_backfill_hashes_heading()} -

-

{m.admin_system_backfill_hashes_description()}

- - {#if backfillHashesResult !== null} -

- {m.admin_system_backfill_hashes_success({ count: backfillHashesResult })} -

- {/if} +
+
{/if}
diff --git a/frontend/src/routes/admin/GroupsTab.svelte b/frontend/src/routes/admin/GroupsTab.svelte new file mode 100644 index 00000000..0f96cc22 --- /dev/null +++ b/frontend/src/routes/admin/GroupsTab.svelte @@ -0,0 +1,221 @@ + + +
+
+

{m.admin_section_groups()}

+
+ + + + + + + + + + + {#each groups as group (group.id)} + + {#if editingGroupId === group.id} + + + {:else} + + + + + {/if} + + {/each} + +
{m.admin_col_name()}{m.admin_col_permissions()}{m.admin_col_actions()}
+
+ async ({ update }) => { + await update(); + cancelEditGroup(); + }} + class="flex w-full flex-col items-start gap-4 sm:flex-row" + > + + +
+ +
+ +
+ {#each availablePermissions as perm (perm)} + + {/each} +
+ +
+ + +
+
+
+ {group.name} + +
+ {#each group.permissions as perm (perm)} + + {perm} + + {/each} +
+
+
+ + +
{ + if (!confirm(m.admin_group_delete_confirm())) { + cancel(); + } + return async ({ update }) => { + await update(); + }; + }} + > + + +
+
+
+ + +
+

+ {m.admin_section_new_group()} +

+
+
+ +
+ +
+ {#each availablePermissions as perm (perm)} + + {/each} +
+ + +
+
+
diff --git a/frontend/src/routes/admin/SystemTab.svelte b/frontend/src/routes/admin/SystemTab.svelte new file mode 100644 index 00000000..bd80e61c --- /dev/null +++ b/frontend/src/routes/admin/SystemTab.svelte @@ -0,0 +1,72 @@ + + +
+

{m.admin_system_backfill_heading()}

+

{m.admin_system_backfill_description()}

+ + {#if backfillResult !== null} +

+ {m.admin_system_backfill_success({ count: backfillResult })} +

+ {/if} +
+ +
+

+ {m.admin_system_backfill_hashes_heading()} +

+

{m.admin_system_backfill_hashes_description()}

+ + {#if backfillHashesResult !== null} +

+ {m.admin_system_backfill_hashes_success({ count: backfillHashesResult })} +

+ {/if} +
diff --git a/frontend/src/routes/admin/TagsTab.svelte b/frontend/src/routes/admin/TagsTab.svelte new file mode 100644 index 00000000..01a1fec0 --- /dev/null +++ b/frontend/src/routes/admin/TagsTab.svelte @@ -0,0 +1,127 @@ + + +
+
+

{m.admin_section_tags()}

+

+ {m.admin_tags_warning()} +

+
+ +
    + {#each tags as tag (tag.id)} +
  • + {#if editingTagId === tag.id} +
    + async ({ update }) => { + await update(); + cancelEditTag(); + }} + class="flex flex-1 items-center gap-2" + > + + + + +
    + {:else} + + {tag.name} + +
    + +
    { + if (!confirm(m.admin_tag_delete_confirm())) { + cancel(); + } + return async ({ update }) => { + await update(); + }; + }} + class="inline" + > + + +
    +
    + {/if} +
  • + {/each} +
+
diff --git a/frontend/src/routes/admin/UsersTab.svelte b/frontend/src/routes/admin/UsersTab.svelte new file mode 100644 index 00000000..de8dd02a --- /dev/null +++ b/frontend/src/routes/admin/UsersTab.svelte @@ -0,0 +1,120 @@ + + +
+
+

{m.admin_section_users()}

+ + + + + {m.admin_btn_new_user()} + +
+ + + + + + + + + + + + {#each users as user (user.id)} + + + + + + + {/each} + +
{m.admin_col_login()}{m.admin_col_full_name()}{m.admin_col_groups()}{m.admin_col_actions()}
+ {user.username} + + {#if user.firstName || user.lastName} + {user.firstName ?? ''} {user.lastName ?? ''} + {:else} + + {/if} + +
+ {#if user.groups && user.groups.length > 0} + {#each user.groups as group (group.id)} + + {group.name} + + {/each} + {:else} + {m.admin_no_groups()} + {/if} +
+
+
+ + {m.btn_edit()} + + +
{ + if (!confirm(m.admin_user_delete_confirm({ username: user.username }))) { + cancel(); + } + return async ({ update }) => { + await update(); + }; + }} + class="flex items-center" + > + + +
+
+
+