From 07fded88f04a8debe69ecc7d718307d7c6e13d84 Mon Sep 17 00:00:00 2001 From: Lars Heinemann Date: Mon, 4 Dec 2023 23:41:20 +0100 Subject: [PATCH] improving the NEW menu on the canvas --- .../FlowType/FlowTypeSelector.tsx | 24 +++++++++++++++++-- .../ContextToolbar/FlowType/NewFlow.tsx | 4 ++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/packages/ui/src/components/Visualization/ContextToolbar/FlowType/FlowTypeSelector.tsx b/packages/ui/src/components/Visualization/ContextToolbar/FlowType/FlowTypeSelector.tsx index b2f2ad746..c67eaa681 100644 --- a/packages/ui/src/components/Visualization/ContextToolbar/FlowType/FlowTypeSelector.tsx +++ b/packages/ui/src/components/Visualization/ContextToolbar/FlowType/FlowTypeSelector.tsx @@ -47,6 +47,23 @@ export const FlowTypeSelector: FunctionComponent = (props) onSelect(undefined, currentSchemaType); }, [onSelect, currentSchemaType]); + /** Override function to provide more useful help texts than available via schema */ + const getDescriptionForType = (type: string) => { + switch (type) { + case SourceSchemaType.Route: + return 'Defines an executable integration flow by declaring a source (starter) and followed by a sequence of actions (or steps). Actions can include data manipulations, EIPs (integration patterns) and internal or external calls.'; + case SourceSchemaType.Kamelet: + return 'Defines a reusable Camel route as a building block. Kamelets can not be executed on their own, they are used as sources, actions or sinks in Camel Routes or Pipes.'; + case SourceSchemaType.Pipe: + case SourceSchemaType.KameletBinding: + return 'Defines a sequence of concatenated Kamelets to form start to finish integration flows. Pipes are a more abstract level of defining integration flows, by chosing and configuring Kamelets.'; + case SourceSchemaType.Integration: + return 'An integration defines a Camel route in a CRD file.'; + default: + return undefined; + } + }; + const toggle = (toggleRef: Ref) => ( = (props) setIsOpen(isOpen); }} toggle={toggle} + style={{ width: '20rem' }} > {Object.entries({ @@ -111,8 +129,10 @@ export const FlowTypeSelector: FunctionComponent = (props) data-testid={`dsl-${sourceSchema.schema?.name}`} itemId={sourceType} description={ - - {(sourceSchema.schema?.schema as { description: string }).description ?? ''} + + {getDescriptionForType(sourceType) !== undefined + ? getDescriptionForType(sourceType) + : (sourceSchema.schema?.schema as { description: string }).description ?? ''} } isDisabled={isOptionDisabled} diff --git a/packages/ui/src/components/Visualization/ContextToolbar/FlowType/NewFlow.tsx b/packages/ui/src/components/Visualization/ContextToolbar/FlowType/NewFlow.tsx index 291e71efe..9693c27ea 100644 --- a/packages/ui/src/components/Visualization/ContextToolbar/FlowType/NewFlow.tsx +++ b/packages/ui/src/components/Visualization/ContextToolbar/FlowType/NewFlow.tsx @@ -45,7 +45,7 @@ export const NewFlow: FunctionComponent = () => { <> - New route + New = () => { isOpen={isConfirmationModalOpen} >

- This will remove the existing routes and you will lose your current work. Are you sure you would like to + This will remove any existing integration and you will lose your current work. Are you sure you would like to proceed?