-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[4346] Improve the query view with object icons and a loading feedback
Bug: #4346 Signed-off-by: Stéphane Bégaudeau <[email protected]>
- Loading branch information
1 parent
ad44eda
commit 979953f
Showing
7 changed files
with
126 additions
and
13 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
51 changes: 51 additions & 0 deletions
51
...java/org/eclipse/sirius/web/application/object/controllers/ObjectIconURLsDataFetcher.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,51 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2025 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.object.controllers; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
import org.eclipse.sirius.components.annotations.spring.graphql.QueryDataFetcher; | ||
import org.eclipse.sirius.components.core.api.IImageURLSanitizer; | ||
import org.eclipse.sirius.components.core.api.ILabelService; | ||
import org.eclipse.sirius.components.graphql.api.IDataFetcherWithFieldCoordinates; | ||
import org.eclipse.sirius.components.graphql.api.URLConstants; | ||
|
||
import graphql.schema.DataFetchingEnvironment; | ||
|
||
/** | ||
* The data fetcher for the field Object#iconURLs. | ||
* | ||
* @author sbegaudeau | ||
*/ | ||
@QueryDataFetcher(type = "Object", field = "iconURLs") | ||
public class ObjectIconURLsDataFetcher implements IDataFetcherWithFieldCoordinates<List<String>> { | ||
|
||
private final IImageURLSanitizer imageURLSanitizer; | ||
|
||
private final ILabelService labelService; | ||
|
||
public ObjectIconURLsDataFetcher(IImageURLSanitizer imageURLSanitizer, ILabelService labelService) { | ||
this.imageURLSanitizer = Objects.requireNonNull(imageURLSanitizer); | ||
this.labelService = Objects.requireNonNull(labelService); | ||
} | ||
|
||
@Override | ||
public List<String> get(DataFetchingEnvironment environment) throws Exception { | ||
var object = environment.getSource(); | ||
|
||
return this.labelService.getImagePath(object).stream() | ||
.map(url -> this.imageURLSanitizer.sanitize(URLConstants.IMAGE_BASE_PATH, url)) | ||
.toList(); | ||
} | ||
} |
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