} \
';
+var isReadonlyView = !L.hasViewPermission() || null;
+
var callMountPoints = rpc.declare({
object: 'luci',
method: 'getMountPoints',
errs || inst || '',
E('div', { 'class': 'right' }, [
E('label', { 'class': 'cbi-checkbox', 'style': 'float:left' }, [
- E('input', { 'id': 'overwrite-cb', 'type': 'checkbox', 'name': 'overwrite' }), ' ',
+ E('input', { 'id': 'overwrite-cb', 'type': 'checkbox', 'name': 'overwrite', 'disabled': isReadonlyView }), ' ',
E('label', { 'for': 'overwrite-cb' }), ' ',
_('Overwrite files from other package(s)')
]),
'data-command': 'install',
'data-package': name,
'class': 'btn cbi-button-action',
- 'click': handleOpkg
+ 'click': handleOpkg,
+ 'disabled': isReadonlyView
}, _('Install'))
])
]);
ui.addNotification(null, E('p', {}, [ _('Unable to save %s: %s').format(file, err) ]));
});
})).then(ui.hideModal);
- }
+ },
+ 'disabled': isReadonlyView
}, _('Save')),
]));
]),
desc || '',
E('div', { 'style': 'display:flex; justify-content:space-between; flex-wrap:wrap' }, [
- E('label', {}, [
- E('input', { type: 'checkbox', checked: 'checked', name: 'autoremove' }),
+ E('label', { 'class': 'cbi-checkbox', 'style': 'float:left' }, [
+ E('input', { 'id': 'autoremove-cb', 'type': 'checkbox', 'checked': 'checked', 'name': 'autoremove', 'disabled': isReadonlyView }), ' ',
+ E('label', { 'for': 'autoremove-cb' }), ' ',
_('Automatically remove unused dependencies')
]),
E('div', { 'style': 'flex-grow:1', 'class': 'right' }, [
'data-command': 'remove',
'data-package': name,
'class': 'btn cbi-button-negative',
- 'click': handleOpkg
+ 'click': handleOpkg,
+ 'disabled': isReadonlyView
}, _('Remove'))
])
])
E('div', {
'class': 'btn',
'click': L.bind(function(res) {
+ if (ui.menu && ui.menu.flushCache)
+ ui.menu.flushCache();
+
ui.hideModal();
updateLists();
E('div', {}, [
E('label', {}, _('Download and install package') + ':'),
E('span', { 'class': 'control-group' }, [
- E('input', { 'type': 'text', 'name': 'install', 'placeholder': _('Package name or URL…'), 'keydown': function(ev) { if (ev.keyCode === 13) handleManualInstall(ev) } }),
- E('button', { 'class': 'btn cbi-button cbi-button-action', 'click': handleManualInstall }, [ _('OK') ])
+ E('input', { 'type': 'text', 'name': 'install', 'placeholder': _('Package name or URL…'), 'keydown': function(ev) { if (ev.keyCode === 13) handleManualInstall(ev) }, 'disabled': isReadonlyView }),
+ E('button', { 'class': 'btn cbi-button cbi-button-action', 'click': handleManualInstall, 'disabled': isReadonlyView }, [ _('OK') ])
])
]),
E('div', {}, [
E('label', {}, _('Actions') + ':'), ' ',
E('span', { 'class': 'control-group' }, [
- E('button', { 'class': 'btn cbi-button-positive', 'data-command': 'update', 'click': handleOpkg }, [ _('Update lists…') ]), ' ',
- E('button', { 'class': 'btn cbi-button-action', 'click': handleUpload }, [ _('Upload Package…') ]), ' ',
+ E('button', { 'class': 'btn cbi-button-positive', 'data-command': 'update', 'click': handleOpkg, 'disabled': isReadonlyView }, [ _('Update lists…') ]), ' ',
+ E('button', { 'class': 'btn cbi-button-action', 'click': handleUpload, 'disabled': isReadonlyView }, [ _('Upload Package…') ]), ' ',
E('button', { 'class': 'btn cbi-button-neutral', 'click': handleConfig }, [ _('Configure opkg…') ])
])
])