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

feat: impact not updated when quick presets are updated (#2014) #2027

Merged

Conversation

stolpeo
Copy link
Contributor

@stolpeo stolpeo commented Oct 14, 2024

Summary by CodeRabbit

  • New Features

    • Enhanced initialization of components with the addition of projectUuid prop for better context handling.
    • New inheritance field added to presets creation for improved data structure.
  • Bug Fixes

    • Updated computed properties to ensure valid updates only occur with truthy values.
  • Documentation

    • Improved prop usage in the QueryPresets component for clarity.

@stolpeo stolpeo linked an issue Oct 14, 2024 that may be closed by this pull request
Copy link
Contributor

coderabbitai bot commented Oct 14, 2024

Walkthrough

This pull request includes updates to several components within the frontend of the application. The reev-frontend-lib subproject reference has been updated to a new commit. The CaseList.vue component now utilizes the onMounted lifecycle hook to initialize the store with a project UUID. Changes in QuickPresets.vue and QueryPresets.vue involve modifications to computed properties and the addition of a new prop, respectively. The SetEditor.vue component has also been updated to include an inheritance field in its payload structure.

Changes

File Path Change Summary
frontend/ext/reev-frontend-lib Subproject commit reference updated from 74df3b985bf... to b190d200262....
frontend/src/cases/views/CaseList/CaseList.vue Added onMounted lifecycle hook to initialize caseListStore with projectUuid. Updated QueryPresets prop usage.
frontend/src/variants/components/FilterForm/QuickPresets.vue Updated computed properties inheritanceWrapper and qualityWrapper to check for truthy newValue.
frontend/src/variants/components/QueryPresets.vue Added projectUuid prop, updated initialization to use props.projectUuid, and removed import for useCaseListStore.
frontend/src/variants/components/QueryPresets/SetEditor.vue Updated payload structure in handleAddClicked method to include inheritance: null for presets.

Possibly related issues

🐰 In the meadow, changes bloom,
With projectUuid, we make room.
Quick presets now adjust with glee,
As inheritance joins the spree.
A hop, a jump, all systems go,
In the code, new wonders flow! 🌼✨


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

deps-report 🔍

Commit scanned: 55f6665
ℹ️ Python version 3.10 is used by your project but the latest version is 3.13.

Vulnerable dependencies

4 dependencies have vulnerabilities 😱
Dependency Advisory Versions impacted
djangorestframework (transitive) Affected versions of the package djangorestframework are vulnerable to Cross-site Scripting (XSS) via the break_long_headers template filter due to improper input sanitization before splitting and joining with
tags.
<3.15.2
jinja2 (transitive) In Jinja2, the from_string function is prone to Server Side Template Injection (SSTI) where it takes the source parameter as a template object, renders it, and then returns it. The attacker can exploit it with INJECTION COMMANDS in a URI. NOTE: The maintainer and multiple third parties believe that this vulnerability isn't valid because users shouldn't use untrusted templates without sandboxing. >=0
setuptools (transitive) Affected versions of Setuptools allow for remote code execution via its download functions. These functions, which are used to download packages from URLs provided by users or retrieved from package index servers, are susceptible to code injection. If these functions are exposed to user-controlled inputs, such as package URLs, they can execute arbitrary commands on the system. <70.0.0
sqlalchemy Sqlalchemy 2.0.0b1 avoids leaking cleartext passwords to the open for careless uses of str(engine.URL()) in logs and prints. sqlalchemy/sqlalchemy#8563 <2.0.0b1

Outdated dependencies

46 outdated dependencies found (including 19 outdated major versions)😢
Dependency Installed version Latest version
alabaster (transitive) 0.7.16 1.0.0
argon2-cffi (transitive) 21.3.0 23.1.0
billiard (transitive) 3.6.4.0 4.2.1
crispy-bootstrap4 (transitive) 2022.1 2024.10
django 3.2.25 5.1.2
django-model-utils (transitive) 4.3.1 5.0.0
django-rest-knox (transitive) 4.2.0 5.0.2
django-sodar-core 0.13.4 1.0.2
jsonschema-specifications (transitive) 2023.12.1 2024.10.1
markupsafe (transitive) 2.1.5 3.0.1
mistune (transitive) 2.0.5 3.0.2
packaging (transitive) 23.2 24.1
protobuf 3.20.3 5.28.2
setuptools (transitive) 67.6.1 75.1.0
sphinx (transitive) 6.2.1 8.1.3
sphinx-rtd-theme (transitive) 1.2.2 3.0.1
sqlalchemy 1.4.54 2.0.35
unidecode (transitive) 0.4.21 1.3.8
xmlschema (transitive) 2.5.1 3.4.2
Dependency Installed version Latest version
aiobotocore (transitive) 2.15.1 2.15.2
aiohttp (transitive) 3.10.9 3.10.10
anyio (transitive) 4.6.0 4.6.2
botocore (transitive) 1.35.23 1.35.39
celery (transitive) 5.2.7 5.4.0
charset-normalizer (transitive) 3.3.2 3.4.0
coverage (dev,transitive) 7.6.1 7.6.3
django-autocomplete-light (transitive) 3.9.4 3.11.0
django-crispy-forms (transitive) 2.0 2.3
django-db-file-storage (transitive) 0.5.5 0.5.6.1
django-debug-toolbar 4.3.0 4.4.6
django-environ (transitive) 0.10.0 0.11.2
django-iconify (transitive) 0.1.1 0.4
django-plugins-bihealth 0.4.0 0.5.2
django-postgres-copy 2.3.7 2.7.6
djangorestframework (transitive) 3.14.0 3.15.2
docutils (transitive) 0.18.1 0.21.2
drf-keyed-list-bihealth 0.1.1 0.2.1
markdown (transitive) 3.4.1 3.7
mypy-protobuf (dev) 3.3.0 3.6.0
pydantic-core (transitive) 2.23.4 2.24.1
requests-http-signature 0.2.0 0.7.1
rules (transitive) 3.3 3.5
versioneer (transitive) 0.28 0.29
wheel (transitive) 0.40.0 0.44.0
xmltodict (transitive) 0.13.0 0.14.1
yarl (transitive) 1.13.1 1.15.2

Logs

@stolpeo stolpeo enabled auto-merge (squash) October 14, 2024 09:43
@stolpeo stolpeo merged commit edcc966 into main Oct 14, 2024
16 of 17 checks passed
@stolpeo stolpeo deleted the 2014-impact-not-updated-when-quick-presets-are-updated branch October 14, 2024 09:55
Copy link

codecov bot commented Oct 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91%. Comparing base (0f405f6) to head (55f6665).
Report is 10 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #2027     +/-   ##
=======================================
- Coverage     91%     91%     -1%     
=======================================
  Files        667     674      +7     
  Lines      37986   39168   +1182     
=======================================
+ Hits       34869   35814    +945     
- Misses      3117    3354    +237     

see 12 files with indirect coverage changes

Copy link
Contributor

@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

🧹 Outside diff range and nitpick comments (4)
frontend/src/cases/views/CaseList/CaseList.vue (1)

37-39: LGTM: onMounted hook added for store initialization

The onMounted hook is correctly implemented to initialize the case list store when the component is mounted. The use of async/await is appropriate for handling the asynchronous initialization.

Consider adding error handling to the initialize call:

 onMounted(async () => {
-  await caseListStore.initialize(props.projectUuid)
+  try {
+    await caseListStore.initialize(props.projectUuid)
+  } catch (error) {
+    console.error('Failed to initialize case list store:', error)
+    // Optionally, you can add logic to show an error message to the user
+  }
 })

This will help catch and log any initialization errors, improving the robustness of the component.

frontend/src/variants/components/QueryPresets.vue (2)

25-25: LGTM! Consider adding a default value or making the prop required.

The addition of the projectUuid prop improves the component's reusability. However, to enhance robustness, consider either:

  1. Adding a default value: projectUuid: { type: String, default: '' }
  2. Making the prop required: projectUuid: { type: String, required: true }

This would help prevent potential issues if the prop is not provided.


180-180: LGTM! Consider adding error handling.

The update to use props.projectUuid in the store initialization is correct and aligns with the new prop. To improve robustness, consider adding error handling:

onMounted(async () => {
  try {
    await queryPresetsStore.initialize(props.projectUuid)
  } catch (error) {
    console.error('Failed to initialize queryPresetsStore:', error)
    // Consider showing an error message to the user
  }
})

This will help catch and log any initialization errors, improving debuggability.

frontend/src/variants/components/QueryPresets/SetEditor.vue (1)

253-253: LGTM! Consider adding a comment for clarity.

The addition of the inheritance field to the payload for 'frequencypresets' and 'quickpresets' categories is correct and aligns with the PR objective. This change allows for future handling of inheritance-related data in these preset types.

Consider adding a brief comment explaining the purpose of the inheritance field and why it's initially set to null. This would improve code readability and make it easier for other developers to understand the intent behind this field.

 payload = {
   label,
   frequency: null,
   impact: null,
   quality: null,
   chromosome: null,
   flagsetc: null,
+  // Inheritance field for future use in frequency and quick presets
   inheritance: null,
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between c434bf9 and 55f6665.

📒 Files selected for processing (5)
  • frontend/ext/reev-frontend-lib (1 hunks)
  • frontend/src/cases/views/CaseList/CaseList.vue (4 hunks)
  • frontend/src/variants/components/FilterForm/QuickPresets.vue (3 hunks)
  • frontend/src/variants/components/QueryPresets.vue (2 hunks)
  • frontend/src/variants/components/QueryPresets/SetEditor.vue (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • frontend/ext/reev-frontend-lib
🧰 Additional context used
🔇 Additional comments (8)
frontend/src/cases/views/CaseList/CaseList.vue (3)

4-4: LGTM: Necessary imports added correctly

The new imports for onMounted and useCaseListStore are correctly added and are essential for the component's enhanced functionality.

Also applies to: 10-10


25-26: LGTM: Store initialization added

The caseListStore is correctly initialized using the useCaseListStore composable. This follows Vue 3 composition API best practices.


Line range hint 1-119: Overall assessment: Changes improve component functionality and align with Vue 3 best practices

The modifications to CaseList.vue successfully address the PR objective of updating the impact when quick presets are modified. The changes include:

  1. Adding necessary imports for onMounted and useCaseListStore.
  2. Initializing the case list store.
  3. Implementing an onMounted hook for store initialization.
  4. Updating the QueryPresets component with a new project-uuid prop.

These changes enhance the component's functionality and maintain consistency with Vue 3 composition API best practices. The only suggested improvements are adding error handling to the store initialization and verifying the consistency of QueryPresets usage across the codebase.

frontend/src/variants/components/QueryPresets.vue (1)

Line range hint 1-280: Overall, the changes improve component structure and reusability.

The modifications to this component are well-thought-out and align with best practices:

  1. The addition of the projectUuid prop decouples the component from global state.
  2. Updating the store initialization to use the new prop maintains consistency.

These changes should make the component more reusable and easier to test. The suggestions provided in the previous comments are minor and aimed at further improving robustness and error handling.

frontend/src/variants/components/FilterForm/QuickPresets.vue (4)

Line range hint 118-141: Improved handling of inheritance preset updates

The addition of the condition newValue && newValue !== 'custom' in the inheritanceWrapper setter is a good improvement. This change ensures that the querySettings are only updated when a valid preset is selected, preventing unnecessary updates and potential errors when newValue is falsy or 'custom'.

This modification aligns well with the PR objective of updating the impact when quick presets are modified, as it provides more precise control over when the inheritance settings are applied.


Line range hint 192-201: Consistent improvement in quality preset handling

The addition of the condition newValue && newValue !== 'custom' in the qualityWrapper setter is a good improvement, consistent with the changes made to inheritanceWrapper. This modification ensures that the quality settings are only updated when a valid preset is selected, preventing unnecessary updates and potential errors.

This change contributes to the overall goal of improving the handling of preset updates, ensuring that the impact is correctly updated when quick presets are modified.


Line range hint 254-267: Comprehensive improvement in preset handling across all categories

The addition of the condition newValue && newValue !== 'custom' in the makeWrapper function is an excellent improvement. This change ensures consistent behavior across all preset categories (frequency, impact, flags, chromosomes) created using this function.

By applying this condition, we prevent unnecessary updates and potential errors when newValue is falsy or 'custom' for all these categories. This comprehensive approach significantly contributes to the PR's objective of correctly updating the impact when quick presets are modified.

Great job on maintaining consistency and improving the overall robustness of the preset handling system!


Line range hint 1-500: Summary: Robust improvements in preset handling

The changes made to this component significantly enhance the handling of preset updates across all categories (inheritance, quality, frequency, impact, flags, and chromosomes). By consistently adding the condition newValue && newValue !== 'custom' to all preset setters, the code now prevents unnecessary updates and potential errors when invalid values are provided.

These improvements directly address the PR objective of updating the impact when quick presets are modified. The implementation is consistent and well-thought-out, applying the same logic across different preset types.

Overall, these changes contribute to a more robust and reliable preset system in the application. Great work on improving the code quality and user experience!

@@ -95,7 +103,7 @@ const queueMessage = (message: SnackbarMessage) => {
<CaseListQc />
</div>
<div v-else-if="props.currentTab === Tab.QUERY_PRESETS">
<QueryPresets :preset-set="presetSet" />
<QueryPresets :project-uuid="projectUuid" :preset-set="presetSet" />
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Missing :project-uuid prop in additional QueryPresets component instances

The following instances of the QueryPresets component are missing the :project-uuid prop and should be updated to ensure consistency:

  • frontend/src/variants/components/QueryPresets/SetEditor.vue:

    <QueryPresetsQualityPane :query-settings="selectedPresets" />
  • frontend/src/variants/components/QueryPresets.vue:

    <QueryPresetsSetEditor :preset-set-uuid="presetSet" />
🔗 Analysis chain

LGTM: projectUuid prop added to QueryPresets component

The project-uuid prop has been correctly added to the QueryPresets component, which should allow it to access project-specific data.

To ensure this change is consistent across the codebase, please run the following command to check for any other instances of QueryPresets that might need updating:

This will help identify any other locations where the QueryPresets component is used and might need the project-uuid prop added for consistency.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other usages of QueryPresets component
rg --type vue "QueryPresets" -C 3

Length of output: 61


Script:

#!/bin/bash
# Search for other usages of QueryPresets component in .vue files
rg "QueryPresets" -g "*.vue" -C 3

Length of output: 63203


Script:

#!/bin/bash
# Search for QueryPresets component usages without the :project-uuid prop in .vue files
rg '<QueryPresets[^>]*>' -g "*.vue" | grep -v ':project-uuid'

Length of output: 308

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.

Impact not updated when quick presets are updated
1 participant