edit delete schemas

This commit is contained in:
2026-01-08 18:13:17 +02:00
parent 25ad3fefab
commit 9dcc6b4e12
21 changed files with 317 additions and 107 deletions
@@ -1,6 +1,7 @@
<script>
import ChannelLayout from "../../layouts/ChannelLayout.svelte";
import Sortable from "../../common/Sortable.svelte";
import DeleteButton from "../../common/DeleteButton.svelte";
import { post } from "../../modules/remote";
import { getApp } from "../../app";
let { channel, user, data } = $props();
@@ -8,18 +9,36 @@
function handleSchemaCreate(e) {
e.preventDefault();
// post(
// channel.lucentUrl + "/schemas",
// {
// name: newSchemaName,
// alias: newSchemaAlias,
// },
// (data, err) => {
// if (err.isEmpty()) {
// Turbo.visit(window.location.href);
// }
// },
// );
post(
channel.lucentUrl + "/schemas/update",
{
id: data.schema.id,
name: data.schema.name,
alias: data.schema.alias,
revisions: data.schema.revisions,
},
(data, err) => {
if (err.isEmpty()) {
Turbo.visit(channel.lucentUrl + "/schemas");
}
},
);
}
function handleDelete() {
post(
app.url("schemas/delete"),
{
schemaId: data.schema.id,
},
(data, err) => {
if (err.isEmpty()) {
Turbo.visit(app.url("schemas"));
} else {
console.log(err);
}
},
);
}
</script>
@@ -54,8 +73,26 @@
Developers will use this to reference the field
</small>
</label>
<label>
Revision number
<input
bind:value={data.schema.revisions}
type="number"
required
aria-describedby="revision-helper"
/>
<small id="revision-helper">
How many revisions per document will be kept
</small>
</label>
</fieldset>
<button type="submit">Update</button>
</form>
<DeleteButton onDelete={handleDelete}>
{#snippet text()}
Delete schema
{/snippet}
</DeleteButton>
{/snippet}