b7a52d1d1294225ed4cf1857da8500f1514b232e
9 margin: .5em 0 1em 0; \
11 justify-content: space-around; \
16 white-space: nowrap; \
18 box-sizing: border-box; \
23 .controls > *:first-child, \
24 .controls > * > label { \
29 .controls > *:nth-child(2), \
30 .controls > *:nth-child(3) { \
34 .controls > * > .btn { \
44 .controls > div > input { \
50 white-space: nowrap; \
53 ul.deps, ul.deps ul, ul.errors { \
57 ul.deps li, ul.errors li { \
63 display: inline-block; \
69 white-space: nowrap; \
76 padding-left: 1.5em; \
79 ul.errors li:before { \
81 display: inline-block; \
83 margin-left: -1.5em; \
87 var callMountPoints
= rpc
.declare({
89 method
: 'getMountPoints',
90 expect
: { result
: [] }
94 available
: { providers
: {}, pkgs
: {} },
95 installed
: { providers
: {}, pkgs
: {} }
98 var currentDisplayMode
= 'available', currentDisplayRows
= [];
100 function parseList(s
, dest
)
102 var re
= /([^\n]*)\n/g,
103 pkg
= null, key
= null, val
= null, m
;
105 while ((m
= re
.exec(s
)) !== null) {
106 if (m
[1].match(/^\s(.*)$/)) {
107 if (pkg
!== null && key
!== null && val
!== null)
108 val
+= '\n' + RegExp
.$1.trim();
113 if (key
!== null && val
!== null) {
121 var list
= val
.split(/\s*,\s*/);
122 if (list
.length
!== 1 || list
[0].length
> 0)
126 case 'installed-time':
127 pkg
.installtime
= new Date(+val
* 1000);
130 case 'installed-size':
131 pkg
.installsize
= +val
;
135 var stat
= val
.split(/\s+/),
148 pkg
.installed
= true;
155 pkg
.essential
= true;
163 case 'auto-installed':
177 if (m
[1].trim().match(/^([\w-]+)\s*:(.+)$/)) {
178 key
= RegExp
.$1.toLowerCase();
179 val
= RegExp
.$2.trim();
182 dest
.pkgs
[pkg
.name
] = pkg
;
184 var provides
= dest
.providers
[pkg
.name
] ? [] : [ pkg
.name
];
187 provides
.push
.apply(provides
, pkg
.provides
);
189 provides
.forEach(function(p
) {
190 dest
.providers
[p
] = dest
.providers
[p
] || [];
191 dest
.providers
[p
].push(pkg
);
197 function display(pattern
)
199 var src
= packages
[currentDisplayMode
=== 'updates' ? 'installed' : currentDisplayMode
],
200 table
= document
.querySelector('#packages'),
201 pager
= document
.querySelector('#pager');
203 currentDisplayRows
.length
= 0;
205 if (typeof(pattern
) === 'string' && pattern
.length
> 0)
206 pattern
= new RegExp(pattern
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'ig');
208 for (var name
in src
.pkgs
) {
209 var pkg
= src
.pkgs
[name
],
210 desc
= pkg
.description
|| '',
213 if (!pkg
.size
&& packages
.available
.pkgs
[name
])
214 altsize
= packages
.available
.pkgs
[name
].size
;
216 if (!desc
&& packages
.available
.pkgs
[name
])
217 desc
= packages
.available
.pkgs
[name
].description
|| '';
219 desc
= desc
.split(/\n/);
220 desc
= desc
[0].trim() + (desc
.length
> 1 ? '…' : '');
222 if ((pattern
instanceof RegExp
) &&
223 !name
.match(pattern
) && !desc
.match(pattern
))
228 if (currentDisplayMode
=== 'updates') {
229 var avail
= packages
.available
.pkgs
[name
],
230 inst
= packages
.installed
.pkgs
[name
];
232 if (!inst
|| !inst
.installed
)
235 if (!avail
|| compareVersion(avail
.version
, pkg
.version
) <= 0)
238 ver
= '%s » %s'.format(
239 truncateVersion(pkg
.version
|| '-'),
240 truncateVersion(avail
.version
|| '-'));
243 'class': 'btn cbi-button-positive',
244 'data-package': name
,
245 'click': handleInstall
248 else if (currentDisplayMode
=== 'installed') {
252 ver
= truncateVersion(pkg
.version
|| '-');
254 'class': 'btn cbi-button-negative',
255 'data-package': name
,
256 'click': handleRemove
260 var inst
= packages
.installed
.pkgs
[name
];
262 ver
= truncateVersion(pkg
.version
|| '-');
264 if (!inst
|| !inst
.installed
)
266 'class': 'btn cbi-button-action',
267 'data-package': name
,
268 'click': handleInstall
270 else if (inst
.installed
&& inst
.version
!= pkg
.version
)
272 'class': 'btn cbi-button-positive',
273 'data-package': name
,
274 'click': handleInstall
278 'class': 'btn cbi-button-neutral',
279 'disabled': 'disabled'
283 name
= '%h'.format(name
);
284 desc
= '%h'.format(desc
|| '-');
287 name
= name
.replace(pattern
, '<ins>$&</ins>');
288 desc
= desc
.replace(pattern
, '<ins>$&</ins>');
291 currentDisplayRows
.push([
294 pkg
.size
? '%.1024mB'.format(pkg
.size
)
295 : (altsize
? '~%.1024mB'.format(altsize
) : '-'),
301 currentDisplayRows
.sort(function(a
, b
) {
304 else if (a
[0] > b
[0])
310 pager
.parentNode
.style
.display
= '';
311 pager
.setAttribute('data-offset', 100);
312 handlePage({ target
: pager
.querySelector('.prev') });
315 function handlePage(ev
)
317 var filter
= document
.querySelector('input[name="filter"]'),
318 pager
= ev
.target
.parentNode
,
319 offset
= +pager
.getAttribute('data-offset'),
320 next
= ev
.target
.classList
.contains('next');
322 if ((next
&& (offset
+ 100) >= currentDisplayRows
.length
) ||
323 (!next
&& (offset
< 100)))
326 offset
+= next
? 100 : -100;
327 pager
.setAttribute('data-offset', offset
);
328 pager
.querySelector('.text').firstChild
.data
= currentDisplayRows
.length
329 ? _('Displaying %d-%d of %d').format(1 + offset
, Math
.min(offset
+ 100, currentDisplayRows
.length
), currentDisplayRows
.length
)
333 pager
.querySelector('.prev').setAttribute('disabled', 'disabled');
335 pager
.querySelector('.prev').removeAttribute('disabled');
337 if ((offset
+ 100) >= currentDisplayRows
.length
)
338 pager
.querySelector('.next').setAttribute('disabled', 'disabled');
340 pager
.querySelector('.next').removeAttribute('disabled');
342 var placeholder
= _('No information available');
346 E('span', {}, _('No packages matching "<strong>%h</strong>".').format(filter
.value
)), ' (',
347 E('a', { href
: '#', onclick
: 'handleReset(event)' }, _('Reset')), ')'
350 cbi_update_table('#packages', currentDisplayRows
.slice(offset
, offset
+ 100),
354 function handleMode(ev
)
356 var tab
= findParent(ev
.target
, 'li');
357 if (tab
.getAttribute('data-mode') === currentDisplayMode
)
360 tab
.parentNode
.querySelectorAll('li').forEach(function(li
) {
361 li
.classList
.remove('cbi-tab');
362 li
.classList
.add('cbi-tab-disabled');
365 tab
.classList
.remove('cbi-tab-disabled');
366 tab
.classList
.add('cbi-tab');
368 currentDisplayMode
= tab
.getAttribute('data-mode');
370 display(document
.querySelector('input[name="filter"]').value
);
380 else if (c
=== '' || c
>= '0' && c
<= '9')
382 else if ((c
>= 'a' && c
<= 'z') || (c
>= 'A' && c
<= 'Z'))
383 return c
.charCodeAt(0);
385 return c
.charCodeAt(0) + 256;
388 function compareVersion(val
, ref
)
391 isdigit
= { 0:1, 1:1, 2:1, 3:1, 4:1, 5:1, 6:1, 7:1, 8:1, 9:1 };
399 while (vi
< val
.length
|| ri
< ref
.length
) {
402 while ((vi
< val
.length
&& !isdigit
[val
.charAt(vi
)]) ||
403 (ri
< ref
.length
&& !isdigit
[ref
.charAt(ri
)])) {
404 var vc
= orderOf(val
.charAt(vi
)), rc
= orderOf(ref
.charAt(ri
));
411 while (val
.charAt(vi
) === '0')
414 while (ref
.charAt(ri
) === '0')
417 while (isdigit
[val
.charAt(vi
)] && isdigit
[ref
.charAt(ri
)]) {
418 first_diff
= first_diff
|| (val
.charCodeAt(vi
) - ref
.charCodeAt(ri
));
422 if (isdigit
[val
.charAt(vi
)])
424 else if (isdigit
[ref
.charAt(ri
)])
433 function versionSatisfied(ver
, ref
, vop
)
435 var r
= compareVersion(ver
, ref
);
459 function pkgStatus(pkg
, vop
, ver
, info
)
461 info
.errors
= info
.errors
|| [];
462 info
.install
= info
.install
|| [];
465 if (vop
&& !versionSatisfied(pkg
.version
, ver
, vop
)) {
468 (packages
.available
.providers
[pkg
.name
] || []).forEach(function(p
) {
469 if (!repl
&& versionSatisfied(p
.version
, ver
, vop
))
474 info
.install
.push(repl
);
477 'data-tooltip': _('Requires update to %h %h')
478 .format(repl
.name
, repl
.version
)
479 }, _('Needs upgrade'));
482 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
)));
485 'class': 'label warning',
486 'data-tooltip': _('Require version %h %h,\ninstalled %h')
487 .format(vop
, ver
, pkg
.version
)
488 }, _('Version incompatible'));
491 return E('span', { 'class': 'label notice' }, _('Installed'));
493 else if (!pkg
.missing
) {
494 if (!vop
|| versionSatisfied(pkg
.version
, ver
, vop
)) {
495 info
.install
.push(pkg
);
496 return E('span', { 'class': 'label' }, _('Not installed'));
499 info
.errors
.push(_('The repository version of package <em>%h</em> is not compatible, require %s but only %s is available.')
500 .format(pkg
.name
, truncateVersion(ver
, vop
), truncateVersion(pkg
.version
)));
503 'class': 'label warning',
504 'data-tooltip': _('Require version %h %h,\ninstalled %h')
505 .format(vop
, ver
, pkg
.version
)
506 }, _('Version incompatible'));
509 info
.errors
.push(_('Required dependency package <em>%h</em> is not available in any repository.').format(pkg
.name
));
511 return E('span', { 'class': 'label warning' }, _('Not available'));
515 function renderDependencyItem(dep
, info
)
518 vop
= dep
.version
? dep
.version
[0] : null,
519 ver
= dep
.version
? dep
.version
[1] : null,
522 for (var i
= 0; dep
.pkgs
&& i
< dep
.pkgs
.length
; i
++) {
523 var pkg
= packages
.installed
.pkgs
[dep
.pkgs
[i
]] ||
524 packages
.available
.pkgs
[dep
.pkgs
[i
]] ||
528 li
.appendChild(document
.createTextNode(' | '));
533 text
+= ' (%.1024mB)'.format(pkg
.installsize
);
535 text
+= ' (~%.1024mB)'.format(pkg
.size
);
537 li
.appendChild(E('span', { 'data-tooltip': pkg
.description
},
538 [ text
, ' ', pkgStatus(pkg
, vop
, ver
, info
) ]));
540 (pkg
.depends
|| []).forEach(function(d
) {
541 if (depends
.indexOf(d
) === -1)
547 li
.appendChild(E('span', {},
549 pkgStatus({ name
: dep
.name
, missing
: true }, vop
, ver
, info
) ]));
551 var subdeps
= renderDependencies(depends
, info
);
553 li
.appendChild(subdeps
);
558 function renderDependencies(depends
, info
)
560 var deps
= depends
|| [],
563 info
.seen
= info
.seen
|| [];
565 for (var i
= 0; i
< deps
.length
; i
++) {
568 if (deps
[i
] === 'libc')
571 if (deps
[i
].match(/^(.+)\s+\((<=|<|>|>=|=|<<|>>)(.+)\)$/)) {
572 dep
= RegExp
.$1.trim();
573 vop
= RegExp
.$2.trim();
574 ver
= RegExp
.$3.trim();
577 dep
= deps
[i
].trim();
586 (packages
.installed
.providers
[dep
] || []).forEach(function(p
) {
587 if (pkgs
.indexOf(p
.name
) === -1) pkgs
.push(p
.name
);
590 (packages
.available
.providers
[dep
] || []).forEach(function(p
) {
591 if (pkgs
.indexOf(p
.name
) === -1) pkgs
.push(p
.name
);
600 items
.push(renderDependencyItem(info
.seen
[dep
], info
));
604 return E('ul', { 'class': 'deps' }, items
);
609 function truncateVersion(v
, op
)
611 v
= v
.replace(/\b(([a-f0-9]{8})[a-f0-9]{24,32})\b/,
612 '<span data-tooltip="$1">$2…</span>');
614 if (!op
|| op
=== '=')
617 return '%h %h'.format(op
, v
);
620 function handleReset(ev
)
622 var filter
= document
.querySelector('input[name="filter"]');
628 function handleInstall(ev
)
630 var name
= ev
.target
.getAttribute('data-package'),
631 pkg
= packages
.available
.pkgs
[name
],
636 size
= _('~%.1024mB installed').format(pkg
.installsize
);
638 size
= _('~%.1024mB compressed').format(pkg
.size
);
642 var deps
= renderDependencies(pkg
.depends
, depcache
),
643 tree
= null, errs
= null, inst
= null, desc
= null;
645 if (depcache
.errors
&& depcache
.errors
.length
) {
646 errs
= E('ul', { 'class': 'errors' });
647 depcache
.errors
.forEach(function(err
) {
648 errs
.appendChild(E('li', {}, err
));
652 var totalsize
= pkg
.installsize
|| pkg
.size
|| 0,
655 if (depcache
.install
&& depcache
.install
.length
)
656 depcache
.install
.forEach(function(ipkg
) {
657 totalsize
+= ipkg
.installsize
|| ipkg
.size
|| 0;
662 _('Require approx. %.1024mB size for %d package(s) to install.')
663 .format(totalsize
, totalpkgs
));
666 tree
= E('li', '<strong>%s:</strong>'.format(_('Dependencies')));
667 tree
.appendChild(deps
);
670 if (pkg
.description
) {
671 desc
= E('div', {}, [
672 E('h5', {}, _('Description')),
673 E('p', {}, pkg
.description
)
677 ui
.showModal(_('Details for package <em>%h</em>').format(pkg
.name
), [
679 E('li', '<strong>%s:</strong> %h'.format(_('Version'), pkg
.version
)),
680 E('li', '<strong>%s:</strong> %h'.format(_('Size'), size
)),
685 E('div', { 'class': 'right' }, [
686 E('label', { 'class': 'cbi-checkbox', 'style': 'float:left' }, [
687 E('input', { 'id': 'overwrite-cb', 'type': 'checkbox', 'name': 'overwrite' }), ' ',
688 E('label', { 'for': 'overwrite-cb' }), ' ',
689 _('Overwrite files from other package(s)')
693 'click': ui
.hideModal
697 'data-command': 'install',
698 'data-package': name
,
699 'class': 'btn cbi-button-action',
706 function handleManualInstall(ev
)
708 var name_or_url
= document
.querySelector('input[name="install"]').value
,
710 'class': 'btn cbi-button-action',
711 'data-command': 'install',
712 'data-package': name_or_url
,
713 'click': function(ev
) {
714 document
.querySelector('input[name="install"]').value
= '';
717 }, _('Install')), warning
;
719 if (!name_or_url
.length
) {
722 else if (name_or_url
.indexOf('/') !== -1) {
723 warning
= E('p', {}, _('Installing packages from untrusted sources is a potential security risk! Really attempt to install <em>%h</em>?').format(name_or_url
));
725 else if (!packages
.available
.providers
[name_or_url
]) {
726 warning
= E('p', {}, _('The package <em>%h</em> is not available in any configured repository.').format(name_or_url
));
730 warning
= E('p', {}, _('Really attempt to install <em>%h</em>?').format(name_or_url
));
733 ui
.showModal(_('Manually install package'), [
735 E('div', { 'class': 'right' }, [
737 'click': ui
.hideModal
,
738 'class': 'btn cbi-button-neutral'
745 function handleConfig(ev
)
749 ui
.showModal(_('OPKG Configuration'), [
750 E('p', { 'class': 'spinning' }, _('Loading configuration data…'))
753 fs
.list('/etc/opkg').then(function(partials
) {
754 var files
= [ '/etc/opkg.conf' ];
756 for (var i
= 0; i
< partials
.length
; i
++)
757 if (partials
[i
].type
== 'file' && partials
[i
].name
.match(/\.conf$/))
758 files
.push('/etc/opkg/' + partials
[i
].name
);
760 return Promise
.all(files
.map(function(file
) {
762 .then(L
.bind(function(conf
, file
, res
) { conf
[file
] = res
}, this, conf
, file
))
763 .catch(function(err
) {
764 ui
.addNotification(null, E('p', {}, [ _('Unable to read %s: %s').format(file
, err
) ]));
771 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>.'))
774 Object
.keys(conf
).sort().forEach(function(file
) {
775 body
.push(E('h5', {}, '%h'.format(file
)));
776 body
.push(E('textarea', {
778 'rows': Math
.max(Math
.min(L
.toArray(conf
[file
].match(/\n/g)).length
, 10), 3)
779 }, '%h'.format(conf
[file
])));
782 body
.push(E('div', { 'class': 'right' }, [
784 'class': 'btn cbi-button-neutral',
785 'click': ui
.hideModal
789 'class': 'btn cbi-button-positive',
790 'click': function(ev
) {
792 findParent(ev
.target
, '.modal').querySelectorAll('textarea[name]')
793 .forEach(function(textarea
) {
794 data
[textarea
.getAttribute('name')] = textarea
.value
797 ui
.showModal(_('OPKG Configuration'), [
798 E('p', { 'class': 'spinning' }, _('Saving configuration data…'))
801 Promise
.all(Object
.keys(data
).map(function(file
) {
802 return fs
.write(file
, data
[file
]).catch(function(err
) {
803 ui
.addNotification(null, E('p', {}, [ _('Unable to save %s: %s').format(file
, err
) ]));
805 })).then(ui
.hideModal
);
810 ui
.showModal(_('OPKG Configuration'), body
);
814 function handleRemove(ev
)
816 var name
= ev
.target
.getAttribute('data-package'),
817 pkg
= packages
.installed
.pkgs
[name
],
818 avail
= packages
.available
.pkgs
[name
] || {},
821 if (avail
.installsize
)
822 size
= _('~%.1024mB installed').format(avail
.installsize
);
824 size
= _('~%.1024mB compressed').format(avail
.size
);
828 if (avail
.description
) {
829 desc
= E('div', {}, [
830 E('h5', {}, _('Description')),
831 E('p', {}, avail
.description
)
835 ui
.showModal(_('Remove package <em>%h</em>').format(pkg
.name
), [
837 E('li', '<strong>%s:</strong> %h'.format(_('Version'), pkg
.version
)),
838 E('li', '<strong>%s:</strong> %h'.format(_('Size'), size
))
841 E('div', { 'style': 'display:flex; justify-content:space-between; flex-wrap:wrap' }, [
843 E('input', { type
: 'checkbox', checked
: 'checked', name
: 'autoremove' }),
844 _('Automatically remove unused dependencies')
846 E('div', { 'style': 'flex-grow:1', 'class': 'right' }, [
849 'click': ui
.hideModal
853 'data-command': 'remove',
854 'data-package': name
,
855 'class': 'btn cbi-button-negative',
863 function handleOpkg(ev
)
865 return new Promise(function(resolveFn
, rejectFn
) {
866 var cmd
= ev
.target
.getAttribute('data-command'),
867 pkg
= ev
.target
.getAttribute('data-package'),
868 rem
= document
.querySelector('input[name="autoremove"]'),
869 owr
= document
.querySelector('input[name="overwrite"]');
871 var dlg
= ui
.showModal(_('Executing package manager'), [
872 E('p', { 'class': 'spinning' },
873 _('Waiting for the <em>opkg %h</em> command to complete…').format(cmd
))
876 var argv
= [ cmd
, '--force-removal-of-dependent-packages' ];
878 if (rem
&& rem
.checked
)
879 argv
.push('--autoremove');
881 if (owr
&& owr
.checked
)
882 argv
.push('--force-overwrite');
887 fs
.exec_direct('/usr/libexec/opkg-call', argv
, 'json').then(function(res
) {
888 dlg
.removeChild(dlg
.lastChild
);
891 dlg
.appendChild(E('pre', [ res
.stdout
]));
894 dlg
.appendChild(E('h5', _('Errors')));
895 dlg
.appendChild(E('pre', { 'class': 'errors' }, [ res
.stderr
]));
899 dlg
.appendChild(E('p', _('The <em>opkg %h</em> command failed with code <code>%d</code>.').format(cmd
, (res
.code
& 0xff) || -1)));
901 dlg
.appendChild(E('div', { 'class': 'right' },
904 'click': L
.bind(function(res
) {
909 rejectFn(new Error(res
.stderr
|| 'opkg error %d'.format(res
.code
)));
914 }).catch(function(err
) {
915 ui
.addNotification(null, E('p', _('Unable to execute <em>opkg %s</em> command: %s').format(cmd
, err
)));
921 function handleUpload(ev
)
923 var path
= '/tmp/upload.ipk';
924 return ui
.uploadFile(path
).then(L
.bind(function(btn
, res
) {
925 ui
.showModal(_('Manually install package'), [
926 E('p', {}, _('Installing packages from untrusted sources is a potential security risk! Really attempt to install <em>%h</em>?').format(res
.name
)),
928 res
.size
? E('li', {}, '%s: %1024.2mB'.format(_('Size'), res
.size
)) : '',
929 res
.checksum
? E('li', {}, '%s: %s'.format(_('MD5'), res
.checksum
)) : '',
930 res
.sha256sum
? E('li', {}, '%s: %s'.format(_('SHA256'), res
.sha256sum
)) : ''
932 E('div', { 'class': 'right' }, [
934 'click': function(ev
) {
938 'class': 'btn cbi-button-neutral'
939 }, _('Cancel')), ' ',
941 'class': 'btn cbi-button-action',
942 'data-command': 'install',
943 'data-package': path
,
944 'click': function(ev
) {
945 handleOpkg(ev
).finally(function() {
952 }, this, ev
.target
));
955 function downloadLists()
959 fs
.exec_direct('/usr/libexec/opkg-call', [ 'list-available' ]),
960 fs
.exec_direct('/usr/libexec/opkg-call', [ 'list-installed' ])
964 function updateLists(data
)
966 cbi_update_table('#packages', [],
967 E('div', { 'class': 'spinning' }, _('Loading package information…')));
969 packages
.available
= { providers
: {}, pkgs
: {} };
970 packages
.installed
= { providers
: {}, pkgs
: {} };
972 return (data
? Promise
.resolve(data
) : downloadLists()).then(function(data
) {
973 var pg
= document
.querySelector('.cbi-progressbar'),
974 mount
= L
.toArray(data
[0].filter(function(m
) { return m
.mount
== '/' || m
.mount
== '/overlay' }))
975 .sort(function(a
, b
) { return a
.mount
> b
.mount
})[0] || { size
: 0, free
: 0 };
977 pg
.firstElementChild
.style
.width
= Math
.floor(mount
.size
? ((100 / mount
.size
) * mount
.free
) : 100) + '%';
978 pg
.setAttribute('title', '%s (%.1024mB)'.format(pg
.firstElementChild
.style
.width
, mount
.free
));
980 parseList(data
[1], packages
.available
);
981 parseList(data
[2], packages
.installed
);
983 display(document
.querySelector('input[name="filter"]').value
);
987 var keyTimeout
= null;
989 function handleKeyUp(ev
) {
990 if (keyTimeout
!== null)
991 window
.clearTimeout(keyTimeout
);
993 keyTimeout
= window
.setTimeout(function() {
994 display(ev
.target
.value
);
998 return L
.view
.extend({
1000 return downloadLists();
1003 render: function(listData
) {
1004 var query
= decodeURIComponent(L
.toArray(location
.search
.match(/\bquery=([^=]+)\b/))[1] || '');
1007 E('style', { 'type': 'text/css' }, [ css
]),
1009 E('h2', {}, _('Software')),
1011 E('div', { 'class': 'controls' }, [
1013 E('label', {}, _('Free space') + ':'),
1014 E('div', { 'class': 'cbi-progressbar', 'title': _('unknown') }, E('div', {}, [ '\u00a0' ]))
1018 E('label', {}, _('Filter') + ':'),
1019 E('span', { 'class': 'control-group' }, [
1020 E('input', { 'type': 'text', 'name': 'filter', 'placeholder': _('Type to filter…'), 'value': query
, 'keyup': handleKeyUp
}),
1021 E('button', { 'class': 'btn cbi-button', 'click': handleReset
}, [ _('Clear') ])
1026 E('label', {}, _('Download and install package') + ':'),
1027 E('span', { 'class': 'control-group' }, [
1028 E('input', { 'type': 'text', 'name': 'install', 'placeholder': _('Package name or URL…'), 'keydown': function(ev
) { if (ev
.keyCode
=== 13) handleManualInstall(ev
) } }),
1029 E('button', { 'class': 'btn cbi-button cbi-button-action', 'click': handleManualInstall
}, [ _('OK') ])
1034 E('label', {}, _('Actions') + ':'), ' ',
1035 E('span', { 'class': 'control-group' }, [
1036 E('button', { 'class': 'btn cbi-button-positive', 'data-command': 'update', 'click': handleOpkg
}, [ _('Update lists…') ]), ' ',
1037 E('button', { 'class': 'btn cbi-button-action', 'click': handleUpload
}, [ _('Upload Package…') ]), ' ',
1038 E('button', { 'class': 'btn cbi-button-neutral', 'click': handleConfig
}, [ _('Configure opkg…') ])
1043 E('ul', { 'class': 'cbi-tabmenu mode' }, [
1044 E('li', { 'data-mode': 'available', 'class': 'available cbi-tab', 'click': handleMode
}, E('a', { 'href': '#' }, [ _('Available') ])),
1045 E('li', { 'data-mode': 'installed', 'class': 'installed cbi-tab-disabled', 'click': handleMode
}, E('a', { 'href': '#' }, [ _('Installed') ])),
1046 E('li', { 'data-mode': 'updates', 'class': 'installed cbi-tab-disabled', 'click': handleMode
}, E('a', { 'href': '#' }, [ _('Updates') ]))
1049 E('div', { 'class': 'controls', 'style': 'display:none' }, [
1050 E('div', { 'id': 'pager', 'class': 'center' }, [
1051 E('button', { 'class': 'btn cbi-button-neutral prev', 'aria-label': _('Previous page'), 'click': handlePage
}, [ '«' ]),
1052 E('div', { 'class': 'text' }, [ 'dummy' ]),
1053 E('button', { 'class': 'btn cbi-button-neutral next', 'aria-label': _('Next page'), 'click': handlePage
}, [ '»' ])
1057 E('div', { 'id': 'packages', 'class': 'table' }, [
1058 E('div', { 'class': 'tr cbi-section-table-titles' }, [
1059 E('div', { 'class': 'th col-2 left' }, [ _('Package name') ]),
1060 E('div', { 'class': 'th col-2 left version' }, [ _('Version') ]),
1061 E('div', { 'class': 'th col-1 center size'}, [ _('Size (.ipk)') ]),
1062 E('div', { 'class': 'th col-10 left' }, [ _('Description') ]),
1063 E('div', { 'class': 'th right cbi-section-actions' }, [ '\u00a0' ])
1068 requestAnimationFrame(function() {
1069 updateLists(listData
)
1076 handleSaveApply
: null,