solid_queue_board 0.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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +22 -0
- data/LICENSE.txt +21 -0
- data/README.md +131 -0
- data/app/controllers/solid_queue_board/application_controller.rb +42 -0
- data/app/controllers/solid_queue_board/jobs_controller.rb +60 -0
- data/app/controllers/solid_queue_board/processes_controller.rb +12 -0
- data/app/controllers/solid_queue_board/queues_controller.rb +21 -0
- data/app/controllers/solid_queue_board/recurring_tasks_controller.rb +23 -0
- data/app/helpers/solid_queue_board/application_helper.rb +162 -0
- data/app/models/solid_queue_board/job_record.rb +13 -0
- data/app/models/solid_queue_board/jobs_query.rb +101 -0
- data/app/views/layouts/solid_queue_board/application.html.erb +53 -0
- data/app/views/layouts/solid_queue_board/partial.html.erb +3 -0
- data/app/views/solid_queue_board/jobs/_empty.html.erb +1 -0
- data/app/views/solid_queue_board/jobs/_pager.html.erb +11 -0
- data/app/views/solid_queue_board/jobs/_row.html.erb +53 -0
- data/app/views/solid_queue_board/jobs/_toolbar.html.erb +25 -0
- data/app/views/solid_queue_board/jobs/index.html.erb +23 -0
- data/app/views/solid_queue_board/processes/index.html.erb +85 -0
- data/app/views/solid_queue_board/queues/index.html.erb +34 -0
- data/app/views/solid_queue_board/recurring_tasks/index.html.erb +50 -0
- data/app/views/solid_queue_board/shared/_flash.html.erb +6 -0
- data/app/views/solid_queue_board/shared/_nav.html.erb +14 -0
- data/config/locales/de.yml +149 -0
- data/config/locales/en.yml +149 -0
- data/config/locales/es.yml +149 -0
- data/config/locales/fr.yml +149 -0
- data/config/locales/it.yml +149 -0
- data/config/locales/ja.yml +149 -0
- data/config/locales/ko.yml +149 -0
- data/config/locales/pt.yml +149 -0
- data/config/locales/zh-CN.yml +149 -0
- data/config/routes.rb +30 -0
- data/lib/solid_queue_board/engine.rb +24 -0
- data/lib/solid_queue_board/version.rb +5 -0
- data/lib/solid_queue_board/web/board.css +258 -0
- data/lib/solid_queue_board/web/board.js +358 -0
- data/lib/solid_queue_board.rb +51 -0
- metadata +159 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
/* Solid Queue Board: Bootstrap-3-style, square corners, light and dark.
|
|
2
|
+
Self-contained: system fonts only, no external resources. */
|
|
3
|
+
:root {
|
|
4
|
+
--bg: #f5f5f5; --surface: #ffffff; --fg: #333333; --muted: #777777; --line: #dddddd; --line-strong: #cccccc;
|
|
5
|
+
--head-bg: #ffffff; --row-alt: #f9f9f9; --hover: #f5f5f5; --detail-bg: #fcfcfc; --pre-bg: #f5f5f5;
|
|
6
|
+
--code-fg: #333333; --link: #337ab7; --input-line: #cccccc; --btn-bg: #ffffff; --btn-hover: #e6e6e6;
|
|
7
|
+
--accent: #337ab7; --accent-line: #2e6da4; --accent-fg: #ffffff; --badge-bg: #777777; --label-fg: #ffffff;
|
|
8
|
+
--primary: #337ab7; --ok: #5cb85c; --info: #5bc0de; --warn: #f0ad4e; --err: #d9534f; --idle: #777777;
|
|
9
|
+
--ok-ink: #3c763d; --err-ink: #a94442; --ok-bg: #dff0d8; --err-bg: #f2dede; --ok-bd: #d6e9c6; --err-bd: #ebccd1;
|
|
10
|
+
--bar-bg: #222222; --bar-fg: #ffffff; --bar-muted: #9d9d9d; --bar-line: #080808;
|
|
11
|
+
--flash: rgba(240, 173, 78, .28);
|
|
12
|
+
--f-ui: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
13
|
+
--f-mono: Menlo, Monaco, Consolas, "Courier New", monospace;
|
|
14
|
+
color-scheme: light;
|
|
15
|
+
}
|
|
16
|
+
@media (prefers-color-scheme: dark) {
|
|
17
|
+
:root:not([data-theme="light"]) {
|
|
18
|
+
--bg: #1c1f23; --surface: #24282d; --fg: #dde1e6; --muted: #9aa3ad; --line: #3a4048; --line-strong: #4a5059;
|
|
19
|
+
--head-bg: #2b3036; --row-alt: #282c31; --hover: #2e343b; --detail-bg: #202327; --pre-bg: #1a1d20;
|
|
20
|
+
--code-fg: #e6c07b; --link: #6fb0ea; --input-line: #4a5059; --btn-bg: #2f343a; --btn-hover: #3a4047;
|
|
21
|
+
--accent: #3d8bd0; --accent-line: #3a7fbf; --accent-fg: #ffffff; --badge-bg: #5c646e; --label-fg: #ffffff;
|
|
22
|
+
--primary: #3d8bd0; --ok: #449d44; --info: #2f96b4; --warn: #c88a2e; --err: #c9302c; --idle: #5c646e;
|
|
23
|
+
--ok-ink: #7ccf7c; --err-ink: #f08a86; --ok-bg: #1f3320; --err-bg: #3d2020; --ok-bd: #2c4a2d; --err-bd: #5a2d2d;
|
|
24
|
+
--bar-bg: #111315; --bar-fg: #e6e9ec; --bar-muted: #8e959d; --bar-line: #000000;
|
|
25
|
+
--flash: rgba(240, 173, 78, .18);
|
|
26
|
+
color-scheme: dark;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
:root[data-theme="dark"] {
|
|
30
|
+
--bg: #1c1f23; --surface: #24282d; --fg: #dde1e6; --muted: #9aa3ad; --line: #3a4048; --line-strong: #4a5059;
|
|
31
|
+
--head-bg: #2b3036; --row-alt: #282c31; --hover: #2e343b; --detail-bg: #202327; --pre-bg: #1a1d20;
|
|
32
|
+
--code-fg: #e6c07b; --link: #6fb0ea; --input-line: #4a5059; --btn-bg: #2f343a; --btn-hover: #3a4047;
|
|
33
|
+
--accent: #3d8bd0; --accent-line: #3a7fbf; --accent-fg: #ffffff; --badge-bg: #5c646e; --label-fg: #ffffff;
|
|
34
|
+
--primary: #3d8bd0; --ok: #449d44; --info: #2f96b4; --warn: #c88a2e; --err: #c9302c; --idle: #5c646e;
|
|
35
|
+
--ok-ink: #7ccf7c; --err-ink: #f08a86; --ok-bg: #1f3320; --err-bg: #3d2020; --ok-bd: #2c4a2d; --err-bd: #5a2d2d;
|
|
36
|
+
--bar-bg: #111315; --bar-fg: #e6e9ec; --bar-muted: #8e959d; --bar-line: #000000;
|
|
37
|
+
--flash: rgba(240, 173, 78, .18);
|
|
38
|
+
color-scheme: dark;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
*, *::before, *::after { box-sizing: border-box; }
|
|
42
|
+
html, body { margin: 0; }
|
|
43
|
+
body { background: var(--bg); color: var(--fg); font-family: var(--f-ui); font-size: 14px; line-height: 1.42857; }
|
|
44
|
+
a { color: var(--link); text-decoration: none; }
|
|
45
|
+
a:hover { text-decoration: underline; }
|
|
46
|
+
a.plain { color: inherit; }
|
|
47
|
+
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
|
|
48
|
+
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
49
|
+
|
|
50
|
+
/* Top bar (navbar-inverse) */
|
|
51
|
+
.bar {
|
|
52
|
+
display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between;
|
|
53
|
+
min-height: 50px; padding: 8px max(15px, env(safe-area-inset-right, 0px)) 8px max(15px, env(safe-area-inset-left, 0px));
|
|
54
|
+
background: var(--bar-bg); color: var(--bar-fg); border-bottom: 1px solid var(--bar-line);
|
|
55
|
+
}
|
|
56
|
+
.brand { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
|
|
57
|
+
.brand .logo { font-size: 18px; }
|
|
58
|
+
.brand .env { font-family: var(--f-mono); font-size: 12px; color: var(--bar-muted); }
|
|
59
|
+
.tools { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; font-size: 13px; color: var(--bar-muted); }
|
|
60
|
+
/* Live button: dot + interval; click cycles the interval. Theme: icon button. */
|
|
61
|
+
.live, .bar-icon {
|
|
62
|
+
display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12.5px; cursor: pointer; white-space: nowrap;
|
|
63
|
+
color: var(--bar-fg); background: transparent; border: 1px solid var(--bar-muted); padding: 3px 10px; border-radius: 0;
|
|
64
|
+
}
|
|
65
|
+
.live:hover, .bar-icon:hover { border-color: var(--bar-fg); }
|
|
66
|
+
.bar-icon { justify-content: center; width: 30px; padding: 3px 0; font-size: 14px; line-height: 1.2; }
|
|
67
|
+
.live i { width: 8px; height: 8px; background: var(--ok); display: inline-block; }
|
|
68
|
+
.live.off i { background: var(--idle); }
|
|
69
|
+
.live.error i { background: var(--err); }
|
|
70
|
+
.live.busy i { animation: sqb-blink .5s steps(2) infinite; }
|
|
71
|
+
@keyframes sqb-blink { 50% { opacity: .2; } }
|
|
72
|
+
.bar-link { color: var(--bar-fg); font-size: 12.5px; }
|
|
73
|
+
|
|
74
|
+
/* Single menu row: job states | sections */
|
|
75
|
+
.tabs { display: flex; overflow-x: auto; background: var(--bg); border-bottom: 1px solid var(--line); padding: 0 max(0px, env(safe-area-inset-left, 0px)); }
|
|
76
|
+
.tab {
|
|
77
|
+
display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 10px 15px;
|
|
78
|
+
color: var(--link); text-decoration: none;
|
|
79
|
+
}
|
|
80
|
+
.tab:hover { background: var(--hover); text-decoration: none; }
|
|
81
|
+
.tab[aria-current="page"] { color: var(--fg); background: var(--surface); box-shadow: inset 0 -3px 0 var(--accent); }
|
|
82
|
+
.tab-sep { flex: none; width: 1px; background: var(--line); margin: 8px 6px; align-self: stretch; }
|
|
83
|
+
.badge { display: inline-block; min-width: 10px; padding: 3px 7px; font-size: 12px; font-weight: 700; line-height: 1; color: #ffffff; background: var(--badge-bg); text-align: center; border-radius: 0; }
|
|
84
|
+
.badge.danger { background: var(--err); }
|
|
85
|
+
.badge.warning { background: var(--warn); }
|
|
86
|
+
.badge.info { background: var(--info); }
|
|
87
|
+
|
|
88
|
+
.panel {
|
|
89
|
+
display: grid; gap: 12px; min-width: 0;
|
|
90
|
+
padding: 15px max(15px, env(safe-area-inset-right, 0px)) 30px max(15px, env(safe-area-inset-left, 0px));
|
|
91
|
+
}
|
|
92
|
+
.flash { padding: 15px 15px 0; display: grid; gap: 8px; }
|
|
93
|
+
.alert { padding: 10px 15px; border: 1px solid transparent; }
|
|
94
|
+
.alert-success { background: var(--ok-bg); border-color: var(--ok-bd); color: var(--ok-ink); }
|
|
95
|
+
.alert-danger { background: var(--err-bg); border-color: var(--err-bd); color: var(--err-ink); }
|
|
96
|
+
|
|
97
|
+
/* Forms and buttons */
|
|
98
|
+
.toolbar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
|
|
99
|
+
.toolbar-right, .search-form, .row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
|
|
100
|
+
.search-form, .toolbar-right form, .row-actions form { margin: 0; }
|
|
101
|
+
.input {
|
|
102
|
+
font: inherit; font-size: 13px; color: var(--fg); background: var(--surface); border: 1px solid var(--input-line);
|
|
103
|
+
padding: 5px 10px; width: 240px; max-width: 100%; min-width: 0; border-radius: 0; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
|
104
|
+
}
|
|
105
|
+
select.input { width: auto; max-width: 220px; height: calc(1.42857em + 12px); padding: 0 6px; }
|
|
106
|
+
.btn {
|
|
107
|
+
display: inline-block; font: inherit; font-size: 13px; line-height: 1.42857; cursor: pointer; color: var(--fg);
|
|
108
|
+
background: var(--btn-bg); border: 1px solid var(--input-line); padding: 5px 10px; border-radius: 0; white-space: nowrap; text-decoration: none;
|
|
109
|
+
}
|
|
110
|
+
.btn:hover { background: var(--btn-hover); text-decoration: none; }
|
|
111
|
+
.btn-primary { background: var(--accent); border-color: var(--accent-line); color: var(--accent-fg); }
|
|
112
|
+
.btn-primary:hover { background: var(--accent-line); }
|
|
113
|
+
.btn-danger { background: var(--err); border-color: var(--err); color: #ffffff; }
|
|
114
|
+
.btn-danger:hover { background: var(--err-ink); }
|
|
115
|
+
.btn-link { background: transparent; border-color: transparent; color: var(--link); }
|
|
116
|
+
.btn-sm { font-size: 12px; padding: 2px 8px; }
|
|
117
|
+
|
|
118
|
+
/* Tables (table-bordered + table-striped) */
|
|
119
|
+
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--surface); }
|
|
120
|
+
table { border-collapse: collapse; width: 100%; min-width: 760px; font-variant-numeric: tabular-nums; }
|
|
121
|
+
th, td { padding: 8px 10px; text-align: left; vertical-align: top; border-top: 1px solid var(--line); }
|
|
122
|
+
thead th { border-top: 0; border-bottom: 2px solid var(--line); background: var(--head-bg); font-weight: 700; white-space: nowrap; }
|
|
123
|
+
tbody tr:nth-child(even) td { background: var(--row-alt); }
|
|
124
|
+
/* jobs table: every job is a row pair (summary + hidden detail), so stripe by pairs */
|
|
125
|
+
table.with-details tbody tr:nth-child(4n+1) td, table.with-details tbody tr:nth-child(4n+2) td { background: var(--surface); }
|
|
126
|
+
table.with-details tbody tr:nth-child(4n+3) td, table.with-details tbody tr:nth-child(4n+4) td { background: var(--row-alt); }
|
|
127
|
+
tbody tr.clickable { cursor: pointer; }
|
|
128
|
+
tbody tr.clickable:hover td { background: var(--hover); }
|
|
129
|
+
tbody tr.detail td { background: var(--detail-bg); padding: 12px 10px 14px; }
|
|
130
|
+
tbody tr.changed td { animation: sqb-flash 1s ease-out; }
|
|
131
|
+
@keyframes sqb-flash { from { background: var(--flash); } }
|
|
132
|
+
/* new job: one long green pulse, longer than the "changed" flash */
|
|
133
|
+
tbody tr.added td { animation: sqb-added 4s ease-in-out; }
|
|
134
|
+
/* new row grows from zero height (JS wraps each cell's content while it animates) */
|
|
135
|
+
.sqb-grow { overflow: hidden; }
|
|
136
|
+
@keyframes sqb-added {
|
|
137
|
+
0%, 35% { background: color-mix(in srgb, var(--ok) 38%, transparent); }
|
|
138
|
+
}
|
|
139
|
+
th.num, td.num { text-align: right; }
|
|
140
|
+
th a.sort { color: inherit; text-decoration: none; white-space: nowrap; }
|
|
141
|
+
th a.sort:hover { color: var(--link); }
|
|
142
|
+
th .sort-dir { font-size: 10px; color: var(--muted); }
|
|
143
|
+
|
|
144
|
+
/* Content bits */
|
|
145
|
+
.mono { font-family: var(--f-mono); font-size: 12px; }
|
|
146
|
+
.small { font-size: 12.5px; }
|
|
147
|
+
.muted { color: var(--muted); }
|
|
148
|
+
.nowrap { white-space: nowrap; }
|
|
149
|
+
.cls { font-family: var(--f-mono); font-size: 12.5px; color: var(--code-fg); }
|
|
150
|
+
.args { font-family: var(--f-mono); font-size: 11.5px; color: var(--muted); word-break: break-all; }
|
|
151
|
+
.err-msg { color: var(--err-ink); font-family: var(--f-mono); font-size: 12px; word-break: break-word; }
|
|
152
|
+
.detail-grid { display: grid; gap: 10px; min-width: 0; }
|
|
153
|
+
pre.code {
|
|
154
|
+
margin: 0; padding: 9.5px; overflow-x: auto; max-width: 100%; font-family: var(--f-mono); font-size: 12px; line-height: 1.5;
|
|
155
|
+
background: var(--pre-bg); border: 1px solid var(--line); color: var(--fg); white-space: pre;
|
|
156
|
+
}
|
|
157
|
+
dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; margin: 0; }
|
|
158
|
+
dl.kv dt { color: var(--muted); font-size: 12.5px; }
|
|
159
|
+
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
|
|
160
|
+
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
|
|
161
|
+
.empty strong { display: block; color: var(--fg); margin-bottom: 4px; }
|
|
162
|
+
#sqb-toolbar, #sqb-pager { display: contents; }
|
|
163
|
+
/* rows switch to display: block on small screens; keep closed details closed */
|
|
164
|
+
[hidden] { display: none !important; }
|
|
165
|
+
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; }
|
|
166
|
+
|
|
167
|
+
/* Status: colored square + word. Each tone sets --tone, also used by the row stripe. */
|
|
168
|
+
.tone-primary, .label-primary { --tone: var(--primary); }
|
|
169
|
+
.tone-info, .label-info { --tone: var(--info); }
|
|
170
|
+
.tone-warning, .label-warning { --tone: var(--warn); }
|
|
171
|
+
.tone-danger, .label-danger { --tone: var(--err); }
|
|
172
|
+
.tone-success, .label-success { --tone: var(--ok); }
|
|
173
|
+
.tone-default, .label-default { --tone: var(--idle); }
|
|
174
|
+
.label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; white-space: nowrap; color: var(--fg); }
|
|
175
|
+
.label::before { content: ""; flex: none; width: 9px; height: 9px; background: var(--tone, var(--idle)); }
|
|
176
|
+
|
|
177
|
+
/* Jobs table: stripe on the left, actions on hover */
|
|
178
|
+
table.jobs > tbody > tr[class*="tone-"] > td:first-child,
|
|
179
|
+
table.procs > tbody > tr[class*="tone-"] > td:first-child { box-shadow: inset 3px 0 0 var(--tone); }
|
|
180
|
+
table.procs .c-beat, table.procs .c-status { white-space: nowrap; }
|
|
181
|
+
table.jobs .c-status { width: 1%; white-space: nowrap; }
|
|
182
|
+
table.jobs .c-queue { width: 1%; white-space: nowrap; }
|
|
183
|
+
table.jobs .c-when { width: 1%; white-space: nowrap; }
|
|
184
|
+
table.jobs .c-actions { width: 1%; white-space: nowrap; text-align: right; }
|
|
185
|
+
table.jobs .row-actions { justify-content: flex-end; flex-wrap: nowrap; visibility: hidden; }
|
|
186
|
+
table.jobs tr:hover .row-actions, table.jobs tr:focus-within .row-actions, table.jobs tr[aria-expanded="true"] .row-actions { visibility: visible; }
|
|
187
|
+
@media (hover: none) { table.jobs .row-actions { visibility: visible; } }
|
|
188
|
+
.runs { margin-left: 6px; font-family: var(--f-mono); font-size: 11.5px; color: var(--muted); }
|
|
189
|
+
.sub { font-size: 11.5px; color: var(--muted); white-space: normal; }
|
|
190
|
+
.sub .err-msg { font-size: 11.5px; }
|
|
191
|
+
.btn-discard { color: var(--err-ink); }
|
|
192
|
+
.btn-discard:hover { background: var(--err-bg); }
|
|
193
|
+
|
|
194
|
+
@media (max-width: 600px) {
|
|
195
|
+
.bar { align-items: center; }
|
|
196
|
+
.brand .env { display: none; }
|
|
197
|
+
.input { width: 100%; }
|
|
198
|
+
.search-form { flex: 1 1 100%; }
|
|
199
|
+
.search-form .input { flex: 1; width: auto; }
|
|
200
|
+
.search-form select.input { flex: 1 1 100%; max-width: none; }
|
|
201
|
+
|
|
202
|
+
/* cards: the background and the status stripe go on the row, so the row padding does not leave gaps */
|
|
203
|
+
.tbl-wrap table.with-details > tbody > tr > td { background: transparent; }
|
|
204
|
+
.tbl-wrap table.with-details > tbody > tr:nth-child(4n+1), .tbl-wrap table.with-details > tbody > tr:nth-child(4n+2) { background: var(--surface); }
|
|
205
|
+
.tbl-wrap table.with-details > tbody > tr:nth-child(4n+3), .tbl-wrap table.with-details > tbody > tr:nth-child(4n+4) { background: var(--row-alt); }
|
|
206
|
+
.tbl-wrap table.with-details > tbody > tr.detail { background: var(--detail-bg); }
|
|
207
|
+
.tbl-wrap table.with-details > tbody > tr.clickable:hover { background: var(--hover); }
|
|
208
|
+
|
|
209
|
+
/* jobs become cards: job + status, then time + actions */
|
|
210
|
+
table.jobs { min-width: 0; }
|
|
211
|
+
table.jobs thead { display: none; }
|
|
212
|
+
table.jobs, table.jobs tbody, table.jobs td { display: block; }
|
|
213
|
+
table.jobs td { border-top: 0; }
|
|
214
|
+
table.jobs > tbody > tr { display: block; border-top: 1px solid var(--line); }
|
|
215
|
+
table.jobs > tbody > tr:first-child { border-top: 0; }
|
|
216
|
+
table.jobs > tbody > tr.clickable {
|
|
217
|
+
display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "job status" "when actions";
|
|
218
|
+
padding: 6px 0; box-shadow: inset 3px 0 0 var(--tone);
|
|
219
|
+
}
|
|
220
|
+
table.jobs > tbody > tr.detail { box-shadow: inset 3px 0 0 var(--tone); border-top: 0; }
|
|
221
|
+
table.jobs > tbody > tr[class*="tone-"] > td:first-child { box-shadow: none; }
|
|
222
|
+
table.jobs .c-job { grid-area: job; } table.jobs .c-status { grid-area: status; width: auto; }
|
|
223
|
+
table.jobs .c-when { grid-area: when; width: auto; white-space: normal; }
|
|
224
|
+
table.jobs .c-actions { grid-area: actions; width: auto; align-self: end; }
|
|
225
|
+
table.jobs .c-queue { display: none; }
|
|
226
|
+
table.jobs > tbody > tr.clickable > td { padding: 3px 10px; }
|
|
227
|
+
table.jobs .row-actions { visibility: visible; }
|
|
228
|
+
|
|
229
|
+
/* processes become cards: kind + status, name, host · PID · running, heartbeat */
|
|
230
|
+
table.procs { min-width: 0; }
|
|
231
|
+
table.procs thead { display: none; }
|
|
232
|
+
table.procs, table.procs tbody, table.procs td { display: block; }
|
|
233
|
+
table.procs td { border-top: 0; }
|
|
234
|
+
table.procs > tbody > tr { display: block; border-top: 1px solid var(--line); }
|
|
235
|
+
table.procs > tbody > tr:first-child { border-top: 0; }
|
|
236
|
+
table.procs > tbody > tr.clickable {
|
|
237
|
+
display: flex; flex-wrap: wrap; align-items: baseline; padding: 6px 0; box-shadow: inset 3px 0 0 var(--tone);
|
|
238
|
+
}
|
|
239
|
+
table.procs > tbody > tr.detail { box-shadow: inset 3px 0 0 var(--tone); border-top: 0; }
|
|
240
|
+
table.procs > tbody > tr[class*="tone-"] > td:first-child { box-shadow: none; }
|
|
241
|
+
table.procs > tbody > tr.clickable > td { padding: 2px 10px; min-width: 0; text-align: left; }
|
|
242
|
+
table.procs .c-kind { order: 1; flex: 1 1 auto; }
|
|
243
|
+
table.procs .c-status { order: 2; flex: none; }
|
|
244
|
+
table.procs .c-name { order: 3; flex: 1 1 100%; font-size: 11.5px; color: var(--muted); word-break: break-all; }
|
|
245
|
+
table.procs .c-host, table.procs .c-pid, table.procs .c-run { flex: none; font-size: 11.5px; }
|
|
246
|
+
table.procs .c-host { order: 4; } table.procs .c-pid { order: 5; } table.procs .c-run { order: 6; }
|
|
247
|
+
table.procs .c-host { max-width: 100%; word-break: break-all; }
|
|
248
|
+
table.procs > tbody > tr.clickable > .c-host { padding-right: 0; }
|
|
249
|
+
table.procs > tbody > tr.clickable > .c-pid, table.procs > tbody > tr.clickable > .c-run { padding-left: 0; padding-right: 0; }
|
|
250
|
+
table.procs .c-pid::before, table.procs .c-run::before { content: "\00a0\00b7\00a0" attr(data-label) "\00a0"; color: var(--muted); font-family: var(--f-ui); }
|
|
251
|
+
table.procs .c-run.is-na, table.procs .c-meta { display: none; }
|
|
252
|
+
table.procs .c-beat { order: 7; flex: 1 1 100%; font-size: 11.5px; }
|
|
253
|
+
table.procs .c-beat::before { content: attr(data-label) " "; color: var(--muted); font-family: var(--f-ui); }
|
|
254
|
+
table.procs dl.kv { grid-template-columns: minmax(0, max-content) minmax(0, 1fr); }
|
|
255
|
+
}
|
|
256
|
+
@media (prefers-reduced-motion: reduce) {
|
|
257
|
+
.live.busy i { animation: none; }
|
|
258
|
+
}
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
// Solid Queue Board: theme, auto-refresh polling, expandable rows, confirmations.
|
|
2
|
+
// Plain JS, no dependencies. Polling fetches the same URL with a header: the jobs page gets JSON with one
|
|
3
|
+
// HTML fragment per row (rows are inserted, updated and removed one by one); other pages get HTML that is
|
|
4
|
+
// morphed in place (only new, changed and removed nodes are touched).
|
|
5
|
+
(function () {
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
var root = document.getElementById("sqb");
|
|
9
|
+
if (!root) return;
|
|
10
|
+
|
|
11
|
+
var region = document.getElementById("sqb-region");
|
|
12
|
+
var themeBtn = document.getElementById("sqb-theme");
|
|
13
|
+
var live = document.getElementById("sqb-live");
|
|
14
|
+
var liveLabel = document.getElementById("sqb-live-label");
|
|
15
|
+
var liveStatus = document.getElementById("sqb-live-status");
|
|
16
|
+
|
|
17
|
+
var store = {
|
|
18
|
+
get: function (key, fallback) { try { var v = localStorage.getItem(key); return v === null ? fallback : v; } catch (e) { return fallback; } },
|
|
19
|
+
set: function (key, value) { try { localStorage.setItem(key, value); } catch (e) {} }
|
|
20
|
+
};
|
|
21
|
+
function t(name, vars) {
|
|
22
|
+
var text = root.getAttribute("data-t-" + name) || "";
|
|
23
|
+
Object.keys(vars || {}).forEach(function (k) { text = text.replace("%{" + k + "}", vars[k]); });
|
|
24
|
+
return text;
|
|
25
|
+
}
|
|
26
|
+
function clock(d) {
|
|
27
|
+
function p(n) { return (n < 10 ? "0" : "") + n; }
|
|
28
|
+
return p(d.getHours()) + ":" + p(d.getMinutes()) + ":" + p(d.getSeconds());
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* ---------- theme: one button cycles system, light, dark ---------- */
|
|
32
|
+
var THEMES = ["system", "light", "dark"];
|
|
33
|
+
var THEME_ICONS = { system: "\u25D0", light: "\u2600", dark: "\u263E" };
|
|
34
|
+
function applyTheme(value) {
|
|
35
|
+
if (value === "light" || value === "dark") document.documentElement.setAttribute("data-theme", value);
|
|
36
|
+
else document.documentElement.removeAttribute("data-theme");
|
|
37
|
+
var label = t("theme") + ": " + t("theme-" + value);
|
|
38
|
+
themeBtn.textContent = THEME_ICONS[value];
|
|
39
|
+
themeBtn.title = label;
|
|
40
|
+
themeBtn.setAttribute("aria-label", label);
|
|
41
|
+
}
|
|
42
|
+
var theme = store.get("sqb-theme", "system");
|
|
43
|
+
if (THEMES.indexOf(theme) < 0) theme = "system";
|
|
44
|
+
applyTheme(theme);
|
|
45
|
+
themeBtn.addEventListener("click", function () {
|
|
46
|
+
theme = THEMES[(THEMES.indexOf(theme) + 1) % THEMES.length];
|
|
47
|
+
store.set("sqb-theme", theme);
|
|
48
|
+
applyTheme(theme);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
/* ---------- expandable rows (state survives refreshes) ---------- */
|
|
52
|
+
var openRows = new Set();
|
|
53
|
+
function setRow(row, open) {
|
|
54
|
+
var id = row.getAttribute("data-sqb-toggle");
|
|
55
|
+
var detail = document.getElementById("sqb-detail-" + id);
|
|
56
|
+
if (!detail) return;
|
|
57
|
+
detail.hidden = !open;
|
|
58
|
+
row.setAttribute("aria-expanded", open ? "true" : "false");
|
|
59
|
+
if (open) openRows.add(id); else openRows.delete(id);
|
|
60
|
+
}
|
|
61
|
+
function restoreRows() {
|
|
62
|
+
openRows.forEach(function (id) {
|
|
63
|
+
var row = region.querySelector('[data-sqb-toggle="' + id + '"]');
|
|
64
|
+
if (row) setRow(row, true); else openRows.delete(id);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
region.addEventListener("click", function (event) {
|
|
68
|
+
if (event.target.closest("a, button, form, pre, input")) return;
|
|
69
|
+
var row = event.target.closest("[data-sqb-toggle]");
|
|
70
|
+
if (row) setRow(row, row.getAttribute("aria-expanded") !== "true");
|
|
71
|
+
});
|
|
72
|
+
region.addEventListener("keydown", function (event) {
|
|
73
|
+
var row = event.target.closest("[data-sqb-toggle]");
|
|
74
|
+
if (row && (event.key === "Enter" || event.key === " ")) {
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
setRow(row, row.getAttribute("aria-expanded") !== "true");
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
/* ---------- confirmations on destructive forms ---------- */
|
|
81
|
+
document.addEventListener("submit", function (event) {
|
|
82
|
+
var message = event.target.getAttribute("data-sqb-confirm");
|
|
83
|
+
if (message && !window.confirm(message)) event.preventDefault();
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
/* ---------- filter menus submit on change ---------- */
|
|
87
|
+
document.addEventListener("change", function (event) {
|
|
88
|
+
var field = event.target;
|
|
89
|
+
if (!field.hasAttribute || !field.hasAttribute("data-sqb-autosubmit") || !field.form) return;
|
|
90
|
+
if (field.form.requestSubmit) field.form.requestSubmit(); else field.form.submit();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
/* ---------- polling ---------- */
|
|
94
|
+
var intervals = (root.getAttribute("data-poll-intervals") || "0").split(",").map(function (v) { return parseInt(v, 10) || 0; });
|
|
95
|
+
var interval = parseInt(store.get("sqb-poll", root.getAttribute("data-poll-default")), 10) || 0;
|
|
96
|
+
if (intervals.indexOf(interval) < 0) interval = parseInt(root.getAttribute("data-poll-default"), 10) || 0;
|
|
97
|
+
var countdown = interval;
|
|
98
|
+
var lastUpdate = new Date();
|
|
99
|
+
var busy = false;
|
|
100
|
+
var failed = false;
|
|
101
|
+
|
|
102
|
+
// The live button shows the interval; the full status goes to its title and to a screen reader region.
|
|
103
|
+
function render() {
|
|
104
|
+
live.classList.toggle("off", interval === 0);
|
|
105
|
+
live.classList.toggle("busy", busy);
|
|
106
|
+
live.classList.toggle("error", !!failed);
|
|
107
|
+
liveLabel.textContent = interval === 0 ? t("off") : interval + " s";
|
|
108
|
+
if (busy) return;
|
|
109
|
+
var status;
|
|
110
|
+
if (failed) status = failed;
|
|
111
|
+
else if (interval === 0) status = t("off") + " \u00B7 " + t("updated", { time: clock(lastUpdate) });
|
|
112
|
+
else status = t("updated", { time: clock(lastUpdate) }) + " \u00B7 " + t("next", { seconds: countdown });
|
|
113
|
+
live.title = status + "\n" + t("change");
|
|
114
|
+
if (liveStatus.textContent !== status && (failed || countdown === interval)) liveStatus.textContent = status;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* ---------- in-place update of the live region ---------- */
|
|
118
|
+
// Client-owned state: never overwritten by the server HTML.
|
|
119
|
+
var CLIENT_ATTRS = { "hidden": 1, "aria-expanded": 1 };
|
|
120
|
+
var FLASH = ["added", "changed"];
|
|
121
|
+
var slice = Array.prototype.slice;
|
|
122
|
+
|
|
123
|
+
function keyOf(node) {
|
|
124
|
+
if (node.nodeType !== 1) return null;
|
|
125
|
+
var toggle = node.getAttribute("data-sqb-toggle");
|
|
126
|
+
if (toggle !== null) return "t:" + toggle;
|
|
127
|
+
return node.id ? "i:" + node.id : null;
|
|
128
|
+
}
|
|
129
|
+
function typeOf(node) { return node.nodeType + ":" + node.nodeName; }
|
|
130
|
+
|
|
131
|
+
// (Re)start the row flash: remove, force a reflow, add.
|
|
132
|
+
function flash(row, name) {
|
|
133
|
+
FLASH.forEach(function (c) { row.classList.remove(c); });
|
|
134
|
+
void row.offsetWidth;
|
|
135
|
+
row.classList.add(name);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function syncAttributes(from, to) {
|
|
139
|
+
slice.call(to.attributes).forEach(function (attr) {
|
|
140
|
+
if (CLIENT_ATTRS[attr.name]) return;
|
|
141
|
+
var value = attr.value;
|
|
142
|
+
if (attr.name === "class") {
|
|
143
|
+
// keep a running flash class that the server does not know about
|
|
144
|
+
FLASH.forEach(function (c) { if (from.classList.contains(c)) value += " " + c; });
|
|
145
|
+
}
|
|
146
|
+
if (from.getAttribute(attr.name) !== value) from.setAttribute(attr.name, value);
|
|
147
|
+
});
|
|
148
|
+
slice.call(from.attributes).forEach(function (attr) {
|
|
149
|
+
if (!CLIENT_ATTRS[attr.name] && !to.hasAttribute(attr.name)) from.removeAttribute(attr.name);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function syncNode(from, to, ctx) {
|
|
154
|
+
if (from.nodeType !== 1) {
|
|
155
|
+
if (from.nodeValue !== to.nodeValue) from.nodeValue = to.nodeValue;
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (from.nodeName !== to.nodeName) {
|
|
159
|
+
from.parentNode.replaceChild(document.importNode(to, true), from);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
var sig = to.getAttribute("data-sqb-sig");
|
|
163
|
+
if (ctx.animate && sig !== null && from.getAttribute("data-sqb-sig") !== sig) flash(from, "changed");
|
|
164
|
+
syncAttributes(from, to);
|
|
165
|
+
syncChildren(from, to, ctx);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Match children by key (job id, element id) or, without a key, by position and type.
|
|
169
|
+
function syncChildren(parent, source, ctx) {
|
|
170
|
+
var olds = slice.call(parent.childNodes), news = slice.call(source.childNodes);
|
|
171
|
+
var keyed = {}, queues = {};
|
|
172
|
+
olds.forEach(function (node) {
|
|
173
|
+
var key = keyOf(node);
|
|
174
|
+
if (key) keyed[key] = node;
|
|
175
|
+
else (queues[typeOf(node)] = queues[typeOf(node)] || []).push(node);
|
|
176
|
+
});
|
|
177
|
+
var matches = news.map(function (node) {
|
|
178
|
+
var key = keyOf(node), found = null;
|
|
179
|
+
if (key) { found = keyed[key] || null; delete keyed[key]; }
|
|
180
|
+
else if (queues[typeOf(node)] && queues[typeOf(node)].length) found = queues[typeOf(node)].shift();
|
|
181
|
+
return found;
|
|
182
|
+
});
|
|
183
|
+
var used = new Set(matches.filter(Boolean));
|
|
184
|
+
olds.forEach(function (node) { if (!used.has(node)) parent.removeChild(node); });
|
|
185
|
+
|
|
186
|
+
var ref = parent.firstChild;
|
|
187
|
+
news.forEach(function (node, i) {
|
|
188
|
+
var match = matches[i];
|
|
189
|
+
if (match) {
|
|
190
|
+
if (match === ref) ref = ref.nextSibling; else parent.insertBefore(match, ref);
|
|
191
|
+
syncNode(match, node, ctx);
|
|
192
|
+
} else {
|
|
193
|
+
var created = document.importNode(node, true);
|
|
194
|
+
parent.insertBefore(created, ref);
|
|
195
|
+
if (ctx.animate && created.nodeType === 1 && created.hasAttribute("data-sqb-sig")) {
|
|
196
|
+
flash(created, "added");
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Drop the flash classes once the animation ends, so the next one restarts cleanly.
|
|
203
|
+
region.addEventListener("animationend", function (event) {
|
|
204
|
+
var row = event.target.closest && event.target.closest("tr");
|
|
205
|
+
if (!row) return;
|
|
206
|
+
if (/^sqb-(added|flash)/.test(event.animationName)) FLASH.forEach(function (c) { row.classList.remove(c); });
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
// New rows grow from zero height: each cell's content goes into a temporary wrapper whose height
|
|
210
|
+
// is animated, so the rows below move down with it. Layout animation: works on tables everywhere.
|
|
211
|
+
var reduceMotion = window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
212
|
+
var GROW_MS = 450;
|
|
213
|
+
function growRow(row) {
|
|
214
|
+
if (!row.animate || (reduceMotion && reduceMotion.matches)) return;
|
|
215
|
+
var cells = slice.call(row.cells);
|
|
216
|
+
var wraps = cells.map(function (cell) {
|
|
217
|
+
var wrap = document.createElement("div");
|
|
218
|
+
wrap.className = "sqb-grow";
|
|
219
|
+
while (cell.firstChild) wrap.appendChild(cell.firstChild);
|
|
220
|
+
cell.appendChild(wrap);
|
|
221
|
+
return wrap;
|
|
222
|
+
});
|
|
223
|
+
var heights = wraps.map(function (wrap) { return wrap.offsetHeight; });
|
|
224
|
+
var easing = "cubic-bezier(.2, .7, .2, 1)";
|
|
225
|
+
cells.forEach(function (cell, i) {
|
|
226
|
+
var style = getComputedStyle(cell);
|
|
227
|
+
cell.animate([{ paddingTop: "0px", paddingBottom: "0px" }, { paddingTop: style.paddingTop, paddingBottom: style.paddingBottom }],
|
|
228
|
+
{ duration: GROW_MS, easing: easing });
|
|
229
|
+
wraps[i].animate([{ height: "0px", opacity: 0 }, { height: heights[i] + "px", opacity: 1 }], { duration: GROW_MS, easing: easing })
|
|
230
|
+
.onfinish = function () {
|
|
231
|
+
// put the content back as the server sent it
|
|
232
|
+
var wrap = wraps[i];
|
|
233
|
+
if (wrap.parentNode !== cell) return; // a refresh already replaced this cell
|
|
234
|
+
while (wrap.firstChild) cell.insertBefore(wrap.firstChild, wrap);
|
|
235
|
+
wrap.remove();
|
|
236
|
+
};
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function update(html) {
|
|
241
|
+
var animate = !!region.querySelector("[data-sqb-sig]");
|
|
242
|
+
var template = document.createElement("template");
|
|
243
|
+
template.innerHTML = html;
|
|
244
|
+
try {
|
|
245
|
+
syncChildren(region, template.content, { animate: animate });
|
|
246
|
+
} catch (error) {
|
|
247
|
+
region.innerHTML = html;
|
|
248
|
+
}
|
|
249
|
+
restoreRows();
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/* ---------- jobs page: JSON with one HTML fragment per row ---------- */
|
|
253
|
+
function fragment(html) {
|
|
254
|
+
var template = document.createElement("template");
|
|
255
|
+
template.innerHTML = html || "";
|
|
256
|
+
return template.content;
|
|
257
|
+
}
|
|
258
|
+
function elements(content) { return slice.call(content.childNodes).filter(function (n) { return n.nodeType === 1; }); }
|
|
259
|
+
|
|
260
|
+
function applyJobs(data) {
|
|
261
|
+
var tbody = document.getElementById("sqb-rows");
|
|
262
|
+
var animate = !!tbody.querySelector("[data-sqb-sig]");
|
|
263
|
+
var ctx = { animate: animate };
|
|
264
|
+
|
|
265
|
+
var nav = region.querySelector("nav.tabs"), newNav = elements(fragment(data.nav))[0];
|
|
266
|
+
if (nav && newNav) syncNode(nav, newNav, ctx);
|
|
267
|
+
syncChildren(document.getElementById("sqb-toolbar"), fragment(data.toolbar), ctx);
|
|
268
|
+
syncChildren(document.getElementById("sqb-pager"), fragment(data.pager), ctx);
|
|
269
|
+
|
|
270
|
+
var keep = new Set(), ref = tbody.firstChild, grown = [];
|
|
271
|
+
function place(node) {
|
|
272
|
+
if (node === ref) ref = ref.nextSibling; else tbody.insertBefore(node, ref);
|
|
273
|
+
keep.add(node);
|
|
274
|
+
}
|
|
275
|
+
data.rows.forEach(function (item) {
|
|
276
|
+
var row = tbody.querySelector('tr[data-sqb-toggle="' + item.id + '"]');
|
|
277
|
+
var detail = document.getElementById("sqb-detail-" + item.id);
|
|
278
|
+
if (row && detail) {
|
|
279
|
+
if (row.sqbHtml !== item.html) {
|
|
280
|
+
var fresh = elements(fragment(item.html));
|
|
281
|
+
syncNode(row, fresh[0], ctx);
|
|
282
|
+
if (fresh[1]) syncNode(detail, fresh[1], ctx);
|
|
283
|
+
row.sqbHtml = item.html;
|
|
284
|
+
}
|
|
285
|
+
place(row);
|
|
286
|
+
place(detail);
|
|
287
|
+
} else {
|
|
288
|
+
var created = elements(fragment(item.html));
|
|
289
|
+
created.forEach(place);
|
|
290
|
+
created[0].sqbHtml = item.html;
|
|
291
|
+
if (animate) {
|
|
292
|
+
flash(created[0], "added");
|
|
293
|
+
grown.push(created[0]);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
if (data.empty) {
|
|
298
|
+
var empty = tbody.querySelector("tr.empty-row") || elements(fragment(data.empty))[0];
|
|
299
|
+
place(empty);
|
|
300
|
+
}
|
|
301
|
+
slice.call(tbody.childNodes).forEach(function (node) { if (!keep.has(node)) tbody.removeChild(node); });
|
|
302
|
+
|
|
303
|
+
restoreRows();
|
|
304
|
+
grown.forEach(growRow);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
function userIsBusy() {
|
|
308
|
+
var active = document.activeElement;
|
|
309
|
+
if (active && region.contains(active) && (active.tagName === "INPUT" || active.tagName === "SELECT")) return true;
|
|
310
|
+
var selection = window.getSelection && window.getSelection();
|
|
311
|
+
return !!(selection && !selection.isCollapsed && region.contains(selection.anchorNode));
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
function refresh(force) {
|
|
315
|
+
if (busy || (!force && (document.hidden || userIsBusy()))) return;
|
|
316
|
+
busy = true;
|
|
317
|
+
render();
|
|
318
|
+
var json = !!document.getElementById("sqb-rows");
|
|
319
|
+
var headers = { "Accept": json ? "application/json" : "text/html" };
|
|
320
|
+
headers[root.getAttribute("data-partial-header")] = "1";
|
|
321
|
+
fetch(window.location.href, { headers: headers, credentials: "same-origin", cache: "no-store", redirect: "manual" })
|
|
322
|
+
.then(function (response) {
|
|
323
|
+
if (!response.ok) throw new Error(response.status || "redirect");
|
|
324
|
+
return json ? response.json() : response.text();
|
|
325
|
+
})
|
|
326
|
+
.then(function (body) {
|
|
327
|
+
if (json) applyJobs(body); else update(body);
|
|
328
|
+
failed = false;
|
|
329
|
+
lastUpdate = new Date();
|
|
330
|
+
})
|
|
331
|
+
.catch(function (error) {
|
|
332
|
+
failed = t("error", { status: error.message });
|
|
333
|
+
})
|
|
334
|
+
.then(function () {
|
|
335
|
+
busy = false;
|
|
336
|
+
countdown = interval;
|
|
337
|
+
render();
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// Each click moves to the next interval and refreshes right away.
|
|
342
|
+
live.addEventListener("click", function () {
|
|
343
|
+
interval = intervals[(intervals.indexOf(interval) + 1) % intervals.length];
|
|
344
|
+
store.set("sqb-poll", String(interval));
|
|
345
|
+
refresh(true);
|
|
346
|
+
});
|
|
347
|
+
document.addEventListener("visibilitychange", function () {
|
|
348
|
+
if (!document.hidden && interval > 0 && (new Date() - lastUpdate) / 1000 >= interval) refresh(false);
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
setInterval(function () {
|
|
352
|
+
if (interval === 0 || busy || document.hidden) return;
|
|
353
|
+
countdown -= 1;
|
|
354
|
+
if (countdown <= 0) refresh(false); else render();
|
|
355
|
+
}, 1000);
|
|
356
|
+
|
|
357
|
+
render();
|
|
358
|
+
})();
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "solid_queue"
|
|
4
|
+
require "ransack"
|
|
5
|
+
require "solid_queue_board/version"
|
|
6
|
+
require "solid_queue_board/engine"
|
|
7
|
+
|
|
8
|
+
# A self-contained dashboard for Solid Queue.
|
|
9
|
+
#
|
|
10
|
+
# # config/routes.rb
|
|
11
|
+
# mount SolidQueueBoard::Engine, at: "/jobs"
|
|
12
|
+
#
|
|
13
|
+
# # config/initializers/solid_queue_board.rb
|
|
14
|
+
# SolidQueueBoard.configure do |config|
|
|
15
|
+
# config.base_controller_class = "ApplicationController"
|
|
16
|
+
# config.authorize = ->(controller) { controller.current_user&.admin? }
|
|
17
|
+
# end
|
|
18
|
+
module SolidQueueBoard
|
|
19
|
+
# Controller the dashboard inherits from. Use your ApplicationController to reuse its
|
|
20
|
+
# authentication (before_actions, current_user, ...).
|
|
21
|
+
mattr_accessor :base_controller_class, default: "ActionController::Base"
|
|
22
|
+
|
|
23
|
+
# Called with the controller instance before every action. Return true to allow access.
|
|
24
|
+
# Default: open only in development and test, closed everywhere else.
|
|
25
|
+
mattr_accessor :authorize, default: ->(_controller) { Rails.env.local? }
|
|
26
|
+
|
|
27
|
+
# Title shown in the top bar. Defaults to the host application name.
|
|
28
|
+
mattr_accessor :title, default: nil
|
|
29
|
+
|
|
30
|
+
# Link shown in the top bar to go back to the host application (nil hides it).
|
|
31
|
+
mattr_accessor :back_url, default: "/"
|
|
32
|
+
|
|
33
|
+
# Rows per page in the jobs table.
|
|
34
|
+
mattr_accessor :per_page, default: 50
|
|
35
|
+
|
|
36
|
+
# Auto-refresh choices, in seconds (0 = off), and the default one.
|
|
37
|
+
mattr_accessor :poll_intervals, default: [ 3, 6, 12, 24, 0 ]
|
|
38
|
+
mattr_accessor :default_poll_interval, default: 6
|
|
39
|
+
|
|
40
|
+
def self.configure
|
|
41
|
+
yield self
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def self.app_title
|
|
45
|
+
return title if title.present?
|
|
46
|
+
|
|
47
|
+
klass = Rails.application.class
|
|
48
|
+
name = klass.module_parent_name || klass.name.to_s.delete_suffix("Application")
|
|
49
|
+
name.underscore.humanize
|
|
50
|
+
end
|
|
51
|
+
end
|