From 85b15758f73c19b99574bc6705a3629bd6cc5c7b Mon Sep 17 00:00:00 2001 From: RachelElysia <71795832+RachelElysia@users.noreply.github.com> Date: Thu, 2 May 2024 09:20:41 -0400 Subject: [PATCH] Fleet UI: AI autofill policy description and resolution (#18646) --- .../PlatformSelector/PlatformSelector.tsx | 13 +- .../components/PlatformSelector/_styles.scss | 4 + .../forms/fields/InputField/InputField.jsx | 12 +- .../forms/fields/InputField/_styles.scss | 7 +- frontend/components/icons/Sparkles.tsx | 25 ++++ frontend/components/icons/index.ts | 2 + frontend/hooks/usePlatformSelector.tsx | 7 +- .../ManagePoliciesPage/ManagePoliciesPage.tsx | 4 +- .../PolicyForm/PolicyForm.tests.tsx | 17 ++- .../components/PolicyForm/PolicyForm.tsx | 29 +++- .../components/PolicyForm/_styles.scss | 13 ++ .../SaveNewPolicyModal/SaveNewPolicyModal.tsx | 139 +++++++++++++++--- .../PolicyPage/screens/QueryEditor.tsx | 70 +++++++++ frontend/services/entities/autofill.ts | 16 ++ .../services/mock_service/mocks/config.ts | 3 +- .../services/mock_service/mocks/responses.ts | 8 + frontend/utilities/endpoints.ts | 3 + 17 files changed, 334 insertions(+), 38 deletions(-) create mode 100644 frontend/components/icons/Sparkles.tsx create mode 100644 frontend/services/entities/autofill.ts diff --git a/frontend/components/PlatformSelector/PlatformSelector.tsx b/frontend/components/PlatformSelector/PlatformSelector.tsx index bb1a8ece85..4cbd7f5686 100644 --- a/frontend/components/PlatformSelector/PlatformSelector.tsx +++ b/frontend/components/PlatformSelector/PlatformSelector.tsx @@ -1,4 +1,5 @@ import React from "react"; +import classNames from "classnames"; import Checkbox from "components/forms/fields/Checkbox"; interface IPlatformSelectorProps { @@ -11,6 +12,7 @@ interface IPlatformSelectorProps { setCheckWindows: (val: boolean) => void; setCheckLinux: (val: boolean) => void; setCheckChrome: (val: boolean) => void; + disabled?: boolean; } export const PlatformSelector = ({ @@ -23,17 +25,23 @@ export const PlatformSelector = ({ setCheckWindows, setCheckLinux, setCheckChrome, + disabled = false, }: IPlatformSelectorProps): JSX.Element => { const baseClass = "platform-selector"; + const labelClasses = classNames("form-field__label", { + [`form-field__label--disabled`]: disabled, + }); + return (