| 1 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 2 |
import cockpit from "cockpit"; |
| 3 |
|
| 4 |
import '../lib/patternfly/patternfly-6-cockpit.scss'; |
| 5 |
|
| 6 |
document.addEventListener("DOMContentLoaded", () => { |
| 7 |
const proxy = cockpit.dbus(null, { bus: "internal" }).proxy("cockpit.Packages", "/packages"); |
| 8 |
|
| 9 |
let manifests; |
| 10 |
|
| 11 |
function update(str) { |
| 12 |
const new_m = JSON.parse(str); |
| 13 |
|
| 14 |
if (manifests) { |
| 15 |
for (const p in new_m) { |
| 16 |
if (!manifests[p]) |
| 17 |
console.log("ADD", p); |
| 18 |
else if (manifests[p].checksum != new_m[p].checksum) |
| 19 |
console.log("CHG", p); |
| 20 |
} |
| 21 |
for (const p in manifests) { |
| 22 |
if (!new_m[p]) |
| 23 |
console.log("REM", p); |
| 24 |
} |
| 25 |
} |
| 26 |
|
| 27 |
manifests = new_m; |
| 28 |
} |
| 29 |
|
| 30 |
const debug_manifest_changes = false; |
| 31 |
|
| 32 |
proxy.wait(function () { |
| 33 |
document.body.removeAttribute("hidden"); |
| 34 |
if (debug_manifest_changes) { |
| 35 |
update(proxy.Manifests); |
| 36 |
proxy.addEventListener("changed", () => update(proxy.Manifests)); |
| 37 |
} |
| 38 |
document.getElementById("reload").addEventListener("click", () => { |
| 39 |
proxy.Reload() |
| 40 |
.catch(error => console.log("ERROR", error)); |
| 41 |
}); |
| 42 |
}); |
| 43 |
}); |