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

Redesign enterprise tile #35622

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

jingcheng16
Copy link
Contributor

@jingcheng16 jingcheng16 commented Jan 14, 2025

Product Description

Changes:

  • Remove the descriptors below the stat, make that description a tooltip to avoid redundancy. ( Not every tile have a tooltip. Only the one that might cause confusion will have. )
  • Change the button style to default style
  • Change the stat to the non-bold thickness, the text size is big enough to negate the need for making it bold

Before:
image

After:
image

Technical Summary

Ticket: https://dimagi.atlassian.net/browse/SAAS-16428

Feature Flag

Safety Assurance

Safety story

Mainly appearance change.

Automated test coverage

QA Plan

Rollback instructions

  • This PR can be reverted after deploy with no further considerations

Labels & Review

  • Risk label is set correctly
  • The set of people pinged as reviewers is appropriate for the level of risk of the change

@jingcheng16 jingcheng16 requested a review from biyeun January 14, 2025 22:29
@jingcheng16 jingcheng16 marked this pull request as ready for review January 14, 2025 23:17
{% if report.total_description %}
<div class="position-absolute start-100" style="top: 25%">
<span class="hq-help-template" data-content="{{ report.total_description }}" data-placement="right">
<i class="fa fa-info-circle"></i>
Copy link
Contributor

Choose a reason for hiding this comment

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

What would you think of putting the icon next to the header text instead of the number? It's more secondary/tertiary information than primary information.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I feel putting the icon next to the header text implies this description is to explain the header text, not the stat there anymore. But maybe I can move the icon to next to the header text, and then in the tooltip, I included a description of the stat, also a description of the report they will get. I'll bring it up with saas-product. Thank you!

<i class="fa fa-spin fa-spinner"></i>
</div>
{% if report.total_description %}
<div class="position-absolute start-100" style="top: 25%">
Copy link
Contributor

Choose a reason for hiding this comment

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

The top: 25% style could be a top-25 class, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bootstrap only have top-0, top-50 and top-100, so I have to use style: https://getbootstrap.com/docs/5.0/utilities/position/#arrange-elements

Copy link
Contributor

Choose a reason for hiding this comment

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

aha, got it

Copy link
Member

Choose a reason for hiding this comment

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

can override the sass map to include top-25
https://getbootstrap.com/docs/5.3/utilities/position/#sass-maps
also i would prefer end-0 instead of start-100

Copy link
Contributor Author

Choose a reason for hiding this comment

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

override in 9119c9f
start-100 put the left edge of the element at the right edge of the parent element
end-0 put the right edge of the element at the left edge of the parent element
So they're not exchangeable...

Fix a small thing as well: <i> element will be override by "hq-help-template" anyway so remove it
Copy link

coderabbitai bot commented Jan 17, 2025

Walkthrough

The pull request introduces a series of changes across multiple files in the CommCare HQ enterprise application, primarily focusing on transitioning from API usage tracking to API key management. The modifications span the API resources, enterprise reporting system, and associated templates and styling.

Key changes include the removal of the APIUsageResource in favor of the APIKeysResource, along with updates to the EnterpriseReport class that replace API_USAGE with API_KEYS and the removal of total_description properties from various report classes. The project tile template has been restructured for improved layout and conditional display of help information. Additionally, a new positioning variable has been added to the SCSS variables file to support more flexible styling options.

These changes represent a systematic update to the enterprise reporting and API management components of the application, focusing on nomenclature and structural improvements.

Finishing Touches

  • 📝 Generate Docstrings (Beta)

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 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.

@jingcheng16
Copy link
Contributor Author

@biyeun @mjriley This PR is ready for review again.

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

🧹 Nitpick comments (2)
corehq/apps/enterprise/static/enterprise/js/project_dashboard.js (1)

228-228: Consider consolidating tooltip visibility management.

The visibility of the help tooltip is managed in multiple places. Consider extracting this logic into a dedicated function to improve maintainability and reduce the risk of inconsistent states.

 function updateDisplayTotal($element, kwargs) {
     const $display = $element.find(".js-total");
     const $helpTotal = $element.find(".help-total");
+    
+    function setHelpTotalVisibility(visible) {
+        $helpTotal[visible ? 'removeClass' : 'addClass']('d-none');
+    }
+    
     const slug = $element.data("slug");
+    setHelpTotalVisibility(false);  // Hide initially
     const requestParams = {
         url: initialPageData.reverse("enterprise_dashboard_total", slug),
         success: function (data) {
             $display.html(localizeNumberlikeString(data.total));
-            $helpTotal.removeClass("d-none");
+            setHelpTotalVisibility(true);
         },
         error: function (request) {
             if (request.responseJSON) {
                 alertUser.alert_user(request.responseJSON["message"], "danger");
             } else {
                 alertUser.alert_user(gettext("Error updating display total, please try again or report an issue if this persists."), "danger");
             }
             $display.html(gettext("??"));
-            $helpTotal.addClass("d-none");
+            setHelpTotalVisibility(false);
         },
         data: kwargs,
     };
     $display.html('<i class="fa fa-spin fa-spinner"></i>');
-    $helpTotal.addClass("d-none");
     $.ajax(requestParams);
 }

Also applies to: 234-234, 243-243, 248-248

corehq/apps/enterprise/templates/enterprise/partials/project_tile.html (1)

34-43: Remove unnecessary non-breaking space.

The &nbsp; is used as a placeholder but could be removed since the button already has content from the data binding.

         <button
           class="btn btn-link fs-6"
           id="{{ report.slug }}_dateRangeDisplay"
           type="button"
           data-bind="text: presetText"
           data-bs-toggle="modal"
           data-bs-target="#enterpriseFormsDaterange"
           data-sender="{{ report.slug }}"
-        >
-          &nbsp;
-        </button>
+        ></button>
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9119c9f and 632ff91.

📒 Files selected for processing (2)
  • corehq/apps/enterprise/static/enterprise/js/project_dashboard.js (2 hunks)
  • corehq/apps/enterprise/templates/enterprise/partials/project_tile.html (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: task-list-completed
  • GitHub Check: tests (python-sharded-and-javascript)
  • GitHub Check: tests (python, bf)
  • GitHub Check: tests (python, 6a)
  • GitHub Check: tests (python, 05)
  • GitHub Check: task-list-completed
🔇 Additional comments (2)
corehq/apps/enterprise/templates/enterprise/partials/project_tile.html (2)

Line range hint 49-53: Button style update looks good.

The change from primary to outline style aligns with the PR objectives and style guide requirements.


12-27: Consider a more responsive approach for tooltip positioning.

The absolute positioning with start-100 top-25 might cause layout issues on different screen sizes. Consider using a more flexible positioning approach.

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.

3 participants