From fb2778c9b3fefffb7b70d7348fb790b49b4cc2d9 Mon Sep 17 00:00:00 2001
From: RachelElysia <71795832+RachelElysia@users.noreply.github.com>
Date: Mon, 15 Jul 2024 12:08:26 -0400
Subject: [PATCH] Fleet UI: Tooltip shows dynamically on truncated text only
(#20420)
---
.../QueryFrequencyIndicator/_styles.scss | 2 +-
.../TooltipTruncatedTextCell.tsx | 3 +-
.../TooltipTruncatedTextCell/_styles.scss | 1 +
.../TooltipTruncatedText/_styles.scss | 8 +++++
.../OSSettingsErrorCell.tsx | 2 +-
.../OSSettingsErrorCell/_styles.scss | 2 +-
.../OSSettingsTable/OSSettingsTableConfig.tsx | 5 ++-
.../hosts/details/cards/Policies/_styles.scss | 4 +--
.../policies/ManagePoliciesPage/_styles.scss | 21 ++++++++++++
.../CalendarEventsModal.tsx | 32 +++++++++----------
.../OtherWorkflowsModal.tsx | 3 +-
.../ManageQueryAutomationsModal.tsx | 3 +-
12 files changed, 58 insertions(+), 28 deletions(-)
diff --git a/frontend/components/QueryFrequencyIndicator/_styles.scss b/frontend/components/QueryFrequencyIndicator/_styles.scss
index 8559b82ec2..b10b189731 100644
--- a/frontend/components/QueryFrequencyIndicator/_styles.scss
+++ b/frontend/components/QueryFrequencyIndicator/_styles.scss
@@ -1,12 +1,12 @@
.query-frequency-indicator {
width: 90px;
- display: flex;
align-items: center;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
.icon {
+ vertical-align: middle;
padding-right: $pad-small;
}
}
diff --git a/frontend/components/TableContainer/DataTable/TooltipTruncatedTextCell/TooltipTruncatedTextCell.tsx b/frontend/components/TableContainer/DataTable/TooltipTruncatedTextCell/TooltipTruncatedTextCell.tsx
index 2fcdb9b3a1..995665a669 100644
--- a/frontend/components/TableContainer/DataTable/TooltipTruncatedTextCell/TooltipTruncatedTextCell.tsx
+++ b/frontend/components/TableContainer/DataTable/TooltipTruncatedTextCell/TooltipTruncatedTextCell.tsx
@@ -49,7 +49,7 @@ const TooltipTruncatedTextCell = ({
const isDefaultValue = value === DEFAULT_EMPTY_CELL_VALUE;
return (
-
+
{
return (
-
diff --git a/frontend/pages/hosts/details/cards/Policies/_styles.scss b/frontend/pages/hosts/details/cards/Policies/_styles.scss
index e7d90c5676..2ee63c7732 100644
--- a/frontend/pages/hosts/details/cards/Policies/_styles.scss
+++ b/frontend/pages/hosts/details/cards/Policies/_styles.scss
@@ -22,7 +22,7 @@
tbody {
tr {
.name__cell {
- max-width: 0; // sets ellipses
+ max-width: 0; // sets ellipsis
}
.policy-link {
@@ -36,7 +36,7 @@
}
}
.policy-info {
- width: 100%; // sets ellipses
+ width: 100%; // sets ellipsis
justify-content: left;
.policy-info-text {
diff --git a/frontend/pages/policies/ManagePoliciesPage/_styles.scss b/frontend/pages/policies/ManagePoliciesPage/_styles.scss
index ca0978671d..db4492f573 100644
--- a/frontend/pages/policies/ManagePoliciesPage/_styles.scss
+++ b/frontend/pages/policies/ManagePoliciesPage/_styles.scss
@@ -234,13 +234,34 @@
.checkbox-row {
display: flex;
+ max-width: 100%;
padding: 8px 12px;
justify-content: space-between;
align-items: center;
align-self: stretch;
border-bottom: 1px solid $ui-fleet-black-10;
+ gap: 20px;
+
+ .form-field--checkbox {
+ flex: 1 1 0%; /* This allows growing and shrinking */
+ min-width: 0; /* This is crucial for proper shrinking */
+ }
+
+ .fleet-checkbox__tick {
+ flex: 0 0 auto; /* This prevents growing and shrinking */
+ width: fit-content; /* This ensures button isn't cut off */
+ }
+
+ .fleet-checkbox__label {
+ display: flex;
+ white-space: nowrap;
+ flex: 1 1 0%; /* This allows growing and shrinking */
+ min-width: 0; /* This is crucial for proper shrinking */
+ }
&__preview-button {
+ flex: 0 0 auto; /* This prevents growing and shrinking */
+ width: fit-content; /* This ensures button isn't cut off */
visibility: hidden;
}
diff --git a/frontend/pages/policies/ManagePoliciesPage/components/CalendarEventsModal/CalendarEventsModal.tsx b/frontend/pages/policies/ManagePoliciesPage/components/CalendarEventsModal/CalendarEventsModal.tsx
index b2746d4257..4a10a9c010 100644
--- a/frontend/pages/policies/ManagePoliciesPage/components/CalendarEventsModal/CalendarEventsModal.tsx
+++ b/frontend/pages/policies/ManagePoliciesPage/components/CalendarEventsModal/CalendarEventsModal.tsx
@@ -2,8 +2,8 @@ import React, { useCallback, useState, useEffect } from "react";
import { IPolicyStats } from "interfaces/policy";
+import { syntaxHighlight } from "utilities/helpers";
import validURL from "components/forms/validators/valid_url";
-
import Button from "components/buttons/Button";
import RevealButton from "components/buttons/RevealButton";
import CustomLink from "components/CustomLink";
@@ -12,7 +12,7 @@ import Slider from "components/forms/fields/Slider";
import InputField from "components/forms/fields/InputField";
import Modal from "components/Modal";
import Checkbox from "components/forms/fields/Checkbox";
-import { syntaxHighlight } from "utilities/helpers";
+import TooltipTruncatedText from "components/TooltipTruncatedText";
import Icon from "components/Icon";
import CalendarEventPreviewModal from "../CalendarEventPreviewModal";
import CalendarPreview from "../../../../../../assets/images/calendar-preview-720x436@2x.png";
@@ -198,22 +198,20 @@ const CalendarEventsModal = ({
onPolicyEnabledChange({ name, value: !isChecked });
}}
>
- {name}
+
-
-
-
+
);
})}
diff --git a/frontend/pages/policies/ManagePoliciesPage/components/OtherWorkflowsModal/OtherWorkflowsModal.tsx b/frontend/pages/policies/ManagePoliciesPage/components/OtherWorkflowsModal/OtherWorkflowsModal.tsx
index 77a488f730..75c66b5fd7 100644
--- a/frontend/pages/policies/ManagePoliciesPage/components/OtherWorkflowsModal/OtherWorkflowsModal.tsx
+++ b/frontend/pages/policies/ManagePoliciesPage/components/OtherWorkflowsModal/OtherWorkflowsModal.tsx
@@ -26,6 +26,7 @@ import Radio from "components/forms/fields/Radio";
import validUrl from "components/forms/validators/valid_url";
import RevealButton from "components/buttons/RevealButton";
import CustomLink from "components/CustomLink";
+import TooltipTruncatedText from "components/TooltipTruncatedText";
import ExampleTicket from "../ExampleTicket";
import ExamplePayload from "../ExamplePayload";
@@ -427,7 +428,7 @@ const OtherWorkflowsModal = ({
setErrors((errs) => omit(errs, "policyItems"));
}}
>
- {name}
+
);
diff --git a/frontend/pages/queries/ManageQueriesPage/components/ManageQueryAutomationsModal/ManageQueryAutomationsModal.tsx b/frontend/pages/queries/ManageQueriesPage/components/ManageQueryAutomationsModal/ManageQueryAutomationsModal.tsx
index 391881bcf7..dfba913f15 100644
--- a/frontend/pages/queries/ManageQueriesPage/components/ManageQueryAutomationsModal/ManageQueryAutomationsModal.tsx
+++ b/frontend/pages/queries/ManageQueriesPage/components/ManageQueryAutomationsModal/ManageQueryAutomationsModal.tsx
@@ -9,6 +9,7 @@ import QueryFrequencyIndicator from "components/QueryFrequencyIndicator/QueryFre
import LogDestinationIndicator from "components/LogDestinationIndicator/LogDestinationIndicator";
import { ISchedulableQuery } from "interfaces/schedulable_query";
+import TooltipTruncatedText from "components/TooltipTruncatedText";
interface IManageQueryAutomationsModalProps {
isUpdatingAutomations: boolean;
@@ -135,7 +136,7 @@ const ManageQueryAutomationsModal = ({
// setErrors((errs) => omit(errs, "queryItems"));
}}
>
- {name}
+