fixed superuser OTP id input reactivity, enabled truncate dropdown option for system collections, updated jsvm types

This commit is contained in:
Gani Georgiev
2024-11-23 14:12:12 +02:00
parent b34453afc7
commit 2dd4e38e1d
32 changed files with 3027 additions and 2980 deletions
@@ -368,7 +368,7 @@
{!collection.id ? "New collection" : "Edit collection"}
</h4>
{#if !!collection.id && !collection.system}
{#if !!collection.id && (!collection.system || !isView)}
<div class="flex-fill" />
<div
tabindex="0"
@@ -378,16 +378,18 @@
>
<i class="ri-more-line" aria-hidden="true" />
<Toggler class="dropdown dropdown-right m-t-5">
<button
type="button"
class="dropdown-item"
role="menuitem"
on:click={() => duplicateConfirm()}
>
<i class="ri-file-copy-line" aria-hidden="true" />
<span class="txt">Duplicate</span>
</button>
<hr />
{#if !collection.system}
<button
type="button"
class="dropdown-item"
role="menuitem"
on:click={() => duplicateConfirm()}
>
<i class="ri-file-copy-line" aria-hidden="true" />
<span class="txt">Duplicate</span>
</button>
<hr />
{/if}
{#if !isView}
<button
type="button"
@@ -399,15 +401,17 @@
<span class="txt">Truncate</span>
</button>
{/if}
<button
type="button"
class="dropdown-item txt-danger"
role="menuitem"
on:click|preventDefault|stopPropagation={() => deleteConfirm()}
>
<i class="ri-delete-bin-7-line" aria-hidden="true" />
<span class="txt">Delete</span>
</button>
{#if !collection.system}
<button
type="button"
class="dropdown-item txt-danger"
role="menuitem"
on:click|preventDefault|stopPropagation={() => deleteConfirm()}
>
<i class="ri-delete-bin-7-line" aria-hidden="true" />
<span class="txt">Delete</span>
</button>
{/if}
</Toggler>
</div>
{/if}
@@ -138,7 +138,7 @@
otpAuthSubmitting = true;
try {
await ApiClient.collection("_superusers").authWithOTP(otpId, otpPassword, { mfaId });
await ApiClient.collection("_superusers").authWithOTP(otpId || lastOTPId, otpPassword, { mfaId });
removeAllToasts();
setErrors({});
replace("/");
@@ -238,7 +238,18 @@
<form class="block" on:submit|preventDefault={authWithOTP}>
<Field class="form-field required" name="otpId" let:uniqueId>
<label for={uniqueId}>Id</label>
<input type="text" id={uniqueId} bind:value={otpId} required />
<input
type="text"
id={uniqueId}
value={otpId}
placeholder={lastOTPId}
on:change={(e) => {
console.log("change");
otpId = e.target.value || lastOTPId;
e.target.value = otpId;
}}
required
/>
</Field>
<Field class="form-field required" name="password" let:uniqueId>