From f0de422c6e9aae3bb8a3551bef39e3d0cd9b01fb Mon Sep 17 00:00:00 2001 From: Christoph Kluge Date: Wed, 11 Sep 2024 11:28:11 +0200 Subject: [PATCH] rework tagManagement modal render --- web/frontend/src/Job.root.svelte | 14 +- web/frontend/src/job/TagManagement.svelte | 199 ++++++++++++++-------- 2 files changed, 131 insertions(+), 82 deletions(-) diff --git a/web/frontend/src/Job.root.svelte b/web/frontend/src/Job.root.svelte index 8216ed0..17588fb 100644 --- a/web/frontend/src/Job.root.svelte +++ b/web/frontend/src/Job.root.svelte @@ -326,13 +326,13 @@ - - {#if $initq.data} - - {/if} - + {#if $initq.data} + + + + {/if}
diff --git a/web/frontend/src/job/TagManagement.svelte b/web/frontend/src/job/TagManagement.svelte index d3d343e..f358c71 100644 --- a/web/frontend/src/job/TagManagement.svelte +++ b/web/frontend/src/job/TagManagement.svelte @@ -186,81 +186,130 @@ {/if} - - - - Search using "type: name". If no tag matches your search, a - button for creating a new one will appear. - -
-
    - {#each allTagsFiltered as tag} - - - - - {#if pendingChange === tag.id} - - {:else if job.tags.find((t) => t.id == tag.id)} - - {:else} - - {/if} - - + + + + + + + Search using "type: name". If no tag matches your search, a + button for creating a new one will appear. + + + +
    + {#if usedTagsFiltered.length > 0} + + {#each usedTagsFiltered as utag} + + + + + {#if pendingChange === utag.id} + + {:else} + + {/if} + + + {/each} + + {:else if filterTerm !== ""} + + + No attached tags matching. + + {:else} - - No tags matching - - {/each} -
-
+ + + Job has no attached tags. + + + {/if} + + {#if unusedTagsFiltered.length > 0} + + {#each unusedTagsFiltered as uutag} + + + + + {#if pendingChange === uutag.id} + + {:else} + + {/if} + + + {/each} + + {:else if filterTerm !== ""} + + + No unused tags matching. + + + {:else} + + + No unused tags available. + + + {/if} + + {#if newTagType && newTagName && isNewTag(newTagType, newTagName)} -
- - {#if roles && authlevel >= roles.admin} - + Add new tag: + + + + {#if isAdmin} + + + + + + + {/if} -
- {:else if allTagsFiltered.length == 0} - Search Term is not a valid Tag (type: name) +
+ {:else if filterTerm !== "" && allTagsFiltered.length == 0} + + Search Term is not a valid Tag (type: name) + + {:else if filterTerm == "" && unusedTagsFiltered.length == 0} + + Type "type: name" into the search field to create a new tag. + {/if} @@ -271,6 +320,7 @@ + {:else} @@ -399,9 +449,8 @@ {/if}