mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-01-18 21:17:59 +00:00
Form bugfixes
This commit is contained in:
parent
99108121c3
commit
dc5b12ee0d
@ -42,7 +42,7 @@ export function input(node, { autofocus, type, onValid, onInvalid, mandatory } =
|
|||||||
return checkInteger() || checkNumberBoundaries(uint64);
|
return checkInteger() || checkNumberBoundaries(uint64);
|
||||||
|
|
||||||
case 'string':
|
case 'string':
|
||||||
if (mandatory && (node.value == '')) {
|
if (mandatory && (!node.value)) {
|
||||||
return 'This field cannot empty';
|
return 'This field cannot empty';
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
export let valid = false;
|
export let valid = false;
|
||||||
|
|
||||||
const validity = {};
|
const validity = {};
|
||||||
$: valid = Object.values(validity).every(v => !!v);
|
$: valid = Object.values(validity).every(v => v !== false);
|
||||||
|
|
||||||
const iconMap = {
|
const iconMap = {
|
||||||
string: 'text',
|
string: 'text',
|
||||||
@ -49,7 +49,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<FormInput {column} bind:value={keypathProxy[column.key]} bind:valid={validity[column.key]} />
|
<FormInput {column} bind:value={keypathProxy[column.key]} bind:valid={validity[column.key]} />
|
||||||
<button type="button" class="btn" title="Reset value" on:click={() => reset(column.key)} disabled={!keypathProxy[column.key]}>
|
<button type="button" class="btn" title="Reset value" on:click={() => reset(column.key)} disabled={keypathProxy[column.key] === undefined}>
|
||||||
<Icon name="reload" />
|
<Icon name="reload" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -89,6 +89,7 @@
|
|||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
padding: 3px 5px;
|
padding: 3px 5px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
line-height: 1;
|
||||||
}
|
}
|
||||||
.tag.invalid {
|
.tag.invalid {
|
||||||
background-color: rgba(255, 80, 80, 0.3);
|
background-color: rgba(255, 80, 80, 0.3);
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
database: collection.dbKey,
|
database: collection.dbKey,
|
||||||
collection: collection.key,
|
collection: collection.key,
|
||||||
type: 'table',
|
type: 'table',
|
||||||
columns: [ { key: '_id', showInTable: true, inputType: 'string' } ],
|
columns: [ { key: '_id', showInTable: true, inputType: 'objectid', mandatory: true } ],
|
||||||
};
|
};
|
||||||
activeViewKey = newViewKey;
|
activeViewKey = newViewKey;
|
||||||
}
|
}
|
||||||
|
@ -19,15 +19,14 @@
|
|||||||
$: viewsForCollection = views.forCollection(collection.hostKey, collection.dbKey, collection.key);
|
$: viewsForCollection = views.forCollection(collection.hostKey, collection.dbKey, collection.key);
|
||||||
$: oppositeViewType = viewType === 'table' ? 'form' : 'table';
|
$: oppositeViewType = viewType === 'table' ? 'form' : 'table';
|
||||||
|
|
||||||
|
$: if (collection.viewKey !== 'list') {
|
||||||
|
json = JSON.stringify(newItems, undefined, 2);
|
||||||
|
}
|
||||||
|
|
||||||
async function insert() {
|
async function insert() {
|
||||||
if (collection.viewKey === 'list') {
|
insertedIds = await InsertItems(collection.hostKey, collection.dbKey, collection.key, json);
|
||||||
insertedIds = await InsertItems(collection.hostKey, collection.dbKey, collection.key, json);
|
if ((collection.viewKey === 'list') && insertedIds) {
|
||||||
}
|
newItems = [];
|
||||||
else {
|
|
||||||
insertedIds = await InsertItems(collection.hostKey, collection.dbKey, collection.key, JSON.stringify(newItems));
|
|
||||||
if (insertedIds) {
|
|
||||||
newItems = [];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,6 +115,7 @@
|
|||||||
{ label: 'Drop database…', fn: () => dropDatabase(dbKey) },
|
{ label: 'Drop database…', fn: () => dropDatabase(dbKey) },
|
||||||
{ separator: true },
|
{ separator: true },
|
||||||
{ label: 'New database…', fn: () => dispatch('newDatabase') },
|
{ label: 'New database…', fn: () => dispatch('newDatabase') },
|
||||||
|
{ label: 'New collection…', fn: () => dispatch('newCollection') },
|
||||||
],
|
],
|
||||||
})),
|
})),
|
||||||
menu: [
|
menu: [
|
||||||
|
@ -48,7 +48,6 @@
|
|||||||
busy.start();
|
busy.start();
|
||||||
$connections[activeHostKey].databases[newDb.name] = { collections: {} };
|
$connections[activeHostKey].databases[newDb.name] = { collections: {} };
|
||||||
newDb = undefined;
|
newDb = undefined;
|
||||||
await hostTree.reload();
|
|
||||||
busy.end();
|
busy.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +72,6 @@
|
|||||||
busy.start();
|
busy.start();
|
||||||
$connections[activeHostKey].databases[activeDbKey].collections[newColl.name] = {};
|
$connections[activeHostKey].databases[activeDbKey].collections[newColl.name] = {};
|
||||||
newColl = undefined;
|
newColl = undefined;
|
||||||
await hostTree.reload();
|
|
||||||
busy.end();
|
busy.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user