diff options
| author | zousar <[email protected]> | 2025-04-15 23:42:32 -0600 |
|---|---|---|
| committer | zousar <[email protected]> | 2025-04-15 23:42:32 -0600 |
| commit | 311040be0b5220db7d526f95fa42fa4e9dd13518 (patch) | |
| tree | 27307ef2e788b857d9a4c15ff720650601ad5091 /src/zenserver | |
| parent | xmake updatefrontend (diff) | |
| download | zen-311040be0b5220db7d526f95fa42fa4e9dd13518.tar.xz zen-311040be0b5220db7d526f95fa42fa4e9dd13518.zip | |
Make metadata presentation more generic
Diffstat (limited to 'src/zenserver')
| -rw-r--r-- | src/zenserver/frontend/html/pages/entry.js | 65 |
1 files changed, 42 insertions, 23 deletions
diff --git a/src/zenserver/frontend/html/pages/entry.js b/src/zenserver/frontend/html/pages/entry.js index 41fc47218..54fb11c18 100644 --- a/src/zenserver/frontend/html/pages/entry.js +++ b/src/zenserver/frontend/html/pages/entry.js @@ -79,10 +79,32 @@ export class Page extends ZenPage async _build_meta(section, entry) { var tree = {} - const cookart = this._find_iohash_field(entry, "CookPackageArtifacts"); - if (cookart != null) + + for (const field of entry) { - tree["cook"] = { CookPackageArtifacts: cookart}; + var visibleKey = undefined; + const name = field.get_name(); + if (name == "CookPackageArtifacts") + { + visibleKey = name; + } + else if (name.startsWith("meta.")) + { + visibleKey = name.slice(5); + } + + if (visibleKey != undefined) + { + var found_value = field.as_value(); + if (found_value instanceof Uint8Array) + { + var ret = ""; + for (var x of found_value) + ret += x.toString(16).padStart(2, "0"); + tree[visibleKey] = ret; + } + } + } if (Object.keys(tree).length == 0) @@ -90,28 +112,25 @@ export class Page extends ZenPage const sub_section = section.add_section("meta"); - for (const cat_name in tree) + const table = sub_section.add_widget( + Table, + ["name", "actions"], Table.Flag_PackRight + ); + for (const key in tree) { - const cat_section = sub_section.add_section(cat_name); - const table = cat_section.add_widget( - Table, - ["name", "actions"], Table.Flag_PackRight + const row = table.add_row(key); + const value = tree[key]; + + const project = this.get_param("project"); + const oplog = this.get_param("oplog"); + const link = row.get_cell(0).link( + "/" + ["prj", project, "oplog", oplog, value+".json"].join("/") ); - Object.entries(tree[cat_name]).forEach(([key, value]) => - { - const row = table.add_row(key); - - const project = this.get_param("project"); - const oplog = this.get_param("oplog"); - const link = row.get_cell(0).link( - "/" + ["prj", project, "oplog", oplog, value+".json"].join("/") - ); - - const action_tb = new Toolbar(row.get_cell(-1), true); - action_tb.left().add("copy-hash").on_click(async (v) => { - await navigator.clipboard.writeText(v); - }, value); - }); + + const action_tb = new Toolbar(row.get_cell(-1), true); + action_tb.left().add("copy-hash").on_click(async (v) => { + await navigator.clipboard.writeText(v); + }, value); } } |