Skip to content
This repository was archived by the owner on May 12, 2026. It is now read-only.

Commit 1acc26f

Browse files
committed
dynamic entity order of sections.
1 parent 802de0f commit 1acc26f

1 file changed

Lines changed: 124 additions & 124 deletions

File tree

  • src/routes/(protected)/dynamic-entities/system/[id]

src/routes/(protected)/dynamic-entities/system/[id]/+page.svelte

Lines changed: 124 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -527,10 +527,132 @@
527527
</dl>
528528
</div>
529529

530+
<!-- Schema Properties -->
531+
<div
532+
class="rounded-lg border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-800"
533+
>
534+
<div class="border-b border-gray-200 p-6 dark:border-gray-700">
535+
<h2 class="text-lg font-semibold text-gray-900 dark:text-gray-100">
536+
Schema Properties
537+
</h2>
538+
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
539+
{Object.keys(properties).length} properties defined
540+
{#if requiredFields.length > 0}
541+
({requiredFields.length} required)
542+
{/if}
543+
</p>
544+
</div>
545+
546+
{#if Object.keys(properties).length === 0}
547+
<div class="flex flex-col items-center justify-center py-12 text-center">
548+
<svg
549+
class="mb-4 h-16 w-16 text-gray-400"
550+
fill="none"
551+
stroke="currentColor"
552+
viewBox="0 0 24 24"
553+
>
554+
<path
555+
stroke-linecap="round"
556+
stroke-linejoin="round"
557+
stroke-width="2"
558+
d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
559+
/>
560+
</svg>
561+
<h3 class="mb-2 text-lg font-semibold text-gray-900 dark:text-gray-100">
562+
No Properties Defined
563+
</h3>
564+
<p class="text-gray-600 dark:text-gray-400">
565+
This entity has no schema properties defined.
566+
</p>
567+
</div>
568+
{:else}
569+
<div class="divide-y divide-gray-200 dark:divide-gray-700">
570+
{#each Object.entries(properties) as [fieldName, fieldDef]}
571+
{@const fieldDefTyped = fieldDef as any}
572+
{@const isRequired = requiredFields.includes(fieldName)}
573+
<div class="p-6">
574+
<div class="flex items-start justify-between">
575+
<div class="flex-1">
576+
<div class="flex items-center gap-2">
577+
<h3
578+
class="font-mono text-base font-semibold text-gray-900 dark:text-gray-100"
579+
>
580+
{fieldName}
581+
</h3>
582+
{#if isRequired}
583+
<span
584+
class="inline-flex items-center rounded-full bg-red-100 px-2 py-0.5 text-xs font-medium text-red-800 dark:bg-red-900 dark:text-red-200"
585+
>
586+
Required
587+
</span>
588+
{/if}
589+
<span
590+
class="inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium {getTypeBadgeColor(
591+
fieldDefTyped.type,
592+
)}"
593+
>
594+
{getTypeDisplayName(fieldDefTyped.type)}
595+
</span>
596+
</div>
597+
{#if fieldDefTyped.description}
598+
<p class="mt-2 text-sm text-gray-600 dark:text-gray-400">
599+
{fieldDefTyped.description}
600+
</p>
601+
{/if}
602+
<dl class="mt-3 space-y-1">
603+
{#if fieldDefTyped.example !== undefined}
604+
<div class="flex gap-2">
605+
<dt
606+
class="text-sm font-medium text-gray-500 dark:text-gray-400"
607+
>
608+
Example:
609+
</dt>
610+
<dd
611+
class="font-mono text-sm text-gray-900 dark:text-gray-100"
612+
>
613+
{typeof fieldDefTyped.example === "boolean"
614+
? fieldDefTyped.example.toString()
615+
: fieldDefTyped.example}
616+
</dd>
617+
</div>
618+
{/if}
619+
{#if fieldDefTyped.minLength !== undefined}
620+
<div class="flex gap-2">
621+
<dt
622+
class="text-sm font-medium text-gray-500 dark:text-gray-400"
623+
>
624+
Min Length:
625+
</dt>
626+
<dd class="text-sm text-gray-900 dark:text-gray-100">
627+
{fieldDefTyped.minLength}
628+
</dd>
629+
</div>
630+
{/if}
631+
{#if fieldDefTyped.maxLength !== undefined}
632+
<div class="flex gap-2">
633+
<dt
634+
class="text-sm font-medium text-gray-500 dark:text-gray-400"
635+
>
636+
Max Length:
637+
</dt>
638+
<dd class="text-sm text-gray-900 dark:text-gray-100">
639+
{fieldDefTyped.maxLength}
640+
</dd>
641+
</div>
642+
{/if}
643+
</dl>
644+
</div>
645+
</div>
646+
</div>
647+
{/each}
648+
</div>
649+
{/if}
650+
</div>
651+
530652
{#if entity.has_personal_entity}
531653
<!-- Allowed Operations Section (for Personal Entities) -->
532654
<div
533-
class="mb-6 rounded-lg border border-gray-200 bg-white p-6 shadow-sm dark:border-gray-700 dark:bg-gray-800"
655+
class="mt-6 rounded-lg border border-gray-200 bg-white p-6 shadow-sm dark:border-gray-700 dark:bg-gray-800"
534656
>
535657
<h2 class="mb-4 text-lg font-semibold text-gray-900 dark:text-gray-100">
536658
Allowed Operations
@@ -582,7 +704,7 @@
582704
{:else}
583705
<!-- Required Roles Section (for System-only Entities) -->
584706
<div
585-
class="mb-6 rounded-lg border border-gray-200 bg-white p-6 shadow-sm dark:border-gray-700 dark:bg-gray-800"
707+
class="mt-6 rounded-lg border border-gray-200 bg-white p-6 shadow-sm dark:border-gray-700 dark:bg-gray-800"
586708
>
587709
<h2 class="mb-4 text-lg font-semibold text-gray-900 dark:text-gray-100">
588710
Required Roles for CRUD Operations
@@ -711,128 +833,6 @@
711833
</div>
712834
{/if}
713835

714-
<!-- Schema Properties -->
715-
<div
716-
class="rounded-lg border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-800"
717-
>
718-
<div class="border-b border-gray-200 p-6 dark:border-gray-700">
719-
<h2 class="text-lg font-semibold text-gray-900 dark:text-gray-100">
720-
Schema Properties
721-
</h2>
722-
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
723-
{Object.keys(properties).length} properties defined
724-
{#if requiredFields.length > 0}
725-
({requiredFields.length} required)
726-
{/if}
727-
</p>
728-
</div>
729-
730-
{#if Object.keys(properties).length === 0}
731-
<div class="flex flex-col items-center justify-center py-12 text-center">
732-
<svg
733-
class="mb-4 h-16 w-16 text-gray-400"
734-
fill="none"
735-
stroke="currentColor"
736-
viewBox="0 0 24 24"
737-
>
738-
<path
739-
stroke-linecap="round"
740-
stroke-linejoin="round"
741-
stroke-width="2"
742-
d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
743-
/>
744-
</svg>
745-
<h3 class="mb-2 text-lg font-semibold text-gray-900 dark:text-gray-100">
746-
No Properties Defined
747-
</h3>
748-
<p class="text-gray-600 dark:text-gray-400">
749-
This entity has no schema properties defined.
750-
</p>
751-
</div>
752-
{:else}
753-
<div class="divide-y divide-gray-200 dark:divide-gray-700">
754-
{#each Object.entries(properties) as [fieldName, fieldDef]}
755-
{@const fieldDefTyped = fieldDef as any}
756-
{@const isRequired = requiredFields.includes(fieldName)}
757-
<div class="p-6">
758-
<div class="flex items-start justify-between">
759-
<div class="flex-1">
760-
<div class="flex items-center gap-2">
761-
<h3
762-
class="font-mono text-base font-semibold text-gray-900 dark:text-gray-100"
763-
>
764-
{fieldName}
765-
</h3>
766-
{#if isRequired}
767-
<span
768-
class="inline-flex items-center rounded-full bg-red-100 px-2 py-0.5 text-xs font-medium text-red-800 dark:bg-red-900 dark:text-red-200"
769-
>
770-
Required
771-
</span>
772-
{/if}
773-
<span
774-
class="inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium {getTypeBadgeColor(
775-
fieldDefTyped.type,
776-
)}"
777-
>
778-
{getTypeDisplayName(fieldDefTyped.type)}
779-
</span>
780-
</div>
781-
{#if fieldDefTyped.description}
782-
<p class="mt-2 text-sm text-gray-600 dark:text-gray-400">
783-
{fieldDefTyped.description}
784-
</p>
785-
{/if}
786-
<dl class="mt-3 space-y-1">
787-
{#if fieldDefTyped.example !== undefined}
788-
<div class="flex gap-2">
789-
<dt
790-
class="text-sm font-medium text-gray-500 dark:text-gray-400"
791-
>
792-
Example:
793-
</dt>
794-
<dd
795-
class="font-mono text-sm text-gray-900 dark:text-gray-100"
796-
>
797-
{typeof fieldDefTyped.example === "boolean"
798-
? fieldDefTyped.example.toString()
799-
: fieldDefTyped.example}
800-
</dd>
801-
</div>
802-
{/if}
803-
{#if fieldDefTyped.minLength !== undefined}
804-
<div class="flex gap-2">
805-
<dt
806-
class="text-sm font-medium text-gray-500 dark:text-gray-400"
807-
>
808-
Min Length:
809-
</dt>
810-
<dd class="text-sm text-gray-900 dark:text-gray-100">
811-
{fieldDefTyped.minLength}
812-
</dd>
813-
</div>
814-
{/if}
815-
{#if fieldDefTyped.maxLength !== undefined}
816-
<div class="flex gap-2">
817-
<dt
818-
class="text-sm font-medium text-gray-500 dark:text-gray-400"
819-
>
820-
Max Length:
821-
</dt>
822-
<dd class="text-sm text-gray-900 dark:text-gray-100">
823-
{fieldDefTyped.maxLength}
824-
</dd>
825-
</div>
826-
{/if}
827-
</dl>
828-
</div>
829-
</div>
830-
</div>
831-
{/each}
832-
</div>
833-
{/if}
834-
</div>
835-
836836
<!-- Raw JSON View -->
837837
<div
838838
class="mt-6 rounded-lg border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-800"

0 commit comments

Comments
 (0)