edit delete schemas
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<script>
|
||||
import AccountLayout from "../../layouts/AccountLayout.svelte";
|
||||
import { post } from "../../modules/remote";
|
||||
let { channel } = $props();
|
||||
let email = $state("");
|
||||
let message = $state("");
|
||||
let isLoading = $state(false);
|
||||
$inspect(channel);
|
||||
function login(e) {
|
||||
e.preventDefault();
|
||||
isLoading = true;
|
||||
post(
|
||||
channel.lucentUrl + "/login",
|
||||
{
|
||||
email: email,
|
||||
},
|
||||
(data, err) => {
|
||||
isLoading = false;
|
||||
message = "You will receive an email with a login link";
|
||||
},
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
<AccountLayout {body} {channel}></AccountLayout>
|
||||
{#snippet body()}
|
||||
<div class="wrapper-tiny">
|
||||
{#if message}
|
||||
<div class="alert alert-info" role="alert">
|
||||
{message}
|
||||
</div>
|
||||
{:else}
|
||||
<form onsubmit={login}>
|
||||
<div class="mb-3">
|
||||
<label for="emailaddress" class="form-label"
|
||||
>Email address</label
|
||||
>
|
||||
<input
|
||||
type="email"
|
||||
bind:value={email}
|
||||
class="form-control"
|
||||
id="emailaddress"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="text-center mt-5 d-block">
|
||||
<button aria-busy={isLoading}>Login</button>
|
||||
</div>
|
||||
</form>
|
||||
{/if}
|
||||
</div>
|
||||
{/snippet}
|
||||
@@ -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}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<script>
|
||||
import AccountLayout from "../../layouts/AccountLayout.svelte";
|
||||
import { post } from "../../modules/remote";
|
||||
let { channel, data } = $props();
|
||||
let isLoading = $state(false);
|
||||
function login(e) {
|
||||
e.preventDefault();
|
||||
isLoading = true;
|
||||
post(
|
||||
channel.lucentUrl + "/verify",
|
||||
{
|
||||
email: data.email,
|
||||
token: data.token,
|
||||
},
|
||||
(data, err) => {
|
||||
window.location = channel.lucentUrl;
|
||||
},
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
<AccountLayout {body} {channel}></AccountLayout>
|
||||
{#snippet body()}
|
||||
<div class="wrapper-tiny">
|
||||
<form onsubmit={login}>
|
||||
<div class="mb-3 text-center">
|
||||
<h3>Login as {data.email}</h3>
|
||||
</div>
|
||||
|
||||
<div class="text-center mt-5 d-block">
|
||||
<button aria-busy={isLoading}>Enter</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{/snippet}
|
||||
Reference in New Issue
Block a user