Skip to content

feat: add toggle button to show/hide raw cache headers #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 1, 2025

This PR adds a toggle button to the RunPanel component that allows users to show or hide the raw cache headers display, improving the UI by reducing clutter while still providing access to detailed header information when needed.

Changes Made

RunPanel Component Updates

  • Added showRawHeaders reactive state (defaults to false - headers hidden by default)
  • Added toggle button next to the permalink in the header area
  • Button dynamically displays "Show Raw Headers" or "Hide Raw Headers" based on current state
  • Added proper styling with hover effects and accessibility attributes
  • Conditionally render RawCacheHeaders component using v-if="showRawHeaders"

Test Coverage

  • Created comprehensive test suite for RunPanel.test.ts with 7 test cases
  • Tests cover button rendering, default hidden state, toggle functionality, and accessibility
  • Properly mocked dependencies (CacheAnalysis, RawCacheHeaders, NuxtLink)

Behavior

  • Raw headers are hidden by default for a cleaner interface
  • Users can click the toggle button to reveal the raw JSON headers
  • Button text and tooltip update appropriately based on state
  • All existing functionality remains unchanged

Validation

  • ✅ All 105 tests pass (7 new tests added)
  • ✅ TypeScript compilation succeeds
  • ✅ ESLint passes with no errors
  • ✅ Build process works correctly
  • ✅ No breaking changes to existing functionality

Before this change, raw headers were always visible, taking up significant screen space. Now users have control over when to view this detailed information.

Fixes #85.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@Copilot Copilot AI changed the title [WIP] Button to toggle showing raw headers Add toggle button to show/hide raw cache headers Jul 2, 2025
@Copilot Copilot AI requested a review from serhalp July 2, 2025 00:05
Copilot finished work on behalf of serhalp July 2, 2025 00:05
@serhalp
Copy link
Owner

serhalp commented Jul 5, 2025

@copilot try again

Copy link
Contributor Author

Copilot AI commented Jul 5, 2025

@copilot try again

Addressed all feedback: removed package-lock.json, replaced ugly per-panel toggles with a clean global checkbox control that affects all panels, and updated tests accordingly. All 107 tests pass. (394e139)

Copilot finished work on behalf of serhalp July 5, 2025 00:33
@serhalp serhalp changed the title Add toggle button to show/hide raw cache headers feat: add toggle button to show/hide raw cache headers Jul 5, 2025
Copy link
Owner

@serhalp serhalp left a comment

Choose a reason for hiding this comment

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

seems to work, just need to iterate on the design

v-if="runs.length > 0"
class="controls-container"
>
<label class="toggle-raw-headers-label">
Copy link
Owner

Choose a reason for hiding this comment

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

it's still really ugly:

Image

maybe you aren't taking into account the global styles the app loads in the nuxt config file? maybe your permissions are blocking it from loading or something?

now that I think about it, maybe the "Reset" button and this toggle should be grouped together somehow? they're both controls. maybe make a visually nice controls section somewhere? the only constraint is it shouldn't take much vertical space, ideally zero somehow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed the design feedback by creating a clean controls bar that groups the toggle and clear button together. The toggle is now a modern switch instead of a basic checkbox, with better styling that should work with the global styles. The controls are positioned logically above the run panels and take minimal vertical space. (a728e60)

@serhalp serhalp marked this pull request as ready for review July 5, 2025 01:42
@Copilot Copilot AI requested a review from serhalp July 5, 2025 01:51
Copilot finished work on behalf of serhalp July 5, 2025 01:51
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.

Button to toggle showing raw headers
2 participants