diff options
Diffstat (limited to 'modules')
14 files changed, 150 insertions, 100 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index 9c59c650a3..917584bb82 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -1201,7 +1201,7 @@ var CBITableSection = CBITypedSection.extend({ L.dom.append(tdEl.lastElementChild, [ E('div', { 'title': _('Drag to reorder'), - 'class': 'cbi-button drag-handle center', + 'class': 'btn cbi-button drag-handle center', 'style': 'cursor:move' }, '☰') ]); @@ -1644,7 +1644,16 @@ var CBIValue = CBIAbstractValue.extend({ if (typeof(this.title) === 'string' && this.title !== '') { optionEl.appendChild(E('label', { 'class': 'cbi-value-title', - 'for': 'widget.cbid.%s.%s.%s'.format(config_name, section_id, this.option) + 'for': 'widget.cbid.%s.%s.%s'.format(config_name, section_id, this.option), + 'click': function(ev) { + var node = ev.currentTarget, + elem = node.nextElementSibling.querySelector('#' + node.getAttribute('for')) || node.nextElementSibling.querySelector('[data-widget-id="' + node.getAttribute('for') + '"]'); + + if (elem) { + elem.click(); + elem.focus(); + } + } }, this.titleref ? E('a', { 'class': 'cbi-title-ref', diff --git a/modules/luci-base/htdocs/luci-static/resources/luci.js b/modules/luci-base/htdocs/luci-static/resources/luci.js index 8d056ec03d..fd4c584886 100644 --- a/modules/luci-base/htdocs/luci-static/resources/luci.js +++ b/modules/luci-base/htdocs/luci-static/resources/luci.js @@ -2984,14 +2984,14 @@ 1: [ _('Apply unchecked') ] }, { classes: { - 0: 'cbi-button cbi-button-apply important', - 1: 'cbi-button cbi-button-negative important' + 0: 'btn cbi-button cbi-button-apply important', + 1: 'btn cbi-button cbi-button-negative important' }, click: L.ui.createHandlerFn(this, 'handleSaveApply') }).render() : E([]); if (this.handleSaveApply || this.handleSave || this.handleReset) { - footer.appendChild(E('div', { 'class': 'cbi-page-actions' }, [ + footer.appendChild(E('div', { 'class': 'cbi-page-actions control-group' }, [ saveApplyBtn, ' ', this.handleSave ? E('button', { 'class': 'cbi-button cbi-button-save', diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index 4458573601..0e196df4b0 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -218,6 +218,7 @@ var UICheckbox = UIElement.extend({ }, render: function() { + var id = 'cb%08x'.format(Math.random() * 0xffffffff); var frameEl = E('div', { 'id': this.options.id, 'class': 'cbi-checkbox' @@ -231,21 +232,24 @@ var UICheckbox = UIElement.extend({ })); frameEl.appendChild(E('input', { - 'id': this.options.id ? 'widget.' + this.options.id : null, + 'id': id, 'name': this.options.name, 'type': 'checkbox', 'value': this.options.value_enabled, - 'checked': (this.value == this.options.value_enabled) ? '' : null + 'checked': (this.value == this.options.value_enabled) ? '' : null, + 'data-widget-id': this.options.id ? 'widget.' + this.options.id : null })); + frameEl.appendChild(E('label', { 'for': id })); + return this.bind(frameEl); }, bind: function(frameEl) { this.node = frameEl; - this.setUpdateEvents(frameEl.lastElementChild, 'click', 'blur'); - this.setChangeEvents(frameEl.lastElementChild, 'change'); + this.setUpdateEvents(frameEl.lastElementChild.previousElementSibling, 'click', 'blur'); + this.setChangeEvents(frameEl.lastElementChild.previousElementSibling, 'change'); L.dom.bindClassInstance(frameEl, this); @@ -253,7 +257,7 @@ var UICheckbox = UIElement.extend({ }, isChecked: function() { - return this.node.lastElementChild.checked; + return this.node.lastElementChild.previousElementSibling.checked; }, getValue: function() { @@ -263,7 +267,7 @@ var UICheckbox = UIElement.extend({ }, setValue: function(value) { - this.node.lastElementChild.checked = (value == this.options.value_enabled); + this.node.lastElementChild.previousElementSibling.checked = (value == this.options.value_enabled); } }); @@ -1342,7 +1346,7 @@ var UIDynamicList = UIElement.extend({ }); dl.lastElementChild.appendChild(inputEl); - dl.lastElementChild.appendChild(E('div', { 'class': 'cbi-button cbi-button-add' }, '+')); + dl.lastElementChild.appendChild(E('div', { 'class': 'btn cbi-button cbi-button-add' }, '+')); if (this.options.datatype || this.options.validate) L.ui.addValidator(inputEl, this.options.datatype || 'string', @@ -2536,10 +2540,12 @@ return L.Class.extend({ L.dom.content(i, [ _('Unsaved Changes'), ': ', n ]); i.classList.add('flash'); i.style.display = ''; + document.dispatchEvent(new CustomEvent('uci-new-changes')); } else { i.classList.remove('flash'); i.style.display = 'none'; + document.dispatchEvent(new CustomEvent('uci-clear-changes')); } }, @@ -2869,7 +2875,7 @@ return L.Class.extend({ var arg_offset = arguments.length - 2; return Function.prototype.bind.apply(function() { - var t = arguments[arg_offset].target; + var t = arguments[arg_offset].currentTarget; t.classList.add('spinning'); t.disabled = true; diff --git a/modules/luci-compat/luasrc/view/cbi/footer.htm b/modules/luci-compat/luasrc/view/cbi/footer.htm index ed632202ce..fecf1bce7c 100644 --- a/modules/luci-compat/luasrc/view/cbi/footer.htm +++ b/modules/luci-compat/luasrc/view/cbi/footer.htm @@ -8,26 +8,26 @@ if pageaction and (display_back or display_skip or display_apply or display_save or display_reset) then - %><div class="cbi-page-actions"><% + %><div class="cbi-page-actions control-group"><% if display_back then - %><input class="cbi-button cbi-button-link" type="button" value="<%:Back to Overview%>" onclick="location.href='<%=pcdata(redirect)%>'" /> <% + %><input class="btn cbi-button cbi-button-link" type="button" value="<%:Back to Overview%>" onclick="location.href='<%=pcdata(redirect)%>'" /> <% end if display_skip then - %><input class="cbi-button cbi-button-skip" type="button" value="<%:Skip%>" onclick="cbi_submit(this, 'cbi.skip')" /> <% + %><input class="btn cbi-button cbi-button-skip" type="button" value="<%:Skip%>" onclick="cbi_submit(this, 'cbi.skip')" /> <% end if display_apply then - %><input class="cbi-button cbi-button-apply" type="button" value="<%:Save & Apply%>" onclick="cbi_submit(this, 'cbi.apply')" /> <% + %><input class="btn cbi-button cbi-button-apply" type="button" value="<%:Save & Apply%>" onclick="cbi_submit(this, 'cbi.apply')" /> <% end if display_save then - %><input class="cbi-button cbi-button-save" type="submit" value="<%:Save%>" /> <% + %><input class="btn cbi-button cbi-button-save" type="submit" value="<%:Save%>" /> <% end if display_reset then - %><input class="cbi-button cbi-button-reset" type="button" value="<%:Reset%>" onclick="location.href='<%=REQUEST_URI%>'" /> <% + %><input class="btn cbi-button cbi-button-reset" type="button" value="<%:Reset%>" onclick="location.href='<%=REQUEST_URI%>'" /> <% end %></div><% diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js index 4e217a5416..81ea32d48c 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js @@ -395,7 +395,7 @@ return L.view.extend({ ss.anonymous = true; so = ss.option(form.Value, 'name', _('Hostname')); - so.datatype = 'hostname("strict")'; + so.validate = validateHostname; so.rmempty = true; so.write = function(section, value) { uci.set('dhcp', section, 'name', value); diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/diagnostics.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/diagnostics.js index ee2a466151..24ab84ab9e 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/diagnostics.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/diagnostics.js @@ -79,8 +79,8 @@ return L.view.extend({ }, { 'click': ui.createHandlerFn(this, 'handlePing'), 'classes': { - 'ping': 'cbi-button cbi-button-action', - 'ping6': 'cbi-button cbi-button-action' + 'ping': 'btn cbi-button cbi-button-action', + 'ping6': 'btn cbi-button cbi-button-action' } }).render() : E('button', { 'class': 'cbi-button cbi-button-action', @@ -102,8 +102,8 @@ return L.view.extend({ }, { 'click': ui.createHandlerFn(this, 'handleTraceroute'), 'classes': { - 'traceroute': 'cbi-button cbi-button-action', - 'traceroute6': 'cbi-button cbi-button-action' + 'traceroute': 'btn cbi-button cbi-button-action', + 'traceroute6': 'btn cbi-button cbi-button-action' } }).render() : E('button', { 'class': 'cbi-button cbi-button-action', diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js index 5cc452c9f3..0e6e5a2e25 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js @@ -874,6 +874,9 @@ return L.view.extend({ o = s.option(form.Value, 'ula_prefix', _('IPv6 ULA-Prefix')); o.datatype = 'cidr6'; + o = s.option(form.Flag, 'packet_steering', _('Packet Steering'), _('Enable packet steering across all CPUs. May help or hinder network speed.')); + o.optional = true; + if (dslModemType != null) { s = m.section(form.TypedSection, 'dsl', _('DSL')); diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js index eaa0813548..2682871345 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js @@ -46,7 +46,7 @@ function render_signal_badge(signalPercent, signalValue, noiseValue, wrap) { icon = L.resource('icons/signal-75-100.png'); if (signalValue != null && signalValue != 0 && noiseValue != null && noiseValue != 0) { - value = '%d / %d %s'.format(signalValue, noiseValue, _('dBm')); + value = '%d/%d\xa0%s'.format(signalValue, noiseValue, _('dBm')); title = '%s: %d %s / %s: %d %s / %s %d'.format( _('Signal'), signalValue, _('dBm'), _('Noise'), noiseValue, _('dBm'), @@ -65,8 +65,18 @@ function render_signal_badge(signalPercent, signalValue, noiseValue, wrap) { title = _('Interface is disabled'); } - return E('div', { 'class': wrap ? 'center' : 'ifacebadge', 'title': title }, - [ E('img', { 'src': icon }), wrap ? E('br') : ' ', value ]); + return E('div', { + 'class': wrap ? 'center' : 'ifacebadge', + 'title': title, + 'data-signal': signalValue, + 'data-noise': noiseValue + }, [ + E('img', { 'src': icon }), + E('span', {}, [ + wrap ? E('br') : ' ', + value + ]) + ]); } function render_network_badge(radioNet) { @@ -155,13 +165,16 @@ function render_modal_status(node, radioNet) { } function format_wifirate(rate) { - var s = '%.1f Mbit/s, %dMHz'.format(rate.rate / 1000, rate.mhz); - - if (rate.ht || rate.vht) { - if (rate.vht) s += ', VHT-MCS %d'.format(rate.mcs); - if (rate.nss) s += ', VHT-NSS %d'.format(rate.nss); - if (rate.ht) s += ', MCS %s'.format(rate.mcs); - if (rate.short_gi) s += ', Short GI'; + var s = '%.1f\xa0%s, %d\xa0%s'.format(rate.rate / 1000, _('Mbit/s'), rate.mhz, _('MHz')), + ht = rate.ht, vht = rate.vht, + mhz = rate.mhz, nss = rate.nss, + mcs = rate.mcs, sgi = rate.short_gi; + + if (ht || vht) { + if (vht) s += ', VHT-MCS\xa0%d'.format(mcs); + if (nss) s += ', VHT-NSS\xa0%d'.format(nss); + if (ht) s += ', MCS\xa0%s'.format(mcs); + if (sgi) s += ', ' + _('Short GI').replace(/ /g, '\xa0'); } return s; @@ -543,20 +556,26 @@ return L.view.extend({ var hint; if (name && ipv4 && ipv6) - hint = '%s (%s, %s)'.format(name, ipv4, ipv6); + hint = '%s <span class="hide-xs">(%s, %s)</span>'.format(name, ipv4, ipv6); else if (name && (ipv4 || ipv6)) - hint = '%s (%s)'.format(name, ipv4 || ipv6); + hint = '%s <span class="hide-xs">(%s)</span>'.format(name, ipv4 || ipv6); else hint = name || ipv4 || ipv6 || '?'; var row = [ - E('span', { 'class': 'ifacebadge' }, [ + E('span', { + 'class': 'ifacebadge', + 'data-ifname': bss.network.getIfname(), + 'data-ssid': bss.network.getSSID() + }, [ E('img', { 'src': L.resource('icons/wifi%s.png').format(bss.network.isUp() ? '' : '_disabled'), 'title': bss.radio.getI18n() }), - ' %s '.format(bss.network.getShortName()), - E('small', '(%s)'.format(bss.network.getIfname())) + E('span', [ + ' %s '.format(bss.network.getShortName()), + E('small', '(%s)'.format(bss.network.getIfname())) + ]) ]), bss.mac, hint, @@ -570,7 +589,7 @@ return L.view.extend({ if (bss.network.isClientDisconnectSupported()) { if (table.firstElementChild.childNodes.length < 6) - table.firstElementChild.appendChild(E('div', { 'class': 'th nowrap right'}, [ _('Disconnect') ])); + table.firstElementChild.appendChild(E('div', { 'class': 'th cbi-section-actions'})); row.push(E('button', { 'class': 'cbi-button cbi-button-remove', @@ -2143,13 +2162,13 @@ return L.view.extend({ .then(L.bind(this.poll_status, this, nodes)); }, this), 5); - var table = E('div', { 'class': 'table', 'id': 'wifi_assoclist_table' }, [ + var table = E('div', { 'class': 'table assoclist', 'id': 'wifi_assoclist_table' }, [ E('div', { 'class': 'tr table-titles' }, [ E('div', { 'class': 'th nowrap' }, _('Network')), E('div', { 'class': 'th hide-xs' }, _('MAC-Address')), E('div', { 'class': 'th' }, _('Host')), - E('div', { 'class': 'th nowrap' }, _('Signal / Noise')), - E('div', { 'class': 'th nowrap' }, _('RX Rate / TX Rate')) + E('div', { 'class': 'th' }, _('Signal / Noise')), + E('div', { 'class': 'th' }, _('RX Rate / TX Rate')) ]) ]); diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/40_dhcp.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/40_dhcp.js index 9975a648ff..5de79a8ee2 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/40_dhcp.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/40_dhcp.js @@ -23,7 +23,7 @@ return L.Class.extend({ leases6 = Array.isArray(data[0].dhcp6_leases) ? data[0].dhcp6_leases : [], machints = data[1].getMACHints(false); - var table = E('div', { 'class': 'table' }, [ + var table = E('div', { 'class': 'table lases' }, [ E('div', { 'class': 'tr table-titles' }, [ E('div', { 'class': 'th' }, _('Hostname')), E('div', { 'class': 'th' }, _('IPv4-Address')), @@ -50,7 +50,7 @@ return L.Class.extend({ ]; }), E('em', _('There are no active leases'))); - var table6 = E('div', { 'class': 'table' }, [ + var table6 = E('div', { 'class': 'table leases6' }, [ E('div', { 'class': 'tr table-titles' }, [ E('div', { 'class': 'th' }, _('Host')), E('div', { 'class': 'th' }, _('IPv6-Address')), diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/60_wifi.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/60_wifi.js index 86468c7188..5eff561536 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/60_wifi.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/60_wifi.js @@ -58,16 +58,16 @@ function renderbox(radio, networks) { } function wifirate(rt) { - var s = '%.1f %s, %d%s'.format(rt.rate / 1000, _('Mbit/s'), rt.mhz, _('MHz')), + var s = '%.1f\xa0%s, %d\xa0%s'.format(rt.rate / 1000, _('Mbit/s'), rt.mhz, _('MHz')), ht = rt.ht, vht = rt.vht, mhz = rt.mhz, nss = rt.nss, mcs = rt.mcs, sgi = rt.short_gi; if (ht || vht) { - if (vht) s += ', VHT-MCS %d'.format(mcs); - if (nss) s += ', VHT-NSS %d'.format(nss); - if (ht) s += ', MCS %s'.format(mcs); - if (sgi) s += ', ' + _('Short GI'); + if (vht) s += ', VHT-MCS\xa0%d'.format(mcs); + if (nss) s += ', VHT-NSS\xa0%d'.format(nss); + if (ht) s += ', MCS\xa0%s'.format(mcs); + if (sgi) s += ', ' + _('Short GI').replace(/ /g, '\xa0'); } return s; @@ -119,13 +119,13 @@ return L.Class.extend({ if (!table.lastElementChild) return null; - var assoclist = E('div', { 'class': 'table' }, [ + var assoclist = E('div', { 'class': 'table assoclist' }, [ E('div', { 'class': 'tr table-titles' }, [ E('div', { 'class': 'th nowrap' }, _('Network')), E('div', { 'class': 'th hide-xs' }, _('MAC-Address')), E('div', { 'class': 'th' }, _('Host')), - E('div', { 'class': 'th nowrap' }, '%s / %s'.format(_('Signal'), _('Noise'))), - E('div', { 'class': 'th nowrap' }, '%s / %s'.format(_('RX Rate'), _('TX Rate'))) + E('div', { 'class': 'th' }, '%s / %s'.format(_('Signal'), _('Noise'))), + E('div', { 'class': 'th' }, '%s / %s'.format(_('RX Rate'), _('TX Rate'))) ]) ]); @@ -154,37 +154,51 @@ return L.Class.extend({ var sig_title, sig_value; if (bss.noise) { - sig_value = '%d / %d %s'.format(bss.signal, bss.noise, _('dBm')); + sig_value = '%d/%d\xa0%s'.format(bss.signal, bss.noise, _('dBm')); sig_title = '%s: %d %s / %s: %d %s / %s %d'.format( _('Signal'), bss.signal, _('dBm'), _('Noise'), bss.noise, _('dBm'), _('SNR'), bss.signal - bss.noise); } else { - sig_value = '%d %s'.format(bss.signal, _('dBm')); + sig_value = '%d\xa0%s'.format(bss.signal, _('dBm')); sig_title = '%s: %d %s'.format(_('Signal'), bss.signal, _('dBm')); } var hint; if (name && ipv4 && ipv6) - hint = '%s (%s, %s)'.format(name, ipv4, ipv6); + hint = '%s <span class="hide-xs">(%s, %s)</span>'.format(name, ipv4, ipv6); else if (name && (ipv4 || ipv6)) - hint = '%s (%s)'.format(name, ipv4 || ipv6); + hint = '%s <span class="hide-xs">(%s)</span>'.format(name, ipv4 || ipv6); else hint = name || ipv4 || ipv6 || '?'; var row = [ - E('span', { 'class': 'ifacebadge', 'title': networks[i].getI18n() }, [ + E('span', { + 'class': 'ifacebadge', + 'title': networks[i].getI18n(), + 'data-ifname': networks[i].getIfname(), + 'data-ssid': networks[i].getActiveSSID() + }, [ E('img', { 'src': L.resource('icons/wifi.png') }), - ' ', networks[i].getShortName(), - E('small', {}, [ ' (', networks[i].getIfname(), ')' ]) + E('span', {}, [ + ' ', networks[i].getShortName(), + E('small', {}, [ ' (', networks[i].getIfname(), ')' ]) + ]) ]), bss.mac, hint, - E('span', { 'class': 'ifacebadge', 'title': sig_title }, [ + E('span', { + 'class': 'ifacebadge', + 'title': sig_title, + 'data-signal': bss.signal, + 'data-noise': bss.noise + }, [ E('img', { 'src': icon }), - ' ', sig_value + E('span', {}, [ + ' ', sig_value + ]) ]), E('span', {}, [ E('span', wifirate(bss.rx)), @@ -195,7 +209,7 @@ return L.Class.extend({ if (networks[i].isClientDisconnectSupported()) { if (assoclist.firstElementChild.childNodes.length < 6) - assoclist.firstElementChild.appendChild(E('div', { 'class': 'th nowrap right' }, [ _('Disconnect') ])); + assoclist.firstElementChild.appendChild(E('div', { 'class': 'th cbi-section-actions' })); row.push(E('button', { 'class': 'cbi-button cbi-button-remove', diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/processes.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/processes.js index b996b78ce5..d56eca5071 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/processes.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/processes.js @@ -38,7 +38,7 @@ return L.view.extend({ proc.COMMAND, proc['%CPU'], proc['%MEM'], - E('div', { 'class': 'nowrap' }, [ + E('div', {}, [ E('button', { 'class': 'btn cbi-button-action', 'click': ui.createHandlerFn(this, 'handleSignal', 1, proc.PID) @@ -70,7 +70,7 @@ return L.view.extend({ E('div', { 'class': 'th' }, _('Command')), E('div', { 'class': 'th' }, _('CPU usage (%)')), E('div', { 'class': 'th' }, _('Memory usage (%)')), - E('div', { 'class': 'th center' }, _('Actions')) + E('div', { 'class': 'th center nowrap cbi-section-actions' }) ]) ]) ]); diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/crontab.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/crontab.js index c2ab770c51..bd1eb6e51a 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/crontab.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/crontab.js @@ -21,7 +21,7 @@ return L.view.extend({ render: function(crontab) { return E([ E('h2', _('Scheduled Tasks')), - E('p', {}, + E('p', { 'class': 'cbi-section-descr' }, _('This is the system crontab in which scheduled tasks can be defined.') + _('<br/>Note: you need to manually restart the cron service if the crontab file was empty before editing.')), E('p', {}, E('textarea', { 'style': 'width:100%', 'rows': 10 }, [ crontab != null ? crontab : '' ])) diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/startup.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/startup.js index 560282de77..587f867aa6 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/startup.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/startup.js @@ -36,12 +36,12 @@ return L.view.extend({ }, handleEnableDisable: function(name, isEnabled, ev) { - return this.handleAction(name, isEnabled ? 'disable' : 'enable', ev).then(L.bind(function(name, isEnabled, cell) { - L.dom.content(cell, this.renderEnableDisable({ + return this.handleAction(name, isEnabled ? 'disable' : 'enable', ev).then(L.bind(function(name, isEnabled, btn) { + btn.parentNode.replaceChild(this.renderEnableDisable({ name: name, enabled: isEnabled - })); - }, this, name, !isEnabled, ev.currentTarget.parentNode)); + }), btn); + }, this, name, !isEnabled, ev.currentTarget)); }, handleRcLocalSave: function(ev) { @@ -71,10 +71,7 @@ return L.view.extend({ E('div', { 'class': 'tr table-titles' }, [ E('div', { 'class': 'th' }, _('Start priority')), E('div', { 'class': 'th' }, _('Initscript')), - E('div', { 'class': 'th' }, _('Enable/Disable')), - E('div', { 'class': 'th' }, _('Start')), - E('div', { 'class': 'th' }, _('Restart')), - E('div', { 'class': 'th' }, _('Stop')) + E('div', { 'class': 'th nowrap cbi-section-actions' }) ]) ]); @@ -93,10 +90,12 @@ return L.view.extend({ rows.push([ '%02d'.format(list[i].index), list[i].name, - this.renderEnableDisable(list[i]), - E('button', { 'class': 'btn cbi-button-action', 'click': ui.createHandlerFn(this, 'handleAction', list[i].name, 'start') }, _('Start')), - E('button', { 'class': 'btn cbi-button-action', 'click': ui.createHandlerFn(this, 'handleAction', list[i].name, 'restart') }, _('Restart')), - E('button', { 'class': 'btn cbi-button-action', 'click': ui.createHandlerFn(this, 'handleAction', list[i].name, 'stop') }, _('Stop')) + E('div', [ + this.renderEnableDisable(list[i]), + E('button', { 'class': 'btn cbi-button-action', 'click': ui.createHandlerFn(this, 'handleAction', list[i].name, 'start') }, _('Start')), + E('button', { 'class': 'btn cbi-button-action', 'click': ui.createHandlerFn(this, 'handleAction', list[i].name, 'restart') }, _('Restart')), + E('button', { 'class': 'btn cbi-button-action', 'click': ui.createHandlerFn(this, 'handleAction', list[i].name, 'stop') }, _('Stop')) + ]) ]); } diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/system.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/system.js index c2f31e7b4c..8fe6b57545 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/system.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/system.js @@ -48,28 +48,28 @@ callTimezone = rpc.declare({ CBILocalTime = form.DummyValue.extend({ renderWidget: function(section_id, option_id, cfgvalue) { return E([], [ - E('span', {}, [ - E('input', { - 'id': 'localtime', - 'type': 'text', - 'readonly': true, - 'value': new Date(cfgvalue * 1000).toLocaleString() - }) - ]), - ' ', - E('button', { - 'class': 'cbi-button cbi-button-apply', - 'click': ui.createHandlerFn(this, function() { - return callSetLocaltime(Math.floor(Date.now() / 1000)); - }) - }, _('Sync with browser')), - ' ', - this.ntpd_support ? E('button', { - 'class': 'cbi-button cbi-button-apply', - 'click': ui.createHandlerFn(this, function() { - return callInitAction('sysntpd', 'restart'); - }) - }, _('Sync with NTP-Server')) : '' + E('input', { + 'id': 'localtime', + 'type': 'text', + 'readonly': true, + 'value': new Date(cfgvalue * 1000).toLocaleString() + }), + E('br'), + E('span', { 'class': 'control-group' }, [ + E('button', { + 'class': 'cbi-button cbi-button-apply', + 'click': ui.createHandlerFn(this, function() { + return callSetLocaltime(Math.floor(Date.now() / 1000)); + }) + }, _('Sync with browser')), + ' ', + this.ntpd_support ? E('button', { + 'class': 'cbi-button cbi-button-apply', + 'click': ui.createHandlerFn(this, function() { + return callInitAction('sysntpd', 'restart'); + }) + }, _('Sync with NTP-Server')) : '' + ]) ]); }, }); |