Skip to content

Commit 3af4778

Browse files
phillip-krugergsmet
authored andcommitted
Dev UI: Shortern the save message in the workspace
Signed-off-by: Phillip Kruger <[email protected]> (cherry picked from commit c9e9642)
1 parent 54bcd9c commit 3af4778

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/menu/WorkspaceProcessor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
9696
}
9797

9898
sortWorkspaceItems(workspaceItems);
99-
workspaceProducer.produce(new WorkspaceBuildItem(workspaceItems));
99+
workspaceProducer.produce(new WorkspaceBuildItem(projectRoot, workspaceItems));
100100
}
101101
}
102102

@@ -185,7 +185,7 @@ void createBuildTimeActions(Optional<WorkspaceBuildItem> workspaceBuildItem,
185185
String content = params.get("content");
186186
Path path = Paths.get(URI.create(params.get("path")));
187187
writeContent(path, content);
188-
return new SavedResult(path, true, null);
188+
return new SavedResult(workspaceBuildItem.get().getRootPath().relativize(path).toString(), true, null);
189189
}
190190
return new SavedResult(null, false, "Invalid input");
191191
});
@@ -283,7 +283,7 @@ private String getFileTypeManually(Path filePath) {
283283
return fileName.contains(".") ? fileName.substring(fileName.lastIndexOf('.') + 1) : "";
284284
}
285285

286-
static record SavedResult(Path path, boolean success, String errorMessage) {
286+
static record SavedResult(String path, boolean success, String errorMessage) {
287287
}
288288

289289
static record WorkspaceContent(String type, String content, boolean isBinary) {

extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-workspace.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class QwcWorkspace extends observeState(QwcHotReloadElement) {
8585
_changeToWorkspaceItem: {state: true},
8686
_actionResult: {state: true},
8787
_showActionProgress: {state: true},
88-
_confirmDialogOpened: {state: true},
88+
_confirmDialogOpened: {state: true}
8989
};
9090

9191
constructor() {
@@ -474,7 +474,6 @@ export class QwcWorkspace extends observeState(QwcHotReloadElement) {
474474
if(jsonRpcResponse.result.success){
475475
notifier.showInfoMessage(jsonRpcResponse.result.path + " saved successfully");
476476
if(select) this._selectedWorkspaceItem = { ...this._selectedWorkspaceItem, content: content, isDirty: false };
477-
//super.forceRestart();
478477
}else {
479478
notifier.showErrorMessage(jsonRpcResponse.result.path + " NOT saved. " + jsonRpcResponse.result.errorMessage);
480479
}

extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/workspace/WorkspaceBuildItem.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
*/
1212
public final class WorkspaceBuildItem extends SimpleBuildItem {
1313
private final List<WorkspaceItem> workspaceItems;
14+
private final Path rootPath;
1415

15-
public WorkspaceBuildItem(List<WorkspaceItem> workspaceItems) {
16+
public WorkspaceBuildItem(Path rootPath, List<WorkspaceItem> workspaceItems) {
17+
this.rootPath = rootPath;
1618
this.workspaceItems = workspaceItems;
1719
}
1820

@@ -26,6 +28,10 @@ public List<Path> getPaths() {
2628
.collect(Collectors.toList());
2729
}
2830

31+
public Path getRootPath() {
32+
return this.rootPath;
33+
}
34+
2935
public static record WorkspaceItem(String name, Path path) {
3036

3137
}

0 commit comments

Comments
 (0)