Skip to content

Commit e5aa89d

Browse files
frouenepcdavid
authored andcommitted
[2796] Convert flow to view DSL
Bug: #2796 Signed-off-by: Florian ROUËNÉ <florian.rouene@obeosoft.com>
1 parent d53ef48 commit e5aa89d

File tree

78 files changed

+3797
-197
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+3797
-197
lines changed

CHANGELOG.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ Additional changes to this interface will propably occur in the near future in o
8080
- https://github.com/eclipse-sirius/sirius-web/issues/2889[#2889] [emf] Remove the default implementation of the editing context from the `sirius-components-emf` module.
8181
The default implementation of the editing context for Sirius Web, which had Sirius Web specific code already, will be owned by `sirius-web-services`.
8282
This default implementation will now also contain all the view models properly loaded which should be considered during the lifecycle of the editing context.
83+
- https://github.com/eclipse-sirius/sirius-web/issues/2796[#2796] [sirius-web] All Flow related configurations have been moved to `sirius-components-flow-starter` module.
8384

8485
=== Dependency update
8586

@@ -153,6 +154,7 @@ Among those capabilities, we should find the list of view models to consider dur
153154
This change makes the editing context the single source of truth for the state of the view models.
154155
- https://github.com/eclipse-sirius/sirius-web/issues/2904[#2904] [sirius-web] Order candidates in Representations sections in the Onboard Area.
155156
- https://github.com/eclipse-sirius/sirius-web/issues/2903[#2903] [sirius-web] Order New Representation modal candidates.
157+
- https://github.com/eclipse-sirius/sirius-web/issues/2796[#2796] [sirius-web] Flow diagram description has been converted to the view DSL.
156158

157159
== v2023.12.0
158160

integration-tests/cypress/e2e/project/diagrams/diagram-selection-dialog.cy.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*******************************************************************************
2-
* Copyright (c) 2021, 2023 Obeo.
2+
* Copyright (c) 2021, 2024 Obeo.
33
* This program and the accompanying materials
4-
* are made available under the erms of the Eclipse Public License v2.0
4+
* are made available under the terms of the Eclipse Public License v2.0
55
* which accompanies this distribution, and is available at
66
* https://www.eclipse.org/legal/epl-2.0/
77
*
@@ -10,7 +10,9 @@
1010
* Contributors:
1111
* Obeo - initial API and implementation
1212
*******************************************************************************/
13-
describe('/projects/:projectId/edit - Diagram', () => {
13+
// Flow diagram description does not have selection tools after the view DSL conversion
14+
// These tests can be reactivated when selection support is added to React-Flow
15+
describe.skip('/projects/:projectId/edit - Diagram', () => {
1416
beforeEach(() => {
1517
cy.deleteAllProjects();
1618
cy.createProject('Cypress Project').then((res) => {

integration-tests/cypress/e2e/project/diagrams/diagram.cy.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ describe('/projects/:projectId/edit - Diagram', () => {
9191
cy.getByTestId('Topography with auto layout').click();
9292
cy.getByTestId('create-representation').click();
9393

94-
cy.get('#diagram>svg text.sprotty-label').should('have.length', 23);
95-
cy.get('#diagram>svg foreignObject.sprotty-label').should('have.length', 2);
94+
cy.get('#diagram>svg text.sprotty-label').should('have.length', 25);
9695
cy.get('#diagram>svg g.sprotty-edge').should('have.length', 7);
9796
cy.get('#diagram>svg image').should('have.length', 10);
9897
cy.get('#diagram rect').should('have.length', 18);
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2024 Obeo.
3+
* This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v2.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*
10+
* Contributors:
11+
* Obeo - initial API and implementation
12+
*******************************************************************************/
13+
14+
import { Project } from '../../../pages/Project';
15+
import { Flow } from '../../../usecases/Flow';
16+
import { Explorer } from '../../../workbench/Explorer';
17+
import { Diagram } from '../../../workbench/Diagram';
18+
19+
const projectName = 'Cypress - flow';
20+
21+
describe('Flow', () => {
22+
context('Given a flow project with a robot document', () => {
23+
let projectId: string = '';
24+
beforeEach(() =>
25+
new Flow().createRobotProject(projectName).then((createdProjectData) => {
26+
projectId = createdProjectData.projectId;
27+
new Project().visit(projectId);
28+
})
29+
);
30+
31+
afterEach(() => cy.deleteProject(projectId));
32+
33+
context('When we interact with the flow diagram', () => {
34+
it('Then I can create a topography diagram', () => {
35+
const explorer = new Explorer();
36+
const diagram = new Diagram();
37+
explorer.getExplorerView().contains('robot');
38+
explorer.expand('robot');
39+
explorer.createRepresentation('Robot', 'Topography', 'diagramTopography');
40+
diagram.getDiagram('diagramTopography').should('exist');
41+
diagram.getNodes('diagramTopography', 'Central_Unit').should('exist');
42+
});
43+
44+
it('Then I can create a topography unsynchronized diagram', () => {
45+
const explorer = new Explorer();
46+
const diagram = new Diagram();
47+
explorer.getExplorerView().contains('robot');
48+
explorer.expand('robot');
49+
explorer.createRepresentation('Robot', 'Topography unsynchronized', 'diagramTopographyUnsynchronized');
50+
diagram.getDiagram('diagramTopographyUnsynchronized').should('exist');
51+
diagram.getNodes('diagramTopographyUnsynchronized', 'Central_Unit').should('not.exist');
52+
});
53+
54+
it('Then I can create a topography with auto layout diagram', () => {
55+
const explorer = new Explorer();
56+
const diagram = new Diagram();
57+
explorer.getExplorerView().contains('robot');
58+
explorer.expand('robot');
59+
explorer.createRepresentation('Robot', 'Topography with auto layout', 'diagramTopographyWithAutoLayout');
60+
diagram.getDiagram('diagramTopographyWithAutoLayout').should('exist');
61+
diagram.getNodes('diagramTopographyWithAutoLayout', 'Description').should('exist');
62+
});
63+
});
64+
});
65+
});

packages/sirius-web/backend/sirius-web-sample-application/pom.xml

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
<properties>
3131
<java.version>17</java.version>
32-
<flow.version>1.0.11-SNAPSHOT</flow.version>
3332
<bpmn.version>4.0.3-SNAPSHOT</bpmn.version>
3433
<eef.version>2.1.5-SNAPSHOT</eef.version>
3534
</properties>
@@ -156,23 +155,13 @@
156155
</dependency>
157156
<dependency>
158157
<groupId>org.eclipse.sirius</groupId>
159-
<artifactId>sirius-components-view-deck</artifactId>
160-
<version>2023.12.8</version>
161-
</dependency>
162-
<dependency>
163-
<groupId>fr.obeo.dsl.designer.sample.flow</groupId>
164-
<artifactId>fr.obeo.dsl.designer.sample.flow</artifactId>
165-
<version>${flow.version}</version>
166-
</dependency>
167-
<dependency>
168-
<groupId>fr.obeo.dsl.designer.sample.flow</groupId>
169-
<artifactId>fr.obeo.dsl.designer.sample.flow.edit</artifactId>
170-
<version>${flow.version}</version>
158+
<artifactId>sirius-components-flow-starter</artifactId>
159+
<version>2023.12.8</version>
171160
</dependency>
172161
<dependency>
173-
<groupId>fr.obeo.dsl.designer.sample.flow</groupId>
174-
<artifactId>fr.obeo.dsl.designer.sample.flow.design</artifactId>
175-
<version>${flow.version}</version>
162+
<groupId>org.eclipse.sirius</groupId>
163+
<artifactId>sirius-components-view-deck</artifactId>
164+
<version>2023.12.8</version>
176165
</dependency>
177166
<dependency>
178167
<groupId>BPMN2</groupId>
@@ -269,13 +258,13 @@
269258
<version>2023.12.8</version>
270259
<scope>test</scope>
271260
</dependency>
272-
<dependency>
273-
<groupId>org.eclipse.sirius</groupId>
274-
<artifactId>sirius-components-view-deck-edit</artifactId>
275-
<version>2023.12.8</version>
276-
<scope>compile</scope>
277-
</dependency>
278-
</dependencies>
261+
<dependency>
262+
<groupId>org.eclipse.sirius</groupId>
263+
<artifactId>sirius-components-view-deck-edit</artifactId>
264+
<version>2023.12.8</version>
265+
<scope>compile</scope>
266+
</dependency>
267+
</dependencies>
279268

280269
<build>
281270
<plugins>

packages/sirius-web/backend/sirius-web-sample-application/src/main/java/org/eclipse/sirius/web/sample/configuration/SampleEMFConfiguration.java

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2019, 2023 Obeo.
2+
* Copyright (c) 2019, 2024 Obeo.
33
* This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v2.0
55
* which accompanies this distribution, and is available at
@@ -12,16 +12,11 @@
1212
*******************************************************************************/
1313
package org.eclipse.sirius.web.sample.configuration;
1414

15-
import fr.obeo.dsl.designer.sample.flow.FlowPackage;
16-
import fr.obeo.dsl.designer.sample.flow.provider.FlowItemProviderAdapterFactory;
17-
1815
import org.eclipse.emf.common.notify.AdapterFactory;
1916
import org.eclipse.emf.ecore.EPackage;
2017
import org.eclipse.sirius.components.domain.DomainPackage;
2118
import org.eclipse.sirius.components.domain.provider.DomainItemProviderAdapterFactory;
2219
import org.eclipse.sirius.components.emf.configuration.ChildExtenderProvider;
23-
import org.eclipse.sirius.components.emf.services.ILabelFeatureProvider;
24-
import org.eclipse.sirius.components.emf.services.LabelFeatureProvider;
2520
import org.eclipse.sirius.components.view.ViewPackage;
2621
import org.eclipse.sirius.components.view.diagram.DiagramPackage;
2722
import org.eclipse.sirius.components.view.diagram.provider.DiagramItemProviderAdapterFactory;
@@ -44,21 +39,6 @@
4439
@Configuration
4540
public class SampleEMFConfiguration {
4641

47-
@Bean
48-
public AdapterFactory flowAdapterFactory() {
49-
return new FlowItemProviderAdapterFactory();
50-
}
51-
52-
@Bean
53-
public EPackage flowEPackage() {
54-
return FlowPackage.eINSTANCE;
55-
}
56-
57-
@Bean
58-
public ILabelFeatureProvider flowLabelFeatureProvider() {
59-
return new LabelFeatureProvider(FlowPackage.eINSTANCE.getNsURI(), new FlowLabelFeatureSwitch(), new FlowEditableSwitch());
60-
}
61-
6242
@Bean
6343
@ConditionalOnProperty(prefix = "org.eclipse.sirius.web.features", name = "studioDefinition")
6444
public EPackage domainEPackage() {

packages/sirius-web/backend/sirius-web-sample-application/src/main/java/org/eclipse/sirius/web/sample/configuration/SampleSiriusConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2019, 2022 Obeo.
2+
* Copyright (c) 2019, 2024 Obeo.
33
* This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v2.0
55
* which accompanies this distribution, and is available at
@@ -29,7 +29,7 @@ public class SampleSiriusConfiguration implements ISiriusConfiguration {
2929

3030
@Override
3131
public List<String> getODesignPaths() {
32-
return List.of("description/flow.odesign");
32+
return List.of();
3333
}
3434

3535
@Bean

packages/sirius-web/backend/sirius-web-sample-application/src/main/java/org/eclipse/sirius/web/sample/configuration/StereotypeDescriptionRegistryConfigurer.java

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2019, 2023 Obeo.
2+
* Copyright (c) 2019, 2024 Obeo.
33
* This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v2.0
55
* which accompanies this distribution, and is available at
@@ -12,8 +12,6 @@
1212
*******************************************************************************/
1313
package org.eclipse.sirius.web.sample.configuration;
1414

15-
import fr.obeo.dsl.designer.sample.flow.FlowFactory;
16-
1715
import java.util.List;
1816
import java.util.UUID;
1917

@@ -30,7 +28,6 @@
3028
import org.eclipse.sirius.web.sample.papaya.view.PapayaViewProvider;
3129
import org.springframework.beans.factory.annotation.Value;
3230
import org.springframework.context.annotation.Configuration;
33-
import org.springframework.core.io.ClassPathResource;
3431

3532
import io.micrometer.core.instrument.MeterRegistry;
3633

@@ -46,18 +43,6 @@ public class StereotypeDescriptionRegistryConfigurer implements IStereotypeDescr
4643

4744
public static final String EMPTY_LABEL = "Others...";
4845

49-
public static final UUID EMPTY_FLOW_ID = UUID.nameUUIDFromBytes("empty_flow".getBytes());
50-
51-
public static final String EMPTY_FLOW_LABEL = "Flow";
52-
53-
public static final UUID ROBOT_FLOW_ID = UUID.nameUUIDFromBytes("robot_flow".getBytes());
54-
55-
public static final String ROBOT_FLOW_LABEL = "Robot Flow";
56-
57-
public static final UUID BIG_GUY_FLOW_ID = UUID.nameUUIDFromBytes("big_guy_flow".getBytes());
58-
59-
public static final String BIG_GUY_FLOW_LABEL = "Big Guy Flow (17k elements)";
60-
6146
public static final UUID EMPTY_VIEW_ID = UUID.nameUUIDFromBytes("empty_view".getBytes());
6247

6348
public static final String EMPTY_VIEW_LABEL = "View";
@@ -90,15 +75,12 @@ public StereotypeDescriptionRegistryConfigurer(MeterRegistry meterRegistry, @Val
9075

9176
@Override
9277
public void addStereotypeDescriptions(IStereotypeDescriptionRegistry registry) {
93-
registry.add(new StereotypeDescription(EMPTY_FLOW_ID, EMPTY_FLOW_LABEL, this::getEmptyFlowContent));
9478
if (this.studiosEnabled) {
9579
registry.add(new StereotypeDescription(EMPTY_DOMAIN_ID, EMPTY_DOMAIN_LABEL, this::getEmptyDomainContent));
9680
registry.add(new StereotypeDescription(EMPTY_VIEW_ID, EMPTY_VIEW_LABEL, this::getEmptyViewContent));
9781
registry.add(new StereotypeDescription(PAPAYA_DOMAIN_ID, PAPAYA_DOMAIN_LABEL, this::getPapayaDomainContent));
9882
registry.add(new StereotypeDescription(PAPAYA_VIEW_ID, PAPAYA_VIEW_LABEL, this::getPapayaViewContent));
9983
}
100-
registry.add(new StereotypeDescription(ROBOT_FLOW_ID, ROBOT_FLOW_LABEL, this::getRobotFlowContent));
101-
registry.add(new StereotypeDescription(BIG_GUY_FLOW_ID, BIG_GUY_FLOW_LABEL, this::getBigGuyFlowContent));
10284
registry.add(new StereotypeDescription(EMPTY_ID, EMPTY_LABEL, "New", this::getEmptyContent));
10385
}
10486

@@ -130,15 +112,4 @@ private String getEmptyContent() {
130112
return this.stereotypeBuilder.getStereotypeBody(List.of());
131113
}
132114

133-
private String getEmptyFlowContent() {
134-
return this.stereotypeBuilder.getStereotypeBody(List.of(FlowFactory.eINSTANCE.createSystem()));
135-
}
136-
137-
private String getRobotFlowContent() {
138-
return this.stereotypeBuilder.getStereotypeBody(new ClassPathResource("robot.flow"));
139-
}
140-
141-
private String getBigGuyFlowContent() {
142-
return this.stereotypeBuilder.getStereotypeBody(new ClassPathResource("Big_Guy.flow"));
143-
}
144115
}

0 commit comments

Comments
 (0)