Skip to content

Commit

Permalink
chore(viz): formating and reflect suggested PR changes + make route t…
Browse files Browse the repository at this point in the history
…emplate runnable with jbang
  • Loading branch information
mmelko authored and lordrip committed Oct 26, 2023
1 parent 32d40c3 commit b3d4a52
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export const NewFlow: FunctionComponent<PropsWithChildren> = () => {

const checkBeforeAddNewFlow = useCallback(
(flowType: SourceSchemaType) => {
// console.log('selected new flow', flowType);
const isSameSourceType = entitiesContext.currentSchemaType === flowType;

if (isSameSourceType) {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/hooks/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const useEntities = (): EntitiesContextResult => {
currentSchemaType: camelResource?.getType(),
setCurrentSchemaType: setCurrentSchemaType(),
visualEntities: camelResource.getVisualEntities(),
flowTemplateService: flowTemplateService,
flowTemplateService,
camelResource,
updateCodeFromEntities,
eventNotifier,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 '';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -109,6 +109,7 @@ export class VisualFlowsApi {
setVisibleFlows(flows: string[]) {
this.dispatch({ type: 'setVisibleFlows', flows: flows });
}

clearFlows() {
this.dispatch({ type: 'clearFlows' });
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/providers/visible-flows.provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const VisibleFlowsProvider: FunctionComponent<PropsWithChildren> = (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;
}
Expand Down

0 comments on commit b3d4a52

Please sign in to comment.