|
Description
Kyle M Hall (khall)
2025-09-15 19:19:55 UTC
Created attachment 186445 [details] [review] Bug 40813: Add ability to embed page start and end timing It would be useful to know what time a page load was initiated and rendering completed for debugging purposes. The most reasonable solution I've found is to get a time from the start of get_template_and_user and the end of intranet-bottom.inc. This adds timing to nearly all Koha pages with just a few lines of code. Test Plan: 1) Apply this patch 2) Restart all the things! 3) Load mainpage.pl 4) Note the "start" and "end" values at the bottom of the page Open questions: 1) Do we need to hide this data by default using CSS or a syspref? If so, which? 2) Can anyone style this information better? (In reply to Kyle M Hall (khall) from comment #2) > Open questions: > 1) Do we need to hide this data by default using CSS or a syspref? If so, > which? In my opinion it should be by system preference. Perhaps "DumpTemplateLoadTimes"? Created attachment 186490 [details] [review] Bug 40813: Add ability to embed page start and end timing It would be useful to know what time a page load was initiated and rendering completed for debugging purposes. The most reasonable solution I've found is to get a time from the start of get_template_and_user and the end of intranet-bottom.inc. This adds timing to nearly all Koha pages with just a few lines of code. Test Plan: 1) Apply this patch 2) Restart all the things! 3) Load mainpage.pl 4) Note the "start" and "end" values at the bottom of the page 1) QA checks - failing (blocker) I am not sure about the span error. I have tried to spot it, but failed. But will be interesting to check maybe. Processing files [RUNNING] C4/Auth.pm [RUNNING] koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc [ ] 0/2 tests completed [error] E3jaz8Qpz5.tt: SyntaxError: Unexpected closing tag "span". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags (4:9) [error] 2 | #~136~# [error] 3 | #~137~# [error] > 4 | </span> [error] | ^^^^^^^ [error] 5 | </div> [error] 6 | </footer> [FAIL] koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc [PASS] C4/Auth.pm Result: [PASS] C4/Auth.pm [FAIL] koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc FAIL filters missing_filter at line 301 ( <span class="navbar-text start_time" data-start="[% start_time %]">) missing_filter at line 303 ( [% start_time.hms(':') %]) missing_filter at line 306 ( <span class="navbar-text end_time" data-end="[% end_time %]">) missing_filter at line 308 ( [% end_time.hms(':') %]) FAIL tidiness File is not tidy, please run `perl misc/devel/tidy.pl koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc` Processing additional checks PASS! 2) Code review Nothing spotted. 3) Testing a) System preference / Debug setting (blocker) It works as described, but I agree with Lucas' comment about the preference. This should be optional and have a switch to turn on/off b) Styling (no blocker) Right now it doesn't stay at the bottom of the page but moves up on pages with not a lot of content. For testing it might be nicer to "pin" it to the bottom, so you can compare a little easier between pages, etc. because it's always in the same spot. Created attachment 192095 [details]
Mockup of the times in the footer
Maybe it could be shown in a footer like the language selectors? We'd have to re-do the logic on when to show it.
(In reply to Owen Leonard from comment #6) > Created attachment 192095 [details] > Mockup of the times in the footer > > Maybe it could be shown in a footer like the language selectors? We'd have > to re-do the logic on when to show it. That looks really great to me. How would it look like if there are no other languages active? Created attachment 192117 [details] [review] Bug 40813: Move timings to existing footer Own, I think I've got the logic fixed, but I have failed to style it correctly. Can you have a look? Thanks! Created attachment 192128 [details] [review] Bug 40813: (follow-up) Add some CSS, udpate navbar structure This follow-up changes the structure of the footer navbar markup so that it avoids IDs related to "language" since its purpose is now more general. The start and end time markup is adjusted for being inside a navbar and to align it to the right away from the language menu (if present). Also changed: Added missing html filters and fixed a minor tidy complaint in Auth.pm. It occurs to me that this would be even more useful if it output milliseconds too. Created attachment 192167 [details] [review] Bug 40813: Add ability to embed page start and end timing It would be useful to know what time a page load was initiated and rendering completed for debugging purposes. The most reasonable solution I've found is to get a time from the start of get_template_and_user and the end of intranet-bottom.inc. This adds timing to nearly all Koha pages with just a few lines of code. Test Plan: 1) Apply this patch 2) Restart all the things! 3) Load mainpage.pl 4) Note the "start" and "end" values at the bottom of the page Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Created attachment 192168 [details] [review] Bug 40813: Move timings to existing footer Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Created attachment 192169 [details] [review] Bug 40813: (follow-up) Add some CSS, udpate navbar structure This follow-up changes the structure of the footer navbar markup so that it avoids IDs related to "language" since its purpose is now more general. The start and end time markup is adjusted for being inside a navbar and to align it to the right away from the language menu (if present). Also changed: Added missing html filters and fixed a minor tidy complaint in Auth.pm. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Created attachment 192170 [details] [review] Bug 40813: (follow-up) Add milliseconds Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> |