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

Show "Manage Automations" dropdown when no policies are present #26298

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

sgress454
Copy link
Contributor

For #23243

Checklist for submitter

  • Changes file added for user-visible changes in changes/, orbit/changes/ or ee/fleetd-chrome/changes.
    See Changes files for more information.

Details

This PR changes the behavior of the Manage Automations dropdown on the Manage Policies page. Any user that has permission to manage policies will now always see the dropdown. If there are no policies added for the selected team (or no policies at all, in the case of "All teams" or users on the free tier), the dropdown is disabled with a tooltip.

Screenshots

Free tier:
image


Premium tier, All Teams:
image


Premium tier, team selected:
image

@sgress454 sgress454 requested a review from a team as a code owner February 12, 2025 18:13
Copy link

codecov bot commented Feb 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.84%. Comparing base (606df3f) to head (2e0ee02).
Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #26298      +/-   ##
==========================================
- Coverage   63.85%   63.84%   -0.01%     
==========================================
  Files        1632     1632              
  Lines      157936   157938       +2     
  Branches     4038     4091      +53     
==========================================
- Hits       100843   100838       -5     
- Misses      49191    49198       +7     
  Partials     7902     7902              
Flag Coverage Δ
frontend 53.51% <100.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sgress454
Copy link
Contributor Author

@noahtalerman I only saw tooltip verbiage for one state, so I added variations for the free tier and for when "All Teams" is selected (see screenshots in description). Let me know if you want changes to the text.

@noahtalerman
Copy link
Member

@noahtalerman I only saw tooltip verbiage for one state, so I added variations for the free tier and for when "All Teams" is selected (see screenshots in description). Let me know if you want changes to the text.

Hey @sgress454! Up to @marko-lisica (Product Designer for the user story):

Screenshot 2025-02-12 at 4 51 58 PM

@marko-lisica
Copy link
Member

@noahtalerman I only saw tooltip verbiage for one state, so I added variations for the free tier and for when "All Teams" is selected (see screenshots in description). Let me know if you want changes to the text.

Hey @sgress454! Up to @marko-lisica (Product Designer for the user story):

Screenshot 2025-02-12 at 4 51 58 PM

Great catch @sgress454! I just added these 2 cases to Figma here

Screenshot 2025-02-13 at 13 30 30

I noticed that the tooltips on the screenshots don't have a caret (arrow) pointing to the button and a copy doesn't match what's specified in Figma. We use one without caret only with underlined text.

Tooltip w/o caret:
Screenshot 2025-02-13 at 13 31 50

Tooltip w/ caret:
Screenshot 2025-02-13 at 13 32 56

@sgress454
Copy link
Contributor Author

Thanks @marko-lisica! Updated:

  • Added carets to tooltips
  • Centered tooltip text
  • Updated language for free tier / premium tier with team selected

Copy link
Contributor

@jacobshandling jacobshandling left a comment

Choose a reason for hiding this comment

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

The only requested change is for the "top" positioning, everything else is nice-to-have

}

automationsDropdown = (
<TooltipWrapper underline={false} tipContent={tipContent} showArrow>
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like we want position="top"

/>
</div>
);
if (!hasPoliciesToAutomateOrDelete) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Our general pattern for this kind of thing would be more like:

      const tipContent =
        isPremiumTier && currentTeamId !== APP_CONTEXT_ALL_TEAMS_ID ? (
          <>
            To manage automations add a policy to this team.
            <br />
            For inherited policies select &ldquo;All teams&rdquo;.
          </>
        ) : (
          "To manage automations add a policy."
        );

, though I like this let-based version too. If you feel like we should shift in that direction in
general, can you bring it up as a topic at frontend sync? Otherwise let's stick with the
ternary-based approach please.

Also, nice effort towards using more semantic HTML! I will say in my experience in the codebase,
using <p> tends to introduce more style issues than it solves. I'd support a concerted app-wide effort
to use more semantic markup, though caution that currently it tends to introduce more problems than
it solves.

@@ -55,6 +55,10 @@
.form-field {
margin-bottom: 0;
}

&__tooltip {
text-align: center;
Copy link
Contributor

Choose a reason for hiding this comment

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

related to the <p>, right?

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