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

1.18 ports10 #7285

Merged
merged 2 commits into from
Dec 5, 2024
Merged

1.18 ports10 #7285

merged 2 commits into from
Dec 5, 2024

Conversation

arkadius
Copy link
Member

@arkadius arkadius commented Dec 5, 2024

Describe your changes

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

    • Enhanced activity deployment status logic, now recognizing both "RUNNING" and "SCHEDULED" states.
    • Updated component props for better clarity and functionality.
  • Bug Fixes

    • Resolved clipboard and focus-related issues, improving user interaction.
  • Documentation

    • Changelog updated to reflect new features, improvements, and bug fixes across versions.

@github-actions github-actions bot added client client main fe docs ui labels Dec 5, 2024
Copy link

coderabbitai bot commented Dec 5, 2024

📝 Walkthrough

Walkthrough

The changes in this pull request primarily focus on the ActivitiesPanelRow component and its related components, specifically modifying how the active deployment status of an activity is determined. The boolean variable isRunning has been replaced with isDeploymentActive, which checks if the firstDeployedIndex matches the current index and if the scenarioState.status.name is included in a new array of statuses (scenarioStatusesToActiveDeploy) that consists of both "RUNNING" and "SCHEDULED". This adjustment broadens the conditions under which an activity is considered actively deployed.

The ActivityItem and ActivityItemHeader components have been updated accordingly to reflect this change in prop names and types. The getHeaderColors function in the activityItemColors.ts file has also been modified to use the new isDeploymentActive parameter instead of isRunning. Overall, the modifications maintain the existing functionality while refining the logic related to activity deployment status.

Possibly related PRs

Suggested labels

ui, docs, client

Suggested reviewers

  • Dzuming
  • JulianWielga

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: 2

🧹 Outside diff range and nitpick comments (2)
designer/client/src/components/toolbars/activities/helpers/activityItemColors.ts (1)

Line range hint 7-10: Consider updating variable names for consistency

The variable names still use "running" terminology while the logic has moved to "deployment active" concept. Consider renaming for better consistency:

  • runningActiveFoundHeaderBackgroundactiveDeploymentFoundHeaderBackground
  • runningHeaderBackgroundactiveDeploymentHeaderBackground
designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemHeader.tsx (1)

Line range hint 169-174: Add JSDoc documentation for the Props interface.

Consider adding JSDoc documentation to explain the purpose and expected values of the isDeploymentActive prop, especially since it represents a significant change in how deployment status is determined.

Example:

interface Props {
    activity: ItemActivity;
    /** Indicates whether the activity is actively deployed based on firstDeployedIndex and scenarioState status */
    isDeploymentActive: boolean;
    isActiveFound: boolean;
    isFound: boolean;
    searchQuery: string;
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 37580f8 and 281a5d2.

📒 Files selected for processing (5)
  • 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)
  • docs/Changelog.md (1 hunks)
🔇 Additional comments (6)
docs/Changelog.md (1)

55-55: LGTM: Changelog entry is clear and follows the standard format.

The entry properly documents a bug fix for deployment status indicators in periodic scenarios, with appropriate PR reference.

designer/client/src/components/toolbars/activities/helpers/activityItemColors.ts (1)

15-16: LGTM! Parameter rename is consistent with the new deployment status logic.

The parameter rename from isRunning to isDeploymentActive accurately reflects the expanded deployment status conditions.

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

31-31: LGTM! Prop updates are consistent and maintain type safety.

The prop rename from isRunning to isDeploymentActive is properly implemented in both the type definition and component usage.

Also applies to: 58-58

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

73-73: LGTM! Dependencies are properly updated.

The useMemo dependencies array correctly includes the renamed isDeploymentActive prop.


30-31: Document the implications of including "SCHEDULED" status

Please document why "SCHEDULED" status is now considered an active deployment and its implications on the UI/UX.

Let's verify the usage of these statuses:

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

40-47: LGTM! Improved prop naming for better clarity.

The rename from isRunning to isDeploymentActive better reflects the broader deployment status conditions. The type safety is maintained in the styled component definition.

Comment on lines +30 to +31
const scenarioStatusesToActiveDeploy = ["RUNNING", "SCHEDULED"];
const isDeploymentActive = firstDeployedIndex === index && scenarioStatusesToActiveDeploy.includes(scenarioState.status.name);
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Extract status constants to a shared location

Consider moving the status array to a constants file to avoid magic strings and enable reuse:

- const scenarioStatusesToActiveDeploy = ["RUNNING", "SCHEDULED"];
+ import { ACTIVE_DEPLOYMENT_STATUSES } from "../../../constants/scenarioStatuses";
+ // In constants file:
+ export const ACTIVE_DEPLOYMENT_STATUSES = ["RUNNING", "SCHEDULED"] as const;

Committable suggestion skipped: line range outside the PR's diff.

@@ -230,7 +230,7 @@ const WithOpenVersion = ({
);
};

const ActivityItemHeader = ({ activity, isRunning, isFound, isActiveFound, searchQuery }: Props) => {
const ActivityItemHeader = ({ activity, isDeploymentActive, isFound, isActiveFound, searchQuery }: Props) => {
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Based on the search results, I can see that there are no existing test files for the ActivityItemHeader component and its deployment status logic. The code shows that isDeploymentActive is a critical prop that affects the header's styling and behavior through getHeaderColors. Given this finding, I'll generate the final response:

Add tests for ActivityItemHeader's deployment status logic

Please create a new test file ActivityItemHeader.test.tsx to cover:

  1. Visual verification of header styling based on isDeploymentActive prop:
    • When deployment is active and found (isDeploymentActive={true}, isActiveFound={true})
    • When deployment is active but not found (isDeploymentActive={true}, isActiveFound={false})
    • When deployment is inactive (isDeploymentActive={false})
  2. Test header color changes using the getHeaderColors helper
  3. Verify header content rendering with different activity types during deployment
🔗 Analysis chain

Add tests for the new deployment status logic.

Since this change modifies how deployment status is determined, please ensure there are tests covering:

  1. Different combinations of firstDeployedIndex and scenarioState.status.name
  2. Edge cases where deployment status changes
  3. Visual verification of the header styling based on isDeploymentActive

This aligns with the PR objective requiring automated test coverage for changes.

Let's check for existing test coverage:

Also applies to: 282-282


Let me search for existing test files specifically related to ActivityItemHeader and deployment status.


Let me search for any existing test files in the activities directory to see if there's test coverage for related components.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for test files related to ActivityItemHeader
fd -e test.tsx -e spec.tsx ActivityItemHeader

# Search for existing test cases related to deployment status
rg -i "test|describe|it.*deployment.*active|running" --type ts

Length of output: 67564


Script:

#!/bin/bash
# Search for test files related to ActivityItemHeader and deployment status
fd -e test.tsx -e spec.tsx ActivityItemHeader

# Search for test cases related to deployment status in ActivityItemHeader
rg -A 5 "isDeploymentActive|deployment.*status" --type ts designer/client/src/components/toolbars/activities

Length of output: 9826


Script:

#!/bin/bash
# Search for test files in the activities directory
fd -e test.tsx -e spec.tsx . designer/client/src/components/toolbars/activities/

# Check for any test coverage of deployment status in existing test files
rg -A 5 "test.*deployment|describe.*deployment" designer/client/test

Length of output: 153

@arkadius arkadius merged commit 5b2a777 into staging Dec 5, 2024
13 checks passed
@arkadius arkadius deleted the 1.18-ports10 branch December 5, 2024 13:23
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