mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-07-19 22:18:03 +00:00
Application settings
This commit is contained in:
@ -8,15 +8,16 @@
|
||||
import FindViewConfigModal from './find-viewconfig.svelte';
|
||||
import { onMount } from 'svelte';
|
||||
import Grid from '../../../components/grid.svelte';
|
||||
import { applicationSettings } from '../../../stores';
|
||||
|
||||
export let collection;
|
||||
|
||||
const defaults = {
|
||||
query: '{}',
|
||||
sort: '{ "_id": 1 }',
|
||||
sort: $applicationSettings.defaultSort || '{ "_id": 1 }',
|
||||
fields: '{}',
|
||||
skip: 0,
|
||||
limit: 15,
|
||||
limit: $applicationSettings.defaultLimit || 15,
|
||||
};
|
||||
|
||||
let form = { ...defaults };
|
||||
@ -72,7 +73,9 @@
|
||||
|
||||
async function refresh() {
|
||||
await getViewConfig();
|
||||
await submitQuery();
|
||||
if ($applicationSettings.autosubmitQuery) {
|
||||
await submitQuery();
|
||||
}
|
||||
}
|
||||
|
||||
function prev() {
|
||||
|
@ -1,7 +1,6 @@
|
||||
<script>
|
||||
import { onMount, tick } from 'svelte';
|
||||
import { Hosts } from '../../../wailsjs/go/app/App';
|
||||
import { Environment } from '../../../wailsjs/runtime';
|
||||
import { input } from '../../actions';
|
||||
import Modal from '../../components/modal.svelte';
|
||||
import DatabaseList from './dblist.svelte';
|
||||
@ -13,7 +12,6 @@
|
||||
export let activeDbKey = '';
|
||||
export let activeCollKey = '';
|
||||
|
||||
let environment;
|
||||
let addressBarModalOpen = true;
|
||||
let dbList;
|
||||
|
||||
@ -43,7 +41,6 @@
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
Environment().then(e => environment = e);
|
||||
Hosts().then(h => hosts = h);
|
||||
});
|
||||
</script>
|
||||
|
37
frontend/src/organisms/settings/index.svelte
Normal file
37
frontend/src/organisms/settings/index.svelte
Normal file
@ -0,0 +1,37 @@
|
||||
<script>
|
||||
import { input } from '../../actions';
|
||||
import Modal from '../../components/modal.svelte';
|
||||
import { applicationSettings as settings } from '../../stores';
|
||||
|
||||
export let show = false;
|
||||
</script>
|
||||
|
||||
<Modal title="Prefrences" bind:show>
|
||||
<div class="prefs">
|
||||
<label for="defaultLimit">Initial number of items to retrieve using one query (limit):</label>
|
||||
<label class="field">
|
||||
<input type="number" bind:value={$settings.defaultLimit} id="defaultLimit" use:input={{ autofocus: true }} />
|
||||
<span class="label">items</span>
|
||||
</label>
|
||||
|
||||
<label for="defaultSort">Default sort query</label>
|
||||
<label class="field">
|
||||
<input type="text" class="code" bind:value={$settings.defaultSort} id="defaultSort" use:input={{ json: true }} />
|
||||
</label>
|
||||
|
||||
<label for="autosubmitQuery">Autosubmit query</label>
|
||||
<span>
|
||||
<input type="checkbox" id="autosubmitQuery" bind:checked={$settings.autosubmitQuery} />
|
||||
<label for="autosubmitQuery">Query items automatically when you open a collection</label>
|
||||
</span>
|
||||
</div>
|
||||
</Modal>
|
||||
|
||||
<style>
|
||||
.prefs {
|
||||
display: grid;
|
||||
grid-template-columns: auto auto;
|
||||
gap: 0.5rem;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user