From 543e5c5ff7021a6aa059bdcaf69446f74b257396 Mon Sep 17 00:00:00 2001 From: Mayursinh Sarvaiya Date: Tue, 18 Aug 2026 16:45:27 +0530 Subject: [PATCH 1/8] feat: add name field in creation wizard Signed-off-by: Mayursinh Sarvaiya --- .../features/common/subscription-name-tag.tsx | 34 +++++++++++++++++++ .../create-warehouse-wizard.tsx | 6 ++-- .../create-warehouse/subscription-wizard.tsx | 26 ++++++++++---- 3 files changed, 57 insertions(+), 9 deletions(-) create mode 100644 ui/src/features/common/subscription-name-tag.tsx diff --git a/ui/src/features/common/subscription-name-tag.tsx b/ui/src/features/common/subscription-name-tag.tsx new file mode 100644 index 0000000000..a2010bd89d --- /dev/null +++ b/ui/src/features/common/subscription-name-tag.tsx @@ -0,0 +1,34 @@ +import { faTag } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { Tag } from 'antd'; +import classNames from 'classnames'; + +// SubscriptionNameTag renders the optional name of a Warehouse subscription. A +// subscription carries its name onto everything it produces -- discovered +// artifacts and Freight -- so the same name surfaces in many unrelated views. +// Rendering it through this one component keeps it recognizable as a +// subscription name wherever it appears. Renders nothing when there is no name, +// so callers can drop it in without guarding. +export const SubscriptionNameTag = ({ + name, + className +}: { + name?: string; + className?: string; +}) => { + if (!name) { + return null; + } + + return ( + + + {name} + + ); +}; diff --git a/ui/src/features/stage/create-warehouse/create-warehouse-wizard.tsx b/ui/src/features/stage/create-warehouse/create-warehouse-wizard.tsx index 419d427516..a046198177 100644 --- a/ui/src/features/stage/create-warehouse/create-warehouse-wizard.tsx +++ b/ui/src/features/stage/create-warehouse/create-warehouse-wizard.tsx @@ -93,15 +93,15 @@ export const CreateWarehouseWizard = (props: CreateWarehouseWizardProps) => { + onChange={(subscriptions) => { setFormState({ ...formState, spec: { ...(formState?.spec || {}), subscriptions } - }) - } + }); + }} /> diff --git a/ui/src/features/stage/create-warehouse/subscription-wizard.tsx b/ui/src/features/stage/create-warehouse/subscription-wizard.tsx index e546a481b3..ad77d445a0 100644 --- a/ui/src/features/stage/create-warehouse/subscription-wizard.tsx +++ b/ui/src/features/stage/create-warehouse/subscription-wizard.tsx @@ -3,7 +3,7 @@ import { faEye, faTrash, IconDefinition } from '@fortawesome/free-solid-svg-icon import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import Form from '@rjsf/antd'; import validator from '@rjsf/validator-ajv8'; -import { Button, Card, Collapse, Modal, Select, Tag, Typography } from 'antd'; +import { Button, Card, Collapse, Input, Modal, Select, Tag, Typography } from 'antd'; import AntdFormLabel from 'antd/es/form/FormItemLabel'; import classNames from 'classnames'; import { JSONSchema7 } from 'json-schema'; @@ -31,6 +31,8 @@ export const SubscriptionWizard = (props: { subscriptionTypes[2] /* image as default and common subscription */ ); + const [name, setName] = useState(''); + return ( <> @@ -61,6 +63,16 @@ export const SubscriptionWizard = (props: { value={selectedNewSubscription} onChange={(newSubscription) => setSelectedNewSubscription(newSubscription)} /> +
+ + setName(e.target.value)} + placeholder='Optional' + /> +
+ onSubmit={(data) => { props.onChange([ ...props.subscriptions, { + ...(name ? { name } : {}), [selectedNewSubscription]: data.formData } - ]) - } + ]); + setName(''); + }} >