mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-22 18:06:01 +00:00
Refactor DbKeyDetailTab to use ToolStrip for action buttons and improve layout structure
This commit is contained in:
@@ -36,6 +36,8 @@
|
|||||||
import SelectField from '../forms/SelectField.svelte';
|
import SelectField from '../forms/SelectField.svelte';
|
||||||
import DbKeyValueDetail from '../dbkeyvalue/DbKeyValueDetail.svelte';
|
import DbKeyValueDetail from '../dbkeyvalue/DbKeyValueDetail.svelte';
|
||||||
import { _t } from '../translations';
|
import { _t } from '../translations';
|
||||||
|
import ToolStripContainer from '../buttons/ToolStripContainer.svelte';
|
||||||
|
import ToolStripButton from '../buttons/ToolStripButton.svelte';
|
||||||
|
|
||||||
export let tabid;
|
export let tabid;
|
||||||
export let conid;
|
export let conid;
|
||||||
@@ -124,6 +126,7 @@
|
|||||||
{#await apiCall('database-connections/load-key-info', { conid, database, key, refreshToken })}
|
{#await apiCall('database-connections/load-key-info', { conid, database, key, refreshToken })}
|
||||||
<LoadingInfo message="Loading key details" wrapper />
|
<LoadingInfo message="Loading key details" wrapper />
|
||||||
{:then keyInfo}
|
{:then keyInfo}
|
||||||
|
<ToolStripContainer>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="top-panel">
|
<div class="top-panel">
|
||||||
<div class="type">
|
<div class="type">
|
||||||
@@ -134,17 +137,6 @@
|
|||||||
<TextField value={key} readOnly />
|
<TextField value={key} readOnly />
|
||||||
</div>
|
</div>
|
||||||
<FormStyledButton value={`TTL:${keyInfo.ttl}`} on:click={() => handleChangeTtl(keyInfo)} />
|
<FormStyledButton value={`TTL:${keyInfo.ttl}`} on:click={() => handleChangeTtl(keyInfo)} />
|
||||||
{#if keyInfo.type == 'string'}
|
|
||||||
<FormStyledButton
|
|
||||||
value={_t('common.save', { defaultMessage: 'Save' })}
|
|
||||||
on:click={saveString}
|
|
||||||
disabled={!editedValue}
|
|
||||||
/>
|
|
||||||
{/if}
|
|
||||||
{#if keyInfo.keyType?.addMethod && keyInfo.keyType?.showItemList}
|
|
||||||
<FormStyledButton value="Add item" on:click={() => addItem(keyInfo)} />
|
|
||||||
{/if}
|
|
||||||
<FormStyledButton value={_t('common.refresh', { defaultMessage: 'Refresh' })} on:click={refresh} />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
@@ -161,7 +153,12 @@
|
|||||||
/>
|
/>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
<svelte:fragment slot="2">
|
<svelte:fragment slot="2">
|
||||||
<DbKeyItemDetail dbKeyFields={keyInfo.keyType.dbKeyFields} item={currentRow} />
|
<DbKeyItemDetail
|
||||||
|
dbKeyFields={keyInfo.type === 'hash'
|
||||||
|
? keyInfo.keyType.dbKeyFields.filter(f => f.name === 'value')
|
||||||
|
: keyInfo.keyType.dbKeyFields}
|
||||||
|
item={currentRow}
|
||||||
|
/>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</VerticalSplitter>
|
</VerticalSplitter>
|
||||||
{:else}
|
{:else}
|
||||||
@@ -177,6 +174,21 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<svelte:fragment slot="toolstrip">
|
||||||
|
{#if keyInfo.type == 'string'}
|
||||||
|
<ToolStripButton
|
||||||
|
icon="icon save"
|
||||||
|
on:click={saveString}
|
||||||
|
disabled={!editedValue}
|
||||||
|
>{_t('common.save', { defaultMessage: 'Save' })}</ToolStripButton>
|
||||||
|
{/if}
|
||||||
|
{#if keyInfo.keyType?.addMethod && keyInfo.keyType?.showItemList}
|
||||||
|
<ToolStripButton icon="icon add" on:click={() => addItem(keyInfo)}>Add item</ToolStripButton>
|
||||||
|
{/if}
|
||||||
|
<ToolStripButton icon="icon refresh" on:click={refresh}>{_t('common.refresh', { defaultMessage: 'Refresh' })}</ToolStripButton>
|
||||||
|
</svelte:fragment>
|
||||||
|
</ToolStripContainer>
|
||||||
{/await}
|
{/await}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
Reference in New Issue
Block a user