Skip to content

Fix. SecurityLog. Fixed ip column and timeline render. - #724

Merged
svfcode merged 2 commits into
devfrom
upd-sec-log
Aug 30, 2026
Merged

Fix. SecurityLog. Fixed ip column and timeline render.#724
svfcode merged 2 commits into
devfrom
upd-sec-log

Conversation

@svfcode

@svfcode svfcode commented Aug 30, 2026

Copy link
Copy Markdown
Member

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR targets the Security Log UI by improving the user-activity timeline’s rendering behavior (especially around accordion visibility/resize) and correcting how IP addresses are prepared/displayed in the Security Log table.

Changes:

  • Added timeline init guards and a centralized “redraw current timeline” path to improve timeline rendering on resize/accordion interaction.
  • Adjusted Security Log IP preparation to normalize IPv6 values for display/actions.
  • Updated the shipped minified timeline bundle.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
js/src/spbc-timeline-widget.js Adds init guarding and redraw logic for the Security Log timeline widget, including accordion/resize behavior.
js/spbc-timeline-widget.min.js Updates the minified asset corresponding to the timeline widget.
inc/spbc-settings.php Updates Security Log IP formatting/normalization and how IPs are shown in the table.
Suppressed comments (2)

js/src/spbc-timeline-widget.js:116

  • redrawCurrentTimeline() can be called from the window resize listener even when initTimeline() hasn’t successfully run yet (e.g., when the widget DOM is injected later and the MutationObserver is waiting). In that case the draw methods will throw when required DOM nodes don’t exist yet. Guard redraws until initialization has completed.
    redrawCurrentTimeline() {
        if (!this.selectedUserValue) {
            return;
        }
        if (this.selectedUserValue === 'most_active__action') {

inc/spbc-settings.php:767

  • sprintf() is currently passed 3 arguments but the format string contains only 2 placeholders, so $country_part is never rendered. Also, the two displayed IP values are identical, which makes the second line redundant. Consider showing the raw logged IP and the normalized one, and include the country part in the format string.
            $ip_part      = sprintf(
                '<a href="' . $ip_blacklist_link . '" target="_blank">%s<i class="spbc-icon-link-ext"></i></a><br>%s',
                $ip,
                $ip,
                $country_part

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread js/src/spbc-timeline-widget.js
Comment thread inc/spbc-settings.php Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (1)

js/src/spbc-timeline-widget.js:64

  • tryInit() only assigns the redraw handler via the accordion activate option when it initializes the accordion itself. In this file, spbcTimelineWidgetRender() also initializes #spbc-timeline-accordion on DOM ready without an activate handler (see js/src/spbc-timeline-widget.js:1001-1006), which can overwrite/prevent the redraw hook and leave the SVG rendered at 0 width after expanding the accordion. Bind to the accordionactivate event unconditionally (namespaced) so the redraw handler survives accordion re-initialization regardless of where it happens.
            // Draw first, while the panel is still visible. jQuery accordion
            // with active:false sets display:none and clientWidth becomes 0.
            this.initTimeline();
            const $acc = jQuery(accordion);
            if ($acc.length && ! $acc.hasClass('ui-accordion')) {

@svfcode
svfcode merged commit d415775 into dev Aug 30, 2026
5 checks passed
@Glomberg
Glomberg deleted the upd-sec-log branch September 2, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants