10 margin: .5em 0 1em 0; \
12 justify-content: space-around; \
17 white-space: nowrap; \
19 box-sizing: border-box; \
24 .controls > *:first-child, \
25 .controls > * > label { \
30 .controls > *:nth-child(2), \
31 .controls > *:nth-child(3) { \
35 .controls > * > .btn { \
45 .controls > div > input { \
51 white-space: nowrap; \
54 ul.deps, ul.deps ul, ul.errors { \
58 ul.deps li, ul.errors li { \
64 display: inline-block; \
70 white-space: nowrap; \
77 padding-left: 1.5em; \
80 ul.errors li:before { \
82 display: inline-block; \
84 margin-left: -1.5em; \
88 var callMountPoints
= rpc
.declare({
90 method
: 'getMountPoints',
91 expect
: { result
: [] }
95 available
: { providers
: {}, pkgs
: {} },
96 installed
: { providers
: {}, pkgs
: {} }
99 var currentDisplayMode
= 'available', currentDisplayRows
= [];
101 function parseList(s
, dest
)
103 var re
= /([^\n]*)\n/g,
104 pkg
= null, key
= null, val
= null, m
;
106 while ((m
= re
.exec(s
)) !== null) {
107 if (m
[1].match(/^\s(.*)$/)) {
108 if (pkg
!== null && key
!== null && val
!== null)
109 val
+= '\n' + RegExp
.$1.trim();
114 if (key
!== null && val
!== null) {
122 var list
= val
.split(/\s*,\s*/);
123 if (list
.length
!== 1 || list
[0].length
> 0)
127 case 'installed-time':
128 pkg
.installtime
= new Date(+val
* 1000);
131 case 'installed-size':
132 pkg
.installsize
= +val
;
136 var stat
= val
.split(/\s+/),
149 pkg
.installed
= true;
156 pkg
.essential
= true;
164 case 'auto-installed':
178 if (m
[1].trim().match(/^([\w-]+)\s*:(.+)$/)) {
179 key
= RegExp
.$1.toLowerCase();
180 val
= RegExp
.$2.trim();
183 dest
.pkgs
[pkg
.name
] = pkg
;
185 var provides
= dest
.providers
[pkg
.name
] ? [] : [ pkg
.name
];
188 provides
.push
.apply(provides
, pkg
.provides
);
190 provides
.forEach(function(p
) {
191 dest
.providers
[p
] = dest
.providers
[p
] || [];
192 dest
.providers
[p
].push(pkg
);
198 function display(pattern
)
200 var src
= packages
[currentDisplayMode
=== 'updates' ? 'installed' : currentDisplayMode
],
201 table
= document
.querySelector('#packages'),
202 pager
= document
.querySelector('#pager');
204 currentDisplayRows
.length
= 0;
206 if (typeof(pattern
) === 'string' && pattern
.length
> 0)
207 pattern
= new RegExp(pattern
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'ig');
209 for (var name
in src
.pkgs
) {
210 var pkg
= src
.pkgs
[name
],
211 desc
= pkg
.description
|| '',
214 if (!pkg
.size
&& packages
.available
.pkgs
[name
])
215 altsize
= packages
.available
.pkgs
[name
].size
;
217 if (!desc
&& packages
.available
.pkgs
[name
])
218 desc
= packages
.available
.pkgs
[name
].description
|| '';
220 desc
= desc
.split(/\n/);
221 desc
= desc
[0].trim() + (desc
.length
> 1 ? '…' : '');
223 if ((pattern
instanceof RegExp
) &&
224 !name
.match(pattern
) && !desc
.match(pattern
))
229 if (currentDisplayMode
=== 'updates') {
230 var avail
= packages
.available
.pkgs
[name
],
231 inst
= packages
.installed
.pkgs
[name
];
233 if (!inst
|| !inst
.installed
)
236 if (!avail
|| compareVersion(avail
.version
, pkg
.version
) <= 0)
239 ver
= '%s » %s'.format(
240 truncateVersion(pkg
.version
|| '-'),
241 truncateVersion(avail
.version
|| '-'));
244 'class': 'btn cbi-button-positive',
245 'data-package': name
,
246 'click': handleInstall
249 else if (currentDisplayMode
=== 'installed') {
253 ver
= truncateVersion(pkg
.version
|| '-');
255 'class': 'btn cbi-button-negative',
256 'data-package': name
,
257 'click': handleRemove
261 var inst
= packages
.installed
.pkgs
[name
];
263 ver
= truncateVersion(pkg
.version
|| '-');
265 if (!inst
|| !inst
.installed
)
267 'class': 'btn cbi-button-action',
268 'data-package': name
,
269 'click': handleInstall
271 else if (inst
.installed
&& inst
.version
!= pkg
.version
)
273 'class': 'btn cbi-button-positive',
274 'data-package': name
,
275 'click': handleInstall
279 'class': 'btn cbi-button-neutral',
280 'disabled': 'disabled'
284 name
= '%h'.format(name
);
285 desc
= '%h'.format(desc
|| '-');
288 name
= name
.replace(pattern
, '<ins>$&</ins>');
289 desc
= desc
.replace(pattern
, '<ins>$&</ins>');
292 currentDisplayRows
.push([
295 pkg
.size
? '%.1024mB'.format(pkg
.size
)
296 : (altsize
? '~%.1024mB'.format(altsize
) : '-'),
302 currentDisplayRows
.sort(function(a
, b
) {
305 else if (a
[0] > b
[0])
311 pager
.parentNode
.style
.display
= '';
312 pager
.setAttribute('data-offset', 100);
313 handlePage({ target
: pager
.querySelector('.prev') });
316 function handlePage(ev
)
318 var filter
= document
.querySelector('input[name="filter"]'),
319 pager
= ev
.target
.parentNode
,
320 offset
= +pager
.getAttribute('data-offset'),
321 next
= ev
.target
.classList
.contains('next');
323 if ((next
&& (offset
+ 100) >= currentDisplayRows
.length
) ||
324 (!next
&& (offset
< 100)))
327 offset
+= next
? 100 : -100;
328 pager
.setAttribute('data-offset', offset
);
329 pager
.querySelector('.text').firstChild
.data
= currentDisplayRows
.length
330 ? _('Displaying %d-%d of %d').format(1 + offset
, Math
.min(offset
+ 100, currentDisplayRows
.length
), currentDisplayRows
.length
)
334 pager
.querySelector('.prev').setAttribute('disabled', 'disabled');
336 pager
.querySelector('.prev').removeAttribute('disabled');
338 if ((offset
+ 100) >= currentDisplayRows
.length
)
339 pager
.querySelector('.next').setAttribute('disabled', 'disabled');
341 pager
.querySelector('.next').removeAttribute('disabled');
343 var placeholder
= _('No information available');
347 E('span', {}, _('No packages matching "<strong>%h</strong>".').format(filter
.value
)), ' (',
348 E('a', { href
: '#', onclick
: 'handleReset(event)' }, _('Reset')), ')'
351 cbi_update_table('#packages', currentDisplayRows
.slice(offset
, offset
+ 100),
355 function handleMode(ev
)
357 var tab
= findParent(ev
.target
, 'li');
358 if (tab
.getAttribute('data-mode') === currentDisplayMode
)
361 tab
.parentNode
.querySelectorAll('li').forEach(function(li
) {
362 li
.classList
.remove('cbi-tab');
363 li
.classList
.add('cbi-tab-disabled');
366 tab
.classList
.remove('cbi-tab-disabled');
367 tab
.classList
.add('cbi-tab');
369 currentDisplayMode
= tab
.getAttribute('data-mode');
371 display(document
.querySelector('input[name="filter"]').value
);
381 else if (c
=== '' || c
>= '0' && c
<= '9')
383 else if ((c
>= 'a' && c
<= 'z') || (c
>= 'A' && c
<= 'Z'))
384 return c
.charCodeAt(0);
386 return c
.charCodeAt(0) + 256;
389 function compareVersion(val
, ref
)
392 isdigit
= { 0:1, 1:1, 2:1, 3:1, 4:1, 5:1, 6:1, 7:1, 8:1, 9:1 };
400 while (vi
< val
.length
|| ri
< ref
.length
) {
403 while ((vi
< val
.length
&& !isdigit
[val
.charAt(vi
)]) ||
404 (ri
< ref
.length
&& !isdigit
[ref
.charAt(ri
)])) {
405 var vc
= orderOf(val
.charAt(vi
)), rc
= orderOf(ref
.charAt(ri
));
412 while (val
.charAt(vi
) === '0')
415 while (ref
.charAt(ri
) === '0')
418 while (isdigit
[val
.charAt(vi
)] && isdigit
[ref
.charAt(ri
)]) {
419 first_diff
= first_diff
|| (val
.charCodeAt(vi
) - ref
.charCodeAt(ri
));
423 if (isdigit
[val
.charAt(vi
)])
425 else if (isdigit
[ref
.charAt(ri
)])
434 function versionSatisfied(ver
, ref
, vop
)
436 var r
= compareVersion(ver
, ref
);
460 function pkgStatus(pkg
, vop
, ver
, info
)
462 info
.errors
= info
.errors
|| [];
463 info
.install
= info
.install
|| [];
466 if (vop
&& !versionSatisfied(pkg
.version
, ver
, vop
)) {
469 (packages
.available
.providers
[pkg
.name
] || []).forEach(function(p
) {
470 if (!repl
&& versionSatisfied(p
.version
, ver
, vop
))
475 info
.install
.push(repl
);
478 'data-tooltip': _('Requires update to %h %h')
479 .format(repl
.name
, repl
.version
)
480 }, _('Needs upgrade'));
483 info
.errors
.push(_('The installed version of package <em>%h</em> is not compatible, require %s while %s is installed.').format(pkg
.name
, truncateVersion(ver
, vop
), truncateVersion(pkg
.version
)));
486 'class': 'label warning',
487 'data-tooltip': _('Require version %h %h,\ninstalled %h')
488 .format(vop
, ver
, pkg
.version
)
489 }, _('Version incompatible'));
492 return E('span', { 'class': 'label notice' }, _('Installed'));
494 else if (!pkg
.missing
) {
495 if (!vop
|| versionSatisfied(pkg
.version
, ver
, vop
)) {
496 info
.install
.push(pkg
);
497 return E('span', { 'class': 'label' }, _('Not installed'));
500 info
.errors
.push(_('The repository version of package <em>%h</em> is not compatible, require %s but only %s is available.')
501 .format(pkg
.name
, truncateVersion(ver
, vop
), truncateVersion(pkg
.version
)));
504 'class': 'label warning',
505 'data-tooltip': _('Require version %h %h,\ninstalled %h')
506 .format(vop
, ver
, pkg
.version
)
507 }, _('Version incompatible'));
510 info
.errors
.push(_('Required dependency package <em>%h</em> is not available in any repository.').format(pkg
.name
));
512 return E('span', { 'class': 'label warning' }, _('Not available'));
516 function renderDependencyItem(dep
, info
)
519 vop
= dep
.version
? dep
.version
[0] : null,
520 ver
= dep
.version
? dep
.version
[1] : null,
523 for (var i
= 0; dep
.pkgs
&& i
< dep
.pkgs
.length
; i
++) {
524 var pkg
= packages
.installed
.pkgs
[dep
.pkgs
[i
]] ||
525 packages
.available
.pkgs
[dep
.pkgs
[i
]] ||
529 li
.appendChild(document
.createTextNode(' | '));
534 text
+= ' (%.1024mB)'.format(pkg
.installsize
);
536 text
+= ' (~%.1024mB)'.format(pkg
.size
);
538 li
.appendChild(E('span', { 'data-tooltip': pkg
.description
},
539 [ text
, ' ', pkgStatus(pkg
, vop
, ver
, info
) ]));
541 (pkg
.depends
|| []).forEach(function(d
) {
542 if (depends
.indexOf(d
) === -1)
548 li
.appendChild(E('span', {},
550 pkgStatus({ name
: dep
.name
, missing
: true }, vop
, ver
, info
) ]));
552 var subdeps
= renderDependencies(depends
, info
);
554 li
.appendChild(subdeps
);
559 function renderDependencies(depends
, info
)
561 var deps
= depends
|| [],
564 info
.seen
= info
.seen
|| [];
566 for (var i
= 0; i
< deps
.length
; i
++) {
569 if (deps
[i
] === 'libc')
572 if (deps
[i
].match(/^(.+)\s+\((<=|<|>|>=|=|<<|>>)(.+)\)$/)) {
573 dep
= RegExp
.$1.trim();
574 vop
= RegExp
.$2.trim();
575 ver
= RegExp
.$3.trim();
578 dep
= deps
[i
].trim();
587 (packages
.installed
.providers
[dep
] || []).forEach(function(p
) {
588 if (pkgs
.indexOf(p
.name
) === -1) pkgs
.push(p
.name
);
591 (packages
.available
.providers
[dep
] || []).forEach(function(p
) {
592 if (pkgs
.indexOf(p
.name
) === -1) pkgs
.push(p
.name
);
601 items
.push(renderDependencyItem(info
.seen
[dep
], info
));
605 return E('ul', { 'class': 'deps' }, items
);
610 function truncateVersion(v
, op
)
612 v
= v
.replace(/\b(([a-f0-9]{8})[a-f0-9]{24,32})\b/,
613 '<span data-tooltip="$1">$2…</span>');
615 if (!op
|| op
=== '=')
618 return '%h %h'.format(op
, v
);
621 function handleReset(ev
)
623 var filter
= document
.querySelector('input[name="filter"]');
629 function handleInstall(ev
)
631 var name
= ev
.target
.getAttribute('data-package'),
632 pkg
= packages
.available
.pkgs
[name
],
637 size
= _('~%.1024mB installed').format(pkg
.installsize
);
639 size
= _('~%.1024mB compressed').format(pkg
.size
);
643 var deps
= renderDependencies(pkg
.depends
, depcache
),
644 tree
= null, errs
= null, inst
= null, desc
= null;
646 if (depcache
.errors
&& depcache
.errors
.length
) {
647 errs
= E('ul', { 'class': 'errors' });
648 depcache
.errors
.forEach(function(err
) {
649 errs
.appendChild(E('li', {}, err
));
653 var totalsize
= pkg
.installsize
|| pkg
.size
|| 0,
656 if (depcache
.install
&& depcache
.install
.length
)
657 depcache
.install
.forEach(function(ipkg
) {
658 totalsize
+= ipkg
.installsize
|| ipkg
.size
|| 0;
663 _('Require approx. %.1024mB size for %d package(s) to install.')
664 .format(totalsize
, totalpkgs
));
667 tree
= E('li', '<strong>%s:</strong>'.format(_('Dependencies')));
668 tree
.appendChild(deps
);
671 if (pkg
.description
) {
672 desc
= E('div', {}, [
673 E('h5', {}, _('Description')),
674 E('p', {}, pkg
.description
)
678 ui
.showModal(_('Details for package <em>%h</em>').format(pkg
.name
), [
680 E('li', '<strong>%s:</strong> %h'.format(_('Version'), pkg
.version
)),
681 E('li', '<strong>%s:</strong> %h'.format(_('Size'), size
)),
686 E('div', { 'class': 'right' }, [
687 E('label', { 'class': 'cbi-checkbox', 'style': 'float:left' }, [
688 E('input', { 'id': 'overwrite-cb', 'type': 'checkbox', 'name': 'overwrite' }), ' ',
689 E('label', { 'for': 'overwrite-cb' }), ' ',
690 _('Overwrite files from other package(s)')
694 'click': ui
.hideModal
698 'data-command': 'install',
699 'data-package': name
,
700 'class': 'btn cbi-button-action',
707 function handleManualInstall(ev
)
709 var name_or_url
= document
.querySelector('input[name="install"]').value
,
711 'class': 'btn cbi-button-action',
712 'data-command': 'install',
713 'data-package': name_or_url
,
714 'click': function(ev
) {
715 document
.querySelector('input[name="install"]').value
= '';
718 }, _('Install')), warning
;
720 if (!name_or_url
.length
) {
723 else if (name_or_url
.indexOf('/') !== -1) {
724 warning
= E('p', {}, _('Installing packages from untrusted sources is a potential security risk! Really attempt to install <em>%h</em>?').format(name_or_url
));
726 else if (!packages
.available
.providers
[name_or_url
]) {
727 warning
= E('p', {}, _('The package <em>%h</em> is not available in any configured repository.').format(name_or_url
));
731 warning
= E('p', {}, _('Really attempt to install <em>%h</em>?').format(name_or_url
));
734 ui
.showModal(_('Manually install package'), [
736 E('div', { 'class': 'right' }, [
738 'click': ui
.hideModal
,
739 'class': 'btn cbi-button-neutral'
746 function handleConfig(ev
)
750 ui
.showModal(_('OPKG Configuration'), [
751 E('p', { 'class': 'spinning' }, _('Loading configuration data…'))
754 fs
.list('/etc/opkg').then(function(partials
) {
755 var files
= [ '/etc/opkg.conf' ];
757 for (var i
= 0; i
< partials
.length
; i
++)
758 if (partials
[i
].type
== 'file' && partials
[i
].name
.match(/\.conf$/))
759 files
.push('/etc/opkg/' + partials
[i
].name
);
761 return Promise
.all(files
.map(function(file
) {
763 .then(L
.bind(function(conf
, file
, res
) { conf
[file
] = res
}, this, conf
, file
))
764 .catch(function(err
) {
765 ui
.addNotification(null, E('p', {}, [ _('Unable to read %s: %s').format(file
, err
) ]));
772 E('p', {}, _('Below is a listing of the various configuration files used by <em>opkg</em>. Use <em>opkg.conf</em> for global settings and <em>customfeeds.conf</em> for custom repository entries. The configuration in the other files may be changed but is usually not preserved by <em>sysupgrade</em>.'))
775 Object
.keys(conf
).sort().forEach(function(file
) {
776 body
.push(E('h5', {}, '%h'.format(file
)));
777 body
.push(E('textarea', {
779 'rows': Math
.max(Math
.min(L
.toArray(conf
[file
].match(/\n/g)).length
, 10), 3)
780 }, '%h'.format(conf
[file
])));
783 body
.push(E('div', { 'class': 'right' }, [
785 'class': 'btn cbi-button-neutral',
786 'click': ui
.hideModal
790 'class': 'btn cbi-button-positive',
791 'click': function(ev
) {
793 findParent(ev
.target
, '.modal').querySelectorAll('textarea[name]')
794 .forEach(function(textarea
) {
795 data
[textarea
.getAttribute('name')] = textarea
.value
798 ui
.showModal(_('OPKG Configuration'), [
799 E('p', { 'class': 'spinning' }, _('Saving configuration data…'))
802 Promise
.all(Object
.keys(data
).map(function(file
) {
803 return fs
.write(file
, data
[file
]).catch(function(err
) {
804 ui
.addNotification(null, E('p', {}, [ _('Unable to save %s: %s').format(file
, err
) ]));
806 })).then(ui
.hideModal
);
811 ui
.showModal(_('OPKG Configuration'), body
);
815 function handleRemove(ev
)
817 var name
= ev
.target
.getAttribute('data-package'),
818 pkg
= packages
.installed
.pkgs
[name
],
819 avail
= packages
.available
.pkgs
[name
] || {},
822 if (avail
.installsize
)
823 size
= _('~%.1024mB installed').format(avail
.installsize
);
825 size
= _('~%.1024mB compressed').format(avail
.size
);
829 if (avail
.description
) {
830 desc
= E('div', {}, [
831 E('h5', {}, _('Description')),
832 E('p', {}, avail
.description
)
836 ui
.showModal(_('Remove package <em>%h</em>').format(pkg
.name
), [
838 E('li', '<strong>%s:</strong> %h'.format(_('Version'), pkg
.version
)),
839 E('li', '<strong>%s:</strong> %h'.format(_('Size'), size
))
842 E('div', { 'style': 'display:flex; justify-content:space-between; flex-wrap:wrap' }, [
844 E('input', { type
: 'checkbox', checked
: 'checked', name
: 'autoremove' }),
845 _('Automatically remove unused dependencies')
847 E('div', { 'style': 'flex-grow:1', 'class': 'right' }, [
850 'click': ui
.hideModal
854 'data-command': 'remove',
855 'data-package': name
,
856 'class': 'btn cbi-button-negative',
864 function handleOpkg(ev
)
866 return new Promise(function(resolveFn
, rejectFn
) {
867 var cmd
= ev
.target
.getAttribute('data-command'),
868 pkg
= ev
.target
.getAttribute('data-package'),
869 rem
= document
.querySelector('input[name="autoremove"]'),
870 owr
= document
.querySelector('input[name="overwrite"]');
872 var dlg
= ui
.showModal(_('Executing package manager'), [
873 E('p', { 'class': 'spinning' },
874 _('Waiting for the <em>opkg %h</em> command to complete…').format(cmd
))
877 var argv
= [ cmd
, '--force-removal-of-dependent-packages' ];
879 if (rem
&& rem
.checked
)
880 argv
.push('--autoremove');
882 if (owr
&& owr
.checked
)
883 argv
.push('--force-overwrite');
888 fs
.exec_direct('/usr/libexec/opkg-call', argv
, 'json').then(function(res
) {
889 dlg
.removeChild(dlg
.lastChild
);
892 dlg
.appendChild(E('pre', [ res
.stdout
]));
895 dlg
.appendChild(E('h5', _('Errors')));
896 dlg
.appendChild(E('pre', { 'class': 'errors' }, [ res
.stderr
]));
900 dlg
.appendChild(E('p', _('The <em>opkg %h</em> command failed with code <code>%d</code>.').format(cmd
, (res
.code
& 0xff) || -1)));
902 dlg
.appendChild(E('div', { 'class': 'right' },
905 'click': L
.bind(function(res
) {
910 rejectFn(new Error(res
.stderr
|| 'opkg error %d'.format(res
.code
)));
915 }).catch(function(err
) {
916 ui
.addNotification(null, E('p', _('Unable to execute <em>opkg %s</em> command: %s').format(cmd
, err
)));
922 function handleUpload(ev
)
924 var path
= '/tmp/upload.ipk';
925 return ui
.uploadFile(path
).then(L
.bind(function(btn
, res
) {
926 ui
.showModal(_('Manually install package'), [
927 E('p', {}, _('Installing packages from untrusted sources is a potential security risk! Really attempt to install <em>%h</em>?').format(res
.name
)),
929 res
.size
? E('li', {}, '%s: %1024.2mB'.format(_('Size'), res
.size
)) : '',
930 res
.checksum
? E('li', {}, '%s: %s'.format(_('MD5'), res
.checksum
)) : '',
931 res
.sha256sum
? E('li', {}, '%s: %s'.format(_('SHA256'), res
.sha256sum
)) : ''
933 E('div', { 'class': 'right' }, [
935 'click': function(ev
) {
939 'class': 'btn cbi-button-neutral'
940 }, _('Cancel')), ' ',
942 'class': 'btn cbi-button-action',
943 'data-command': 'install',
944 'data-package': path
,
945 'click': function(ev
) {
946 handleOpkg(ev
).finally(function() {
953 }, this, ev
.target
));
956 function downloadLists()
960 fs
.exec_direct('/usr/libexec/opkg-call', [ 'list-available' ]),
961 fs
.exec_direct('/usr/libexec/opkg-call', [ 'list-installed' ])
965 function updateLists(data
)
967 cbi_update_table('#packages', [],
968 E('div', { 'class': 'spinning' }, _('Loading package information…')));
970 packages
.available
= { providers
: {}, pkgs
: {} };
971 packages
.installed
= { providers
: {}, pkgs
: {} };
973 return (data
? Promise
.resolve(data
) : downloadLists()).then(function(data
) {
974 var pg
= document
.querySelector('.cbi-progressbar'),
975 mount
= L
.toArray(data
[0].filter(function(m
) { return m
.mount
== '/' || m
.mount
== '/overlay' }))
976 .sort(function(a
, b
) { return a
.mount
> b
.mount
})[0] || { size
: 0, free
: 0 };
978 pg
.firstElementChild
.style
.width
= Math
.floor(mount
.size
? ((100 / mount
.size
) * mount
.free
) : 100) + '%';
979 pg
.setAttribute('title', '%s (%.1024mB)'.format(pg
.firstElementChild
.style
.width
, mount
.free
));
981 parseList(data
[1], packages
.available
);
982 parseList(data
[2], packages
.installed
);
984 display(document
.querySelector('input[name="filter"]').value
);
988 var keyTimeout
= null;
990 function handleKeyUp(ev
) {
991 if (keyTimeout
!== null)
992 window
.clearTimeout(keyTimeout
);
994 keyTimeout
= window
.setTimeout(function() {
995 display(ev
.target
.value
);
1001 return downloadLists();
1004 render: function(listData
) {
1005 var query
= decodeURIComponent(L
.toArray(location
.search
.match(/\bquery=([^=]+)\b/))[1] || '');
1008 E('style', { 'type': 'text/css' }, [ css
]),
1010 E('h2', {}, _('Software')),
1012 E('div', { 'class': 'controls' }, [
1014 E('label', {}, _('Free space') + ':'),
1015 E('div', { 'class': 'cbi-progressbar', 'title': _('unknown') }, E('div', {}, [ '\u00a0' ]))
1019 E('label', {}, _('Filter') + ':'),
1020 E('span', { 'class': 'control-group' }, [
1021 E('input', { 'type': 'text', 'name': 'filter', 'placeholder': _('Type to filter…'), 'value': query
, 'keyup': handleKeyUp
}),
1022 E('button', { 'class': 'btn cbi-button', 'click': handleReset
}, [ _('Clear') ])
1027 E('label', {}, _('Download and install package') + ':'),
1028 E('span', { 'class': 'control-group' }, [
1029 E('input', { 'type': 'text', 'name': 'install', 'placeholder': _('Package name or URL…'), 'keydown': function(ev
) { if (ev
.keyCode
=== 13) handleManualInstall(ev
) } }),
1030 E('button', { 'class': 'btn cbi-button cbi-button-action', 'click': handleManualInstall
}, [ _('OK') ])
1035 E('label', {}, _('Actions') + ':'), ' ',
1036 E('span', { 'class': 'control-group' }, [
1037 E('button', { 'class': 'btn cbi-button-positive', 'data-command': 'update', 'click': handleOpkg
}, [ _('Update lists…') ]), ' ',
1038 E('button', { 'class': 'btn cbi-button-action', 'click': handleUpload
}, [ _('Upload Package…') ]), ' ',
1039 E('button', { 'class': 'btn cbi-button-neutral', 'click': handleConfig
}, [ _('Configure opkg…') ])
1044 E('ul', { 'class': 'cbi-tabmenu mode' }, [
1045 E('li', { 'data-mode': 'available', 'class': 'available cbi-tab', 'click': handleMode
}, E('a', { 'href': '#' }, [ _('Available') ])),
1046 E('li', { 'data-mode': 'installed', 'class': 'installed cbi-tab-disabled', 'click': handleMode
}, E('a', { 'href': '#' }, [ _('Installed') ])),
1047 E('li', { 'data-mode': 'updates', 'class': 'installed cbi-tab-disabled', 'click': handleMode
}, E('a', { 'href': '#' }, [ _('Updates') ]))
1050 E('div', { 'class': 'controls', 'style': 'display:none' }, [
1051 E('div', { 'id': 'pager', 'class': 'center' }, [
1052 E('button', { 'class': 'btn cbi-button-neutral prev', 'aria-label': _('Previous page'), 'click': handlePage
}, [ '«' ]),
1053 E('div', { 'class': 'text' }, [ 'dummy' ]),
1054 E('button', { 'class': 'btn cbi-button-neutral next', 'aria-label': _('Next page'), 'click': handlePage
}, [ '»' ])
1058 E('div', { 'id': 'packages', 'class': 'table' }, [
1059 E('div', { 'class': 'tr cbi-section-table-titles' }, [
1060 E('div', { 'class': 'th col-2 left' }, [ _('Package name') ]),
1061 E('div', { 'class': 'th col-2 left version' }, [ _('Version') ]),
1062 E('div', { 'class': 'th col-1 center size'}, [ _('Size (.ipk)') ]),
1063 E('div', { 'class': 'th col-10 left' }, [ _('Description') ]),
1064 E('div', { 'class': 'th right cbi-section-actions' }, [ '\u00a0' ])
1069 requestAnimationFrame(function() {
1070 updateLists(listData
)
1077 handleSaveApply
: null,