Skip to content

Commit

Permalink
Return Nodes vs. FilterPanel *add* button, allow admin view, show tag…
Browse files Browse the repository at this point in the history
… editing stubs
  • Loading branch information
blokhin committed Sep 20, 2023
1 parent d82c2b1 commit 2d26253
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
12 changes: 11 additions & 1 deletion src/components/FilterPanel/FilterPanel.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<div class="py-2">
<Grid>
{#if add}
<Col col="auto">
<IconButton size="lg" {icon} variant="primary" {tooltip} on:click={action} />
</Col>
{/if}
<Col>
<InputGroup>
<Autocomplete
Expand Down Expand Up @@ -29,7 +34,7 @@

<script lang="ts" context="module">
import { pattern, query, type Param, type Params } from 'svelte-pathfinder';
import { Autocomplete, Col, Grid, InputGroup, Select } from 'svelte-spectre';
import { Autocomplete, Col, Grid, IconButton, InputGroup, Select } from 'svelte-spectre';
import { autoColor } from '@/helpers/style';
import { filters, type CollectionDTO } from '@/stores/filters';
Expand All @@ -48,6 +53,11 @@
</script>

<script lang="ts">
export let add = true;
export let icon = 'plus';
export let tooltip = 'Add item';
export let action = () => {};
let selected: Tag[] = [];
let predefined: Tag[] = [];
Expand Down
8 changes: 6 additions & 2 deletions src/pages/DataSources.svelte
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<Main>
<Nodes asyncData={$datasourcesAsync}>
<Nodes
asyncData={$datasourcesAsync}
addTooltip="Add data"
addAction={() => goto('/import')}
>
<svelte:fragment let:item>
<Col col="12">
<DataSource datasource={item}>
<TileTags datasourceId={item.id} />
{#if $user?.id === item.userId}
{#if $user?.id === item.userId || $user.roleSlug === 'admin'}
<TileMenu items={tileMenuItems(item.type)} dataId={item.id} />
{/if}
</DataSource>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Tags.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Main>
<Nodes
asyncData={$collectionsAsync}
addTooltip="Add collection"
addAction={() => openEdit()}
addTooltip="Add a new tag"
addAction={() => openEdit('new')}
bind:width
>
<svelte:fragment slot="loader">
Expand Down
7 changes: 7 additions & 0 deletions src/views/tiles/Collection.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
title="Edit collection"
on:click={() => dispatch('edit', { id })}
/>
{:else}
<IconButton
icon="edit"
size="sm"
variant="error"
title="Editing disabled"
/>
{/if}
</slot>
</svelte:fragment>
Expand Down
2 changes: 1 addition & 1 deletion src/views/tiles/DataSource.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</svelte:fragment>
<svelte:fragment slot="subtitle">
<small class="text-gray">
{#if $user.roleSlug == 'admin'}
{#if $user.roleSlug === 'admin'}
Added {showTimestamp(datasource)} by {datasource.userFirstName} {datasource.userLastName}
{:else}
Added {showTimestamp(datasource)}
Expand Down

0 comments on commit 2d26253

Please sign in to comment.