emailengine-app 2.79.6 → 2.79.7

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.
@@ -36,16 +36,13 @@
36
36
  but init() checks the disable flag before it dials out and returns without
37
37
  connecting, so the click would report success and do nothing. --}}
38
38
  {{#> ui/tooltip text=(when accountParked "Syncing is switched off - use Resume syncing instead" "Close and re-open the connection")}}
39
- {{!-- pointer-events-none so the tooltip above still explains why: browsers dispatch no
40
- mouse events for a disabled control, so without it the wrapper never sees the hover --}}
41
- <button type="button" class="btn btn-soft btn-sm{{#if accountParked}} pointer-events-none{{/if}}" id="request-reconnect"{{#if accountParked}} disabled{{/if}}>
42
- <span class="icon-[tabler--refresh] size-4" id="reconnect-icon"></span> Reconnect
43
- </button>
39
+ {{> ui/btn label="Reconnect" bare=true style="soft" size="sm" icon="icon-[tabler--refresh]"
40
+ id="request-reconnect" disabled=accountParked}}
44
41
  {{/ui/tooltip}}
45
42
 
46
43
  {{#> ui/tooltip text="Run periodic folder syncing now"}}
47
44
  <button type="button" class="btn btn-soft btn-sm" id="request-sync">
48
- <span class="icon-[tabler--rotate-clockwise] size-4" id="sync-icon"></span> Run sync
45
+ <span class="icon-[tabler--rotate-clockwise] size-4"></span> Run sync
49
46
  </button>
50
47
  {{/ui/tooltip}}
51
48
 
@@ -121,7 +118,16 @@
121
118
  </button>
122
119
  <ul class="dropdown-menu dropdown-open:opacity-100 hidden min-w-56" role="menu"
123
120
  aria-orientation="vertical" aria-labelledby="logs-info">
124
- <li><a class="dropdown-item" href="/admin/accounts/{{urlpart account.account}}/logs.txt" download>Download stored logs</a></li>
121
+ {{!-- Downloading or clearing an empty log is a no-op dressed as work, so both
122
+ entries below render inert. This line says why: an inert entry is out of hit
123
+ testing, so it cannot carry a tooltip of its own --}}
124
+ <li id="no-stored-logs" class="{{#if hasStoredLogs}}hidden{{/if}}"><span
125
+ class="text-base-content/60 block px-4 py-2 text-sm">No stored logs for this account</span>
126
+ </li>
127
+ <li>
128
+ <a id="download-logs" class="dropdown-item{{#unless hasStoredLogs}} dropdown-disabled{{/unless}}"
129
+ {{#if hasStoredLogs}}href="/admin/accounts/{{urlpart account.account}}/logs.txt" download{{else}}aria-disabled="true"{{/if}}>Download stored logs</a>
130
+ </li>
125
131
  <li>
126
132
  <div class="divider my-1"></div>
127
133
  </li>
@@ -129,7 +135,8 @@
129
135
  <li><span class="text-base-content/60 block px-4 py-2 text-sm">Logging is enabled for all accounts</span></li>
130
136
  {{else}}
131
137
  <li><a class="dropdown-item" href="#" id="toggle-logs">{{#if account.logs}}Disable logging{{else}}Enable logging{{/if}}</a></li>
132
- <li><a class="dropdown-item" href="#" id="flush-logs">Clear stored logs</a></li>
138
+ <li><a id="flush-logs" class="dropdown-item{{#unless hasStoredLogs}} dropdown-disabled{{/unless}}"
139
+ {{#if hasStoredLogs}}href="#"{{else}}aria-disabled="true"{{/if}}>Clear stored logs</a></li>
133
140
  {{/if}}
134
141
  </ul>
135
142
  </div>
@@ -931,7 +938,7 @@ submitLabel="Delete account"}}
931
938
  <span class="icon-[tabler--trash] size-4"></span> Reset
932
939
  </button>
933
940
  <button type="button" class="btn btn-primary" id="export-start-btn">
934
- <span class="icon-[tabler--file-export] size-4" id="export-start-icon"></span> Start Export
941
+ <span class="icon-[tabler--file-export] size-4"></span> Start Export
935
942
  </button>
936
943
  </div>
937
944
  {{/ui/modal}}
@@ -952,29 +959,14 @@ submitLabel="Delete account"}}
952
959
  return data;
953
960
  }
954
961
 
955
- let reconnecting = false;
956
962
  const requestReconnectElm = document.getElementById('request-reconnect');
957
963
  requestReconnectElm.addEventListener('click', e => {
958
964
  e.preventDefault();
959
- if (requestReconnectElm.classList.contains('disabled')) {
960
- return;
961
- }
962
-
963
- if (reconnecting) {
964
- return
965
- }
966
-
967
- reconnecting = true;
968
- document.getElementById('reconnect-icon').classList.add('animate-spin');
969
- reconnectAccount().then(data => {
970
- document.getElementById('reconnect-icon').classList.remove('animate-spin');
971
- reconnecting = false;
972
- showToast(data.error ? data.error : (data.success ? 'Account reconnection requested' : 'Failed to request reconnect'), data.success ? 'check-circle' : 'alert-triangle');
973
- }).catch(err => {
974
- document.getElementById('reconnect-icon').classList.remove('animate-spin');
975
- reconnecting = false;
976
- showToast('Request failed\n' + err.message, 'alert-triangle');
977
- })
965
+ // Busy for the round trip: the request goes to a worker that has to reach the mail
966
+ // server, and the busy button is what stops a second one being asked for meanwhile.
967
+ uiBusyAction(requestReconnectElm, () =>
968
+ reconnectAccount().then(data => uiToastResult(data, 'Account reconnection requested', 'Failed to request reconnect'))
969
+ );
978
970
  });
979
971
 
980
972
  // Only rendered for an account the auth-failure safety net switched off
@@ -1016,29 +1008,12 @@ submitLabel="Delete account"}}
1016
1008
  return data;
1017
1009
  }
1018
1010
 
1019
- let syncing = false;
1020
1011
  const requestSyncElm = document.getElementById('request-sync');
1021
1012
  requestSyncElm.addEventListener('click', e => {
1022
1013
  e.preventDefault();
1023
- if (requestSyncElm.classList.contains('disabled')) {
1024
- return;
1025
- }
1026
-
1027
- if (syncing) {
1028
- return
1029
- }
1030
-
1031
- syncing = true;
1032
- document.getElementById('sync-icon').classList.add('animate-spin');
1033
- syncAccount().then(data => {
1034
- document.getElementById('sync-icon').classList.remove('animate-spin');
1035
- syncing = false;
1036
- showToast(data.error ? data.error : (data.success ? 'Account sync requested' : 'Failed to request syncing'), data.success ? 'check-circle' : 'alert-triangle');
1037
- }).catch(err => {
1038
- document.getElementById('sync-icon').classList.remove('animate-spin');
1039
- syncing = false;
1040
- showToast('Request failed\n' + err.message, 'alert-triangle');
1041
- })
1014
+ uiBusyAction(requestSyncElm, () =>
1015
+ syncAccount().then(data => uiToastResult(data, 'Account sync requested', 'Failed to request syncing'))
1016
+ );
1042
1017
  });
1043
1018
 
1044
1019
  const toggleLogs = async () => {
@@ -1062,47 +1037,41 @@ submitLabel="Delete account"}}
1062
1037
  return data;
1063
1038
  }
1064
1039
 
1065
- let togglingLogs = false;
1066
1040
  // #toggle-logs / #flush-logs only render when the global "log all accounts"
1067
1041
  // setting is off - guard so the rest of this block still gets wired
1068
- document.getElementById('toggle-logs')?.addEventListener('click', e => {
1042
+ const toggleLogsElm = document.getElementById('toggle-logs');
1043
+ toggleLogsElm?.addEventListener('click', e => {
1069
1044
  e.preventDefault();
1070
- if (togglingLogs) {
1071
- return
1072
- }
1073
- togglingLogs = true;
1074
-
1075
- toggleLogs().then(data => {
1076
- togglingLogs = false;
1077
- showToast(data.error ? data.error : (data.success ? 'Logging settings updated' : 'Failed to request reconnect'), data.success ? 'check-circle' : 'alert-triangle');
1078
- }).catch(err => {
1079
- togglingLogs = false;
1080
- showToast('Request failed\n' + err.message, 'alert-triangle');
1081
- })
1045
+ uiBusyAction(toggleLogsElm, () =>
1046
+ toggleLogs().then(data => uiToastResult(data, 'Logging settings updated', 'Failed to update logging settings'))
1047
+ );
1082
1048
  });
1083
1049
 
1084
- const flushLogs = async () => {
1085
- const account = document.getElementById('account-id').value.trim();
1050
+ const downloadLogsElm = document.getElementById('download-logs');
1051
+ const flushLogsElm = document.getElementById('flush-logs');
1086
1052
 
1087
- const data = await uiPostJson(`/admin/accounts/${account}/logs-flush`);
1088
- return data;
1053
+ // The client-side mirror of hasStoredLogs = false: nothing left to download or to clear,
1054
+ // and the note carries the reason that an entry out of hit testing cannot show itself
1055
+ const markLogsEmpty = () => {
1056
+ for (const elm of [downloadLogsElm, flushLogsElm]) {
1057
+ elm.classList.add('dropdown-disabled');
1058
+ elm.removeAttribute('href');
1059
+ elm.setAttribute('aria-disabled', 'true');
1060
+ }
1061
+ document.getElementById('no-stored-logs').classList.remove('hidden');
1089
1062
  }
1090
1063
 
1091
- let flushingLogs = false;
1092
- document.getElementById('flush-logs')?.addEventListener('click', e => {
1064
+ flushLogsElm?.addEventListener('click', e => {
1093
1065
  e.preventDefault();
1094
- if (flushingLogs) {
1095
- return
1096
- }
1097
- flushingLogs = true;
1098
-
1099
- flushLogs().then(data => {
1100
- flushingLogs = false;
1101
- showToast(data.error ? data.error : (data.success ? 'Stored logs were flushed' : 'Failed to flush logs'), data.success ? 'check-circle' : 'alert-triangle');
1102
- }).catch(err => {
1103
- flushingLogs = false;
1104
- showToast('Request failed\n' + err.message, 'alert-triangle');
1105
- })
1066
+ const account = document.getElementById('account-id').value.trim();
1067
+ uiBusyAction(flushLogsElm, () =>
1068
+ uiPostJson(`/admin/accounts/${account}/logs-flush`).then(data => {
1069
+ if (data.success) {
1070
+ markLogsEmpty();
1071
+ }
1072
+ uiToastResult(data, 'Stored logs were flushed', 'Failed to flush logs');
1073
+ })
1074
+ );
1106
1075
  });
1107
1076
 
1108
1077
  // Export status indicator on page load
@@ -1318,7 +1287,8 @@ submitLabel="Delete account"}}
1318
1287
  updateExportIndicator();
1319
1288
  });
1320
1289
 
1321
- document.getElementById('export-start-btn').addEventListener('click', async function () {
1290
+ const exportStartBtn = document.getElementById('export-start-btn');
1291
+ exportStartBtn.addEventListener('click', () => {
1322
1292
  const account = document.getElementById('account-id').value.trim();
1323
1293
  const startDate = document.getElementById('export-start-date').value;
1324
1294
  const endDate = document.getElementById('export-end-date').value;
@@ -1329,39 +1299,39 @@ submitLabel="Delete account"}}
1329
1299
  return;
1330
1300
  }
1331
1301
 
1332
- document.getElementById('export-start-icon').classList.add('animate-spin');
1333
-
1334
- try {
1335
- const data = await uiPostJson(`/admin/accounts/${account}/export`, {
1336
- startDate: startDate + 'T00:00:00Z',
1337
- endDate: endDate + 'T23:59:59Z',
1338
- includeAttachments
1339
- });
1340
- if (data.exportId) {
1341
- currentExportId = data.exportId;
1342
- showStatusView();
1343
- // Reset progress display state
1344
- document.getElementById('export-progress-section').classList.remove('hidden');
1345
- document.getElementById('export-error-section').classList.add('hidden');
1346
- document.getElementById('export-download-section').classList.add('hidden');
1347
- document.getElementById('export-phase-badge').classList.add('hidden');
1348
- const progressBar = document.getElementById('export-progress-bar');
1349
- progressBar.classList.remove('bg-success');
1350
- progressBar.classList.add('bg-info');
1351
- progressBar.style.width = '0%';
1352
- progressBar.setAttribute('aria-valuenow', 0);
1353
- document.getElementById('export-progress-text').textContent = '';
1354
- await updateExportStatus();
1355
- startPolling();
1356
- showToast('Export started', 'check-circle');
1357
- } else {
1358
- showToast(data.error || data.message || 'Failed to start export', 'alert-triangle');
1302
+ // Every call mints its own exportId and starts a full mailbox walk, so a second click
1303
+ // would run two exports and leave the first one with nothing pointing at it.
1304
+ uiBusyAction(exportStartBtn, async () => {
1305
+ try {
1306
+ const data = await uiPostJson(`/admin/accounts/${account}/export`, {
1307
+ startDate: startDate + 'T00:00:00Z',
1308
+ endDate: endDate + 'T23:59:59Z',
1309
+ includeAttachments
1310
+ });
1311
+ if (data.exportId) {
1312
+ currentExportId = data.exportId;
1313
+ showStatusView();
1314
+ // Reset progress display state
1315
+ document.getElementById('export-progress-section').classList.remove('hidden');
1316
+ document.getElementById('export-error-section').classList.add('hidden');
1317
+ document.getElementById('export-download-section').classList.add('hidden');
1318
+ document.getElementById('export-phase-badge').classList.add('hidden');
1319
+ const progressBar = document.getElementById('export-progress-bar');
1320
+ progressBar.classList.remove('bg-success');
1321
+ progressBar.classList.add('bg-info');
1322
+ progressBar.style.width = '0%';
1323
+ progressBar.setAttribute('aria-valuenow', 0);
1324
+ document.getElementById('export-progress-text').textContent = '';
1325
+ await updateExportStatus();
1326
+ startPolling();
1327
+ showToast('Export started', 'check-circle');
1328
+ } else {
1329
+ showToast(data.error || data.message || 'Failed to start export', 'alert-triangle');
1330
+ }
1331
+ } catch (err) {
1332
+ showToast('Export failed: ' + err.message, 'alert-triangle');
1359
1333
  }
1360
- } catch (err) {
1361
- showToast('Export failed: ' + err.message, 'alert-triangle');
1362
- } finally {
1363
- document.getElementById('export-start-icon').classList.remove('animate-spin');
1364
- }
1334
+ });
1365
1335
  });
1366
1336
 
1367
1337
  document.getElementById('export-reset-btn').addEventListener('click', async function () {
@@ -295,14 +295,12 @@ focus ring on) the corner close button --}}
295
295
  let submitDownElm = document.getElementById('submit-settings-btn-down')
296
296
  let errorsListElm = document.getElementById('test-errors-list')
297
297
 
298
- // Cosmetic only: greys out the real submit <button> while a submit is in flight (the dropdown
299
- // toggle is a <summary> and the skip link an <a>, neither has disabled semantics). The actual
300
- // duplicate-submit guard is the formSubmitting latch in submitForm(), which every path routes
301
- // through.
302
- let setSubmitButtonsDisabled = (disabled) => {
303
- submitElm.disabled = disabled;
304
- };
305
-
298
+ // eeButtonBusy() below is feedback only: it greys the real submit <button> out and spins its
299
+ // icon while a submit is in flight, so the wait for the account to be created is visible (the
300
+ // dropdown toggle is a <summary> and the skip link an <a>, neither has disabled semantics).
301
+ // The actual duplicate-submit guard is the formSubmitting latch in submitForm(), which every
302
+ // path routes through - this form submits through myForm.submit(), which fires no submit
303
+ // event, so the shared guard in static/js/public.js never sees it.
306
304
  let formSubmitting = false;
307
305
  let submitRecoveryTimer = null;
308
306
  let resetSubmitGuard = () => {
@@ -311,7 +309,7 @@ focus ring on) the corner close button --}}
311
309
  clearTimeout(submitRecoveryTimer);
312
310
  submitRecoveryTimer = null;
313
311
  }
314
- setSubmitButtonsDisabled(false);
312
+ eeButtonBusy(submitElm, false);
315
313
  };
316
314
  let submitForm = () => {
317
315
  // The server claims a single-use nonce, so a second POST from a double-click loses the race and
@@ -327,7 +325,7 @@ focus ring on) the corner close button --}}
327
325
  return;
328
326
  }
329
327
  formSubmitting = true;
330
- setSubmitButtonsDisabled(true);
328
+ eeButtonBusy(submitElm, true);
331
329
  // Recovery timer for an aborted submit: a successful submit navigates away (this page and the
332
330
  // timer are discarded) and a validation error reloads the page fresh, so this only fires when the
333
331
  // navigation never happened - the user cancelled it (Esc / Stop) while the page stayed alive. There
@@ -135,13 +135,13 @@
135
135
  return data;
136
136
  }
137
137
 
138
- document.getElementById('test-payload-btn').addEventListener('click', e => {
138
+ const testPayloadBtn = document.getElementById('test-payload-btn');
139
+ testPayloadBtn.addEventListener('click', e => {
139
140
  e.preventDefault()
140
- sendTestPayload().then(data => {
141
- showToast(data.error ? data.error : (data.success ? data.message || 'Connection successful' : 'Failed to establish connection'), data.success ? 'check-circle' : 'alert-triangle');
142
- }).catch(err => {
143
- showToast('Request failed\n' + err.message, 'alert-triangle');
144
- })
141
+ // Busy until Elasticsearch answers, rather than looking unpressed and being clicked again.
142
+ uiBusyAction(testPayloadBtn, () =>
143
+ sendTestPayload().then(data => uiToastResult(data, data.message || 'Connection successful', 'Failed to establish connection'))
144
+ );
145
145
  });
146
146
  })
147
147
  </script>
@@ -133,7 +133,10 @@ Remove the current license key from this EmailEngine instance?
133
133
  licenseFileTxt = (licenseFileTxt || '').toString().trim().substring(0, 10 * 1024)
134
134
  licenseTextElm.value = licenseFileTxt;
135
135
  if (licenseFileTxt.indexOf('BEGIN LICENSE') >= 0) {
136
- document.getElementById('licenseForm').submit();
136
+ // requestSubmit(), not submit(): this posts to the license server like the
137
+ // Activate button does, and only requestSubmit fires the submit event the
138
+ // busy/double-submit guard in static/js/ui.js listens for.
139
+ document.getElementById('licenseForm').requestSubmit();
137
140
  } else {
138
141
  licenseTextElm.focus();
139
142
  licenseTextElm.select();
@@ -288,7 +288,7 @@
288
288
 
289
289
 
290
290
  {{#> ui/confirm-modal id="deleteModal" title="Delete OAuth2 App" action="/admin/config/oauth/delete"
291
- fieldName="app" fieldValue=app.id submitLabel="Delete app" submitIcon="icon-[tabler--trash]" formClass="pending-form"}}
291
+ fieldName="app" fieldValue=app.id submitLabel="Delete app" submitIcon="icon-[tabler--trash]"}}
292
292
  <p>Are you sure you want to delete the OAuth2 application "{{app.name}}"? This action cannot be undone.</p>
293
293
  {{/ui/confirm-modal}}
294
294
 
@@ -13,7 +13,7 @@ appData.id) midLabel=appData.name current="Edit app" class="mt-6 mb-6"}}
13
13
  {{/if}}
14
14
  {{/unless}}{{/unless}}{{/unless}}
15
15
 
16
- <form method="post" action="/admin/config/oauth/edit" class="pending-form">
16
+ <form method="post" action="/admin/config/oauth/edit">
17
17
  <input type="hidden" name="crumb" value="{{crumb}}" />
18
18
  <input type="hidden" name="provider" value="{{appData.provider}}">
19
19
  <input type="hidden" name="app" value="{{appData.id}}">
@@ -13,7 +13,7 @@ providerData.comment " app") class="mt-6 mb-6"}}
13
13
  {{/if}}
14
14
  {{/unless}}{{/unless}}{{/unless}}
15
15
 
16
- <form method="post" action="/admin/config/oauth/new" class="pending-form">
16
+ <form method="post" action="/admin/config/oauth/new">
17
17
  <input type="hidden" name="crumb" value="{{crumb}}" />
18
18
  <input type="hidden" name="provider" value="{{values.provider}}">
19
19
 
@@ -282,13 +282,14 @@ class="mb-1"}}
282
282
  return data;
283
283
  }
284
284
 
285
- document.getElementById('test-payload-btn').addEventListener('click', e => {
285
+ const testPayloadBtn = document.getElementById('test-payload-btn');
286
+ testPayloadBtn.addEventListener('click', e => {
286
287
  e.preventDefault()
287
- sendTestPayload().then(data => {
288
- uiToastResult(data, 'Test payload sent', 'Failed to send payload');
289
- }).catch(err => {
290
- showToast('Request failed\n' + err.message, 'alert-triangle');
291
- })
288
+ // The delivery waits for the configured URL to answer; a second click would send a
289
+ // second payload.
290
+ uiBusyAction(testPayloadBtn, () =>
291
+ sendTestPayload().then(data => uiToastResult(data, 'Test payload sent', 'Failed to send payload'))
292
+ );
292
293
  });
293
294
 
294
295
  const editors = new Map();
@@ -58,13 +58,14 @@
58
58
  return await uiPostJson('/admin/gateways/test', payload);
59
59
  }
60
60
 
61
- document.getElementById('test-verify-btn').addEventListener('click', e => {
61
+ const testVerifyBtn = document.getElementById('test-verify-btn');
62
+ testVerifyBtn.addEventListener('click', e => {
62
63
  e.preventDefault()
63
- sendTestPayload().then(data => {
64
- showToast(data.error ? data.error : (data.success ? data.message || 'Connection successful' : 'Failed to establish connection'), data.success ? 'check-circle' : 'alert-triangle');
65
- }).catch(err => {
66
- showToast('Request failed\n' + err.message, 'alert-triangle');
67
- })
64
+ // Busy for as long as the SMTP server takes to answer - otherwise the button looks
65
+ // unpressed and gets clicked again, opening another connection to the same server.
66
+ uiBusyAction(testVerifyBtn, () =>
67
+ sendTestPayload().then(data => uiToastResult(data, data.message || 'Connection successful', 'Failed to establish connection'))
68
+ );
68
69
  });
69
70
  })
70
71
  </script>
@@ -18,9 +18,15 @@
18
18
  id - element id (optional)
19
19
  class - extra classes (optional)
20
20
  overlay - value for data-overlay to open/close a ui/modal (optional)
21
+ disabled - truthy to render the button disabled. Also adds pointer-events-none,
22
+ because a disabled control dispatches no mouse events and a wrapping
23
+ {{#> ui/tooltip}} would never see the hover that is meant to explain
24
+ why the button is off. Ignored entirely by the href form - a link
25
+ cannot be disabled, and half-disabling one (unclickable but still
26
+ keyboard-reachable) is worse than not offering it.
21
27
  --}}
22
28
  {{#*inline "btnClasses"~}}
23
- btn{{#unless bare}} btn-{{#if variant}}{{variant}}{{else}}primary{{/if}}{{/unless}}{{#if style}} btn-{{style}}{{/if}}{{#if size}} btn-{{size}}{{/if}}{{#if class}} {{class}}{{/if}}
29
+ btn{{#unless bare}} btn-{{#if variant}}{{variant}}{{else}}primary{{/if}}{{/unless}}{{#if style}} btn-{{style}}{{/if}}{{#if size}} btn-{{size}}{{/if}}{{#unless href}}{{#if disabled}} pointer-events-none{{/if}}{{/unless}}{{#if class}} {{class}}{{/if}}
24
30
  {{~/inline}}
25
31
  {{#*inline "btnContent"~}}
26
32
  {{#if icon}}<span class="{{icon}} size-4 shrink-0"></span>{{/if}}{{label}}
@@ -28,5 +34,5 @@ btn{{#unless bare}} btn-{{#if variant}}{{variant}}{{else}}primary{{/if}}{{/unles
28
34
  {{#if href}}
29
35
  <a href="{{href}}" {{#if id}}id="{{id}}" {{/if}}{{#if external}}target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" {{/if}}class="{{> btnClasses}}">{{> btnContent}}</a>
30
36
  {{else}}
31
- <button type="{{#if type}}{{type}}{{else}}button{{/if}}" {{#if id}}id="{{id}}" {{/if}}{{#if overlay}}data-overlay="{{overlay}}" {{/if}}class="{{> btnClasses}}">{{> btnContent}}</button>
37
+ <button type="{{#if type}}{{type}}{{else}}button{{/if}}" {{#if id}}id="{{id}}" {{/if}}{{#if overlay}}data-overlay="{{overlay}}" {{/if}}{{#if disabled}}disabled {{/if}}class="{{> btnClasses}}">{{> btnContent}}</button>
32
38
  {{/if}}
@@ -21,15 +21,14 @@
21
21
  shared .list-delete-btn handler can fill it (optional)
22
22
  formId - id on the form element (optional)
23
23
  formTarget - form target, e.g. "_blank" for download responses (optional)
24
- formClass - extra classes on the form, e.g. "pending-form" (optional)
25
24
  --}}
26
25
  {{#> ui/modal id=id title=title titleId=titleId}}
27
26
  <div class="modal-body">
28
27
  {{!-- own hash params neutralized against fallthrough into the block --}}
29
- {{> @partial-block id="" title="" titleId="" action="" submitLabel="" submitVariant="" submitIcon="" fieldName="" fieldValue="" fieldId="" fieldClass="" formId="" formTarget="" formClass=""}}
28
+ {{> @partial-block id="" title="" titleId="" action="" submitLabel="" submitVariant="" submitIcon="" fieldName="" fieldValue="" fieldId="" fieldClass="" formId="" formTarget=""}}
30
29
  </div>
31
30
  <div class="modal-footer">
32
- <form method="post" action="{{action}}"{{#if formId}} id="{{formId}}"{{/if}}{{#if formTarget}} target="{{formTarget}}" rel="noopener noreferrer"{{/if}} class="{{#if formClass}}{{formClass}} {{/if}}flex gap-2">
31
+ <form method="post" action="{{action}}"{{#if formId}} id="{{formId}}"{{/if}}{{#if formTarget}} target="{{formTarget}}" rel="noopener noreferrer"{{/if}} class="flex gap-2">
33
32
  <input type="hidden" name="crumb" value="{{crumb}}">
34
33
  {{#if fieldName}}
35
34
  <input type="hidden"{{#if fieldId}} id="{{fieldId}}"{{/if}}{{#if fieldClass}} class="{{fieldClass}}"{{/if}} name="{{fieldName}}" value="{{fieldValue}}">
@@ -0,0 +1,25 @@
1
+ {{!--
2
+ ui/empty-state - centered "nothing here yet" placeholder for the inside of a card that
3
+ brings its own header and primary action (the passkeys card on the account security
4
+ page). Block form; the block is the explanatory sentence under the title:
5
+ {{#> ui/empty-state icon="icon-[tabler--fingerprint]" title="No passkeys registered"}}
6
+ Register this device to sign in without typing a password.
7
+ {{/ui/empty-state}}
8
+ ui/list-empty is the sibling for a whole list page: it wraps itself in a card and its
9
+ copy is search/filter-aware, which is why it cannot be nested inside a card.
10
+ NB the partial-block pitfall - a block whose content is nothing but a {{#if}} wrapper
11
+ loses it. Hoist such a condition outside the call and use one block per arm.
12
+ Params:
13
+ icon - full iconify class for the muted glyph (optional; pass the complete class so
14
+ the Tailwind scanner sees it at the call site)
15
+ title - bold headline (required)
16
+ class - extra classes on the wrapper (optional)
17
+ --}}
18
+ <div class="flex flex-col items-center gap-2 py-6 text-center{{#if class}} {{class}}{{/if}}">
19
+ {{#if icon}}<span class="{{icon}} text-base-content/30 size-10"></span>{{/if}}
20
+ <p class="mb-0 font-medium">{{title}}</p>
21
+ {{#if @partial-block}}
22
+ {{!-- own hash params neutralized against fallthrough into the block --}}
23
+ <p class="text-base-content/60 mb-0 max-w-md text-sm">{{> @partial-block icon="" title="" class=""}}</p>
24
+ {{/if}}
25
+ </div>
@@ -19,11 +19,11 @@
19
19
  const testSendBtn = document.getElementById('test-send-btn');
20
20
  testSendBtn.addEventListener('click', e => {
21
21
  e.preventDefault();
22
- sendTestPayload().then(data => {
23
- uiToastResult(data, 'Test payload sent', 'Failed to send payload');
24
- }).catch(err => {
25
- showToast('Request failed\n' + err.message, 'alert-triangle');
26
- })
22
+ // Waits for the target server to answer; clicking again would deliver the preview
23
+ // payload a second time.
24
+ uiBusyAction(testSendBtn, () =>
25
+ sendTestPayload().then(data => uiToastResult(data, 'Test payload sent', 'Failed to send payload'))
26
+ );
27
27
  });
28
28
  });
29
29
  </script>