mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-05 09:54:06 +08:00
🐶 Sync 2026-10-08 01:07:04
This commit is contained in:
1 parent
31f25ca6cb
commit
ef5af2e0cc
283 files changed
+34710
-16084
No files matched your search
@@ -51,6 +51,11 @@ const css = ' \
|
||||
white-space: nowrap; \
|
||||
} \
|
||||
\
|
||||
/* bootstrap sets 15%; shrink */ \
|
||||
#packages .td.cbi-section-actions { \
|
||||
width: auto; \
|
||||
} \
|
||||
\
|
||||
ul.deps, ul.deps ul, ul.errors { \
|
||||
margin-left: 1em; \
|
||||
} \
|
||||
@@ -523,7 +528,7 @@ function versionSatisfied(ver, ref, vop)
|
||||
return false;
|
||||
}
|
||||
|
||||
function pkgStatus(pkg, vop, ver, info)
|
||||
function pkgStatus(pkg, vop, ver, info, count)
|
||||
{
|
||||
info.errors = info.errors || [];
|
||||
info.install = info.install || [];
|
||||
@@ -559,7 +564,8 @@ function pkgStatus(pkg, vop, ver, info)
|
||||
}
|
||||
else if (!pkg.missing) {
|
||||
if (!vop || versionSatisfied(pkg.version, ver, vop)) {
|
||||
info.install.push(pkg);
|
||||
if (count !== false)
|
||||
info.install.push(pkg);
|
||||
return E('span', { 'class': 'label' }, _('Not installed'));
|
||||
}
|
||||
|
||||
@@ -586,6 +592,42 @@ function renderDependencyItem(dep, info, flat)
|
||||
const ver = dep.version ? dep.version[1] : null;
|
||||
const depends = [];
|
||||
|
||||
// A dependency with several providers (alternatives) is satisfied by any
|
||||
// single one of them, so apk only ever installs one. Mirror the apk
|
||||
// solver's provider selection - an already installed one, otherwise the
|
||||
// available one with the highest provider-priority, otherwise the first
|
||||
// available one - and count only that towards the size estimate and
|
||||
// subdependencies instead of every alternative.
|
||||
let effective = -1;
|
||||
|
||||
for (let i = 0; dep.pkgs && i < dep.pkgs.length; i++) {
|
||||
if (isPkgInstalled(packages.installed.pkgs[dep.pkgs[i]])) {
|
||||
effective = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const satisfied = effective >= 0;
|
||||
|
||||
if (!satisfied && dep.pkgs && dep.pkgs.length) {
|
||||
let prio = null;
|
||||
|
||||
for (let i = 0; i < dep.pkgs.length; i++) {
|
||||
const p = packages.available.pkgs[dep.pkgs[i]];
|
||||
if (!p)
|
||||
continue;
|
||||
|
||||
const pprio = Number(p['provider-priority']) || 0;
|
||||
if (prio === null || pprio > prio) {
|
||||
effective = i;
|
||||
prio = pprio;
|
||||
}
|
||||
}
|
||||
|
||||
if (effective < 0)
|
||||
effective = 0;
|
||||
}
|
||||
|
||||
for (let i = 0; dep.pkgs && i < dep.pkgs.length; i++) {
|
||||
const pkg = packages.installed.pkgs[dep.pkgs[i]] ||
|
||||
packages.available.pkgs[dep.pkgs[i]] ||
|
||||
@@ -602,12 +644,13 @@ function renderDependencyItem(dep, info, flat)
|
||||
text += ' (~%1024mB)'.format(pkg.size);
|
||||
|
||||
li.appendChild(E('span', { 'data-tooltip': pkg.description },
|
||||
[ text, ' ', pkgStatus(pkg, vop, ver, info) ]));
|
||||
[ text, ' ', pkgStatus(pkg, vop, ver, info, !satisfied && i === effective) ]));
|
||||
|
||||
(pkg.depends || []).forEach(function(d) {
|
||||
if (depends.indexOf(d) === -1)
|
||||
depends.push(d);
|
||||
});
|
||||
if (i === effective)
|
||||
(pkg.depends || []).forEach(function(d) {
|
||||
if (depends.indexOf(d) === -1)
|
||||
depends.push(d);
|
||||
});
|
||||
}
|
||||
|
||||
if (!li.firstChild)
|
||||
@@ -944,7 +987,7 @@ function handleConfig(ev)
|
||||
body.push(E('h5', {}, '%h'.format(file)));
|
||||
body.push(E('textarea', {
|
||||
'name': file,
|
||||
'rows': Math.max(Math.min(L.toArray(conf[file].match(/\n/g)).length, 10), 3)
|
||||
'rows': Math.max(Math.min(L.toArray(conf[file].match(/\n/g)).length, 10), 3) + 1
|
||||
}, '%h'.format(conf[file])));
|
||||
});
|
||||
|
||||
@@ -1241,7 +1284,7 @@ return view.extend({
|
||||
))
|
||||
]),
|
||||
|
||||
E('div', { 'class': 'controls' }, [
|
||||
E('div', { 'class': 'cbi-section' }, E('div', { 'class': 'controls' }, [
|
||||
E('div', {}, [
|
||||
E('label', {'id': 'disk-space-label'}, _('Disk space') + ':'),
|
||||
E('div', { 'class': 'cbi-progressbar', 'title': _('unknown') }, E('div', {}, [ '\u00a0' ]))
|
||||
@@ -1317,7 +1360,7 @@ return view.extend({
|
||||
])
|
||||
])
|
||||
])
|
||||
]),
|
||||
])),
|
||||
|
||||
E('ul', { 'class': 'cbi-tabmenu mode' }, [
|
||||
E('li', { 'data-mode': 'available', 'class': 'available cbi-tab', 'click': handleMode }, E('a', { 'href': '#' }, [ _('Available') ])),
|
||||
@@ -1325,6 +1368,7 @@ return view.extend({
|
||||
E('li', { 'data-mode': 'updates', 'class': 'installed cbi-tab-disabled', 'click': handleMode }, E('a', { 'href': '#' }, [ _('Updates') ]))
|
||||
]),
|
||||
|
||||
E('div', { 'class': 'cbi-section' }, [
|
||||
E('div', { 'class': 'controls', 'style': 'display:none' }, [
|
||||
E('div', { 'class': 'pager center' }, [
|
||||
E('button', { 'class': 'btn cbi-button-neutral prev', 'aria-label': _('Previous page'), 'click': handlePage }, [ '«' ]),
|
||||
@@ -1350,6 +1394,7 @@ return view.extend({
|
||||
E('button', { 'class': 'btn cbi-button-neutral next', 'aria-label': _('Next page'), 'click': handlePage }, [ '»' ])
|
||||
])
|
||||
])
|
||||
])
|
||||
]);
|
||||
|
||||
requestAnimationFrame(function() {
|
||||
|
||||
Reference in new issue
Block a user