@xeplr/ui-jobs 1.6.11 → 1.7.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 CHANGED
@@ -123,6 +123,8 @@ Every call goes through `authFetch`, which prefixes the base URL `@xeplr/ui-acco
123
123
 
124
124
  **On a phone** (below 640px) the search, sort and **New job** wrap onto their own lines instead of running off the edge, the table keeps scrolling sideways inside its own box, row buttons and the run-history expander become thumb-sized (40px / 32px), and the search and sort are 16px so iOS does not zoom the page. A job's description and raw cron are still in the row's tooltip, which a phone cannot show — open the job to read them.
125
125
 
126
+ A **system job** (`system: true` from `@xeplr/jobs` — today the workflows' due work, `workflow-due`) is listed to every company with a **System** mark, **Always on** instead of the switch, and **Run now** only — no Edit, no Delete. Under the table it says why, in plain words: it does the workflows' due work for every company, so it cannot be changed, paused or deleted (the server refuses those for every caller, Super Admin included). A link to its editor (`?edit=<id>`) shows the same sentence instead of a form. A workflow "On a schedule" appears here as an ordinary job named "Workflow: <name>": pausing it pauses the workflow; its schedule is changed in the workflow.
127
+
126
128
  State shows **Running** over **Paused**: a pause takes effect at the next pick, and "paused" over a live run invites starting a second one. A job with no schedule has its switch off and disabled — there is nothing for the scheduler to pick.
127
129
 
128
130
  ### The editor
@@ -131,7 +133,7 @@ Three steps (four with `chainsApiBase`), all reachable at any time, with **Save
131
133
 
132
134
  1. **Job** — name, description, action.
133
135
  2. **Inputs** — a control per field of the action's `inputSchema`: a select for `options`, true/false for `boolean`, a number input, a JSON textarea for `object` / `array` (invalid JSON blocks the save), text otherwise. Fields marked `system: true` are never shown — the server fills them, and rendering them would ask for a credential. Optional fields with a `default` are under **Advanced**, whose summary lists their values. Values are converted to the declared types on save, since `@xeplr/schema-handler` rejects `"1000"` for a number.
134
- 3. **Schedule** — cron (`CronScheduleField`), status, **Start from** (`startAt`), **Retry on failure** (0–3, default 0), **Give up after** (`timeoutMinutes`, blank = server default of 30).
136
+ 3. **Schedule** — cron (`CronScheduleField`), **Time zone** (an IANA name such as `Asia/Kolkata`; empty = the server's; a name the browser cannot read is shown in red and Save waits), status, **Start from** (`startAt`), **Retry on failure** (0–3, default 0), **Give up after** (`timeoutMinutes`, blank = server default of 30).
135
137
  **Each run takes** (only for an action with a `window` input) — which rows each run takes, the job's decision (`incrementalMode`): *Everything, each run* (none), *Since the last successful run* (`period`), or *Continue from what is already loaded* (`watermark`, offered only when the action's `window` field says `watermark: true`, since the action has to read its own target). With `watermark`, **Also re-read the last … days** (`reloadDays`). A range given when the job is started always wins. Logic in `src/lib/incrementalModel.js`.
136
138
  4. **After this job** (`JobChainSection`, `useJobChainController`, `lib/jobChainModel.js`) — "Run another job when this one finishes", then rules checked top to bottom, first match wins. Each rule has:
137
139
  - **If**: a JSON condition, e.g. `{ "field": "status", "op": "=", "value": "success" }`, or `{ "all": [ … ] }` / `{ "any": [ … ] }`. Empty means "otherwise" and must come last.
@@ -218,7 +220,7 @@ Styles read `--accent`, `--surface`, `--ink`, `--muted`, `--hair`, `--plane` and
218
220
  npm test
219
221
  ```
220
222
 
221
- Plain Node scripts, no framework (`test/run.mjs` runs each `*.test.*` file): job state, `describeCron`, next-run and duration labels, latest run per job, search and sort; and the "After this job" form's rules: text to rules and back, what is refused, what the job before may fill, and rules ⇄ the workflow they are (its trigger, `when` arrows, `job-run` steps, reused and deleted steps, a draft, and every reshape that counts as edited elsewhere) (`jobChainModel.test.mjs`).
223
+ Plain Node scripts, no framework (`test/run.mjs` runs each `*.test.*` file): job state, `describeCron`, next-run and duration labels, latest run per job, search and sort, a system job and a time zone the browser can read; and the "After this job" form's rules: text to rules and back, what is refused, what the job before may fill, and rules ⇄ the workflow they are (its trigger, `when` arrows, `job-run` steps, reused and deleted steps, a draft, and every reshape that counts as edited elsewhere) (`jobChainModel.test.mjs`).
222
224
 
223
225
  ## License
224
226
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xeplr/ui-jobs",
3
- "version": "1.6.11",
3
+ "version": "1.7.0",
4
4
  "description": "The screens for @xeplr/jobs — schedule, run, pause and watch jobs — as routes a host app registers, or a standalone app",
5
5
  "type": "module",
6
6
  "main": "src/index.jsx",
@@ -1,10 +1,10 @@
1
1
  .csf-field { display: grid; gap: 6px; margin-bottom: 14px; }
2
- .csf-field label { font-size: 13px; color: var(--muted, #6b6a63); }
2
+ .csf-field label { font-size: 13px; color: var(--muted, var(--xeplr-text-secondary, #6b6a63)); }
3
3
  .csf-field select, .csf-field input {
4
4
  width: 100%; padding: 9px 11px; font: inherit; font-size: 14px;
5
5
  color: var(--xeplr-input-text, #1a1a19); background: var(--xeplr-input-bg, #ffffff);
6
6
  border: 1px solid var(--xeplr-input-border, #e2e1d9); border-radius: 8px;
7
7
  }
8
- .csf-field select:focus, .csf-field input:focus { outline: none; border-color: var(--accent, #2563eb); }
8
+ .csf-field select:focus, .csf-field input:focus { outline: none; border-color: var(--accent, var(--xeplr-accent, #2563eb)); }
9
9
  .csf-cron { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
10
- .csf-help { font-size: 12px; color: var(--muted, #6b6a63); }
10
+ .csf-help { font-size: 12px; color: var(--muted, var(--xeplr-text-secondary, #6b6a63)); }
@@ -1,19 +1,19 @@
1
1
  /* "After this job" — the rules list in the job editor. */
2
2
  .jb-chain { display: grid; gap: 10px; }
3
- .jb-chain-toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink, #1a1a19); cursor: pointer; }
3
+ .jb-chain-toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink, var(--xeplr-text-primary, #1a1a19)); cursor: pointer; }
4
4
  .jb-chain-rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
5
5
  .jb-chain-rule {
6
- padding: 12px 14px; background: var(--plane, #f7f7f5);
7
- border: 1px solid var(--hair, #e2e1d9); border-radius: 11px;
6
+ padding: 12px 14px; background: var(--plane, var(--xeplr-bg-tertiary, #f7f7f5));
7
+ border: 1px solid var(--hair, var(--xeplr-border-primary, #e2e1d9)); border-radius: 11px;
8
8
  }
9
9
  .jb-chain-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
10
- .jb-chain-n { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted, #6b6a63); }
10
+ .jb-chain-n { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted, var(--xeplr-text-secondary, #6b6a63)); }
11
11
  .jb-chain-tools { display: flex; gap: 6px; }
12
12
  .jb-chain-tools button, .jb-chain-add {
13
- padding: 4px 10px; font: inherit; font-size: 12px; color: var(--ink, #1a1a19);
14
- background: var(--surface, #ffffff); border: 1px solid var(--hair, #e2e1d9); border-radius: 7px; cursor: pointer;
13
+ padding: 4px 10px; font: inherit; font-size: 12px; color: var(--ink, var(--xeplr-text-primary, #1a1a19));
14
+ background: var(--surface, var(--xeplr-bg-secondary, #ffffff)); border: 1px solid var(--hair, var(--xeplr-border-primary, #e2e1d9)); border-radius: 7px; cursor: pointer;
15
15
  }
16
16
  .jb-chain-tools button:disabled { opacity: .45; cursor: default; }
17
17
  .jb-chain-add { justify-self: start; font-size: 13px; padding: 6px 12px; }
18
18
  .jb-chain-json { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; resize: vertical; }
19
- .jb-chain-fields { margin: 6px 0 8px; padding-left: 18px; font-size: 13px; color: var(--muted, #6b6a63); display: grid; gap: 3px; }
19
+ .jb-chain-fields { margin: 6px 0 8px; padding-left: 18px; font-size: 13px; color: var(--muted, var(--xeplr-text-secondary, #6b6a63)); display: grid; gap: 3px; }
@@ -7,11 +7,11 @@
7
7
  }
8
8
  .jb-editor .jb-param input, .jb-editor .jb-param select { width: 100%; min-width: 0; }
9
9
  .jb-param-name { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
10
- .jb-param-arrow { color: var(--muted, #6b6a63); }
10
+ .jb-param-arrow { color: var(--muted, var(--xeplr-text-secondary, #6b6a63)); }
11
11
  .jb-param-gap { min-width: 0; }
12
12
  .jb-param-remove, .jb-param-add {
13
- padding: 5px 10px; font: inherit; font-size: 12px; color: var(--ink, #1a1a19);
14
- background: var(--surface, #ffffff); border: 1px solid var(--hair, #e2e1d9); border-radius: 7px; cursor: pointer;
13
+ padding: 5px 10px; font: inherit; font-size: 12px; color: var(--ink, var(--xeplr-text-primary, #1a1a19));
14
+ background: var(--surface, var(--xeplr-bg-secondary, #ffffff)); border: 1px solid var(--hair, var(--xeplr-border-primary, #e2e1d9)); border-radius: 7px; cursor: pointer;
15
15
  }
16
16
  .jb-param-add { justify-self: start; font-size: 13px; }
17
17
  @media (max-width: 640px) {
@@ -23,13 +23,13 @@
23
23
  .jb-namebox-list {
24
24
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0; margin: 0; padding: 4px;
25
25
  list-style: none; max-height: 220px; overflow: auto;
26
- background: var(--surface, #ffffff); border: 1px solid var(--hair, #e2e1d9); border-radius: 8px;
26
+ background: var(--surface, var(--xeplr-bg-secondary, #ffffff)); border: 1px solid var(--hair, var(--xeplr-border-primary, #e2e1d9)); border-radius: 8px;
27
27
  box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
28
28
  }
29
29
  .jb-namebox-list li {
30
30
  padding: 6px 8px; border-radius: 6px; cursor: pointer;
31
- font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: var(--ink, #1a1a19);
31
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: var(--ink, var(--xeplr-text-primary, #1a1a19));
32
32
  }
33
- .jb-namebox-list li:hover, .jb-namebox-list li[aria-selected="true"] { background: var(--xeplr-hover, #f0efe9); }
34
- .jb-namebox-list .jb-namebox-note { cursor: default; font-family: inherit; font-size: 12px; color: var(--muted, #6b6a63); }
33
+ .jb-namebox-list li:hover, .jb-namebox-list li[aria-selected="true"] { background: var(--xeplr-hover, var(--xeplr-bg-hover, #f0efe9)); }
34
+ .jb-namebox-list .jb-namebox-note { cursor: default; font-family: inherit; font-size: 12px; color: var(--muted, var(--xeplr-text-secondary, #6b6a63)); }
35
35
  .jb-namebox-list .jb-namebox-note:hover { background: none; }
@@ -13,24 +13,24 @@
13
13
 
14
14
  .jb-search, .jb-sort {
15
15
  padding: 9px 12px; font: inherit; font-size: 14px;
16
- color: var(--ink, #1a1a19); background: var(--surface, #ffffff);
17
- border: 1px solid var(--hair, #e2e1d9); border-radius: 9px;
16
+ color: var(--ink, var(--xeplr-text-primary, #1a1a19)); background: var(--surface, var(--xeplr-bg-secondary, #ffffff));
17
+ border: 1px solid var(--hair, var(--xeplr-border-primary, #e2e1d9)); border-radius: 9px;
18
18
  }
19
19
  .jb-search { width: 220px; }
20
20
  .jb-search:focus, .jb-sort:focus {
21
- outline: none; border-color: var(--accent, #2563eb); box-shadow: 0 0 0 3px var(--xeplr-accent-soft, #e8eefc);
21
+ outline: none; border-color: var(--accent, var(--xeplr-accent, #2563eb)); box-shadow: 0 0 0 3px var(--xeplr-accent-soft, var(--xeplr-accent-muted, #e8eefc));
22
22
  }
23
23
 
24
24
  .jb-primary {
25
25
  padding: 9px 16px; font: inherit; font-weight: 600; white-space: nowrap;
26
- color: #fff; background: var(--accent, #2563eb); border: 0; border-radius: 9px; cursor: pointer;
26
+ color: #fff; background: var(--accent, var(--xeplr-accent, #2563eb)); border: 0; border-radius: 9px; cursor: pointer;
27
27
  }
28
28
  .jb-primary:hover { filter: brightness(1.06); }
29
29
  .jb-primary:disabled { opacity: .55; cursor: default; filter: none; }
30
30
 
31
31
  /* ── the table ───────────────────────────────────────────────────────── */
32
32
  .jb-table-wrap {
33
- background: var(--surface, #ffffff); border: 1px solid var(--hair, #e2e1d9);
33
+ background: var(--surface, var(--xeplr-bg-secondary, #ffffff)); border: 1px solid var(--hair, var(--xeplr-border-primary, #e2e1d9));
34
34
  border-radius: 13px;
35
35
  /* SCROLLS rather than clips: if anything ever makes the table wider than
36
36
  the page, the person can still reach its right-hand controls (a run's
@@ -40,22 +40,22 @@
40
40
  .jb-table { width: 100%; border-collapse: collapse; }
41
41
  .jb-table thead th {
42
42
  padding: 11px 16px; text-align: left; font-size: 11px; font-weight: 600;
43
- letter-spacing: .06em; text-transform: uppercase; color: var(--muted, #6b6a63);
44
- background: var(--plane, #f7f7f5); border-bottom: 1px solid var(--hair, #e2e1d9); white-space: nowrap;
43
+ letter-spacing: .06em; text-transform: uppercase; color: var(--muted, var(--xeplr-text-secondary, #6b6a63));
44
+ background: var(--plane, var(--xeplr-bg-tertiary, #f7f7f5)); border-bottom: 1px solid var(--hair, var(--xeplr-border-primary, #e2e1d9)); white-space: nowrap;
45
45
  }
46
46
  .jb-table td {
47
47
  padding: 13px 16px; vertical-align: top; font-size: 14px;
48
48
  border-bottom: 1px solid var(--xeplr-border-secondary, #eceada);
49
49
  }
50
50
  .jb-table tbody tr:last-child td { border-bottom: 0; }
51
- .jb-table tbody tr:hover { background: var(--xeplr-hover, #f0efe9); }
51
+ .jb-table tbody tr:hover { background: var(--xeplr-hover, var(--xeplr-bg-hover, #f0efe9)); }
52
52
 
53
53
  .jb-name { font-weight: 600; }
54
- .jb-desc { color: var(--muted, #6b6a63); font-size: 13px; margin-top: 2px; }
55
- .jb-dim { color: var(--muted, #6b6a63); }
54
+ .jb-desc { color: var(--muted, var(--xeplr-text-secondary, #6b6a63)); font-size: 13px; margin-top: 2px; }
55
+ .jb-dim { color: var(--muted, var(--xeplr-text-secondary, #6b6a63)); }
56
56
  .jb-code {
57
57
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
58
- background: var(--plane, #f7f7f5); padding: 2px 6px; border-radius: 6px;
58
+ background: var(--plane, var(--xeplr-bg-tertiary, #f7f7f5)); padding: 2px 6px; border-radius: 6px;
59
59
  }
60
60
  .jb-lastrun { display: inline-flex; align-items: center; gap: 8px; }
61
61
 
@@ -63,9 +63,9 @@
63
63
  .jb-row-actions button {
64
64
  margin-right: 4px; padding: 5px 10px; font: inherit; font-size: 13px;
65
65
  color: inherit; background: transparent;
66
- border: 1px solid var(--hair, #e2e1d9); border-radius: 7px; cursor: pointer;
66
+ border: 1px solid var(--hair, var(--xeplr-border-primary, #e2e1d9)); border-radius: 7px; cursor: pointer;
67
67
  }
68
- .jb-row-actions button:hover:not(:disabled) { background: var(--surface, #ffffff); border-color: var(--xeplr-border-strong, #cfcec4); }
68
+ .jb-row-actions button:hover:not(:disabled) { background: var(--surface, var(--xeplr-bg-secondary, #ffffff)); border-color: var(--xeplr-border-strong, var(--xeplr-border-secondary, #cfcec4)); }
69
69
  .jb-row-actions button:disabled { opacity: .45; cursor: default; }
70
70
  .jb-danger { color: var(--xeplr-danger, #c2372e); }
71
71
 
@@ -77,11 +77,11 @@
77
77
  font-size: 11px; font-weight: 600; text-transform: capitalize;
78
78
  }
79
79
  .jb-table td .jb-pill { margin-top: 6px; }
80
- .jb-pill--running, .jb-pill--busy { background: var(--xeplr-status-warn-soft, #fdf3e0); color: var(--xeplr-status-warn, #a86a00); }
81
- .jb-pill--scheduled { background: var(--xeplr-accent-soft, #e8eefc); color: var(--accent, #2563eb); }
80
+ .jb-pill--running, .jb-pill--busy { background: var(--xeplr-status-warn-soft, var(--xeplr-warning-bg, #fdf3e0)); color: var(--xeplr-status-warn, var(--xeplr-warning, #a86a00)); }
81
+ .jb-pill--scheduled { background: var(--xeplr-accent-soft, var(--xeplr-accent-muted, #e8eefc)); color: var(--accent, var(--xeplr-accent, #2563eb)); }
82
82
  .jb-pill--paused, .jb-pill--manual, .jb-pill--unknown { background: var(--xeplr-tag-bg, #f0efe9); color: var(--xeplr-tag-text, #6b6a63); }
83
- .jb-pill--good { background: var(--xeplr-status-good-soft, #e7f4ed); color: var(--xeplr-status-good, #1d7a4c); }
84
- .jb-pill--bad { background: var(--xeplr-status-critical-soft, #fdeceb); color: var(--xeplr-status-critical, #c2372e); }
83
+ .jb-pill--good { background: var(--xeplr-status-good-soft, var(--xeplr-success-bg, #e7f4ed)); color: var(--xeplr-status-good, var(--xeplr-success, #1d7a4c)); }
84
+ .jb-pill--bad { background: var(--xeplr-status-critical-soft, var(--xeplr-danger-bg, #fdeceb)); color: var(--xeplr-status-critical, var(--xeplr-danger, #c2372e)); }
85
85
 
86
86
  /* ── live updates ────────────────────────────────────────────────────── */
87
87
 
@@ -93,7 +93,7 @@
93
93
  display: inline-block; margin: 6px 0 0 6px; padding: 2px 8px; border-radius: 999px;
94
94
  font-size: 11px; font-weight: 600;
95
95
  font-variant-numeric: tabular-nums;
96
- background: var(--xeplr-accent-soft, #e8eefc); color: var(--accent, #2563eb);
96
+ background: var(--xeplr-accent-soft, var(--xeplr-accent-muted, #e8eefc)); color: var(--accent, var(--xeplr-accent, #2563eb));
97
97
  }
98
98
 
99
99
  /* Reporting, then silent. Toned DOWN rather than up: a long final write is
@@ -110,7 +110,7 @@
110
110
  .jb-live-count {
111
111
  padding: 1px 7px; border-radius: 999px; font-weight: 600;
112
112
  font-variant-numeric: tabular-nums;
113
- background: var(--xeplr-status-warn-soft, #fdf3e0); color: var(--xeplr-status-warn, #a86a00);
113
+ background: var(--xeplr-status-warn-soft, var(--xeplr-warning-bg, #fdf3e0)); color: var(--xeplr-status-warn, var(--xeplr-warning, #a86a00));
114
114
  }
115
115
 
116
116
  /* ── the editor ──────────────────────────────────────────────────────── */
@@ -119,7 +119,7 @@
119
119
  form can have at once. Fields now flow into columns instead of stacking. */
120
120
  .jb-editor {
121
121
  max-width: 1100px; margin: 0 0 24px; padding: 22px 26px;
122
- background: var(--surface, #ffffff); border: 1px solid var(--hair, #e2e1d9); border-radius: 13px;
122
+ background: var(--surface, var(--xeplr-bg-secondary, #ffffff)); border: 1px solid var(--hair, var(--xeplr-border-primary, #e2e1d9)); border-radius: 13px;
123
123
  }
124
124
  .jb-editor h2 { margin: 0 0 16px; font-size: 17px; }
125
125
  .jb-field { display: grid; gap: 5px; margin-bottom: 14px; align-content: start; }
@@ -132,23 +132,23 @@
132
132
  /* JSON needs room to be read, so it takes the whole row. */
133
133
  .jb-field--wide { grid-column: 1 / -1; }
134
134
  .jb-field label {
135
- font-size: 13px; font-weight: 500; color: var(--ink, #1a1a19);
135
+ font-size: 13px; font-weight: 500; color: var(--ink, var(--xeplr-text-primary, #1a1a19));
136
136
  }
137
137
  .jb-field input, .jb-field select {
138
138
  width: 100%; padding: 9px 11px; font: inherit; font-size: 14px;
139
139
  color: var(--xeplr-input-text, #1a1a19); background: var(--xeplr-input-bg, #ffffff);
140
140
  border: 1px solid var(--xeplr-input-border, #e2e1d9); border-radius: 8px;
141
141
  }
142
- .jb-field input:focus, .jb-field select:focus { outline: none; border-color: var(--accent, #2563eb); }
142
+ .jb-field input:focus, .jb-field select:focus { outline: none; border-color: var(--accent, var(--xeplr-accent, #2563eb)); }
143
143
  .jb-cron { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
144
- .jb-help { font-size: 12px; color: var(--muted, #6b6a63); }
145
- .jb-warn { color: var(--xeplr-status-warn, #a86a00); }
144
+ .jb-help { font-size: 12px; color: var(--muted, var(--xeplr-text-secondary, #6b6a63)); }
145
+ .jb-warn { color: var(--xeplr-status-warn, var(--xeplr-warning, #a86a00)); }
146
146
  .jb-req { color: var(--xeplr-danger, #c2372e); }
147
- .jb-type { color: var(--xeplr-muted-2, #8a887f); font-size: 11px; }
147
+ .jb-type { color: var(--xeplr-muted-2, var(--xeplr-text-muted, #8a887f)); font-size: 11px; }
148
148
  .jb-editor-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
149
149
  .jb-editor-actions button:not(.jb-primary) {
150
150
  padding: 9px 16px; font: inherit; color: inherit; background: transparent;
151
- border: 1px solid var(--hair, #e2e1d9); border-radius: 9px; cursor: pointer;
151
+ border: 1px solid var(--hair, var(--xeplr-border-primary, #e2e1d9)); border-radius: 9px; cursor: pointer;
152
152
  }
153
153
 
154
154
  /* ── history ─────────────────────────────────────────────────────────── */
@@ -157,7 +157,7 @@
157
157
  .jb-run {
158
158
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
159
159
  padding: 10px 14px; font-size: 13px;
160
- background: var(--surface, #ffffff); border: 1px solid var(--hair, #e2e1d9); border-radius: 10px;
160
+ background: var(--surface, var(--xeplr-bg-secondary, #ffffff)); border: 1px solid var(--hair, var(--xeplr-border-primary, #e2e1d9)); border-radius: 10px;
161
161
  }
162
162
  .jb-run .jb-pill { margin-top: 0; }
163
163
  .jb-run-name { font-weight: 600; }
@@ -166,7 +166,7 @@
166
166
  /* ── empty ───────────────────────────────────────────────────────────── */
167
167
  .jb-empty {
168
168
  padding: 40px 24px; text-align: center;
169
- background: var(--surface, #ffffff); border: 1px dashed var(--hair, #e2e1d9); border-radius: 13px;
169
+ background: var(--surface, var(--xeplr-bg-secondary, #ffffff)); border: 1px dashed var(--hair, var(--xeplr-border-primary, #e2e1d9)); border-radius: 13px;
170
170
  }
171
171
  .jb-empty--inline { border: 0; border-radius: 0; padding: 32px 24px; }
172
172
  .jb-empty-title { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
@@ -193,30 +193,30 @@
193
193
  background: none; border: 0; padding: 0; margin: 0;
194
194
  font: inherit; color: inherit; cursor: pointer; text-align: left;
195
195
  }
196
- .jb-lastrun--btn:hover .jb-caret { color: var(--accent, #2563eb); }
197
- .jb-lastrun--btn:focus-visible { outline: 2px solid var(--accent, #2563eb); outline-offset: 3px; border-radius: 6px; }
196
+ .jb-lastrun--btn:hover .jb-caret { color: var(--accent, var(--xeplr-accent, #2563eb)); }
197
+ .jb-lastrun--btn:focus-visible { outline: 2px solid var(--accent, var(--xeplr-accent, #2563eb)); outline-offset: 3px; border-radius: 6px; }
198
198
 
199
199
  .jb-caret {
200
- color: var(--muted, #6b6a63); font-size: 15px; line-height: 1;
200
+ color: var(--muted, var(--xeplr-text-secondary, #6b6a63)); font-size: 15px; line-height: 1;
201
201
  transition: transform .12s ease; display: inline-block;
202
202
  }
203
203
  .jb-caret--open { transform: rotate(90deg); }
204
204
 
205
205
  /* The open row and its history read as one block, so the parent loses its
206
206
  bottom rule and the panel picks up the accent edge. */
207
- .jb-row--open > td { border-bottom: 0; background: var(--xeplr-hover, #f0efe9); }
208
- .jb-runs-row > td { padding: 0 0 14px 0; background: var(--xeplr-hover, #f0efe9); }
209
- .jb-runs-row:hover > td { background: var(--xeplr-hover, #f0efe9); }
207
+ .jb-row--open > td { border-bottom: 0; background: var(--xeplr-hover, var(--xeplr-bg-hover, #f0efe9)); }
208
+ .jb-runs-row > td { padding: 0 0 14px 0; background: var(--xeplr-hover, var(--xeplr-bg-hover, #f0efe9)); }
209
+ .jb-runs-row:hover > td { background: var(--xeplr-hover, var(--xeplr-bg-hover, #f0efe9)); }
210
210
 
211
211
  .jb-history {
212
- margin: 0 14px; border: 1px solid var(--hair, #e2e1d9); border-radius: 11px;
213
- background: var(--surface, #ffffff); overflow-x: auto;
212
+ margin: 0 14px; border: 1px solid var(--hair, var(--xeplr-border-primary, #e2e1d9)); border-radius: 11px;
213
+ background: var(--surface, var(--xeplr-bg-secondary, #ffffff)); overflow-x: auto;
214
214
  }
215
215
  .jb-history-table { width: 100%; border-collapse: collapse; font-size: 13px; }
216
216
  .jb-history-table th {
217
217
  text-align: left; padding: 8px 12px; font-size: 11px; font-weight: 600;
218
- letter-spacing: .06em; text-transform: uppercase; color: var(--muted, #6b6a63);
219
- background: var(--plane, #f7f7f5); border-bottom: 1px solid var(--hair, #e2e1d9); white-space: nowrap;
218
+ letter-spacing: .06em; text-transform: uppercase; color: var(--muted, var(--xeplr-text-secondary, #6b6a63));
219
+ background: var(--plane, var(--xeplr-bg-tertiary, #f7f7f5)); border-bottom: 1px solid var(--hair, var(--xeplr-border-primary, #e2e1d9)); white-space: nowrap;
220
220
  }
221
221
  .jb-history-table td { padding: 8px 12px; border-bottom: 1px solid var(--xeplr-border-secondary, #eceada); vertical-align: top; }
222
222
  .jb-history-table tr:last-child td { border-bottom: 0; }
@@ -226,32 +226,32 @@
226
226
  /* A retry count belongs NEXT TO the outcome, not in its own column — it is a
227
227
  qualifier on "how did it go", not a separate fact. */
228
228
  .jb-retry {
229
- margin-left: 8px; font-size: 12px; color: var(--xeplr-status-warn, #a86a00);
229
+ margin-left: 8px; font-size: 12px; color: var(--xeplr-status-warn, var(--xeplr-warning, #a86a00));
230
230
  white-space: nowrap;
231
231
  }
232
232
 
233
233
  /* A late finish is not a failure: the work completed. It reads as a setting to
234
234
  change, which is why it is warn-toned rather than critical. */
235
- .jb-late { color: var(--xeplr-status-warn, #a86a00); font-size: 12px; }
235
+ .jb-late { color: var(--xeplr-status-warn, var(--xeplr-warning, #a86a00)); font-size: 12px; }
236
236
 
237
237
  /* interrupted / skipped — neither broken nor fine. */
238
- .jb-pill--warn { background: var(--xeplr-status-warn-soft, #fdf3e0); color: var(--xeplr-status-warn, #a86a00); }
238
+ .jb-pill--warn { background: var(--xeplr-status-warn-soft, var(--xeplr-warning-bg, #fdf3e0)); color: var(--xeplr-status-warn, var(--xeplr-warning, #a86a00)); }
239
239
 
240
240
  /* ── Editor: three sections ────────────────────────────────────────────── */
241
241
 
242
242
  .jb-steps {
243
243
  display: flex; gap: 6px; margin: 4px 0 2px;
244
- border-bottom: 1px solid var(--hair, #e2e1d9); padding-bottom: 0;
244
+ border-bottom: 1px solid var(--hair, var(--xeplr-border-primary, #e2e1d9)); padding-bottom: 0;
245
245
  }
246
246
  .jb-step {
247
247
  display: inline-flex; align-items: center; gap: 8px;
248
248
  padding: 9px 14px; background: none; border: 0; cursor: pointer;
249
- font: inherit; font-size: 14px; color: var(--muted, #6b6a63);
249
+ font: inherit; font-size: 14px; color: var(--muted, var(--xeplr-text-secondary, #6b6a63));
250
250
  border-bottom: 2px solid transparent; margin-bottom: -1px;
251
251
  }
252
- .jb-step:hover { color: var(--ink, #1a1a19); }
253
- .jb-step--on { color: var(--ink, #1a1a19); font-weight: 600; border-bottom-color: var(--accent, #2563eb); }
254
- .jb-step:focus-visible { outline: 2px solid var(--accent, #2563eb); outline-offset: -2px; border-radius: 6px; }
252
+ .jb-step:hover { color: var(--ink, var(--xeplr-text-primary, #1a1a19)); }
253
+ .jb-step--on { color: var(--ink, var(--xeplr-text-primary, #1a1a19)); font-weight: 600; border-bottom-color: var(--accent, var(--xeplr-accent, #2563eb)); }
254
+ .jb-step:focus-visible { outline: 2px solid var(--accent, var(--xeplr-accent, #2563eb)); outline-offset: -2px; border-radius: 6px; }
255
255
 
256
256
  /* The number is the affordance that says "these are ordered" — without it a
257
257
  row of three words reads as tabs, which promise no sequence at all. */
@@ -261,10 +261,10 @@
261
261
  font-size: 12px; font-weight: 600;
262
262
  background: var(--xeplr-tag-bg, #f0efe9); color: var(--xeplr-tag-text, #6b6a63);
263
263
  }
264
- .jb-step--on .jb-step-n { background: var(--accent, #2563eb); color: #fff; }
265
- .jb-step--done .jb-step-n { background: var(--xeplr-status-good-soft, #e7f4ed); color: var(--xeplr-status-good, #1d7a4c); }
264
+ .jb-step--on .jb-step-n { background: var(--accent, var(--xeplr-accent, #2563eb)); color: #fff; }
265
+ .jb-step--done .jb-step-n { background: var(--xeplr-status-good-soft, var(--xeplr-success-bg, #e7f4ed)); color: var(--xeplr-status-good, var(--xeplr-success, #1d7a4c)); }
266
266
 
267
- .jb-step-hint { margin: 10px 0 14px; font-size: 13px; color: var(--muted, #6b6a63); }
267
+ .jb-step-hint { margin: 10px 0 14px; font-size: 13px; color: var(--muted, var(--xeplr-text-secondary, #6b6a63)); }
268
268
 
269
269
  .jb-editor textarea {
270
270
  padding: 9px 11px; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
@@ -272,32 +272,32 @@
272
272
  border: 1px solid var(--xeplr-input-border, #e2e1d9); border-radius: 8px;
273
273
  resize: vertical; width: 100%; box-sizing: border-box;
274
274
  }
275
- .jb-editor textarea:focus { outline: none; border-color: var(--accent, #2563eb); }
275
+ .jb-editor textarea:focus { outline: none; border-color: var(--accent, var(--xeplr-accent, #2563eb)); }
276
276
 
277
277
  /* Cancel on the left, Save on the right, stepping in between — so the
278
278
  destructive and the committing action never sit next to each other. */
279
279
  .jb-editor-nav { display: inline-flex; gap: 8px; margin-left: auto; }
280
280
  .jb-editor-nav button {
281
- padding: 7px 14px; font-size: 13px; color: var(--ink, #1a1a19); background: var(--plane, #f7f7f5);
282
- border: 1px solid var(--hair, #e2e1d9); border-radius: 8px; cursor: pointer;
281
+ padding: 7px 14px; font-size: 13px; color: var(--ink, var(--xeplr-text-primary, #1a1a19)); background: var(--plane, var(--xeplr-bg-tertiary, #f7f7f5));
282
+ border: 1px solid var(--hair, var(--xeplr-border-primary, #e2e1d9)); border-radius: 8px; cursor: pointer;
283
283
  }
284
- .jb-editor-nav button:hover:not(:disabled) { background: var(--surface, #ffffff); border-color: var(--xeplr-border-strong, #cfcec4); }
284
+ .jb-editor-nav button:hover:not(:disabled) { background: var(--surface, var(--xeplr-bg-secondary, #ffffff)); border-color: var(--xeplr-border-strong, var(--xeplr-border-secondary, #cfcec4)); }
285
285
  .jb-editor-nav button:disabled { opacity: .5; cursor: not-allowed; }
286
286
 
287
287
  /* ── advanced, collapsed ───────────────────────────────────────────────── */
288
288
  .jb-advanced {
289
- margin: 4px 0 16px; padding: 0; border-top: 1px solid var(--hair, #e2e1d9);
289
+ margin: 4px 0 16px; padding: 0; border-top: 1px solid var(--hair, var(--xeplr-border-primary, #e2e1d9));
290
290
  }
291
291
  .jb-advanced > summary {
292
292
  padding: 11px 2px; cursor: pointer; font-size: 13px; font-weight: 500;
293
- color: var(--ink, #1a1a19); list-style: none; display: flex; gap: 4px;
293
+ color: var(--ink, var(--xeplr-text-primary, #1a1a19)); list-style: none; display: flex; gap: 4px;
294
294
  align-items: baseline; white-space: nowrap; overflow: hidden;
295
295
  }
296
296
  .jb-advanced > summary::-webkit-details-marker { display: none; }
297
297
  /* A caret we control, so it can turn — the native marker cannot be animated
298
298
  and sits at a different offset in every browser. */
299
299
  .jb-advanced > summary::before {
300
- content: '›'; display: inline-block; font-size: 15px; color: var(--muted, #6b6a63);
300
+ content: '›'; display: inline-block; font-size: 15px; color: var(--muted, var(--xeplr-text-secondary, #6b6a63));
301
301
  transition: transform .12s ease;
302
302
  }
303
303
  .jb-advanced[open] > summary::before { transform: rotate(90deg); }
@@ -322,7 +322,7 @@
322
322
  .jb-switch-track {
323
323
  position: relative; display: inline-block; flex: 0 0 auto;
324
324
  width: 42px; height: 24px; border-radius: 999px;
325
- background: var(--xeplr-border-strong, #b9b9b9);
325
+ background: var(--xeplr-border-strong, var(--xeplr-border-secondary, #b9b9b9));
326
326
  transition: background 140ms ease;
327
327
  }
328
328
  .jb-switch-thumb {
@@ -346,7 +346,7 @@
346
346
  decode the control before they can read the row; "Paused" is the fact they
347
347
  came for. */
348
348
  .jb-switch-label { font-size: 13px; color: var(--xeplr-text-secondary, #666); }
349
- .jb-switch input:checked ~ .jb-switch-label { color: var(--xeplr-text, inherit); }
349
+ .jb-switch input:checked ~ .jb-switch-label { color: var(--xeplr-text, var(--xeplr-text-primary, inherit)); }
350
350
 
351
351
  /* ── ONE OCCURRENCE'S LOG, under its row in the history table ─────────────
352
352
  Bounded height rather than growing the page: a long-running action writes
@@ -365,12 +365,12 @@
365
365
  flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap;
366
366
  }
367
367
  .jb-log-line--warn .jb-log-msg { color: var(--xeplr-warning, #a15c00); }
368
- .jb-log-line--error .jb-log-msg { color: var(--xeplr-error, #b3261e); }
368
+ .jb-log-line--error .jb-log-msg { color: var(--xeplr-error, var(--xeplr-danger, #b3261e)); }
369
369
  /* A bare button wearing .jb-caret — the UA's own chrome removed so the disc
370
370
  the caret draws is the whole control. */
371
371
  .jb-log-toggle { padding: 0; font: inherit; cursor: pointer; }
372
- .jb-log-toggle:hover { color: var(--accent, #2563eb); border-color: var(--accent, #2563eb); }
373
- .jb-log-toggle:focus-visible { outline: 2px solid var(--accent, #2563eb); outline-offset: 2px; }
372
+ .jb-log-toggle:hover { color: var(--accent, var(--xeplr-accent, #2563eb)); border-color: var(--accent, var(--xeplr-accent, #2563eb)); }
373
+ .jb-log-toggle:focus-visible { outline: 2px solid var(--accent, var(--xeplr-accent, #2563eb)); outline-offset: 2px; }
374
374
 
375
375
  /* ── ONE LINE PER ROW ────────────────────────────────────────────────────
376
376
  Every cell stays on its line and ellipsises rather than wrapping. A table
@@ -395,13 +395,13 @@
395
395
  .jb-caret {
396
396
  display: inline-flex; align-items: center; justify-content: center;
397
397
  width: 22px; height: 22px; flex: 0 0 auto;
398
- font-size: 15px; line-height: 1; color: var(--muted, #6b6a63);
399
- border: 1px solid var(--hair, #e2e1d9); border-radius: 50%;
400
- background: var(--surface, #ffffff);
398
+ font-size: 15px; line-height: 1; color: var(--muted, var(--xeplr-text-secondary, #6b6a63));
399
+ border: 1px solid var(--hair, var(--xeplr-border-primary, #e2e1d9)); border-radius: 50%;
400
+ background: var(--surface, var(--xeplr-bg-secondary, #ffffff));
401
401
  transition: transform .12s ease, border-color .12s ease, color .12s ease;
402
402
  }
403
- .jb-lastrun--btn:hover .jb-caret { color: var(--accent, #2563eb); border-color: var(--accent, #2563eb); }
404
- .jb-caret--open { transform: rotate(90deg); color: var(--accent, #2563eb); border-color: var(--accent, #2563eb); }
403
+ .jb-lastrun--btn:hover .jb-caret { color: var(--accent, var(--xeplr-accent, #2563eb)); border-color: var(--accent, var(--xeplr-accent, #2563eb)); }
404
+ .jb-caret--open { transform: rotate(90deg); color: var(--accent, var(--xeplr-accent, #2563eb)); border-color: var(--accent, var(--xeplr-accent, #2563eb)); }
405
405
 
406
406
  /* ── ICON ACTIONS ────────────────────────────────────────────────────────
407
407
  Square targets, the label on hover and to a screen reader. Three worded
@@ -414,14 +414,14 @@
414
414
  }
415
415
  .jb-row-actions button:last-child { margin-right: 0; }
416
416
  .jb-row-actions .jb-danger:hover:not(:disabled) {
417
- color: var(--xeplr-error, #b3261e); border-color: currentColor; background: transparent;
417
+ color: var(--xeplr-error, var(--xeplr-danger, #b3261e)); border-color: currentColor; background: transparent;
418
418
  }
419
419
 
420
420
  /* The chevron is an SVG now, so centring the flex box actually centres the
421
421
  mark — a rotated '>' glyph never sat straight, whatever the box did. */
422
422
  .jb-caret { padding: 0; }
423
423
  .jb-caret .jb-icon { transition: none; }
424
- .jb-linkish { padding: 0; font: inherit; color: var(--accent, #2563eb); background: none; border: 0; cursor: pointer; text-decoration: underline; }
424
+ .jb-linkish { padding: 0; font: inherit; color: var(--accent, var(--xeplr-accent, #2563eb)); background: none; border: 0; cursor: pointer; text-decoration: underline; }
425
425
 
426
426
  /* ── on a phone ──────────────────────────────────────────────────────────
427
427
  The search, sort and New button wrap instead of running off the edge; the
@@ -444,5 +444,11 @@
444
444
  .jb-picks-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 16px; max-height: 240px; overflow: auto; }
445
445
  .jb-pick { display: flex; align-items: center; gap: 8px; min-width: 0; cursor: pointer; }
446
446
  .jb-pick span { overflow-wrap: anywhere; }
447
- .jb-pick input[type="checkbox"] { width: 16px; height: 16px; padding: 0; margin: 0; flex: none; accent-color: var(--accent, #2563eb); }
447
+ .jb-pick input[type="checkbox"] { width: 16px; height: 16px; padding: 0; margin: 0; flex: none; accent-color: var(--accent, var(--xeplr-accent, #2563eb)); }
448
448
  .jb-pick { font-weight: 400; }
449
+
450
+ /* A system job (@xeplr/jobs migrations/0012): marked, and the reason said
451
+ under the table in plain words. */
452
+ .jb-pill--system { background: var(--xeplr-tag-bg, #f0efe9); color: var(--xeplr-text-secondary, #6b6a63); margin-left: 6px; }
453
+ .jb-system-note { margin: 8px 0 0; font-size: 13px; color: var(--muted, var(--xeplr-text-secondary, #6b6a63)); }
454
+ .jb-help--error { color: var(--xeplr-danger, #b42318); }
@@ -9,6 +9,7 @@ import {
9
9
  } from '../api/jobs.js'
10
10
  import {
11
11
  jobState, STATE_LABELS, describeCron, nextRunLabel, durationLabel,
12
+ isSystemJob, SYSTEM_JOB_TEXT, timezoneProblem,
12
13
  latestByJob, prepareJobs, progressLabel, progressStale, lastSeenLabel
13
14
  } from './jobsList.js'
14
15
  import CronScheduleField from '../components/CronScheduleField.jsx'
@@ -524,6 +525,9 @@ function JobEditor({ job, jobs, actions, onCancel, onSaved, stepKey, onStep }) {
524
525
  description: job?.description || '',
525
526
  actionName: job?.actionName || '',
526
527
  schedule: job?.schedule || '',
528
+ // The zone the schedule is read in (@xeplr/jobs migrations/0011). Empty:
529
+ // the server's.
530
+ timezone: job?.timezone || '',
527
531
  // 'ready' | 'pause' — see xeplr-jobs migrations/0001_jobs.js. Editable
528
532
  // HERE and not only from the list, because "write it now, start it later"
529
533
  // is a normal thing to want: a job saved from this panel used to go
@@ -606,6 +610,7 @@ function JobEditor({ job, jobs, actions, onCancel, onSaved, stepKey, onStep }) {
606
610
  // as manual-only, and an empty string is a cron expression the picker
607
611
  // would try to parse.
608
612
  schedule: draft.schedule.trim() || null,
613
+ timezone: draft.schedule.trim() && draft.timezone.trim() ? draft.timezone.trim() : null,
609
614
  // A job with no schedule is manual-only, so 'ready' vs 'pause' says
610
615
  // nothing about it — the picker never looks at it either way. Sent as
611
616
  // 'ready' so it does not sit in the list wearing a Paused badge that
@@ -748,6 +753,19 @@ function JobEditor({ job, jobs, actions, onCancel, onSaved, stepKey, onStep }) {
748
753
  <>
749
754
  <CronScheduleField id="jb-sched" value={draft.schedule} onChange={(schedule) => patch({ schedule })} />
750
755
 
756
+ {/* WHERE "9:00" IS. A schedule is read in this zone; empty is the
757
+ server's, which is what every job did before there was a choice. */}
758
+ {draft.schedule.trim() && (
759
+ <div className="jb-field">
760
+ <label htmlFor="jb-tz">Time zone</label>
761
+ <input id="jb-tz" value={draft.timezone} placeholder="Asia/Kolkata"
762
+ onChange={(e) => patch({ timezone: e.target.value })} />
763
+ <span className={timezoneProblem(draft.timezone) ? 'jb-help jb-help--error' : 'jb-help'}>
764
+ {timezoneProblem(draft.timezone) || 'The schedule runs at these times in this zone. Empty: the server\'s own time.'}
765
+ </span>
766
+ </div>
767
+ )}
768
+
751
769
  {/* ACTIVE OR PAUSED, decided while writing the job rather than after it
752
770
  is already live — "save it, but do not start it yet" is a normal
753
771
  thing to want, and without this the only way to author a scheduled
@@ -893,7 +911,7 @@ function JobEditor({ job, jobs, actions, onCancel, onSaved, stepKey, onStep }) {
893
911
  </span>
894
912
  {/* AVAILABLE ON EVERY STEP. Changing one job's cron should not mean
895
913
  walking past its name and its inputs to reach a button. */}
896
- <button type="submit" className="jb-primary" disabled={saving || !draft.actionName}>
914
+ <button type="submit" className="jb-primary" disabled={saving || !draft.actionName || Boolean(timezoneProblem(draft.timezone))}>
897
915
  {saving ? 'Saving…' : 'Save job'}
898
916
  </button>
899
917
  </div>
@@ -967,6 +985,10 @@ export default function Jobs({ breadcrumb: Breadcrumb, uploadLink } = {}) {
967
985
 
968
986
  useEffect(() => { load() }, [load])
969
987
 
988
+ // An OPEN history follows the run list: when a run finishes, the live
989
+ // updates reload `runs`, and the history must not keep showing it Running.
990
+ useEffect(() => { setRunsVersion((v) => v + 1) }, [runs])
991
+
970
992
  // ── LIVE UPDATES ────────────────────────────────────────────────────────
971
993
  //
972
994
  // This used to call load() on a timer, which is three requests — the job
@@ -1123,7 +1145,13 @@ export default function Jobs({ breadcrumb: Breadcrumb, uploadLink } = {}) {
1123
1145
  </p>
1124
1146
  )}
1125
1147
 
1126
- {editing && (
1148
+ {/* A link straight to a system job's editor (?edit=<id>) gets the
1149
+ reason instead of a form whose Save would be refused. */}
1150
+ {editing && isSystemJob(editing) && (
1151
+ <p className="jb-system-note"><span className="jb-pill jb-pill--system">System</span> {SYSTEM_JOB_TEXT}</p>
1152
+ )}
1153
+
1154
+ {editing && !isSystemJob(editing) && (
1127
1155
  <JobEditor
1128
1156
  // A new job filled in from a link is checked against the actions,
1129
1157
  // so it starts again once they have loaded.
@@ -1187,6 +1215,7 @@ export default function Jobs({ breadcrumb: Breadcrumb, uploadLink } = {}) {
1187
1215
  <td className="jb-cell-job" title={job.description || job.name}>
1188
1216
  <span className="jb-name">{job.name}</span>
1189
1217
  <StatePill state={state} />
1218
+ {isSystemJob(job) && <span className="jb-pill jb-pill--system" title={SYSTEM_JOB_TEXT}>System</span>}
1190
1219
  {/* WHAT IT HAS DONE SO FAR, next to the pill that says it
1191
1220
  is running. Absent until the first throttled write
1192
1221
  lands, and absent forever for an action that reports
@@ -1265,6 +1294,9 @@ export default function Jobs({ breadcrumb: Breadcrumb, uploadLink } = {}) {
1265
1294
  and disabled rather than absent, which would leave a
1266
1295
  hole in the column. */}
1267
1296
  <td className="jb-row-toggle">
1297
+ {isSystemJob(job) ? (
1298
+ <span className="jb-dim" title={SYSTEM_JOB_TEXT}>Always on</span>
1299
+ ) : (
1268
1300
  <label className="jb-switch"
1269
1301
  title={!job.schedule
1270
1302
  ? 'No schedule — there is nothing for the scheduler to pick up'
@@ -1284,6 +1316,7 @@ export default function Jobs({ breadcrumb: Breadcrumb, uploadLink } = {}) {
1284
1316
  {!job.schedule ? 'No schedule' : job.status === 'pause' ? 'Paused' : 'On'}
1285
1317
  </span>
1286
1318
  </label>
1319
+ )}
1287
1320
  </td>
1288
1321
  {/* ICONS, with the words moved into title/aria-label.
1289
1322
  Three labelled buttons per row is a paragraph of text
@@ -1296,14 +1329,19 @@ export default function Jobs({ breadcrumb: Breadcrumb, uploadLink } = {}) {
1296
1329
  onClick={() => act(job.id, triggerJob, 'Could not trigger the job')}>
1297
1330
  <Icon path={ICON_RUN} size={14} />
1298
1331
  </button>
1299
- <button type="button" disabled={busy} title="Edit" aria-label="Edit"
1300
- onClick={() => setEditing(job)}>
1301
- <Icon path={ICON_EDIT} />
1302
- </button>
1303
- <button type="button" className="jb-danger" disabled={busy}
1304
- title="Delete" aria-label="Delete" onClick={() => remove(job)}>
1305
- <Icon path={ICON_DELETE} />
1306
- </button>
1332
+ {/* A system job is run, never changed: no Edit, no Delete. */}
1333
+ {!isSystemJob(job) && (
1334
+ <>
1335
+ <button type="button" disabled={busy} title="Edit" aria-label="Edit"
1336
+ onClick={() => setEditing(job)}>
1337
+ <Icon path={ICON_EDIT} />
1338
+ </button>
1339
+ <button type="button" className="jb-danger" disabled={busy}
1340
+ title="Delete" aria-label="Delete" onClick={() => remove(job)}>
1341
+ <Icon path={ICON_DELETE} />
1342
+ </button>
1343
+ </>
1344
+ )}
1307
1345
  </td>
1308
1346
  </tr>
1309
1347
  {open && (
@@ -1318,6 +1356,11 @@ export default function Jobs({ breadcrumb: Breadcrumb, uploadLink } = {}) {
1318
1356
  })}
1319
1357
  </tbody>
1320
1358
  </table>
1359
+ {/* SAID, not only hovered: why the System row has no switch, Edit
1360
+ or Delete. */}
1361
+ {rows.some(isSystemJob) && (
1362
+ <p className="jb-system-note"><span className="jb-pill jb-pill--system">System</span> {SYSTEM_JOB_TEXT}</p>
1363
+ )}
1321
1364
  {rows.length === 0 && (
1322
1365
  <div className="jb-empty jb-empty--inline">
1323
1366
  <p className="muted">Nothing matches “{query}”.</p>
@@ -17,6 +17,29 @@ export function jobState(job) {
17
17
  return 'scheduled'
18
18
  }
19
19
 
20
+ /**
21
+ * A JOB OF THE INSTALL ITSELF (@xeplr/jobs migrations/0012): listed to every
22
+ * company, changed by no one — the server refuses to save, pause or delete it
23
+ * for every caller. The screen says so rather than offering buttons that fail.
24
+ */
25
+ export function isSystemJob(job) {
26
+ return Boolean(job && job.system)
27
+ }
28
+
29
+ /** Why a system job cannot be changed, in the words the screen shows. */
30
+ export const SYSTEM_JOB_TEXT = 'This is a system job. It does the workflows\' due work for every company — ' +
31
+ 'Wait boxes that run out of time, reminders and escalations, and runs that stopped halfway — ' +
32
+ 'so it cannot be changed, paused or deleted. You can still run it now.'
33
+
34
+ /** A time zone the browser can read (an IANA name such as Asia/Kolkata); blank is fine — the server's. */
35
+ export function timezoneProblem(zone) {
36
+ const z = (zone || '').trim()
37
+ if (!z) return null
38
+ try { new Intl.DateTimeFormat('en-GB', { timeZone: z }); return null } catch (e) {
39
+ return `"${z}" is not a time zone. Use a name such as Asia/Kolkata or Europe/London, or leave it empty for the server's.`
40
+ }
41
+ }
42
+
20
43
  export const STATE_LABELS = {
21
44
  running: 'Running',
22
45
  paused: 'Paused',