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: added API limiting to reduce unnecessary api call for dashboard variables #6609

Merged
merged 4 commits into from
Dec 17, 2024

Conversation

SagarRajput-7
Copy link
Contributor

@SagarRajput-7 SagarRajput-7 commented Dec 10, 2024

Summary

Related Issues / PR's

Screenshots

NA

Affected Areas and Manually Tested Areas


Important

Adds dependency management and API call optimization for dashboard variables in DashboardVariableSelection and VariableItem.

  • Dependency Management:
    • Added buildDependencies, buildDependencyGraph, buildParentDependencyGraph, and onUpdateVariableNode in util.ts to manage variable dependencies.
    • DashboardVariableSelection.tsx initializes and updates dependencyData using these functions.
  • Variable Update Logic:
    • Modified onValueUpdate in DashboardVariableSelection.tsx to handle variable dependencies when updating values.
    • VariableItem.tsx uses validVariableUpdate to determine if a variable update is valid based on dependencies.
  • API Invocation Optimization:
    • Introduced checkAPIInvocation in util.ts to optimize when API calls are made based on variable dependencies.
    • VariableItem.tsx uses this function to conditionally enable API queries.

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

Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@SagarRajput-7 SagarRajput-7 changed the title Limiting api via keys feat: added API limiting to reduce unnecessary api call for dashboard variables Dec 10, 2024
Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@github-actions github-actions bot added the enhancement New feature or request label Dec 10, 2024
@SagarRajput-7 SagarRajput-7 changed the base branch from develop to variable-update-queue December 10, 2024 05:47
@SagarRajput-7 SagarRajput-7 requested a review from a team as a code owner December 10, 2024 05:47
@SagarRajput-7 SagarRajput-7 changed the base branch from variable-update-queue to develop December 10, 2024 05:48
Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@SagarRajput-7 SagarRajput-7 changed the base branch from develop to variable-update-queue December 10, 2024 05:48
Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 421d355 in 35 seconds

More details
  • Looked at 174 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 drafted comments based on config settings.
1. frontend/src/container/NewDashboard/DashboardVariablesSelection/util.ts:4
  • Draft comment:
    Consider enhancing areArraysEqual to handle nested arrays or objects, if applicable, to ensure accurate comparisons.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The function areArraysEqual is used multiple times across the codebase to compare arrays. However, it does not account for cases where the arrays might contain objects or nested arrays. This could lead to incorrect comparisons if such cases arise.
2. frontend/src/container/NewDashboard/DashboardVariablesSelection/util.ts:171
  • Draft comment:
    The check for isEmpty(parentDependencyGraph) is redundant as it is already performed at the start of the function. Consider removing it to simplify the code.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The checkAPIInvocation function has a redundant check for parentDependencyGraph being empty. This check is already performed at the beginning of the function, making the second check unnecessary.
3. frontend/src/container/NewDashboard/DashboardVariablesSelection/VariableItem.tsx:224
  • Draft comment:
    Ensure that checkAPIInvocation is correctly determining when API calls should be made, as it is crucial for performance optimization.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The checkAPIInvocation function is used in multiple places, and its logic is crucial for determining when API calls should be made. Ensuring its correctness and efficiency is important for performance.
4. frontend/src/container/NewDashboard/DashboardVariablesSelection/VariableItem.tsx:218
  • Draft comment:
    Use design tokens or predefined color constants instead of hardcoding color values. This is also applicable in other parts of the code where colors are hardcoded.
  • Reason this comment was not posted:
    Comment was not on a valid diff hunk.

Workflow ID: wflow_FSbDXRI0JFo5mjpl


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

@SagarRajput-7 SagarRajput-7 merged commit e50a773 into variable-update-queue Dec 17, 2024
7 checks passed
SagarRajput-7 added a commit that referenced this pull request Dec 24, 2024
… variables (#6609)

* feat: added API limiting to reduce unneccesary api call for dashboard variables

* feat: fixed dropdown open triggering the api calls for single-select and misc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs required enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant