-
Notifications
You must be signed in to change notification settings - Fork 172
feat: add tags to all resources; feature flag to view tags as folders #9283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 10 commits
88ffa19
e1baab5
cc69880
1fd640f
3f17d37
9381af7
1488ea8
98626eb
001fa6d
bf47792
ab4b206
8a51dde
30acdfa
3955a43
88bc52d
e4cc524
1a2b3f1
4546946
0b99483
2c6c70f
fc452bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handling is missing in the code for unified metrics and explores in |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| <script lang="ts"> | ||
| import { beforeNavigate } from "$app/navigation"; | ||
| import * as DropdownMenu from "@rilldata/web-common/components/dropdown-menu"; | ||
| import CaretDownIcon from "@rilldata/web-common/components/icons/CaretDownIcon.svelte"; | ||
| import CaretUpIcon from "@rilldata/web-common/components/icons/CaretUpIcon.svelte"; | ||
| import { Search } from "@rilldata/web-common/components/search"; | ||
|
|
||
| export let availableTags: string[] = []; | ||
| export let selectedTags: string[] = []; | ||
| export let onTagsChange: (tags: string[]) => void; | ||
| export let searchText = ""; | ||
|
|
||
| let tagsOpen = false; | ||
|
|
||
| beforeNavigate(() => { | ||
| searchText = ""; | ||
| }); | ||
|
|
||
| function toggleTag(tag: string) { | ||
| onTagsChange( | ||
| selectedTags.includes(tag) | ||
| ? selectedTags.filter((t) => t !== tag) | ||
| : [...selectedTags, tag], | ||
| ); | ||
| } | ||
|
|
||
| $: tagsLabel = | ||
| selectedTags.length === 0 | ||
| ? "All tags" | ||
| : selectedTags.length === 1 | ||
| ? selectedTags[0] | ||
| : `${selectedTags[0]}, +${selectedTags.length - 1} other${selectedTags.length > 2 ? "s" : ""}`; | ||
| </script> | ||
|
|
||
| <div class="flex flex-row items-center gap-x-2"> | ||
| {#if availableTags.length > 0} | ||
| <DropdownMenu.Root bind:open={tagsOpen}> | ||
| <DropdownMenu.Trigger | ||
| class="min-w-fit min-h-9 flex flex-row gap-1 items-center rounded-sm border bg-input {tagsOpen | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: should this be |
||
| ? 'bg-gray-200' | ||
| : 'hover:bg-surface-hover'} px-2 py-1" | ||
| > | ||
| <span class="text-fg-secondary font-medium text-sm">{tagsLabel}</span> | ||
| {#if tagsOpen} | ||
| <CaretUpIcon size="12px" /> | ||
| {:else} | ||
| <CaretDownIcon size="12px" /> | ||
| {/if} | ||
| </DropdownMenu.Trigger> | ||
| <DropdownMenu.Content align="start" class="w-48 max-h-72 overflow-y-auto"> | ||
| {#each availableTags as tag (tag)} | ||
| <DropdownMenu.CheckboxItem | ||
| checked={selectedTags.includes(tag)} | ||
| onCheckedChange={() => toggleTag(tag)} | ||
| > | ||
| {tag} | ||
| </DropdownMenu.CheckboxItem> | ||
| {/each} | ||
| </DropdownMenu.Content> | ||
| </DropdownMenu.Root> | ||
| {/if} | ||
|
|
||
| <div class="flex-1 min-w-0"> | ||
| <Search | ||
| placeholder="Search" | ||
| autofocus={false} | ||
| bind:value={searchText} | ||
| rounded="lg" | ||
| /> | ||
| </div> | ||
| </div> | ||
Uh oh!
There was an error while loading. Please reload this page.