luci-app-dockerman: correctness fixes
authorPaul Donald <redacted>
Fri, 22 May 2026 12:46:41 +0000 (15:46 +0300)
committerPaul Donald <redacted>
Wed, 27 May 2026 12:49:44 +0000 (15:49 +0300)
follow-up to baa0f16bb36e830279a21bd015aa7734f3e6df21

Signed-off-by: Paul Donald <redacted>
applications/luci-app-dockerman/htdocs/luci-static/resources/dockerman/common.js
applications/luci-app-dockerman/htdocs/luci-static/resources/view/dockerman/container.js
applications/luci-app-dockerman/htdocs/luci-static/resources/view/dockerman/volumes.js
applications/luci-app-dockerman/root/usr/share/rpcd/ucode/docker_rpc.uc

index 4425ecd93d799ba20db25d5be32ac56ce2ec116d..53147cf68c6818ae55e8a57355dc2a615f93992e 100644 (file)
@@ -488,7 +488,7 @@ const dv = view.extend({
 
        parseMemory(value) {
                if (!value) return 0;
-               const rex = /^([0-9.]+) *([bkmgt])?i? *[Bb]?/i;
+               const rex = /^([0-9.]+) *([bkmgtp])?i? *[Bb]?/i;
                let [, amount, unit] = rex.exec(value.toLowerCase());
                amount = amount ? Number.parseFloat(amount) : 0;
                switch (unit) {
index 66f412a68f1991f9802c84dc2b8af11de10299f0..9f8430ec0b3d41e46d9eba7669405c9c89d2cc15 100644 (file)
@@ -1086,7 +1086,7 @@ return dm2.dv.extend({
 
                        o = s.taboption('wsconsole', form.DummyValue, 'wsconsole_controls', _('WebSocket Console'));
                        o.render = L.bind(function() {
-                               const status = this.getContainerStatus();
+                               const status = this.getContainerStatus(this_container);
                                const isRunning = status === 'running';
 
                                if (!isRunning) {
@@ -1327,6 +1327,7 @@ return dm2.dv.extend({
                        .then(() => {
                                const this_container = map.data.get('json', 'cont');
                                const id = this_container?.Id;
+                               const nc = gethc('NanoCpus');
                                /* In the container edit context, there are not many items we
                                can change - duplicate the container */
                                const createBody = {
@@ -1335,11 +1336,11 @@ return dm2.dv.extend({
                                        Memory: toInt(gethc('Memory')),
                                        MemorySwap: toInt(gethc('MemorySwap')),
                                        MemoryReservation: toInt(gethc('MemoryReservation')),
-                                       BlkioWeight: toInt(gethc('blkio_weight')),
+                                       BlkioWeight: toInt(gethc('BlkioWeight')),
 
                                        CpuPeriod: toInt(gethc('CpuPeriod')),
                                        CpuQuota: toInt(gethc('CpuQuota')),
-                                       NanoCPUs: toInt(gethc('NanoCpus') * (10 ** 9)), // unit: 10^-9, input: float
+                                       NanoCPUs: nc ? Math.round(nc * 1e9) : undefined, // unit: 10^-9, input: float
                                        OomKillDisable: toBool(gethc('OomKillDisable')),
 
                                        RestartPolicy: { Name: get('restart_policy') || this_container.HostConfig?.RestartPolicy?.Name },
index 7734a431bcb484f971503f4ff0eab78d26386b91..d7fcc205e65c4823a031da0ebabe37445af7a8dc 100644 (file)
@@ -22,7 +22,7 @@ return dm2.dv.extend({
 
        render([volumes, containers]) {
                if (volumes?.code !== 200) {
-                       return E('div', {}, [ volumes.body.message ]);
+                       return E('div', {}, [ volumes?.body?.message ?? _('Failed to load volumes') ]);
                }
 
                // this.volumes = volumes || {};
index 5fb85394d77466f0cfa3961b31f442182c809a10..9bd56740e0f5a7876291b43044c18e09256302c5 100755 (executable)
@@ -290,7 +290,7 @@ function run_ttyd(request) {
 
        const id = request.args.id || '';
        const cmd = request.args.cmd || '/bin/sh';
-       const port = request.args.port || 7682;
+       const port = int(request.args.port) || 7682;
        const uid = request.args.uid || '';
 
        if (!id) {
git clone https://git.99rst.org/PROJECT