Files
pulse/views/pages/scheduler.ejs
T
jaredandClaude Opus 5.5 966c2be5cc
CI / Lint (eslint) (pull_request) Successful in 27s
CI / Test (jest) (pull_request) Successful in 26s
CI / Security (npm audit) (pull_request) Successful in 10s
CI / Scan (secrets, workflows, shell) (pull_request) Failing after 2m45s
CI / Integration (api) (pull_request) Successful in 3m37s
CI / UI (playwright) (pull_request) Successful in 2m51s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 2m35s
Scheduler: edit, Run now, cron with a preview, and a schedule's runs (#19)
- Edit: PUT /api/scheduled-commands/:id changes a schedule in place
  (keeping its history) and works out its next run again. The create
  dialog doubles as the edit dialog.
- Run now: POST /api/scheduled-commands/:id/run dispatches at once,
  records triggered_by, leaves next_run alone, and answers 409 while a
  previous run is still going. The dispatch body moved out of the
  scheduler loop into dispatchSchedule() so both share it.
- Cron is offered in the dialog, and a preview shows the next three runs
  and the server time zone they are worked out in
  (GET /api/scheduled-commands/preview). Errors stay in the dialog.
- Runs links to /executions?view=automated&search=scheduler:<name>;
  Executions now honours ?view= and ?search=.
- Create and edit share scheduleInput(), which also checks daily HH:MM.
- The dialog's worker list had no styles on this page (it borrows Quick
  Command's markup); they are now included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 19:17:48 -05:00

66 lines
3.1 KiB
Plaintext

<%#
Scheduler page (WP-F). List of scheduled commands + admin create/toggle/delete.
All data loaded client-side by /assets/pages/scheduler.js.
%>
<%- include('../partials/page-header', {
title: 'Scheduler',
subtitle: 'Automate command execution with flexible scheduling',
actions: '<button type="button" class="lt-btn lt-btn-secondary lt-btn-sm" data-action="app:refresh">&#x21bb; Refresh</button>' +
(pageConfig && pageConfig.isAdmin ? '<button type="button" class="lt-btn lt-btn-primary lt-btn-sm" data-action="sc:create-open">&#x2795; Create Schedule</button>' : '')
}) %>
<div class="lt-frame">
<div id="sc-wrap">
<div class="lt-empty-state" id="sc-loading">
<div class="lt-empty-state-title">Loading&hellip;</div>
</div>
</div>
</div>
<!-- Create Schedule Modal -->
<div class="lt-modal-overlay" id="sc-create-modal" aria-hidden="true" role="dialog" aria-modal="true" aria-labelledby="sc-create-title">
<div class="lt-modal">
<div class="lt-modal-header">
<span class="lt-modal-title" id="sc-create-title">Create Scheduled Command</span>
<button type="button" class="lt-modal-close" data-modal-close aria-label="Close">&#x2715;</button>
</div>
<form id="sc-create-form" data-submit-action="sc:create-submit">
<div class="lt-modal-body">
<div class="lt-form-group">
<label class="lt-label" for="sc-name">Schedule Name</label>
<input type="text" id="sc-name" class="lt-input" placeholder="e.g. Daily System Check">
</div>
<div class="lt-form-group">
<label class="lt-label" for="sc-command">Command</label>
<textarea id="sc-command" class="lt-textarea" rows="3" placeholder="Enter command to execute"></textarea>
</div>
<div class="lt-form-group">
<label class="lt-label">Target Workers</label>
<div id="sc-worker-list" class="qc-worker-list">
<div class="lt-empty-state lt-empty-state--sm"><div class="lt-empty-state-title">Loading&hellip;</div></div>
</div>
</div>
<div class="lt-form-group">
<label class="lt-label" for="sc-type">Schedule Type</label>
<select id="sc-type" class="lt-select" data-change-action="sc:type">
<option value="interval">Every X Minutes</option>
<option value="hourly">Every X Hours</option>
<option value="daily">Daily at Time</option>
<option value="cron">Cron expression</option>
</select>
</div>
<div class="lt-form-group" id="sc-value-container">
<label class="lt-label" for="sc-value">Interval (minutes)</label>
<input type="number" id="sc-value" class="lt-input" placeholder="e.g. 30" min="1">
</div>
<div class="sc-preview" id="sc-preview" aria-live="polite"></div>
<div class="lt-field-error" id="sc-create-error" hidden></div>
</div>
<div class="lt-modal-footer">
<button type="submit" class="lt-btn lt-btn-primary" id="sc-submit">Create Schedule</button>
<button type="button" class="lt-btn lt-btn-ghost" data-modal-close>Cancel</button>
</div>
</form>
</div>
</div>