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

Refinements in query saving

This commit is contained in:
Romein van Buren 2023-02-15 20:33:29 +01:00
parent a3335cdc4e
commit 0bbd50857c
Signed by: romein
GPG Key ID: 0EFF8478ADDF6C49
7 changed files with 24 additions and 20 deletions

View File

@ -1,9 +1,9 @@
<script> <script>
import { resolveKeypath, setValue } from '$lib/keypaths';
import contextMenu from '$lib/stores/contextmenu';
import { createEventDispatcher } from 'svelte'; import { createEventDispatcher } from 'svelte';
import FormInput from './forminput.svelte';
import Icon from './icon.svelte'; import Icon from './icon.svelte';
import FormInput from './forminput.svelte';
import contextMenu from '$lib/stores/contextmenu';
import { resolveKeypath, setValue } from '$lib/keypaths';
export let items = []; export let items = [];
export let columns = []; export let columns = [];

View File

@ -88,7 +88,6 @@
border-collapse: collapse; border-collapse: collapse;
width: 100%; width: 100%;
background-color: #fff; background-color: #fff;
table-layout: fixed;
} }
table thead { table thead {

View File

@ -10,6 +10,7 @@
export let queryToSave = undefined; export let queryToSave = undefined;
export let collection = {}; export let collection = {};
export let show = false; export let show = false;
export let hosts = {};
const dispatch = createEventDispatcher(); const dispatch = createEventDispatcher();
let gridSelectedPath = []; let gridSelectedPath = [];
@ -84,8 +85,12 @@
<div class="querylist"> <div class="querylist">
<Grid <Grid
columns={[ { key: 'name', title: 'Query name' } ]} columns={[ { key: 'n', title: 'Query name' }, { key: 'h', title: 'Host' }, { key: 'ns', title: 'Namespace' } ]}
items={$queries} key="n"
items={Object.entries($queries).reduce((object, [ name, query ]) => {
object[query.name] = { n: name, h: hosts[query.hostKey]?.name || '?', ns: `${query.dbKey}.${query.collKey}` };
return object;
}, {})}
showHeaders={true} showHeaders={true}
canRemoveItems={true} canRemoveItems={true}
bind:activePath={gridSelectedPath} bind:activePath={gridSelectedPath}
@ -102,8 +107,8 @@
{#if Object.keys($queries).includes(queryToSave.name)} {#if Object.keys($queries).includes(queryToSave.name)}
<Hint> <Hint>
You are about to <strong>overwrite</strong> a saved query. Rename it You are about to <strong>overwrite</strong> a saved query. Give it
if you do not want to overwrite. another name if you do not want to overwrite.
</Hint> </Hint>
{/if} {/if}
{:else} {:else}
@ -120,7 +125,7 @@
} }
textarea { textarea {
min-height: 100px; min-height: 75px;
} }
.querylist { .querylist {

View File

@ -14,6 +14,7 @@
// import ObjectViewer from '$components/objectviewer.svelte'; // import ObjectViewer from '$components/objectviewer.svelte';
export let collection; export let collection;
export let hosts = {};
const dispatch = createEventDispatcher(); const dispatch = createEventDispatcher();
const defaults = { const defaults = {
@ -233,6 +234,8 @@
bind:queryToSave bind:queryToSave
bind:show={showQueryChooser} bind:show={showQueryChooser}
on:select={queryChosen} on:select={queryChosen}
{hosts}
{collection}
/> />
<!-- <ObjectViewer bind:data={objectViewerData} /> --> <!-- <ObjectViewer bind:data={objectViewerData} /> -->

View File

@ -15,6 +15,7 @@
export let hostKey; export let hostKey;
export let dbKey; export let dbKey;
export let collectionKey; export let collectionKey;
export let hosts = {};
let tab = 'find'; let tab = 'find';
let find; let find;
@ -55,7 +56,7 @@
<div class="container"> <div class="container">
{#if tab === 'stats'} <Stats {collection} /> {#if tab === 'stats'} <Stats {collection} />
{:else if tab === 'find'} <Find {collection} bind:this={find} on:openViewConfig={openViewConfig} /> {:else if tab === 'find'} <Find {collection} {hosts} bind:this={find} on:openViewConfig={openViewConfig} />
{:else if tab === 'insert'} <Insert {collection} on:performFind={catchQuery} on:openViewConfig={openViewConfig} /> {:else if tab === 'insert'} <Insert {collection} on:performFind={catchQuery} on:openViewConfig={openViewConfig} />
{:else if tab === 'update'} <Update {collection} on:performFind={catchQuery} /> {:else if tab === 'update'} <Update {collection} on:performFind={catchQuery} />
{:else if tab === 'remove'} <Remove {collection} /> {:else if tab === 'remove'} <Remove {collection} />

View File

@ -119,6 +119,7 @@
hostKey={activeHostKey} hostKey={activeHostKey}
dbKey={activeDbKey} dbKey={activeDbKey}
collectionKey={activeCollKey} collectionKey={activeCollKey}
{hosts}
/> />
<HostDetail <HostDetail

11
main.go
View File

@ -32,21 +32,16 @@ func main() {
BackgroundColour: &options.RGBA{R: 0, G: 0, B: 139, A: 1}, BackgroundColour: &options.RGBA{R: 0, G: 0, B: 139, A: 1},
Menu: app.Menu(), Menu: app.Menu(),
Bind: []interface{}{app},
AssetServer: &assetserver.Options{Assets: assets},
OnStartup: app.Startup, OnStartup: app.Startup,
OnShutdown: app.Shutdown, OnShutdown: app.Shutdown,
Logger: logger.NewFileLogger(path.Join(app.Env.LogDirectory, "rolens.log")), Logger: logger.NewFileLogger(path.Join(app.Env.LogDirectory, "rolens.log")),
LogLevel: logger.TRACE, LogLevel: logger.TRACE,
LogLevelProduction: logger.INFO, LogLevelProduction: logger.INFO,
AssetServer: &assetserver.Options{
Assets: assets,
},
Bind: []interface{}{
app,
},
Mac: &mac.Options{ Mac: &mac.Options{
TitleBar: mac.TitleBarHiddenInset(), TitleBar: mac.TitleBarHiddenInset(),
WebviewIsTransparent: true, WebviewIsTransparent: true,