From 2db22706fd72fcbb60e63873f8e90546a701cb2e Mon Sep 17 00:00:00 2001 From: Benjamin Leonard Date: Wed, 6 Nov 2024 11:12:19 +0000 Subject: [PATCH 1/4] Add side modal heading --- app/forms/firewall-rules-common.tsx | 147 +++++++++++++++------------- app/ui/lib/SideModal.tsx | 2 + 2 files changed, 80 insertions(+), 69 deletions(-) diff --git a/app/forms/firewall-rules-common.tsx b/app/forms/firewall-rules-common.tsx index b0935c893b..2ae4064090 100644 --- a/app/forms/firewall-rules-common.tsx +++ b/app/forms/firewall-rules-common.tsx @@ -36,8 +36,10 @@ import { useVpcSelector } from '~/hooks/use-params' import { Badge } from '~/ui/lib/Badge' import { toComboboxItems, type ComboboxItem } from '~/ui/lib/Combobox' import { FormDivider } from '~/ui/lib/Divider' +import { FieldLabel } from '~/ui/lib/FieldLabel' import { Message } from '~/ui/lib/Message' import * as MiniTable from '~/ui/lib/MiniTable' +import { SideModal } from '~/ui/lib/SideModal' import { TextInputHint } from '~/ui/lib/TextInput' import { KEYS } from '~/ui/util/keys' import { ALL_ISH } from '~/util/consts' @@ -415,46 +417,50 @@ export const CommonFields = ({ control, nameTaken, error }: CommonFieldsProps) = {/* Really this should be its own
, but you can't have a form inside a form, so we just stick the submit handler in a button onClick */} -
-

Targets

- + Targets + + +

Targets determine the instances to which this rule applies. You can target instances directly by name, or specify a VPC, VPC subnet, IP, or IP subnet, - which will apply the rule to traffic going to all matching instances. Targets - are additive: the rule applies to instances matching{' '} + which will apply the rule to traffic going to all matching instances. +

+

+ Targets are additive: the rule applies to instances matching{' '} any target. - - } - /> - - targetForm.reset({ type: targetForm.getValues('type'), value: '' }) - } - onInputChange={(value) => targetForm.setValue('value', value)} - onSubmitTextField={submitTarget} - /> - targetForm.reset()} - onSubmit={submitTarget} - /> -

+

+ + } + /> + + + targetForm.reset({ type: targetForm.getValues('type'), value: '' }) + } + onInputChange={(value) => targetForm.setValue('value', value)} + onSubmitTextField={submitTarget} + /> + targetForm.reset()} + onSubmit={submitTarget} + /> {!!targets.value.length && } -

Filters

+ Filters - + A single destination port (1234) or a range (1234–2345) @@ -523,45 +529,48 @@ export const CommonFields = ({ control, nameTaken, error }: CommonFieldsProps) = )}
- Protocol filters + {/* todo: abstract this label and checkbox pattern */} + + Protocol filters + + {/* Protocol filters */}
-
-

Host filters

- - Host filters match the “other end” of traffic from the - target’s perspective: for an inbound rule, they match the source of - traffic. For an outbound rule, they match the destination. - - } - /> - - hostForm.reset({ type: hostForm.getValues('type'), value: '' }) - } - onInputChange={(value) => hostForm.setValue('value', value)} - onSubmitTextField={submitHost} - /> - hostForm.reset()} - onSubmit={submitHost} - /> -
+ + + Host filters + + + Host filters match the “other end” of traffic from the + target’s perspective: for an inbound rule, they match the source of + traffic. For an outbound rule, they match the destination. + + } + /> + hostForm.reset({ type: hostForm.getValues('type'), value: '' })} + onInputChange={(value) => hostForm.setValue('value', value)} + onSubmitTextField={submitHost} + /> + hostForm.reset()} + onSubmit={submitHost} + /> {!!hosts.value.length && } {error && ( diff --git a/app/ui/lib/SideModal.tsx b/app/ui/lib/SideModal.tsx index 63b1d89262..62d478c5e7 100644 --- a/app/ui/lib/SideModal.tsx +++ b/app/ui/lib/SideModal.tsx @@ -170,6 +170,8 @@ function SideModalBody({ children }: { children?: ReactNode }) { SideModal.Body = SideModalBody +SideModal.Heading = classed.div`text-sans-semi-xl` + SideModal.Section = classed.div`p-8 space-y-6 border-secondary` SideModal.Footer = ({ children, error }: { children: ReactNode; error?: boolean }) => ( From 57eaad824ce44165220cfa26d9bce69078173f63 Mon Sep 17 00:00:00 2001 From: Benjamin Leonard Date: Wed, 6 Nov 2024 11:17:12 +0000 Subject: [PATCH 2/4] Remove commented input legend --- app/forms/firewall-rules-common.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/app/forms/firewall-rules-common.tsx b/app/forms/firewall-rules-common.tsx index 2ae4064090..2881dcbef2 100644 --- a/app/forms/firewall-rules-common.tsx +++ b/app/forms/firewall-rules-common.tsx @@ -533,7 +533,6 @@ export const CommonFields = ({ control, nameTaken, error }: CommonFieldsProps) = Protocol filters - {/* Protocol filters */} From f28e4636250406a2ce35870fa9df5ff0f5602d8d Mon Sep 17 00:00:00 2001 From: David Crespo Date: Wed, 6 Nov 2024 09:59:57 -0600 Subject: [PATCH 3/4] very important mt-2 --- app/forms/firewall-rules-common.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/forms/firewall-rules-common.tsx b/app/forms/firewall-rules-common.tsx index 2881dcbef2..119f7d461d 100644 --- a/app/forms/firewall-rules-common.tsx +++ b/app/forms/firewall-rules-common.tsx @@ -428,7 +428,7 @@ export const CommonFields = ({ control, nameTaken, error }: CommonFieldsProps) = instances directly by name, or specify a VPC, VPC subnet, IP, or IP subnet, which will apply the rule to traffic going to all matching instances.

-

+

Targets are additive: the rule applies to instances matching{' '} any target.

@@ -474,7 +474,7 @@ export const CommonFields = ({ control, nameTaken, error }: CommonFieldsProps) = />
- {/* We have to blow this up instead of using TextField to get better + {/* We have to blow this up instead of using TextField to get better text styling on the label */}
From 00f49806e62df9bc2dd736dc9a06f7f33706c5fa Mon Sep 17 00:00:00 2001 From: David Crespo Date: Wed, 6 Nov 2024 10:04:41 -0600 Subject: [PATCH 4/4] cut one word to cut a whole line out of the targets info box --- app/forms/firewall-rules-common.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/forms/firewall-rules-common.tsx b/app/forms/firewall-rules-common.tsx index 119f7d461d..da348ee214 100644 --- a/app/forms/firewall-rules-common.tsx +++ b/app/forms/firewall-rules-common.tsx @@ -425,8 +425,8 @@ export const CommonFields = ({ control, nameTaken, error }: CommonFieldsProps) = <>

Targets determine the instances to which this rule applies. You can target - instances directly by name, or specify a VPC, VPC subnet, IP, or IP subnet, - which will apply the rule to traffic going to all matching instances. + instances directly or specify a VPC, VPC subnet, IP, or IP subnet, which will + apply the rule to traffic going to all matching instances.

Targets are additive: the rule applies to instances matching{' '}