clocktopus 1.6.0 → 1.6.1
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/dist/dashboard/views.js +10 -1
- package/package.json +1 -1
package/dist/dashboard/views.js
CHANGED
|
@@ -682,9 +682,17 @@ export function indexPage() {
|
|
|
682
682
|
desc.style.color = '#d29922';
|
|
683
683
|
setMsg('monitor-msg', pending + ' server...', true);
|
|
684
684
|
|
|
685
|
+
const MIN_DISPLAY_MS = 1500;
|
|
686
|
+
const started = Date.now();
|
|
687
|
+
const waitMin = function() {
|
|
688
|
+
const elapsed = Date.now() - started;
|
|
689
|
+
return new Promise(function(r) { setTimeout(r, Math.max(0, MIN_DISPLAY_MS - elapsed)); });
|
|
690
|
+
};
|
|
691
|
+
|
|
685
692
|
try {
|
|
686
693
|
const res = await fetch('/api/monitor/' + action, { method: 'POST' });
|
|
687
694
|
const data = await res.json();
|
|
695
|
+
await waitMin();
|
|
688
696
|
if (data.ok) {
|
|
689
697
|
setMsg('monitor-msg', 'Monitor ' + action + (action === 'stop' ? 'ped' : 'ed') + '.', true);
|
|
690
698
|
} else {
|
|
@@ -693,8 +701,9 @@ export function indexPage() {
|
|
|
693
701
|
desc.style.color = prevColor;
|
|
694
702
|
dot.className = prevDot;
|
|
695
703
|
}
|
|
696
|
-
setTimeout(checkMonitorStatus,
|
|
704
|
+
setTimeout(checkMonitorStatus, 500);
|
|
697
705
|
} catch {
|
|
706
|
+
await waitMin();
|
|
698
707
|
setMsg('monitor-msg', 'Request failed.', false);
|
|
699
708
|
desc.textContent = prevDesc;
|
|
700
709
|
desc.style.color = prevColor;
|