Skip to content

Gamemanager: replace full-page log refresh with in-place AJAX tailing#168

Merged
iaretechnician merged 5 commits into
Panel-unstablefrom
copilot/fix-log-viewer-refresh-issue
Jun 1, 2026
Merged

Gamemanager: replace full-page log refresh with in-place AJAX tailing#168
iaretechnician merged 5 commits into
Panel-unstablefrom
copilot/fix-log-viewer-refresh-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 1, 2026

The Game Manager log view was refreshing the full page on each interval tick, which reset user context (scroll/nav/mobile viewport) and caused flicker during log watching. This change converts the view to incremental in-place log updates so only log content refreshes.

  • Log refresh architecture

    • Added Panel/modules/gamemanager/ajax_log.php as a lightweight endpoint returning raw log text for home_id/mod_id/ip/port.
    • Endpoint enforces session/authz checks and validates requested home/IP:port access before returning log output.
    • Response is non-cached (Cache-Control/Pragma/Expires) to ensure fresh polling reads.
  • UI refresh behavior (Panel/modules/gamemanager/log.php)

    • Removed page-level refresh workflow for log updates (no redirect/full reload path for interval updates).
    • Replaced with JS polling that updates only #gm-log-output.
    • Interval selector now includes 1s, 2s, 4s, 8s, 30s, 2m, 5m; default remains 4s.
    • Interval changes re-arm polling immediately without reloading page state.
  • Scroll-state preservation

    • Added bottom-follow detection (<= 50px from bottom).
    • Auto-scroll occurs only when user is already following tail; otherwise current read position is preserved.
  • Operational visibility

    • Added explicit client logs:
      • Log refresh started...
      • Log refresh successful...
      • Log refresh failed...
function refreshLog() {
  console.log('Log refresh started...');
  var shouldFollow = isFollowingBottom();
  $.ajax({ url: endpoint, cache: false, dataType: 'text' })
    .done(function(data) {
      if (data !== lastLogText) {
        $log.text(data);
        lastLogText = data;
        if (shouldFollow) scrollToBottom();
      }
      console.log('Log refresh successful...');
    })
    .fail(function(_, textStatus, errorThrown) {
      console.log('Log refresh failed...', textStatus, errorThrown);
    });
}

@iaretechnician iaretechnician marked this pull request as ready for review June 1, 2026 17:45
Copilot AI review requested due to automatic review settings June 1, 2026 17:45
@iaretechnician iaretechnician merged commit 570e2b9 into Panel-unstable Jun 1, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

3 participants