Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Support multiple routes in the same file #801

Closed
11 tasks done
Delawen opened this issue Oct 12, 2022 · 3 comments
Closed
11 tasks done

Support multiple routes in the same file #801

Delawen opened this issue Oct 12, 2022 · 3 comments
Assignees
Labels
enhancement Improve existing features feature request Thumbs up the issue to vote for it visualization Relates to the integration visualization
Milestone

Comments

@Delawen
Copy link
Member

Delawen commented Oct 12, 2022

Context

Sometimes files contain more than one route. The front end right now is not considering a second route that may be available on the same file.

We may need a dropdown with the list of routes in the file. But then, the source code we see will not be the complete list of routes. Or would it?

Roadmap

Associated bugs

Examples

Example of a single route
- from:
    uri: "timer:yaml"
    parameters:
      period: "1000"
    steps:
      - set-body:
          constant: "Hello Camel K from yaml"
      - to: "log:info"
Example of multiple routes
- from:
    uri: "timer:yaml"
    parameters:
      period: "1000"
    steps:
      - set-body:
          constant: "Hello Camel K from yaml"
      - to: "log:info"
- from:
    uri: "timer:anotherone"
    parameters:
      period: "50000"
    steps:
      - set-body:
          constant: "Nobody expects the second route!"
      - to: "log:info"
@Delawen Delawen added enhancement Improve existing features feature request Thumbs up the issue to vote for it labels Oct 12, 2022
@kahboom kahboom added the visualization Relates to the integration visualization label Oct 12, 2022
@kahboom kahboom changed the title Support multiple routes on the same file Support multiple routes in the same file Oct 12, 2022
@kahboom kahboom self-assigned this Oct 12, 2022
@brunoNetId
Copy link

I think this is a must.
it helps organised code and improve readability

@rstroop
Copy link

rstroop commented Mar 2, 2023

Most of the Camel I write has multiple routes. I'd like to add that if we create directs it would be nice to have a dotted line between those routes showing their connection.

@lordrip
Copy link
Member

lordrip commented Apr 28, 2023

Related issue KaotoIO/kaoto-backend#634

@lhein lhein added this to the 1.1.0 milestone May 4, 2023
lordrip added a commit that referenced this issue May 4, 2023
Within the scope of supporting multiple routes, a way to identify
them is required and for that matter this commit adds:

* 'id' property to the IIntegration interface
* 'integrationId' property to the IStepProps interface

It also updates all related stubs, mocks and test to
support the newly added properties.

relates: [801](#801)
lordrip added a commit that referenced this issue May 8, 2023
lordrip added a commit that referenced this issue May 8, 2023
In the existing useIntegrationJSONStore, there are individual methods
to handle the different interaction between the flows' steps.

In the new useFlowsStore the attempt is to have a single method that
handle the same interactions but using a command-like approach of
'append', 'insert', 'replace'.

This API might be subject to change in the future as more functionality
gets ported from single flow to multiple flows

Relates to: #801
lordrip added a commit that referenced this issue May 8, 2023
In order to support multiple flows in the UI, we need to switch our
model from a single flow to an array of flows.

In practical terms, there are at least two alternatives:
1. Refactor existing `IIntegrationJSONStore` to support multiple flows
2. Move from `IIntegrationJSONStore` to another store that supports
multiple flows.

In this commit, the latter was chosen, and for that purpose, the `useFlowsStore`
was created.

In this commit, also an additional setting was added to switch between single and
multiple flows during runtime, to avoid any potential big-bang effect while
developing this feature.

Relates to: #801
lordrip added a commit that referenced this issue May 10, 2023
This commit add the functionality to remove all
existing flows in the canvas

related: #801
lordrip added a commit that referenced this issue May 10, 2023
Currently we're calculating the step's ids by leveraging object references, this come
handy for branches but presents the problem of leaking object references between single
and multiple flows.

This commit leverages lodash.clonedeep dependency to make a copy of the steps as a
workaround for those situations.

This should change in the future with a more robust solution like immer.

relates to: #801
lordrip added a commit that referenced this issue May 22, 2023
With the new endpoints introduced by KaotoIO/kaoto-backend#638, we could start wiring up the source code editor and the related components to use the multiple flows approach.

Changes
This pull request replaces the previous v1/integrations endpoint with the new v2/integrations endpoint that supports multiple flows.

All the changes were validated against the existing e2e tests to ensure that the previous functionality from the single flow is still in place.

* chore: Fix settings.js e2e test
* chore: Fix editing.cy.js e2e test
* chore: Fix step_integration.cy.js e2e test
* chore: Fix source_code.cy.js e2e test
* chore: Fix deleting_steps.cy.js e2e test
* chore: Fix catalog_actions.cy.js e2e test
* chore: Fix code_editor_actions.cy.js e2e test
* chore: Fix step_actions_from_canvas.cy.js e2e test
* chore: Fix step_extension_actions_from_canvas.cy.js e2e test
* chore: Fix branches_from_canvas.cy.js e2e test
* chore: Fix branches_step_actions_from_canvas.cy.js e2e test
* chore: Fix nested_branches_from_canvas.cy.js e2e test
* chore: Fix nested_branches_step_actions_from_canvas.cy.js e2e test

relates to: #801
lordrip added a commit that referenced this issue May 24, 2023
After merging the last pull request about enabling
the flowsStore, the next step is to remove the previous
integrationJsonStore.

In addition to that, another needed step is to remove the
temporary settings switch that toggles between the previous
and the new store.

This pull request removes the integrationJsonStore and adjust
the existing unit tests to comply with the new store.

relates to: #801
lordrip added a commit that referenced this issue May 30, 2023
Currently, there is no mechanism to create a new flow in the
canvas despite now the backend supporting such a feature.

This commit adds the capability to create a new flow directly
from the Toolbar.

Changes:
* Remove Integration name from the Toolbar
* Add a new dropdown to select the new flow dsl
* In case of the dsl of the existing flows is
    the same as the new one, a new flow is created
* On the contrary,  a modal is displayed to warn the
    user that the current flows will be lost

relates to: #801
lordrip added a commit that referenced this issue May 30, 2023
The underlying functionality that these tests covers, has changed in favor of
directly selecting the flow type whenever we create a new route so they no
longer applies.

relates to: #801
lordrip added a commit that referenced this issue Jun 1, 2023
Currently, all existing flows are being shown. This behavior
is not useful when there are many flows at the same time or
somewhat complex flows.

In addition to that, there's no mechanism to delete an existing
flow.

This commit provides a way to toggle the visibility of individual
flows, by leveraging a flows list that also provides the functionality
of deleting individual flows.

relates to: #801
lordrip added a commit that referenced this issue Jun 2, 2023
Currently, the Visualization component is consuming several properties
from the VisualizationStore, and this makes it more susceptible to
store changes, causing rerendering of the VisualizationStepViews
component, and this in turn generates a flickering in the step
extensions.

The fix is to add the 'shallow' function to the 'useVisualizationStore()'
in order to only react to changes in the actual value of said properties.

Relates to: #801
lordrip added a commit that referenced this issue Jun 2, 2023
With the introduction of multiple flows support, some fields from
the settings modal are not valid anymore, like Name, Description and
the Integration type.

This functionality is now embedded in the new multiple flows workflow.

relates to: #801
@lordrip lordrip closed this as completed Jun 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Improve existing features feature request Thumbs up the issue to vote for it visualization Relates to the integration visualization
Projects
None yet
Development

No branches or pull requests

6 participants