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