Skip to content

Fix Devportal application details layout shift when custom leftMenu width is applied#1277

Open
rvrv1234 wants to merge 2 commits intowso2:mainfrom
rvrv1234:fix-devportal-layout
Open

Fix Devportal application details layout shift when custom leftMenu width is applied#1277
rvrv1234 wants to merge 2 commits intowso2:mainfrom
rvrv1234:fix-devportal-layout

Conversation

@rvrv1234
Copy link
Copy Markdown

@rvrv1234 rvrv1234 commented Mar 16, 2026

Description

This PR fixes layout issues in the Devportal Application Details page.

Issue

Two UI problems were observed:

  1. The application details content shifts when theme.custom.leftMenu.width is customized.
  2. The mobile view of the application page appears misaligned even without customizations.

Root Cause

The layout margin used (theme.custom.leftMenu.width - 4), which caused incorrect alignment when custom widths were applied.
Additionally, the mobile breakpoint forced a fixed margin that resulted in a shifted layout.

Fix

  • Removed the hardcoded subtraction from the left menu width.
  • Updated the responsive breakpoint styles to remove forced margins in mobile view.

Test

  • Verified layout with default configuration.
  • Tested with custom left menu width values.
  • Confirmed correct alignment in mobile view.

Summary by CodeRabbit

  • Bug Fixes
    • Improved transaction data validation and API request handling in usage reports for more reliable data processing
    • Refined responsive layout calculations on the application details page to maintain proper alignment and visual consistency across different screen sizes

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


rvrv1234 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 16, 2026

Walkthrough

Two component files receive maintenance updates: one simplifies asynchronous API call handling with early validation and consolidated promise chains, while the other refines layout margin calculations for responsive navigation styling without altering core functionality.

Changes

Cohort / File(s) Summary
API Promise Handling
portals/admin/.../components/APISettings/UsageReport.jsx
Added early return validation for date parameters; replaced optional API call with unconditional invocation; converted unix() to valueOf() for timestamp formatting; consolidated nested promise chains into single then/catch/finally structure for cleaner error handling.
Layout Calculations
portals/devportal/.../components/Applications/Details/index.jsx
Adjusted left margin calculation for vertical-left navigation by removing -4 pixel offset and using full menu width; simplified responsive behavior at md breakpoint by removing conditional offset logic and setting margins to zero.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A hop through the code, we debug with care,
Promise chains simplified in the mountain air,
Margins realigned, layouts set right,
Cleaner APIs dancing in the light! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 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 primary change: fixing layout shifts in Devportal application details when custom leftMenu width is applied, which directly corresponds to the main content changes in the Details/index.jsx file.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

You can make CodeRabbit's review stricter and more nitpicky using the `assertive` profile, if that's what you prefer.

Change the reviews.profile setting to assertive to make CodeRabbit's nitpick more issues in your PRs.

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
portals/devportal/src/main/webapp/source/src/app/components/Applications/Details/index.jsx (1)

447-458: ⚠️ Potential issue | 🔴 Critical

Box component still uses hardcoded margin subtractions inconsistent with the fixed classes.content.

The Box component at lines 451-456 contains hardcoded values that were removed from classes.content:

  • Line 451: theme.custom.leftMenu.width - 158
  • Lines 455-456: theme.custom.leftMenu.width - 4

Meanwhile, classes.content (line 137) correctly uses theme.custom.leftMenu.width without subtractions and sets responsive marginLeft to 0. The Box component should align with this pattern by applying className={classes.content} instead of using inline sx with hardcoded values, as was done in commit d19b8bf before being reverted.

🐛 Suggested fix
-                <Box sx={(theme) => ({
-                    display: 'flex',
-                    flex: 1,
-                    flexDirection: 'column',
-                    marginLeft: (theme.custom.leftMenu.position === 'vertical-left' ? (theme.custom.leftMenu.width - 158) : 0),
-                    paddingBottom: theme.spacing(3),
-                    overflowX: 'hidden',
-                    [theme.breakpoints.down('md')]: {
-                        marginLeft: (theme.custom.leftMenu.position === 'vertical-left'
-                            ? (theme.custom.leftMenu.width - 4) : 0) !== 0 && 50,
-                    },
-                })}
-                >
+                <Box className={classes.content}>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@portals/devportal/src/main/webapp/source/src/app/components/Applications/Details/index.jsx`
around lines 447 - 458, Replace the inline sx usage on the Box component with
the existing classes.content so it uses theme.custom.leftMenu.width (no
hardcoded subtractions) and the same responsive marginLeft behavior as
classes.content; locate the Box instance that currently sets marginLeft via
(theme.custom.leftMenu.width - 158) and the breakpoint block using
(theme.custom.leftMenu.width - 4) and remove those calculations, applying
className={classes.content} instead, preserving any non-margin styles
(paddingBottom, overflowX, display/flex settings) by moving them into the
stylesheet for classes.content or combining them with the className.
🧹 Nitpick comments (1)
portals/devportal/src/main/webapp/source/src/app/components/Applications/Details/index.jsx (1)

137-144: Fix looks correct, but indentation is inconsistent.

The removal of the hardcoded -4 subtraction and setting margins to zero at the md breakpoint aligns with the PR objectives. However, the indentation inside the breakpoint block (lines 142-144) is inconsistent with the rest of the file's style (compare with lines 94-96).

🔧 Fix indentation to match file conventions
         [theme.breakpoints.down('md')]: {
-    marginLeft: 0,
-    marginRight: 0,
-},
+            marginLeft: 0,
+            marginRight: 0,
+        },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@portals/devportal/src/main/webapp/source/src/app/components/Applications/Details/index.jsx`
around lines 137 - 144, The breakpoint style block for
theme.breakpoints.down('md') has inconsistent indentation; locate the style
object that contains marginLeft, marginRight, paddingBottom, overflowX (the same
object using theme.custom.leftMenu) and reformat the lines inside the
[theme.breakpoints.down('md')] block so their indentation matches the file's
convention (align child properties with the other style blocks e.g., the same
number of spaces/tabs used at lines like 94-96), ensuring marginLeft: 0 and
marginRight: 0 remain unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@portals/admin/src/main/webapp/source/src/app/components/APISettings/UsageReport.jsx`:
- Around line 253-256: In the fetchTransactionData Promise chain (the .catch()
attached after the fetch that logs "Error fetching transaction count:"), remove
the rethrow (throw error) so the error is only logged and not rethrown; keep the
console.error call and allow the existing .finally() to run and
setLoading(false), since callers of fetchTransactionData are not awaiting its
promise and rethrowing causes unhandled promise rejections.

---

Outside diff comments:
In
`@portals/devportal/src/main/webapp/source/src/app/components/Applications/Details/index.jsx`:
- Around line 447-458: Replace the inline sx usage on the Box component with the
existing classes.content so it uses theme.custom.leftMenu.width (no hardcoded
subtractions) and the same responsive marginLeft behavior as classes.content;
locate the Box instance that currently sets marginLeft via
(theme.custom.leftMenu.width - 158) and the breakpoint block using
(theme.custom.leftMenu.width - 4) and remove those calculations, applying
className={classes.content} instead, preserving any non-margin styles
(paddingBottom, overflowX, display/flex settings) by moving them into the
stylesheet for classes.content or combining them with the className.

---

Nitpick comments:
In
`@portals/devportal/src/main/webapp/source/src/app/components/Applications/Details/index.jsx`:
- Around line 137-144: The breakpoint style block for
theme.breakpoints.down('md') has inconsistent indentation; locate the style
object that contains marginLeft, marginRight, paddingBottom, overflowX (the same
object using theme.custom.leftMenu) and reformat the lines inside the
[theme.breakpoints.down('md')] block so their indentation matches the file's
convention (align child properties with the other style blocks e.g., the same
number of spaces/tabs used at lines like 94-96), ensuring marginLeft: 0 and
marginRight: 0 remain unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ac1caac9-ff60-4b58-8e32-13df3a162447

📥 Commits

Reviewing files that changed from the base of the PR and between 3cd577e and c944a5b.

📒 Files selected for processing (2)
  • portals/admin/src/main/webapp/source/src/app/components/APISettings/UsageReport.jsx
  • portals/devportal/src/main/webapp/source/src/app/components/Applications/Details/index.jsx

Comment on lines +253 to +256
.catch((error) => {
console.error('Error fetching transaction count:', error);
throw error;
})
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

find . -name "UsageReport.jsx" -type f

Repository: wso2/apim-apps

Length of output: 143


🏁 Script executed:

wc -l ./portals/admin/src/main/webapp/source/src/app/components/APISettings/UsageReport.jsx

Repository: wso2/apim-apps

Length of output: 147


🏁 Script executed:

cat -n ./portals/admin/src/main/webapp/source/src/app/components/APISettings/UsageReport.jsx

Repository: wso2/apim-apps

Length of output: 14911


Remove the throw statement from the .catch() block to prevent unhandled promise rejection.

The error at line 255 is already logged, and since fetchTransactionData doesn't return the promise and call sites don't await it (lines 264, 329), rethrowing creates an unhandled promise rejection. The .finally() block will still execute to set setLoading(false).

Suggested fix
            .catch((error) => {
                console.error('Error fetching transaction count:', error);
-               throw error;
            })
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@portals/admin/src/main/webapp/source/src/app/components/APISettings/UsageReport.jsx`
around lines 253 - 256, In the fetchTransactionData Promise chain (the .catch()
attached after the fetch that logs "Error fetching transaction count:"), remove
the rethrow (throw error) so the error is only logged and not rethrown; keep the
console.error call and allow the existing .finally() to run and
setLoading(false), since callers of fetchTransactionData are not awaiting its
promise and rethrowing causes unhandled promise rejections.

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