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

[NU-1901] fix deployment status indicator for periodic scenarios #7283

Conversation

Dzuming
Copy link
Contributor

@Dzuming Dzuming commented Dec 4, 2024

Describe your changes

  • Fix active indicator for Deployment status for periodic scenario type

Before:
image

After:
image

Checklist before merge

  • Related issue ID is placed at the beginning of PR title in [brackets] (can be GH issue or Nu Jira issue)
  • Code is cleaned from temporary changes and commented out lines
  • Parts of the code that are not easy to understand are documented in the code
  • Changes are covered by automated tests
  • Showcase in dev-application.conf added to demonstrate the feature
  • Documentation added or updated
  • Added entry in Changelog.md describing the change from the perspective of a public distribution user
  • Added MigrationGuide.md entry in the appropriate subcategory if introducing a breaking change
  • Verify that PR will be squashed during merge

Summary by CodeRabbit

  • New Features

    • Expanded the logic for determining the activity's running state to include both "RUNNING" and "SCHEDULED" statuses, providing users with a more accurate representation of ongoing activities.
    • Introduced a new Activities panel that consolidates scenario activities into a chronological list for enhanced user navigation.
    • Added scenario labels for better organization of scenarios.
    • Enhanced SpEL with new methods for data type casting and utility functions.
    • Introduced new aggregation functions for improved data analysis.
  • Bug Fixes

    • Resolved issues related to clipboard functionality and focus handling in the expression editor.
    • Fixed race conditions during SpEL evaluations and savepoint deserialization problems.
    • Corrected the deployment status indicator for periodic scenarios.

@Dzuming Dzuming changed the base branch from staging to release/1.18 December 4, 2024 08:08
@github-actions github-actions bot added client client main fe ui labels Dec 4, 2024
@Dzuming Dzuming changed the title [NU-1901] fix deploy status activity for periodic scenarios [NU-1901] fix deployment status indicator for periodic scenarios Dec 4, 2024
Copy link

coderabbitai bot commented Dec 4, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes in the ActivitiesPanelRow component involve an update to the logic that determines the isRunning state. Previously, the isRunning variable was set to true only when the firstDeployedIndex matched the current index and the scenarioState.status.name was "RUNNING". The modification introduces an array called scenarioStatusesToActiveDeploy, which now includes both "RUNNING" and "SCHEDULED" statuses. As a result, the isDeploymentActive variable will be true if the scenarioState.status.name is found within this array, thereby expanding the conditions under which an activity is considered to be active.

Despite this change in logic, the overall structure and flow of the ActivitiesPanelRow component remain intact. The component continues to utilize hooks such as useMemo and useEffect to optimize performance and manage side effects, ensuring that the rendering logic and lifecycle management are preserved.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ActivitiesPanelRow
    participant ScenarioState

    User->>ActivitiesPanelRow: Interact with activity
    ActivitiesPanelRow->>ScenarioState: Check status
    ScenarioState-->>ActivitiesPanelRow: Return status (RUNNING/SCHEDULED)
    ActivitiesPanelRow->>ActivitiesPanelRow: Update isDeploymentActive based on status
    ActivitiesPanelRow-->>User: Render updated state
Loading

Possibly related PRs

Suggested reviewers

  • arkadius

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 80ed9e1 and 6d3756a.

📒 Files selected for processing (4)
  • designer/client/src/components/toolbars/activities/ActivitiesPanelRow.tsx (3 hunks)
  • designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItem.tsx (2 hunks)
  • designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemHeader.tsx (4 hunks)
  • designer/client/src/components/toolbars/activities/helpers/activityItemColors.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • designer/client/src/components/toolbars/activities/ActivitiesPanelRow.tsx
🔇 Additional comments (4)
designer/client/src/components/toolbars/activities/helpers/activityItemColors.ts (1)

15-16: LGTM! Semantic improvement in parameter naming

The rename from isRunning to isDeploymentActive better reflects the parameter's purpose in determining deployment status, improving code clarity.

designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItem.tsx (1)

31-31: LGTM! Consistent prop updates

The prop rename from isRunning to isDeploymentActive is consistently applied in both the interface and component usage, maintaining type safety and proper prop propagation.

Also applies to: 58-58

designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemHeader.tsx (2)

40-46: LGTM! Consistent styled component updates

The styled component properly reflects the prop rename while maintaining the same styling logic and header color calculations.


170-170: LGTM! Consistent prop handling throughout component

The prop rename is consistently applied across:

  • Props interface
  • Component parameters
  • Styled component usage

Also applies to: 233-233, 282-282


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@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: 0

🧹 Outside diff range and nitpick comments (1)
designer/client/src/components/toolbars/activities/ActivitiesPanelRow.tsx (1)

30-31: Consider optimizing the status array definition and type safety.

The implementation correctly addresses the periodic scenarios by including both "RUNNING" and "SCHEDULED" statuses. However, there are a few potential improvements:

  1. Move the array outside the component to prevent recreation on each render:
+const SCENARIO_ACTIVE_DEPLOY_STATUSES = ["RUNNING", "SCHEDULED"] as const;

export const ActivitiesPanelRow = memo(({ index, style, setRowHeight, handleShowRows, handleHideRows, activities, searchQuery }: Props) => {
-  const scenarioStatusesToActiveDeploy = ["RUNNING", "SCHEDULED"];
   const isRunning = firstDeployedIndex === index && 
-    scenarioStatusesToActiveDeploy.includes(scenarioState.status.name);
+    SCENARIO_ACTIVE_DEPLOY_STATUSES.includes(scenarioState.status.name);
  1. Consider using an enum or type for better type safety:
export enum ScenarioStatus {
  RUNNING = "RUNNING",
  SCHEDULED = "SCHEDULED",
}

const SCENARIO_ACTIVE_DEPLOY_STATUSES = [
  ScenarioStatus.RUNNING,
  ScenarioStatus.SCHEDULED,
] as const;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9db6f47 and ec4beef.

📒 Files selected for processing (1)
  • designer/client/src/components/toolbars/activities/ActivitiesPanelRow.tsx (1 hunks)
🔇 Additional comments (1)
designer/client/src/components/toolbars/activities/ActivitiesPanelRow.tsx (1)

30-31: LGTM! Clean and focused implementation.

The changes effectively solve the periodic scenarios issue while maintaining the component's structure and performance optimizations. The implementation is well-isolated and doesn't introduce any breaking changes.

@github-actions github-actions bot added the docs label Dec 4, 2024
…-activity-for-periodic-scenarios

# Conflicts:
#	docs/Changelog.md
@Dzuming Dzuming merged commit b580599 into release/1.18 Dec 4, 2024
13 checks passed
@Dzuming Dzuming deleted the NU-1901-fix-deploy-status-activity-for-periodic-scenarios branch December 4, 2024 10:14
@coderabbitai coderabbitai bot mentioned this pull request Dec 5, 2024
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client client main fe docs ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants