-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(frontend): entity-lists are now more consistently displayed
- Loading branch information
1 parent
9874e5e
commit 52c1073
Showing
10 changed files
with
155 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<script lang="ts"> | ||
import Spinner from './Spinner.svelte' | ||
import ButtonShowDeleted from './buttons/ButtonShowDeleted.svelte' | ||
export let loading: boolean | ||
export let deletedCount: number | ||
export let error: string | undefined | ||
</script> | ||
|
||
<div class="spinner"><Spinner active={loading} /></div> | ||
{#if error} | ||
{error} | ||
{/if} | ||
<ButtonShowDeleted {deletedCount} /> | ||
<ul> | ||
<slot /> | ||
</ul> | ||
|
||
<style> | ||
.spinner { | ||
float: right; | ||
} | ||
ul { | ||
list-style: none; | ||
padding: 0; | ||
margin: 0; | ||
border-radius: var(--radius); | ||
box-shadow: var(--elevation-4); | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script type="ts"> | ||
import { state } from 'state' | ||
import Button from '../Button.svelte' | ||
export let deletedCount: number | ||
</script> | ||
|
||
{#if !!deletedCount} | ||
<Button | ||
icon="delete" | ||
color="secondary" | ||
active={$state.showDeleted} | ||
disabled={!$state.showDeleted && !deletedCount} | ||
on:click={() => ($state.showDeleted = !$state.showDeleted)}> | ||
Show deleted ({deletedCount}) | ||
</Button> | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,41 @@ | ||
<script lang="ts"> | ||
import { api } from '../../api' | ||
import Button from '../../components/Button.svelte' | ||
import formatDate from '../../dates' | ||
import { slide } from 'svelte/transition' | ||
import ConfigItem from './ConfigItem.svelte' | ||
import ListItem from '../ListItem.svelte' | ||
import Collapse from 'components/Collapse.svelte' | ||
export let endpoint: ApiDef.EndpointEntity | ||
export let onEdit: ((ID: string) => void) | undefined = undefined | ||
export let onDelete: ((ID: string) => void) | undefined = undefined | ||
export let selectedID: string = '' | ||
</script> | ||
|
||
<li transition:slide|local class:deleted={!!endpoint.deleted}> | ||
{endpoint.url} | ||
{formatDate(endpoint.createdAt)} | ||
{#if endpoint.config} | ||
<ConfigItem config={endpoint.config} short={true} /> | ||
{/if} | ||
{#if endpoint.headers} | ||
<strong>Headers</strong> | ||
<ul> | ||
{#each Object.entries(endpoint.headers) as [hKey, hVal]} | ||
<li> | ||
{hKey} - {hVal.join('; ')} | ||
</li> | ||
{/each} | ||
</ul> | ||
{/if} | ||
<Button icon="delete" on:click={() => api.endpoint.delete(endpoint.id)}> | ||
Delete | ||
</Button> | ||
</li> | ||
<ListItem | ||
deleteDisabled={selectedID === endpoint.id} | ||
editDisabled={selectedID === endpoint.id} | ||
{onEdit} | ||
{onDelete} | ||
ID={endpoint.id} | ||
deleted={!!endpoint.deleted}> | ||
<svelte:fragment slot="header"> | ||
{endpoint.url} | ||
</svelte:fragment> | ||
<svelte:fragment slot="description"> | ||
Created: {formatDate(endpoint.createdAt)} | ||
|
||
<style> | ||
.deleted { | ||
text-decoration: line-through; | ||
} | ||
</style> | ||
{#if endpoint.updatedAt} | ||
Updated: {formatDate(endpoint.updatedAt)} | ||
{/if} | ||
</svelte:fragment> | ||
<svelte:fragment slot="details"> | ||
<Collapse key="item-config"> | ||
<span slot="title">Details</span> | ||
{#if endpoint.config} | ||
<div class="sub-item"> | ||
<ConfigItem config={endpoint.config} /> | ||
</div> | ||
{/if} | ||
</Collapse> | ||
</svelte:fragment> | ||
</ListItem> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,40 @@ | ||
<script type="ts"> | ||
import { slide } from 'svelte/transition' | ||
import ConfigItem from './ConfigItem.svelte' | ||
import ListItem from '../ListItem.svelte' | ||
import formatDate from 'dates' | ||
import Collapse from 'components/Collapse.svelte' | ||
export let request: ApiDef.RequestEntity | ||
export let onEdit: ((ID: string) => void) | undefined = undefined | ||
export let onDelete: ((ID: string) => void) | undefined = undefined | ||
export let selectedID: string = '' | ||
</script> | ||
|
||
<li transition:slide|local> | ||
{request.method} | ||
{request.operationName} | ||
{new Date(request.createdAt).toLocaleTimeString()} | ||
{request.query || ''} | ||
{request.variables || ''} | ||
{request.body || ''} | ||
{#if request.config} | ||
<ConfigItem config={request.config} short={true} /> | ||
{/if} | ||
</li> | ||
<ListItem | ||
deleteDisabled={selectedID === request.id} | ||
editDisabled={selectedID === request.id} | ||
{onEdit} | ||
{onDelete} | ||
ID={request.id} | ||
deleted={!!request.deleted}> | ||
<svelte:fragment slot="header"> | ||
{request.operationName} | ||
</svelte:fragment> | ||
<svelte:fragment slot="description"> | ||
Created: {formatDate(request.createdAt)} | ||
|
||
{#if request.updatedAt} | ||
Updated: {formatDate(request.updatedAt)} | ||
{/if} | ||
</svelte:fragment> | ||
<svelte:fragment slot="details"> | ||
<Collapse key="item-config"> | ||
<span slot="title">Details</span> | ||
{#if request.config} | ||
<div class="sub-item"> | ||
<ConfigItem config={request.config} /> | ||
</div> | ||
{/if} | ||
</Collapse> | ||
</svelte:fragment> | ||
</ListItem> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters