-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[3429] Add diagram filter view in diagram panel
Bug: #3429 Signed-off-by: Gwendal Daniel <[email protected]>
- Loading branch information
1 parent
36043f5
commit d8d770d
Showing
66 changed files
with
3,904 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...us-components-collaborative-diagrams/src/main/resources/diagram-images/fade.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
...ius-components-collaborative-diagrams/src/main/resources/diagram-images/pin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions
43
...laborative-diagrams/src/main/resources/diagram-images/reveal-faded-elements.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
...s-components-collaborative-diagrams/src/main/resources/diagram-images/unpin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...ams/frontend/sirius-components-diagrams/src/renderer/panel/DiagramPanelExtensionPoints.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
|
||
import { ComponentExtensionPoint } from '@eclipse-sirius/sirius-components-core'; | ||
import { DiagramPanelActionProps } from './DiagramPanel.types'; | ||
|
||
export const diagramPanelActionExtensionPoint: ComponentExtensionPoint<DiagramPanelActionProps> = { | ||
identifier: 'diagramPanel#action', | ||
FallbackComponent: () => null, | ||
}; |
61 changes: 61 additions & 0 deletions
61
...ava/org/eclipse/sirius/components/forms/tests/graphql/EditTreeCheckboxMutationRunner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.sirius.components.forms.tests.graphql; | ||
|
||
import java.util.Objects; | ||
|
||
import org.eclipse.sirius.components.collaborative.forms.dto.EditTreeCheckboxInput; | ||
import org.eclipse.sirius.components.graphql.tests.api.IGraphQLRequestor; | ||
import org.eclipse.sirius.components.graphql.tests.api.IMutationRunner; | ||
import org.springframework.stereotype.Service; | ||
|
||
/** | ||
* Used to edit a tree checkbox with the GraphQL API. | ||
* | ||
* @author gdaniel | ||
*/ | ||
@Service | ||
public class EditTreeCheckboxMutationRunner implements IMutationRunner<EditTreeCheckboxInput> { | ||
|
||
private static final String EDIT_TREE_CHECKBOX_MUTATION = """ | ||
mutation editTreeCheckbox($input: EditTreeCheckboxInput!) { | ||
editTreeCheckbox(input: $input) { | ||
__typename | ||
... on ErrorPayload { | ||
messages { | ||
body | ||
level | ||
} | ||
} | ||
... on SuccessPayload { | ||
messages { | ||
body | ||
level | ||
} | ||
} | ||
} | ||
} | ||
"""; | ||
|
||
private final IGraphQLRequestor graphQLRequestor; | ||
|
||
public EditTreeCheckboxMutationRunner(IGraphQLRequestor graphQLRequestor) { | ||
this.graphQLRequestor = Objects.requireNonNull(graphQLRequestor); | ||
} | ||
|
||
@Override | ||
public String run(EditTreeCheckboxInput input) { | ||
return this.graphQLRequestor.execute(EDIT_TREE_CHECKBOX_MUTATION, input); | ||
} | ||
|
||
} |
61 changes: 61 additions & 0 deletions
61
...main/java/org/eclipse/sirius/components/forms/tests/graphql/PushButtonMutationRunner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.sirius.components.forms.tests.graphql; | ||
|
||
import java.util.Objects; | ||
|
||
import org.eclipse.sirius.components.collaborative.forms.dto.PushButtonInput; | ||
import org.eclipse.sirius.components.graphql.tests.api.IGraphQLRequestor; | ||
import org.eclipse.sirius.components.graphql.tests.api.IMutationRunner; | ||
import org.springframework.stereotype.Service; | ||
|
||
/** | ||
* Used to push a button with the GraphQL API. | ||
* | ||
* @author gdaniel | ||
*/ | ||
@Service | ||
public class PushButtonMutationRunner implements IMutationRunner<PushButtonInput> { | ||
|
||
private static final String PUSH_BUTTON_MUTATION = """ | ||
mutation pushButton($input: PushButtonInput!) { | ||
pushButton(input: $input) { | ||
__typename | ||
... on ErrorPayload { | ||
messages { | ||
body | ||
level | ||
} | ||
} | ||
... on SuccessPayload { | ||
messages { | ||
body | ||
level | ||
} | ||
} | ||
} | ||
} | ||
"""; | ||
|
||
private final IGraphQLRequestor graphQLRequestor; | ||
|
||
public PushButtonMutationRunner(IGraphQLRequestor graphQLRequestor) { | ||
this.graphQLRequestor = Objects.requireNonNull(graphQLRequestor); | ||
} | ||
|
||
@Override | ||
public String run(PushButtonInput input) { | ||
return this.graphQLRequestor.execute(PUSH_BUTTON_MUTATION, input); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...sirius/web/application/diagram/controllers/SubscriptionDiagramFilterEventDataFetcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.sirius.web.application.diagram.controllers; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.Objects; | ||
|
||
import org.eclipse.sirius.components.annotations.spring.graphql.SubscriptionDataFetcher; | ||
import org.eclipse.sirius.components.collaborative.forms.dto.PropertiesEventInput; | ||
import org.eclipse.sirius.components.core.api.IPayload; | ||
import org.eclipse.sirius.components.graphql.api.IDataFetcherWithFieldCoordinates; | ||
import org.eclipse.sirius.components.graphql.api.IEventProcessorSubscriptionProvider; | ||
import org.eclipse.sirius.components.graphql.api.IExceptionWrapper; | ||
import org.eclipse.sirius.components.graphql.api.LocalContextConstants; | ||
import org.eclipse.sirius.web.application.diagram.services.filter.api.DiagramFilterConfiguration; | ||
import org.reactivestreams.Publisher; | ||
|
||
import graphql.execution.DataFetcherResult; | ||
import graphql.schema.DataFetchingEnvironment; | ||
|
||
/** | ||
* The data fetcher used to send the refreshed diagram filters to a subscription. | ||
* | ||
* @author gdaniel | ||
*/ | ||
@SubscriptionDataFetcher(type = "Subscription", field = "diagramFilterEvent") | ||
public class SubscriptionDiagramFilterEventDataFetcher implements IDataFetcherWithFieldCoordinates<Publisher<DataFetcherResult<IPayload>>> { | ||
|
||
private static final String INPUT_ARGUMENT = "input"; | ||
|
||
private final ObjectMapper objectMapper; | ||
|
||
private final IExceptionWrapper exceptionWrapper; | ||
|
||
private final IEventProcessorSubscriptionProvider eventProcessorSubscriptionProvider; | ||
|
||
public SubscriptionDiagramFilterEventDataFetcher(ObjectMapper objectMapper, IExceptionWrapper exceptionWrapper, IEventProcessorSubscriptionProvider eventProcessorSubscriptionProvider) { | ||
this.objectMapper = Objects.requireNonNull(objectMapper); | ||
this.exceptionWrapper = Objects.requireNonNull(exceptionWrapper); | ||
this.eventProcessorSubscriptionProvider = Objects.requireNonNull(eventProcessorSubscriptionProvider); | ||
} | ||
|
||
@Override | ||
public Publisher<DataFetcherResult<IPayload>> get(DataFetchingEnvironment environment) throws Exception { | ||
Object argument = environment.getArgument(INPUT_ARGUMENT); | ||
var input = this.objectMapper.convertValue(argument, PropertiesEventInput.class); | ||
var diagramFilterConfiguration = new DiagramFilterConfiguration(input.id().toString(), input.objectIds()); | ||
|
||
Map<String, Object> localContext = new HashMap<>(); | ||
localContext.put(LocalContextConstants.EDITING_CONTEXT_ID, input.editingContextId()); | ||
localContext.put(LocalContextConstants.REPRESENTATION_ID, diagramFilterConfiguration.getId()); | ||
|
||
return this.exceptionWrapper.wrapFlux(() -> this.eventProcessorSubscriptionProvider.getSubscription(input.editingContextId(), diagramFilterConfiguration, input), input) | ||
.map(payload -> DataFetcherResult.<IPayload>newResult() | ||
.data(payload) | ||
.localContext(localContext) | ||
.build()); | ||
} | ||
|
||
} |
Oops, something went wrong.