builder: create record: set collection name automatically

This commit is contained in:
Michael Shanks 2019-10-31 09:25:26 +00:00
parent 1503eaf159
commit d5fb7e50c8
1 changed files with 8 additions and 2 deletions

View File

@ -79,6 +79,12 @@ let getTypeOptions = typeOptions =>
join("<br>") join("<br>")
]); ]);
const nameChanged = ev => {
const pluralName = n => `${n}s`;
if(record.collectionName === "") {
record.collectionName = pluralName(ev.target.value);
}
}
</script> </script>
@ -87,9 +93,9 @@ let getTypeOptions = typeOptions =>
<form class="uk-form-horizontal"> <form class="uk-form-horizontal">
<h3 class="settings-title"> <h3 class="settings-title">
Settings Settings
</h3> </h3>
<Textbox label="Name:" bind:text={record.name} /> <Textbox label="Name:" bind:text={record.name} on:change={nameChanged}/>
{#if !record.isSingle} {#if !record.isSingle}
<Textbox label="Collection Name:" bind:text={record.collectionName} /> <Textbox label="Collection Name:" bind:text={record.collectionName} />
<Textbox label="Shard Factor:" bind:text={record.allidsShardFactor} /> <Textbox label="Shard Factor:" bind:text={record.allidsShardFactor} />