1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2025-01-18 13:07:58 +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>
import { resolveKeypath, setValue } from '$lib/keypaths';
import contextMenu from '$lib/stores/contextmenu';
import { createEventDispatcher } from 'svelte';
import FormInput from './forminput.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 columns = [];

View File

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

View File

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

View File

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

View File

@ -15,6 +15,7 @@
export let hostKey;
export let dbKey;
export let collectionKey;
export let hosts = {};
let tab = 'find';
let find;
@ -55,7 +56,7 @@
<div class="container">
{#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 === 'update'} <Update {collection} on:performFind={catchQuery} />
{:else if tab === 'remove'} <Remove {collection} />

View File

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

15
main.go
View File

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