1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2025-01-18 21:17:59 +00:00

Grid icon

This commit is contained in:
Romein van Buren 2023-01-21 10:37:52 +01:00
parent 08cf6b162e
commit 951b24a32b
Signed by: romein
GPG Key ID: 0EFF8478ADDF6C49
3 changed files with 18 additions and 1 deletions

View File

@ -115,6 +115,12 @@
{/if} {/if}
</td> </td>
<td class="has-icon">
<div style:margin-left="{level * 10}px">
<Icon name={item.icon} />
</div>
</td>
{#each columns as column, columnIndex} {#each columns as column, columnIndex}
{@const value = column.key?.includes('.') ? resolveKeypath(item, column.key) : item[column.key]} {@const value = column.key?.includes('.') ? resolveKeypath(item, column.key) : item[column.key]}
<td class:right={column.right} title={value}> <td class:right={column.right} title={value}>
@ -157,7 +163,15 @@
cursor: pointer; cursor: pointer;
} }
td.has-toggle { td.has-toggle {
width: calc(20px + 0.3rem); width: 20px;
}
td.has-icon {
padding: 0;
width: 17px;
}
td.has-icon :global(svg) {
width: 13px;
height: 13px;
} }
td .value { td .value {

View File

@ -29,6 +29,7 @@
<thead> <thead>
<tr> <tr>
<th class="has-toggle"></th> <th class="has-toggle"></th>
<th class="has-icon"></th>
{#each columns as column} {#each columns as column}
<th scope="col">{column.title || ''}</th> <th scope="col">{column.title || ''}</th>
{/each} {/each}

View File

@ -82,9 +82,11 @@
columns={[ { key: 'id' }, { key: 'collCount', right: true } ]} columns={[ { key: 'id' }, { key: 'collCount', right: true } ]}
items={Object.keys(connection.databases).sort().map(dbKey => ({ items={Object.keys(connection.databases).sort().map(dbKey => ({
id: dbKey, id: dbKey,
icon: 'db',
collCount: Object.keys(connection.databases[dbKey].collections || {}).length || '', collCount: Object.keys(connection.databases[dbKey].collections || {}).length || '',
children: Object.keys(connection.databases[dbKey].collections).sort().map(collKey => ({ children: Object.keys(connection.databases[dbKey].collections).sort().map(collKey => ({
id: collKey, id: collKey,
icon: 'list',
menu: [ menu: [
{ label: `Drop ${collKey}`, fn: () => dropCollection(dbKey, collKey) }, { label: `Drop ${collKey}`, fn: () => dropCollection(dbKey, collKey) },
{ label: `Drop ${dbKey}`, fn: () => dropDatabase(dbKey) }, { label: `Drop ${dbKey}`, fn: () => dropDatabase(dbKey) },