admindb 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -20
- package/README.md +333 -325
- package/dist/db/database.d.ts +3 -2
- package/dist/db/database.js +12 -9
- package/dist/db/database.js.map +1 -1
- package/dist/db/manager.js +1 -1
- package/dist/db/manager.js.map +1 -1
- package/dist/public/css/input.css +179 -179
- package/dist/public/js/api.js +47 -47
- package/dist/public/js/app.js +120 -120
- package/dist/public/js/browse.js +123 -123
- package/dist/public/js/databases.js +45 -45
- package/dist/public/js/designer.js +205 -205
- package/dist/public/js/forms.js +244 -244
- package/dist/public/js/query.js +232 -232
- package/dist/public/js/schema.js +314 -314
- package/dist/public/js/triggers.js +155 -155
- package/dist/public/js/views.js +176 -176
- package/dist/views/layouts/main.hbs +49 -49
- package/dist/views/pages/databases.hbs +102 -102
- package/dist/views/pages/designer.hbs +81 -81
- package/dist/views/pages/error.hbs +12 -12
- package/dist/views/pages/form.hbs +62 -62
- package/dist/views/pages/home.hbs +123 -123
- package/dist/views/pages/query.hbs +94 -94
- package/dist/views/pages/schema.hbs +290 -290
- package/dist/views/pages/table.hbs +203 -203
- package/dist/views/pages/triggers.hbs +162 -162
- package/dist/views/pages/views.hbs +134 -134
- package/dist/views/partials/navbar.hbs +50 -50
- package/dist/views/partials/sidebar.hbs +128 -128
- package/package.json +66 -62
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
<div class="space-y-6">
|
|
2
|
-
<!-- Header -->
|
|
3
|
-
<div>
|
|
4
|
-
<p class="text-sm font-semibold uppercase tracking-wider text-primary">Manager</p>
|
|
5
|
-
<h1 class="mt-1 text-3xl font-extrabold tracking-tight">Databases</h1>
|
|
6
|
-
<p class="mt-1.5 text-sm text-base-content/55">Open a database to browse and edit it, or create a new one.</p>
|
|
7
|
-
</div>
|
|
8
|
-
|
|
9
|
-
<!-- New database -->
|
|
10
|
-
<div class="app-card p-5">
|
|
11
|
-
<div class="flex flex-wrap items-end gap-3">
|
|
12
|
-
<div class="w-full max-w-sm">
|
|
13
|
-
<label class="field-label" for="new-db-name">New database name</label>
|
|
14
|
-
<input id="new-db-name" class="field-input font-mono" placeholder="e.g. analytics" autocomplete="off" spellcheck="false" />
|
|
15
|
-
</div>
|
|
16
|
-
{{#unless readonly}}
|
|
17
|
-
<button id="create-db" type="button" class="btn btn-primary btn-sm mb-0.5 gap-1.5">
|
|
18
|
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M12 4v16m8-8H4" /></svg>
|
|
19
|
-
Create
|
|
20
|
-
</button>
|
|
21
|
-
{{else}}
|
|
22
|
-
<span class="mb-1 text-sm font-medium text-warning">Read-only — creating databases is disabled.</span>
|
|
23
|
-
{{/unless}}
|
|
24
|
-
</div>
|
|
25
|
-
<p class="mt-2 text-xs text-base-content/40">
|
|
26
|
-
New databases are created in <code class="font-mono">{{dbDir}}</code>. Files already there are picked up
|
|
27
|
-
automatically, and any explicitly configured database paths appear here too.
|
|
28
|
-
</p>
|
|
29
|
-
</div>
|
|
30
|
-
|
|
31
|
-
<!-- List -->
|
|
32
|
-
<div>
|
|
33
|
-
<div class="mb-3 flex items-center justify-between">
|
|
34
|
-
<h2 class="text-lg font-bold">Available databases</h2>
|
|
35
|
-
<span class="text-sm text-base-content/45">{{databases.length}} total</span>
|
|
36
|
-
</div>
|
|
37
|
-
|
|
38
|
-
{{#if databases.length}}
|
|
39
|
-
<div class="app-card overflow-hidden">
|
|
40
|
-
<div class="overflow-x-auto">
|
|
41
|
-
<table class="table table-sm">
|
|
42
|
-
<thead>
|
|
43
|
-
<tr class="bg-base-200/70 text-xs uppercase tracking-wide text-base-content/50">
|
|
44
|
-
<th class="font-semibold">Name</th>
|
|
45
|
-
<th class="text-right font-semibold">Tables</th>
|
|
46
|
-
<th class="text-right font-semibold">Size</th>
|
|
47
|
-
<th class="font-semibold">Modified</th>
|
|
48
|
-
<th class="text-right font-semibold">Actions</th>
|
|
49
|
-
</tr>
|
|
50
|
-
</thead>
|
|
51
|
-
<tbody>
|
|
52
|
-
{{#each databases}}
|
|
53
|
-
<tr class="group hover:bg-primary/[0.04]">
|
|
54
|
-
<td>
|
|
55
|
-
<a href="{{../basePath}}/{{this.id}}" class="inline-flex items-center gap-2.5">
|
|
56
|
-
<span class="grid h-8 w-8 shrink-0 place-items-center rounded-lg bg-primary/10 text-primary transition-colors group-hover:bg-primary/20">
|
|
57
|
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M4 7v10c0 1.1.9 2 2 2h12a2 2 0 002-2V7M4 7c0-1.1.9-2 2-2h12a2 2 0 012 2M4 7c0 1.1.9 2 2 2h12a2 2 0 002-2" /></svg>
|
|
58
|
-
</span>
|
|
59
|
-
<span class="min-w-0">
|
|
60
|
-
<span class="block truncate font-mono text-[13.5px] font-semibold">{{this.name}}</span>
|
|
61
|
-
<span class="block max-w-[220px] truncate text-[11px] text-base-content/40" title="{{this.path}}">{{this.path}}</span>
|
|
62
|
-
</span>
|
|
63
|
-
</a>
|
|
64
|
-
</td>
|
|
65
|
-
<td class="text-right tabular-nums text-base-content/60">{{this.tables}}</td>
|
|
66
|
-
<td class="text-right tabular-nums text-base-content/60">{{this.sizeLabel}}</td>
|
|
67
|
-
<td class="text-[13px] text-base-content/55">{{this.modifiedLabel}}</td>
|
|
68
|
-
<td class="whitespace-nowrap text-right">
|
|
69
|
-
<div class="row-actions">
|
|
70
|
-
<a href="{{../basePath}}/{{this.id}}" class="btn btn-ghost btn-xs gap-1 text-base-content/70 hover:text-primary">
|
|
71
|
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-3.5 w-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M13 7l5 5m0 0l-5 5m5-5H6" /></svg>
|
|
72
|
-
Open
|
|
73
|
-
</a>
|
|
74
|
-
{{#unless ../readonly}}
|
|
75
|
-
<button type="button" class="btn btn-ghost btn-xs gap-1 text-error js-delete-db" data-id="{{this.id}}">
|
|
76
|
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-3.5 w-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" /></svg>
|
|
77
|
-
Delete
|
|
78
|
-
</button>
|
|
79
|
-
{{/unless}}
|
|
80
|
-
</div>
|
|
81
|
-
</td>
|
|
82
|
-
</tr>
|
|
83
|
-
{{/each}}
|
|
84
|
-
</tbody>
|
|
85
|
-
</table>
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
{{else}}
|
|
89
|
-
<div class="empty-state">
|
|
90
|
-
<span class="empty-icon">
|
|
91
|
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-7 w-7" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M4 7v10c0 1.1.9 2 2 2h12a2 2 0 002-2V7M4 7c0-1.1.9-2 2-2h12a2 2 0 012 2M4 7c0 1.1.9 2 2 2h12a2 2 0 002-2" /></svg>
|
|
92
|
-
</span>
|
|
93
|
-
<p class="text-sm font-medium text-base-content/70">No databases yet</p>
|
|
94
|
-
<p class="max-w-sm text-sm text-base-content/45">
|
|
95
|
-
Create one above, or drop <code class="font-mono">.db</code> files into
|
|
96
|
-
<code class="font-mono">{{dbDir}}</code> and refresh.
|
|
97
|
-
</p>
|
|
98
|
-
</div>
|
|
99
|
-
{{/if}}
|
|
100
|
-
</div>
|
|
101
|
-
</div>
|
|
102
|
-
<script src="{{basePath}}/js/databases.js" defer></script>
|
|
1
|
+
<div class="space-y-6">
|
|
2
|
+
<!-- Header -->
|
|
3
|
+
<div>
|
|
4
|
+
<p class="text-sm font-semibold uppercase tracking-wider text-primary">Manager</p>
|
|
5
|
+
<h1 class="mt-1 text-3xl font-extrabold tracking-tight">Databases</h1>
|
|
6
|
+
<p class="mt-1.5 text-sm text-base-content/55">Open a database to browse and edit it, or create a new one.</p>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<!-- New database -->
|
|
10
|
+
<div class="app-card p-5">
|
|
11
|
+
<div class="flex flex-wrap items-end gap-3">
|
|
12
|
+
<div class="w-full max-w-sm">
|
|
13
|
+
<label class="field-label" for="new-db-name">New database name</label>
|
|
14
|
+
<input id="new-db-name" class="field-input font-mono" placeholder="e.g. analytics" autocomplete="off" spellcheck="false" />
|
|
15
|
+
</div>
|
|
16
|
+
{{#unless readonly}}
|
|
17
|
+
<button id="create-db" type="button" class="btn btn-primary btn-sm mb-0.5 gap-1.5">
|
|
18
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M12 4v16m8-8H4" /></svg>
|
|
19
|
+
Create
|
|
20
|
+
</button>
|
|
21
|
+
{{else}}
|
|
22
|
+
<span class="mb-1 text-sm font-medium text-warning">Read-only — creating databases is disabled.</span>
|
|
23
|
+
{{/unless}}
|
|
24
|
+
</div>
|
|
25
|
+
<p class="mt-2 text-xs text-base-content/40">
|
|
26
|
+
New databases are created in <code class="font-mono">{{dbDir}}</code>. Files already there are picked up
|
|
27
|
+
automatically, and any explicitly configured database paths appear here too.
|
|
28
|
+
</p>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<!-- List -->
|
|
32
|
+
<div>
|
|
33
|
+
<div class="mb-3 flex items-center justify-between">
|
|
34
|
+
<h2 class="text-lg font-bold">Available databases</h2>
|
|
35
|
+
<span class="text-sm text-base-content/45">{{databases.length}} total</span>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
{{#if databases.length}}
|
|
39
|
+
<div class="app-card overflow-hidden">
|
|
40
|
+
<div class="overflow-x-auto">
|
|
41
|
+
<table class="table table-sm">
|
|
42
|
+
<thead>
|
|
43
|
+
<tr class="bg-base-200/70 text-xs uppercase tracking-wide text-base-content/50">
|
|
44
|
+
<th class="font-semibold">Name</th>
|
|
45
|
+
<th class="text-right font-semibold">Tables</th>
|
|
46
|
+
<th class="text-right font-semibold">Size</th>
|
|
47
|
+
<th class="font-semibold">Modified</th>
|
|
48
|
+
<th class="text-right font-semibold">Actions</th>
|
|
49
|
+
</tr>
|
|
50
|
+
</thead>
|
|
51
|
+
<tbody>
|
|
52
|
+
{{#each databases}}
|
|
53
|
+
<tr class="group hover:bg-primary/[0.04]">
|
|
54
|
+
<td>
|
|
55
|
+
<a href="{{../basePath}}/{{this.id}}" class="inline-flex items-center gap-2.5">
|
|
56
|
+
<span class="grid h-8 w-8 shrink-0 place-items-center rounded-lg bg-primary/10 text-primary transition-colors group-hover:bg-primary/20">
|
|
57
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M4 7v10c0 1.1.9 2 2 2h12a2 2 0 002-2V7M4 7c0-1.1.9-2 2-2h12a2 2 0 012 2M4 7c0 1.1.9 2 2 2h12a2 2 0 002-2" /></svg>
|
|
58
|
+
</span>
|
|
59
|
+
<span class="min-w-0">
|
|
60
|
+
<span class="block truncate font-mono text-[13.5px] font-semibold">{{this.name}}</span>
|
|
61
|
+
<span class="block max-w-[220px] truncate text-[11px] text-base-content/40" title="{{this.path}}">{{this.path}}</span>
|
|
62
|
+
</span>
|
|
63
|
+
</a>
|
|
64
|
+
</td>
|
|
65
|
+
<td class="text-right tabular-nums text-base-content/60">{{this.tables}}</td>
|
|
66
|
+
<td class="text-right tabular-nums text-base-content/60">{{this.sizeLabel}}</td>
|
|
67
|
+
<td class="text-[13px] text-base-content/55">{{this.modifiedLabel}}</td>
|
|
68
|
+
<td class="whitespace-nowrap text-right">
|
|
69
|
+
<div class="row-actions">
|
|
70
|
+
<a href="{{../basePath}}/{{this.id}}" class="btn btn-ghost btn-xs gap-1 text-base-content/70 hover:text-primary">
|
|
71
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-3.5 w-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M13 7l5 5m0 0l-5 5m5-5H6" /></svg>
|
|
72
|
+
Open
|
|
73
|
+
</a>
|
|
74
|
+
{{#unless ../readonly}}
|
|
75
|
+
<button type="button" class="btn btn-ghost btn-xs gap-1 text-error js-delete-db" data-id="{{this.id}}">
|
|
76
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-3.5 w-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" /></svg>
|
|
77
|
+
Delete
|
|
78
|
+
</button>
|
|
79
|
+
{{/unless}}
|
|
80
|
+
</div>
|
|
81
|
+
</td>
|
|
82
|
+
</tr>
|
|
83
|
+
{{/each}}
|
|
84
|
+
</tbody>
|
|
85
|
+
</table>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
{{else}}
|
|
89
|
+
<div class="empty-state">
|
|
90
|
+
<span class="empty-icon">
|
|
91
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-7 w-7" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M4 7v10c0 1.1.9 2 2 2h12a2 2 0 002-2V7M4 7c0-1.1.9-2 2-2h12a2 2 0 012 2M4 7c0 1.1.9 2 2 2h12a2 2 0 002-2" /></svg>
|
|
92
|
+
</span>
|
|
93
|
+
<p class="text-sm font-medium text-base-content/70">No databases yet</p>
|
|
94
|
+
<p class="max-w-sm text-sm text-base-content/45">
|
|
95
|
+
Create one above, or drop <code class="font-mono">.db</code> files into
|
|
96
|
+
<code class="font-mono">{{dbDir}}</code> and refresh.
|
|
97
|
+
</p>
|
|
98
|
+
</div>
|
|
99
|
+
{{/if}}
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
<script src="{{basePath}}/js/databases.js" defer></script>
|
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
<div class="space-y-6">
|
|
2
|
-
<!-- Header -->
|
|
3
|
-
<div>
|
|
4
|
-
<p class="text-sm font-semibold uppercase tracking-wider text-primary">Designer</p>
|
|
5
|
-
<h1 class="mt-1 text-3xl font-extrabold tracking-tight">Create table</h1>
|
|
6
|
-
<p class="mt-1.5 text-sm text-base-content/55">Define columns visually — the SQL preview updates live as you type.</p>
|
|
7
|
-
</div>
|
|
8
|
-
|
|
9
|
-
<div class="grid gap-6 lg:grid-cols-[1fr_380px]">
|
|
10
|
-
<!-- Left: editor -->
|
|
11
|
-
<div class="space-y-5">
|
|
12
|
-
<div class="app-card p-5">
|
|
13
|
-
<label class="field-label">
|
|
14
|
-
Table name
|
|
15
|
-
<span class="chip chip-type">required</span>
|
|
16
|
-
</label>
|
|
17
|
-
<input id="table-name" type="text" class="field-input font-mono" placeholder="e.g. users" autocomplete="off" spellcheck="false" />
|
|
18
|
-
</div>
|
|
19
|
-
|
|
20
|
-
<div class="app-card">
|
|
21
|
-
<div class="flex flex-wrap items-center justify-between gap-2 border-b border-base-200 px-5 py-4">
|
|
22
|
-
<h2 class="text-sm font-semibold uppercase tracking-wide text-base-content/45">Columns</h2>
|
|
23
|
-
<button id="add-column" type="button" class="btn btn-outline btn-sm gap-1.5">
|
|
24
|
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M12 4v16m8-8H4" /></svg>
|
|
25
|
-
Add column
|
|
26
|
-
</button>
|
|
27
|
-
</div>
|
|
28
|
-
<div id="columns" class="space-y-3 p-4"></div>
|
|
29
|
-
<div id="designer-error" class="hidden px-4 pb-4"></div>
|
|
30
|
-
<div class="flex flex-wrap gap-2 border-t border-base-200 px-5 py-4">
|
|
31
|
-
{{#unless readonly}}
|
|
32
|
-
<button id="create-table" type="button" class="btn btn-primary gap-1.5">
|
|
33
|
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7" /></svg>
|
|
34
|
-
Create table
|
|
35
|
-
</button>
|
|
36
|
-
{{else}}
|
|
37
|
-
<span class="text-sm font-medium text-warning">Read-only — table creation is disabled.</span>
|
|
38
|
-
{{/unless}}
|
|
39
|
-
<button id="copy-sql" type="button" class="btn btn-outline gap-1.5" title="Copy the preview SQL">
|
|
40
|
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3" /></svg>
|
|
41
|
-
Copy SQL
|
|
42
|
-
</button>
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
|
|
47
|
-
<!-- Right: live preview + tips -->
|
|
48
|
-
<aside class="space-y-4 self-start lg:sticky lg:top-24">
|
|
49
|
-
<div class="app-card overflow-hidden">
|
|
50
|
-
<div class="flex items-center justify-between border-b border-base-200 bg-base-200/40 px-4 py-3">
|
|
51
|
-
<h2 class="flex items-center gap-2 text-sm font-semibold text-base-content/60">
|
|
52
|
-
<span class="grid h-5 w-5 place-items-center rounded-md bg-primary/10 text-primary">
|
|
53
|
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-3.5 w-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M13 10V3L4 14h7v7l9-11h-7z" /></svg>
|
|
54
|
-
</span>
|
|
55
|
-
SQL preview
|
|
56
|
-
</h2>
|
|
57
|
-
<span id="preview-status" class="text-[11px] font-medium text-base-content/40">waiting…</span>
|
|
58
|
-
</div>
|
|
59
|
-
<div class="p-4">
|
|
60
|
-
<pre id="sql-preview" class="code-panel hidden"><code id="preview-code"></code></pre>
|
|
61
|
-
<div id="preview-placeholder" class="rounded-xl border border-dashed border-base-300 px-4 py-8 text-center text-sm text-base-content/35">
|
|
62
|
-
Your <code class="font-mono">CREATE TABLE</code> statement will appear here as you build it.
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
|
|
67
|
-
<div class="rounded-2xl border border-base-300/70 bg-base-100 p-4">
|
|
68
|
-
<h3 class="mb-2 text-[11px] font-semibold uppercase tracking-wider text-base-content/45">Type guide</h3>
|
|
69
|
-
<ul class="space-y-1.5 text-[13px] text-base-content/60">
|
|
70
|
-
<li class="flex items-center justify-between gap-2"><span class="font-mono">TEXT</span><span class="text-base-content/40">Free-form text</span></li>
|
|
71
|
-
<li class="flex items-center justify-between gap-2"><span class="font-mono">INTEGER</span><span class="text-base-content/40">Whole numbers</span></li>
|
|
72
|
-
<li class="flex items-center justify-between gap-2"><span class="font-mono">REAL</span><span class="text-base-content/40">Decimal numbers</span></li>
|
|
73
|
-
<li class="flex items-center justify-between gap-2"><span class="font-mono">BLOB</span><span class="text-base-content/40">Binary data</span></li>
|
|
74
|
-
<li class="flex items-center justify-between gap-2"><span class="font-mono">BOOLEAN</span><span class="text-base-content/40">Stored as 0/1</span></li>
|
|
75
|
-
<li class="flex items-center justify-between gap-2"><span class="font-mono">DATE</span><span class="text-base-content/40">Datetime + now default</span></li>
|
|
76
|
-
</ul>
|
|
77
|
-
</div>
|
|
78
|
-
</aside>
|
|
79
|
-
</div>
|
|
80
|
-
</div>
|
|
81
|
-
<script src="{{basePath}}/js/designer.js" defer></script>
|
|
1
|
+
<div class="space-y-6">
|
|
2
|
+
<!-- Header -->
|
|
3
|
+
<div>
|
|
4
|
+
<p class="text-sm font-semibold uppercase tracking-wider text-primary">Designer</p>
|
|
5
|
+
<h1 class="mt-1 text-3xl font-extrabold tracking-tight">Create table</h1>
|
|
6
|
+
<p class="mt-1.5 text-sm text-base-content/55">Define columns visually — the SQL preview updates live as you type.</p>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<div class="grid gap-6 lg:grid-cols-[1fr_380px]">
|
|
10
|
+
<!-- Left: editor -->
|
|
11
|
+
<div class="space-y-5">
|
|
12
|
+
<div class="app-card p-5">
|
|
13
|
+
<label class="field-label">
|
|
14
|
+
Table name
|
|
15
|
+
<span class="chip chip-type">required</span>
|
|
16
|
+
</label>
|
|
17
|
+
<input id="table-name" type="text" class="field-input font-mono" placeholder="e.g. users" autocomplete="off" spellcheck="false" />
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<div class="app-card">
|
|
21
|
+
<div class="flex flex-wrap items-center justify-between gap-2 border-b border-base-200 px-5 py-4">
|
|
22
|
+
<h2 class="text-sm font-semibold uppercase tracking-wide text-base-content/45">Columns</h2>
|
|
23
|
+
<button id="add-column" type="button" class="btn btn-outline btn-sm gap-1.5">
|
|
24
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M12 4v16m8-8H4" /></svg>
|
|
25
|
+
Add column
|
|
26
|
+
</button>
|
|
27
|
+
</div>
|
|
28
|
+
<div id="columns" class="space-y-3 p-4"></div>
|
|
29
|
+
<div id="designer-error" class="hidden px-4 pb-4"></div>
|
|
30
|
+
<div class="flex flex-wrap gap-2 border-t border-base-200 px-5 py-4">
|
|
31
|
+
{{#unless readonly}}
|
|
32
|
+
<button id="create-table" type="button" class="btn btn-primary gap-1.5">
|
|
33
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7" /></svg>
|
|
34
|
+
Create table
|
|
35
|
+
</button>
|
|
36
|
+
{{else}}
|
|
37
|
+
<span class="text-sm font-medium text-warning">Read-only — table creation is disabled.</span>
|
|
38
|
+
{{/unless}}
|
|
39
|
+
<button id="copy-sql" type="button" class="btn btn-outline gap-1.5" title="Copy the preview SQL">
|
|
40
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3" /></svg>
|
|
41
|
+
Copy SQL
|
|
42
|
+
</button>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<!-- Right: live preview + tips -->
|
|
48
|
+
<aside class="space-y-4 self-start lg:sticky lg:top-24">
|
|
49
|
+
<div class="app-card overflow-hidden">
|
|
50
|
+
<div class="flex items-center justify-between border-b border-base-200 bg-base-200/40 px-4 py-3">
|
|
51
|
+
<h2 class="flex items-center gap-2 text-sm font-semibold text-base-content/60">
|
|
52
|
+
<span class="grid h-5 w-5 place-items-center rounded-md bg-primary/10 text-primary">
|
|
53
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-3.5 w-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M13 10V3L4 14h7v7l9-11h-7z" /></svg>
|
|
54
|
+
</span>
|
|
55
|
+
SQL preview
|
|
56
|
+
</h2>
|
|
57
|
+
<span id="preview-status" class="text-[11px] font-medium text-base-content/40">waiting…</span>
|
|
58
|
+
</div>
|
|
59
|
+
<div class="p-4">
|
|
60
|
+
<pre id="sql-preview" class="code-panel hidden"><code id="preview-code"></code></pre>
|
|
61
|
+
<div id="preview-placeholder" class="rounded-xl border border-dashed border-base-300 px-4 py-8 text-center text-sm text-base-content/35">
|
|
62
|
+
Your <code class="font-mono">CREATE TABLE</code> statement will appear here as you build it.
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<div class="rounded-2xl border border-base-300/70 bg-base-100 p-4">
|
|
68
|
+
<h3 class="mb-2 text-[11px] font-semibold uppercase tracking-wider text-base-content/45">Type guide</h3>
|
|
69
|
+
<ul class="space-y-1.5 text-[13px] text-base-content/60">
|
|
70
|
+
<li class="flex items-center justify-between gap-2"><span class="font-mono">TEXT</span><span class="text-base-content/40">Free-form text</span></li>
|
|
71
|
+
<li class="flex items-center justify-between gap-2"><span class="font-mono">INTEGER</span><span class="text-base-content/40">Whole numbers</span></li>
|
|
72
|
+
<li class="flex items-center justify-between gap-2"><span class="font-mono">REAL</span><span class="text-base-content/40">Decimal numbers</span></li>
|
|
73
|
+
<li class="flex items-center justify-between gap-2"><span class="font-mono">BLOB</span><span class="text-base-content/40">Binary data</span></li>
|
|
74
|
+
<li class="flex items-center justify-between gap-2"><span class="font-mono">BOOLEAN</span><span class="text-base-content/40">Stored as 0/1</span></li>
|
|
75
|
+
<li class="flex items-center justify-between gap-2"><span class="font-mono">DATE</span><span class="text-base-content/40">Datetime + now default</span></li>
|
|
76
|
+
</ul>
|
|
77
|
+
</div>
|
|
78
|
+
</aside>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
<script src="{{basePath}}/js/designer.js" defer></script>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
<div class="mx-auto mt-16 max-w-md space-y-6 text-center">
|
|
2
|
-
<div class="mx-auto grid h-20 w-20 place-items-center rounded-3xl bg-error/10 text-error">
|
|
3
|
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-10 w-10" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
4
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
|
|
5
|
-
</svg>
|
|
6
|
-
</div>
|
|
7
|
-
<div>
|
|
8
|
-
<h1 class="text-5xl font-extrabold tracking-tight text-error">{{status}}</h1>
|
|
9
|
-
<p class="mt-2 text-base-content/60">{{error}}</p>
|
|
10
|
-
</div>
|
|
11
|
-
<a href="{{basePath}}/" class="btn btn-primary">Back to home</a>
|
|
12
|
-
</div>
|
|
1
|
+
<div class="mx-auto mt-16 max-w-md space-y-6 text-center">
|
|
2
|
+
<div class="mx-auto grid h-20 w-20 place-items-center rounded-3xl bg-error/10 text-error">
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-10 w-10" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
4
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
|
|
5
|
+
</svg>
|
|
6
|
+
</div>
|
|
7
|
+
<div>
|
|
8
|
+
<h1 class="text-5xl font-extrabold tracking-tight text-error">{{status}}</h1>
|
|
9
|
+
<p class="mt-2 text-base-content/60">{{error}}</p>
|
|
10
|
+
</div>
|
|
11
|
+
<a href="{{basePath}}/" class="btn btn-primary">Back to home</a>
|
|
12
|
+
</div>
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
<div class="mx-auto max-w-3xl space-y-5">
|
|
2
|
-
<!-- Header -->
|
|
3
|
-
<div class="flex items-center gap-3">
|
|
4
|
-
<a href="{{basePath}}/tables/{{table}}" class="btn btn-circle btn-ghost btn-sm" aria-label="Back to table">
|
|
5
|
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M10 19l-7-7m0 0l7-7m-7 7h18" /></svg>
|
|
6
|
-
</a>
|
|
7
|
-
<div>
|
|
8
|
-
<h1 class="text-2xl font-bold tracking-tight">
|
|
9
|
-
{{#if (eq mode 'edit')}}Edit row{{else}}New row{{/if}}
|
|
10
|
-
<span class="text-base-content/40">in</span> <span class="font-mono text-primary">{{table}}</span>
|
|
11
|
-
</h1>
|
|
12
|
-
<p class="text-sm text-base-content/55">{{infoSummary}}</p>
|
|
13
|
-
</div>
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
<div class="app-card">
|
|
17
|
-
<div class="border-b border-base-200 px-6 py-4">
|
|
18
|
-
<h2 class="text-sm font-semibold uppercase tracking-wide text-base-content/45">Row fields</h2>
|
|
19
|
-
</div>
|
|
20
|
-
<div class="p-6">
|
|
21
|
-
<div id="row-fields" class="grid grid-cols-1 gap-x-6 gap-y-5 md:grid-cols-2"></div>
|
|
22
|
-
<div id="form-error" class="hidden"></div>
|
|
23
|
-
<div class="mt-6 flex flex-wrap items-center gap-2 border-t border-base-200 pt-5">
|
|
24
|
-
{{#unless readonly}}
|
|
25
|
-
<button id="row-submit" type="button" class="btn btn-primary">
|
|
26
|
-
{{#if (eq mode 'edit')}}Update row{{else}}Insert row{{/if}}
|
|
27
|
-
</button>
|
|
28
|
-
<button id="row-generate" type="button" class="btn btn-outline gap-1.5">
|
|
29
|
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4" /></svg>
|
|
30
|
-
Get query
|
|
31
|
-
</button>
|
|
32
|
-
{{else}}
|
|
33
|
-
<span class="text-sm font-medium text-warning">This database is read-only — rows cannot be {{#if (eq mode 'edit')}}updated{{else}}inserted{{/if}}.</span>
|
|
34
|
-
{{/unless}}
|
|
35
|
-
<a href="{{basePath}}/tables/{{table}}" class="btn btn-ghost">Cancel</a>
|
|
36
|
-
</div>
|
|
37
|
-
<p class="mt-3 text-xs text-base-content/40">
|
|
38
|
-
Columns with defaults are pre-filled from the schema. Empty fields are treated as "not set" (DB defaults
|
|
39
|
-
apply). <code class="font-mono">0</code> is a valid value. "Get query" only previews the SQL — it never executes.
|
|
40
|
-
</p>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
|
|
44
|
-
<div id="generated-sql" class="hidden">
|
|
45
|
-
<div class="app-card">
|
|
46
|
-
<div class="flex items-center justify-between border-b border-base-200 px-6 py-4">
|
|
47
|
-
<h2 class="flex items-center gap-2 text-sm font-semibold uppercase tracking-wide text-base-content/45">
|
|
48
|
-
<span class="grid h-6 w-6 place-items-center rounded-md bg-primary/10 text-primary">
|
|
49
|
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4" /></svg>
|
|
50
|
-
</span>
|
|
51
|
-
Generated SQL
|
|
52
|
-
</h2>
|
|
53
|
-
<button id="copy-sql" type="button" class="btn btn-ghost btn-xs gap-1">Copy</button>
|
|
54
|
-
</div>
|
|
55
|
-
<div class="p-4">
|
|
56
|
-
<pre class="code-panel"><code id="generated-sql-code"></code></pre>
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
<script id="form-config" type="application/json">{{{json config}}}</script>
|
|
62
|
-
<script src="{{basePath}}/js/forms.js" defer></script>
|
|
1
|
+
<div class="mx-auto max-w-3xl space-y-5">
|
|
2
|
+
<!-- Header -->
|
|
3
|
+
<div class="flex items-center gap-3">
|
|
4
|
+
<a href="{{basePath}}/tables/{{table}}" class="btn btn-circle btn-ghost btn-sm" aria-label="Back to table">
|
|
5
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M10 19l-7-7m0 0l7-7m-7 7h18" /></svg>
|
|
6
|
+
</a>
|
|
7
|
+
<div>
|
|
8
|
+
<h1 class="text-2xl font-bold tracking-tight">
|
|
9
|
+
{{#if (eq mode 'edit')}}Edit row{{else}}New row{{/if}}
|
|
10
|
+
<span class="text-base-content/40">in</span> <span class="font-mono text-primary">{{table}}</span>
|
|
11
|
+
</h1>
|
|
12
|
+
<p class="text-sm text-base-content/55">{{infoSummary}}</p>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div class="app-card">
|
|
17
|
+
<div class="border-b border-base-200 px-6 py-4">
|
|
18
|
+
<h2 class="text-sm font-semibold uppercase tracking-wide text-base-content/45">Row fields</h2>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="p-6">
|
|
21
|
+
<div id="row-fields" class="grid grid-cols-1 gap-x-6 gap-y-5 md:grid-cols-2"></div>
|
|
22
|
+
<div id="form-error" class="hidden"></div>
|
|
23
|
+
<div class="mt-6 flex flex-wrap items-center gap-2 border-t border-base-200 pt-5">
|
|
24
|
+
{{#unless readonly}}
|
|
25
|
+
<button id="row-submit" type="button" class="btn btn-primary">
|
|
26
|
+
{{#if (eq mode 'edit')}}Update row{{else}}Insert row{{/if}}
|
|
27
|
+
</button>
|
|
28
|
+
<button id="row-generate" type="button" class="btn btn-outline gap-1.5">
|
|
29
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4" /></svg>
|
|
30
|
+
Get query
|
|
31
|
+
</button>
|
|
32
|
+
{{else}}
|
|
33
|
+
<span class="text-sm font-medium text-warning">This database is read-only — rows cannot be {{#if (eq mode 'edit')}}updated{{else}}inserted{{/if}}.</span>
|
|
34
|
+
{{/unless}}
|
|
35
|
+
<a href="{{basePath}}/tables/{{table}}" class="btn btn-ghost">Cancel</a>
|
|
36
|
+
</div>
|
|
37
|
+
<p class="mt-3 text-xs text-base-content/40">
|
|
38
|
+
Columns with defaults are pre-filled from the schema. Empty fields are treated as "not set" (DB defaults
|
|
39
|
+
apply). <code class="font-mono">0</code> is a valid value. "Get query" only previews the SQL — it never executes.
|
|
40
|
+
</p>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<div id="generated-sql" class="hidden">
|
|
45
|
+
<div class="app-card">
|
|
46
|
+
<div class="flex items-center justify-between border-b border-base-200 px-6 py-4">
|
|
47
|
+
<h2 class="flex items-center gap-2 text-sm font-semibold uppercase tracking-wide text-base-content/45">
|
|
48
|
+
<span class="grid h-6 w-6 place-items-center rounded-md bg-primary/10 text-primary">
|
|
49
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4" /></svg>
|
|
50
|
+
</span>
|
|
51
|
+
Generated SQL
|
|
52
|
+
</h2>
|
|
53
|
+
<button id="copy-sql" type="button" class="btn btn-ghost btn-xs gap-1">Copy</button>
|
|
54
|
+
</div>
|
|
55
|
+
<div class="p-4">
|
|
56
|
+
<pre class="code-panel"><code id="generated-sql-code"></code></pre>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
<script id="form-config" type="application/json">{{{json config}}}</script>
|
|
62
|
+
<script src="{{basePath}}/js/forms.js" defer></script>
|