Bugzilla – Attachment 194901 Details for
Bug 36698
Display 'diff' nicely in action logs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36698: Expand nested object values in diff table
722483b.patch (text/plain), 2.87 KB, created by
Lisette Scheer
on 2026-03-06 18:52:26 UTC
(
hide
)
Description:
Bug 36698: Expand nested object values in diff table
Filename:
MIME Type:
Creator:
Lisette Scheer
Created:
2026-03-06 18:52:26 UTC
Size:
2.87 KB
patch
obsolete
>From 722483b6bfc6e89ae5359013ba63e723434219e9 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Fri, 6 Mar 2026 16:16:23 +0000 >Subject: [PATCH] Bug 36698: Expand nested object values in diff table > >When the diff column contains a value that is itself an object (e.g. >a set of granular subpermissions such as >{"override_renewals":1,"manage_curbside_pickups":1}), the previous >renderer would JSON.stringify it into a single unreadable cell. > >This follow-up makes fmt() recurse into objects, rendering them as >an indented <ul> list of key: value pairs instead. The <del>/<ins> >colour wrapper then highlights the entire expanded block, making it >clear at a glance which subpermissions were added or removed. > >null values (e.g. suspend_until transitioning to/from null) are >rendered as empty, letting the red/green cell background convey >the presence or absence of the value. > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> >--- > .../prog/en/modules/tools/viewlog.tt | 8 ++++++++ > koha-tmpl/intranet-tmpl/prog/js/viewlog.js | 17 ++++++++++++++--- > 2 files changed, 22 insertions(+), 3 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >index c399f5bc31b..847be5b0d6e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >@@ -87,6 +87,14 @@ > padding: 1px 3px; > display: inline-block; > } >+ table.struct-diff ul.diff-obj { >+ list-style: none; >+ margin: 0; >+ padding: 0 0 0 0.8em; >+ } >+ table.struct-diff ul.diff-obj li { >+ white-space: nowrap; >+ } > </style> > [% END %] > </head> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/viewlog.js b/koha-tmpl/intranet-tmpl/prog/js/viewlog.js >index 6d9e84319b8..f0e1d1f3324 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/viewlog.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/viewlog.js >@@ -41,9 +41,20 @@ function renderStructDiff(raw) { > if (!entries.length) return ""; > > function fmt(v) { >- if (v === undefined) return ""; >- var s = typeof v === "object" ? JSON.stringify(v) : String(v); >- return $("<span>").text(s).html(); >+ if (v === undefined || v === null) return ""; >+ if (typeof v !== "object") return $("<span>").text(String(v)).html(); >+ var items = Object.keys(v) >+ .map(function (k) { >+ return ( >+ "<li>" + >+ $("<span>").text(k).html() + >+ ": " + >+ fmt(v[k]) + >+ "</li>" >+ ); >+ }) >+ .join(""); >+ return '<ul class="diff-obj">' + items + "</ul>"; > } > > var rows = entries >-- >2.39.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36698
:
194566
|
194745
|
194752
|
194772
|
194773
|
194873
|
194874
|
194878
|
194900
| 194901