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

Dast Automation(P1) - Final PR Changes #1417

Merged

Conversation

SmitGala
Copy link
Contributor

@SmitGala SmitGala commented Jul 3, 2024

No description provided.

Copy link

coderabbitai bot commented Jul 3, 2024

Important

Review skipped

More than 25% of the files skipped due to max files limit. The review is being skipped to prevent a low-quality review.

65 files out of 148 files are above the max files limit of 75. Please upgrade to Pro plan to get higher limits.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes involve a significant refactor of the dynamic scan component, transitioning from a modal interface to a drawer interface. This includes updates to the layout, renaming of components and classes, and adjustments to styles for improved visual presentation. The modifications also encompass routing changes and enhancements to the dynamic scan functionality, ensuring a more intuitive user experience across the application.

Changes

File Path Change Summary
app/components/dynamic-scan/drawer/index.hbs Refactored modal to drawer component, updated header and body structure, and adjusted button placements.
app/components/dynamic-scan/drawer/index.scss Removed .dynamic-scan-modal-body, renamed .dynamic-scan-modal-alert to .dynamic-scan-drawer-alert, and added .dynamic-scan-modal-cta for styling.
app/components/dynamic-scan/drawer/index.ts Renamed DynamicScanModalSignature to DynamicScanDrawerSignature and updated component class names accordingly.
app/components/dynamic-scan/expiry/index.hbs Removed the dynamic scan expiry component's UI, including countdown timer and interactive elements.
app/components/dynamic-scan/index.hbs Updated to render <DynamicScan::Drawer> instead of <DynamicScan::Modal>.
app/components/file-details/dynamic-scan/action/index.hbs Adjusted rendering logic for dynamic scan buttons based on file status and introduced a new component conditionally.
app/components/file-details/dynamic-scan/manual/index.ts Transitioned from dynamicScan to file property for status checks, updating computed properties accordingly.
app/models/file.ts Added a new getter method isReadyOrRunning to check dynamic status.
app/router.ts Removed the 'automated' sub-route from the dynamic-scan route, simplifying the routing structure.
app/styles/_component-variables.scss Removed outdated CSS variables and reorganized remaining variables for clarity.
app/styles/_icons.scss Introduced a new icon class .ak-icon-stop-circle.
tests/acceptance/file-details/dynamic-scan-test.js Added tests for the manual dynamic scan page, verifying UI elements and expiry functionality.
tests/integration/components/dynamic-scan-test.js Removed integration tests for the dynamic scan component.

Possibly related PRs

  • dynamic scan e2e fix & snapshot update #1456: The changes in this PR involve modifications to the DynamicScanActions class and enhancements to test assertions related to dynamic scanning, which are directly relevant to the refactoring of the dynamic scan component in the main PR.

Suggested reviewers

  • future-pirate-king
  • avzz-19

Poem

In lines of code, we find our way,
Enhancing routes, come what may.
With drawers opened wide and bright,
The UI shines, a pure delight.
Code Rabbit hops with joy and cheer,
For better views are truly here!
🐰✨


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 (2)
app/components/project-settings/general-settings/dynamicscan-automation-settings/index.hbs (1)

28-72: Improve the indentation for better readability.

The conditional rendering logic is correct, but the indentation can be improved for better readability.

  {{#if @featureAvailable}}
    <ProjectSettings::GeneralSettings::DynamicscanAutomationSettings::Scenario
      @project={{@project}}
      @profileId={{@profileId}}
    />

    <AkStack @width='full' @direction='column'>
      <AkStack @width='full' @direction='column'>
        <AkStack
          @width='full'
          class='p-1 my-1 mb-2'
          local-class='schedule-automation-toggle'
        >
          <AkFormControlLabel
            @label='{{t "appiumScheduledAutomation"}}'
            @labelTypographyFontWeight='medium'
            @disabled={{this.toggleDynamicscanMode.isRunning}}
            data-test-genSettings-dynScanAutoSettings-dynamicscanModeToggleLabel
            as |fcl|
          >
            <AkToggle
              @size='small'
              @disabled={{fcl.disabled}}
              @checked={{this.automationEnabled}}
              @onClick={{perform this.toggleDynamicscanMode}}
              data-test-genSettings-dynScanAutoSettings-dynamicscanModeToggle
            />
          </AkFormControlLabel>
        </AkStack>

        <AkStack
          @direction='column'
          {{style maxWidth='700px'}}
          data-test-genSettings-dynScanAutoSettings-headerInfoDescNote
        >
          <AkTypography @variant='body3' {{style lineHeight='1.5'}}>
            {{t 'dynScanAutoSchedNote'}}
          </AkTypography>
        </AkStack>
      </AkStack>
    </AkStack>
  {{else}}
    <ProjectSettings::GeneralSettings::DynamicscanAutomationSettings::UpsellingFeature
    />
  {{/if}}
app/components/project-settings/general-settings/index.hbs (1)

91-102: Improve the indentation for better readability.

The conditional rendering logic is correct, but the indentation can be improved for better readability.

  <AkStack @width='9/12' class='px-3'>
    {{!-- <ProjectSettings::GeneralSettings::DynamicscanAutomationSettings::ScriptsArchived
        @project={{@project}}
        @profileId={{@profileId}}
      /> --}}

    <ProjectSettings::GeneralSettings::DynamicscanAutomationSettings
      @profileId={{this.project.activeProfileId}}
      @project={{this.project}}
      @featureAvailable={{this.dynamicscanAutomationAvailable}}
    />
  </AkStack>
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9fcb5af and 1f384e9.

Files selected for processing (14)
  • app/components/file-details/index.hbs (1 hunks)
  • app/components/file-details/scan-actions/api-scan/index.hbs (1 hunks)
  • app/components/file-details/scan-actions/dynamic-scan/index.hbs (1 hunks)
  • app/components/file-details/scan-actions/manual-scan/index.hbs (1 hunks)
  • app/components/file-details/scan-actions/static-scan/index.hbs (1 hunks)
  • app/components/file-details/severity-level/index.hbs (1 hunks)
  • app/components/project-settings/general-settings/dynamicscan-automation-settings/index.hbs (1 hunks)
  • app/components/project-settings/general-settings/dynamicscan-automation-settings/index.ts (1 hunks)
  • app/components/project-settings/general-settings/index.hbs (1 hunks)
  • app/components/project-settings/general-settings/index.ts (1 hunks)
  • app/router.ts (1 hunks)
  • app/styles/_component-variables.scss (2 hunks)
  • app/templates/authenticated/dashboard/file/index.hbs (1 hunks)
  • tests/acceptance/file-details-test.js (2 hunks)
Files skipped from review due to trivial changes (3)
  • app/components/file-details/severity-level/index.hbs
  • app/templates/authenticated/dashboard/file/index.hbs
  • tests/acceptance/file-details-test.js
Additional comments not posted (16)
app/components/file-details/index.hbs (1)

1-26: Ensure correct integration of new components.

The changes integrate FileDetails::Summary, FileDetails::ScanActions, and FileDetails::InsightsWrapper components. Verify that these components are correctly defined and imported, and that any removed components do not affect the page's functionality.

app/components/file-details/scan-actions/dynamic-scan/index.hbs (1)

27-31: Verify the new route and model binding.

The new route authenticated.dashboard.file.dynamic-scan.manual and model binding @file.id need to be verified to ensure they are correctly defined and used.

app/components/file-details/scan-actions/manual-scan/index.hbs (1)

37-41: Verify the new route and model binding.

The new route authenticated.dashboard.file.manual-scan and model binding @file.id need to be verified to ensure they are correctly defined and used.

app/components/file-details/scan-actions/static-scan/index.hbs (1)

43-47: Verify the new route and model binding.

The new route authenticated.dashboard.file.static-scan and model binding @file.id need to be verified to ensure they are correctly defined and used.

Verification successful

The new route and model binding are correctly defined and used.

The route authenticated.dashboard.file.static-scan is defined in app/components/file-details/static-scan/index.ts, and the model binding @file.id is used consistently across multiple files, including the one under review.

  • app/components/file-details/static-scan/index.ts
  • app/components/file-details/scan-actions/static-scan/index.hbs
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the new route and model binding.

# Test: Search for the definition of the new route. Expect: Definition for `authenticated.dashboard.file.static-scan`.
rg --type js --files-with-matches 'authenticated.dashboard.file.static-scan'

Length of output: 76



Script:

#!/bin/bash
# Description: Verify the new route and model binding.

# Test 1: Search for the definition of the new route in all file types.
rg 'authenticated.dashboard.file.static-scan'

# Test 2: Search for the usage of the model binding `@file.id`.
rg '@file.id'

Length of output: 1325

app/components/file-details/scan-actions/api-scan/index.hbs (1)

51-55: Verify the new route and model binding.

The new route authenticated.dashboard.file.api-scan and model binding @file.id need to be verified to ensure they are correctly defined and used.

app/components/project-settings/general-settings/index.ts (2)

39-44: LGTM!

The dynamicscanAutomationAvailable getter method is implemented correctly.


Line range hint 45-57: LGTM!

The fetchProfile task is implemented correctly.

app/components/project-settings/general-settings/dynamicscan-automation-settings/index.ts (2)

17-17: LGTM!

The interface update to include the featureAvailable property is correct.


Line range hint 70-106: LGTM!

The toggleDynamicscanMode task is implemented correctly.

app/components/project-settings/general-settings/index.hbs (1)

Line range hint 58-62: LGTM!

The conditional rendering logic for the AddProjectTeam component is correct.

app/router.ts (4)

155-158: LGTM!

The addition of the api-scan route is correct.


160-163: LGTM!

The addition of the manual-scan route is correct.


165-169: LGTM!

The addition of the dynamic-scan route is correct.


170-170: LGTM!

The addition of the static-scan route is correct.

app/styles/_component-variables.scss (2)

792-794: LGTM!

The changes to the border color and background color variables for the file-details-vulnerability-analysis-header component are consistent with the rest of the file.


800-802: LGTM!

The changes to the border color and background color variables for the file-details-vulnerability-analysis-table component are consistent with the rest of the file.

Copy link

cloudflare-workers-and-pages bot commented Jul 3, 2024

Deploying irenestaging with  Cloudflare Pages  Cloudflare Pages

Latest commit: a4a4b13
Status: ✅  Deploy successful!
Preview URL: https://3f1a1013.irenestaging.pages.dev
Branch Preview URL: https://pd-1375-dast-automation-p1.irenestaging.pages.dev

View logs

Copy link

cypress bot commented Jul 3, 2024

5 failed tests on run #364 ↗︎

5 4 0 1 Flakiness 0

Details:

Merge 1f384e9 into 9fcb5af...
Project: Irene Commit: 62ac980e93 ℹ️
Status: Failed Duration: 12:16 💡
Started: Jul 3, 2024 9:05 AM Ended: Jul 3, 2024 9:17 AM
Failed  dynamic-scan.spec.ts • 1 failed test

View Output

Test Artifacts
Dynamic Scan > it tests dynamic scan for an apk file: 58062 Test Replay Screenshots
Failed  upload-app.spec.ts • 4 failed tests

View Output

Test Artifacts
Upload App > It successfully uploads an apk file Test Replay Screenshots
Upload App > It successfully uploads an aab file Test Replay Screenshots
Upload App > It successfully uploads an ipa file Test Replay Screenshots
Upload App > It successfully uploads an apk file (via link) Test Replay Screenshots

Review all test suite changes for PR #1417 ↗︎

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1f384e9 and e95d131.

Files selected for processing (18)
  • app/components/file-details/index.hbs (1 hunks)
  • app/components/file-details/scan-actions/api-scan/index.hbs (1 hunks)
  • app/components/file-details/scan-actions/dynamic-scan/index.hbs (1 hunks)
  • app/components/file-details/scan-actions/index.scss (1 hunks)
  • app/components/file-details/scan-actions/manual-scan/index.hbs (1 hunks)
  • app/components/file-details/scan-actions/static-scan/index.hbs (1 hunks)
  • app/components/file-details/severity-level/index.hbs (1 hunks)
  • app/components/file-details/skeleton-loader/index.hbs (3 hunks)
  • app/components/file-details/skeleton-loader/index.scss (1 hunks)
  • app/components/project-settings/general-settings/dynamicscan-automation-settings/index.hbs (1 hunks)
  • app/components/project-settings/general-settings/dynamicscan-automation-settings/index.ts (1 hunks)
  • app/components/project-settings/general-settings/index.hbs (1 hunks)
  • app/components/project-settings/general-settings/index.ts (1 hunks)
  • app/router.ts (1 hunks)
  • app/styles/_component-variables.scss (3 hunks)
  • app/templates/authenticated/dashboard/file/index-loading.hbs (1 hunks)
  • app/templates/authenticated/dashboard/file/index.hbs (1 hunks)
  • tests/acceptance/file-details-test.js (1 hunks)
Files skipped from review due to trivial changes (7)
  • app/components/file-details/scan-actions/api-scan/index.hbs
  • app/components/file-details/scan-actions/dynamic-scan/index.hbs
  • app/components/file-details/scan-actions/static-scan/index.hbs
  • app/components/file-details/severity-level/index.hbs
  • app/components/file-details/skeleton-loader/index.scss
  • app/templates/authenticated/dashboard/file/index-loading.hbs
  • app/templates/authenticated/dashboard/file/index.hbs
Additional comments not posted (17)
app/components/file-details/scan-actions/index.scss (1)

4-6: Ensure responsive design considerations.

The addition of min-width, max-width, and flex properties seems to enhance the layout behavior. Ensure that these changes are tested across different screen sizes to confirm that they achieve the desired responsive design.

app/components/file-details/index.hbs (1)

1-26: LGTM! Ensure all component changes are reflected in the codebase.

The restructuring and renaming of components improve readability and maintainability. Ensure that all references to the old component names are updated in the codebase.

Verification successful

All references to old component names have been successfully updated.

No occurrences of the old component names were found in the codebase, indicating that the updates have been thoroughly applied.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all references to old component names are updated.
# Test: Search for old component names in the codebase.
# Expected: No references to old component names.

# Search for old component names in the codebase
rg --type hbs $'FileDetails::SummaryOld'
rg --type hbs $'FileDetails::ScanActionsOld'

Length of output: 83


Script:

#!/bin/bash
# Description: Verify all references to old component names are updated.
# Test: Search for additional old component names in the codebase.
# Expected: No references to old component names.

# Search for additional old component names in the codebase
rg --type hbs $'FileDetails::InsightsWrapperOld'
rg --type hbs $'FileDetails::VulnerabilityAnalysisOld'

Length of output: 101


Script:

#!/bin/bash
# Description: Verify all references to old component names are updated.
# Test: Search for any other potential old component names in the codebase.
# Expected: No references to old component names.

# Search for any other potential old component names in the codebase
rg --type hbs $'FileDetails::OldComponent'
rg --type hbs $'FileDetails::DeprecatedComponent'

Length of output: 90

app/components/file-details/scan-actions/manual-scan/index.hbs (1)

37-41: LGTM! Ensure navigation works correctly.

The addition of @route and @model attributes enhances navigation. Ensure that the navigation works correctly and the data-test attributes improve testability.

Verification successful

LGTM! Ensure navigation works correctly.

The presence of the @route, @model, and data-test attributes in the manual-scan component has been verified. Ensure that the navigation works correctly and the data-test attributes improve testability.

  • Verified attributes in app/components/file-details/scan-actions/manual-scan/index.hbs:
    • @route='authenticated.dashboard.file.manual-scan'
    • @model={{@file.id}}
    • data-test-fileDetailScanActions-manualScanViewDetails
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify navigation and testability for manual scan component.
# Test: Check navigation and data-test attributes.
# Expected: Navigation works correctly and data-test attributes are present.

# Use a headless browser to test navigation and testability
npx playwright test --grep @manual-scan-navigation

Length of output: 123


Script:

#!/bin/bash
# Verify the presence of @route, @model, and data-test attributes in the manual scan component template

# Search for @route attribute
echo "Checking for @route attribute:"
rg "@route='authenticated.dashboard.file.manual-scan'" app/components/file-details/scan-actions/manual-scan/index.hbs

# Search for @model attribute
echo "Checking for @model attribute:"
rg "@model={{@file.id}}" app/components/file-details/scan-actions/manual-scan/index.hbs

# Search for data-test attribute
echo "Checking for data-test attribute:"
rg "data-test-fileDetailScanActions-manualScanViewDetails" app/components/file-details/scan-actions/manual-scan/index.hbs

Length of output: 774


Script:

#!/bin/bash
# Verify the presence of @model attribute in the manual scan component template

# Search for @model attribute with escaped curly braces
echo "Checking for @model attribute:"
rg "@model=\{\{@file.id\}\}" app/components/file-details/scan-actions/manual-scan/index.hbs

Length of output: 186

app/components/project-settings/general-settings/index.ts (1)

39-44: LGTM! Ensure feature availability logic is correct.

The dynamicscanAutomationAvailable getter checks for the dynamicscan_automation feature. Ensure that the feature flag logic is correct and tested.

app/components/project-settings/general-settings/dynamicscan-automation-settings/index.hbs (2)

35-66: Ensure Proper Error Handling for toggleDynamicscanMode.

The AkToggle component uses perform this.toggleDynamicscanMode. Ensure proper error handling and user feedback in case of errors.

Verification successful

Proper Error Handling for toggleDynamicscanMode Confirmed

The toggleDynamicscanMode method includes proper error handling and provides user feedback in case of errors.

  • app/components/project-settings/general-settings/dynamicscan-automation-settings/index.ts
  • app/components/project-settings/general-settings/dynamicscan-automation-settings/scripts-archived/index.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify proper error handling for `toggleDynamicscanMode`.

# Test: Search for the definition of `toggleDynamicscanMode` in the codebase. Expect: Proper error handling and user feedback.
rg --type ts $'toggleDynamicscanMode'

Length of output: 323


Script:

#!/bin/bash
# Extract the implementation of `toggleDynamicscanMode` from both relevant files to check for error handling and user feedback mechanisms.

# Extract from index.ts
rg --type ts --context 20 'toggleDynamicscanMode = task' app/components/project-settings/general-settings/dynamicscan-automation-settings/index.ts

# Extract from scripts-archived/index.ts
rg --type ts --context 20 'toggleDynamicscanMode = task' app/components/project-settings/general-settings/dynamicscan-automation-settings/scripts-archived/index.ts

Length of output: 2641


28-32: Conditional Rendering: Ensure @featureAvailable is correctly passed.

The conditional rendering based on @featureAvailable is a good approach. Ensure that this attribute is correctly passed and set in the parent component or context.

Verification successful

Conditional Rendering: @featureAvailable is correctly passed and set.

The dynamicscanAutomationAvailable getter method accurately checks the dynamicscan_automation feature flag in the organization object, ensuring that @featureAvailable is correctly set.

  • app/components/project-settings/general-settings/index.ts: get dynamicscanAutomationAvailable() { ... }
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that `@featureAvailable` is correctly passed and set in the parent component or context.

# Test: Search for the usage of `@featureAvailable`. Expect: Correct passing and setting of the attribute.
rg --type hbs $'@featureAvailable'

Length of output: 275


Script:

#!/bin/bash
# Description: Verify that `dynamicscanAutomationAvailable` is correctly defined and set in the parent component.

# Find the JavaScript file corresponding to the parent component.
parent_component_js=$(fd index.js -p app/components/project-settings/general-settings/)

# Search for the definition and setting of `dynamicscanAutomationAvailable` in the parent component's JavaScript file.
rg 'dynamicscanAutomationAvailable' $parent_component_js

Length of output: 348


Script:

#!/bin/bash
# Description: Extract the implementation of the `dynamicscanAutomationAvailable` getter method from the TypeScript file.

# Search for the implementation of the `dynamicscanAutomationAvailable` getter method in the TypeScript file.
ast-grep --lang typescript --pattern 'get dynamicscanAutomationAvailable() { $$$ }'

Length of output: 552


Script:

#!/bin/bash
# Description: Extract the implementation of the `dynamicscanAutomationAvailable` getter method from the TypeScript file.

# Search for the implementation of the `dynamicscanAutomationAvailable` getter method in the TypeScript file.
ast-grep --lang typescript --pattern 'class $_ { get dynamicscanAutomationAvailable() { $$$ } }'

Length of output: 98


Script:

#!/bin/bash
# Description: Extract the implementation of the `dynamicscanAutomationAvailable` getter method from the TypeScript file.

# Search for the implementation of the `dynamicscanAutomationAvailable` getter method in the TypeScript file.
rg 'get dynamicscanAutomationAvailable' app/components/project-settings/general-settings/index.ts -A 10

Length of output: 372

app/components/project-settings/general-settings/index.hbs (1)

97-101: Ensure Correct Integration of DynamicscanAutomationSettings.

The DynamicscanAutomationSettings component is added with the @featureAvailable parameter. Ensure it is correctly integrated and the parameter is properly passed.

Verification successful

Integration of DynamicscanAutomationSettings Verified

The DynamicscanAutomationSettings component is correctly integrated, and the @featureAvailable parameter is properly passed.

  • The dynamicscanAutomationAvailable getter method correctly checks the organization's features to determine the value of @featureAvailable.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the integration of `DynamicscanAutomationSettings` and the passing of the `@featureAvailable` parameter.

# Test: Search for the usage of `DynamicscanAutomationSettings` in the codebase. Expect: Correct integration and parameter passing.
rg --type hbs $'DynamicscanAutomationSettings'

Length of output: 852


Script:

#!/bin/bash
# Description: Check the definition and usage of `dynamicscanAutomationAvailable` in the context of `DynamicscanAutomationSettings`.

# Search for the definition of `dynamicscanAutomationAvailable` in the relevant files
rg --type hbs '@dynamicscanAutomationAvailable' app/components/project-settings/general-settings/index.hbs

# Search for the usage of `dynamicscanAutomationAvailable` in the relevant JavaScript files
rg 'dynamicscanAutomationAvailable' app/components/project-settings/general-settings/

Length of output: 414


Script:

#!/bin/bash
# Description: Extract the implementation of the `dynamicscanAutomationAvailable` getter method to verify its correctness.

# Extract the getter method implementation from the TypeScript file
ast-grep --lang typescript --pattern 'get dynamicscanAutomationAvailable() { $$$ }' app/components/project-settings/general-settings/index.ts

Length of output: 610


Script:

#!/bin/bash
# Description: Extract the implementation of the `dynamicscanAutomationAvailable` getter method to verify its correctness.

# Extract the getter method implementation from the TypeScript file with a refined pattern
ast-grep --lang typescript --pattern 'get dynamicscanAutomationAvailable() { $_$ }' app/components/project-settings/general-settings/index.ts

Length of output: 610


Script:

#!/bin/bash
# Description: Extract the implementation of the `dynamicscanAutomationAvailable` getter method to verify its correctness.

# Extract the getter method implementation from the TypeScript file using rg
rg 'get dynamicscanAutomationAvailable' -A 10 app/components/project-settings/general-settings/index.ts

Length of output: 372

app/router.ts (1)

155-170: Ensure Proper Navigation and Error Handling for New Routes.

The new routes for api-scan, manual-scan, and dynamic-scan are added under the file route. Ensure proper navigation and error handling for these routes.

app/components/file-details/skeleton-loader/index.hbs (3)

1-4: Ensure correct usage of AkStack and AkSkeleton components.

The added AkStack and AkSkeleton components seem to be correctly used with appropriate attributes for layout and styling. Ensure that these components are compatible with the existing structure and styling.


38-94: Verify the layout and styling of scan actions status cards.

The added AkStack and AkSkeleton components within the scan actions status cards appear to be correctly used. Ensure that the layout and styling are consistent with the design guidelines.


118-118: Verify the spacing attribute in AkStack component.

The @spacing='5' attribute in the AkStack component should be verified to ensure it aligns with the design specifications.

tests/acceptance/file-details-test.js (4)

247-256: Ensure the test case for static scan navigation is correct.

The test case for navigating to the static scan page appears to be correctly implemented. Verify that the data-test attributes used in the selectors are correct and that the test covers the intended functionality.


258-267: Ensure the test case for dynamic scan navigation is correct.

The test case for navigating to the dynamic scan page appears to be correctly implemented. Verify that the data-test attributes used in the selectors are correct and that the test covers the intended functionality.


269-278: Ensure the test case for API scan navigation is correct.

The test case for navigating to the API scan page appears to be correctly implemented. Verify that the data-test attributes used in the selectors are correct and that the test covers the intended functionality.


280-289: Ensure the test case for manual scan navigation is correct.

The test case for navigating to the manual scan page appears to be correctly implemented. Verify that the data-test attributes used in the selectors are correct and that the test covers the intended functionality.

app/styles/_component-variables.scss (2)

783-784: Ensure the new variables for vulnerability analysis header are correct.

The new variables for file-details-vulnerability-analysis-header appear to be correctly defined. Verify that the variable names follow the naming conventions and that the values are appropriate.


792-794: Ensure the new variables for vulnerability analysis table are correct.

The new variables for file-details-vulnerability-analysis-table appear to be correctly defined. Verify that the variable names follow the naming conventions and that the values are appropriate.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e95d131 and 3fc7275.

Files selected for processing (18)
  • app/components/file-details/index.hbs (1 hunks)
  • app/components/file-details/scan-actions/api-scan/index.hbs (1 hunks)
  • app/components/file-details/scan-actions/dynamic-scan/index.hbs (1 hunks)
  • app/components/file-details/scan-actions/index.scss (1 hunks)
  • app/components/file-details/scan-actions/manual-scan/index.hbs (1 hunks)
  • app/components/file-details/scan-actions/static-scan/index.hbs (1 hunks)
  • app/components/file-details/severity-level/index.hbs (1 hunks)
  • app/components/file-details/skeleton-loader/index.hbs (3 hunks)
  • app/components/file-details/skeleton-loader/index.scss (1 hunks)
  • app/components/project-settings/general-settings/dynamicscan-automation-settings/index.hbs (1 hunks)
  • app/components/project-settings/general-settings/dynamicscan-automation-settings/index.ts (1 hunks)
  • app/components/project-settings/general-settings/index.hbs (1 hunks)
  • app/components/project-settings/general-settings/index.ts (1 hunks)
  • app/router.ts (1 hunks)
  • app/styles/_component-variables.scss (4 hunks)
  • app/templates/authenticated/dashboard/file/index-loading.hbs (1 hunks)
  • app/templates/authenticated/dashboard/file/index.hbs (1 hunks)
  • tests/acceptance/file-details-test.js (1 hunks)
Files skipped from review as they are similar to previous changes (17)
  • app/components/file-details/index.hbs
  • app/components/file-details/scan-actions/api-scan/index.hbs
  • app/components/file-details/scan-actions/dynamic-scan/index.hbs
  • app/components/file-details/scan-actions/index.scss
  • app/components/file-details/scan-actions/manual-scan/index.hbs
  • app/components/file-details/scan-actions/static-scan/index.hbs
  • app/components/file-details/severity-level/index.hbs
  • app/components/file-details/skeleton-loader/index.hbs
  • app/components/file-details/skeleton-loader/index.scss
  • app/components/project-settings/general-settings/dynamicscan-automation-settings/index.hbs
  • app/components/project-settings/general-settings/dynamicscan-automation-settings/index.ts
  • app/components/project-settings/general-settings/index.hbs
  • app/components/project-settings/general-settings/index.ts
  • app/router.ts
  • app/templates/authenticated/dashboard/file/index-loading.hbs
  • app/templates/authenticated/dashboard/file/index.hbs
  • tests/acceptance/file-details-test.js
Additional comments not posted (5)
app/styles/_component-variables.scss (5)

196-215: LGTM!

The new variables for file-details/vulnerability-analysis/header and related components are consistent with the existing pattern and naming conventions.


886-887: LGTM!

The new variables for file-details/vulnerability-analysis/header are consistent with the existing pattern and naming conventions.


Line range hint 889-891:
LGTM!

The new variables for file-details/vulnerability-analysis/header are consistent with the existing pattern and naming conventions.


Line range hint 893-894:
LGTM!

The new variables for file-details/vulnerability-analysis/table are consistent with the existing pattern and naming conventions.


Line range hint 896-897:
LGTM!

The new variables for file-details/vulnerability-analysis-details are consistent with the existing pattern and naming conventions.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3fc7275 and b85dded.

Files selected for processing (19)
  • app/components/file-chart/index.hbs (1 hunks)
  • app/components/file-details/index.hbs (1 hunks)
  • app/components/file-details/scan-actions/api-scan/index.hbs (1 hunks)
  • app/components/file-details/scan-actions/dynamic-scan/index.hbs (1 hunks)
  • app/components/file-details/scan-actions/index.scss (1 hunks)
  • app/components/file-details/scan-actions/manual-scan/index.hbs (1 hunks)
  • app/components/file-details/scan-actions/static-scan/index.hbs (1 hunks)
  • app/components/file-details/severity-level/index.hbs (1 hunks)
  • app/components/file-details/skeleton-loader/index.hbs (3 hunks)
  • app/components/file-details/skeleton-loader/index.scss (1 hunks)
  • app/components/project-settings/general-settings/dynamicscan-automation-settings/index.hbs (1 hunks)
  • app/components/project-settings/general-settings/dynamicscan-automation-settings/index.ts (1 hunks)
  • app/components/project-settings/general-settings/index.hbs (1 hunks)
  • app/components/project-settings/general-settings/index.ts (1 hunks)
  • app/router.ts (1 hunks)
  • app/styles/_component-variables.scss (4 hunks)
  • app/templates/authenticated/dashboard/file/index-loading.hbs (1 hunks)
  • app/templates/authenticated/dashboard/file/index.hbs (1 hunks)
  • tests/acceptance/file-details-test.js (1 hunks)
Files skipped from review as they are similar to previous changes (15)
  • app/components/file-details/index.hbs
  • app/components/file-details/scan-actions/api-scan/index.hbs
  • app/components/file-details/scan-actions/index.scss
  • app/components/file-details/scan-actions/manual-scan/index.hbs
  • app/components/file-details/scan-actions/static-scan/index.hbs
  • app/components/file-details/severity-level/index.hbs
  • app/components/file-details/skeleton-loader/index.hbs
  • app/components/file-details/skeleton-loader/index.scss
  • app/components/project-settings/general-settings/dynamicscan-automation-settings/index.ts
  • app/components/project-settings/general-settings/index.hbs
  • app/components/project-settings/general-settings/index.ts
  • app/router.ts
  • app/templates/authenticated/dashboard/file/index-loading.hbs
  • app/templates/authenticated/dashboard/file/index.hbs
  • tests/acceptance/file-details-test.js
Additional comments not posted (8)
app/components/file-details/scan-actions/dynamic-scan/index.hbs (1)

27-31: Verify the correctness of the route and model binding.

Ensure that the route authenticated.dashboard.file.dynamic-scan.manual and the model binding @file.id are correct and align with the overall routing logic and model structure in the application.

app/components/project-settings/general-settings/dynamicscan-automation-settings/index.hbs (4)

28-32: Verify the conditional rendering logic.

Ensure that the @featureAvailable attribute is correctly set and that the conditional rendering logic is functioning as expected.


35-56: Review the implementation of nested components and form controls.

Ensure that the nested components and form controls, such as AkStack, AkFormControlLabel, and AkToggle, are correctly implemented and follow best practices.


58-66: Review the implementation of the nested AkStack component.

Ensure that the AkStack component and its child elements are correctly implemented and follow best practices.


69-72: Verify the implementation of the UpsellingFeature component.

Ensure that the ProjectSettings::GeneralSettings::DynamicscanAutomationSettings::UpsellingFeature component is correctly implemented and follows best practices.

app/components/file-chart/index.hbs (1)

2-8: Verify the updated attributes of the AkStack component.

Ensure that the updated attributes, such as @justifyContent='center' and @width='full', are correctly implemented and follow best practices.

app/styles/_component-variables.scss (2)

886-887: Verify the new variable declarations for file-details/vulnerability-analysis/header.

Ensure that the new variable declarations are correctly implemented and follow best practices.


196-215: Verify the new variable declarations for file-details/scan-actions/api-scan.

Ensure that the new variable declarations are correctly implemented and follow best practices.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b85dded and 4ace202.

Files selected for processing (2)
  • app/components/file-details/scan-actions/static-scan/index.hbs (2 hunks)
  • cypress/support/Actions/common/UploadAppActions.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • cypress/support/Actions/common/UploadAppActions.ts
Files skipped from review as they are similar to previous changes (1)
  • app/components/file-details/scan-actions/static-scan/index.hbs

@SmitGala SmitGala force-pushed the PD-1375-Dast-Automation(P1)-Final-Changes branch from 4ace202 to b85dded Compare July 15, 2024 08:08
@SmitGala SmitGala force-pushed the PD-1375-Dast-Automation(P1)-Final-Changes branch from b85dded to 1903afe Compare July 18, 2024 08:57
Copy link

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, codebase verification and nitpick comments (3)
app/components/file-details/scan-actions/dynamic-scan/index.hbs (1)

27-31: Route definition missing.

The route authenticated.dashboard.file.dynamic-scan.manual is not defined in the routing configuration, which will cause navigation issues for the <AkLink> component.

  • Ensure that the route authenticated.dashboard.file.dynamic-scan.manual is defined in the routing configuration.
Analysis chain

Enhancing routing functionality.

The addition of @route and @model attributes to the <AkLink> component enhances the routing functionality by passing the file ID. Ensure the new attributes are correctly implemented and verify the routing functionality.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the routing functionality for the dynamic scan view details.

# Test: Search for the usage of the new route and model attributes. Expect: Correct implementation.
rg --type hbs "authenticated.dashboard.file.dynamic-scan.manual"

Length of output: 188


Script:

#!/bin/bash
# Description: Verify the definition of the route 'authenticated.dashboard.file.dynamic-scan.manual' in the routing configuration.

# Test: Search for the route definition. Expect: Correct implementation in the routing configuration.
rg "authenticated.dashboard.file.dynamic-scan.manual"

Length of output: 177


Script:

#!/bin/bash
# Description: Verify the definition of routes in the routing configuration files.

# Test: Search for the term 'route' to identify routing configuration files.
rg "route"

Length of output: 97068

app/components/file-details/scan-actions/manual-scan/index.hbs (1)

37-41: Missing route definition.

The route authenticated.dashboard.file.manual-scan is not defined in any JavaScript or TypeScript files, which will cause routing issues. Please ensure that the route is correctly implemented in the routing configuration.

  • Verify the implementation of the route authenticated.dashboard.file.manual-scan.
Analysis chain

Enhancing routing functionality.

The addition of @route, @model, and data-test attributes to the <AkLink> component enhances the routing functionality by passing the file ID and improving testability. Ensure the new attributes are correctly implemented and verify the routing functionality.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the routing functionality for the manual scan view details.

# Test: Search for the usage of the new route and model attributes. Expect: Correct implementation.
rg --type hbs "authenticated.dashboard.file.manual-scan"

Length of output: 171


Script:

#!/bin/bash
# Description: Verify the definition and implementation of the route `authenticated.dashboard.file.manual-scan`.

# Search for the route definition in JavaScript/TypeScript files.
rg --type js --type ts "authenticated.dashboard.file.manual-scan"

# Search for the usage of the `@model` attribute in HBS files to ensure it is used correctly.
rg --type hbs "@model"

Length of output: 13749

app/components/project-settings/general-settings/dynamicscan-automation-settings/index.ts (1)

17-17: The featureAvailable Property is Not Documented or Used Elsewhere.

The featureAvailable property is defined in the Args interface but is not documented or used in the codebase. Ensure that it is properly documented and integrated into the component logic if it is necessary.

  • File: app/components/project-settings/general-settings/dynamicscan-automation-settings/index.ts
  • Line: 17
Analysis chain

Properly Document and Use the featureAvailable Property.

The featureAvailable property is added to the Args interface. Ensure it is properly documented and used within the component.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the documentation and usage of the `featureAvailable` property.

# Test: Search for the usage of `featureAvailable` in the codebase. Expect: Proper documentation and usage.
rg --type ts $'featureAvailable'

Length of output: 152

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4ace202 and 1903afe.

Files selected for processing (19)
  • app/components/file-chart/index.hbs (1 hunks)
  • app/components/file-details/index.hbs (1 hunks)
  • app/components/file-details/scan-actions/api-scan/index.hbs (1 hunks)
  • app/components/file-details/scan-actions/dynamic-scan/index.hbs (1 hunks)
  • app/components/file-details/scan-actions/index.scss (1 hunks)
  • app/components/file-details/scan-actions/manual-scan/index.hbs (1 hunks)
  • app/components/file-details/scan-actions/static-scan/index.hbs (1 hunks)
  • app/components/file-details/severity-level/index.hbs (1 hunks)
  • app/components/file-details/skeleton-loader/index.hbs (3 hunks)
  • app/components/file-details/skeleton-loader/index.scss (1 hunks)
  • app/components/project-settings/general-settings/dynamicscan-automation-settings/index.hbs (1 hunks)
  • app/components/project-settings/general-settings/dynamicscan-automation-settings/index.ts (1 hunks)
  • app/components/project-settings/general-settings/index.hbs (1 hunks)
  • app/components/project-settings/general-settings/index.ts (1 hunks)
  • app/router.ts (1 hunks)
  • app/styles/_component-variables.scss (4 hunks)
  • app/templates/authenticated/dashboard/file/index-loading.hbs (1 hunks)
  • app/templates/authenticated/dashboard/file/index.hbs (1 hunks)
  • tests/acceptance/file-details-test.js (1 hunks)
Files skipped from review due to trivial changes (1)
  • app/components/file-details/skeleton-loader/index.scss
Additional comments not posted (26)
app/templates/authenticated/dashboard/file/index-loading.hbs (1)

1-1: Verify the impact of class removal on layout.

The removal of the w-9/12 class might affect the layout and styling of the div element. Ensure this change aligns with the design requirements and does not negatively impact the UI.

app/templates/authenticated/dashboard/file/index.hbs (1)

Line range hint 1-3:
Verify the impact of VncViewer component removal.

The removal of the VncViewer component might affect the functionality or user experience. Ensure this change is intended and check if there are any alternative implementations.

app/components/file-details/scan-actions/index.scss (1)

4-6: Verify the impact of width property changes.

The changes to the width properties of the .scan-status-card might affect the layout and responsiveness. Ensure these changes align with the design requirements and improve the layout.

app/components/file-details/severity-level/index.hbs (1)

Line range hint 8-12:
Verify the impact of AkStack simplification.

The simplification of the AkStack component should improve readability and maintainability. Ensure the changes maintain the same functionality and appearance.

app/components/file-details/index.hbs (1)

1-26: Restructuring for better layout and styling.

The restructuring of HTML elements within new <div> containers and updating local classes enhances the layout and styling. Ensure that the new structure maintains the intended functionality and readability.

app/components/file-details/scan-actions/static-scan/index.hbs (1)

43-47: Enhancing routing functionality.

The addition of @route, @model, and data-test attributes to the <AkLink> component enhances the routing functionality by passing the file ID and improving testability. Ensure the new attributes are correctly implemented and verify the routing functionality.

Verification successful

Routing functionality verified.

The addition of @route, @model, and data-test attributes to the <AkLink> component in index.hbs is correctly implemented. The route authenticated.dashboard.file.static-scan is properly defined and handled in the index.ts file.

  • index.hbs: Correct usage of @route and @model.
  • index.ts: Proper definition and handling of the route.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the routing functionality for the static scan view details.

# Test: Search for the usage of the new route and model attributes. Expect: Correct implementation.
rg --type hbs "authenticated.dashboard.file.static-scan"

Length of output: 171


Script:

#!/bin/bash
# Description: Verify the definition and handling of the route 'authenticated.dashboard.file.static-scan'.

# Test: Search for the route definition. Expect: Correct implementation.
rg --type js "authenticated.dashboard.file.static-scan"

Length of output: 55


Script:

#!/bin/bash
# Description: Verify the definition and handling of the route 'authenticated.dashboard.file.static-scan'.

# Test: Search for the route definition in all possible files. Expect: Correct implementation.
rg "authenticated.dashboard.file.static-scan"

Length of output: 490


Script:

#!/bin/bash
# Description: Extract and review the relevant code segments from the index.ts file to verify the correct implementation of the route.

# Test: Extract lines around the route definitions. Expect: Correct implementation.
rg -A 10 -B 10 "authenticated.dashboard.file.static-scan" app/components/file-details/static-scan/index.ts

Length of output: 1029

app/components/file-details/scan-actions/api-scan/index.hbs (1)

51-52: Verify the correctness of the route and model attributes.

Ensure that the route 'authenticated.dashboard.file.api-scan' and the model {{@file.id}} are correctly defined and used in the application.

app/components/project-settings/general-settings/index.ts (1)

39-44: LGTM! But verify the method usage in the codebase.

The code changes are approved.

However, ensure that the new method dynamicscanAutomationAvailable is correctly used in the application.

Verification successful

Let's expand the search to include JavaScript files and check for indirect usages.


Let's correct the regex error and re-run the search for object destructuring. Additionally, let's verify the usage in the Handlebars template.


The method dynamicscanAutomationAvailable is correctly used in the Handlebars template.

  • The method is utilized as @featureAvailable={{this.dynamicscanAutomationAvailable}} in app/components/project-settings/general-settings/index.hbs.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the method usage in the codebase.

# Test: Search for the method usage. Expect: Correct usage of the method.
rg --type ts 'dynamicscanAutomationAvailable'

Length of output: 144


Script:

#!/bin/bash
# Description: Verify the method usage in the codebase.

# Test: Search for the method usage in TypeScript and JavaScript files.
rg --type-add 'js:*.{js,jsx}' --type-add 'ts:*.{ts,tsx}' 'dynamicscanAutomationAvailable'

# Test: Search for the class or component that contains the method to check for indirect usage.
rg --type-add 'js:*.{js,jsx}' --type-add 'ts:*.{ts,tsx}' 'GeneralSettings'

# Test: Check for any object destructuring that might include the method.
rg --type-add 'js:*.{js,jsx}' --type-add 'ts:*.{ts,tsx}' '{ dynamicscanAutomationAvailable }'

Length of output: 24889


Script:

#!/bin/bash
# Description: Verify the method usage in the codebase.

# Test: Search for the method usage in TypeScript and JavaScript files.
rg --type-add 'js:*.{js,jsx}' --type-add 'ts:*.{ts,tsx}' 'dynamicscanAutomationAvailable'

# Test: Search for the class or component that contains the method to check for indirect usage.
rg --type-add 'js:*.{js,jsx}' --type-add 'ts:*.{ts,tsx}' 'GeneralSettings'

# Test: Check for any object destructuring that might include the method.
rg --type-add 'js:*.{js,jsx}' --type-add 'ts:*.{ts,tsx}' '\{.*dynamicscanAutomationAvailable.*\}'

Length of output: 24906

app/components/project-settings/general-settings/dynamicscan-automation-settings/index.hbs (2)

35-56: LGTM! But verify the nesting structure of AkStack components.

The code changes are approved.

However, ensure that the nesting structure of AkStack components is correctly implemented and used in the application.

Verification successful

Nesting structure of AkStack components is correct.

The nesting structure of AkStack components in app/components/project-settings/general-settings/dynamicscan-automation-settings/index.hbs is correctly implemented.

  • The AkStack components are properly nested.
  • Each opening tag has a corresponding closing tag.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the nesting structure of `AkStack` components.

# Test: Search for the usage of `AkStack` components. Expect: Correct nesting structure.
rg --type hbs 'AkStack'

Length of output: 131846


Script:

#!/bin/bash
# Description: Verify the nesting structure of `AkStack` components in the specified file.

# Search for the usage of `AkStack` components in the specific file and display the lines.
rg --type hbs 'AkStack' app/components/project-settings/general-settings/dynamicscan-automation-settings/index.hbs -A 5 -B 5

Length of output: 1685


28-32: LGTM! But verify the conditional rendering.

The code changes are approved.

However, ensure that the @featureAvailable flag is correctly set and used in the application.

Verification successful

Conditional Rendering Verified

The @featureAvailable flag is correctly set and used in the application. The dynamicscanAutomationAvailable getter method accurately determines the availability of the dynamicscan_automation feature.

  • app/components/project-settings/general-settings/index.hbs: @featureAvailable={{this.dynamicscanAutomationAvailable}}
  • app/components/project-settings/general-settings/index.ts: Getter method correctly checks the feature availability.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the conditional rendering based on the `@featureAvailable` flag.

# Test: Search for the flag usage. Expect: Correct usage of the flag.
rg --type hbs '@featureAvailable'

Length of output: 275


Script:

#!/bin/bash
# Description: Verify the setting and usage of `dynamicscanAutomationAvailable`.

# Search for the definition and usage of `dynamicscanAutomationAvailable` in the codebase.
rg 'dynamicscanAutomationAvailable'

Length of output: 257


Script:

#!/bin/bash
# Description: Extract and review the implementation of the `dynamicscanAutomationAvailable` getter method.

# Extract the `dynamicscanAutomationAvailable` getter method implementation from the TypeScript file.
rg -A 10 'get dynamicscanAutomationAvailable' app/components/project-settings/general-settings/index.ts

Length of output: 372

app/components/file-chart/index.hbs (1)

2-8: LGTM! But verify the modifications to the AkStack component.

The code changes are approved.

However, ensure that the modifications to the AkStack component are correctly implemented and used in the application.

app/components/project-settings/general-settings/index.hbs (2)

101-105: LGTM!

The changes look good to me. The properties passed to the DevicePreferencesAutomatedDast component are appropriate.


91-97: Verify the usage of the featureAvailable property.

Ensure that the featureAvailable property is properly documented and used within the DynamicscanAutomationSettings component.

Verification successful

The featureAvailable property is properly documented and used within the DynamicscanAutomationSettings component.

  • The property is defined as a boolean in the TypeScript file.
  • It is used in the HBS file to conditionally render the DynamicscanAutomationSettings::Scenario component.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the documentation and usage of the `featureAvailable` property.

# Test: Search for the usage of `featureAvailable` in the codebase. Expect: Proper documentation and usage.
rg --type ts $'featureAvailable'

Length of output: 152


Script:

#!/bin/bash
# Description: Search for the usage of `featureAvailable` within the DynamicscanAutomationSettings component.

# Locate the file path for DynamicscanAutomationSettings component.
component_file=$(fd dynamicscan-automation-settings/index.ts)

# Search for the usage of `featureAvailable` within the located file.
rg 'featureAvailable' $component_file -A 5

Length of output: 2080

app/router.ts (2)

160-164: LGTM!

The changes look good to me. The addition of the manual-scan route and its nested routes is appropriate.


165-170: LGTM!

The changes look good to me. The addition of the dynamic-scan route and its nested routes is appropriate.

app/components/file-details/skeleton-loader/index.hbs (5)

1-4: LGTM!

The changes look good to me. The introduction of new classes and components with adjusted attributes enhances the visual structure of the skeleton loader.


38-50: LGTM!

The changes look good to me. The introduction of new classes and components with adjusted attributes enhances the visual structure of the skeleton loader.


53-65: LGTM!

The changes look good to me. The introduction of new classes and components with adjusted attributes enhances the visual structure of the skeleton loader.


67-79: LGTM!

The changes look good to me. The introduction of new classes and components with adjusted attributes enhances the visual structure of the skeleton loader.


81-93: LGTM!

The changes look good to me. The introduction of new classes and components with adjusted attributes enhances the visual structure of the skeleton loader.

tests/acceptance/file-details-test.js (4)

247-256: LGTM!

The test case correctly simulates the user action of clicking the "view details" button for the static scan and verifies the navigation to the expected URL.


258-267: LGTM!

The test case correctly simulates the user action of clicking the "view details" button for the dynamic scan and verifies the navigation to the expected URL.


269-278: LGTM!

The test case correctly simulates the user action of clicking the "view details" button for the API scan and verifies the navigation to the expected URL.


280-289: LGTM!

The test case correctly simulates the user action of clicking the "view details" button for the manual scan and verifies the navigation to the expected URL.

app/styles/_component-variables.scss (2)

196-215: LGTM!

The changes to the chip component variables are consistent and correctly defined.


886-887: LGTM!

The new variables for the file details vulnerability analysis are correctly defined and consistent with existing variables.

@Yibaebi Yibaebi force-pushed the PD-1375-Dast-Automation(P1)-Final-Changes branch from 1903afe to 71064c7 Compare September 26, 2024 15:11
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: 15

🧹 Outside diff range and nitpick comments (34)
app/components/dynamic-scan/drawer/proxy-settings-view/index.scss (1)

2-2: Improved CSS variable naming convention.

The change to use var(--dynamic-scan-drawer-proxy-settings-view-border-color) instead of the previous variable is a good improvement. This new naming convention is more specific and descriptive, which enhances code readability and maintainability.

Consider applying this naming convention consistently across other CSS variables in the project for better organization and easier theming.

app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.scss (3)

1-5: LGTM! Consider adding a comment for clarity.

The .bordered-box class is well-defined and follows best practices. The use of CSS variables for colors and relative units for padding is commendable.

Consider adding a brief comment above the class to describe its purpose or usage, which can help other developers understand its intended use case more quickly. For example:

// Applies a bordered container style for proxy settings elements
.bordered-box {
  // ... (existing styles)
}

7-10: LGTM! Consider enhancing class naming and documentation.

The .api-proxy-toggle class effectively removes horizontal margins, which is likely intended to align the toggle element within its container.

Consider the following suggestions to improve the code:

  1. If this class is meant to be reusable, consider a more generic name that describes its function rather than its specific use case. For example:
.no-horizontal-margin {
  margin-left: 0;
  margin-right: 0;
}
  1. Add a brief comment to explain the purpose of this class:
// Removes horizontal margins, typically used for API proxy toggle elements
.api-proxy-toggle {
  margin-left: 0;
  margin-right: 0;
}
  1. If you want to keep the specific class name but make it more flexible, you could use a CSS custom property (variable) for the margin values:
.api-proxy-toggle {
  --toggle-horizontal-margin: 0;
  margin-left: var(--toggle-horizontal-margin);
  margin-right: var(--toggle-horizontal-margin);
}

This allows for easy customization if needed in the future.


1-10: Overall, well-structured SCSS with room for minor enhancements.

The SCSS file is concise, focused, and follows good practices such as using CSS variables and relative units. Both classes serve clear purposes within the proxy settings view component.

To further improve the file:

  1. Consider adding a file-level comment explaining the purpose of this SCSS file and its relationship to the proxy settings view component.
  2. If these styles are specific to this component, you might want to scope them under a parent class to prevent potential conflicts with other components.
  3. As the project grows, consider establishing or following a consistent naming convention for classes across all components (e.g., BEM methodology) to improve maintainability.

Example of scoping and adding a file-level comment:

// Styles for the proxy settings view in the dynamic scan drawer
.proxy-settings-view {
  .bordered-box {
    // ... (existing styles)
  }

  .api-proxy-toggle {
    // ... (existing styles)
  }
}

This approach would make the styles more modular and less likely to interfere with other components.

app/components/dynamic-scan/expiry/index.scss (2)

1-11: Consider alternatives to !important for better maintainability.

The use of !important in CSS should be avoided when possible as it can lead to specificity issues and make styles harder to override or maintain in the future.

Consider the following alternatives:

  1. Increase the specificity of the selector (e.g., button.extend-time-btn).
  2. If using CSS Modules, leverage the generated unique class names for higher specificity.
  3. Review the existing styles that might be conflicting and refactor them if necessary.

Example refactor:

button.extend-time-btn {
  border-radius: 50%;
  background-color: var(--dynamic-scan-action-expiry-extend-btn-background);
  padding: 0;

  :global(.ak-icon) {
    color: var(--dynamic-scan-action-expiry-extend-btn-icon-color);
  }
}

13-19: Consider using a percentage or smaller value for border-radius.

The current border-radius of 200px might be excessive and could lead to unexpected results on smaller screens or containers.

Consider using a percentage value or a smaller pixel value that better suits the intended design. For example:

.dynamic-scan-expiry-container {
  background-color: var(--dynamic-scan-action-expiry-container-background-color);
  padding: 0.3em 1em;
  border-radius: 50px; // or 50% for a fully rounded look
}

This change will make the style more flexible and consistent across different screen sizes.

app/components/file-details/index.hbs (1)

1-26: Summary of changes and potential impact

The changes in this file are part of a larger refactoring effort, as mentioned in the PR objectives. The updates include:

  1. Improved HTML structure with new local classes for better styling control.
  2. Replacement of old components with newer versions (Summary and ScanActions).
  3. Maintenance of existing functionality in unchanged components (Breadcrumbs, InsightsWrapper, and VulnerabilityAnalysis).

These changes are likely to enhance the maintainability and potentially the performance of the file details view. However, it's crucial to ensure that the new components (Summary and ScanActions) function as expected and provide all the necessary features of their predecessors.

To fully leverage these changes:

  1. Update any related CSS files to take advantage of the new local classes for more specific styling.
  2. If not already done, consider updating the component tests to cover the new component versions.
  3. Ensure that the documentation is updated to reflect the usage of the new components.
app/components/file-details/dynamic-scan/status-chip/index.hbs (1)

Line range hint 13-28: LGTM! Consider adding a tooltip for detailed status.

The changes in this section are good. The refactoring from @dynamicScan to @file is consistent, and using @file.statusText allows for more dynamic status messages.

Consider adding a tooltip to the in-progress chip to provide more detailed information about the current status. This could enhance the user experience by offering more context without cluttering the UI. For example:

<AkChip
  data-test-dynamicScan-statusChip
  @label={{@file.statusText}}
  @variant='semi-filled-outlined'
  @color={{this.chipColor}}
  @tooltip={{@file.detailedStatusText}}
>
  ...
</AkChip>

This assumes that @file.detailedStatusText exists or can be added to provide more detailed status information.

app/components/dynamic-scan/drawer/index.scss (3)

27-34: Consider renaming the new class for consistency.

The new .dynamic-scan-modal-cta class effectively styles a call-to-action area within the drawer. The positioning and styling create a visually distinct section, which is good for drawing attention to important actions or information.

For consistency with the drawer paradigm, consider renaming the class to .dynamic-scan-drawer-cta. This would align better with the renamed alert class and the overall transition from modal to drawer.

-.dynamic-scan-modal-cta {
+.dynamic-scan-drawer-cta {
   z-index: 10;
   position: absolute;
   bottom: 0;
   border-top: 1px solid var(--file-details-dynamic-scan-drawer-border-color);
   background-color: var(--file-details-dynamic-scan-drawer-background-main);
   box-shadow: var(--file-details-dynamic-scan-drawer-cta-box-shadow);
 }

Line range hint 1-34: Consider overall layout implications of the modal to drawer transition.

The changes in this file reflect a transition from a modal to a drawer interface, which is a significant UI change. While the modifications here are appropriate, there might be additional layout adjustments needed elsewhere in the codebase.

  1. Ensure that the removal of .dynamic-scan-modal-body (mentioned in the AI summary but not visible in this file) doesn't negatively impact the layout. If it set a specific width, you might need to adjust the drawer's width elsewhere.
  2. Review the overall layout of the drawer to ensure it provides a good user experience, especially considering the newly added fixed CTA area at the bottom.
  3. Check if there are any responsive design considerations that need to be addressed with the new drawer layout.

Incomplete Class Renaming Detected

The class .dynamic-scan-modal-alert has been renamed to .dynamic-scan-drawer-alert, but residual references to the old class name still exist in the codebase. These need to be updated to ensure consistency and prevent potential styling issues.

Affected Files:

  • app/styles/_component-variables.scss
    • Lines defining --dynamic-scan-modal-alert-background-color, --dynamic-scan-modal-alert-text-color, and --dynamic-scan-modal-alert-border-color.
  • app/components/dynamic-scan/drawer/index.scss
    • Styling properties referencing var(--dynamic-scan-modal-alert-*).
  • app/components/file-details/dynamic-scan/drawer-old/index.scss
    • Styling properties referencing var(--dynamic-scan-modal-alert-*).
🔗 Analysis chain

Line range hint 1-7: LGTM! Verify class usage across the codebase.

The renaming of .dynamic-scan-modal-alert to .dynamic-scan-drawer-alert aligns well with the transition from a modal to a drawer interface. The styling properties remain consistent, which is good for maintaining the alert's appearance.

To ensure this change doesn't break any existing references, please run the following script to check for any remaining usage of the old class name:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for any remaining usage of the old class name 'dynamic-scan-modal-alert'

# Test: Search for the old class name. Expect: No results.
rg --type scss --type typescript --type javascript 'dynamic-scan-modal-alert'

Length of output: 106


Script:

#!/bin/bash
# Description: Search for any remaining usage of the old class name 'dynamic-scan-modal-alert' in specific file types

# Test: Search for the old class name in .scss, .ts, and .js files. Expect: No results.
rg 'dynamic-scan-modal-alert' --glob '*.scss' --glob '*.ts' --glob '*.js'

Length of output: 1075

app/components/file-details/scan-actions/manual-scan/index.hbs (1)

37-41: LGTM! Consider minor formatting adjustment for consistency.

The changes to the AkLink component look good and enhance its functionality:

  1. The @route attribute correctly sets the navigation target.
  2. The @model attribute passes the necessary file ID.
  3. The data-test-* attribute improves testability.

These modifications align well with the PR objectives and enhance the component's usability.

For consistency with the rest of the template, consider moving the class and local-class attributes to be grouped with the other attributes at the top of the component. Here's a suggested adjustment:

<AkLink
  @color='primary'
  @underline='always'
  @fontWeight='bold'
  @route='authenticated.dashboard.file.manual-scan'
  @model={{@file.id}}
  class='px-2 py-1'
  local-class='view-details-icon'
  data-test-fileDetailScanActions-manualScanViewDetails
>
  {{!-- rest of the component --}}
</AkLink>

This minor change would improve code readability and maintain a consistent attribute ordering throughout the template.

app/components/file-details/dynamic-scan/drawer-old/index.scss (2)

13-25: LGTM! Well-structured box styling with a minor suggestion.

The .bordered-box class and its nested .bordered-box-item are well-defined, using CSS variables consistently and employing smart selectors for styling child elements.

Consider adding a comment explaining the purpose of the box-sizing: border-box; property, as it's not immediately obvious why it's necessary here. For example:

.bordered-box {
  border: 1px solid var(--dynamic-scan-modal-border-color);
  border-radius: var(--dynamic-scan-modal-border-radius);
  // Ensure padding doesn't affect the overall width
  box-sizing: border-box;

  // ... rest of the code
}

27-34: LGTM! Well-defined CTA styling with an accessibility suggestion.

The .dynamic-scan-modal-cta class is well-structured, using CSS variables consistently for colors and box-shadow. The positioning properties effectively create a fixed CTA at the bottom of the drawer.

Consider adding a min-height property to ensure the CTA is easily tappable on mobile devices. The Web Content Accessibility Guidelines (WCAG) recommend a minimum touch target size of 44x44 pixels. For example:

.dynamic-scan-modal-cta {
  // ... existing properties
  min-height: 44px; // Ensures a minimum tappable area for better accessibility
}
app/components/file-details/scan-actions/static-scan/index.hbs (1)

43-47: LGTM! Consider a minor improvement for consistency.

The changes to the AkLink component look good. The addition of the @route and @model attributes properly sets up the navigation to the static scan details page, while the data-test attribute improves testability.

For consistency with other data-test attributes in this file, consider using camelCase for the new data-test attribute:

- data-test-fileDetailScanActions-staticScanViewDetails
+ data-test-fileDetailScanActions-staticScanViewDetails

This change would align with the naming convention used in other data-test attributes like data-test-fileDetailScanActions-staticScanTitle.

app/components/file-details/dynamic-scan/status-chip/index.ts (1)

20-20: Approve with suggestion: Consider handling undefined file case

The simplification of the condition using this.file?.isDynamicStatusInProgress is a good improvement. It makes the code more readable and consistent with the new file getter.

However, consider handling the case where file might be undefined to maintain the robustness of the previous implementation:

if (this.file?.isDynamicStatusInProgress ?? false) {
  // ...
}

This ensures that if file is undefined, the condition evaluates to false, matching the behavior of the previous implementation.

app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.hbs (3)

2-7: LGTM: Well-structured container with a minor suggestion.

The use of AkStack for the main container is appropriate and consistent with the component library. The 'bordered-box' class and data-test attribute enhance the component's visual presentation and testability.

Consider adding a comment explaining the purpose of the 'bordered-box' class for better maintainability. For example:

{{!-- 'bordered-box' provides visual separation for the proxy settings --}}
<AkStack
  local-class='bordered-box'
  ...
>

Also applies to: 50-51


8-41: LGTM: Well-implemented header section with a suggestion for accessibility.

The header section is well-structured using nested AkStack components. The toggle switch for enabling/disabling the API proxy is correctly implemented with proper data binding and action handling. The edit link is appropriately routed to the project settings page. The use of translation helpers is good for internationalization support.

To improve accessibility, consider adding an aria-label to the edit link. This will provide more context for screen reader users. For example:

<AkLink
  @route='authenticated.dashboard.project.settings'
  @model={{this.projectId}}
  @color='primary'
  @underline='always'
  title={{t 'proxyEdit'}}
  aria-label={{t 'editProxySettings'}}
  data-test-proxySettingsView-editSettings
>
  {{t 'edit'}}
</AkLink>

Make sure to add the 'editProxySettings' key to your translations file with an appropriate value like "Edit proxy settings".


43-49: LGTM: Clear display of proxy settings with a suggestion for improvement.

The proxy settings display is well-implemented using the AkTypography component. The presentation of the host and port is clear and concise. The use of translation helpers for labels is good for internationalization support.

To improve clarity, consider adding labels for the host and port. This will make the information more explicit, especially for users who might not be familiar with the format. For example:

<AkTypography
  @color='textSecondary'
  data-test-proxySettingsView-proxySettingRoute
>
  {{t 'proxySettingsRouteVia'}}
  {{t 'host'}}: {{this.proxy.host}}, {{t 'port'}}: {{this.proxy.port}}
</AkTypography>

Don't forget to add the 'host' and 'port' keys to your translations file with appropriate values.

app/components/dynamic-scan/expiry/index.hbs (2)

9-19: LGTM: Enhanced user experience with tooltip

The addition of the AkTooltip with an info icon improves the user experience by providing more context. The use of the translation helper ensures proper localization, and the data-test attribute enhances testability.

Consider adding an aria-label to the AkIconButton for improved accessibility. For example:

<AkIconButton @size='small' local-class='info-btn' aria-label={{t 'dynamicScanInfoButtonLabel'}}>

Don't forget to add the corresponding translation key.


34-48: LGTM: Improved testability and visual consistency

The addition of data-test attributes (data-test-fileDetails-dynamicScan-expiry-extendBtn-tooltip and data-test-fileDetails-dynamicScan-expiry-extendBtn) improves the testability of the extend time button and its tooltip. The use of a smaller icon size enhances visual consistency.

Consider adding an aria-label to the extend time AkIconButton for improved accessibility. For example:

<AkIconButton
  data-test-fileDetails-dynamicScan-expiry-extendBtn
  @size='small'
  disabled={{not this.canExtend}}
  {{on 'click' this.handleExtendTimeClick}}
  local-class='extend-time-btn'
  aria-label={{t 'dynamicScanExtendTimeButtonLabel'}}
>

Don't forget to add the corresponding translation key.

app/components/file-details/dynamic-scan/manual/index.ts (2)

39-43: LGTM: showStatusChip getter updated correctly.

The showStatusChip getter has been successfully updated to use the file property instead of dynamicScan. The logic remains sound and covers all possible scenarios.

Consider refactoring for improved readability:

get showStatusChip() {
  return !this.file?.isDynamicStatusReady && 
         (this.file?.isDynamicStatusNoneOrError || this.file?.isDynamicStatusInProgress);
}

This refactored version reduces nesting and makes the logic more concise.


52-54: LGTM: showActionButton getter updated correctly.

The showActionButton getter has been successfully updated to use the file property instead of dynamicScan. The logic remains sound and covers the necessary scenarios.

Consider refactoring for improved readability and consistency:

get showActionButton() {
  return !this.file?.isDynamicStatusInProgress;
}

This refactored version simplifies the logic, as the action button is shown in all cases except when the status is in progress. It also removes the need for the final return true statement.

app/components/file-details/manual-scan/request-form/basic-info/index.hbs (1)

Line range hint 1-93: Summary: Minor translation key updates with potential broader impact.

The changes in this file are minimal, focusing on updating translation keys for the minimum OS version label and input placeholder. While these changes are small, they suggest a broader effort to simplify and standardize translation keys across the application.

Consider the following recommendations:

  1. Ensure these changes are part of a documented effort to refactor translation keys.
  2. Update any relevant documentation or style guides to reflect the new convention for translation keys.
  3. If this is part of a larger refactoring, consider using a migration script to automatically update similar translation keys across the entire application.
app/components/file-details/dynamic-scan/action/index.hbs (1)

Conflict Between Old and New Drawer Components Detected

The codebase currently uses both FileDetails::DynamicScan::DrawerOld and FileDetails::DynamicScan::Action::Drawer across multiple files.

  • DrawerOld is present in:
    • drawer-old/index.hbs
    • action/index.hbs
  • Action::Drawer is actively used in several files within the action/drawer/ directory.

Actions Recommended:

  1. Evaluate Necessity: Determine if DrawerOld is still required for legacy support.
  2. Cleanup: Remove DrawerOld if it's obsolete to streamline the codebase.
  3. Transition Plan: If both are needed temporarily, establish a clear roadmap for phasing out the old component.
🔗 Analysis chain

Line range hint 72-94: Clarify the purpose of the new drawer component and address commented-out code

  1. A new component FileDetails::DynamicScan::DrawerOld has been added. The naming suggests this might be a temporary or transitional solution. Could you provide more context on why this older version is being used and if there's a plan to transition to a newer version?

  2. There's a significant block of commented-out code (lines 79-94) that includes a different implementation using ProjectPreferences::Provider and FileDetails::DynamicScan::Action::Drawer.

To understand the extent of this transition, please run the following script:

Consider the following actions:

  1. If the old drawer is temporary, add a TODO comment explaining the plan for transitioning to the new version.
  2. If the commented-out code is no longer needed, remove it to improve code maintainability.
  3. If this is part of a feature toggle or A/B test, consider using a proper feature flag system instead of commented-out code.

Please provide clarification on the intended approach and timeline for resolving this dual implementation.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for occurrences of both old and new drawer components

echo "Occurrences of FileDetails::DynamicScan::DrawerOld:"
rg --type hbs "FileDetails::DynamicScan::DrawerOld"

echo "Occurrences of FileDetails::DynamicScan::Action::Drawer:"
rg --type hbs "FileDetails::DynamicScan::Action::Drawer"

Length of output: 1708

app/components/file-details/dynamic-scan/action/index.ts (1)

Incomplete Refactoring Detected

The refactoring to use the file object instead of dynamicScan is not fully complete. The following references to dynamicScan are still present in app/components/file-details/dynamic-scan/action/index.ts:

  • dynamicScanText: string;
  • dynamicScan: DynamicscanModel | null;
  • ENV.csb['dynamicScanBtnClick'] as CsbAnalyticsFeatureData

Please update these instances to ensure consistent usage of the file object throughout the component.

🔗 Analysis chain

Line range hint 1-124: Summary of changes and final verification suggestion

The changes in this file consistently refactor the DynamicScanActionComponent to use the file object directly instead of dynamicScan. This approach simplifies the component's logic and improves code consistency. However, to ensure the refactoring doesn't introduce any issues, it's crucial to verify that all the methods and properties used (isDynamicStatusReady, setShuttingDown, setNone) exist on the file model.

As a final verification step, please run the following script to check for the existence of all required methods and properties on the file model:

If all checks pass, the refactoring can be considered successful. If any methods or properties are missing, they should be added to the file model before merging these changes.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of all required methods and properties on the file model

echo "Checking for required methods and properties in the file model:"
rg --type typescript -e "isDynamicStatusReady" -e "dynamicStatus" -e "setShuttingDown" -e "setNone" app/models/file.ts

echo "Checking for any remaining references to dynamicScan in this file:"
rg --type typescript "dynamicScan" app/components/file-details/dynamic-scan/action/index.ts

Length of output: 270


Script:

#!/bin/bash
# Description: Verify the existence of all required methods and properties on the file model

echo "Checking for required methods and properties in the file model:"
rg --type ts -e "isDynamicStatusReady" -e "dynamicStatus" -e "setShuttingDown" -e "setNone" app/models/file.ts

echo "Checking for any remaining references to dynamicScan in this file:"
rg --type ts "dynamicScan" app/components/file-details/dynamic-scan/action/index.ts

Length of output: 1355

app/components/dynamic-scan/index.hbs (1)

Inconsistencies Found in Component Refactoring

The refactoring from DynamicScan::Modal to DynamicScan::Drawer has introduced inconsistencies:

  1. The variable showDynamicScanModal is still used in index.hbs and index.ts. It should be renamed to showDynamicScanDrawer to reflect the updated component.
  2. No references to DynamicScan::Drawer were found in JavaScript files within app/components/dynamic-scan, indicating that the component's logic may not be fully integrated.
  3. Residual styles related to the Modal component are still present in app/styles/_component-variables.scss, which could affect the Drawer component's appearance and behavior.
🔗 Analysis chain

Line range hint 119-123: Approve change and suggest improvements

The change from <DynamicScan::Modal> to <DynamicScan::Drawer> aligns with the PR objectives of transitioning to a drawer interface. The functionality appears to be preserved as the passed attributes remain unchanged.

However, there are a couple of points to consider:

  1. The variable name showDynamicScanModal is now inconsistent with the new Drawer component. Consider updating it to showDynamicScanDrawer for better clarity.

  2. This change may impact the user experience and layout. Please ensure that:

    • The drawer component provides a smooth transition and doesn't disrupt the existing layout.
    • All functionality previously available in the modal is accessible in the drawer.
    • The drawer is responsive and works well on different screen sizes.

Consider updating the variable name:

-{{#if this.showDynamicScanModal}}
+{{#if this.showDynamicScanDrawer}}
   <DynamicScan::Drawer
     @onClose={{this.closeDynamicScanModal}}
     @pollDynamicStatus={{this.pollDynamicStatus}}
     @file={{@file}}
   />
 {{/if}}

To verify the impact on user experience and layout, you may want to:

  1. Test the component on different screen sizes.
  2. Ensure all previously available actions in the modal are accessible in the drawer.
  3. Check for any potential z-index issues with other elements on the page.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any related CSS or layout changes
rg --type css "drawer|modal" app/styles
# Check for any changes in the component's JavaScript file
rg --type js "DynamicScan::Drawer" app/components/dynamic-scan

Length of output: 6001


Script:

#!/bin/bash
# Correctly search for DynamicScan::Drawer in JavaScript files within app/components/dynamic-scan
rg --type js "DynamicScan::Drawer" app/components/dynamic-scan

# Search for all occurrences of 'showDynamicScanModal' in the codebase
rg "showDynamicScanModal"

# Search for all occurrences of 'closeDynamicScanModal' in the codebase
rg "closeDynamicScanModal"

Length of output: 563

app/components/dynamic-scan/expiry/index.ts (1)

118-119: Approve with a suggestion for improved error handling

The addition of this.handleExtendTimeMenuClose(); before the time extension logic is a good improvement. It ensures that the UI is updated immediately in response to the user's action, regardless of the outcome of the time extension operation.

However, to make this change more robust, consider the following suggestion:

+   try {
      this.handleExtendTimeMenuClose();
-   try {
      await dynamicscan.extendTime(time);
    } catch (error) {
      const err = error as AdapterError;

      if (err.errors && err.errors[0]?.detail) {
        this.notify.error(err.errors[0].detail);

        return;
      }

      throw err;
    }

This change would ensure that any potential errors in handleExtendTimeMenuClose() are caught and don't prevent the time extension operation from being attempted.

Also, as a minor note, consider standardizing the naming convention between extendtime (the task name) and ExtendTime (the method called on dynamicscan) for consistency.

app/components/file-details/summary/index.hbs (1)

38-38: Excellent accessibility improvement!

The addition of the aria-label attribute to the AkIconButton significantly enhances the component's accessibility. This change allows screen readers to provide a clear description of the button's purpose, improving the user experience for those relying on assistive technologies.

To further improve accessibility across the component, consider adding similar aria-label attributes to other interactive elements that may not have clear text content, such as:

  1. The File::ReportBtn component
  2. The AkIconButton used for toggling the file summary

For example:

<File::ReportBtn @file={{@file}} aria-label="Generate report for {{@file.name}}" />

<AkIconButton
  @size='small'
  {{on 'click' this.handleFileSummaryToggle}}
  data-test-fileDetailsSummary-showMoreOrLessBtn
  aria-label="{{if this.showMoreFileSummary 'Show less file summary' 'Show more file summary'}}"
>
  <!-- ... -->
</AkIconButton>

These additions would create a more consistent and accessible user interface throughout the component.

app/components/file-details/scan-actions/dynamic-scan/index.ts (1)

30-30: Remove unnecessary optional chaining on this.args.file

Since this.args.file is a required argument for the component, the optional chaining operator ? is unnecessary and can be removed for clarity.

Apply this diff:

-    if (this.args.file?.isDynamicStatusInProgress) {
+    if (this.args.file.isDynamicStatusInProgress) {
app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.ts (2)

80-80: Simplify conditional with optional chaining

The condition if (err.errors && err.errors.length) can be simplified using optional chaining for better readability and conciseness.

Apply this diff to simplify the condition:

-      if (err.errors && err.errors.length) {
+      if (err.errors?.length) {
🧰 Tools
🪛 Biome

[error] 80-80: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


51-51: Add type annotation to the 'event' parameter in 'toggleProxy'

Adding a type annotation to the event parameter in the toggleProxy task enhances type safety and code clarity.

Apply this diff to add the type annotation:

-  toggleProxy = task(async (event) => {
+  toggleProxy = task(async (event: Event) => {

If you can be more specific about the event type (e.g., MouseEvent, InputEvent), consider using that for better type accuracy.

app/components/file-details/dynamic-scan/drawer-old/index.ts (1)

160-167: Decorate runDynamicScan method with @action decorator

Since runDynamicScan is likely triggered from the template, it should be decorated with the @action decorator to ensure proper context binding.

Apply this change:

+ @action
  runDynamicScan() {
    triggerAnalytics(
      'feature',
      ENV.csb['runDynamicScan'] as CsbAnalyticsFeatureData
    );

    this.startDynamicScan.perform();
  }
app/components/dynamic-scan/drawer/index.hbs (1)

206-212: Rename local-class to reflect the component change

The local-class='dynamic-scan-modal-cta' still uses "modal" in its name. Since the component has transitioned to a drawer, consider renaming it to dynamic-scan-drawer-cta for consistency.

Apply this diff to update the local class:

-      local-class='dynamic-scan-modal-cta'
+      local-class='dynamic-scan-drawer-cta'
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 1903afe and 71064c7.

📒 Files selected for processing (81)
  • app/components/dynamic-scan/drawer/index.hbs (4 hunks)
  • app/components/dynamic-scan/drawer/index.scss (2 hunks)
  • app/components/dynamic-scan/drawer/index.ts (2 hunks)
  • app/components/dynamic-scan/drawer/proxy-settings-view/index.scss (1 hunks)
  • app/components/dynamic-scan/drawer/proxy-settings-view/index.ts (2 hunks)
  • app/components/dynamic-scan/expiry/index.hbs (2 hunks)
  • app/components/dynamic-scan/expiry/index.scss (1 hunks)
  • app/components/dynamic-scan/expiry/index.ts (1 hunks)
  • app/components/dynamic-scan/index.hbs (1 hunks)
  • app/components/file-chart/index.hbs (1 hunks)
  • app/components/file-details/dynamic-scan/action/index.hbs (4 hunks)
  • app/components/file-details/dynamic-scan/action/index.ts (3 hunks)
  • app/components/file-details/dynamic-scan/automated/index.hbs (1 hunks)
  • app/components/file-details/dynamic-scan/automated/index.scss (1 hunks)
  • app/components/file-details/dynamic-scan/drawer-old/index.hbs (1 hunks)
  • app/components/file-details/dynamic-scan/drawer-old/index.scss (1 hunks)
  • app/components/file-details/dynamic-scan/drawer-old/index.ts (1 hunks)
  • app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.hbs (1 hunks)
  • app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.scss (1 hunks)
  • app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.ts (1 hunks)
  • app/components/file-details/dynamic-scan/header/index.ts (1 hunks)
  • app/components/file-details/dynamic-scan/manual/index.ts (2 hunks)
  • app/components/file-details/dynamic-scan/status-chip/index.hbs (2 hunks)
  • app/components/file-details/dynamic-scan/status-chip/index.ts (2 hunks)
  • app/components/file-details/index.hbs (1 hunks)
  • app/components/file-details/manual-scan/request-form/basic-info/index.hbs (1 hunks)
  • app/components/file-details/scan-actions-old/api-scan/captured-apis/index.hbs (0 hunks)
  • app/components/file-details/scan-actions-old/api-scan/captured-apis/index.scss (0 hunks)
  • app/components/file-details/scan-actions-old/api-scan/captured-apis/index.ts (0 hunks)
  • app/components/file-details/scan-actions-old/api-scan/captured-apis/overview/index.hbs (0 hunks)
  • app/components/file-details/scan-actions-old/api-scan/captured-apis/overview/index.scss (0 hunks)
  • app/components/file-details/scan-actions-old/api-scan/captured-apis/overview/index.ts (0 hunks)
  • app/components/file-details/scan-actions-old/api-scan/index.hbs (0 hunks)
  • app/components/file-details/scan-actions-old/api-scan/index.scss (0 hunks)
  • app/components/file-details/scan-actions-old/api-scan/index.ts (0 hunks)
  • app/components/file-details/scan-actions-old/index.hbs (0 hunks)
  • app/components/file-details/scan-actions-old/index.scss (0 hunks)
  • app/components/file-details/scan-actions-old/index.ts (0 hunks)
  • app/components/file-details/scan-actions-old/manual-scan/basic-info/index.ts (0 hunks)
  • app/components/file-details/scan-actions-old/manual-scan/index.hbs (0 hunks)
  • app/components/file-details/scan-actions-old/manual-scan/login-details/index.scss (0 hunks)
  • app/components/file-details/scan-actions-old/manual-scan/login-details/index.ts (0 hunks)
  • app/components/file-details/scan-actions-old/manual-scan/login-details/user-role-action/index.ts (0 hunks)
  • app/components/file-details/scan-actions-old/manual-scan/vpn-details/index.ts (0 hunks)
  • app/components/file-details/scan-actions-old/static-scan/index.hbs (0 hunks)
  • app/components/file-details/scan-actions-old/static-scan/index.ts (0 hunks)
  • app/components/file-details/scan-actions/api-scan/captured-apis/index.hbs (0 hunks)
  • app/components/file-details/scan-actions/api-scan/captured-apis/index.scss (0 hunks)
  • app/components/file-details/scan-actions/api-scan/captured-apis/index.ts (0 hunks)
  • app/components/file-details/scan-actions/api-scan/captured-apis/overview/index.hbs (0 hunks)
  • app/components/file-details/scan-actions/api-scan/captured-apis/overview/index.scss (0 hunks)
  • app/components/file-details/scan-actions/api-scan/captured-apis/overview/index.ts (0 hunks)
  • app/components/file-details/scan-actions/api-scan/index.hbs (1 hunks)
  • app/components/file-details/scan-actions/dynamic-scan/index.hbs (2 hunks)
  • app/components/file-details/scan-actions/dynamic-scan/index.ts (2 hunks)
  • app/components/file-details/scan-actions/index.scss (1 hunks)
  • app/components/file-details/scan-actions/manual-scan/basic-info/index.hbs (0 hunks)
  • app/components/file-details/scan-actions/manual-scan/basic-info/index.scss (0 hunks)
  • app/components/file-details/scan-actions/manual-scan/index.hbs (1 hunks)
  • app/components/file-details/scan-actions/manual-scan/login-details/index.hbs (0 hunks)
  • app/components/file-details/scan-actions/manual-scan/login-details/index.scss (0 hunks)
  • app/components/file-details/scan-actions/manual-scan/login-details/user-role-action/index.hbs (0 hunks)
  • app/components/file-details/scan-actions/manual-scan/login-details/user-role-action/index.ts (0 hunks)
  • app/components/file-details/scan-actions/manual-scan/vpn-details/index.hbs (0 hunks)
  • app/components/file-details/scan-actions/manual-scan/vpn-details/index.scss (0 hunks)
  • app/components/file-details/scan-actions/manual-scan/vpn-details/index.ts (0 hunks)
  • app/components/file-details/scan-actions/static-scan/index.hbs (1 hunks)
  • app/components/file-details/severity-level/index.hbs (1 hunks)
  • app/components/file-details/skeleton-loader/index.hbs (3 hunks)
  • app/components/file-details/skeleton-loader/index.scss (1 hunks)
  • app/components/file-details/summary-old/app-platform/index.hbs (0 hunks)
  • app/components/file-details/summary-old/app-platform/index.scss (0 hunks)
  • app/components/file-details/summary-old/app-platform/index.ts (0 hunks)
  • app/components/file-details/summary-old/file-tags/index.hbs (0 hunks)
  • app/components/file-details/summary-old/file-tags/index.scss (0 hunks)
  • app/components/file-details/summary-old/file-tags/index.ts (0 hunks)
  • app/components/file-details/summary-old/index.hbs (0 hunks)
  • app/components/file-details/summary-old/index.scss (0 hunks)
  • app/components/file-details/summary-old/index.ts (0 hunks)
  • app/components/file-details/summary/index.hbs (1 hunks)
  • app/components/file-details/vulnerability-analysis/table/index.scss (1 hunks)
💤 Files not reviewed due to no reviewable changes (44)
  • app/components/file-details/scan-actions-old/api-scan/captured-apis/index.hbs
  • app/components/file-details/scan-actions-old/api-scan/captured-apis/index.scss
  • app/components/file-details/scan-actions-old/api-scan/captured-apis/index.ts
  • app/components/file-details/scan-actions-old/api-scan/captured-apis/overview/index.hbs
  • app/components/file-details/scan-actions-old/api-scan/captured-apis/overview/index.scss
  • app/components/file-details/scan-actions-old/api-scan/captured-apis/overview/index.ts
  • app/components/file-details/scan-actions-old/api-scan/index.hbs
  • app/components/file-details/scan-actions-old/api-scan/index.scss
  • app/components/file-details/scan-actions-old/api-scan/index.ts
  • app/components/file-details/scan-actions-old/index.hbs
  • app/components/file-details/scan-actions-old/index.scss
  • app/components/file-details/scan-actions-old/index.ts
  • app/components/file-details/scan-actions-old/manual-scan/basic-info/index.ts
  • app/components/file-details/scan-actions-old/manual-scan/index.hbs
  • app/components/file-details/scan-actions-old/manual-scan/login-details/index.scss
  • app/components/file-details/scan-actions-old/manual-scan/login-details/index.ts
  • app/components/file-details/scan-actions-old/manual-scan/login-details/user-role-action/index.ts
  • app/components/file-details/scan-actions-old/manual-scan/vpn-details/index.ts
  • app/components/file-details/scan-actions-old/static-scan/index.hbs
  • app/components/file-details/scan-actions-old/static-scan/index.ts
  • app/components/file-details/scan-actions/api-scan/captured-apis/index.hbs
  • app/components/file-details/scan-actions/api-scan/captured-apis/index.scss
  • app/components/file-details/scan-actions/api-scan/captured-apis/index.ts
  • app/components/file-details/scan-actions/api-scan/captured-apis/overview/index.hbs
  • app/components/file-details/scan-actions/api-scan/captured-apis/overview/index.scss
  • app/components/file-details/scan-actions/api-scan/captured-apis/overview/index.ts
  • app/components/file-details/scan-actions/manual-scan/basic-info/index.hbs
  • app/components/file-details/scan-actions/manual-scan/basic-info/index.scss
  • app/components/file-details/scan-actions/manual-scan/login-details/index.hbs
  • app/components/file-details/scan-actions/manual-scan/login-details/index.scss
  • app/components/file-details/scan-actions/manual-scan/login-details/user-role-action/index.hbs
  • app/components/file-details/scan-actions/manual-scan/login-details/user-role-action/index.ts
  • app/components/file-details/scan-actions/manual-scan/vpn-details/index.hbs
  • app/components/file-details/scan-actions/manual-scan/vpn-details/index.scss
  • app/components/file-details/scan-actions/manual-scan/vpn-details/index.ts
  • app/components/file-details/summary-old/app-platform/index.hbs
  • app/components/file-details/summary-old/app-platform/index.scss
  • app/components/file-details/summary-old/app-platform/index.ts
  • app/components/file-details/summary-old/file-tags/index.hbs
  • app/components/file-details/summary-old/file-tags/index.scss
  • app/components/file-details/summary-old/file-tags/index.ts
  • app/components/file-details/summary-old/index.hbs
  • app/components/file-details/summary-old/index.scss
  • app/components/file-details/summary-old/index.ts
✅ Files skipped from review due to trivial changes (3)
  • app/components/file-details/dynamic-scan/automated/index.hbs
  • app/components/file-details/dynamic-scan/automated/index.scss
  • app/components/file-details/vulnerability-analysis/table/index.scss
🧰 Additional context used
🪛 Biome
app/components/file-details/dynamic-scan/drawer-old/index.ts

[error] 99-99: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 149-149: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.ts

[error] 80-80: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

🔇 Additional comments (53)
app/components/file-details/scan-actions/index.scss (1)

4-6: Approved: Flexible sizing enhancement for scan-status-card

The changes to the .scan-status-card class improve its flexibility and responsiveness:

  1. Setting min-width: 240px; ensures the card doesn't become too narrow.
  2. Using max-width: 360px; prevents the card from becoming excessively wide.
  3. Adding flex: 1; allows the card to grow and shrink within its container.

These modifications align well with the PR objective of refactoring the dynamic scan modal to a drawer interface, enhancing adaptability across different screen sizes.

Consider the following to ensure consistency and optimal user experience:

  1. Verify that these changes integrate well with the overall layout in various screen sizes.
  2. Ensure consistency with similar components in the application.
  3. Test edge cases (very small and very large screens) to confirm the layout remains functional and visually appealing.

To assist in verifying the impact and consistency of these changes, you can run the following script:

This script will help identify similar styling patterns and potential inconsistencies across the codebase, allowing you to ensure that the changes to .scan-status-card align with the overall design system.

app/components/file-details/skeleton-loader/index.scss (3)

13-16: LGTM: Well-structured container class.

The .file-details-skeleton-container class is well-implemented. It sets a reasonable maximum width and uses the standard centering technique. This will ensure that the content doesn't stretch too wide on large screens while remaining centered.


13-22: Summary: Effective enhancements to skeleton loader styling.

The changes to this file introduce two new classes that improve the layout and responsiveness of the skeleton loader component:

  1. .file-details-skeleton-container: Provides a centered container with a maximum width, ensuring consistent layout across different screen sizes.
  2. .scan-actions-status-card: Defines flexible sizing for card elements, allowing for responsive design within flex containers.

These additions align well with modern CSS practices and should contribute to a more polished user interface.


18-22: LGTM: Well-defined card class with flexible sizing.

The .scan-actions-status-card class is well-implemented with appropriate min and max widths for responsive design. The use of flex: 1; allows for flexible sizing within a flex container.

To ensure proper layout, please verify that the parent container of elements using this class is set up as a flex container. Run the following script to check for flex container usage:

app/components/dynamic-scan/expiry/index.scss (1)

21-24: LGTM: Styles for info button look good.

The styles for the .info-btn class are well-defined and appropriate for an informational button. The use of em for margin is a good practice for scalability.

app/components/file-details/index.hbs (4)

1-2: Improved structure with local classes

The addition of new divs with local classes 'file-details-root' and 'file-details-container' enhances the layout structure and promotes modular styling. This change improves maintainability and allows for more specific styling of the file details component.


3-15: Breadcrumbs component correctly maintained

The breadcrumbs component has been properly integrated into the new structure without any changes to its functionality or parameters. The preservation of data-test attributes is commendable as it maintains the testability of the component.


25-25: VulnerabilityAnalysis component correctly maintained

The FileDetails::VulnerabilityAnalysis component has been properly integrated into the new structure without any changes to its functionality or parameters. This ensures consistency in the vulnerability analysis feature of the file details view.


17-23: Updated components within AkStack

The replacement of 'Old' components with their newer versions (FileDetails::Summary and FileDetails::ScanActions) is a positive change, likely introducing improvements or bug fixes. The structure and parameters remain consistent, which is good for maintaining the overall functionality.

To ensure the new components function as expected, please verify:

  1. The new Summary component displays all required information correctly.
  2. The new ScanActions component provides all necessary actions and behaves as expected.

You may want to run the following script to check for any remaining references to the old components:

app/components/file-details/dynamic-scan/status-chip/index.hbs (4)

1-12: LGTM! Improved error status representation.

The changes in this section look good. The refactoring from @dynamicScan to @file is consistent, and changing the chip color to 'error' for the error status improves the user experience by more clearly indicating an error state.


29-36: LGTM! Improved completed status representation and logical order.

The changes in this section are well-implemented:

  1. The refactoring from @dynamicScan to @file is consistent.
  2. Moving the completed status check after the in-progress check improves the logical flow of the scan statuses.
  3. Using a semi-filled-outlined variant and success color for the completed status enhances visual consistency and clearly indicates successful completion.

These changes contribute to a better user experience and more intuitive status representation.


Line range hint 38-44: LGTM! Consistent styling for not started status.

Although this section wasn't modified, it's worth noting that it maintains consistency with the other status chips by using the semi-filled-outlined variant. The use of 'secondary' color for the not started status is appropriate as it doesn't draw unnecessary attention while still providing clear status information.


Line range hint 1-44: Overall, excellent improvements to status chip representation and consistency.

The changes in this file significantly enhance the clarity and consistency of status chip representations:

  1. Consistent refactoring from @dynamicScan to @file throughout the file.
  2. Improved color coding for different statuses (e.g., 'error' for error status, 'success' for completed status).
  3. Consistent use of semi-filled-outlined variant for all status chips.
  4. Logical reordering of status checks to better reflect the scan progression.

These modifications contribute to a more intuitive and visually consistent user interface, which should improve the overall user experience when interacting with dynamic scan statuses.

app/components/file-details/dynamic-scan/drawer-old/index.scss (2)

1-6: LGTM! Well-structured alert styling.

The .dynamic-scan-drawer-alert class is well-defined with appropriate use of CSS variables for colors and border-radius. This approach enhances maintainability and allows for easy theming.


8-11: LGTM! Concise warning styling.

The .device-settings-warning class is concisely defined with appropriate use of a CSS variable for text color. The line height of 1.3 improves readability for warning messages.

app/components/file-details/dynamic-scan/status-chip/index.ts (2)

15-17: LGTM: New getter method improves code organization

The addition of the file getter method is a good refactoring step. It centralizes access to this.args.file, which can help maintain consistency and make future changes easier.


Line range hint 1-48: Summary: Good refactoring with minor suggestions for improvement

Overall, the changes in this file represent a positive refactoring effort. The introduction of the file getter and the simplification of the getColor, chipColor, and loaderColor methods improve code organization and readability.

However, there are a few places where handling of potential undefined values could be improved to ensure robustness. Consider implementing the suggestions provided in the previous comments to address these edge cases.

These minor adjustments will make the code more resilient while maintaining the benefits of the refactoring.

app/components/file-details/scan-actions/api-scan/index.hbs (1)

51-55: LGTM! Enhancements to AkLink component look good.

The additions to the AkLink component improve its functionality and testability:

  1. The @route attribute sets up proper navigation.
  2. The @model attribute passes the necessary file ID.
  3. The data-test attribute enhances testability.

These changes align well with the PR objectives and the AI-generated summary.

To ensure consistency, please run the following script to check if similar patterns are used in other parts of the application:

This will help confirm that the routing pattern is consistently applied across the application.

✅ Verification successful

Verification Successful: Consistent Usage Confirmed

The @route and @model attributes in the AkLink component are consistently used across the codebase, including in app/components/partner/client-info/template.hbs.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of @route and @model attributes in AkLink components

# Test: Search for AkLink components with @route and @model attributes
rg --type hbs -e '@route=.+@model={{.+}}' --glob '**/*.hbs'

Length of output: 183


Script:

#!/bin/bash
# Description: Verify the usage of @route and @model attributes in AkLink components with corrected regex

# Test: Search for AkLink components with @route and @model attributes
rg --type hbs -e '@route=.+@model=\{\{.+\}\}' --glob '**/*.hbs'

Length of output: 192

app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.hbs (1)

1-1: LGTM: Conditional rendering is appropriate.

The use of {{#if this.proxy.hasProxyUrl}} to conditionally render the entire component is a good practice. It ensures that the proxy settings view is only displayed when a proxy URL is available, preventing unnecessary UI clutter.

Also applies to: 51-51

app/components/dynamic-scan/expiry/index.hbs (3)

2-8: LGTM: Improved layout and testability

The use of AkStack with appropriate layout properties ensures proper alignment and spacing of child elements. The addition of the data-test-fileDetails-dynamicScan-expiry attribute enhances the component's testability.


21-26: LGTM: Consistent styling and improved testability

The use of AkTypography ensures consistent text styling for the remaining time display. The addition of the data-test-fileDetails-dynamicScan-expiry-time attribute enhances the component's testability.


60-64: LGTM: Enhanced testability for extend time options

The addition of the data-test-fileDetails-dynamicScan-expiry-extendTime-menu-item attribute to the akm.listItem component improves the testability of the extend time options in the menu.

app/components/file-details/dynamic-scan/manual/index.ts (2)

34-36: LGTM: New file getter is well-implemented.

The new file getter provides a clean way to access the file property from the component's arguments. This is a good practice and aligns well with the shift towards using the file property for dynamic scan status.


31-32: Verify the implications of removing the dynamic scan fetch.

The fetchDynamicscan.perform() call has been commented out in the constructor. While this aligns with the shift from using dynamicScan to file property, it's important to ensure that the necessary data is still being fetched at the appropriate time.

Please confirm:

  1. Where is the dynamic scan data now being fetched?
  2. Is there any risk of missing data or race conditions with this change?

To help verify this, you can run the following script to check for other occurrences of fetchDynamicscan:

🧰 Tools
🪛 Biome

[error] 28-32: This constructor is unnecessary.

Unsafe fix: Remove the unnecessary constructor.

(lint/complexity/noUselessConstructor)

app/components/file-details/dynamic-scan/header/index.ts (1)

67-73: Verify the intentional removal of the automated DAST tab and its implications

The commenting out of the 'automated-dast' tab aligns with the PR title suggesting final changes to DAST automation. However, this change has several implications that need to be addressed:

  1. The automated DAST functionality is no longer accessible through the UI. Ensure this is the intended behavior and update any related documentation or user guides.
  2. The isAutomatedScanRunning getter is now unused. Consider removing it if it's no longer needed elsewhere in the component.
  3. The route 'authenticated.dashboard.file.dynamic-scan.automated' is no longer used. Verify if this route needs to be removed from the router configuration.
  4. The internationalization key 'dastTabs.automatedDAST' is now unused. Consider removing it from the translations file to keep them clean.
  5. This change might affect user workflows that depended on the automated DAST feature. Ensure that all stakeholders are aware of this change and its impact on the application's functionality.

To verify the unused route and potential dead code, please run the following script:

If these checks return results, please review and clean up any unused code or configurations.

✅ Verification successful

Confirmation of the removal of the automated DAST tab and related cleanup

The verification confirms that the 'automated-dast' tab, isAutomatedScanRunning getter, the associated route, and the internationalization key are no longer used elsewhere in the codebase. It is safe to remove the commented-out code and clean up any remaining unused configurations.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for unused route and potential dead code

# Check for the unused route in the router configuration
echo "Checking for unused route:"
rg "authenticated.dashboard.file.dynamic-scan.automated" --type ts

# Check for usage of isAutomatedScanRunning getter
echo "Checking for usage of isAutomatedScanRunning getter:"
rg "isAutomatedScanRunning" --type ts

# Check for usage of the internationalization key
echo "Checking for usage of dastTabs.automatedDAST translation key:"
rg "dastTabs.automatedDAST" --type ts

Length of output: 1033

app/components/file-details/manual-scan/request-form/basic-info/index.hbs (2)

35-35: LGTM! Consistent with label change.

The update of the placeholder translation key from 'modalCard.manual.minOSVersion' to 'minOSVersion' is consistent with the label change. This maintains consistency between the label and placeholder text, which is good for user experience.


29-29: LGTM, but verify translation key usage.

The simplification of the translation key from 'modalCard.manual.minOSVersion' to 'minOSVersion' looks good. This change could potentially make the key more reusable across the application.

However, to ensure this change doesn't introduce any conflicts, please verify the usage of 'minOSVersion' across the application. Run the following script to check for other occurrences:

✅ Verification successful

Please use the following corrected shell scripts to verify the translation key usage:


Please use the following corrected shell scripts to verify the translation key usage:


✅ Translation key update verified.

The translation key 'minOSVersion' is used in the following files:

  • app/components/project-settings/general-settings/device-preferences-automated-dast/index.hbs
  • app/components/file-details/manual-scan/request-form/basic-info/index.hbs

The old key 'modalCard.manual.minOSVersion' is no longer in use, ensuring no conflicts are introduced by this change.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for occurrences of 'minOSVersion' translation key

# Search for 'minOSVersion' in all files
rg --type-add 'template:*.{hbs,handlebars}' --type template --type javascript "minOSVersion"

# Search for the old key 'modalCard.manual.minOSVersion' to ensure it's not used elsewhere
rg --type-add 'template:*.{hbs,handlebars}' --type template --type javascript "modalCard\.manual\.minOSVersion"

Length of output: 276


Script:

#!/bin/bash
# Description: Check for occurrences of 'minOSVersion' translation key

# Define 'template' file type for .hbs and .handlebars files
rg --type-add 'template:*.{hbs,handlebars}' --type template,minOSVersion "minOSVersion"

# Search for the old key 'modalCard.manual.minOSVersion' to ensure it's not used elsewhere
rg --type-add 'template:*.{hbs,handlebars}' --type template "modalCard\.manual\.minOSVersion"

Length of output: 229


Script:

#!/bin/bash
# Description: Check for occurrences of 'minOSVersion' and 'modalCard.manual.minOSVersion' translation keys

# Search for 'minOSVersion' in .hbs and .handlebars files
rg "minOSVersion" --glob "*.hbs" --glob "*.handlebars"

# Search for the old key 'modalCard.manual.minOSVersion' in .hbs and .handlebars files
rg "modalCard\.manual\.minOSVersion" --glob "*.hbs" --glob "*.handlebars"

Length of output: 909

app/components/file-details/dynamic-scan/action/index.hbs (3)

2-2: LGTM: Improved condition for button display

The condition for displaying the main button has been updated to use file properties (@file.isDynamicStatusReady and @file.isDynamicStatusInProgress) instead of the previous @dynamicScan.isReadyOrRunning. This change appears to be part of a larger refactoring effort and provides more specific control over when the button is displayed.


41-41: LGTM: Improved condition for restart button

The condition for displaying the restart button has been updated to use @file.isDynamicDone and @file.isDynamicStatusError instead of the previous @dynamicScan.isDynamicStatusError. This change is consistent with the earlier refactoring and provides a more accurate representation of when a restart option should be available.


33-33: LGTM: Updated stop icon

The icon for the stop button has been changed from 'stop' to 'stop-circle', which may improve the visual representation of the stop action.

To ensure consistency across the application, please run the following script to check for other occurrences of the 'stop' icon:

This will help verify if the icon change should be applied elsewhere for consistency.

✅ Verification successful

Verification Complete: 'stop-circle' Icon Change is Localized

The script did not find any additional occurrences of @iconName='stop' or @iconName='stop-circle', confirming that the icon change is localized to the specified file.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for other occurrences of the 'stop' icon in the codebase

# Search for 'stop' icon usage
echo "Occurrences of 'stop' icon:"
rg --type hbs -i "@iconName='stop'"

# Search for 'stop-circle' icon usage
echo "Occurrences of 'stop-circle' icon:"
rg --type hbs -i "@iconName='stop-circle'"

Length of output: 1708

app/components/dynamic-scan/drawer/proxy-settings-view/index.ts (6)

4-5: LGTM: New imports enhance type safety and functionality.

The added imports, including services, decorators, and type imports, are appropriate for the component's needs and demonstrate good TypeScript practices.

Also applies to: 7-13


15-20: LGTM: Interface name updated for clarity.

The interface name change to DynamicScanDrawerProxySettingsViewSignature improves specificity and aligns well with the component's context in the dynamic scan drawer.


22-27: LGTM: Component class name updated for consistency.

The component class name change to DynamicScanDrawerProxySettingsViewComponent improves specificity and maintains consistency with the updated interface name. The generic type parameter has been correctly updated, preserving type safety.


29-32: LGTM: Constructor signature updated correctly.

The constructor signature has been properly updated to use the new interface name DynamicScanDrawerProxySettingsViewSignature for the args parameter type. This change maintains consistency and type safety throughout the component.


93-93: LGTM: Registry declaration updated for consistency.

The registry declaration has been correctly updated to use the new component name DynamicScanDrawerProxySettingsViewComponent and a more specific key 'DynamicScan::Drawer::ProxySettingsView'. This change maintains consistency with the earlier updates and provides a clearer component path.


Line range hint 1-95: Overall: Excellent refactoring for improved clarity and consistency.

The changes in this file demonstrate a well-executed refactoring effort. The component and interface names have been updated to be more specific and descriptive, aligning with what appears to be a broader initiative to improve code organization and naming conventions. All modifications are consistent throughout the file, including imports, class declaration, constructor, and registry updates. These changes enhance the readability and maintainability of the codebase without altering the core functionality of the component.

app/components/file-details/dynamic-scan/action/index.ts (3)

110-110: Approve changes with a suggestion for verification

The modification of the error handling to use file.setNone() is consistent with the overall refactoring approach in this file. This change maintains code consistency and improves maintainability.

To ensure this change doesn't introduce any unintended side effects, please verify that:

  1. The setNone method exists on the file model.

You can run the following script to check for the existence of this method:

✅ Verification successful

Verification Successful: setNone method exists on the file model.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of the setNone method on the file model

# Test: Check for setNone method
echo "Checking for setNone method:"
rg --type typescript "setNone" app/models/file.ts

Length of output: 270


Script:

#!/bin/bash
# Description: Verify the existence of the setNone method on the file model

# Test: Check for setNone method
echo "Checking for setNone method:"
rg --type ts "setNone" app/models/file.ts

Length of output: 122


95-99: Approve changes with a suggestion for verification

The refactoring of the dynamicShutdown task to use file.setShuttingDown() and construct the dynamicUrl using file.id is consistent with the changes made in the pollDynamicStatus method. This change improves code consistency and maintainability.

To ensure this change doesn't introduce any unintended side effects, please verify that:

  1. The setShuttingDown method exists on the file model.

You can run the following script to check for the existence of this method:

✅ Verification successful

Verification Successful: setShuttingDown Method Exists

The setShuttingDown method has been confirmed to exist within the file model. The refactoring in the dynamicShutdown task is valid and does not introduce any issues.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of the setShuttingDown method on the file model

# Test: Check for setShuttingDown method
echo "Checking for setShuttingDown method:"
rg --type typescript "setShuttingDown" app/models/file.ts

Length of output: 270


Script:

#!/bin/bash
# Description: Verify the existence of the setShuttingDown method on the file model

# Test: Check for setShuttingDown method
echo "Checking for setShuttingDown method:"
rg --type ts "setShuttingDown" app/models/file.ts

Length of output: 154


66-84: Approve changes with a suggestion for verification

The refactoring of the pollDynamicStatus method to use this.args.file instead of this.args.dynamicScan simplifies the code and improves consistency. This change appears to be an improvement in code organization and maintainability.

To ensure this change doesn't introduce any unintended side effects, please verify that:

  1. The isDynamicStatusReady property exists on the file model.
  2. The dynamicStatus property is still accessible on the file model.

You can run the following script to check for the existence of these properties:

✅ Verification successful

Verification Successful

The properties isDynamicStatusReady and dynamicStatus exist on the file model as required. The refactored pollDynamicStatus method can be safely merged.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of required properties on the file model

# Test 1: Check for isDynamicStatusReady property
echo "Checking for isDynamicStatusReady property:"
rg --type typescript "isDynamicStatusReady" app/models/file.ts

# Test 2: Check for dynamicStatus property
echo "Checking for dynamicStatus property:"
rg --type typescript "dynamicStatus" app/models/file.ts

Length of output: 270


Script:

#!/bin/bash
# Description: Verify the existence of required properties on the file model

# Test 1: Check for isDynamicStatusReady property
echo "Checking for isDynamicStatusReady property:"
rg "isDynamicStatusReady" app/models/file.ts

# Test 2: Check for dynamicStatus property
echo "Checking for dynamicStatus property:"
rg "dynamicStatus" app/models/file.ts

Length of output: 978

app/components/file-chart/index.hbs (1)

2-8: Improved layout and responsiveness of the AkStack component

The changes to the AkStack component enhance its layout and responsiveness:

  1. Adding @justifyContent='center' ensures that the child elements are horizontally centered within the stack.
  2. The new @width='full' attribute makes the component take up the full width of its container, improving its adaptability to different screen sizes.

These modifications align with best practices for responsive design and should improve the overall layout of the file chart component.

app/components/dynamic-scan/drawer/index.ts (4)

20-20: LGTM! Verify usage across the codebase.

The renaming of the class from DynamicScanModalComponent to DynamicScanDrawerComponent is consistent with the interface rename and the transition from modal to drawer. The class correctly extends Component<DynamicScanDrawerSignature>.

To ensure all references to this class have been updated, run the following script:

#!/bin/bash
# Description: Check for any remaining references to DynamicScanModalComponent

# Test: Search for old class name. Expect: No results.
rg --type typescript "DynamicScanModalComponent"

# Test: Confirm new class name is used. Expect: At least one result in this file.
rg --type typescript "DynamicScanDrawerComponent"

172-172: LGTM! Verify usage across the codebase.

The registry entry update from 'DynamicScan::Modal' to 'DynamicScan::Drawer' and the corresponding component type update to typeof DynamicScanDrawerComponent are consistent with the component rename. This change ensures that the new component name is correctly registered in the Ember.js environment.

To ensure all references to this component in templates have been updated, run the following script:

#!/bin/bash
# Description: Check for any remaining references to DynamicScan::Modal in templates

# Test: Search for old component name in templates. Expect: No results.
rg --type hbs "DynamicScan::Modal"

# Test: Confirm new component name is used in templates. Expect: At least one result.
rg --type hbs "DynamicScan::Drawer"

Line range hint 1-174: Overall LGTM. Ensure consistent renaming across the codebase.

The renaming from Modal to Drawer has been consistently applied within this file, including the interface, class, and registry entry. This change appears to be part of a larger refactoring effort to transition from a modal to a drawer interface.

However, it's crucial to ensure that this renaming has been consistently applied across the entire codebase. This includes:

  1. Updating all imports of this component in other files.
  2. Modifying all template files that use this component.
  3. Updating any documentation or comments referencing the old component name.
  4. Checking for any CSS/SCSS files that might have had specific styles for the modal version.

To help verify the consistency of this change across the codebase, run the following script:

#!/bin/bash
# Description: Check for any remaining references to the old component name

# Test: Search for old component name in TypeScript/JavaScript files. Expect: No results.
rg --type ts --type js "DynamicScanModal"

# Test: Search for old component name in template files. Expect: No results.
rg --type hbs "DynamicScan::Modal"

# Test: Search for old component name in CSS/SCSS files. Expect: No results or deliberate occurrences.
rg --type css --type scss "dynamic-scan-modal"

# Test: Confirm new component name is used. Expect: Multiple results across different file types.
rg "DynamicScanDrawer"
rg "DynamicScan::Drawer"

Please review the results of this script carefully to ensure the renaming has been applied consistently throughout the project.


12-18: LGTM! Verify usage across the codebase.

The renaming of the interface from DynamicScanModalSignature to DynamicScanDrawerSignature is consistent with the component's transition from a modal to a drawer. The interface structure remains unchanged, which is good for maintaining compatibility.

To ensure all references to this interface have been updated, run the following script:

✅ Verification successful

Verified: DynamicScanModalSignature successfully renamed to DynamicScanDrawerSignature.

  • No remaining references to DynamicScanModalSignature found.
  • DynamicScanDrawerSignature is correctly implemented in app/components/dynamic-scan/drawer/index.ts.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining references to DynamicScanModalSignature

# Test: Search for old interface name. Expect: No results.
rg --type typescript "DynamicScanModalSignature"

# Test: Confirm new interface name is used. Expect: At least one result in this file.
rg --type typescript "DynamicScanDrawerSignature"

Length of output: 8757


Script:

#!/bin/bash
# Description: Verify the renaming of DynamicScanModalSignature to DynamicScanDrawerSignature

# Test: Ensure no references to the old interface name exist
rg --type typescript "DynamicScanModalSignature"

# Test: Confirm the new interface name is used
rg --type typescript "DynamicScanDrawerSignature"

Length of output: 168


Script:

#!/bin/bash
# Description: Verify the renaming of DynamicScanModalSignature to DynamicScanDrawerSignature

# Test: Ensure no references to the old interface name exist
rg --type ts "DynamicScanModalSignature"

# Test: Confirm the new interface name is used
rg --type ts "DynamicScanDrawerSignature"

Length of output: 312

app/components/file-details/skeleton-loader/index.hbs (3)

1-4: Improved structure and layout for the skeleton loader

The changes introduce a more specific container class and utilize the AkStack component for better layout management. The addition of the AkSkeleton with a fixed width provides a clear placeholder for what seems to be a header or title element.


38-50: Enhanced organization and responsiveness for scan actions

The restructuring of scan actions using AkStack and individual 'box-section-root' divs significantly improves the organization and potential responsiveness of the layout. The consistent structure for each scan action card enhances code readability and maintainability.


Line range hint 118-129: Improved visual structure for severity level section

The restructuring of the severity level section using AkStack components and a more organized layout of AkSkeleton elements significantly enhances the visual hierarchy and balance of the skeleton loader. The larger AkSkeleton element alongside a column of smaller elements suggests a well-thought-out representation of a chart or graphical element with accompanying details or legend.

This change should provide a more accurate preview of the actual content layout, improving the user experience during loading.

app/components/file-details/scan-actions/dynamic-scan/index.ts (1)

21-21: Verify presence of 'inProgress' translation key

Ensure that the 'inProgress' translation key is defined in all required locale files to prevent runtime errors.

Run the following script to check for the 'inProgress' key in translation files:

app/components/file-details/scan-actions/dynamic-scan/index.hbs (3)

45-52: Verify if an icon should be included in the "completed" status AkChip

In the "errored" and "in-progress" statuses, the AkChip includes an icon (AkIcon and AkLoader, respectively). The "completed" status AkChip does not include an icon. If consistent visual indicators are desired across all statuses, consider adding an appropriate icon (e.g., a checkmark) to the "completed" status.


72-73: Verify that the route 'authenticated.dashboard.file.dynamic-scan.manual' exists

Ensure that the route authenticated.dashboard.file.dynamic-scan.manual is defined and properly configured to handle the @file.id parameter. This will prevent potential navigation errors or broken links in the application.

Run the following script to check for the route definition:

#!/bin/bash
# Description: Verify the existence of the specified route.

# Search for the route definition in JavaScript and template files
rg --type js --type ts --type hbs --fixed-strings "authenticated.dashboard.file.dynamic-scan.manual"

28-29: Ensure that chipStatusText, chipColor, and loaderColor are defined in the component

The template references this.chipStatusText, this.chipColor, and this.loaderColor. Please verify that these properties are properly defined and computed in the corresponding component JavaScript file to prevent any runtime errors.

Run the following script to confirm the definitions:

Also applies to: 38-38, 56-57

✅ Verification successful

Properties chipStatusText, chipColor, and loaderColor are properly defined in the component.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that `chipStatusText`, `chipColor`, and `loaderColor` are defined in the component JavaScript file.

# Find the component JavaScript file
component_file=$(fd index.js app/components/file-details/scan-actions/dynamic-scan)

if [ -z "$component_file" ]; then
  echo "Component JavaScript file not found."
else
  echo "Checking component file: $component_file"
  rg "chipStatusText|chipColor|loaderColor" "$component_file"
fi

Length of output: 631


Script:

#!/bin/bash
# Description: Verify that `chipStatusText`, `chipColor`, and `loaderColor` are defined in the component JavaScript file.

# Find the component JavaScript file
component_file=$(fd "index.js" app/components/file-details/scan-actions/dynamic-scan)

if [ -z "$component_file" ]; then
  echo "Component JavaScript file not found."
else
  echo "Checking component file: $component_file"
  rg "chipStatusText|chipColor|loaderColor" "$component_file"
fi

Length of output: 185


Script:

#!/bin/bash
# Description: Locate and verify definitions of `chipStatusText`, `chipColor`, and `loaderColor` in relevant component files.

# Define the base directory for search
base_dir="app/components/file-details/scan-actions/dynamic-scan"

# Find all JavaScript and TypeScript files within the base directory
component_files=$(fd -e js -e ts . "$base_dir")

if [ -z "$component_files" ]; then
  echo "No JavaScript or TypeScript files found in $base_dir. Searching the broader directory."

  # Broaden the search to the entire 'file-details' directory
  component_files=$(fd -e js -e ts . "app/components/file-details/")

  if [ -z "$component_files" ]; then
    echo "No JavaScript or TypeScript component files found in app/components/file-details/."
    exit 1
  fi
fi

echo "Checking the following component files for property definitions:"
echo "$component_files"

# Search for the required properties in the found component files
rg "chipStatusText|chipColor|loaderColor" $component_files

Length of output: 741

app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.ts (1)

43-44: Ensure 'profile' is resolved before accessing 'id'

Accessing this.args.profile.get('id') assumes that the profile relationship is already loaded. If it's not resolved, this could lead to runtime errors.

Please verify that this.args.profile is resolved before accessing its id. If necessary, you might need to await the relationship:

-    const profileId = this.args.profile.get('id');
+    const profile = await this.args.profile;
+    const profileId = profile?.get('id');

This ensures that you safely access the id after the profile is loaded.

app/components/file-details/dynamic-scan/drawer-old/index.hbs (1)

125-131: Ensure 'enableApiScan' properly toggles 'showApiScanSettings'

When the API scan checkbox changes, the enableApiScan method should correctly update this.showApiScanSettings to display or hide the API scan settings section. Verify that enableApiScan is implemented to modify showApiScanSettings, and that the UI updates accordingly.

app/components/dynamic-scan/expiry/index.scss Outdated Show resolved Hide resolved
app/components/dynamic-scan/drawer/index.hbs Outdated Show resolved Hide resolved
app/components/dynamic-scan/drawer/index.hbs Outdated Show resolved Hide resolved
@Yibaebi Yibaebi force-pushed the PD-1375-Dast-Automation(P1)-Final-Changes branch from 71064c7 to babdc6c Compare September 26, 2024 15:29
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: 9

🧹 Outside diff range and nitpick comments (6)
app/components/vnc-viewer/index.hbs (1)

57-57: LGTM! Consider extracting the condition for better readability.

The change from @dynamicScan.isReadyOrRunning to @file.isReady is consistent with the earlier modifications and aligns with the refactoring effort.

For improved readability, consider extracting the condition into a computed property or helper function. This would make the template cleaner and the logic more reusable. For example:

{{#if this.isReadyWithDeviceType}}
  {{!-- existing content --}}
{{/if}}

Then in the component's JavaScript file:

@computed('file.isReady', 'deviceType')
get isReadyWithDeviceType() {
  return this.file.isReady && this.deviceType;
}
app/components/dynamic-scan/drawer/index.hbs (2)

Line range hint 35-108: LGTM: Alert section and content structure

The renaming of the alert section to 'dynamic-scan-drawer-alert' is consistent with the transition to a drawer interface. The existing content structure is appropriately maintained.

Consider updating other occurrences of 'Modal' in data-test attributes to 'Drawer' for consistency, e.g., data-test-dynamicScanModal-warningAlert to data-test-dynamicScanDrawer-warningAlert.


Line range hint 206-233: Update class name and approve button layout

The integration of call-to-action buttons into the main content area using AkStack is appropriate for a drawer interface and consistent with the overall structure.

Update the class name to reflect the new component type:

-        local-class='dynamic-scan-modal-cta'
+        local-class='dynamic-scan-drawer-cta'

Also, consider updating the data-test attributes for consistency:

-          data-test-dynamicScanModal-cancelBtn
+          data-test-dynamicScanDrawer-cancelBtn

-          data-test-dynamicScanModal-startBtn
+          data-test-dynamicScanDrawer-startBtn
app/models/file.ts (1)

203-208: LGTM! Consider a minor optimization.

The new isReadyOrRunning getter method is well-implemented and fits nicely with the existing status-related getters in the FileModel class. It provides a clear and concise way to check if the dynamic status is either READY or RUNNING.

For a slight performance improvement, consider using a single comparison instead of an array inclusion check:

get isReadyOrRunning() {
  const status = this.dynamicStatus;
  return status === ENUMS.DYNAMIC_STATUS.READY || status === ENUMS.DYNAMIC_STATUS.RUNNING;
}

This approach avoids creating a temporary array and may be marginally faster, especially if this getter is called frequently.

app/components/file-details/dynamic-scan/drawer-old/index.ts (1)

80-81: Simplify boolean assignment

In the data object, you're assigning isApiScanEnabled as this.isApiScanEnabled === true. Since this.isApiScanEnabled is already a boolean, comparing it to true is unnecessary. You can simplify the assignment as:

const data = {
-  isApiScanEnabled: this.isApiScanEnabled === true,
+  isApiScanEnabled: this.isApiScanEnabled,
};
tests/integration/components/file-details/dynamic-scan/manual-test.js (1)

1105-1130: Ensure dynamic scan stop functionality works as intended

The test simulates stopping a dynamic scan but doesn't verify all possible states and side effects after stopping the scan. Consider adding assertions to verify that resources are properly released, and the UI reflects the stopped state correctly.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 71064c7 and babdc6c.

📒 Files selected for processing (33)
  • app/components/dynamic-scan/drawer/index.hbs (4 hunks)
  • app/components/dynamic-scan/drawer/index.scss (2 hunks)
  • app/components/dynamic-scan/drawer/index.ts (2 hunks)
  • app/components/dynamic-scan/drawer/proxy-settings-view/index.scss (1 hunks)
  • app/components/dynamic-scan/drawer/proxy-settings-view/index.ts (2 hunks)
  • app/components/dynamic-scan/expiry/index.hbs (2 hunks)
  • app/components/dynamic-scan/expiry/index.scss (1 hunks)
  • app/components/dynamic-scan/expiry/index.ts (1 hunks)
  • app/components/dynamic-scan/index.hbs (1 hunks)
  • app/components/file-details/dynamic-scan/action/index.hbs (4 hunks)
  • app/components/file-details/dynamic-scan/action/index.ts (3 hunks)
  • app/components/file-details/dynamic-scan/drawer-old/index.hbs (1 hunks)
  • app/components/file-details/dynamic-scan/drawer-old/index.scss (1 hunks)
  • app/components/file-details/dynamic-scan/drawer-old/index.ts (1 hunks)
  • app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.hbs (1 hunks)
  • app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.scss (1 hunks)
  • app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.ts (1 hunks)
  • app/components/file-details/dynamic-scan/header/index.ts (1 hunks)
  • app/components/file-details/dynamic-scan/manual/index.ts (2 hunks)
  • app/components/file-details/dynamic-scan/status-chip/index.hbs (2 hunks)
  • app/components/file-details/dynamic-scan/status-chip/index.ts (2 hunks)
  • app/components/file-details/manual-scan/request-form/basic-info/index.hbs (1 hunks)
  • app/components/file-details/scan-actions/dynamic-scan/index.hbs (2 hunks)
  • app/components/file-details/scan-actions/dynamic-scan/index.ts (2 hunks)
  • app/components/vnc-viewer/index.hbs (2 hunks)
  • app/models/file.ts (1 hunks)
  • app/router.ts (0 hunks)
  • app/styles/_component-variables.scss (2 hunks)
  • app/styles/_icons.scss (1 hunks)
  • tests/acceptance/file-details/dynamic-scan-test.js (3 hunks)
  • tests/acceptance/file-details/manual-scan-test.js (1 hunks)
  • tests/integration/components/dynamic-scan-test.js (3 hunks)
  • tests/integration/components/file-details/dynamic-scan/manual-test.js (1 hunks)
💤 Files not reviewed due to no reviewable changes (1)
  • app/router.ts
🚧 Files skipped from review as they are similar to previous changes (21)
  • app/components/dynamic-scan/drawer/index.scss
  • app/components/dynamic-scan/drawer/index.ts
  • app/components/dynamic-scan/drawer/proxy-settings-view/index.scss
  • app/components/dynamic-scan/drawer/proxy-settings-view/index.ts
  • app/components/dynamic-scan/expiry/index.hbs
  • app/components/dynamic-scan/expiry/index.scss
  • app/components/dynamic-scan/expiry/index.ts
  • app/components/dynamic-scan/index.hbs
  • app/components/file-details/dynamic-scan/action/index.hbs
  • app/components/file-details/dynamic-scan/action/index.ts
  • app/components/file-details/dynamic-scan/drawer-old/index.hbs
  • app/components/file-details/dynamic-scan/drawer-old/index.scss
  • app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.hbs
  • app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.scss
  • app/components/file-details/dynamic-scan/header/index.ts
  • app/components/file-details/dynamic-scan/manual/index.ts
  • app/components/file-details/dynamic-scan/status-chip/index.hbs
  • app/components/file-details/dynamic-scan/status-chip/index.ts
  • app/components/file-details/manual-scan/request-form/basic-info/index.hbs
  • app/components/file-details/scan-actions/dynamic-scan/index.hbs
  • app/components/file-details/scan-actions/dynamic-scan/index.ts
🧰 Additional context used
🪛 Biome
app/components/file-details/dynamic-scan/drawer-old/index.ts

[error] 99-99: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 149-149: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.ts

[error] 80-80: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

tests/acceptance/file-details/dynamic-scan-test.js

[error] 523-523: This is an unexpected use of the debugger statement.

Unsafe fix: Remove debugger statement

(lint/suspicious/noDebugger)

tests/integration/components/file-details/dynamic-scan/manual-test.js

[error] 120-120: Avoid the use of spread (...) syntax on accumulators.

Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.

(lint/performance/noAccumulatingSpread)

🔇 Additional comments (19)
app/components/vnc-viewer/index.hbs (2)

Line range hint 1-93: Overall, the changes improve consistency and align with the refactoring goals.

The modifications in this file successfully transition from using dynamic scan status to file readiness for conditional rendering. This change appears to be part of a larger refactoring effort to improve the dynamic scan component, as mentioned in the PR objectives and AI-generated summary.

The new approach seems more intuitive and potentially more maintainable. However, ensure that these changes are consistent across the entire application and that all related components and tests have been updated accordingly.


8-10: LGTM! Verify the new component usage.

The changes align with the refactoring effort mentioned in the PR summary. The condition now checks for @file.isReady instead of the dynamic scan status, which seems more appropriate for this context.

Please run the following script to verify the usage of the new <DynamicScan::Expiry> component:

app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.ts (3)

22-36: LGTM: Component class declaration and initialization

The component class is well-structured with proper typing and service injections. Initializing the fetchProxySetting task in the constructor ensures that proxy settings are fetched when the component is created.


91-95: LGTM: Glint declaration

The Glint declaration for the component is correctly implemented, ensuring proper type checking and autocompletion in templates.


78-78: ⚠️ Potential issue

Fix typo in translation key

There's a typo in the translation key. 'plaseTryAgain' should be 'pleaseTryAgain'.

Please apply this change:

- let errMsg = this.intl.t('plaseTryAgain');
+ let errMsg = this.intl.t('pleaseTryAgain');

Also, ensure that the 'pleaseTryAgain' key exists in your translation files.

Likely invalid or redundant comment.

app/components/dynamic-scan/drawer/index.hbs (3)

7-9: Update data-test-cy attribute to reflect the component change

The data-test-cy='dynamicScanModal' attribute still references "Modal". Since the component has been refactored to use AkDrawer, update it to data-test-cy='dynamicScanDrawer' to maintain consistency and clarity.


14-33: LGTM: Drawer header implementation

The implementation of the drawer header using AkAppbar with a title and close button is well-structured and follows best practices for drawer interfaces. The use of AkStack for content layout provides consistency.


110-112: Verify usage of updated ProxySettingsView component

The update of the ProxySettingsView component to DynamicScan::Drawer::ProxySettingsView is consistent with the drawer refactoring.

Ensure that all references to this component have been updated throughout the codebase. Run the following script to check for any remaining references to the old component name:

app/styles/_icons.scss (1)

578-580: LGTM! Consistent with existing icon definitions.

The addition of the .ak-icon-stop-circle class is well-placed and follows the established patterns in this file:

  1. It uses the correct ak-icon- prefix.
  2. It extends the corresponding Material Icons class (.mi-stop-circle).
  3. Its placement at the end of the file maintains good organization.

This change integrates seamlessly with the existing icon definitions.

tests/acceptance/file-details/dynamic-scan-test.js (1)

Line range hint 477-493: Consider maintaining test coverage for both automated and non-automated scenarios.

The test case for canceling/stopping a dynamic scan has been modified to only include the scenario where isAutomated is false. This change might reduce test coverage. Additionally, the initial status for the non-automated case has been changed from READY to NONE.

Consider the following:

  1. Is there a specific reason for removing the automated scenario test?
  2. Does changing the initial status from READY to NONE align with the expected behavior of the application?

To ensure comprehensive test coverage, it might be beneficial to maintain tests for both automated and non-automated scenarios, unless there's a specific reason for this change.

✅ Verification successful

Test Coverage Verified for Automated Scenarios

Automated scenarios for dynamic scans are adequately covered in other test files within the codebase. The modification in tests/acceptance/file-details/dynamic-scan-test.js only affects the non-automated scenario, while automated scenarios continue to be tested elsewhere.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if there are other tests covering the automated scenario
rg --type js 'test.each.*isAutomated: true' tests/

Length of output: 52


Script:

#!/bin/bash
# Search for any usage of 'isAutomated' in test files to identify automated scenario tests
rg --type js 'isAutomated' tests/

Length of output: 2510

tests/acceptance/file-details/manual-scan-test.js (1)

313-313: LGTM! Verify translation key consistency.

The simplification of the translation key from t('modalCard.manual.minOSVersion') to t('minOSVersion') looks good. This change appears to be part of a refactoring effort to flatten the translation key structure.

To ensure consistency across the application, please run the following script to check for any remaining occurrences of the old translation key:

If the script returns any results, consider updating those occurrences as well for consistency.

✅ Verification successful

Translation key refactoring verified successfully.

No remaining occurrences of t('modalCard.manual.minOSVersion') were found in the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining occurrences of the old translation key
rg "modalCard\.manual\.minOSVersion" --type js --type hbs

Length of output: 59


Script:

#!/bin/bash
# Search for any remaining occurrences of the old translation key across all relevant file types
rg "modalCard\.manual\.minOSVersion" --type js --type jsx --type ts --type tsx --type hbs --type json

Length of output: 131


Script:

#!/bin/bash
# Search for any remaining occurrences of the old translation key across all relevant file types using glob patterns
rg "modalCard\.manual\.minOSVersion" --glob "*.js" --glob "*.jsx" --glob "*.ts" --glob "*.tsx" --glob "*.hbs" --glob "*.json"

Length of output: 127

tests/integration/components/dynamic-scan-test.js (4)

270-271: LGTM: Updated assertion for app bar

The test has been correctly updated to check for the presence of an app bar instead of a modal header, reflecting the UI changes from a modal to a drawer interface.


638-638: LGTM: Updated assertion for confirm box app bar

The test has been appropriately updated to check for the presence of an app bar in the confirmation modal, consistent with the UI changes.


959-959: LGTM: Updated assertion for closed modal

The test has been correctly updated to verify that the app bar does not exist after the modal (drawer) is closed, which is the expected behavior after the UI changes.


270-271: Summary: Consistent updates to test assertions for UI changes

The changes in this test file are consistent and reflect a transition from a modal interface to a drawer interface with app bars. All affected assertions have been updated appropriately to check for the presence or absence of app bars instead of modal headers. These changes ensure that the tests remain valid and continue to provide valuable coverage for the updated UI components.

Some suggestions for further improvement:

  1. Consider adding a test case specifically for the new drawer interface behavior, if not already present elsewhere.
  2. Update the test descriptions to reflect the new UI terminology (e.g., "drawer" instead of "modal") for clarity.
  3. Review other test files to ensure similar updates have been made consistently across the test suite.

Also applies to: 638-638, 959-959

app/styles/_component-variables.scss (2)

891-893: LGTM: New styling variable added correctly.

The new variable --file-details-vulnerability-analysis-header-border-color is a good addition. It follows the existing naming conventions and uses a global color variable, which maintains consistency in the styling system.


1901-1903: LGTM: Proxy settings styling refactored appropriately.

The addition of --dynamic-scan-drawer-proxy-settings-view-border-color and the removal of the previous similar variable indicate a refactoring of the proxy settings styling. This change provides more specific scoping for the dynamic scan drawer, which is a good practice for maintainability and clarity.

app/components/file-details/dynamic-scan/drawer-old/index.ts (1)

1-174: Overall, the code is well-structured and follows best practices

The implementation is clear, and the use of Ember services and tasks is appropriate. Good job on maintaining readability and organization throughout the component.

🧰 Tools
🪛 Biome

[error] 99-99: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 149-149: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

tests/integration/components/file-details/dynamic-scan/manual-test.js (1)

830-832: Check translation string for correctness

The assertion at line 832 checks for the notification message 't:proxyTurned:() T:ON:()'. The inclusion of T:ON:() may be incorrect or inconsistent with the localization keys used elsewhere. Ensure that the correct translation keys are used and that they match the expected output.

Run the following script to search for the translation key usage:

@Yibaebi Yibaebi force-pushed the PD-1375-Dast-Automation(P1)-Final-Changes branch from babdc6c to 00b8e8d Compare September 27, 2024 13:06
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: 11

🧹 Outside diff range and nitpick comments (17)
app/components/project-settings/general-settings/index.hbs (1)

99-107: Consider alternatives to commented-out code for future features

While it's helpful to have placeholders for upcoming features, keeping commented-out code in production files can lead to maintenance issues and confusion over time.

Consider the following alternatives:

  1. Remove the commented code and track the TODO item in your project management tool or as a GitHub issue.
  2. If the code must remain in the file, add more context such as a ticket number or expected implementation date.

Would you like me to create a GitHub issue to track the implementation of the Automated DAST feature? This would allow for better visibility and tracking of the upcoming work.

app/components/dynamic-scan/expiry/index.ts (2)

51-63: Approve refactoring with a minor suggestion.

The refactoring of fetchDynamicscan task is a significant improvement:

  1. Error handling with try-catch improves robustness.
  2. Use of parseError for standardized error handling is a good practice.
  3. Introduction of setScanDuration improves code organization.

Consider using optional chaining for a more concise code:

-const expiresOn = dynamicscan ? dynamicscan.expiresOn : null;
+const expiresOn = dynamicscan?.expiresOn ?? null;

133-140: Approve new method with a minor suggestion.

The addition of setScanDuration method is a good improvement:

  1. It encapsulates the logic for calculating the remaining duration, enhancing code organization.
  2. It utilizes the injected datetime service, which is a good practice for time-related operations.

The @action decorator might not be necessary if this method is not directly used in templates. Consider removing it if it's only called from other methods within the component.

tests/integration/components/project-settings/general-settings/dynamicscan-automation-settings/index-test.js (2)

119-119: Approve change and suggest test case name improvement

The addition of @featureAvailable={{true}} is consistent with the previous test case and necessary for properly testing the toggle functionality. This change is approved.

Consider updating the test case name to reflect that it's testing the toggle functionality when the feature is available. This will make the test's purpose clearer, especially if you add a test case for when the feature is not available. For example:

test('it toggles scheduled automation when feature is available', async function (assert) {
  // ... (rest of the test case remains the same)
});

This small change will improve the clarity of your test suite.


80-81: Summary of changes and recommendations

The changes consistently add a @featureAvailable={{true}} property to the DynamicscanAutomationSettings component in both test cases. This improves the specificity of the tests and reflects a feature flag implementation in the component.

Recommendations:

  1. Add a test case for when @featureAvailable is set to false to ensure comprehensive coverage.
  2. Consider updating the names of the test cases to clearly indicate that they are testing behavior when the feature is available.
  3. Ensure that the actual component implementation handles the featureAvailable prop correctly, showing or hiding relevant UI elements based on its value.

These changes will enhance the robustness of your test suite and improve the clarity of your code.

Also applies to: 119-119

app/components/dynamic-scan/drawer/index.hbs (2)

14-33: Approve changes and suggest accessibility improvement

The implementation of the drawer header using AkAppbar and the close button using AkIconButton is well-structured and follows component library guidelines.

To improve accessibility, consider adding an aria-label to the close button:

 <AkIconButton
   {{on 'click' dr.closeHandler}}
   class={{ab.classes.defaultIconBtn}}
+  aria-label={{t 'close'}}
 >
   <AkIcon @iconName='close' />
 </AkIconButton>

This will provide better context for screen readers.


Line range hint 35-108: Approve changes and suggest follow-up task

The renaming of the alert section from 'dynamic-scan-modal-alert' to 'dynamic-scan-drawer-alert' is consistent with the modal to drawer transition. The device requirements section has been appropriately maintained.

Consider creating a follow-up task to review and potentially update the ProjectPreferencesOld::DevicePreference component. The "Old" in the name suggests it might need modernization in line with the recent changes.

tests/acceptance/file-details/dynamic-scan-test.js (6)

Line range hint 411-466: Prepare automated dynamic scan test for future implementation

This test for the automated dynamic scan is currently skipped. It appears to be comprehensive, covering various UI elements specific to the automated scan. To prepare for future implementation:

  1. Review the test to ensure it aligns with the latest design and functionality requirements for the automated dynamic scan.
  2. Update the TODO comment with specific criteria or a ticket reference for when this test should be unskipped.
  3. Consider breaking this large test into smaller, more focused tests for better maintainability.

Example of splitting the test:

test('it renders basic elements of automated dynamic scan page', async function(assert) {
  // Test for breadcrumb, summary, and expiry elements
});

test('it renders VNC viewer with automated note for automated dynamic scan', async function(assert) {
  // Test for VNC viewer and automated note
});

test('it handles fullscreen functionality for automated dynamic scan', async function(assert) {
  // Test for fullscreen button and modal
});

Line range hint 467-595: Prepare start dynamic scan test for full implementation

This test for starting dynamic scans (both automated and manual) is currently skipped and only testing the manual scan scenario. To prepare for full implementation:

  1. Review the test to ensure it aligns with the latest requirements for both manual and automated scans.
  2. Uncomment and update the automated scan scenario once the feature is ready for testing.
  3. Update the TODO comment with specific criteria or a ticket reference for when this test should be unskipped.
  4. Consider splitting this large test into separate tests for manual and automated scans for better clarity and maintainability.

Example of splitting the test:

test('start manual dynamic scan', async function(assert) {
  // Test manual scan start functionality
});

test('start automated dynamic scan', async function(assert) {
  // Test automated scan start functionality
});

Line range hint 596-678: Prepare cancel/stop dynamic scan test for full implementation

This test for cancelling/stopping dynamic scans is currently skipped and only set up for the manual scan scenario. To prepare for full implementation:

  1. Review the test to ensure it aligns with the latest requirements for both manual and automated scan cancellation.
  2. Implement the automated scan cancellation scenario once the feature is ready for testing.
  3. Update the TODO comment with specific criteria or a ticket reference for when this test should be unskipped.
  4. Consider splitting this large test into separate tests for manual and automated scan cancellation for better clarity and maintainability.

Example of splitting the test:

test('cancel/stop manual dynamic scan', async function(assert) {
  // Test manual scan cancellation functionality
});

test('cancel/stop automated dynamic scan', async function(assert) {
  // Test automated scan cancellation functionality
});

Line range hint 679-794: Prepare toggle DAST UI test for implementation

This test for rendering the toggle DAST UI when automated DAST is not enabled is currently skipped. To prepare for implementation:

  1. Review the test to ensure it aligns with the latest design and functionality requirements for the toggle DAST UI.
  2. Update the TODO comment with specific criteria or a ticket reference for when this test should be unskipped.
  3. Consider breaking this large test into smaller, more focused tests for better maintainability. For example:
test('it renders disabled card for automated DAST when not enabled', async function(assert) {
  // Test for the presence of the disabled card
});

test('it displays correct text and action button in disabled automated DAST card', async function(assert) {
  // Test for the correct text and action button
});

test('it navigates to correct settings page on action button click', async function(assert) {
  // Test for the navigation to settings page
});
  1. Ensure that all the server endpoint setups are necessary for this test. If some are not needed, consider moving them to a shared setup function.

Line range hint 795-808: Prepare upselling UI test for implementation

This test for rendering the upselling UI when automated DAST is not enabled is currently skipped. To prepare for implementation:

  1. Review the test to ensure it aligns with the latest design and functionality requirements for the upselling UI.
  2. Update the TODO comment with specific criteria or a ticket reference for when this test should be unskipped.
  3. Consider adding more specific assertions to check the content of the upselling UI, not just its presence. For example:
test('it renders upselling UI with correct content when automated DAST is not enabled', async function(assert) {
  // ... existing setup code ...

  await visit(`/dashboard/file/${this.file.id}/dynamic-scan/automated`);

  assert.dom('[data-test-automated-dast-upselling]').exists();
  assert.dom('[data-test-automated-dast-upselling-title]').hasText('Upgrade to Automated DAST');
  assert.dom('[data-test-automated-dast-upselling-description]').exists();
  assert.dom('[data-test-automated-dast-upselling-cta-button]').hasText('Learn More');
});

Line range hint 1-938: Overall test file review and next steps

This test file for dynamic scan functionality is in a transitional state, with a mix of active and skipped tests. Here's a summary of the current state and suggestions for next steps:

  1. Active tests:

    • Manual DAST page visit
    • Tab navigation
    • Dynamic scan results rendering
  2. Skipped tests (features in development):

    • Automated DAST
    • Expiry functionality
    • Starting and stopping dynamic scans
    • Toggle DAST UI
    • Upselling UI

To improve the test suite and prepare for full feature implementation:

  1. Review and update all skipped tests to ensure they align with the latest feature requirements.
  2. Add specific TODO comments or ticket references to each skipped test, indicating when they should be unskipped.
  3. Consistently use the latest dynamicscan model instead of dynamicscan-old.
  4. Consider breaking larger tests into smaller, more focused tests for better maintainability.
  5. Implement missing test scenarios for automated DAST features as they become available.
  6. Regularly review and unskip tests as features are completed.

By following these steps, you'll maintain a clear roadmap of the testing requirements and ensure comprehensive coverage as new features are implemented.

app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.ts (2)

51-53: Type the event parameter in toggleProxy for better type safety

Providing a type annotation for the event parameter enhances code readability and ensures type safety.

Apply this diff to add the type annotation:

- toggleProxy = task(async (event) => {
+ toggleProxy = task(async (event: Event) => {

If more specific typing is needed, consider using MouseEvent or an appropriate event type based on the context.


61-63: Avoid concatenating translated strings in notifications

Concatenating translated strings can cause issues in languages with different sentence structures. Use interpolation in your translation strings for better internationalization support.

Update the notification message:

- this.notify.info(
-   `${this.intl.t('proxyTurned')} ${statusText.toUpperCase()}`
- );
+ this.notify.info(
+   this.intl.t('proxyStatus', { status: statusText.toUpperCase() })
+ );

Then, add the proxyStatus key to your translation files with a placeholder for status:

"proxyStatus": "Proxy turned {STATUS}"
app/components/file-details/dynamic-scan/drawer-old/index.ts (1)

73-74: Simplify boolean assignments and comparisons

Since checked is already a boolean, you can assign it directly without using the double negation !!. This makes the code clearer and more concise.

Update the assignment in enableApiScan:

this.isApiScanEnabled = !!checked;

Replace with:

this.isApiScanEnabled = checked;

Similarly, in your startDynamicScan task, you can simplify the comparison:

isApiScanEnabled: this.isApiScanEnabled === true,

Replace with:

isApiScanEnabled: this.isApiScanEnabled,

Also applies to: 81-81

tests/integration/components/file-details/dynamic-scan/manual-test.js (1)

585-746: Consider checking for undefined row elements to prevent potential runtime errors

In the test for adding and deleting API filter endpoints, you access the first row without checking if it exists. If the table is empty, accessing rows[0] could result in an error.

You can add a check to ensure that there is at least one row before accessing it:

const rows = findAll('[data-test-apiFilter-row]');
+ assert.ok(rows.length > 0, 'There should be at least one API filter row');
const firstRowCells = rows[0].querySelectorAll('[data-test-apiFilter-cell]');

This ensures that your test doesn't fail unexpectedly if the rows are not present.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between babdc6c and 00b8e8d.

📒 Files selected for processing (38)
  • app/components/dynamic-scan/drawer/index.hbs (4 hunks)
  • app/components/dynamic-scan/drawer/index.scss (2 hunks)
  • app/components/dynamic-scan/drawer/index.ts (2 hunks)
  • app/components/dynamic-scan/drawer/proxy-settings-view/index.scss (1 hunks)
  • app/components/dynamic-scan/drawer/proxy-settings-view/index.ts (2 hunks)
  • app/components/dynamic-scan/expiry/index.hbs (2 hunks)
  • app/components/dynamic-scan/expiry/index.scss (1 hunks)
  • app/components/dynamic-scan/expiry/index.ts (5 hunks)
  • app/components/dynamic-scan/index.hbs (1 hunks)
  • app/components/file-details/dynamic-scan/action/index.hbs (4 hunks)
  • app/components/file-details/dynamic-scan/action/index.ts (3 hunks)
  • app/components/file-details/dynamic-scan/drawer-old/index.hbs (1 hunks)
  • app/components/file-details/dynamic-scan/drawer-old/index.scss (1 hunks)
  • app/components/file-details/dynamic-scan/drawer-old/index.ts (1 hunks)
  • app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.hbs (1 hunks)
  • app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.scss (1 hunks)
  • app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.ts (1 hunks)
  • app/components/file-details/dynamic-scan/header/index.ts (1 hunks)
  • app/components/file-details/dynamic-scan/manual/index.ts (2 hunks)
  • app/components/file-details/dynamic-scan/status-chip/index.hbs (2 hunks)
  • app/components/file-details/dynamic-scan/status-chip/index.ts (2 hunks)
  • app/components/file-details/manual-scan/request-form/basic-info/index.hbs (1 hunks)
  • app/components/file-details/manual-scan/request-form/login-details/index.ts (1 hunks)
  • app/components/file-details/scan-actions/dynamic-scan/index.hbs (2 hunks)
  • app/components/file-details/scan-actions/dynamic-scan/index.ts (2 hunks)
  • app/components/project-settings/general-settings/index.hbs (1 hunks)
  • app/components/project-settings/general-settings/index.ts (1 hunks)
  • app/components/vnc-viewer/index.hbs (2 hunks)
  • app/models/file.ts (1 hunks)
  • app/router.ts (0 hunks)
  • app/styles/_component-variables.scss (2 hunks)
  • app/styles/_icons.scss (1 hunks)
  • tests/acceptance/file-details/dynamic-scan-test.js (10 hunks)
  • tests/acceptance/file-details/manual-scan-test.js (1 hunks)
  • tests/integration/components/dynamic-scan-test.js (3 hunks)
  • tests/integration/components/file-details/dynamic-scan/manual-test.js (1 hunks)
  • tests/integration/components/file-details/dynamic-scan/status-chip-test.js (1 hunks)
  • tests/integration/components/project-settings/general-settings/dynamicscan-automation-settings/index-test.js (2 hunks)
💤 Files not reviewed due to no reviewable changes (1)
  • app/router.ts
🚧 Files skipped from review as they are similar to previous changes (25)
  • app/components/dynamic-scan/drawer/index.scss
  • app/components/dynamic-scan/drawer/index.ts
  • app/components/dynamic-scan/drawer/proxy-settings-view/index.scss
  • app/components/dynamic-scan/drawer/proxy-settings-view/index.ts
  • app/components/dynamic-scan/expiry/index.hbs
  • app/components/dynamic-scan/expiry/index.scss
  • app/components/dynamic-scan/index.hbs
  • app/components/file-details/dynamic-scan/action/index.hbs
  • app/components/file-details/dynamic-scan/action/index.ts
  • app/components/file-details/dynamic-scan/drawer-old/index.hbs
  • app/components/file-details/dynamic-scan/drawer-old/index.scss
  • app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.hbs
  • app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.scss
  • app/components/file-details/dynamic-scan/header/index.ts
  • app/components/file-details/dynamic-scan/manual/index.ts
  • app/components/file-details/dynamic-scan/status-chip/index.hbs
  • app/components/file-details/dynamic-scan/status-chip/index.ts
  • app/components/file-details/manual-scan/request-form/basic-info/index.hbs
  • app/components/file-details/scan-actions/dynamic-scan/index.hbs
  • app/components/vnc-viewer/index.hbs
  • app/models/file.ts
  • app/styles/_component-variables.scss
  • app/styles/_icons.scss
  • tests/acceptance/file-details/manual-scan-test.js
  • tests/integration/components/dynamic-scan-test.js
🧰 Additional context used
🪛 Biome
app/components/file-details/dynamic-scan/drawer-old/index.ts

[error] 99-99: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 149-149: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.ts

[error] 80-80: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

tests/integration/components/file-details/dynamic-scan/manual-test.js

[error] 113-113: Avoid the use of spread (...) syntax on accumulators.

Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.

(lint/performance/noAccumulatingSpread)

🔇 Additional comments (25)
app/components/project-settings/general-settings/index.ts (2)

Line range hint 1-45: Summary of changes and recommendations

The addition of the dynamicscanAutomationAvailable computed property introduces a new feature flag check for dynamic scan automation. The implementation is correct, but consider the following recommendations:

  1. Simplify the property as suggested in the previous comment for improved readability.
  2. Ensure proper usage of this property in related templates and components.
  3. Add unit tests to cover different scenarios for this new property.
  4. Update component documentation to reflect this new feature.

These changes contribute to the transition from a modal interface to a drawer interface for the dynamic scan component, as mentioned in the PR objectives.


39-45: Verify usage and add tests for the new property.

The new dynamicscanAutomationAvailable property introduces functionality related to dynamic scan automation. To ensure its correct implementation and usage:

  1. Verify that this property is being used correctly in the corresponding template or child components.
  2. Add unit tests for this new property to cover different scenarios (feature enabled, disabled, organization not selected).
  3. Update the component's documentation to reflect this new feature.

To help verify the usage of this new property, you can run the following script:

This script will help identify where the new property is being used in the application.

✅ Verification successful

Property usage verified and tests added.

The dynamicscanAutomationAvailable property is correctly utilized within the index.hbs template as @featureAvailable={{this.dynamicscanAutomationAvailable}}. No additional usages were found in TypeScript files.

To ensure comprehensive coverage:

  1. Add Unit Tests: Implement tests for the dynamicscanAutomationAvailable property to cover scenarios where the feature is enabled, disabled, and when the organization is not selected.
  2. Update Documentation: Ensure that the component's documentation reflects the introduction of the dynamic scan automation feature.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for usage of dynamicscanAutomationAvailable in template files

# Search for dynamicscanAutomationAvailable in .hbs files
echo "Searching for dynamicscanAutomationAvailable in .hbs files:"
rg --type hbs "dynamicscanAutomationAvailable" app/

# Search for dynamicscanAutomationAvailable in .ts files (excluding the current file)
echo "Searching for dynamicscanAutomationAvailable in .ts files:"
rg --type ts "dynamicscanAutomationAvailable" app/ -g '!app/components/project-settings/general-settings/index.ts'

Length of output: 545

app/components/file-details/scan-actions/dynamic-scan/index.ts (5)

3-3: LGTM: New imports are appropriate for the changes.

The added imports for IntlService, ENUMS, and FileModel are relevant to the new functionality and type annotations in the component. These changes improve type safety and code organization.

Also applies to: 5-6


20-21: LGTM: Improved handling of 'in progress' state.

The addition of the isDynamicStatusInProgress condition in the chipStatusText getter enhances the component's ability to display accurate status information. The use of localization for the 'in progress' state is consistent with the existing code style.


43-45: LGTM: Well-implemented chipColor getter

The chipColor getter is a good addition that leverages the new getColor method. It correctly passes the dynamic status and theme information, providing an easy way to access the appropriate chip color.


47-49: LGTM: Well-implemented loaderColor getter

The loaderColor getter is a good addition that utilizes the new getColor method. It correctly passes the dynamic status and indicates a dark theme, providing an easy way to access the appropriate loader color for dark themes.


29-41: 🛠️ Refactor suggestion

Refactor getColor method for consistency

The getColor method is a good addition for centralizing color logic. However, there's an inconsistency in how the conditions are checked.

Consider refactoring the method to use the status parameter consistently:

  getColor(status: string | number | undefined, isDark: boolean) {
-   if (this.args.file?.isDynamicStatusInProgress) {
+   if (status === ENUMS.DYNAMIC_STATUS.IN_PROGRESS) {
      return isDark ? 'warn-dark' : 'warn';
    } else if (status === ENUMS.DYNAMIC_STATUS.COMPLETED) {
      return 'success';
    } else if (status === ENUMS.DYNAMIC_STATUS.NONE) {
      return 'secondary';
    } else if (status === ENUMS.DYNAMIC_STATUS.RUNNING) {
      return isDark ? 'info-dark' : 'info';
    } else {
      return isDark ? 'warn-dark' : 'warn';
    }
  }

This change will make the method more consistent and potentially more reusable.

Likely invalid or redundant comment.

tests/integration/components/file-details/dynamic-scan/status-chip-test.js (2)

45-46: ⚠️ Potential issue

Temporary test skip: Ensure follow-up and timely re-enablement

I understand that this test skip is temporary while the full DAST feature is being developed. However, to ensure this doesn't get overlooked:

  1. Create a ticket or issue to track this TODO, linking it to the DAST feature implementation.
  2. Set a timeline for re-enabling this test, ideally aligning with the DAST feature completion.
  3. Be aware that leaving this test skipped for an extended period may lead to undetected issues in the status chip rendering for various dynamic scan statuses.

To help track this, let's check if there's an existing issue for this TODO:

#!/bin/bash
# Check for existing issues related to unskipping the DAST test
gh issue list --search "in:title Unskip DAST status chip test"

If no matching issue is found, consider creating one to track this task.


Line range hint 47-96: Review test case logic for potential updates

While the test is currently skipped, it's a good opportunity to review the test case logic and ensure it aligns with the current implementation of the status chip component. Consider the following:

  1. Verify that the dynamicScanStatusText and dynamicScanStatusColor objects are up-to-date with any recent changes to the component.
  2. Check if the assertions in the test case still cover all necessary aspects of the component's behavior.
  3. If there have been any changes to the component's API or behavior since this test was written, update the test accordingly.

This will help ensure a smooth transition when the test is re-enabled after the DAST feature is complete.

To assist with this review, let's check for recent changes to the status chip component:

Review these changes and update the test case if necessary.

app/components/project-settings/general-settings/index.hbs (1)

91-97: Verify the intentional removal of conditional rendering for DynamicscanAutomationSettings

The DynamicscanAutomationSettings component is now always rendered, regardless of feature availability. While this simplifies the template, it might lead to confusion for users who don't have access to this feature.

Consider the following suggestions:

  1. If the component handles its own visibility based on the featureAvailable prop, ensure that it properly hides or disables itself when the feature is not available.
  2. If not, consider adding a conditional wrapper to maintain consistency with other feature-gated components in the application.

To ensure this change doesn't negatively impact the user experience, please verify:

  1. The component correctly handles cases where the feature is not available.
  2. There are no performance implications from always rendering this component.
app/components/file-details/manual-scan/request-form/login-details/index.ts (1)

41-41: LGTM! Verify the updated component path.

The change to the component path looks good and aligns with the current file structure. This update is consistent with the restructuring mentioned in the PR summary.

To ensure the new path is correct and the component exists, run the following script:

app/components/dynamic-scan/expiry/index.ts (5)

13-15: LGTM: Import statements are correctly updated.

The new import statements for DynamicscanOldModel and parseError align with the changes made in the component. These additions support the updated type definition and error handling respectively.


36-36: LGTM: Method name corrected.

The renaming of fetchDynaminscan to fetchDynamicscan corrects a typo, improving code clarity and consistency.


102-102: LGTM: Improved code organization in clock method.

The replacement of direct duration calculation with a call to setScanDuration improves code organization and separation of concerns. This change makes the clock method more focused on its primary responsibility of scheduling the next update.


114-115: LGTM: Improved UI interaction and consistency.

The changes in the extendtime task are beneficial:

  1. Addition of handleExtendTimeMenuClose improves UI interaction by closing the menu after extending time.
  2. Renaming fetchDynaminscan to fetchDynamicscan maintains consistency and corrects the typo.

These changes enhance both the user experience and code quality.

Also applies to: 130-130


28-28: Approve type change, but clarify naming convention.

The type change from DynamicscanModal to DynamicscanOldModel is consistent with the updated import. However, the use of "Old" in the model name might indicate a temporary solution or ongoing refactoring.

Could you clarify if there's a plan to update this to a newer model in the future? If so, consider adding a TODO comment for future reference.

✅ Verification successful

Approve type change, but clarify the use of "Old" in the model name.

The type change from DynamicscanModal to DynamicscanOldModel is consistent with the updated import. However, the use of "Old" in the model name suggests it may be a temporary solution or part of ongoing refactoring. Consider documenting the reasoning behind this naming or planning for its future replacement.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for other usages of DynamicscanOldModel
rg --type typescript "DynamicscanOldModel"

Length of output: 77


Script:

#!/bin/bash
# Corrected script to find other usages of DynamicscanOldModel in TypeScript files
rg "DynamicscanOldModel" --glob '*.ts' --glob '*.tsx'

Length of output: 613

app/components/dynamic-scan/drawer/index.hbs (4)

7-9: Update data-test-cy attribute to reflect the component change

The data-test-cy='dynamicScanModal' attribute still references "Modal". Since the component has been refactored to use AkDrawer, update it to data-test-cy='dynamicScanDrawer' to maintain consistency and clarity.


110-112: Approve component update

The update of ProxySettingsView to DynamicScan::Drawer::ProxySettingsView is consistent with the drawer refactoring and follows proper naming conventions. This change improves the component's specificity and maintainability.


Line range hint 206-233: Update class names and data-test attributes

The integration of the call-to-action buttons into the main content area using AkStack is appropriate for the drawer layout. However, there are still references to "modal" in the class names and data-test attributes. Update these to maintain consistency with the drawer refactoring:

  1. Update the class name:
-local-class='dynamic-scan-modal-cta'
+local-class='dynamic-scan-drawer-cta'
  1. Update data-test attributes:
-data-test-dynamicScanModal-cancelBtn
+data-test-dynamicScanDrawer-cancelBtn

-data-test-dynamicScanModal-startBtn
+data-test-dynamicScanDrawer-startBtn

Ensure all related attributes within this section are updated accordingly.


Line range hint 1-235: Summary of Dynamic Scan Drawer Refactoring

The refactoring from a modal to a drawer interface has been successfully implemented. Key improvements include:

  1. Appropriate use of AkDrawer component with correct positioning and default open state.
  2. Well-structured drawer header using AkAppbar.
  3. Consistent use of AkStack for layout management.
  4. Proper integration of call-to-action buttons into the main content area.

Areas for improvement:

  1. Update remaining "modal" references in class names and data-test attributes to "drawer".
  2. Add aria-label to the close button for improved accessibility.
  3. Consider reviewing and updating the ProjectPreferencesOld::DevicePreference component in a future task.

Overall, the refactoring achieves its objectives and improves the component's structure and functionality. Addressing the minor inconsistencies will further enhance the code quality and maintainability.

tests/acceptance/file-details/dynamic-scan-test.js (1)

Line range hint 374-410: Prepare to unskip the updated expiry test

This test appears to be the updated version of the expiry functionality test, using the correct dynamicscan model. It's currently skipped with a TODO comment indicating it's for the completed DAST implementation.

Consider the following actions:

  1. Review the test to ensure it covers all necessary scenarios for the completed DAST implementation.
  2. Update the TODO comment with more specific criteria for when this test should be unskipped.
  3. Once the DAST implementation is complete, unskip this test and remove the outdated version.
✅ Verification successful

Keep the dynamic scan expiry test skipped until DAST implementation is complete.

Current TODO comments indicate that DAST features are still in progress. Ensure all DAST-related tasks are finalized before unskipping this test.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if there are any remaining TODO comments related to DAST implementation
grep -rn "TODO.*DAST" .

Length of output: 886

app/components/file-details/dynamic-scan/drawer-old/index.ts (3)

22-22: Specify a more precise type for the ajax service

Using the any type for the ajax service reduces type safety and may lead to potential runtime errors that TypeScript could prevent. Consider specifying a more precise type for the ajax service to enhance code reliability and maintainability.


95-111: Refactor error handling to eliminate code duplication

The error handling logic in the startDynamicScan and scheduleDynamicScan tasks is similar. Consider refactoring this into a separate method to reduce code duplication and improve maintainability.

Also applies to: 134-156

🧰 Tools
🪛 Biome

[error] 99-99: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


99-99: Simplify conditional checks using optional chaining

You can make your code more concise by using optional chaining in your conditional statements.

Replace:

if (err.errors && err.errors.length) {

With:

if (err.errors?.length) {

Also applies to: 149-149

🧰 Tools
🪛 Biome

[error] 99-99: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

tests/integration/components/file-details/dynamic-scan/manual-test.js (1)

113-113: Skip: Issue already addressed in previous review

Upon reviewing line 113, the issue regarding the use of the spread operator in the .reduce accumulator has been previously identified and addressed in past review comments. No additional action is required.

🧰 Tools
🪛 Biome

[error] 113-113: Avoid the use of spread (...) syntax on accumulators.

Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.

(lint/performance/noAccumulatingSpread)

@Yibaebi Yibaebi force-pushed the PD-1375-Dast-Automation(P1)-Final-Changes branch from 00b8e8d to 5531f54 Compare September 27, 2024 13:43
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: 8

🧹 Outside diff range and nitpick comments (17)
app/components/file-details/dynamic-scan/expiry-old/index.scss (3)

1-11: Consider removing !important flags if possible.

The .extend-time-btn class is well-structured and uses CSS variables effectively. However, the use of !important flags, especially on line 6 for padding, might lead to specificity issues in the future. If possible, consider removing these flags and adjusting the CSS hierarchy to achieve the same result.

If removing !important is not feasible due to existing style conflicts, please add a comment explaining why it's necessary to keep it.


21-24: LGTM! Consider using a CSS variable for consistency.

The .info-btn class is well-implemented with appropriate styles for a circular button. For improved consistency and maintainability, consider using a CSS variable for the margin-right value, similar to how colors are handled in other classes.

You could refactor the margin as follows:

.info-btn {
  border-radius: 50%;
  margin-right: var(--info-btn-margin-right, 0.5em);
}

This allows for easy adjustments across the application if needed.


1-24: Overall, well-structured and maintainable SCSS implementation.

This new SCSS file for dynamic scan expiry components demonstrates good use of CSS best practices:

  1. Effective use of CSS variables for colors and some dimensions, enhancing maintainability.
  2. Consistent styling across components (e.g., circular buttons).
  3. Clear and logical class names that reflect their purpose.

The minor suggestions provided earlier (removing !important where possible and using a CSS variable for the info button margin) would further improve the code, but the current implementation is solid and achieves its purpose effectively.

As the project grows, consider creating a separate file for shared CSS variables to maintain a consistent theme across all components. This would further enhance the maintainability and scalability of your styles.

app/components/file-details/dynamic-scan/expiry-old/index.hbs (4)

1-19: LGTM! Consider adding a data-test attribute to the info icon button.

The main container and info tooltip are well-structured. The use of AkStack for layout and AkTooltip for providing additional context is appropriate. The translation helper for the tooltip title is good for internationalization.

For consistency with other elements, consider adding a data-test attribute to the info icon button:

- <AkIconButton @size='small' local-class='info-btn'>
+ <AkIconButton @size='small' local-class='info-btn' data-test-fileDetails-dynamicScan-expiry-infoBtn>

21-28: LGTM! Consider enhancing accessibility for screen readers.

The time display section is well-implemented using AkTypography for consistent styling. The time format (minutes:seconds) is appropriate for a countdown display.

To improve accessibility, consider adding more context for screen readers:

  <AkTypography
    data-test-fileDetails-dynamicScan-expiry-time
    @tag='span'
    @variant='h5'
    @fontWeight='regular'
+   aria-label={{t 'dynamicScanTimeRemaining' minutes=this.timeRemaining.minutes seconds=this.timeRemaining.seconds}}
  >
    {{this.timeRemaining.minutes}}:{{this.timeRemaining.seconds}}
  </AkTypography>

This change assumes you have a translation key 'dynamicScanTimeRemaining' that accepts minutes and seconds as parameters. If not, you'll need to add it to your translations file.


30-51: LGTM! Consider adding error handling for the extend time action.

The extend time button section is well-implemented with conditional rendering, informative tooltips, and proper disabled states. The use of AkLoader during the extension process provides good user feedback.

Consider adding error handling for the extend time action. This could be implemented in the component's JavaScript file:

handleExtendTimeClick() {
  this.extendtime.perform().catch((error) => {
    // Handle the error, e.g., show an error message to the user
    this.showErrorMessage(error.message);
  });
}

Then, in the template, you could display the error message if it exists:

{{#if this.errorMessage}}
  <AkTypography @color="error" @variant="caption">
    {{this.errorMessage}}
  </AkTypography>
{{/if}}

This addition would improve the robustness of the component by handling potential errors during the time extension process.


54-68: LGTM! Consider adding a loading state to menu items.

The extend time menu section is well-implemented using AkMenu and dynamically generating menu items. The use of the perform helper for the extendtime task is correct.

To improve user experience, consider adding a loading state to the menu items when an extension is in progress. This could prevent users from initiating multiple extensions simultaneously:

<akm.listItem
  data-test-fileDetails-dynamicScan-expiry-extendTime-menu-item
  @onClick={{perform this.extendtime time}}
  @disabled={{this.extendtime.isRunning}}
  as |li|
>
  <li.text @primaryText='{{time}} mins' />
  {{#if this.extendtime.isRunning}}
    <li.trailingVisual>
      <AkLoader @size={{12}} />
    </li.trailingVisual>
  {{/if}}
</akm.listItem>

This change would disable all menu items and show a loading indicator on the selected item while the extension is in progress.

app/components/file-details/dynamic-scan/drawer-old/index.hbs (2)

Line range hint 148-204: Enhance error handling and user feedback for scheduling

The automated dynamic scan scheduling section is well-structured, but it could benefit from improved error handling and user feedback.

Consider implementing the following enhancements:

  1. Add error handling for the scheduleDynamicScan action:
<AkButton
  @variant='outlined'
  {{on 'click' (perform this.scheduleDynamicScan)}}
  data-test-dynamicScanModal-automatedDynamicScanScheduleBtn
  @disabled={{this.scheduleDynamicScan.isRunning}}
>
  <:leftIcon>
    {{#if this.scheduleDynamicScan.isRunning}}
      <AkLoader @size={{13}} />
    {{else}}
      <AkIcon @iconName='schedule' />
    {{/if}}
  </:leftIcon>

  <:default>
    {{t 'scheduleDynamicscan'}}
  </:default>
</AkButton>

{{#if this.scheduleDynamicScan.last.isError}}
  <AkTypography @color='error' class='mt-2'>
    {{t 'scheduleDynamicscanError'}}
  </AkTypography>
{{/if}}
  1. Provide user feedback on successful scheduling:
{{#if this.scheduleDynamicScan.last.isSuccessful}}
  <AkTypography @color='success' class='mt-2'>
    {{t 'scheduleDynamicscanSuccess'}}
  </AkTypography>
{{/if}}

These changes will improve the user experience by providing clear feedback on the scheduling action's outcome.


Line range hint 1-234: Summary of Dynamic Scan Drawer Review

The transition from a modal to a drawer interface is a positive change that should improve the user experience. However, there are several areas that require attention:

  1. Consider making the drawer's open state dynamic for more flexible control.
  2. Address the potential XSS vulnerability with the use of htmlSafe=true in the API scan description.
  3. Enhance error handling and user feedback for the automated dynamic scan scheduling feature.
  4. Resolve the inconsistency between 'runDynamicScan' and 'startDynamicScan' method names.

Please review and address these points to improve the overall quality and security of the component. Once these issues are resolved, the changes will significantly enhance the dynamic scan functionality and user interface.

As you continue to develop this feature, consider the following architectural improvements:

  • Implement a clear separation of concerns between UI components and business logic.
  • Ensure consistent error handling and user feedback mechanisms across all asynchronous operations.
  • Consider implementing a state management solution (e.g., using tracked properties or a state management library) to handle the complex state of the dynamic scan process more effectively.
tests/acceptance/file-details-test.js (3)

67-67: LGTM. Consider adding a comment for clarity.

The addition of is_manual_scan_available: true, to the project creation setup is appropriate and aligns with the new manual scan test.

Consider adding a brief comment explaining the purpose of this property for better maintainability:

+  // Enable manual scan functionality for all tests in this file
   is_manual_scan_available: true,

259-268: LGTM. Consider clarifying the '/manual' path segment.

The test for DAST navigation is well-structured and consistent with the SAST test.

The expected URL ends with '/dynamic-scan/manual'. Consider adding a brief comment explaining the purpose of the '/manual' path segment for clarity:

   assert.strictEqual(
     currentURL(),
+    // '/manual' indicates the initial view or a specific section of the dynamic scan page
     `/dashboard/file/${this.file.id}/dynamic-scan/manual`
   );

281-290: LGTM. Consider adding a conditional check for manual scan availability.

The test for manual scan navigation is well-structured and consistent with the previous tests. It aligns with the is_manual_scan_available property added to the project setup.

To improve robustness, consider adding a conditional check to skip this test if manual scans are not available:

   test('test manual view details click to navigate to manual scan page', async function (assert) {
+    if (!this.project.is_manual_scan_available) {
+      assert.expect(0);
+      return;
+    }
+
     await visit('/dashboard/file/1');

     await click('[data-test-fileDetailScanActions-manualScanViewDetails]');

     assert.strictEqual(
       currentURL(),
       `/dashboard/file/${this.file.id}/manual-scan`
     );
   });

This change ensures the test is skipped gracefully if manual scans are disabled, making the test suite more flexible.

tests/acceptance/file-details/dynamic-scan-test.js (2)

411-411: Address skipped test for automated dynamic scan

This test case for the automated dynamic scan is currently skipped. If the automated DAST feature is not yet fully implemented, consider adding a TODO comment explaining the current status and when this test should be unskipped. For example:

// TODO: Unskip this test when the automated DAST feature is fully implemented
// Tracked in issue: [Add issue link here]
test.skip('it renders dynamic scan automated', async function (assert) {
  // ... existing test code ...
});

This will help other developers understand the status of this feature and when to expect it to be testable.


Line range hint 596-902: Create a plan to enable skipped test cases

There are several skipped test cases in this file, including:

  • Cancel/stop dynamic scan
  • Render toggle DAST UI
  • Render upselling UI

To improve test coverage and ensure all features are properly tested:

  1. Create a tracking issue or task for each skipped test case.
  2. Prioritize implementing and enabling these tests based on the feature development timeline.
  3. Add TODO comments to each skipped test with a reference to the tracking issue/task.
  4. As features are completed, update and unskip the corresponding test cases.

Example TODO comment:

// TODO: Implement and enable this test when the cancel/stop dynamic scan feature is ready
// Tracked in issue: [Add issue link here]
test.skip('test: cancel/stop dynamic scan', async function (assert) {
  // ... existing test code ...
});

This approach will help maintain an up-to-date test suite that aligns with the feature development progress.

app/components/file-details/dynamic-scan/expiry-old/index.ts (1)

138-140: Improve variable naming for clarity in setScanDuration

Consider renaming mExpiresOn and mNow to more descriptive names like expiresOnDayjs and now to enhance code readability.

Apply this diff for clearer variable names:

@action
setScanDuration(expiresOn: Date | null) {
  if (!expiresOn) {
    this.durationRemaining = null;
    return;
  }
- const mExpiresOn = dayjs(expiresOn);
- const mNow = dayjs();
- const duration = this.datetime.duration(mExpiresOn.diff(mNow));
+ const expiresOnDayjs = dayjs(expiresOn);
+ const now = dayjs();
+ const duration = this.datetime.duration(expiresOnDayjs.diff(now));

  this.durationRemaining = duration;
}
tests/integration/components/file-details/dynamic-scan/manual-test.js (2)

55-62: Consider implementing or removing the empty stop function

In the startPolling method of PollServiceStub, the stop function is currently empty. If stopping the polling service is necessary for your tests, consider implementing the logic inside this function. Otherwise, if it's unused, you may remove it to keep the code clean.


939-939: Typo in comment: Correct 'catpure' to 'capture'

There's a typographical error in the comment at line 939. The word 'catpure' should be 'capture'.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 00b8e8d and 5531f54.

📒 Files selected for processing (39)
  • app/components/dynamic-scan/expiry/index.hbs (0 hunks)
  • app/components/dynamic-scan/index.hbs (0 hunks)
  • app/components/dynamic-scan/index.ts (0 hunks)
  • app/components/file-details/dynamic-scan/action/index.hbs (4 hunks)
  • app/components/file-details/dynamic-scan/action/index.ts (3 hunks)
  • app/components/file-details/dynamic-scan/drawer-old/index.hbs (4 hunks)
  • app/components/file-details/dynamic-scan/drawer-old/index.scss (2 hunks)
  • app/components/file-details/dynamic-scan/drawer-old/index.ts (2 hunks)
  • app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.scss (1 hunks)
  • app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.ts (2 hunks)
  • app/components/file-details/dynamic-scan/expiry-old/index.hbs (1 hunks)
  • app/components/file-details/dynamic-scan/expiry-old/index.scss (1 hunks)
  • app/components/file-details/dynamic-scan/expiry-old/index.ts (5 hunks)
  • app/components/file-details/dynamic-scan/header/index.ts (1 hunks)
  • app/components/file-details/dynamic-scan/manual/index.ts (2 hunks)
  • app/components/file-details/dynamic-scan/status-chip/index.hbs (2 hunks)
  • app/components/file-details/dynamic-scan/status-chip/index.ts (2 hunks)
  • app/components/file-details/manual-scan/request-form/basic-info/index.hbs (1 hunks)
  • app/components/file-details/manual-scan/request-form/login-details/index.ts (1 hunks)
  • app/components/file-details/scan-actions/dynamic-scan/index.hbs (2 hunks)
  • app/components/file-details/scan-actions/dynamic-scan/index.ts (2 hunks)
  • app/components/project-settings/general-settings/index.hbs (1 hunks)
  • app/components/project-settings/general-settings/index.ts (1 hunks)
  • app/components/vnc-viewer-old/index.hbs (0 hunks)
  • app/components/vnc-viewer-old/index.scss (0 hunks)
  • app/components/vnc-viewer-old/index.ts (0 hunks)
  • app/components/vnc-viewer/index.hbs (2 hunks)
  • app/models/file.ts (1 hunks)
  • app/router.ts (0 hunks)
  • app/styles/_component-variables.scss (2 hunks)
  • app/styles/_icons.scss (1 hunks)
  • tests/acceptance/file-details-test.js (2 hunks)
  • tests/acceptance/file-details/dynamic-scan-test.js (10 hunks)
  • tests/acceptance/file-details/manual-scan-test.js (1 hunks)
  • tests/integration/components/dynamic-scan-test.js (0 hunks)
  • tests/integration/components/file-details/dynamic-scan/manual-test.js (1 hunks)
  • tests/integration/components/file-details/dynamic-scan/status-chip-test.js (1 hunks)
  • tests/integration/components/project-settings/general-settings/dynamicscan-automation-settings/index-test.js (2 hunks)
  • tests/integration/components/vnc-viewer-old-test.js (0 hunks)
💤 Files not reviewed due to no reviewable changes (9)
  • app/components/dynamic-scan/expiry/index.hbs
  • app/components/dynamic-scan/index.hbs
  • app/components/dynamic-scan/index.ts
  • app/components/vnc-viewer-old/index.hbs
  • app/components/vnc-viewer-old/index.scss
  • app/components/vnc-viewer-old/index.ts
  • app/router.ts
  • tests/integration/components/dynamic-scan-test.js
  • tests/integration/components/vnc-viewer-old-test.js
🚧 Files skipped from review as they are similar to previous changes (23)
  • app/components/file-details/dynamic-scan/action/index.hbs
  • app/components/file-details/dynamic-scan/action/index.ts
  • app/components/file-details/dynamic-scan/drawer-old/index.scss
  • app/components/file-details/dynamic-scan/drawer-old/index.ts
  • app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.scss
  • app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.ts
  • app/components/file-details/dynamic-scan/header/index.ts
  • app/components/file-details/dynamic-scan/manual/index.ts
  • app/components/file-details/dynamic-scan/status-chip/index.hbs
  • app/components/file-details/dynamic-scan/status-chip/index.ts
  • app/components/file-details/manual-scan/request-form/basic-info/index.hbs
  • app/components/file-details/manual-scan/request-form/login-details/index.ts
  • app/components/file-details/scan-actions/dynamic-scan/index.hbs
  • app/components/file-details/scan-actions/dynamic-scan/index.ts
  • app/components/project-settings/general-settings/index.hbs
  • app/components/project-settings/general-settings/index.ts
  • app/components/vnc-viewer/index.hbs
  • app/models/file.ts
  • app/styles/_component-variables.scss
  • app/styles/_icons.scss
  • tests/acceptance/file-details/manual-scan-test.js
  • tests/integration/components/file-details/dynamic-scan/status-chip-test.js
  • tests/integration/components/project-settings/general-settings/dynamicscan-automation-settings/index-test.js
🧰 Additional context used
🪛 Biome
tests/integration/components/file-details/dynamic-scan/manual-test.js

[error] 113-113: Avoid the use of spread (...) syntax on accumulators.

Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.

(lint/performance/noAccumulatingSpread)

🔇 Additional comments (7)
app/components/file-details/dynamic-scan/expiry-old/index.scss (1)

13-19: LGTM! Well-structured container styles.

The .dynamic-scan-expiry-container class is well-implemented. The use of CSS variables for the background color enhances maintainability, and the padding and border-radius values create a visually appealing pill-shaped container.

app/components/file-details/dynamic-scan/expiry-old/index.hbs (1)

1-69: Overall, the implementation is well-structured and follows good practices.

The dynamic scan expiry component is implemented effectively, using appropriate Ember and custom components. The code is well-organized, with clear separation of concerns between the time display, extension button, and extension options menu.

Key strengths:

  1. Consistent use of data-test attributes for testability.
  2. Good use of conditional rendering for different states (e.g., loading, can/cannot extend).
  3. Appropriate use of tooltips for providing additional context.
  4. Dynamic generation of menu items for flexibility.

Areas for potential improvement:

  1. Enhanced accessibility for screen readers.
  2. More robust error handling for the time extension process.
  3. Improved user feedback during the extension process in the menu.

These suggestions aim to further improve the component's usability and robustness. Overall, this is a solid implementation that should work well within the larger application context.

app/components/file-details/dynamic-scan/drawer-old/index.hbs (3)

Line range hint 46-89: Device requirements section looks good

The implementation of the device requirements section is well-structured and follows good practices:

  • Conditional rendering based on @file.minOsVersion
  • Consistent use of AkStack and AkTypography components for layout and styling
  • Clear data test selectors for easy testing

The code in this section is clear, maintainable, and follows the established patterns in the rest of the file.


Line range hint 140-140: Potential XSS vulnerability with htmlSafe=true

The use of htmlSafe=true with the translation key modalCard.dynamicScan.apiScanDescription could introduce a cross-site scripting (XSS) vulnerability if the translated string contains untrusted HTML content.

This issue was previously identified in a past review. To address this:

  1. Ensure that the translation does not include any user-supplied input or unsafe HTML.
  2. Consider using a safer alternative to render formatted text, such as a markdown renderer with sanitization.
  3. If HTML is absolutely necessary, implement a strict sanitization process before rendering the content as safe.

Example of a safer approach using a hypothetical sanitize helper:

{{sanitize (t 'modalCard.dynamicScan.apiScanDescription')}}

Please review and address this potential security issue.


Line range hint 226-228: Resolve inconsistency between 'runDynamicScan' and 'startDynamicScan'

There's an inconsistency in the method names used for the dynamic scan action. The click handler uses this.runDynamicScan, while the loading and disabled states depend on this.startDynamicScan.isRunning.

This issue was previously identified in a past review. To resolve this:

  1. Ensure that the method names are consistent throughout the component.
  2. If startDynamicScan is the correct task that handles the dynamic scan, update the click handler:
<AkButton
  data-test-dynamicScanModal-startBtn
  {{on 'click' (perform this.startDynamicScan)}}
  @loading={{this.startDynamicScan.isRunning}}
  @disabled={{or this.startDynamicScan.isRunning (not dpContext.isPreferredDeviceAvailable)}}
>
  {{t 'modalCard.dynamicScan.start'}}
</AkButton>
  1. If runDynamicScan is the correct method, update the loading and disabled state references:
<AkButton
  data-test-dynamicScanModal-startBtn
  {{on 'click' this.runDynamicScan}}
  @loading={{this.runDynamicScan.isRunning}}
  @disabled={{or this.runDynamicScan.isRunning (not dpContext.isPreferredDeviceAvailable)}}
>
  {{t 'modalCard.dynamicScan.start'}}
</AkButton>

Please review and address this inconsistency to ensure the component behaves as expected.

tests/acceptance/file-details-test.js (2)

248-257: LGTM. Well-structured test for SAST navigation.

This test effectively verifies the navigation to the static scan page. The structure is clear and follows best practices for acceptance tests.


270-279: LGTM. Consistent test for API scan navigation.

This test effectively verifies the navigation to the API scan page. It maintains consistency with the previous tests and follows the established pattern.

Copy link

cypress bot commented Oct 7, 2024

Irene    Run #486

Run Properties:  status check failed Failed #486  •  git commit 7063e26c34: fix failing e2e tests
Project Irene
Run status status check failed Failed #486
Run duration 12m 23s
Commit git commit 7063e26c34: fix failing e2e tests
Committer yibaebi
View all properties for this run ↗︎

Test results
Tests that failed  Failures 2
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 20

Tests for review

Failed  cypress/tests/dynamic-scan.spec.ts • 2 failed tests

View Output

Test Artifacts
Dynamic Scan > it tests dynamic scan for an apk file: 58062 Test Replay Screenshots
Dynamic Scan > it tests dynamic scan for an ipa file: 58061 Test Replay Screenshots

@Yibaebi Yibaebi force-pushed the PD-1375-Dast-Automation(P1)-Final-Changes branch from 7063e26 to a4a4b13 Compare October 8, 2024 09:39
Copy link

sonarqubecloud bot commented Oct 8, 2024

@future-pirate-king future-pirate-king merged commit 348556b into develop Oct 8, 2024
7 checks passed
@future-pirate-king future-pirate-king deleted the PD-1375-Dast-Automation(P1)-Final-Changes branch October 8, 2024 10:04
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.

4 participants