Skip to content

feat(dev-tools)/adds sorting on columns with verticle borders - #8238

Merged
sid-bruno merged 5 commits into
usebruno:mainfrom
sachin-thakur-bruno:feat/dev-tools-network-headers-sort
Jun 12, 2026
Merged

sid-bruno merged 5 commits into
usebruno:mainfrom
sachin-thakur-bruno:feat/dev-tools-network-headers-sort

Conversation

@sachin-thakur-bruno

@sachin-thakur-bruno sachin-thakur-bruno commented Jun 11, 2026 •

Copy link
Copy Markdown
Collaborator

Description

JIRA

This PR covers the Sorting on the Network tab column.

  • Column config — introduced a COLUMNS array with width and alignment per column. Used to generate the grid template and separator positions from a single source of truth.
  • Full-height column separators — getSeparatorPositions computes the left/right pixel position of each separator from column widths. Renders as absolutely positioned 1px divs spanning the full container height, laying the groundwork for column resizing.
Screen.Recording.2026-06-11.at.4.25.10.PM.mov

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

Summary by CodeRabbit

  • New Features

    • Network tab requests are now sortable by clicking column headers, with visual sort-direction indicators and restored insertion order when sort is cleared.
  • Improvements

    • Redesigned request table into a column-based layout with visual column separators.
    • Cleaner row selection highlight and unified cell padding, typography, overflow/ellipsis, and right-aligned duration/size for improved readability.
  • Tests

    • Added tests covering sorting interactions and result ordering; test setup includes environment shims for consistent behavior.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ef6541cb-f690-452d-9593-0f4c0ed1c730

📥 Commits

Reviewing files that changed from the base of the PR and between d2ed928 and e66da48.

📒 Files selected for processing (3)
  • packages/bruno-app/jest.setup.js
  • packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.spec.js
  • packages/bruno-app/src/components/Devtools/Console/NetworkTab/utils.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/bruno-app/src/components/Devtools/Console/NetworkTab/utils.js

Walkthrough

Network Tab was refactored to a grid-driven request table with a COLUMNS config, client-side sorting (cycle: none → asc → desc), computed grid templates/separator positions, updated header/cell/row styling, Jest test shims, and RTL tests validating sort state and ordering.

Changes

Network Tab Grid Layout and Sorting

Layer / File(s) Summary
Column helpers and sort value extraction
packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.js, packages/bruno-app/src/components/Devtools/Console/NetworkTab/utils.js
Adds COLUMNS import/usage and helper exports: getGridTemplate, getSeparatorPositions, getSortValue, and sortRequests to compute grid templates, separator offsets, extract comparable sort values (method/status/domain/path/time/duration/size), and perform stable sorting.
Header / cell / row styling
packages/bruno-app/src/components/Devtools/Console/NetworkTab/StyledWrapper.js
Reworks header into .header-cell flex items, introduces .col-separator, resets .request-row padding, switches selected-row indicator to inset box-shadow, and standardizes cell padding, overflow/ellipsis, monospace typography, and right-alignment for duration/size.
Component grid rendering and header-driven sorting
packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.js
RequestRow accepts gridTemplateColumns; NetworkTab computes gridTemplateColumns and separatorPositions, adds sortConfig with handleHeaderClick to cycle sort state, renders clickable headers with active sort icons, and renders sortedRequests with positioned column separators.
Tests and Jest environment shims
packages/bruno-app/jest.setup.js, packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.spec.js
Adds global Jest shims for ResizeObserver and matchMedia and RTL tests that verify sort-icon cycling, single-active-column behavior, ordering for method/status (including case-insensitive sorting), and restoration of insertion order when sort is cleared.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • bijin-bruno
  • sid-bruno

Poem

✨ Click a header, watch rows realign,
Separators whisper column lines,
Monospace times in tidy right,
Sorts cycle through the header light,
Network table hums, precise and fine.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: adding sorting functionality to Network tab columns and introducing vertical column borders/separators.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (2)
packages/bruno-app/src/components/Devtools/Console/NetworkTab/StyledWrapper.js (1)

177-215: 💤 Low value

Redundant padding values on .request-size.

Line 210 specifies padding: 2px 8px 2px 8px; which is equivalent to padding: 2px 8px;.

✨ Simplification
   .request-size {
-    padding: 2px 8px 2px 8px;
+    padding: 2px 8px;
     color: ${(props) => props.theme.console.messageColor};
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/bruno-app/src/components/Devtools/Console/NetworkTab/StyledWrapper.js`
around lines 177 - 215, The .request-size rule contains redundant padding
shorthand (padding: 2px 8px 2px 8px); update the CSS in StyledWrapper.js by
replacing that value with the simplified equivalent padding: 2px 8px; so the
.request-size selector matches the other rules and removes unnecessary
duplication.
packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.js (1)

249-275: ⚡ Quick win

Add data-testid attributes for Playwright tests.

According to Bruno coding guidelines, testable elements should include data-testid for E2E tests. The header cells and request rows are interactive elements that would benefit from test identifiers.

🧪 Suggested additions

For header cells:

             <div
               key={col.key}
               className={`header-cell${col.align === 'right' ? ' text-right' : ''}`}
               onClick={() => handleHeaderClick(col.key)}
+              data-testid={`network-header-${col.key}`}
             >

For request rows:

           <div
             className={`request-row ${isSelected ? 'selected' : ''}`}
             onClick={onClick}
             style={{ gridTemplateColumns }}
+            data-testid="network-request-row"
           >
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.js`
around lines 249 - 275, Add data-testid attributes to the header cells and
request rows so Playwright can target them: in the header map where COLUMNS is
rendered (the div that calls handleHeaderClick and references
sortConfig.key/col.key) add a data-testid like
`data-testid={"network-header-"+col.key}`; in the requests list where
sortedRequests are mapped to the RequestRow component (the JSX that passes
request, isSelected, onClick via handleRequestClick, gridTemplateColumns) add a
data-testid prop (e.g.,
`data-testid={"network-request-"+request.itemUid+"-"+request.timestamp}`) or
wrap the row root div with that attribute so tests can reliably select rows.
Ensure test ids are unique and stable (use request.itemUid/timestamp or col.key)
and propagate them through RequestRow if necessary.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.js`:
- Around line 249-264: The header-cell markup conditionally adds a text-right
class (in NetworkTab's header render where COLUMNS are mapped, using
handleHeaderClick and sortConfig) but StyledWrapper.js lacks a definition for
.text-right; add a .text-right rule inside the .header-cell styles in
StyledWrapper.js to right-align content (so Duration and Size columns render
correctly) and ensure it applies to the span/text within the header-cell.

---

Nitpick comments:
In `@packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.js`:
- Around line 249-275: Add data-testid attributes to the header cells and
request rows so Playwright can target them: in the header map where COLUMNS is
rendered (the div that calls handleHeaderClick and references
sortConfig.key/col.key) add a data-testid like
`data-testid={"network-header-"+col.key}`; in the requests list where
sortedRequests are mapped to the RequestRow component (the JSX that passes
request, isSelected, onClick via handleRequestClick, gridTemplateColumns) add a
data-testid prop (e.g.,
`data-testid={"network-request-"+request.itemUid+"-"+request.timestamp}`) or
wrap the row root div with that attribute so tests can reliably select rows.
Ensure test ids are unique and stable (use request.itemUid/timestamp or col.key)
and propagate them through RequestRow if necessary.

In
`@packages/bruno-app/src/components/Devtools/Console/NetworkTab/StyledWrapper.js`:
- Around line 177-215: The .request-size rule contains redundant padding
shorthand (padding: 2px 8px 2px 8px); update the CSS in StyledWrapper.js by
replacing that value with the simplified equivalent padding: 2px 8px; so the
.request-size selector matches the other rules and removes unnecessary
duplication.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 33d20c83-64ca-4284-a182-fb8dcdc1daf7

📥 Commits

Reviewing files that changed from the base of the PR and between 59b4a16 and ba65a01.

📒 Files selected for processing (2)
  • packages/bruno-app/src/components/Devtools/Console/NetworkTab/StyledWrapper.js
  • packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.js

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🧹 Nitpick comments (3)
packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.spec.js (1)

136-139: ⚡ Quick win

Replace class-based DOM queries with stable test selectors.

Line 138 and Line 173 rely on .method-badge / .status-badge. These are styling-coupled and brittle. Prefer data-testid/role-based selectors so tests stay behavioral when class names change.

As per coding guidelines, brittle selectors should be replaced with role/label/test id or other stable user-facing selectors.

Also applies to: 172-174

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.spec.js`
around lines 136 - 139, The test's DOM queries inside getRowMethods (and the
similar status lookup) use fragile class selectors '.method-badge' and
'.status-badge'; update these to stable test selectors by changing the component
to add data-testid attributes (e.g., data-testid="network-method" /
data-testid="network-status") and modify the test to use
screen.getAllByTestId('network-request-row').map(row =>
row.querySelector('[data-testid="network-method"]')?.textContent) or use
role/label queries instead; locate getRowMethods and the corresponding status
extraction in the spec and replace class-based querySelector calls with
data-testid or role-based selectors to make the tests resilient to styling
changes.

Source: Coding guidelines

packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.js (1)

49-93: ⚡ Quick win

Extract helper functions to module level.

These six pure functions (formatTime, formatDuration, formatSize, getUrl, getDomain, getPath) are recreated on every render of every RequestRow. Since they don't depend on component state or hooks, extract them outside the component to reduce allocations.

♻️ Proposed refactor

Move the functions above the RequestRow component definition:

+const formatTime = (timestamp) => {
+  const date = new Date(timestamp);
+  return date.toLocaleTimeString('en-US', {
+    hour12: false,
+    hour: '2-digit',
+    minute: '2-digit',
+    second: '2-digit',
+    fractionalSecondDigits: 3
+  });
+};
+
+const formatDuration = (duration) => {
+  if (!duration) return '-';
+  if (duration < 1000) return `${Math.round(duration)}ms`;
+  return `${(duration / 1000).toFixed(2)}s`;
+};
+
+const formatSize = (size) => {
+  if (!size) return '-';
+  if (size < 1024) return `${size}B`;
+  if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)}KB`;
+  return `${(size / (1024 * 1024)).toFixed(1)}MB`;
+};
+
+const getUrl = (req) => req?.url || 'Unknown URL';
+
+const getDomain = (req) => {
+  try {
+    const url = new URL(getUrl(req));
+    return url.hostname;
+  } catch {
+    return getUrl(req);
+  }
+};
+
+const getPath = (req) => {
+  try {
+    const url = new URL(getUrl(req));
+    return url.pathname + url.search;
+  } catch {
+    return getUrl(req);
+  }
+};
+
 const RequestRow = ({ request, isSelected, onClick, gridTemplateColumns }) => {
   const { data } = request;
   const { request: req, response: res, timestamp } = data;

-  const formatTime = (timestamp) => {
-    const date = new Date(timestamp);
-    return date.toLocaleTimeString('en-US', {
-      hour12: false,
-      hour: '2-digit',
-      minute: '2-digit',
-      second: '2-digit',
-      fractionalSecondDigits: 3
-    });
-  };
-
-  const formatDuration = (duration) => {
-    if (!duration) return '-';
-    if (duration < 1000) return `${Math.round(duration)}ms`;
-    return `${(duration / 1000).toFixed(2)}s`;
-  };
-
-  const formatSize = (size) => {
-    if (!size) return '-';
-    if (size < 1024) return `${size}B`;
-    if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)}KB`;
-    return `${(size / (1024 * 1024)).toFixed(1)}MB`;
-  };
-
-  const getUrl = () => {
-    return req?.url || 'Unknown URL';
-  };
-
-  const getDomain = () => {
-    try {
-      const url = new URL(getUrl());
-      return url.hostname;
-    } catch {
-      return getUrl();
-    }
-  };
-
-  const getPath = () => {
-    try {
-      const url = new URL(getUrl());
-      return url.pathname + url.search;
-    } catch {
-      return getUrl();
-    }
-  };
-
   return (
     <div
       className={`request-row ${isSelected ? 'selected' : ''}`}
       onClick={onClick}
       style={{ gridTemplateColumns }}
       data-testid="network-request-row"
     >
       <div className="request-method">
         <MethodBadge method={req?.method} />
       </div>

       <div className="request-status">
         <StatusBadge status={res?.status} statusCode={res?.statusCode} />
       </div>

-      <div className="request-domain" title={getDomain()}>
-        {getDomain()}
+      <div className="request-domain" title={getDomain(req)}>
+        {getDomain(req)}
       </div>

-      <div className="request-path" title={getPath()}>
-        {getPath()}
+      <div className="request-path" title={getPath(req)}>
+        {getPath(req)}
       </div>

       <div className="request-time">
         {formatTime(timestamp)}
       </div>

       <div className="request-duration">
         {formatDuration(res?.duration)}
       </div>

       <div className="request-size">
         {formatSize(res?.size)}
       </div>
     </div>
   );
 };
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.js`
around lines 49 - 93, Extract the six pure helpers (formatTime, formatDuration,
formatSize, getUrl, getDomain, getPath) out of the RequestRow component to
module scope to avoid recreating them on every render; move their definitions
above the RequestRow declaration and update getUrl/getDomain/getPath to accept a
req (or url) argument instead of closing over req so callers inside RequestRow
pass the request (e.g., req) into getUrl/getDomain/getPath; ensure signatures
remain consistent and update any internal calls in RequestRow to use the new
parameterized helpers.
packages/bruno-app/src/components/Devtools/Console/NetworkTab/utils.js (1)

4-25: ⚡ Quick win

Add JSDoc to explain the separator positioning algorithm.

This function implements non-trivial logic for computing separator positions between mixed fixed/auto-width columns. As per coding guidelines, complex code should include documentation to aid future maintainers.

📝 Proposed JSDoc
+/**
+ * Computes the left/right pixel positions for column separators.
+ * For columns with fixed widths, separators are positioned from the left.
+ * For columns with auto widths (null), separators are positioned from the right.
+ * `@param` {Array} columns - Array of column definitions with width property
+ * `@returns` {Array} Array of position objects with {left: px} or {right: px} or null
+ */
 export const getSeparatorPositions = (columns) => {
   const n = columns.length;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/bruno-app/src/components/Devtools/Console/NetworkTab/utils.js`
around lines 4 - 25, Add a JSDoc block to getSeparatorPositions describing
purpose, parameters, return value and algorithm: state that it computes
separator positions for n-1 separators given an array of column objects (each
with width which may be number or null), explain the left-to-right pass that
records absolute left offsets until an auto-width (null) column, the
right-to-left pass that records absolute right offsets until an auto-width
column and only fills gaps where left pass didn't set a position, and clarify
the returned array format (length n-1 with entries null or objects {left:
number} or {right: number}); include param types for columns and the exact shape
of the returned positions for future maintainers and tooling.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.spec.js`:
- Around line 12-29: The tests overwrite globals (global.ResizeObserver and
window.matchMedia in the beforeAll block) but never restore them; save the
original references (e.g., const _origResizeObserver = global.ResizeObserver and
const _origMatchMedia = window.matchMedia) before mocking and restore them in an
afterAll cleanup (or set them back to undefined if originally undefined) so the
mocks do not leak to other suites; update the beforeAll/afterAll surrounding the
ResizeObserver assignment and the matchMedia Object.defineProperty to perform
this save/restore.

In `@packages/bruno-app/src/components/Devtools/Console/NetworkTab/utils.js`:
- Around line 27-46: getSortValue currently returns the HTTP method raw for the
'method' key, causing case-sensitive sorting; update the 'method' branch in
getSortValue to normalize the method string (e.g., use
req?.method?.toUpperCase() or .toLowerCase() with a fallback '') so comparisons
are case-insensitive and consistent across mixed-case inputs; modify the
'method' case in
packages/bruno-app/src/components/Devtools/Console/NetworkTab/utils.js to return
the normalized method instead of req?.method.

---

Nitpick comments:
In `@packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.js`:
- Around line 49-93: Extract the six pure helpers (formatTime, formatDuration,
formatSize, getUrl, getDomain, getPath) out of the RequestRow component to
module scope to avoid recreating them on every render; move their definitions
above the RequestRow declaration and update getUrl/getDomain/getPath to accept a
req (or url) argument instead of closing over req so callers inside RequestRow
pass the request (e.g., req) into getUrl/getDomain/getPath; ensure signatures
remain consistent and update any internal calls in RequestRow to use the new
parameterized helpers.

In `@packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.spec.js`:
- Around line 136-139: The test's DOM queries inside getRowMethods (and the
similar status lookup) use fragile class selectors '.method-badge' and
'.status-badge'; update these to stable test selectors by changing the component
to add data-testid attributes (e.g., data-testid="network-method" /
data-testid="network-status") and modify the test to use
screen.getAllByTestId('network-request-row').map(row =>
row.querySelector('[data-testid="network-method"]')?.textContent) or use
role/label queries instead; locate getRowMethods and the corresponding status
extraction in the spec and replace class-based querySelector calls with
data-testid or role-based selectors to make the tests resilient to styling
changes.

In `@packages/bruno-app/src/components/Devtools/Console/NetworkTab/utils.js`:
- Around line 4-25: Add a JSDoc block to getSeparatorPositions describing
purpose, parameters, return value and algorithm: state that it computes
separator positions for n-1 separators given an array of column objects (each
with width which may be number or null), explain the left-to-right pass that
records absolute left offsets until an auto-width (null) column, the
right-to-left pass that records absolute right offsets until an auto-width
column and only fills gaps where left pass didn't set a position, and clarify
the returned array format (length n-1 with entries null or objects {left:
number} or {right: number}); include param types for columns and the exact shape
of the returned positions for future maintainers and tooling.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5ff8a9bd-ee2d-4cc9-9c48-8a3397970741

📥 Commits

Reviewing files that changed from the base of the PR and between 2ff9650 and d2ed928.

📒 Files selected for processing (3)
  • packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.js
  • packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.spec.js
  • packages/bruno-app/src/components/Devtools/Console/NetworkTab/utils.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants