[#872] changed the schema required validator to be optional for auth collections
This commit is contained in:
@@ -158,7 +158,7 @@
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-block {collection.schema?.length ? 'btn-secondary' : 'btn-warning'}"
|
||||
class="btn btn-block {collection?.isAuth || collection.schema?.length ? 'btn-secondary' : 'btn-warning'}"
|
||||
on:click={newField}
|
||||
>
|
||||
<i class="ri-add-line" />
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import { scale } from "svelte/transition";
|
||||
import CommonHelper from "@/utils/CommonHelper";
|
||||
import ApiClient from "@/utils/ApiClient";
|
||||
import { errors, setErrors } from "@/stores/errors";
|
||||
import { errors, setErrors, removeError } from "@/stores/errors";
|
||||
import { confirm } from "@/stores/confirmation";
|
||||
import { addSuccessToast } from "@/stores/toasts";
|
||||
import { addCollection, removeCollection } from "@/stores/collections";
|
||||
@@ -180,6 +180,9 @@
|
||||
|
||||
function setCollectionType(t) {
|
||||
collection.type = t;
|
||||
|
||||
// reset schema errors on type change
|
||||
removeError("schema");
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -242,7 +245,7 @@
|
||||
disabled={isSystemUpdate}
|
||||
spellcheck="false"
|
||||
autofocus={collection.isNew}
|
||||
placeholder={`eg. "posts"`}
|
||||
placeholder={collection.isAuth ? `eg. "users"` : `eg. "posts"`}
|
||||
value={collection.name}
|
||||
on:input={(e) => {
|
||||
collection.name = CommonHelper.slugify(e.target.value);
|
||||
|
||||
@@ -333,7 +333,10 @@
|
||||
|
||||
{#if collection?.isAuth}
|
||||
<AuthFields bind:record {collection} />
|
||||
<hr />
|
||||
|
||||
{#if collection?.schema?.length}
|
||||
<hr />
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{#each collection?.schema || [] as field (field.name)}
|
||||
@@ -364,10 +367,6 @@
|
||||
{:else if field.type === "relation"}
|
||||
<RelationField {field} bind:value={record[field.name]} />
|
||||
{/if}
|
||||
{:else}
|
||||
<div class="block txt-center txt-disabled">
|
||||
<h5>No custom fields to be set</h5>
|
||||
</div>
|
||||
{/each}
|
||||
</form>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user