Skip to content
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

only load critical alerts modal once devops store is set #5034

Merged
merged 2 commits into from
Jan 9, 2025

Conversation

alpetric
Copy link
Contributor

@alpetric alpetric commented Jan 9, 2025

Modal was loading in too early before $devopsRole was set.

The initial load of the modal would show the user to not have devops but workspace admin role and hence display unacknowledged critical alerts for that workspace. Since the badge is updated every 30s or when changing context (to workspace), it would refresh the badge.

Fix: we're only loading the modal once $devopsRole !== undefined


Important

Ensure critical alerts modal in +layout.svelte loads only when $devopsRole is defined.

  • Behavior:
    • In +layout.svelte, the critical alerts modal now loads only when $devopsRole is defined and either $devopsRole is true or $userStore.is_admin is true.
    • Prevents modal from loading prematurely and showing incorrect roles.

This description was created by Ellipsis for 7837519. It will automatically update as commits are pushed.

@alpetric alpetric requested a review from rubenfiszel as a code owner January 9, 2025 01:07
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Reviewed everything up to ec11c00 in 31 seconds

More details
  • Looked at 14 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_UU6EBPR8UbXED4tZ


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@@ -289,7 +289,8 @@
setContext('openSearchWithPrefilledText', openSearchModal)

$: {
if ($enterpriseLicense && $workspaceStore && $userStore && ($devopsRole || $userStore.is_admin)) {
if ($enterpriseLicense && $workspaceStore && $userStore && $devopsRole !== undefined && ($devopsRole || $userStore.is_admin)) {
console.log('mountModal', $devopsRole, $userStore.is_admin)
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the console.log statement to keep the production code clean.

Suggested change
console.log('mountModal', $devopsRole, $userStore.is_admin)
// console.log('mountModal', $devopsRole, $userStore.is_admin)

Copy link

cloudflare-workers-and-pages bot commented Jan 9, 2025

Deploying windmill with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7837519
Status: ✅  Deploy successful!
Preview URL: https://1e192e27.windmill.pages.dev
Branch Preview URL: https://alp-critical-alert-fix.windmill.pages.dev

View logs

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 7837519 in 9 seconds

More details
  • Looked at 12 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. frontend/src/routes/(root)/(logged)/+layout.svelte:292
  • Draft comment:
    Removing the console.log statement is a good practice for production code as it avoids unnecessary logging.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The PR removes a console.log statement which is not necessary for production code. This is a good practice as it cleans up the code and avoids unnecessary logging.

Workflow ID: wflow_xQkh5uYvjGhf3IBp


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@rubenfiszel rubenfiszel merged commit 6711a81 into main Jan 9, 2025
3 checks passed
@rubenfiszel rubenfiszel deleted the alp/critical_alert_fix branch January 9, 2025 05:43
@github-actions github-actions bot locked and limited conversation to collaborators Jan 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants