Skip to content

RI-8188 Gate Profiler start with confirmation on production databases#5936

Open
KrumTy wants to merge 4 commits into
mainfrom
fe/feature/RI-8188/profiler-start-confirmation
Open

RI-8188 Gate Profiler start with confirmation on production databases#5936
KrumTy wants to merge 4 commits into
mainfrom
fe/feature/RI-8188/profiler-start-confirmation

Conversation

@KrumTy
Copy link
Copy Markdown
Contributor

@KrumTy KrumTy commented May 19, 2026

What

Adds a Cancel/Run confirmation popover that intercepts the Profiler Start button when the connected database is marked as production (useDatabaseMode().mode === 'production'). Non-production and disabled modes start directly, preserving the existing behavior.

The Start button is extracted into a new ProfilerStartButton component that owns the popover state and the database-mode lookup, keeping Monitor.tsx as a minimal swap.

Screenshot 2026-05-19 at 10 37 27

Testing

  • Unit: jest redisinsight/ui/src/components/monitor (Monitor + new ProfilerStartButton specs).
  • Manual smoke test with the devProdMode feature flag on:
    • Non-production database → clicking Start Profiler launches the profiler directly.
    • Database marked as production → clicking Start Profiler opens the Cancel/Run popover; Cancel closes without starting; Run starts the profiler.
    • Feature flag off → clicking Start Profiler launches the profiler directly.

Closes #RI-8188


Note

Medium Risk
Changes the Profiler start flow by adding a production-only confirmation popover; risk is limited to UI/UX but could inadvertently block or alter start behavior depending on useDatabaseMode detection.

Overview
Adds a production-safety gate to the Profiler start action: when useDatabaseMode().mode === 'production', clicking Start Profiler now opens a Cancel/Run confirmation popover before invoking the start handler.

Refactors the “not started” Profiler intro UI out of Monitor.tsx into a dedicated MonitorNotStarted component and introduces ProfilerStartButton to encapsulate the start/confirm logic, with new Jest unit tests covering both non-production and production flows.

Reviewed by Cursor Bugbot for commit 3eb459a. Bugbot is set up for automated code reviews on this repo. Configure here.

Extracts the Start Profiler button into a new ProfilerStartButton
component that reads the connection's mode via useDatabaseMode and,
when mode === 'production', intercepts the click with a Cancel/Run
confirmation popover before launching the Profiler. Non-production
modes start directly as before.

References: #RI-8188
@KrumTy KrumTy requested a review from a team as a code owner May 19, 2026 07:14
@KrumTy KrumTy added the AI-Made label May 19, 2026
@jit-ci
Copy link
Copy Markdown

jit-ci Bot commented May 19, 2026

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b2e9507. Configure here.

Comment thread redisinsight/ui/src/components/monitor/Monitor/Monitor.tsx Outdated
Renames the inline MonitorNotStarted component function to
renderMonitorNotStarted and invokes it instead of rendering it as a
child component. React was treating each re-render's component
function as a new type and unmounting the subtree, which reset the
isConfirmOpen state inside ProfilerStartButton and could close the
production confirmation popover mid-decision.

References: #RI-8188
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

Code Coverage - Frontend unit tests

St.
Category Percentage Covered / Total
🟢 Statements 82.85% 24663/29770
🟡 Branches 68.06% 10355/15214
🟡 Functions 78.03% 6666/8543
🟢 Lines 83.31% 24084/28910

Test suite run success

6968 tests passing in 803 suites.

Report generated by 🧪jest coverage report action from 3eb459a

The not-started screen was an inline function component defined inside
Monitor's render body, which gave it a new function identity on every
parent render. React treated each render's MonitorNotStarted as a new
component type and unmounted/remounted the subtree — which reset the
isConfirmOpen state inside ProfilerStartButton and could close the
production confirmation popover mid-decision.

Hoisting the component to module scope (in its own folder, matching the
sibling MonitorLog/MonitorHeader/MonitorOutputList pattern) gives it a
stable identity. saveLogValue, setSaveLogValue, and onStart are now
passed explicitly as props.

Replaces the renderMonitorNotStarted() workaround from 1117ccf.

References: #RI-8188
Copy link
Copy Markdown
Contributor

@ArtemHoruzhenko ArtemHoruzhenko left a comment

Choose a reason for hiding this comment

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

lgtm

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