diff --git a/packages/ui/src/components/Visualization/ContextToolbar/FlowType/NewFlow.tsx b/packages/ui/src/components/Visualization/ContextToolbar/FlowType/NewFlow.tsx index 42c715dca..8b4fd9e2d 100644 --- a/packages/ui/src/components/Visualization/ContextToolbar/FlowType/NewFlow.tsx +++ b/packages/ui/src/components/Visualization/ContextToolbar/FlowType/NewFlow.tsx @@ -14,7 +14,6 @@ export const NewFlow: FunctionComponent = () => { const checkBeforeAddNewFlow = useCallback( (flowType: SourceSchemaType) => { - // console.log('selected new flow', flowType); const isSameSourceType = entitiesContext.currentSchemaType === flowType; if (isSameSourceType) { diff --git a/packages/ui/src/hooks/entities.ts b/packages/ui/src/hooks/entities.ts index fc1131e29..af6ac8704 100644 --- a/packages/ui/src/hooks/entities.ts +++ b/packages/ui/src/hooks/entities.ts @@ -67,7 +67,7 @@ export const useEntities = (): EntitiesContextResult => { currentSchemaType: camelResource?.getType(), setCurrentSchemaType: setCurrentSchemaType(), visualEntities: camelResource.getVisualEntities(), - flowTemplateService: flowTemplateService, + flowTemplateService, camelResource, updateCodeFromEntities, eventNotifier, diff --git a/packages/ui/src/models/visualization/flows/flow-templates-service.ts b/packages/ui/src/models/visualization/flows/flow-templates-service.ts index 1211fef3c..0ed32feb9 100644 --- a/packages/ui/src/models/visualization/flows/flow-templates-service.ts +++ b/packages/ui/src/models/visualization/flows/flow-templates-service.ts @@ -12,13 +12,15 @@ export class FlowTemplateService { return `apiVersion: camel.apache.org/v1 kind: Pipe metadata: - name: webhook-binding + name: new-pipe-template spec: source: ref: kind: Kamelet apiVersion: camel.apache.org/v1 name: timer-source + properties: + message: hello sink: ref: kind: Kamelet @@ -29,9 +31,11 @@ spec: return `- route: from: uri: timer:template + parameters: + period: "1000" steps: - - to: - uri: log:template`; + - log: + message: template message`; default: return ''; } diff --git a/packages/ui/src/models/visualization/flows/flows-visibility.ts b/packages/ui/src/models/visualization/flows/flows-visibility.ts index 2fbc2e867..83061daf8 100644 --- a/packages/ui/src/models/visualization/flows/flows-visibility.ts +++ b/packages/ui/src/models/visualization/flows/flows-visibility.ts @@ -95,7 +95,7 @@ export class VisualFlowsApi { } toggleFlowVisible(flowId: string, isVisible?: boolean) { - this.dispatch({ type: 'toggleFlowVisible', flowId: flowId, isVisible: isVisible }); + this.dispatch({ type: 'toggleFlowVisible', flowId, isVisible }); } showAllFlows() { @@ -109,6 +109,7 @@ export class VisualFlowsApi { setVisibleFlows(flows: string[]) { this.dispatch({ type: 'setVisibleFlows', flows: flows }); } + clearFlows() { this.dispatch({ type: 'clearFlows' }); } diff --git a/packages/ui/src/providers/visible-flows.provider.tsx b/packages/ui/src/providers/visible-flows.provider.tsx index f58e65c2e..829dffcc5 100644 --- a/packages/ui/src/providers/visible-flows.provider.tsx +++ b/packages/ui/src/providers/visible-flows.provider.tsx @@ -20,7 +20,7 @@ export const VisibleFlowsProvider: FunctionComponent = (props const flows: IVisibleFlows = {}; entitiesContext?.visualEntities.forEach((visualEntity) => (flows[visualEntity.id] = visibleFlows[visualEntity.id])); - const hiddenAll = Object.values(flows).reduce((acc, current) => acc && !current, true); + const hiddenAll = Object.values(flows).every((visible) => !visible); if (hiddenAll) { flows[entitiesContext!.visualEntities[0].id] = true; }