@nodestackapp/server 2.0.0 → 2.1.0
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/README.md +4 -3
- package/dist/NodeStack.d.ts +9 -0
- package/dist/NodeStack.d.ts.map +1 -1
- package/dist/NodeStack.js +24 -3
- package/dist/NodeStack.js.map +1 -1
- package/dist/admin/AdminUIBundler.d.ts.map +1 -1
- package/dist/admin/AdminUIBundler.js +9 -5
- package/dist/admin/AdminUIBundler.js.map +1 -1
- package/dist/admin/ui/css/codemirror.css +98 -0
- package/dist/admin/ui/css/main.css +2309 -2189
- package/dist/admin/ui/index.html +8331 -5295
- package/dist/admin/ui/js/api.js +44 -14
- package/dist/admin/ui/js/app.js +480 -254
- package/dist/admin/ui/js/apps.js +29 -14
- package/dist/admin/ui/js/codemirror.js +15 -0
- package/dist/admin/ui/js/collections.js +38 -9
- package/dist/admin/ui/js/command-palette.js +12 -1
- package/dist/admin/ui/js/functions-tester.js +432 -0
- package/dist/admin/ui/js/functions-workbench.js +1038 -0
- package/dist/admin/ui/js/functions.js +765 -0
- package/dist/admin/ui/js/modals.js +6 -2
- package/dist/admin/ui/js/plugin-tester.js +562 -559
- package/dist/admin/ui/js/plugins.js +198 -77
- package/dist/admin/ui/js/records.js +89 -54
- package/dist/admin/ui/js/schema.js +23 -9
- package/dist/admin/ui/js/views.js +82 -34
- package/dist/admin/ui/js/webhooks.js +1111 -1104
- package/dist/apps/AppScope.d.ts +4 -0
- package/dist/apps/AppScope.d.ts.map +1 -1
- package/dist/apps/AppScope.js +33 -1
- package/dist/apps/AppScope.js.map +1 -1
- package/dist/auth/ApiKeyService.d.ts +91 -0
- package/dist/auth/ApiKeyService.d.ts.map +1 -0
- package/dist/auth/ApiKeyService.js +414 -0
- package/dist/auth/ApiKeyService.js.map +1 -0
- package/dist/auth/AuthService.d.ts +33 -1
- package/dist/auth/AuthService.d.ts.map +1 -1
- package/dist/auth/AuthService.js +219 -1
- package/dist/auth/AuthService.js.map +1 -1
- package/dist/auth/oauth/AppleProvider.d.ts +23 -0
- package/dist/auth/oauth/AppleProvider.d.ts.map +1 -0
- package/dist/auth/oauth/AppleProvider.js +161 -0
- package/dist/auth/oauth/AppleProvider.js.map +1 -0
- package/dist/auth/oauth/BaseOAuthProvider.d.ts +18 -0
- package/dist/auth/oauth/BaseOAuthProvider.d.ts.map +1 -0
- package/dist/auth/oauth/BaseOAuthProvider.js +79 -0
- package/dist/auth/oauth/BaseOAuthProvider.js.map +1 -0
- package/dist/auth/oauth/DiscordProvider.d.ts +11 -0
- package/dist/auth/oauth/DiscordProvider.d.ts.map +1 -0
- package/dist/auth/oauth/DiscordProvider.js +47 -0
- package/dist/auth/oauth/DiscordProvider.js.map +1 -0
- package/dist/auth/oauth/GitHubProvider.d.ts +13 -0
- package/dist/auth/oauth/GitHubProvider.d.ts.map +1 -0
- package/dist/auth/oauth/GitHubProvider.js +90 -0
- package/dist/auth/oauth/GitHubProvider.js.map +1 -0
- package/dist/auth/oauth/GoogleProvider.d.ts +11 -0
- package/dist/auth/oauth/GoogleProvider.d.ts.map +1 -0
- package/dist/auth/oauth/GoogleProvider.js +43 -0
- package/dist/auth/oauth/GoogleProvider.js.map +1 -0
- package/dist/auth/oauth/MicrosoftProvider.d.ts +11 -0
- package/dist/auth/oauth/MicrosoftProvider.d.ts.map +1 -0
- package/dist/auth/oauth/MicrosoftProvider.js +83 -0
- package/dist/auth/oauth/MicrosoftProvider.js.map +1 -0
- package/dist/auth/oauth/OAuthProviderRegistry.d.ts +32 -0
- package/dist/auth/oauth/OAuthProviderRegistry.d.ts.map +1 -0
- package/dist/auth/oauth/OAuthProviderRegistry.js +232 -0
- package/dist/auth/oauth/OAuthProviderRegistry.js.map +1 -0
- package/dist/auth/oauth/types.d.ts +63 -0
- package/dist/auth/oauth/types.d.ts.map +1 -0
- package/dist/auth/oauth/types.js +3 -0
- package/dist/auth/oauth/types.js.map +1 -0
- package/dist/cli/cli.js +10 -10
- package/dist/cli/cli.js.map +1 -1
- package/dist/core/container/Tokens.d.ts +2 -0
- package/dist/core/container/Tokens.d.ts.map +1 -1
- package/dist/core/container/Tokens.js +2 -0
- package/dist/core/container/Tokens.js.map +1 -1
- package/dist/core/plugins/PluginManager.d.ts.map +1 -1
- package/dist/core/plugins/PluginManager.js +73 -19
- package/dist/core/plugins/PluginManager.js.map +1 -1
- package/dist/database/migrations/SystemMigrations.d.ts.map +1 -1
- package/dist/database/migrations/SystemMigrations.js +40 -0
- package/dist/database/migrations/SystemMigrations.js.map +1 -1
- package/dist/functions/FunctionService.d.ts +80 -0
- package/dist/functions/FunctionService.d.ts.map +1 -0
- package/dist/functions/FunctionService.js +610 -0
- package/dist/functions/FunctionService.js.map +1 -0
- package/dist/functions/runtime/IFunctionRuntime.d.ts +23 -0
- package/dist/functions/runtime/IFunctionRuntime.d.ts.map +1 -0
- package/dist/functions/runtime/IFunctionRuntime.js +3 -0
- package/dist/functions/runtime/IFunctionRuntime.js.map +1 -0
- package/dist/functions/runtime/QuickJsWasmRuntime.d.ts +21 -0
- package/dist/functions/runtime/QuickJsWasmRuntime.d.ts.map +1 -0
- package/dist/functions/runtime/QuickJsWasmRuntime.js +418 -0
- package/dist/functions/runtime/QuickJsWasmRuntime.js.map +1 -0
- package/dist/functions/runtime/SandboxedRunner.d.ts +31 -0
- package/dist/functions/runtime/SandboxedRunner.d.ts.map +1 -0
- package/dist/functions/runtime/SandboxedRunner.js +61 -0
- package/dist/functions/runtime/SandboxedRunner.js.map +1 -0
- package/dist/functions/security/SsrfGuard.d.ts +41 -0
- package/dist/functions/security/SsrfGuard.d.ts.map +1 -0
- package/dist/functions/security/SsrfGuard.js +470 -0
- package/dist/functions/security/SsrfGuard.js.map +1 -0
- package/dist/functions/types.d.ts +109 -0
- package/dist/functions/types.d.ts.map +1 -0
- package/dist/functions/types.js +3 -0
- package/dist/functions/types.js.map +1 -0
- package/dist/http/HttpServer.d.ts +7 -1
- package/dist/http/HttpServer.d.ts.map +1 -1
- package/dist/http/HttpServer.js +66 -1
- package/dist/http/HttpServer.js.map +1 -1
- package/dist/http/controllers/ApiKeyController.d.ts +31 -0
- package/dist/http/controllers/ApiKeyController.d.ts.map +1 -0
- package/dist/http/controllers/ApiKeyController.js +52 -0
- package/dist/http/controllers/ApiKeyController.js.map +1 -0
- package/dist/http/controllers/AuthController.d.ts +29 -1
- package/dist/http/controllers/AuthController.d.ts.map +1 -1
- package/dist/http/controllers/AuthController.js +42 -1
- package/dist/http/controllers/AuthController.js.map +1 -1
- package/dist/http/controllers/FunctionController.d.ts +64 -0
- package/dist/http/controllers/FunctionController.d.ts.map +1 -0
- package/dist/http/controllers/FunctionController.js +202 -0
- package/dist/http/controllers/FunctionController.js.map +1 -0
- package/dist/http/controllers/RecordController.d.ts.map +1 -1
- package/dist/http/controllers/RecordController.js +4 -0
- package/dist/http/controllers/RecordController.js.map +1 -1
- package/dist/http/middleware/AuthMiddleware.d.ts +6 -1
- package/dist/http/middleware/AuthMiddleware.d.ts.map +1 -1
- package/dist/http/middleware/AuthMiddleware.js +79 -8
- package/dist/http/middleware/AuthMiddleware.js.map +1 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -3
- package/dist/index.js.map +1 -1
- package/dist/plugins/chat-notifications.d.ts +51 -0
- package/dist/plugins/chat-notifications.d.ts.map +1 -0
- package/dist/plugins/chat-notifications.js +545 -0
- package/dist/plugins/chat-notifications.js.map +1 -0
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/webhooks.d.ts +5 -34
- package/dist/plugins/webhooks.d.ts.map +1 -1
- package/dist/plugins/webhooks.js +11 -412
- package/dist/plugins/webhooks.js.map +1 -1
- package/dist/records/MockDataService.d.ts.map +1 -1
- package/dist/records/MockDataService.js +3 -0
- package/dist/records/MockDataService.js.map +1 -1
- package/dist/records/RecordService.d.ts.map +1 -1
- package/dist/records/RecordService.js +39 -30
- package/dist/records/RecordService.js.map +1 -1
- package/dist/records/RecordValidator.d.ts +6 -0
- package/dist/records/RecordValidator.d.ts.map +1 -0
- package/dist/records/RecordValidator.js +100 -0
- package/dist/records/RecordValidator.js.map +1 -0
- package/package.json +89 -88
|
@@ -320,37 +320,183 @@ async function loadPluginConfig(pluginId) {
|
|
|
320
320
|
</div>
|
|
321
321
|
|
|
322
322
|
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem;">
|
|
323
|
-
${
|
|
324
|
-
const
|
|
325
|
-
const
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
323
|
+
${(() => {
|
|
324
|
+
const consumed = new Set();
|
|
325
|
+
const cards = [];
|
|
326
|
+
|
|
327
|
+
for (const field of res.fields) {
|
|
328
|
+
if (consumed.has(field.name)) continue;
|
|
329
|
+
|
|
330
|
+
// Check if field is a Webhook URL that pairs with a boolean toggle
|
|
331
|
+
let urlField = null;
|
|
332
|
+
let toggleField = null;
|
|
333
|
+
let platformTitle = '';
|
|
334
|
+
let platformIcon = '';
|
|
335
|
+
|
|
336
|
+
if (field.name.endsWith('WebhookUrl') || field.name.endsWith('Url')) {
|
|
337
|
+
const prefix = field.name.replace(/WebhookUrl$|Url$/, '');
|
|
338
|
+
const tName1 = 'enable' + prefix.charAt(0).toUpperCase() + prefix.slice(1);
|
|
339
|
+
const tName2 = prefix + 'Enabled';
|
|
340
|
+
const match = res.fields.find(f => (f.name === tName1 || f.name === tName2) && f.type === 'boolean');
|
|
341
|
+
if (match) {
|
|
342
|
+
urlField = field;
|
|
343
|
+
toggleField = match;
|
|
344
|
+
}
|
|
345
|
+
} else if (field.type === 'boolean' && (field.name.startsWith('enable') || field.name.endsWith('Enabled'))) {
|
|
346
|
+
let prefix = '';
|
|
347
|
+
if (field.name.startsWith('enable')) {
|
|
348
|
+
prefix = field.name.slice(6);
|
|
349
|
+
prefix = prefix.charAt(0).toLowerCase() + prefix.slice(1);
|
|
350
|
+
} else {
|
|
351
|
+
prefix = field.name.replace(/Enabled$/, '');
|
|
352
|
+
}
|
|
353
|
+
const match = res.fields.find(f => (f.name === prefix + 'WebhookUrl' || f.name === prefix + 'Url') && f.type === 'text');
|
|
354
|
+
if (match) {
|
|
355
|
+
urlField = match;
|
|
356
|
+
toggleField = field;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
if (urlField && toggleField) {
|
|
361
|
+
consumed.add(urlField.name);
|
|
362
|
+
consumed.add(toggleField.name);
|
|
363
|
+
|
|
364
|
+
const lowerName = urlField.name.toLowerCase();
|
|
365
|
+
if (lowerName.includes('discord')) {
|
|
366
|
+
platformTitle = 'Discord Channel';
|
|
367
|
+
platformIcon = '<svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>';
|
|
368
|
+
} else if (lowerName.includes('slack')) {
|
|
369
|
+
platformTitle = 'Slack Channel';
|
|
370
|
+
platformIcon = '<svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/></svg>';
|
|
371
|
+
} else {
|
|
372
|
+
platformTitle = urlField.label || 'Channel Webhook';
|
|
373
|
+
platformIcon = '🔔';
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
const urlId = `cfg-${pluginId}-${urlField.name}`;
|
|
377
|
+
const toggleId = `cfg-${pluginId}-${toggleField.name}`;
|
|
378
|
+
const isUrlLocked = urlField.isLocked;
|
|
379
|
+
const isToggleLocked = toggleField.isLocked;
|
|
380
|
+
const isToggleChecked = toggleField.value !== false;
|
|
381
|
+
|
|
382
|
+
const badgeHtml = isUrlLocked ? `
|
|
383
|
+
<span class="badge badge-secondary" style="font-size: 10px; padding: 2px 6px;" title="${escapeHtml(urlField.lockReason || 'Locked')}">
|
|
384
|
+
🔒 ENV LOCKED
|
|
385
|
+
</span>
|
|
386
|
+
` : (urlField.source === 'db' || toggleField.source === 'db' ? `
|
|
387
|
+
<span class="badge badge-success" style="font-size: 10px; padding: 2px 6px;">
|
|
388
|
+
✏️ DATABASE OVERRIDE
|
|
389
|
+
</span>
|
|
390
|
+
` : `
|
|
391
|
+
<span class="badge badge-primary" style="font-size: 10px; padding: 2px 6px;">
|
|
392
|
+
✏️ ${urlField.source === 'code' ? 'CODE DEFAULT' : 'DEFAULT'}
|
|
393
|
+
</span>
|
|
394
|
+
`);
|
|
395
|
+
|
|
396
|
+
cards.push(`
|
|
397
|
+
<div style="background: var(--bg-input); border: 1px solid ${isUrlLocked ? 'rgba(255,255,255,0.06)' : 'var(--border-subtle)'}; border-radius: 8px; padding: 0.95rem 1.1rem; display: flex; flex-direction: column; gap: 0.65rem;">
|
|
398
|
+
<div style="display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap;">
|
|
399
|
+
<div style="display: flex; align-items: center; gap: 8px;">
|
|
400
|
+
<span style="display: inline-flex; align-items: center; color: var(--accent-primary);">${platformIcon}</span>
|
|
401
|
+
<label style="font-size: 13px; font-weight: 700; color: var(--text-heading); cursor: pointer; margin: 0;" for="${toggleId}">
|
|
402
|
+
${escapeHtml(platformTitle)}
|
|
403
|
+
</label>
|
|
404
|
+
</div>
|
|
405
|
+
<div style="display: flex; align-items: center; gap: 10px;">
|
|
406
|
+
<label style="display: inline-flex; align-items: center; gap: 6px; cursor: ${isToggleLocked ? 'not-allowed' : 'pointer'}; margin: 0; user-select: none;">
|
|
407
|
+
<input type="checkbox" id="${toggleId}" ${isToggleChecked ? 'checked' : ''} ${isToggleLocked ? 'disabled' : ''}
|
|
408
|
+
onchange="const inp = document.getElementById('${urlId}'); if (inp) inp.style.opacity = this.checked ? '1' : '0.55';"
|
|
409
|
+
style="cursor: pointer; width: 16px; height: 16px; accent-color: var(--accent-primary);" />
|
|
410
|
+
<span style="font-size: 12px; font-weight: 600; color: var(--text-main);">Enabled</span>
|
|
411
|
+
</label>
|
|
412
|
+
${badgeHtml}
|
|
413
|
+
</div>
|
|
414
|
+
</div>
|
|
415
|
+
|
|
416
|
+
<div style="display: flex; flex-direction: column; gap: 0.35rem;">
|
|
417
|
+
<label style="font-size: 11.5px; font-weight: 600; color: var(--text-muted); display: block;" for="${urlId}">
|
|
418
|
+
${escapeHtml(urlField.label)} ${urlField.required ? '<span style="color:#ef4444;">*</span>' : ''}
|
|
419
|
+
</label>
|
|
420
|
+
${isUrlLocked ? `
|
|
421
|
+
<input type="text" class="form-input" disabled value="${escapeHtml(urlField.value !== undefined ? String(urlField.value) : '')}"
|
|
422
|
+
style="opacity: 0.7; cursor: not-allowed; background: rgba(0,0,0,0.35); font-family: monospace; font-size: 12.5px; border-color: rgba(255,255,255,0.06);" />
|
|
423
|
+
<div style="font-size: 11px; color: #94a3b8; display: flex; align-items: center; gap: 4px;">
|
|
424
|
+
<span>🔒</span> <span>${escapeHtml(urlField.lockReason || 'Managed by environment')}</span>
|
|
425
|
+
</div>
|
|
426
|
+
` : `
|
|
427
|
+
<input type="text" class="form-input" id="${urlId}"
|
|
428
|
+
value="${escapeHtml(urlField.value !== undefined ? String(urlField.value) : '')}" placeholder="${escapeHtml(urlField.placeholder || '')}"
|
|
429
|
+
style="font-family: monospace; font-size: 12.5px; opacity: ${isToggleChecked ? '1' : '0.55'}; transition: opacity 0.15s ease;" />
|
|
430
|
+
`}
|
|
431
|
+
<div style="font-size: 11px; color: var(--text-muted); line-height: 1.35;">
|
|
432
|
+
${escapeHtml(urlField.description || '')}
|
|
433
|
+
${urlField.envKey ? `<span style="display:inline-block; margin-left: 4px; font-family: monospace; opacity: 0.8;">(${escapeHtml(urlField.envKey)})</span>` : ''}
|
|
434
|
+
</div>
|
|
435
|
+
</div>
|
|
436
|
+
</div>
|
|
437
|
+
`);
|
|
438
|
+
continue;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
// Standard standalone field card
|
|
442
|
+
consumed.add(field.name);
|
|
443
|
+
const isLocked = field.isLocked;
|
|
444
|
+
const fieldId = `cfg-${pluginId}-${field.name}`;
|
|
445
|
+
cards.push(`
|
|
446
|
+
<div style="background: var(--bg-input); border: 1px solid ${isLocked ? 'rgba(255,255,255,0.06)' : 'var(--border-subtle)'}; border-radius: 8px; padding: 0.85rem 1rem; display: flex; flex-direction: column; gap: 0.45rem;">
|
|
447
|
+
<div style="display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;">
|
|
448
|
+
<label style="font-size: 12.5px; font-weight: 700; color: var(--text-heading);" for="${fieldId}">
|
|
449
|
+
${escapeHtml(field.label)} ${field.required ? '<span style="color:#ef4444;">*</span>' : ''}
|
|
450
|
+
</label>
|
|
451
|
+
${isLocked ? `
|
|
452
|
+
<span class="badge badge-secondary" style="font-size: 10px; padding: 2px 6px;" title="${escapeHtml(field.lockReason || 'Locked')}">
|
|
453
|
+
🔒 ENV LOCKED
|
|
454
|
+
</span>
|
|
455
|
+
` : (field.source === 'db' ? `
|
|
456
|
+
<span class="badge badge-success" style="font-size: 10px; padding: 2px 6px;">
|
|
457
|
+
✏️ DATABASE OVERRIDE
|
|
458
|
+
</span>
|
|
459
|
+
` : `
|
|
460
|
+
<span class="badge badge-primary" style="font-size: 10px; padding: 2px 6px;">
|
|
461
|
+
✏️ ${field.source === 'code' ? 'CODE DEFAULT' : 'DEFAULT'}
|
|
462
|
+
</span>
|
|
463
|
+
`)}
|
|
464
|
+
</div>
|
|
346
465
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
466
|
+
${isLocked ? `
|
|
467
|
+
${field.type === 'select' ? `
|
|
468
|
+
<select class="form-input" disabled
|
|
469
|
+
style="opacity: 0.7; cursor: not-allowed; background: rgba(0,0,0,0.35); font-size: 12.5px; border-color: rgba(255,255,255,0.06); color: var(--text-heading);">
|
|
470
|
+
${field.value !== undefined && !(field.options || []).some(opt => String(typeof opt === 'object' && opt !== null && 'value' in opt ? opt.value : opt) === String(field.value)) ? `
|
|
471
|
+
<option value="${escapeHtml(String(field.value))}" selected>${escapeHtml(String(field.value))}</option>
|
|
472
|
+
` : ''}
|
|
473
|
+
${(field.options || []).map(opt => {
|
|
474
|
+
const optVal = typeof opt === 'object' && opt !== null && 'value' in opt ? opt.value : opt;
|
|
475
|
+
const optLabel = typeof opt === 'object' && opt !== null && 'label' in opt ? opt.label : opt;
|
|
476
|
+
const isSelected = String(field.value) === String(optVal);
|
|
477
|
+
return `<option value="${escapeHtml(String(optVal))}" ${isSelected ? 'selected' : ''}>${escapeHtml(String(optLabel))}</option>`;
|
|
478
|
+
}).join('')}
|
|
479
|
+
</select>
|
|
480
|
+
` : `
|
|
481
|
+
<input type="text" class="form-input" disabled value="${escapeHtml(field.type === 'password' ? '••••••••' : (field.value !== undefined ? String(field.value) : ''))}"
|
|
482
|
+
style="opacity: 0.7; cursor: not-allowed; background: rgba(0,0,0,0.35); font-family: monospace; font-size: 12.5px; border-color: rgba(255,255,255,0.06);" />
|
|
483
|
+
`}
|
|
484
|
+
<div style="font-size: 11px; color: #94a3b8; display: flex; align-items: center; gap: 4px;">
|
|
485
|
+
<span>🔒</span> <span>${escapeHtml(field.lockReason || 'Managed by environment')}</span>
|
|
486
|
+
</div>
|
|
487
|
+
` : (field.type === 'boolean' ? `
|
|
488
|
+
<div style="display: flex; align-items: center; gap: 0.5rem; height: 36px;">
|
|
489
|
+
<input type="checkbox" id="${fieldId}" ${field.value ? 'checked' : ''} style="cursor: pointer; width: 18px; height: 18px;" />
|
|
490
|
+
<label for="${fieldId}" style="font-size: 12.5px; color: var(--text-main); cursor: pointer;">Enabled</label>
|
|
491
|
+
</div>
|
|
492
|
+
` : (field.type === 'select' ? `
|
|
493
|
+
<select class="form-input" id="${fieldId}"
|
|
494
|
+
style="cursor: pointer; font-size: 12.5px; background: var(--bg-card); color: var(--text-heading);">
|
|
495
|
+
${!field.required && !(field.options || []).some(opt => (typeof opt === 'object' && opt !== null && 'value' in opt ? opt.value : opt) === '') ? `
|
|
496
|
+
<option value="" ${field.value === undefined || field.value === '' ? 'selected' : ''}>${escapeHtml(field.placeholder || '-- Select an option --')}</option>
|
|
497
|
+
` : (field.placeholder && (field.value === undefined || field.value === '') ? `
|
|
498
|
+
<option value="" disabled selected>${escapeHtml(field.placeholder)}</option>
|
|
499
|
+
` : '')}
|
|
354
500
|
${(field.options || []).map(opt => {
|
|
355
501
|
const optVal = typeof opt === 'object' && opt !== null && 'value' in opt ? opt.value : opt;
|
|
356
502
|
const optLabel = typeof opt === 'object' && opt !== null && 'label' in opt ? opt.label : opt;
|
|
@@ -358,56 +504,31 @@ async function loadPluginConfig(pluginId) {
|
|
|
358
504
|
return `<option value="${escapeHtml(String(optVal))}" ${isSelected ? 'selected' : ''}>${escapeHtml(String(optLabel))}</option>`;
|
|
359
505
|
}).join('')}
|
|
360
506
|
</select>
|
|
507
|
+
` : (field.type === 'password' ? `
|
|
508
|
+
<input type="password" class="form-input" id="${fieldId}"
|
|
509
|
+
value="" placeholder="${field.hasValue ? '•••••••• (Secret configured - leave blank to keep unchanged)' : escapeHtml(field.placeholder || 'Enter secret...')}"
|
|
510
|
+
autocomplete="new-password"
|
|
511
|
+
style="font-family: monospace; font-size: 12.5px;" />
|
|
512
|
+
${field.hasValue ? `
|
|
513
|
+
<div style="font-size: 10.5px; color: var(--accent-success); display: flex; align-items: center; gap: 4px; margin-top: 2px;">
|
|
514
|
+
<span>✓</span> <span>Secret is configured. Leave blank to keep existing secret.</span>
|
|
515
|
+
</div>
|
|
516
|
+
` : ''}
|
|
361
517
|
` : `
|
|
362
|
-
<input type="text" class="form-input"
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
<input type="checkbox" id="${fieldId}" ${field.value ? 'checked' : ''} style="cursor: pointer; width: 18px; height: 18px;" />
|
|
371
|
-
<label for="${fieldId}" style="font-size: 12.5px; color: var(--text-main); cursor: pointer;">Enabled</label>
|
|
518
|
+
<input type="text" class="form-input" id="${fieldId}"
|
|
519
|
+
value="${escapeHtml(field.value !== undefined ? String(field.value) : '')}" placeholder="${escapeHtml(field.placeholder || '')}"
|
|
520
|
+
style="font-family: monospace; font-size: 12.5px;" />
|
|
521
|
+
`)))}
|
|
522
|
+
|
|
523
|
+
<div style="font-size: 11px; color: var(--text-muted); line-height: 1.35;">
|
|
524
|
+
${escapeHtml(field.description || '')}
|
|
525
|
+
${field.envKey ? `<span style="display:inline-block; margin-left: 4px; font-family: monospace; opacity: 0.8;">(${escapeHtml(field.envKey)})</span>` : ''}
|
|
372
526
|
</div>
|
|
373
|
-
` : (field.type === 'select' ? `
|
|
374
|
-
<select class="form-input" id="${fieldId}"
|
|
375
|
-
style="cursor: pointer; font-size: 12.5px; background: var(--bg-card); color: var(--text-heading);">
|
|
376
|
-
${!field.required && !(field.options || []).some(opt => (typeof opt === 'object' && opt !== null && 'value' in opt ? opt.value : opt) === '') ? `
|
|
377
|
-
<option value="" ${field.value === undefined || field.value === '' ? 'selected' : ''}>${escapeHtml(field.placeholder || '-- Select an option --')}</option>
|
|
378
|
-
` : (field.placeholder && (field.value === undefined || field.value === '') ? `
|
|
379
|
-
<option value="" disabled selected>${escapeHtml(field.placeholder)}</option>
|
|
380
|
-
` : '')}
|
|
381
|
-
${(field.options || []).map(opt => {
|
|
382
|
-
const optVal = typeof opt === 'object' && opt !== null && 'value' in opt ? opt.value : opt;
|
|
383
|
-
const optLabel = typeof opt === 'object' && opt !== null && 'label' in opt ? opt.label : opt;
|
|
384
|
-
const isSelected = String(field.value) === String(optVal);
|
|
385
|
-
return `<option value="${escapeHtml(String(optVal))}" ${isSelected ? 'selected' : ''}>${escapeHtml(String(optLabel))}</option>`;
|
|
386
|
-
}).join('')}
|
|
387
|
-
</select>
|
|
388
|
-
` : (field.type === 'password' ? `
|
|
389
|
-
<input type="password" class="form-input" id="${fieldId}"
|
|
390
|
-
value="" placeholder="${field.hasValue ? '•••••••• (Secret configured - leave blank to keep unchanged)' : escapeHtml(field.placeholder || 'Enter secret...')}"
|
|
391
|
-
autocomplete="new-password"
|
|
392
|
-
style="font-family: monospace; font-size: 12.5px;" />
|
|
393
|
-
${field.hasValue ? `
|
|
394
|
-
<div style="font-size: 10.5px; color: var(--accent-success); display: flex; align-items: center; gap: 4px; margin-top: 2px;">
|
|
395
|
-
<span>✓</span> <span>Secret is configured. Leave blank to keep existing secret.</span>
|
|
396
|
-
</div>
|
|
397
|
-
` : ''}
|
|
398
|
-
` : `
|
|
399
|
-
<input type="text" class="form-input" id="${fieldId}"
|
|
400
|
-
value="${escapeHtml(field.value !== undefined ? String(field.value) : '')}" placeholder="${escapeHtml(field.placeholder || '')}"
|
|
401
|
-
style="font-family: monospace; font-size: 12.5px;" />
|
|
402
|
-
`)))}
|
|
403
|
-
|
|
404
|
-
<div style="font-size: 11px; color: var(--text-muted); line-height: 1.35;">
|
|
405
|
-
${escapeHtml(field.description || '')}
|
|
406
|
-
${field.envKey ? `<span style="display:inline-block; margin-left: 4px; font-family: monospace; opacity: 0.8;">(${escapeHtml(field.envKey)})</span>` : ''}
|
|
407
527
|
</div>
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
528
|
+
`);
|
|
529
|
+
}
|
|
530
|
+
return cards.join('');
|
|
531
|
+
})()}
|
|
411
532
|
</div>
|
|
412
533
|
|
|
413
534
|
<div style="display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.5rem; padding-top: 0.75rem; border-top: 1px solid var(--border-subtle);">
|
|
@@ -162,40 +162,8 @@
|
|
|
162
162
|
function renderRecordsView() {
|
|
163
163
|
const topActions = document.getElementById('view-actions');
|
|
164
164
|
if (topActions) topActions.innerHTML = '';
|
|
165
|
-
const actions = document.getElementById('collection-actions')
|
|
166
|
-
actions.innerHTML =
|
|
167
|
-
<div style="display:flex; align-items:center; gap:0.5rem;">
|
|
168
|
-
<div class="dropdown-wrapper">
|
|
169
|
-
<button class="btn btn-secondary btn-sm" onclick="toggleExportMenu(event)" title="Export collection records">
|
|
170
|
-
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>
|
|
171
|
-
<span>Export</span>
|
|
172
|
-
<span style="font-size:10px; margin-left:1px; opacity:0.7;">▾</span>
|
|
173
|
-
</button>
|
|
174
|
-
<div id="export-dropdown-menu" style="display:none; position:absolute; right:0; top:calc(100% + 4px); background:var(--bg-card); border:1px solid var(--border-subtle); border-radius:6px; box-shadow:var(--shadow-dropdown); min-width:150px; z-index:100; padding:4px 0;">
|
|
175
|
-
<button class="dropdown-menu-item" onclick="exportData('csv')">
|
|
176
|
-
<span style="color:#60a5fa; font-weight:bold;">CSV</span> Export as CSV
|
|
177
|
-
</button>
|
|
178
|
-
<button class="dropdown-menu-item" onclick="exportData('json')">
|
|
179
|
-
<span style="color:#34d399; font-weight:bold;">{ }</span> Export as JSON
|
|
180
|
-
</button>
|
|
181
|
-
</div>
|
|
182
|
-
</div>
|
|
183
|
-
|
|
184
|
-
<button class="btn btn-secondary btn-sm" onclick="openImportModal()" title="Drag & drop CSV import with visual column mapping">
|
|
185
|
-
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>
|
|
186
|
-
<span>Import CSV</span>
|
|
187
|
-
</button>
|
|
188
|
-
|
|
189
|
-
<button class="btn btn-secondary btn-sm" onclick="openMockDataModal()" title="1-Click Generate Mock Data (Built-in Faker Engine)" style="border-color: rgba(96, 165, 250, 0.4); color: var(--accent-primary);">
|
|
190
|
-
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
|
|
191
|
-
<span>Generate Mock Data</span>
|
|
192
|
-
</button>
|
|
193
|
-
|
|
194
|
-
<button class="btn btn-primary btn-sm" onclick="openNewRecordModal()">
|
|
195
|
-
<span>+ New Record</span>
|
|
196
|
-
</button>
|
|
197
|
-
</div>
|
|
198
|
-
`;
|
|
165
|
+
const actions = document.getElementById('collection-actions');
|
|
166
|
+
if (actions) actions.innerHTML = '';
|
|
199
167
|
|
|
200
168
|
if (typeof showPageView === 'function') {
|
|
201
169
|
showPageView('collections');
|
|
@@ -205,6 +173,52 @@
|
|
|
205
173
|
|
|
206
174
|
const main = document.getElementById('collections-detail-pane') || document.getElementById('main-body');
|
|
207
175
|
main.innerHTML = `
|
|
176
|
+
<div class="collection-view-header" style="display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border-subtle);">
|
|
177
|
+
<div>
|
|
178
|
+
<h2 style="font-size: 16px; font-weight: 800; color: var(--text-heading); margin: 0; display: flex; align-items: center; gap: 8px;">
|
|
179
|
+
<span>${escapeHtml(col.name)}</span>
|
|
180
|
+
<span class="badge ${col.type === 'auth' ? 'badge-post' : 'badge-get'}" style="font-size: 10px; font-weight: 700;">${col.type.toUpperCase()}</span>
|
|
181
|
+
${col.system ? `<span class="badge" style="font-size: 10px; background: rgba(148, 163, 184, 0.2); color: var(--text-muted);">SYSTEM</span>` : ''}
|
|
182
|
+
</h2>
|
|
183
|
+
<p style="font-size: 12px; color: var(--text-muted); margin: 3px 0 0 0;">
|
|
184
|
+
Browse, filter, and manage records for the <code>${escapeHtml(col.name)}</code> table.
|
|
185
|
+
</p>
|
|
186
|
+
</div>
|
|
187
|
+
<div class="collection-view-actions" style="display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;">
|
|
188
|
+
<div class="dropdown-wrapper">
|
|
189
|
+
<button class="btn btn-secondary btn-sm" onclick="toggleExportMenu(event)" title="Export collection records">
|
|
190
|
+
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>
|
|
191
|
+
<span>Export</span>
|
|
192
|
+
<span style="font-size: 10px; margin-left: 1px; opacity: 0.7;">▾</span>
|
|
193
|
+
</button>
|
|
194
|
+
<div id="export-dropdown-menu" style="display: none; position: absolute; left: 0; top: calc(100% + 4px); background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 6px; box-shadow: var(--shadow-dropdown); min-width: 160px; z-index: 100; padding: 4px 0;">
|
|
195
|
+
<button class="dropdown-menu-item" onclick="exportData('csv')">
|
|
196
|
+
<span style="color: #60a5fa; font-weight: bold;">CSV</span> Export as CSV
|
|
197
|
+
</button>
|
|
198
|
+
<button class="dropdown-menu-item" onclick="exportData('json')">
|
|
199
|
+
<span style="color: #34d399; font-weight: bold;">{ }</span> Export as JSON
|
|
200
|
+
</button>
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
203
|
+
|
|
204
|
+
<button class="btn btn-secondary btn-sm" onclick="openImportModal()" title="Drag & drop CSV import with visual column mapping">
|
|
205
|
+
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>
|
|
206
|
+
<span>Import CSV</span>
|
|
207
|
+
</button>
|
|
208
|
+
|
|
209
|
+
${!col.system ? `
|
|
210
|
+
<button class="btn btn-secondary btn-sm" onclick="openMockDataModal()" title="1-Click Generate Mock Data (Built-in Faker Engine)" style="color: var(--accent-primary);">
|
|
211
|
+
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
|
|
212
|
+
<span>Generate Mock Data</span>
|
|
213
|
+
</button>
|
|
214
|
+
` : ''}
|
|
215
|
+
|
|
216
|
+
<button class="btn btn-primary btn-sm" onclick="openNewRecordModal()">
|
|
217
|
+
<span>+ New Record</span>
|
|
218
|
+
</button>
|
|
219
|
+
</div>
|
|
220
|
+
</div>
|
|
221
|
+
|
|
208
222
|
<div class="controls-bar">
|
|
209
223
|
<div style="display:flex; align-items:center; gap:0.75rem; flex:1; max-width:640px;">
|
|
210
224
|
<div class="search-bar-composite" id="search-composite-box">
|
|
@@ -371,15 +385,36 @@
|
|
|
371
385
|
</td>
|
|
372
386
|
</tr>
|
|
373
387
|
`;
|
|
388
|
+
} else if (col.system) {
|
|
389
|
+
tbContainer.innerHTML = `
|
|
390
|
+
<tr>
|
|
391
|
+
<td colspan="${displayFields.length + 3}" style="text-align:center;padding:3.5rem 1rem;">
|
|
392
|
+
<div style="display:flex; flex-direction:column; align-items:center; gap:0.75rem;">
|
|
393
|
+
<div style="width:44px; height:44px; border-radius:50%; background:var(--bg-input); color:var(--text-muted); display:flex; align-items:center; justify-content:center;">
|
|
394
|
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><line x1="3" y1="9" x2="21" y2="9"></line><line x1="9" y1="21" x2="9" y2="9"></line></svg>
|
|
395
|
+
</div>
|
|
396
|
+
<div style="font-weight:600; font-size:15px; color:var(--text-main);">No records in '${escapeHtml(col.name)}' yet</div>
|
|
397
|
+
<div style="font-size:13px; color:var(--text-muted); max-width:400px; line-height:1.4;">
|
|
398
|
+
System activity and audit events will appear here automatically as operations execute.
|
|
399
|
+
</div>
|
|
400
|
+
<div style="display:flex; gap:0.5rem; margin-top:0.5rem;">
|
|
401
|
+
<button class="btn btn-primary btn-sm" onclick="openNewRecordModal()">
|
|
402
|
+
<span>+ New Record</span>
|
|
403
|
+
</button>
|
|
404
|
+
</div>
|
|
405
|
+
</div>
|
|
406
|
+
</td>
|
|
407
|
+
</tr>
|
|
408
|
+
`;
|
|
374
409
|
} else {
|
|
375
410
|
tbContainer.innerHTML = `
|
|
376
411
|
<tr>
|
|
377
412
|
<td colspan="${displayFields.length + 3}" style="text-align:center;padding:3.5rem 1rem;">
|
|
378
413
|
<div style="display:flex; flex-direction:column; align-items:center; gap:0.75rem;">
|
|
379
414
|
<div style="width:44px; height:44px; border-radius:50%; background:rgba(59,130,246,0.12); color:#60a5fa; display:flex; align-items:center; justify-content:center; font-size:20px;">
|
|
380
|
-
|
|
415
|
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
|
|
381
416
|
</div>
|
|
382
|
-
<div style="font-weight:600; font-size:15px; color:var(--text-main);">No records in '${col.name}' yet</div>
|
|
417
|
+
<div style="font-weight:600; font-size:15px; color:var(--text-main);">No records in '${escapeHtml(col.name)}' yet</div>
|
|
383
418
|
<div style="font-size:13px; color:var(--text-muted); max-width:380px; line-height:1.4;">
|
|
384
419
|
Populate your collection in seconds with realistic human names, emails, prices, avatars, and linked relations.
|
|
385
420
|
</div>
|
|
@@ -890,11 +925,11 @@
|
|
|
890
925
|
if (e) e.stopPropagation();
|
|
891
926
|
if (!btnEl) return;
|
|
892
927
|
const id = btnEl.getAttribute('data-id');
|
|
893
|
-
if (id) {
|
|
894
|
-
if (typeof closeRecordDrawer === 'function') {
|
|
895
|
-
closeRecordDrawer();
|
|
896
|
-
}
|
|
897
|
-
editRecord(id);
|
|
928
|
+
if (id) {
|
|
929
|
+
if (typeof closeRecordDrawer === 'function') {
|
|
930
|
+
closeRecordDrawer();
|
|
931
|
+
}
|
|
932
|
+
editRecord(id);
|
|
898
933
|
}
|
|
899
934
|
}
|
|
900
935
|
|
|
@@ -914,11 +949,11 @@
|
|
|
914
949
|
function handleDrawerEditRecord(btnEl) {
|
|
915
950
|
if (!btnEl) return;
|
|
916
951
|
const id = btnEl.getAttribute('data-id');
|
|
917
|
-
if (id) {
|
|
918
|
-
if (typeof closeRecordDrawer === 'function') {
|
|
919
|
-
closeRecordDrawer();
|
|
920
|
-
}
|
|
921
|
-
editRecord(id);
|
|
952
|
+
if (id) {
|
|
953
|
+
if (typeof closeRecordDrawer === 'function') {
|
|
954
|
+
closeRecordDrawer();
|
|
955
|
+
}
|
|
956
|
+
editRecord(id);
|
|
922
957
|
}
|
|
923
958
|
}
|
|
924
959
|
|
|
@@ -931,11 +966,11 @@
|
|
|
931
966
|
function handleDrawerDeleteRecord(btnEl) {
|
|
932
967
|
if (!btnEl) return;
|
|
933
968
|
const id = btnEl.getAttribute('data-id');
|
|
934
|
-
if (id) {
|
|
935
|
-
if (typeof closeRecordDrawer === 'function') {
|
|
936
|
-
closeRecordDrawer();
|
|
937
|
-
}
|
|
938
|
-
drawerDeleteRecord(id);
|
|
969
|
+
if (id) {
|
|
970
|
+
if (typeof closeRecordDrawer === 'function') {
|
|
971
|
+
closeRecordDrawer();
|
|
972
|
+
}
|
|
973
|
+
drawerDeleteRecord(id);
|
|
939
974
|
}
|
|
940
975
|
}
|
|
941
976
|
|
|
@@ -1067,8 +1102,8 @@
|
|
|
1067
1102
|
if (!items || items.length === 0) {
|
|
1068
1103
|
container.innerHTML = `
|
|
1069
1104
|
<div class="audit-card" style="text-align:center; padding:2rem; color:var(--text-muted);">
|
|
1070
|
-
<
|
|
1071
|
-
<div style="font-weight:600; color
|
|
1105
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="color:var(--text-muted); margin-bottom:0.5rem;"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>
|
|
1106
|
+
<div style="font-weight:600; color:var(--text-heading); margin-bottom:0.25rem;">No History Logged</div>
|
|
1072
1107
|
<div style="font-size:12px;">No recorded field modifications found for this record.</div>
|
|
1073
1108
|
</div>
|
|
1074
1109
|
`;
|
|
@@ -1080,7 +1115,7 @@
|
|
|
1080
1115
|
|
|
1081
1116
|
container.innerHTML = `
|
|
1082
1117
|
<div style="margin-bottom:1rem; display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px;">
|
|
1083
|
-
<h3 style="margin:0; font-size:13px; font-weight:700; color
|
|
1118
|
+
<h3 style="margin:0; font-size:13px; font-weight:700; color:var(--text-heading); text-transform:uppercase; letter-spacing:0.05em;">
|
|
1084
1119
|
Audit History (${countLabel})
|
|
1085
1120
|
</h3>
|
|
1086
1121
|
<span style="font-size:11px; color:var(--text-muted);">Immutable Append-Only Log</span>
|
|
@@ -91,18 +91,32 @@
|
|
|
91
91
|
|
|
92
92
|
const topActions = document.getElementById('view-actions');
|
|
93
93
|
if (topActions) topActions.innerHTML = '';
|
|
94
|
-
const actions = document.getElementById('collection-actions')
|
|
95
|
-
actions.innerHTML =
|
|
96
|
-
${!col.system ? `
|
|
97
|
-
<button class="btn btn-danger btn-sm" onclick="openDeleteCollectionModal('${col.name}')" title="Permanently delete this collection">
|
|
98
|
-
Delete Collection
|
|
99
|
-
</button>
|
|
100
|
-
` : ''}
|
|
101
|
-
<button class="btn btn-primary btn-sm" onclick="saveSchemaChanges()">Save Schema</button>
|
|
102
|
-
`;
|
|
94
|
+
const actions = document.getElementById('collection-actions');
|
|
95
|
+
if (actions) actions.innerHTML = '';
|
|
103
96
|
|
|
104
97
|
const main = document.getElementById('collections-detail-pane') || document.getElementById('main-body');
|
|
105
98
|
main.innerHTML = `
|
|
99
|
+
<div class="collection-view-header" style="display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.25rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border-subtle);">
|
|
100
|
+
<div>
|
|
101
|
+
<h2 style="font-size: 16px; font-weight: 800; color: var(--text-heading); margin: 0; display: flex; align-items: center; gap: 8px;">
|
|
102
|
+
<span>${escapeHtml(col.name)} Schema & Rules</span>
|
|
103
|
+
<span class="badge ${col.type === 'auth' ? 'badge-post' : 'badge-get'}" style="font-size: 10px; font-weight: 700;">${col.type.toUpperCase()}</span>
|
|
104
|
+
${col.system ? `<span class="badge" style="font-size: 10px; background: rgba(148, 163, 184, 0.2); color: var(--text-muted);">SYSTEM</span>` : ''}
|
|
105
|
+
</h2>
|
|
106
|
+
<p style="font-size: 12px; color: var(--text-muted); margin: 3px 0 0 0;">
|
|
107
|
+
Define database columns, field types, validations, and API access rules.
|
|
108
|
+
</p>
|
|
109
|
+
</div>
|
|
110
|
+
<div style="display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;">
|
|
111
|
+
${!col.system ? `
|
|
112
|
+
<button class="btn btn-danger btn-sm" onclick="openDeleteCollectionModal('${escapeHtml(col.name)}')" title="Permanently delete this collection">
|
|
113
|
+
Delete Collection
|
|
114
|
+
</button>
|
|
115
|
+
` : ''}
|
|
116
|
+
<button class="btn btn-primary btn-sm" onclick="saveSchemaChanges()">Save Schema</button>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
106
120
|
<div style="max-width: 860px; display:flex; flex-direction:column; gap: 1.5rem;">
|
|
107
121
|
<div class="form-group">
|
|
108
122
|
<label class="form-label">Collection Name</label>
|