aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZousar Shaker <[email protected]>2025-04-11 08:38:39 -0600
committerGitHub Enterprise <[email protected]>2025-04-11 08:38:39 -0600
commit3a2c42d9655a34e7747145c9911faa317cd1c69a (patch)
treeda525d910fd2a8f8ccd8e79c930c5184d171d456 /src
parentuse FindClose (#357) (diff)
parentChangelog (diff)
downloadzen-3a2c42d9655a34e7747145c9911faa317cd1c69a.tar.xz
zen-3a2c42d9655a34e7747145c9911faa317cd1c69a.zip
Merge pull request #356 from ue-foundation/zs/web-ui-signed-integers
Zs/web UI signed integers
Diffstat (limited to 'src')
-rw-r--r--src/zenserver/frontend/html/indexer/worker.js4
-rw-r--r--src/zenserver/frontend/html/pages/entry.js5
-rw-r--r--src/zenserver/frontend/html/util/compactbinary.js4
-rw-r--r--src/zenserver/frontend/html/util/friendly.js14
-rw-r--r--src/zenserver/frontend/html/util/widgets.js2
5 files changed, 16 insertions, 13 deletions
diff --git a/src/zenserver/frontend/html/indexer/worker.js b/src/zenserver/frontend/html/indexer/worker.js
index b4d547ef9..69ee234fa 100644
--- a/src/zenserver/frontend/html/indexer/worker.js
+++ b/src/zenserver/frontend/html/indexer/worker.js
@@ -77,8 +77,8 @@ async function map_id_to_key(project_id, oplog, start, end, page_size, stride)
continue;
var id = 0n;
- var size = 0;
- var raw_size = 0;
+ var size = 0n;
+ var raw_size = 0n;
for (const item of pkg_data.as_array())
{
var found = 0, pkg_id = undefined;
diff --git a/src/zenserver/frontend/html/pages/entry.js b/src/zenserver/frontend/html/pages/entry.js
index f127cb0a3..41fc47218 100644
--- a/src/zenserver/frontend/html/pages/entry.js
+++ b/src/zenserver/frontend/html/pages/entry.js
@@ -210,8 +210,11 @@ export class Page extends ZenPage
_display_unsupported(section, entry)
{
+ const replacer = (key, value) =>
+ typeof value === "bigint" ? { $bigint: value.toString() } : value;
+
const object = entry.to_js_object();
- const text = JSON.stringify(object, null, " ");
+ const text = JSON.stringify(object, replacer, " ");
section.tag("pre").text(text);
}
diff --git a/src/zenserver/frontend/html/util/compactbinary.js b/src/zenserver/frontend/html/util/compactbinary.js
index 366ec6aff..90e4249f6 100644
--- a/src/zenserver/frontend/html/util/compactbinary.js
+++ b/src/zenserver/frontend/html/util/compactbinary.js
@@ -284,7 +284,7 @@ CbFieldView.prototype.as_array = function()
}
////////////////////////////////////////////////////////////////////////////////
-CbFieldView.prototype.as_value = function(int_type=Number)
+CbFieldView.prototype.as_value = function(int_type=BigInt)
{
switch (CbFieldTypeOps.get_type(this.get_type()))
{
@@ -388,8 +388,8 @@ CbObjectView.prototype.to_js_object = function()
}
if (node.is_string()) return node.as_value();
- if (node.is_float()) return node.as_value();
if (node.is_integer()) return node.as_value();
+ if (node.is_float()) return node.as_value();
var ret = node.as_value();
if (ret instanceof Uint8Array)
diff --git a/src/zenserver/frontend/html/util/friendly.js b/src/zenserver/frontend/html/util/friendly.js
index b27721964..a15252faf 100644
--- a/src/zenserver/frontend/html/util/friendly.js
+++ b/src/zenserver/frontend/html/util/friendly.js
@@ -7,17 +7,17 @@ export class Friendly
{
static sep(value, prec=0)
{
- return (+value).toLocaleString("en", {
+ return (+Number(value)).toLocaleString("en", {
style: "decimal",
minimumFractionDigits : prec,
maximumFractionDigits : prec,
});
}
- static k(x, p=0) { return Friendly.sep((x + 999) / Math.pow(10, 3)|0, p) + "K"; }
- static m(x, p=1) { return Friendly.sep( x / Math.pow(10, 6), p) + "M"; }
- static g(x, p=2) { return Friendly.sep( x / Math.pow(10, 9), p) + "G"; }
- static kib(x, p=0) { return Friendly.sep((x + 1023) / (1 << 10)|0, p) + " KiB"; }
- static mib(x, p=1) { return Friendly.sep( x / (1 << 20), p) + " MiB"; }
- static gib(x, p=2) { return Friendly.sep( x / (1 << 30), p) + " GiB"; }
+ static k(x, p=0) { return Friendly.sep((BigInt(x) + 999n) / BigInt(Math.pow(10, 3))|0n, p) + "K"; }
+ static m(x, p=1) { return Friendly.sep( BigInt(x) / BigInt(Math.pow(10, 6)), p) + "M"; }
+ static g(x, p=2) { return Friendly.sep( BigInt(x) / BigInt(Math.pow(10, 9)), p) + "G"; }
+ static kib(x, p=0) { return Friendly.sep((BigInt(x) + 1023n) / (1n << 10n)|0n, p) + " KiB"; }
+ static mib(x, p=1) { return Friendly.sep( BigInt(x) / (1n << 20n), p) + " MiB"; }
+ static gib(x, p=2) { return Friendly.sep( BigInt(x) / (1n << 30n), p) + " GiB"; }
}
diff --git a/src/zenserver/frontend/html/util/widgets.js b/src/zenserver/frontend/html/util/widgets.js
index d4f9875cd..32a3f4d28 100644
--- a/src/zenserver/frontend/html/util/widgets.js
+++ b/src/zenserver/frontend/html/util/widgets.js
@@ -173,7 +173,7 @@ export class PropTable extends Table
continue;
}
- if (friendly && typeof value == "number")
+ if (friendly && ((typeof value == "number") || (typeof value == "bigint")))
{
if (key.indexOf("memory") >= 0) value = Friendly.kib(value);
else if (key.indexOf("disk") >= 0) value = Friendly.kib(value);