1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2025-07-19 22:18:03 +00:00

Add nice loading indicator to the host tree

This commit is contained in:
2023-12-22 17:05:32 +01:00
parent 426b0b8468
commit fd1340f9e4
5 changed files with 47 additions and 9 deletions

View File

@ -7,20 +7,27 @@
<Grid
striped={false}
columns={[ { key: 'name' }, { key: 'count', right: true } ]}
columns={[
{ key: 'name' },
{ key: 'count', right: true },
]}
items={Object.values($hostTree || {}).map(host => {
return {
id: host.key,
name: host.name,
loading: host.loading,
icon: 'server',
children: Object.values(host.databases || {})
.sort((a, b) => a.key.localeCompare(b))
.map(database => {
return {
id: database.key,
name: database.key,
icon: 'db',
loading: database.loading,
count: Object.keys(database.collections || {}).length || '',
icon: 'db',
children: Object.values(database.collections)
.sort((a, b) => a.key.localeCompare(b))
.map(collection => {
@ -42,6 +49,7 @@
],
};
}) || [],
menu: [
{ label: 'Dump database (BSON via mongodump)…', fn: database.dump },
{ label: 'Drop database…', fn: database.drop },
@ -51,6 +59,7 @@
],
};
}),
menu: [
{ label: 'New database…', fn: host.newDatabase },
{ separator: true },