forked from eclipse-sirius/sirius-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[4037] Add support for actions in tree item menu
Bug: eclipse-sirius#4037 Signed-off-by: Jerome Gout <[email protected]> Signed-off-by: Florian ROUËNÉ <[email protected]>
- Loading branch information
1 parent
e2d6de5
commit aadd5fe
Showing
79 changed files
with
6,024 additions
and
811 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
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
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
64 changes: 64 additions & 0 deletions
64
...va/org/eclipse/sirius/web/tests/graphql/FetchTreeItemContextMenuEntryDataQueryRunner.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,64 @@ | ||
/******************************************************************************* | ||
* 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.tests.graphql; | ||
|
||
import java.util.Map; | ||
import java.util.Objects; | ||
|
||
import org.eclipse.sirius.components.graphql.tests.api.IGraphQLRequestor; | ||
import org.eclipse.sirius.components.graphql.tests.api.IQueryRunner; | ||
import org.springframework.stereotype.Service; | ||
|
||
/** | ||
* Used to get the list of actions in the context menu of a tree item from the GraphQL API. | ||
* | ||
* @author Jerome Gout | ||
*/ | ||
@Service | ||
public class FetchTreeItemContextMenuEntryDataQueryRunner implements IQueryRunner { | ||
|
||
private static final String TREE_ITEM_CONTEXT_MENU_QUERY = """ | ||
query getFetchTreeItemContextMenuEntryDataQuery( | ||
$editingContextId: ID! | ||
$representationId: ID! | ||
$treeItemId: ID! | ||
$menuEntryId: ID! | ||
) { | ||
viewer { | ||
editingContext(editingContextId: $editingContextId) { | ||
representation(representationId: $representationId) { | ||
description { | ||
... on TreeDescription { | ||
fetchTreeItemContextMenuEntryData(treeItemId: $treeItemId, menuEntryId: $menuEntryId) { | ||
urlToFetch | ||
fetchKind | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
"""; | ||
|
||
private final IGraphQLRequestor graphQLRequestor; | ||
|
||
public FetchTreeItemContextMenuEntryDataQueryRunner(IGraphQLRequestor graphQLRequestor) { | ||
this.graphQLRequestor = Objects.requireNonNull(graphQLRequestor); | ||
} | ||
|
||
@Override | ||
public String run(Map<String, Object> variables) { | ||
return this.graphQLRequestor.execute(TREE_ITEM_CONTEXT_MENU_QUERY, variables); | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
...g/eclipse/sirius/web/tests/graphql/SingleClickTreeItemContextMenuEntryMutationRunner.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,60 @@ | ||
/******************************************************************************* | ||
* 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.tests.graphql; | ||
|
||
import java.util.Map; | ||
import java.util.Objects; | ||
|
||
import org.eclipse.sirius.components.collaborative.trees.dto.InvokeSingleClickTreeItemContextMenuEntryInput; | ||
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 execute a single click context menu entry with the GraphQL API. | ||
* | ||
* @author Jerome Gout | ||
*/ | ||
@Service | ||
public class SingleClickTreeItemContextMenuEntryMutationRunner implements IMutationRunner<InvokeSingleClickTreeItemContextMenuEntryInput> { | ||
|
||
private static final String INVOKE_SINGLE_CLICK_CONTEXT_MENU_ENTRY = """ | ||
mutation invokeSingleClickTreeItemContextMenuEntry($input: InvokeSingleClickTreeItemContextMenuEntryInput!) { | ||
invokeSingleClickTreeItemContextMenuEntry(input: $input) { | ||
__typename | ||
... on ErrorPayload { | ||
message | ||
} | ||
} | ||
} | ||
"""; | ||
|
||
private final IGraphQLRequestor graphQLRequestor; | ||
|
||
public SingleClickTreeItemContextMenuEntryMutationRunner(IGraphQLRequestor graphQLRequestor) { | ||
this.graphQLRequestor = Objects.requireNonNull(graphQLRequestor); | ||
} | ||
|
||
@Override | ||
public String run(InvokeSingleClickTreeItemContextMenuEntryInput input) { | ||
Map<String, Object> inputMap = Map.of( | ||
"id", input.id(), | ||
"editingContextId", input.editingContextId(), | ||
"representationId", input.representationId(), | ||
"treeItemId", input.treeItemId(), | ||
"menuEntryId", input.menuEntryId() | ||
); | ||
Map<String, Object> variables = Map.of("input", inputMap); | ||
return this.graphQLRequestor.execute(INVOKE_SINGLE_CLICK_CONTEXT_MENU_ENTRY, variables); | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
...ts/src/main/java/org/eclipse/sirius/web/tests/graphql/TreeItemContextMenuQueryRunner.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.web.tests.graphql; | ||
|
||
import java.util.Map; | ||
import java.util.Objects; | ||
|
||
import org.eclipse.sirius.components.graphql.tests.api.IGraphQLRequestor; | ||
import org.eclipse.sirius.components.graphql.tests.api.IQueryRunner; | ||
import org.springframework.stereotype.Service; | ||
|
||
/** | ||
* Used to get the list of actions in the context menu of a tree item from the GraphQL API. | ||
* | ||
* @author Jerome Gout | ||
*/ | ||
@Service | ||
public class TreeItemContextMenuQueryRunner implements IQueryRunner { | ||
|
||
private static final String TREE_ITEM_CONTEXT_MENU_QUERY = """ | ||
query getAllContextMenuActions($editingContextId: ID!, $representationId: ID!, $treeItemId: ID!) { | ||
viewer { | ||
editingContext(editingContextId: $editingContextId) { | ||
representation(representationId: $representationId) { | ||
description { | ||
... on TreeDescription { | ||
contextMenu(treeItemId: $treeItemId) { | ||
__typename | ||
id | ||
label | ||
iconURL | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
"""; | ||
|
||
private final IGraphQLRequestor graphQLRequestor; | ||
|
||
public TreeItemContextMenuQueryRunner(IGraphQLRequestor graphQLRequestor) { | ||
this.graphQLRequestor = Objects.requireNonNull(graphQLRequestor); | ||
} | ||
|
||
@Override | ||
public String run(Map<String, Object> variables) { | ||
return this.graphQLRequestor.execute(TREE_ITEM_CONTEXT_MENU_QUERY, variables); | ||
} | ||
} |
Oops, something went wrong.