Skip to content

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

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

Merged
merged 8 commits into from
Feb 25, 2025

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.85%. Comparing base (606df3f) to head (529486b).
Report is 136 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #26298      +/-   ##
==========================================
- Coverage   63.85%   63.85%   -0.01%     
==========================================
  Files        1632     1634       +2     
  Lines      157936   157985      +49     
  Branches     4038     4059      +21     
==========================================
+ Hits       100843   100874      +31     
- Misses      49191    49208      +17     
- Partials     7902     7903       +1     
Flag Coverage Δ
frontend 53.60% <100.00%> (+0.03%) ⬆️

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"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jacobshandling If we do position top, it gets cut off by the site nav. And the tooltip style sheet currently has:

z-index: 99; // not more than the site nav

which makes that seem intentional.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I'm not sure why I put that there. Since the Figma has the tooltip up (see here) I'd say it's fine to override, either by locally setting z-index, or you might need to set TooltipWrapper's fixedPositionStrategy prop

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

Copy link
Contributor Author

@sgress454 sgress454 Feb 18, 2025

Choose a reason for hiding this comment

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

It needs to be a real container since it has a style associated with it. I can change it to <div>. I wasn't really trying to make a policy statement, just force of habit 😄 . As far as the let vs. ternary, an earlier version had more variations that made that necessary; since there's only two I can switch back to ternary. That's not a style-guideline consistency hill I'd want to die on.

@@ -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?

@sgress454
Copy link
Contributor Author

@jacobshandling Updated this to use "top" positioning and replaced <p> with <div>!

@jacobshandling jacobshandling self-requested a review February 22, 2025 01:21
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.

LGTM

@sgress454 sgress454 merged commit e013ce7 into main Feb 25, 2025
14 checks passed
@sgress454 sgress454 deleted the sgress454/23423-update-automations-ui branch February 25, 2025 17:10
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