Compare commits

...

4 Commits

Author SHA1 Message Date
remittor
5297980d79 luci: tools: Fix function execAndRead 2026-01-27 19:27:40 +03:00
remittor
3ab854aedf luci: Restart service on press Save&Apply 2026-01-27 13:55:35 +03:00
remittor
83bf86b2f8 luci: service: Rewrite func serviceActionEx 2026-01-26 16:08:37 +03:00
remittor
e2c6c0552e luci: service: Add method getPackageDict 2026-01-26 13:00:54 +03:00
6 changed files with 266 additions and 184 deletions

View File

@@ -49,7 +49,7 @@ return baseclass.extend({
log: '/tmp/'+tools.appName+'_dwc.log',
logArea: this.logArea,
callback: this.execAndReadCallback,
cbarg: this, // wnd
ctx: this,
});
},
@@ -70,27 +70,27 @@ return baseclass.extend({
log: '/tmp/'+tools.appName+'_dwc.log',
logArea: this.logArea,
callback: this.execAndReadCallback,
cbarg: this, // wnd
ctx: this,
});
},
execAndReadCallback: function(wnd, rc, txt = '')
execAndReadCallback: function(rc, txt = '')
{
wnd.setBtnMode(1, 1, 1);
this.setBtnMode(1, 1, 1);
if (rc == 0 && txt) {
wnd.appendLog('=========================================================');
this.appendLog('=========================================================');
return;
}
if (rc >= 500) {
if (txt) {
wnd.appendLog(txt.startsWith('ERROR') ? txt : 'ERROR: ' + txt);
this.appendLog(txt.startsWith('ERROR') ? txt : 'ERROR: ' + txt);
} else {
wnd.appendLog('ERROR: ' + wnd._action + ': Terminated with error code = ' + rc);
this.appendLog('ERROR: ' + this._action + ': Terminated with error code = ' + rc);
}
} else {
wnd.appendLog('ERROR: Process finished with retcode = ' + rc);
this.appendLog('ERROR: Process finished with retcode = ' + rc);
}
wnd.appendLog('=========================================================');
this.appendLog('=========================================================');
},
openDiagnostDialog: function(pkg_arch)

View File

@@ -48,5 +48,7 @@ return baseclass.extend({
dst_obj.packager.path = '/bin/opkg';
dst_obj.packager.args = [ 'list-installed', '*'+this.appName+'*' ];
}
dst_obj.skey_pkg_dict = this.appName + '-pkg-dict';
dst_obj.skey_deffered_action = this.appName + '-deffered-action';
}
});

View File

@@ -50,7 +50,7 @@ return view.extend({
fs.exec(tools.execPath, [ 'enabled' ]), // svc_en
tools.getSvcInfo(), // svc_info
fs.exec('/bin/busybox', [ 'ps' ]), // process list
fs.exec(tools.packager.path, tools.packager.args), // installed packages
tools.getPackageDict(), // installed packages
tools.getStratList(), // nfqws strategy list
fs.exec('/bin/cat', [ '/etc/openwrt_release' ]), // CPU arch
uci.load(tools.appName), // config
@@ -62,7 +62,9 @@ return view.extend({
});
},
setAppStatus: function(status_array, elems = { }, force_app_status = 0) {
setAppStatus: function(status_array, elems = { }, force_app_status = 0)
{
tools.execDefferedAction();
let cfg = uci.get(tools.appName, 'config');
if (!status_array || cfg == null || typeof(cfg) !== 'object') {
let elem_status = elems.status || document.getElementById("status");
@@ -73,9 +75,9 @@ return view.extend({
}
let svc_boot = status_array[0] ? true : false;
let svc_en = status_array[1]; // stdout: empty or error text
let svc_info = status_array[2]; // stdout: JSON as text
let svc_info = status_array[2]; // dict for services
let proc_list = status_array[3]; // stdout: multiline text
let pkg_list = status_array[4]; // stdout: installed packages
let pkg_dict = status_array[4]; // stdout: installed packages
let stratlist = status_array[5]; // array of strat names
let sys_info = status_array[6]; // stdout: openwrt distrib info
@@ -95,8 +97,8 @@ return view.extend({
this.disableButtons(true, -1, elems);
return;
}
if (pkg_list.code != 0) {
ui.addNotification(null, E('p', _('Unable to enumerate installed packages') + ': setAppStatus()'));
if (!pkg_dict) {
ui.addNotification(null, E('p', _('Unable to enumerate installed packages') + ': getPackageDict()'));
this.disableButtons(true, -1, elems);
return;
}
@@ -135,89 +137,37 @@ return view.extend({
}
},
serviceAction: function(action, button) {
if (button) {
let elem = document.getElementById(button);
this.disableButtons(true, elem);
}
serviceActionEx: async function(action, button, args = [ ], hide_modal = false, btn_dis = true)
{
let btn = document.getElementById(button);
this.disableButtons(true, btn);
poll.stop();
let _this = this;
return tools.handleServiceAction(tools.appName, action)
.then(() => {
return _this.getAppStatus().then(
(status_array) => {
_this.setAppStatus(status_array);
try {
if (action == 'start' || action == 'restart') {
let apply_exec = tools.checkUnsavedChanges();
if (apply_exec) {
ui.changes.apply(true); // apply_rollback
await new Promise(resolve => setTimeout(resolve, 1000));
tools.setDefferedAction(action, null, true);
return;
}
);
})
.catch(e => {
ui.addNotification(null, E('p', _('Unable to run service action.') + ' Error: ' + e.message));
});
},
serviceActionEx: function(action, button, args = [ ], hide_modal = false) {
if (button) {
let elem = document.getElementById(button);
this.disableButtons(true, elem);
}
poll.stop();
let _this = this;
let exec_cmd = null;
let exec_arg = [ ];
let errmsg = 'ERROR:';
if (action == 'start' || action == 'restart') {
exec_cmd = tools.syncCfgPath;
errmsg = _('Unable to run sync_config.sh script.');
}
else if (action == 'reset') {
exec_cmd = tools.defaultCfgPath;
exec_arg = args; // (reset_ipset)(sync) ==> restore all configs + sync config
errmsg = _('Unable to run restore-def-cfg.sh script.');
action = null;
} else {
ui.addNotification(null, E('p', 'ERROR: unknown action'));
return null;
}
return fs.exec(exec_cmd, exec_arg)
.then(function(res) {
if (res.code != 0) {
ui.addNotification(null, E('p', errmsg + ' res.code = ' + res.code));
action = null; // return with error
}
await tools.serviceActionEx(action, args, false);
if (hide_modal) {
ui.hideModal();
}
if (!action) {
return _this.getAppStatus().then(
(status_array) => {
_this.setAppStatus(status_array);
}
);
}
return _this.serviceAction(action, null);
})
.catch(e => {
ui.addNotification(null, E('p', errmsg + ' Error: ' + e.message));
});
},
appAction: function(action, button) {
if (button) {
let elem = document.getElementById(button);
this.disableButtons(true, elem);
}
poll.stop();
return fs.exec_direct(tools.execPath, [ action ]).then(res => {
return this.getAppStatus().then(
(status_array) => {
this.setAppStatus(status_array);
ui.hideModal();
} catch(e) {
//ui.addNotification(null, E('p', 'Error: ' + e.message));
} finally {
setTimeout(() => {
if (btn && btn_dis) {
btn.disabled = true;
}
);
});
if (!poll.active()) {
poll.start();
}
}, 0);
}
},
statusPoll: function() {
@@ -226,7 +176,12 @@ return view.extend({
);
},
dialogResetCfg: function(ev) {
dialogResetCfg: function(ev)
{
if (tools.checkUnsavedChanges()) {
ui.addNotification(null, E('p', _('You have unapplied changes')));
return;
}
ev.target.blur();
let reset_base = E('label', [
@@ -274,7 +229,7 @@ return view.extend({
let resetcfg_btn = E('button', {
'class': btn_style_action,
}, _('Reset settings'));
resetcfg_btn.onclick = ui.createHandlerFn(this, () => {
resetcfg_btn.onclick = ui.createHandlerFn(this, async () => {
//cancel_button.disabled = true;
let opt_flags = '';
if (document.getElementById('cfg_reset_base').checked == false) {
@@ -342,9 +297,9 @@ return view.extend({
}
let cfg = uci.get(tools.appName, 'config');
let pkg_list = status_array[4];
if (pkg_list === undefined || typeof(pkg_list) !== 'object' || pkg_list.code != 0) {
ui.addNotification(null, E('p', _('Unable to enumerate installed packages') + ': setAppStatus()'));
let pkgdict = status_array[4];
if (pkgdict == null) {
ui.addNotification(null, E('p', _('Unable to enumerate installed packages') + ': render()'));
return;
}
@@ -390,9 +345,9 @@ return view.extend({
};
let btn_enable = create_btn('btn_enable', btn_style_success, _('Enable'));
btn_enable.onclick = ui.createHandlerFn(this, this.serviceAction, 'enable', 'btn_enable');
btn_enable.onclick = ui.createHandlerFn(this, this.serviceActionEx, 'enable', 'btn_enable');
let btn_disable = create_btn('btn_disable', btn_style_warning, _('Disable'));
btn_disable.onclick = ui.createHandlerFn(this, this.serviceAction, 'disable', 'btn_disable');
btn_disable.onclick = ui.createHandlerFn(this, this.serviceActionEx, 'disable', 'btn_disable');
layout_append(_('Service autorun control'), null, [ btn_enable, btn_disable ] );
let btn_start = create_btn('btn_start', btn_style_action, _('Start'));
@@ -400,7 +355,7 @@ return view.extend({
let btn_restart = create_btn('btn_restart', btn_style_action, _('Restart'));
btn_restart.onclick = ui.createHandlerFn(this, this.serviceActionEx, 'restart', 'btn_restart');
let btn_stop = create_btn('btn_stop', btn_style_warning, _('Stop'));
btn_stop.onclick = ui.createHandlerFn(this, this.serviceAction, 'stop', 'btn_stop');
btn_stop.onclick = ui.createHandlerFn(this, this.serviceActionEx, 'stop', 'btn_stop');
layout_append(_('Service daemons control'), null, [ btn_start, btn_restart, btn_stop ] );
let btn_reset = create_btn('btn_reset', btn_style_action, _('Reset settings'));
@@ -428,15 +383,15 @@ return view.extend({
};
this.setAppStatus(status_array, elems);
poll.add(L.bind(this.statusPoll, this));
poll.add(L.bind(this.statusPoll, this), 2); // interval 2 sec
let page_title = tools.AppName;
let pkgdict = tools.decode_pkg_list(pkg_list.stdout, false);
page_title += ' &nbsp ';
if (pkgdict[tools.appName] === undefined || pkgdict[tools.appName] == '') {
page_title += 'unknown version';
} else {
page_title += 'v' + pkgdict[tools.appName];
page_title = page_title.replace(/-r1$/, '');
}
let aux1 = E('em');
let aux2 = E('em');

View File

@@ -13,43 +13,18 @@ document.head.appendChild(E('link', {
}));
return view.extend({
parsers: { },
appStatusCode: null,
depends: function(elem, key, array, empty=true) {
if (empty && array.length === 0) {
elem.depends(key, '_dummy');
} else {
array.forEach(e => elem.depends(key, e));
}
},
validateIpPort: function(section, value) {
return (/^$|^([0-9]{1,3}\.){3}[0-9]{1,3}(#[\d]{2,5})?$/.test(value)) ? true : _('Expecting:')
+ ` ${_('One of the following:')}\n - ${_('valid IP address')}\n - ${_('valid address#port')}\n`;
},
validateUrl: function(section, value) {
return (/^$|^https?:\/\/[\w.-]+(:[0-9]{2,5})?[\w\/~.&?+=-]*$/.test(value)) ? true : _('Expecting:')
+ ` ${_('valid URL')}\n`;
},
svc_info: null,
load: function() {
return Promise.all([
{ code: -1}, // L.resolveDefault(fs.exec(tools.execPath, [ 'raw-status' ]), 1),
null, // L.resolveDefault(fs.list(tools.parsersDir), null),
uci.load(tools.appName),
]).catch(e => {
ui.addNotification(null, E('p', _('Unable to read the contents') + ': %s '.format(e.message) ));
});
return tools.baseLoad();
},
render: function(data) {
if (!data) {
return;
}
this.appStatusCode = data[0].code;
this.svc_info = data.svc_info;
tools.execDefferedAction(this.svc_info);
let m, s, o, tabname;
@@ -480,12 +455,18 @@ return view.extend({
return map_promise;
},
handleSaveApply: function(ev, mode) {
handleSaveApply: function(ev, mode)
{
return this.handleSave(ev).then(() => {
ui.changes.apply(mode == '0');
//if (this.appStatusCode != 1 && this.appStatusCode != 2) {
// window.setTimeout(() => fs.exec(tools.execPath, [ 'restart' ]), 3000);
//}
let apply_exec = tools.checkUnsavedChanges();
if (apply_exec) {
ui.changes.apply(mode == '0');
tools.setDefferedAction('restart', this.svc_info);
} else {
if (this.svc_info?.dmn.inited) {
tools.serviceActionEx('restart');
}
}
});
},
});

View File

@@ -101,6 +101,29 @@ return baseclass.extend({
});
},
getPackageDict: function()
{
let exec_cmd = this.packager.path;
let exec_arg = this.packager.args;
return fs.exec(exec_cmd, exec_arg).then(res => {
let pdict_json = localStorage.getItem(this.skey_pkg_dict);
if (res.code != 0) {
console.log(this.appName + ': Unable to enumerate installed packages. code = ' + res.code);
if (pdict_json != null) {
return JSON.parse(pdict_json); // return cached value
}
return null;
}
let pdict = this.decode_pkg_list(res.stdout);
if (pdict != pdict_json) {
localStorage.setItem(this.skey_pkg_dict, JSON.stringify(pdict)); // renew cache
}
return pdict;
}).catch(e => {
ui.addNotification(null, E('p', _('Unable to enumerate installed packages.') + ' Error: %s'.format(e)));
});
},
getStratList: function() {
let exec_cmd = '/bin/busybox';
let exec_arg = [ 'awk', '-F', '"', '/if \\[ "\\$strat" = "/ {print $4}', this.defCfgPath ];
@@ -114,7 +137,9 @@ return baseclass.extend({
});
},
handleServiceAction: function(name, action) {
handleServiceAction: function(name, action, throwed = false)
{
console.log('handleServiceAction: '+name+' '+action);
return this.callInitAction(name, action).then(success => {
if (!success) {
throw _('Command failed');
@@ -122,9 +147,122 @@ return baseclass.extend({
return true;
}).catch(e => {
ui.addNotification(null, E('p', _('Service action failed "%s %s": %s').format(name, action, e)));
if (throwed) {
throw e;
}
});
},
serviceActionEx: async function(action, args = [ ], throwed = false)
{
let errmsg = null;
try {
let exec_cmd = null;
let exec_arg = [ ];
if (action == 'start' || action == 'restart') {
exec_cmd = this.syncCfgPath;
errmsg = _('Unable to run sync_config.sh script.');
}
if (action == 'reset') {
exec_cmd = this.defaultCfgPath;
exec_arg = args; // (reset_ipset)(sync) ==> restore all configs + sync config
errmsg = _('Unable to run restore-def-cfg.sh script.');
action = null;
}
if (exec_cmd) {
let res = await fs.exec(exec_cmd, exec_arg);
if (res.code != 0) {
throw Error('res.code = ' + res.code);
}
}
errmsg = null;
await this.handleServiceAction(this.appName, action, throwed);
} catch(e) {
if (throwed) {
throw e;
} else {
let msg = errmsg ? errmsg : _('Unable to run service action') + ' "' + action + '".';
ui.addNotification(null, E('p', msg + ' Error: ' + e.message));
}
}
},
baseLoad: function(callback, cbarg)
{
return Promise.all([
this.getSvcInfo(), // svc_info
uci.load(this.appName),
])
.then( ([svcInfo, uci_data]) => {
let svc_info = this.decodeSvcInfo(svcInfo);
let ret = { svc_info, uci_data };
if (typeof callback === 'function') {
const res = callback(cbarg, ret);
if (res && typeof res.then === 'function') {
return res.then(() => ret);
}
return ret;
}
return ret;
})
.catch(e => {
ui.addNotification(null, E('p', _('Unable to read the contents') + ' (baseLoad): %s '.format(e.message) ));
return null;
});
},
decodeSvcInfo: function(svc_info, svc_autorun = true, proc_list = [ ])
{
if (svc_info?.autorun !== undefined && svc_info?.dmn !== undefined) {
return svc_info;
}
if (svc_info != null && typeof(svc_info) == 'object') {
return this.decode_svc_info(svc_autorun, svc_info, proc_list);
}
return null;
},
setDefferedAction: function(action, svcInfo = null, forced = false)
{
let svc_info = this.decodeSvcInfo(svcInfo);
if (action == 'start' && svc_info?.dmn.inited) {
action = 'restart';
}
if (action == 'start') {
if (!forced && svc_info?.dmn.inited) {
action = null;
}
}
if (action == 'restart') {
if (!forced && !svc_info?.dmn.inited) {
action = null;
}
}
if (action && localStorage.getItem(this.skey_deffered_action) == null) {
localStorage.setItem(this.skey_deffered_action, action);
console.log('setDefferedAction: '+this.skey_deffered_action+' = '+action);
}
},
execDefferedAction: function(svcInfo = null)
{
let svc_info = this.decodeSvcInfo(svcInfo);
//console.log('execDefferedAction: svc_info = '+JSON.stringify(svc_info));
let action = localStorage.getItem(this.skey_deffered_action);
if (action) {
localStorage.removeItem(this.skey_deffered_action);
console.log('execDefferedAction: '+action);
this.serviceActionEx(action);
}
},
checkUnsavedChanges: function()
{
if (!ui.changes) return false;
if (!ui.changes.changes) return false;
return ui.changes.changes[this.appName] ? true : false;
},
normalizeValue: function(v) {
return (v && typeof(v) === 'string') ? v.trim().replace(/\r?\n/g, '') : v;
},
@@ -141,7 +279,7 @@ return baseclass.extend({
return m ? m[2] : defval;
},
decode_pkg_list: function(pkg_list, with_suffix_r1 = true) {
decode_pkg_list: function(pkg_list) {
let pkg_dict = { };
if (!pkg_list) {
return pkg_dict;
@@ -180,11 +318,7 @@ return baseclass.extend({
}
}
if (rev >= 0) {
if (rev == 1 && !with_suffix_r1) {
// nothing
} else {
ver += '-r' + rev;
}
ver += '-r' + rev;
}
pkg_dict[name] = ver;
}
@@ -208,7 +342,8 @@ return baseclass.extend({
return plist;
},
decode_svc_info: function(svc_autorun, svc_info, proc_list, cfg) {
decode_svc_info: function(svc_autorun, svc_info, proc_list, cfg = null)
{
let result = {
"autorun": svc_autorun,
"dmn": {
@@ -219,13 +354,18 @@ return baseclass.extend({
},
"status": this.statusDict.error,
};
if (proc_list.code != 0) {
return -2;
}
let plist = this.get_pid_list(proc_list.stdout);
if (plist.length < 4) {
return -3;
let plist = proc_list;
if (proc_list?.code !== undefined) {
if (proc_list.code != 0) {
return -2;
}
plist = this.get_pid_list(proc_list.stdout);
if (plist.length < 4) {
return -3;
}
}
if (svc_info == null) {
return null;
}
if (typeof(svc_info) !== 'object') {
return -4;
@@ -600,7 +740,7 @@ return baseclass.extend({
},
}),
execAndRead: async function({ cmd = [ ], log = '', logArea = null, callback = null, cbarg = null, hiderow = [ ], rpc_timeout = 5, rpc_root = false } = {})
execAndRead: async function({ cmd = [ ], log = '', logArea = null, callback = null, ctx = null, hiderow = [ ], rpc_timeout = 5, rpc_root = false } = {})
{
function appendLog(msg, end = '\n')
{
@@ -624,23 +764,23 @@ return baseclass.extend({
await fs.exec('/bin/busybox', [ 'rm', '-f', logFile + '*' ], null, rpc_opt);
appendLog('Output file cleared!');
} catch (e) {
return callback(cbarg, 500, 'ERROR: Failed to clear output file');
return callback.call(ctx, 500, 'ERROR: Failed to clear output file');
}
try {
let opt_list = [ logFile ];
opt_list.push(...cmd);
let res = await fs.exec(this.appDir+'/script-exec.sh', opt_list, null, rpc_opt);
if (res.code != 0) {
return callback(cbarg, 525, 'ERROR: cannot run "' + cmd[0] + '" script! (error = ' + res.code + ')');
return callback.call(ctx, 525, 'ERROR: cannot run "' + cmd[0] + '" script! (error = ' + res.code + ')');
}
appendLog('Process started...');
} catch (e) {
return callback(cbarg, 520, 'ERROR: Failed on execute process: ' + e.message);
return callback.call(ctx, 520, 'ERROR: Failed on execute process: ' + e.message);
}
let lastLen = 0;
let retCode = -1;
return await new Promise(async (resolve, reject) => {
async function poll()
async function epoll()
{
try {
let res = await fs.exec('/bin/cat', [ logFile ], null, rpc_opt);
@@ -656,7 +796,7 @@ return baseclass.extend({
let rc = await fs.exec('/bin/cat', [ rcFile ], null, rpc_opt);
if (rc.code != 0) {
fixLogEnd();
resolve(callback(cbarg, 545, 'ERROR: cannot read file "' + rcFile + '"'));
resolve(callback.call(ctx, 545, 'ERROR: cannot read file "' + rcFile + '"'));
return;
}
if (rc.stdout) {
@@ -666,13 +806,13 @@ return baseclass.extend({
if (retCode >= 0) {
fixLogEnd();
if (retCode == 0 && res.stdout) {
resolve(callback(cbarg, 0, res.stdout));
resolve(callback.call(ctx, 0, res.stdout));
return;
}
resolve(callback(cbarg, retCode, 'ERROR: Process failed with error ' + retCode));
resolve(callback.call(ctx, retCode, 'ERROR: Process failed with error ' + retCode));
return;
}
setTimeout(poll, 500);
setTimeout(epoll, 500);
} catch (e) {
let skip_err = false;
if (e.message?.includes('RPC call to file/exec failed with error -32000: Object not found')) {
@@ -683,17 +823,17 @@ return baseclass.extend({
}
if (skip_err) {
console.warn('WARN: execAndRead: ' + e.message);
setTimeout(poll, 500);
return; // goto next poll iteration
setTimeout(epoll, 500);
return; // goto next epoll iteration
}
fixLogEnd();
let errtxt = 'ERROR: execAndRead: ' + e.message;
errtxt += 'ERROR: execAndRead: ' + e.stack?.trim().split('\n')[0];
callback(cbarg, 540, errtxt);
callback.call(ctx, 540, errtxt);
reject(e);
}
}
poll();
epoll();
});
},

View File

@@ -59,7 +59,7 @@ return baseclass.extend({
log: '/tmp/'+tools.appName+'_pkg_check.log',
logArea: this.logArea,
callback: this.execAndReadCallback,
cbarg: this, // wnd
ctx: this,
});
},
@@ -84,58 +84,62 @@ return baseclass.extend({
logArea: this.logArea,
hiderow: /^ \* resolve_conffiles.*(?:\r?\n|$)/gm,
callback: this.execAndReadCallback,
cbarg: this, // wnd
ctx: this,
});
},
execAndReadCallback: function(wnd, rc, txt = '')
execAndReadCallback: function(rc, txt = '')
{
//console.log('execAndReadCallback = ' + rc + '; _action = ' + wnd._action);
//console.log('execAndReadCallback = ' + rc + '; _action = ' + this._action);
if (rc == 0 && txt) {
let code = txt.match(/^RESULT:\s*\(([^)]+)\)\s+.+$/m);
if (wnd._action == 'checkUpdates') {
wnd.appendLog('=========================================================');
if (this._action == 'checkUpdates') {
this.appendLog('=========================================================');
if (code && code[1] == 'E') {
wnd.btn_install.textContent = _('Reinstall');
this.btn_install.textContent = _('Reinstall');
} else {
wnd.btn_install.textContent = _('Install');
this.btn_install.textContent = _('Install');
}
let pkg_url = txt.match(/^ZAP_PKG_URL\s*=\s*(.+)$/m);
if (code && pkg_url) {
if (!wnd.forced_reinstall) {
if (!this.forced_reinstall) {
if (code[1] == 'E' || code[1] == 'G') {
wnd.setStage(0); // install not needed
this.setStage(0); // install not needed
return;
}
}
wnd.pkg_url = pkg_url[1];
wnd.setStage(2); // enable all buttons
this.pkg_url = pkg_url[1];
this.setStage(2); // enable all buttons
return; // install allowed
}
}
if (wnd._action == 'installUpdates') {
if (wnd._test || (code && code[1] == '+')) {
wnd.setStage(9);
wnd.appendLog('Please update WEB-page (press F5)');
if (this._action == 'installUpdates') {
if (this._test || (code && code[1] == '+')) {
this.setStage(9);
this.appendLog('Please update WEB-page (press F5)');
return;
}
}
}
wnd.setStage(0);
this.setStage(0);
if (rc >= 500) {
if (txt) {
wnd.appendLog(txt.startsWith('ERROR') ? txt : 'ERROR: ' + txt);
this.appendLog(txt.startsWith('ERROR') ? txt : 'ERROR: ' + txt);
} else {
wnd.appendLog('ERROR: ' + wnd._action + ': Terminated with error code = ' + rc);
this.appendLog('ERROR: ' + this._action + ': Terminated with error code = ' + rc);
}
} else {
wnd.appendLog('ERROR: Process finished with retcode = ' + rc);
this.appendLog('ERROR: Process finished with retcode = ' + rc);
}
wnd.appendLog('=========================================================');
this.appendLog('=========================================================');
},
openUpdateDialog: function(pkg_arch)
{
if (tools.checkUnsavedChanges()) {
ui.addNotification(null, E('p', _('You have unapplied changes')));
return;
}
this.stage = 0;
this.pkg_arch = pkg_arch;
this.pkg_url = null;