Repository navigation
feat(ui): display and edit JSON payloads as HJSON - #584
madejackson wants to merge 1 commit into
Conversation
…itor
Instead of storing a snapshot label, derive what the user actually set by
diffing the running container's config against the image's own config:
Backend
- New ExportContainerRuntime: exports only the settings that were explicitly
set at create time, by comparing ContainerInspect against
ImageInspectWithRaw:
* env: keep only entries not present in the image env or with a different
value (image-inherited ENV and Cosmos-injected TZ/normalized vars dropped)
* labels: keep only labels not in the image; drop cosmos.* and
com.docker.compose.* bookkeeping labels
* command/entrypoint/workingdir/user/stopsignal/hostname/domainname/
healthcheck: kept only when they differ from the image's
* inherently-runtime fields (ports, volumes, networks, resources, restart,
dns, etc.) have no image baseline and are exported as-is
* falls back to the full runtime export if the image is unavailable
- ExportContainerRoute: ?from=initial (default) uses the diff;
?from=runtime uses the full live runtime export
Frontend
- docker.tsx exportContainer now takes from?: 'initial' | 'runtime'
- compose-editor adds a 'Show runtime values' switch that re-fetches the
diff vs the full runtime view (themed for dark/light)
- newService.jsx re-syncs the editor when the service prop changes (so the
toggle actually updates the document)
Prerequisite: bases on the HJSON PR azukaar#584 (feat/hjson-display).
…itor
Instead of storing a snapshot label, derive what the user actually set by
diffing the running container's config against the image's own config:
Backend
- New ExportContainerRuntime: exports only the settings that were explicitly
set at create time, by comparing ContainerInspect against
ImageInspectWithRaw:
* env: keep only entries not present in the image env or with a different
value (image-inherited ENV and Cosmos-injected TZ/normalized vars dropped)
* labels: keep only labels not in the image; drop cosmos.* and
com.docker.compose.* bookkeeping labels
* command/entrypoint/workingdir/user/stopsignal/hostname/domainname/
healthcheck: kept only when they differ from the image's
* inherently-runtime fields (ports, volumes, networks, resources, restart,
dns, etc.) have no image baseline and are exported as-is
* falls back to the full runtime export if the image is unavailable
- ExportContainerRoute: ?from=initial (default) uses the diff;
?from=runtime uses the full live runtime export
Frontend
- docker.tsx exportContainer now takes from?: 'initial' | 'runtime'
- compose-editor adds a 'Show runtime values' switch that re-fetches the
diff vs the full runtime view (themed for dark/light)
- newService.jsx re-syncs the editor when the service prop changes (so the
toggle actually updates the document)
Prerequisite: bases on the HJSON PR azukaar#584 (feat/hjson-display).
3e27b37 to
2846cf2
Compare
…itor
Instead of storing a snapshot label, derive what the user actually set by
diffing the running container's config against the image's own config:
Backend
- New ExportContainerRuntime: exports only the settings that were explicitly
set at create time, by comparing ContainerInspect against
ImageInspectWithRaw:
* env: keep only entries not present in the image env or with a different
value (image-inherited ENV and Cosmos-injected TZ/normalized vars dropped)
* labels: keep only labels not in the image; drop cosmos.* and
com.docker.compose.* bookkeeping labels
* command/entrypoint/workingdir/user/stopsignal/hostname/domainname/
healthcheck: kept only when they differ from the image's
* inherently-runtime fields (ports, volumes, networks, resources, restart,
dns, etc.) have no image baseline and are exported as-is
* falls back to the full runtime export if the image is unavailable
- ExportContainerRoute: ?from=initial (default) uses the diff;
?from=runtime uses the full live runtime export
Frontend
- docker.tsx exportContainer now takes from?: 'initial' | 'runtime'
- compose-editor adds a 'Show runtime values' switch that re-fetches the
diff vs the full runtime view (themed for dark/light)
- newService.jsx re-syncs the editor when the service prop changes (so the
toggle actually updates the document)
Prerequisite: bases on the HJSON PR azukaar#584 (feat/hjson-display).
2846cf2 to
c0b4e29
Compare
…itor
Instead of storing a snapshot label, derive what the user actually set by
diffing the running container's config against the image's own config:
Backend
- New ExportContainerRuntime: exports only the settings that were explicitly
set at create time, by comparing ContainerInspect against
ImageInspectWithRaw:
* env: keep only entries not present in the image env or with a different
value (image-inherited ENV and Cosmos-injected TZ/normalized vars dropped)
* labels: keep only labels not in the image; drop cosmos.* and
com.docker.compose.* bookkeeping labels
* command/entrypoint/workingdir/user/stopsignal/hostname/domainname/
healthcheck: kept only when they differ from the image's
* inherently-runtime fields (ports, volumes, networks, resources, restart,
dns, etc.) have no image baseline and are exported as-is
* falls back to the full runtime export if the image is unavailable
- ExportContainerRoute: ?from=initial (default) uses the diff;
?from=runtime uses the full live runtime export
Frontend
- docker.tsx exportContainer now takes from?: 'initial' | 'runtime'
- compose-editor adds a 'Show runtime values' switch that re-fetches the
diff vs the full runtime view (themed for dark/light)
- newService.jsx re-syncs the editor when the service prop changes (so the
toggle actually updates the document)
Prerequisite: bases on the HJSON PR azukaar#584 (feat/hjson-display).
c0b4e29 to
efffa6e
Compare
…itor
Instead of storing a snapshot label, derive what the user actually set by
diffing the running container's config against the image's own config:
Backend
- New ExportContainerRuntime: exports only the settings that were explicitly
set at create time, by comparing ContainerInspect against
ImageInspectWithRaw:
* env: keep only entries not present in the image env or with a different
value (image-inherited ENV and Cosmos-injected TZ/normalized vars dropped)
* labels: keep only labels not in the image; drop cosmos.* and
com.docker.compose.* bookkeeping labels
* command/entrypoint/workingdir/user/stopsignal/hostname/domainname/
healthcheck: kept only when they differ from the image's
* inherently-runtime fields (ports, volumes, networks, resources, restart,
dns, etc.) have no image baseline and are exported as-is
* falls back to the full runtime export if the image is unavailable
- ExportContainerRoute: ?from=initial (default) uses the diff;
?from=runtime uses the full live runtime export
Frontend
- docker.tsx exportContainer now takes from?: 'initial' | 'runtime'
- compose-editor adds a 'Show runtime values' switch that re-fetches the
diff vs the full runtime view (themed for dark/light)
- newService.jsx re-syncs the editor when the service prop changes (so the
toggle actually updates the document)
Prerequisite: bases on the HJSON PR azukaar#584 (feat/hjson-display).
PR azukaar#584 (HJSON infra) adds client/src/utils/hjson.jsx which imports the 'hjson' npm package, but the dependency was never declared in package.json. Without it the client build fails at: Rollup failed to resolve import "hjson" from hjson.jsx Add hjson ^3.2.2 (same version as PR azukaar#584).
efffa6e to
616ed90
Compare
c0f48b1 to
d6c18d0
Compare
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: madejackson.
|
8051ed3 to
bbccc62
Compare
7ca9a67 to
f60d7bc
Compare
|
Updated the branch to match the description in the PR body — the HJSON output now actually uses |
Replace raw JSON.stringify output with HJSON (hjson.github.io) in the compose editor, docker-compose JSON import, API config preview modals and the event explorer: unquoted keys, always-quoted string values, trailing separators, no escaping noise. The compose editor/import parse HJSON on submit (JSON first, HJSON fallback — a superset), so users can paste either. Pure frontend preprocessing: the backend still receives and emits JSON. Includes a Prism grammar that keeps the familiar editor colors with HJSON: keys red, string values green, numbers/booleans/null purple, comments and multiline strings/block-comments grey/green. Strings containing #, // or : stay single quoted strings; comments containing ':' stay comments. Files: - client/src/utils/hjson.jsx (new): toHjson + parseJsonOrHjson - client/src/utils/hjsonGrammar.js (new): Prism HJSON grammar - newService.jsx / docker-compose.jsx: init/parse as JSON-or-HJSON - apiModal.jsx / eventsExplorer.jsx: render payloads/events as HJSON - package.json / package-lock.json: add hjson dependency
f60d7bc to
cb4caf5
Compare
Replace raw JSON.stringify output with HJSON (hjson.github.io) in the compose editor, docker-compose JSON import, API config preview modals and the event explorer: unquoted keys, always-quoted string values, trailing separators, no escaping noise. The compose editor/import parse HJSON on submit (JSON first, HJSON fallback - a superset), so users can paste either. Pure frontend preprocessing: the backend still receives and emits JSON. Includes a Prism grammar that keeps the familiar editor colors with HJSON: keys red, string values green, numbers/booleans/null purple, comments and multiline strings/block-comments grey/green. Strings containing #, // or : stay single quoted strings; comments containing ':' stay comments. Files: - client/src/utils/hjson.jsx (new): toHjson + parseJsonOrHjson - client/src/utils/hjsonGrammar.js (new): Prism HJSON grammar - newService.jsx / docker-compose.jsx: init/parse as JSON-or-HJSON - apiModal.jsx / eventsExplorer.jsx: render payloads/events as HJSON - package.json / package-lock.json: add hjson dependency Upstream PR: azukaar#584
Closing: fully superseded by #590Verified mechanically, not by eye: Identical #590 = this exact commit plus the follow-up commit Closing #584 in favour of #590, which I'll keep rebased and verified. Nothing is dropped: every line of this PR is inside #590's branch ( |
Display & edit JSON payloads as HJSON
The compose editor (create/edit/import), API config preview modals and the event explorer rendered raw
JSON.stringifyoutput — noisy with quotes and escaping. This switches the display side to HJSON (hjson.github.io) and makes the compose editor/import accept HJSON on input.What changes
client/src/utils/hjson.jsx(new):toHjson()renders objects as pretty HJSON (unquoted keys,quotes: 'min'string values,separator: false, multiline strings as'''blocks);parseJsonOrHjson()tries JSON first and falls back to HJSON (a superset of JSON) — users can paste either.\n(but no\r) render as''' ... '''blocks; CRLF strings stay escaped to avoid Hjson's\r-stripping data loss. Round-trip is exact.quoteArrayColons: bare array elements containing:(e.g.BACKEND_HOSTNAME=https://...,8080:80) are quoted so the grammar colors them as single green strings.extractComments/injectComments): HJSON comments are extracted to a node→comment map on save and restored on load;'''block interiors are skipped so#///inside multiline strings are never captured as comments.client/src/utils/hjsonGrammar.js(new): a Prism grammar that keeps the editor's familiar colors with HJSON — keys red, string values green (bare, quoted and'''blocks), numbers/booleans violet,nullcyan, comments (#, //, / */*) grey, multiline strings & block comments supported. Handles strings containing#,//,:and comments containing:correctly.newService.jsx: compose editor initialised withtoHjson(service), submits viaparseJsonOrHjson.docker-compose.jsx: JSON compose imports parse viaparseJsonOrHjson(2-line change; YAML import path untouched).apiModal.jsx/eventsExplorer.jsx: API payloads and event details render as HJSON when JSON (non-JSON text left as-is).package.json/package-lock.json: addhjsondependency.Notes
npm run client-buildand an extensive test matrix (keys, escaped quotes,#////:inside strings, multiline strings/block comments, env-array values likeTZ=Europe/ZurichandFTLCONF_misc_dnsmasq_lines=..., round-trip of CRLF and multiline values).