mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 15:03:57 +00:00
mongo summary improved
This commit is contained in:
@@ -42,32 +42,32 @@
|
|||||||
{clickable}
|
{clickable}
|
||||||
on:clickrow
|
on:clickrow
|
||||||
>
|
>
|
||||||
<svelte:fragment slot="-1" let:row>
|
<svelte:fragment slot="-1" let:row let:col>
|
||||||
<slot name="name" {row} />
|
<slot name="name" {row} {col} />
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
<svelte:fragment slot="0" let:row>
|
<svelte:fragment slot="0" let:row let:col>
|
||||||
<slot name="0" {row} />
|
<slot name="0" {row} {col} />
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
<svelte:fragment slot="1" let:row>
|
<svelte:fragment slot="1" let:row let:col>
|
||||||
<slot name="1" {row} />
|
<slot name="1" {row} {col} />
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
<svelte:fragment slot="2" let:row>
|
<svelte:fragment slot="2" let:row let:col>
|
||||||
<slot name="2" {row} />
|
<slot name="2" {row} {col} />
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
<svelte:fragment slot="3" let:row>
|
<svelte:fragment slot="3" let:row let:col>
|
||||||
<slot name="3" {row} />
|
<slot name="3" {row} {col} />
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
<svelte:fragment slot="4" let:row>
|
<svelte:fragment slot="4" let:row let:col>
|
||||||
<slot name="4" {row} />
|
<slot name="4" {row} {col} />
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
<svelte:fragment slot="5" let:row>
|
<svelte:fragment slot="5" let:row let:col>
|
||||||
<slot name="5" {row} />
|
<slot name="5" {row} {col} />
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
<svelte:fragment slot="6" let:row>
|
<svelte:fragment slot="6" let:row let:col>
|
||||||
<slot name="6" {row} />
|
<slot name="6" {row} {col} />
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
<svelte:fragment slot="7" let:row>
|
<svelte:fragment slot="7" let:row let:col>
|
||||||
<slot name="7" {row} />
|
<slot name="7" {row} {col} />
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</TableControl>
|
</TableControl>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -86,17 +86,17 @@
|
|||||||
{:else if col.formatter}
|
{:else if col.formatter}
|
||||||
{col.formatter(row)}
|
{col.formatter(row)}
|
||||||
{:else if col.slot != null}
|
{:else if col.slot != null}
|
||||||
{#if col.slot == -1}<slot name="-1" {row} {index} />
|
{#if col.slot == -1}<slot name="-1" {row} {col} {index} />
|
||||||
{:else if col.slot == 0}<slot name="0" {row} {index} {...rowProps} />
|
{:else if col.slot == 0}<slot name="0" {row} {col} {index} {...rowProps} />
|
||||||
{:else if col.slot == 1}<slot name="1" {row} {index} {...rowProps} />
|
{:else if col.slot == 1}<slot name="1" {row} {col} {index} {...rowProps} />
|
||||||
{:else if col.slot == 2}<slot name="2" {row} {index} {...rowProps} />
|
{:else if col.slot == 2}<slot name="2" {row} {col} {index} {...rowProps} />
|
||||||
{:else if col.slot == 3}<slot name="3" {row} {index} {...rowProps} />
|
{:else if col.slot == 3}<slot name="3" {row} {col} {index} {...rowProps} />
|
||||||
{:else if col.slot == 4}<slot name="4" {row} {index} {...rowProps} />
|
{:else if col.slot == 4}<slot name="4" {row} {col} {index} {...rowProps} />
|
||||||
{:else if col.slot == 5}<slot name="5" {row} {index} {...rowProps} />
|
{:else if col.slot == 5}<slot name="5" {row} {col} {index} {...rowProps} />
|
||||||
{:else if col.slot == 6}<slot name="6" {row} {index} {...rowProps} />
|
{:else if col.slot == 6}<slot name="6" {row} {col} {index} {...rowProps} />
|
||||||
{:else if col.slot == 7}<slot name="7" {row} {index} {...rowProps} />
|
{:else if col.slot == 7}<slot name="7" {row} {col} {index} {...rowProps} />
|
||||||
{:else if col.slot == 8}<slot name="8" {row} {index} {...rowProps} />
|
{:else if col.slot == 8}<slot name="8" {row} {col} {index} {...rowProps} />
|
||||||
{:else if col.slot == 9}<slot name="9" {row} {index} {...rowProps} />
|
{:else if col.slot == 9}<slot name="9" {row} {col} {index} {...rowProps} />
|
||||||
{/if}
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
{row[col.fieldName] || ''}
|
{row[col.fieldName] || ''}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
import ObjectListControl from '../elements/ObjectListControl.svelte';
|
import ObjectListControl from '../elements/ObjectListControl.svelte';
|
||||||
import { apiCall } from '../utility/api';
|
import { apiCall } from '../utility/api';
|
||||||
|
import formatFileSize from '../utility/formatFileSize';
|
||||||
|
|
||||||
export let conid;
|
export let conid;
|
||||||
|
|
||||||
@@ -13,11 +14,30 @@
|
|||||||
{#await apiCall('server-connections/server-summary', { conid, refreshToken })}
|
{#await apiCall('server-connections/server-summary', { conid, refreshToken })}
|
||||||
<LoadingInfo message="Loading server details" wrapper />
|
<LoadingInfo message="Loading server details" wrapper />
|
||||||
{:then summary}
|
{:then summary}
|
||||||
<ObjectListControl
|
<div class="wrapper">
|
||||||
collection={summary.databases}
|
<ObjectListControl
|
||||||
hideDisplayName
|
collection={summary.databases}
|
||||||
title="Databases"
|
hideDisplayName
|
||||||
emptyMessage={'No databases'}
|
title={`Databases (${summary.databases.length})`}
|
||||||
columns={summary.columns}
|
emptyMessage={'No databases'}
|
||||||
/>
|
columns={summary.columns.map(col => ({
|
||||||
|
...col,
|
||||||
|
slot: col.dataType == 'bytes' ? 1 : null,
|
||||||
|
}))}
|
||||||
|
>
|
||||||
|
<svelte:fragment slot="1" let:row let:col>{formatFileSize(row?.[col.fieldName])}</svelte:fragment>
|
||||||
|
</ObjectListControl>
|
||||||
|
</div>
|
||||||
{/await}
|
{/await}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.wrapper {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: var(--theme-bg-0);
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -354,6 +354,21 @@ const driver = {
|
|||||||
|
|
||||||
async serverSummary(pool) {
|
async serverSummary(pool) {
|
||||||
const res = await pool.__getDatabase().admin().listDatabases();
|
const res = await pool.__getDatabase().admin().listDatabases();
|
||||||
|
const profiling = await Promise.all(res.databases.map((x) => pool.db(x.name).command({ profile: -1 })));
|
||||||
|
|
||||||
|
function formatProfiling(info) {
|
||||||
|
switch (info.was) {
|
||||||
|
case 0:
|
||||||
|
return 'No profiling';
|
||||||
|
case 1:
|
||||||
|
return `Filtered (>${info.slowms} ms)`;
|
||||||
|
case 2:
|
||||||
|
'Profile all';
|
||||||
|
default:
|
||||||
|
return '???';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
@@ -366,8 +381,16 @@ const driver = {
|
|||||||
dataType: 'bytes',
|
dataType: 'bytes',
|
||||||
header: 'Size',
|
header: 'Size',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
fieldName: 'profiling',
|
||||||
|
dataType: 'string',
|
||||||
|
header: 'Profiling',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
databases: res.databases,
|
databases: res.databases.map((db, i) => ({
|
||||||
|
...db,
|
||||||
|
profiling: formatProfiling(profiling[i]),
|
||||||
|
})),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user