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

fix: Qbd direct dashboard error section fix and video update #1135

Merged
merged 2 commits into from
Dec 20, 2024

Conversation

DhaaraniCIT
Copy link
Contributor

@DhaaraniCIT DhaaraniCIT commented Dec 20, 2024

Description

fix: Qbd direct dashboard error section fix and video update

Clickup

https://app.clickup.com/

Summary by CodeRabbit

  • New Features

    • Updated demo video links for QuickBooks Desktop integration.
    • Enhanced dropdown functionality with dynamic text overflow handling and tooltips in the generic mapping table.
  • Bug Fixes

    • Improved logic for displaying mapping options based on application names and branding configurations in the dashboard error section.
  • Chores

    • Streamlined import statements by removing unused imports in the dashboard error section component.

Copy link
Contributor

coderabbitai bot commented Dec 20, 2024

Walkthrough

This pull request involves updates across multiple components, focusing on modifying YouTube video links for QuickBooks Desktop (QBD) integration and refining the logic in the dashboard error section. The changes include updating demo video URLs in branding configurations and HTML components, streamlining import statements, and enhancing the conditional logic within the showMappingResolve method in the dashboard error section component.

Changes

File Change Summary
src/app/branding/fyle-branding-config.ts Updated QBD_DIRECT demo video link URL
src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-download-file/qbd-direct-download-file.component.html Updated embedded YouTube video source URL
src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-setup-connection/qbd-direct-setup-connection.component.html Updated embedded YouTube video source URL
src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.ts Removed unused imports, refined showMappingResolve method logic for isMultiLineOption
src/app/shared/components/helper/mapping/generic-mapping-table/generic-mapping-table.component.html Added template reference variables, enhanced dropdown text handling with overflow and tooltips

Possibly related PRs

Suggested Labels

size/M

Suggested Reviewers

  • ashwin1111

Poem

🐰 Hop, hop, through code so bright,
Video links now shine just right!
QBD's demo takes a new flight,
With URLs crisp and errors tight,
A rabbit's update brings delight! 🎥

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


🪧 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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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.

@github-actions github-actions bot added the size/S Small PR label Dec 20, 2024
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

🧹 Nitpick comments (2)
src/app/shared/components/helper/mapping/generic-mapping-table/generic-mapping-table.component.html (2)

32-34: LGTM! Consider extracting the hardcoded width.

The text overflow handling implementation is solid, using proper CSS properties for truncation with tooltips.

Consider extracting the hardcoded width '16rem' to a CSS variable or component property for better maintainability:

-[ngStyle]="{'white-space': 'nowrap', 'overflow': 'hidden', 'text-overflow': 'ellipsis', 'max-width': '16rem'}"
+[ngStyle]="{'white-space': 'nowrap', 'overflow': 'hidden', 'text-overflow': 'ellipsis', 'max-width': dropdownMaxWidth}"

34-34: Consider optimizing tooltip performance.

The isOverflowing function is called for every item, which might be unnecessary for short text.

Consider adding a length check before calling isOverflowing:

-[pTooltip]="isOverflowing(textElement, value)"
+[pTooltip]="value?.value?.length > 20 ? isOverflowing(textElement, value) : null"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a7b8b20 and 9d08eff.

📒 Files selected for processing (5)
  • src/app/branding/fyle-branding-config.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-download-file/qbd-direct-download-file.component.html (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-setup-connection/qbd-direct-setup-connection.component.html (1 hunks)
  • src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.ts (2 hunks)
  • src/app/shared/components/helper/mapping/generic-mapping-table/generic-mapping-table.component.html (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-setup-connection/qbd-direct-setup-connection.component.html
  • src/app/branding/fyle-branding-config.ts
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-download-file/qbd-direct-download-file.component.html
🧰 Additional context used
🪛 Biome (1.9.4)
src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.ts

[error] 5-5: Do not shadow the global "Error" property.

Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.

(lint/suspicious/noShadowRestrictedNames)


[error] 178-178: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)


[error] 180-180: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

🔇 Additional comments (3)
src/app/shared/components/helper/mapping/generic-mapping-table/generic-mapping-table.component.html (1)

32-34: Verify alignment with PR objectives.

The changes focus on UI improvements (text overflow and tooltips) in a shared component, but the PR objectives mention fixing the QBD direct dashboard error section. Could you clarify how these changes relate to the error section fix?

Let's check for related error handling code:

✅ Verification successful

Changes are related to QBD direct dashboard error section

The modifications to the generic mapping table component are indeed connected to the QBD direct dashboard error section. The component is used within the dashboard's error section to display and resolve mapping errors, as evidenced by:

  1. The component is used in dashboard-error-section.component.html with a dialog for resolving mapping errors
  2. The code shows specific handling for QBD Direct in the component:
    this.uiExposedAppName = this.appName === AppName.QBD_DIRECT ? AppName.QBD : this.appName;
  3. The text overflow and tooltip improvements directly enhance the error resolution experience by making long mapping values more readable in the error section.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for QBD dashboard error related files and components
rg -l "qbd.*dashboard.*error" --type ts --type html

# Search for references to this generic mapping table in QBD components
rg -l "generic-mapping-table" --type ts --type html | grep -i "qbd"

Length of output: 119


Script:

#!/bin/bash
# Let's try a broader search for QBD related files
rg -l "qbd" --type ts --type html

# Search for error-related code in QBD files
rg "error" --type ts --type html | grep -i "qbd"

# Search for any usage of generic-mapping-table component
rg -l "generic-mapping-table" --type ts --type html

# Look for the component's TypeScript file to understand its usage
fd "generic-mapping-table.component.ts$"

Length of output: 31473


Script:

#!/bin/bash
# Let's check if this generic mapping table is used in QBD direct dashboard
rg -B 5 -A 5 "generic-mapping-table" src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-dashboard/qbd-direct-dashboard.component.html

# Check the dashboard error section component to see how it uses the generic mapping table
rg -B 5 -A 5 "generic-mapping-table" src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.html

# Look at the component's implementation to understand its purpose
cat src/app/shared/components/helper/mapping/generic-mapping-table/generic-mapping-table.component.ts

Length of output: 11454

src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.ts (2)

4-4: LGTM: Clean import statements

Good cleanup of unused imports and simplification of import statements.

Also applies to: 6-6


177-181: Verify error handling robustness

Please ensure proper handling of edge cases:

  1. When importCodeFields is undefined
  2. When destinationField is null/undefined
  3. When appName is not in the expected list

Let's verify the error handling:

🧰 Tools
🪛 Biome (1.9.4)

[error] 178-178: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)


[error] 180-180: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

Comment on lines 177 to 181
if ([AppName.QBD_DIRECT, AppName.QBO].includes(this.appName)) {
this.isMultiLineOption = this.destinationField === FyleField.CATEGORY && brandingConfig.brandId !== 'co' ? true : false;
} else {
this.isMultiLineOption = this.importCodeFields?.includes(this.destinationField) && brandingConfig.brandId !== 'co' ? true : false;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Simplify conditional logic and improve maintainability

The current implementation has several areas for improvement:

  1. The ternary expressions can be simplified
  2. The repeated condition brandingConfig.brandId !== 'co' should be extracted
  3. The special handling for different apps needs documentation

Consider applying these improvements:

+ // Extract common condition
+ private isCoBrand(): boolean {
+   return brandingConfig.brandId === 'co';
+ }

  showMappingResolve(errorType: AccountingErrorType, groupedError: Error[], sourceField: ExportErrorSourceType) {
    // ... existing code ...
    
+   // Special handling for QBD and QBO apps for category mapping
    if ([AppName.QBD_DIRECT, AppName.QBO].includes(this.appName)) {
-     this.isMultiLineOption = this.destinationField === FyleField.CATEGORY && brandingConfig.brandId !== 'co' ? true : false;
+     this.isMultiLineOption = this.destinationField === FyleField.CATEGORY && !this.isCoBrand();
    } else {
-     this.isMultiLineOption = this.importCodeFields?.includes(this.destinationField) && brandingConfig.brandId !== 'co' ? true : false;
+     this.isMultiLineOption = this.importCodeFields?.includes(this.destinationField) && !this.isCoBrand();
    }

Also, please add documentation explaining why QBD_DIRECT and QBO apps have special handling for category mapping.

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

🧰 Tools
🪛 Biome (1.9.4)

[error] 178-178: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)


[error] 180-180: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

@DhaaraniCIT DhaaraniCIT added the deploy Triggers deployment of active branch to Staging label Dec 20, 2024
@DhaaraniCIT DhaaraniCIT added deploy Triggers deployment of active branch to Staging and removed deploy Triggers deployment of active branch to Staging labels Dec 20, 2024
Copy link

Unit Test Coverage % values
Statements 33.31% ( 4126 / 12384 )
Branches 26.64% ( 1177 / 4418 )
Functions 25.88% ( 896 / 3461 )
Lines 33.49% ( 4060 / 12121 )

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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9d08eff and 70edd75.

📒 Files selected for processing (1)
  • src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.ts (2 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.ts

[error] 5-5: Do not shadow the global "Error" property.

Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.

(lint/suspicious/noShadowRestrictedNames)


[error] 178-178: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)


[error] 180-180: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

🔇 Additional comments (1)
src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.ts (1)

4-4: LGTM! Clean import statements

Good cleanup of unused imports, making the code more maintainable.

Also applies to: 6-6

Comment on lines +177 to +181
if ([AppName.QBD_DIRECT, AppName.QBO].includes(this.appName)) {
this.isMultiLineOption = this.sourceField === ExportErrorSourceType.CATEGORY && brandingConfig.brandId !== 'co' ? true : false;
} else {
this.isMultiLineOption = this.importCodeFields?.includes(this.destinationField) && brandingConfig.brandId !== 'co' ? true : false;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Simplify conditional logic and improve code clarity

The current implementation has several areas for improvement:

  1. Unnecessary ternary operators with boolean literals
  2. Repeated brandId check
  3. Missing documentation for special QBD/QBO handling

Apply this diff to improve the code:

+  // Special handling for QBD and QBO apps where category mapping always enables multi-line option
+  // for non-co brands
   if ([AppName.QBD_DIRECT, AppName.QBO].includes(this.appName)) {
-    this.isMultiLineOption = this.sourceField === ExportErrorSourceType.CATEGORY && brandingConfig.brandId !== 'co' ? true : false;
+    this.isMultiLineOption = this.sourceField === ExportErrorSourceType.CATEGORY && brandingConfig.brandId !== 'co';
   } else {
-    this.isMultiLineOption = this.importCodeFields?.includes(this.destinationField) && brandingConfig.brandId !== 'co' ? true : false;
+    this.isMultiLineOption = this.importCodeFields?.includes(this.destinationField) && brandingConfig.brandId !== 'co';
   }

Consider extracting the brandId check into a private method for better reusability:

private isNonCoBrand(): boolean {
  return brandingConfig.brandId !== 'co';
}
🧰 Tools
🪛 Biome (1.9.4)

[error] 178-178: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)


[error] 180-180: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

@DhaaraniCIT DhaaraniCIT merged commit e009fbe into master Dec 20, 2024
8 checks passed
DhaaraniCIT added a commit that referenced this pull request Dec 20, 2024
* fix: Qbd direct dashboard error section fix and video update

* fix: Qbd direct dashboard error section fix and video update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy Triggers deployment of active branch to Staging size/S Small PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants