1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2025-01-18 13:07:58 +00:00

Small frontend fixes

This commit is contained in:
Romein van Buren 2023-06-25 08:16:31 +02:00
parent f0ab5288f7
commit 8bebdfccd8
Signed by: romein
GPG Key ID: 0EFF8478ADDF6C49
4 changed files with 42 additions and 20 deletions

View File

@ -70,7 +70,7 @@
<div class="forminput {type}">
<div class="field">
{#if type === 'string'}
<input type="text" bind:value use:input={{ type, onValid, onInvalid, mandatory, autofocus }} />
<input type="text" bind:value use:input={{ type, onValid, onInvalid, mandatory, autofocus }} autocomplete="off" spellcheck="false" />
{:else if type === 'objectid'}
<input
type="text"

View File

@ -30,7 +30,9 @@
function refresh(hideObjectIndicators, items) {
_items = objectToArray(items).map(item => {
item.children = objectToArray(item.children);
if (item.children) {
item.children = objectToArray(item.children);
}
return item;
});

View File

@ -169,22 +169,41 @@
<span class="label">Query or id</span>
<input type="text"
class="code"
placeholder={defaults.query}
autocomplete="off"
spellcheck="false"
use:input={{ type: 'json', autofocus: true }}
bind:this={queryField}
bind:value={form.query}
use:input={{ type: 'json', autofocus: true }}
placeholder={defaults.query} />
/>
</label>
<label class="field">
<span class="label">Sort</span>
<input type="text" class="code" bind:value={form.sort} use:input={{ type: 'json' }} placeholder={defaults.sort} />
<input
type="text"
class="code"
placeholder={defaults.sort}
autocomplete="off"
spellcheck="false"
bind:value={form.sort}
use:input={{ type: 'json' }}
/>
</label>
</div>
<div class="form-row two">
<label class="field">
<span class="label">Fields</span>
<input type="text" class="code" bind:value={form.fields} use:input={{ type: 'json' }} placeholder={defaults.fields} />
<input
type="text"
class="code"
placeholder={defaults.fields}
autocomplete="off"
spellcheck="false"
bind:value={form.fields}
use:input={{ type: 'json' }}
/>
</label>
<label class="field">
@ -194,7 +213,8 @@
bind:value={form.skip}
use:input
placeholder={defaults.skip}
list="skipstops" />
list="skipstops"
/>
</label>
<label class="field">
@ -204,7 +224,8 @@
bind:value={form.limit}
use:input
placeholder={defaults.limit}
list="limits" />
list="limits"
/>
</label>
</div>
@ -242,9 +263,11 @@
{:else}
<Grid
key="_id"
columns={$views[collection.viewKey]?.columns?.map(c => {
return { key: c.key, title: c.key };
}) || []}
columns={$views[collection.viewKey]?.columns
?.filter(c => c.showInTable)
.map(c => {
return { key: c.key, title: c.key };
}) || []}
showHeaders={true}
items={result.results ? result.results.map(r => EJSON.deserialize(r)) : []}
bind:activePath
@ -295,7 +318,6 @@
</div>
{#if objectViewerData}
<!-- @todo Implement save -->
<ObjectViewer bind:data={objectViewerData} saveable on:save={saveDocument} bind:successMessage={objectViewerSuccessMessage} />
{/if}

View File

@ -73,12 +73,7 @@
}
function showJson() {
if (viewType === 'form') {
objectViewerData = { ...(newItems[0] || {}) };
}
else if (viewType === 'table') {
objectViewerData = [ ...newItems ];
}
objectViewerData = [ ...newItems ];
}
function addRow(beforeIndex = -1) {
@ -151,7 +146,6 @@
<div class="table">
<Grid
key="id"
items={newItems}
columns={$views[collection.viewKey]?.columns
?.filter(c => inputTypes.includes(c.inputType))
.map(c => {
@ -162,7 +156,9 @@
canRemoveItems={true}
hideChildrenToggles={true}
on:addRow={addRow}
on:removeItem={() => deleteRow()}
bind:inputsValid={allValid}
bind:items={newItems}
/>
</div>
{/if}
@ -209,7 +205,9 @@
</div>
</form>
<ObjectViewer data={objectViewerData} />
{#if objectViewerData}
<ObjectViewer bind:data={objectViewerData} />
{/if}
<style>
form {