mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-05 09:54:06 +08:00
✨ Sync 2026-10-11 20:48:25
This commit is contained in:
1 parent
78f0ba8251
commit
5ce75c9f2b
45 files changed
+54
-879
No files matched your search
@@ -247,7 +247,7 @@ function clKernelUnlock() {
|
||||
|
||||
return view.extend({
|
||||
_busy: false,
|
||||
_op: null, /* 'start' | 'stop' | 'restart' | 'reload' | null */
|
||||
_op: null, /* 'start' | 'stop' | null */
|
||||
_opTimers: null, /* array of setTimeout IDs for cleanup */
|
||||
_accessRefreshing: false,
|
||||
_coreSwitchBusy: false,
|
||||
@@ -789,29 +789,7 @@ return view.extend({
|
||||
if (disabled) return;
|
||||
return running ? self._stop() : self._start();
|
||||
}
|
||||
}, [E('span', { 'class': 'cl-service-knob' })]),
|
||||
E('button', {
|
||||
type: 'button',
|
||||
'class': 'btn cbi-button-action cl-btn-sm',
|
||||
title: _("Restart Service"),
|
||||
disabled: (disabled || !running) ? '' : null,
|
||||
click: function (ev) {
|
||||
ev.preventDefault();
|
||||
if (disabled || !running) return;
|
||||
return self._restart();
|
||||
}
|
||||
}, _("Restart")),
|
||||
E('button', {
|
||||
type: 'button',
|
||||
'class': 'btn cbi-button-action cl-btn-sm',
|
||||
title: _("Reload Service"),
|
||||
disabled: (disabled || !running) ? '' : null,
|
||||
click: function (ev) {
|
||||
ev.preventDefault();
|
||||
if (disabled || !running) return;
|
||||
return self._reload();
|
||||
}
|
||||
}, _("Reload"))
|
||||
}, [E('span', { 'class': 'cl-service-knob' })])
|
||||
]);
|
||||
},
|
||||
|
||||
@@ -1966,7 +1944,7 @@ return view.extend({
|
||||
|
||||
// preflight: refuse start when no profile selected.
|
||||
// backend select_config also defends but toast is slow, UI would flash.
|
||||
if (opKey === 'start' || opKey === 'restart' || opKey === 'reload') {
|
||||
if (opKey === 'start') {
|
||||
var st0 = this._lastSt || {};
|
||||
var hasConfig = !!(st0.config || st0.conf_path);
|
||||
if (!hasConfig) {
|
||||
@@ -1988,14 +1966,12 @@ return view.extend({
|
||||
btn.setAttribute('aria-pressed', newRunning ? 'true' : 'false');
|
||||
btn.className = 'cl-service-switch' + (newRunning ? ' is-on' : ' is-off');
|
||||
}
|
||||
self._showOpMsg(opKey === 'stop' ? _("Stopping…") : opKey === 'reload' ? _("Reloading…") : _("Starting…"));
|
||||
self._showOpMsg(opKey === 'stop' ? _("Stopping…") : _("Starting…"));
|
||||
}
|
||||
|
||||
var maxWait = opKey === 'stop' ? 15000 : 35000;
|
||||
var started = Date.now();
|
||||
var pollTimer = null;
|
||||
var initialPid = (this._lastSt && this._lastSt.pid) || 0;
|
||||
var sawStopped = false;
|
||||
var rpcDone = false;
|
||||
var finished = false;
|
||||
|
||||
@@ -2027,10 +2003,8 @@ return view.extend({
|
||||
if (opKey === 'stop') {
|
||||
if (rpcDone && st.running === false) return finish(_("Stopped") + ' ⚪');
|
||||
} else {
|
||||
if (st.running === false) sawStopped = true;
|
||||
if (rpcDone && st.health_status === 'fail') return finish(null);
|
||||
if (rpcDone && st.running === true &&
|
||||
(opKey !== 'restart' || (initialPid && st.pid && st.pid !== initialPid) || sawStopped))
|
||||
if (rpcDone && st.running === true)
|
||||
return finish(_("Running 🟢"));
|
||||
}
|
||||
if (elapsed >= maxWait) return finish(null);
|
||||
@@ -2044,10 +2018,8 @@ return view.extend({
|
||||
pollTimer = setTimeout(pollOnce, 100);
|
||||
},
|
||||
|
||||
_start: function () { return this._svc(function () { return clashoo.start(); }, 'start'); },
|
||||
_stop: function () { return this._svc(function () { return clashoo.stop(); }, 'stop'); },
|
||||
_restart: function () { return this._svc(function () { return clashoo.restart(); }, 'restart'); },
|
||||
_reload: function () { return this._svc(function () { return clashoo.reload(); }, 'reload'); },
|
||||
_start: function () { return this._svc(function () { return clashoo.start(); }, 'start'); },
|
||||
_stop: function () { return this._svc(function () { return clashoo.stop(); }, 'stop'); },
|
||||
|
||||
_updSubs: function (ev) {
|
||||
var btn = ev && ev.target;
|
||||
|
||||
Reference in new issue
Block a user