We will create a UI that will create a new action table.
Create a new file src/routes/create-table/+page.svelte and add the following form.
<script>
<script lang="ts">
export let form;
</script>
<main>
<h1>Create Action Table</h1>
{#if form?.success}
<!-- this message is ephemeral; it exists because the page was rendered in
response to a form submission. it will vanish if the user reloads -->
<p>Successfully created the table.</p>
{/if}
{#if !form?.success}
<!-- this message is ephemeral; it exists because the page was rendered in
response to a form submission. it will vanish if the user reloads -->
<p>Sorry, something went wrong!</p>
{/if}
<form method="POST" action="/create-table">
<label>
Table ID
<input name="table_id" />
</label>
<label>
Column Name
<input name="column_name" />
</label>
<label>
Columng Data Type
<select name="column_d_type">
<option value="str">str</option>
<option value="int">int</option>
<option value="float">float</option>
<option value="bool">bool</option>
</select>
</label>
<button type="submit">Create</button>
</form>
</main>
We will utilize form action provided by sveltekit to accept the inputs from the client side. Then use jamai client to create a action table.
Create a +page.server.ts file in the same path of the form element to accept post data from the form.