Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: storage name in view #285

Merged
merged 3 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions src/main/java/nl/nn/testtool/filter/View.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,24 +123,6 @@ public String toString() {
return getName();
}

public Map<String, Object> toMap(boolean isDefaultView) {
Map<String, String> metadataTypes = new HashMap<>();
for (String metadataName : getMetadataNames()) {
metadataTypes.put(metadataName, metadataExtractor.getType(metadataName));
}

return new HashMap<String, Object>() {{
put("storageName", debugStorage.getName());
put("defaultView", isDefaultView);
put("metadataNames", metadataNames);
put("metadataLabels", getMetadataLabels());
put("crudStorage", debugStorage instanceof CrudStorage);
put("nodeLinkStrategy", nodeLinkStrategy);
put("name", getName());
put("metadataTypes", metadataTypes);
}};
}

public List<String> getMetadataLabels() {
List<String> metadataLabels = new ArrayList<>();
for (String metadataName : getMetadataNames()) {
Expand Down
15 changes: 14 additions & 1 deletion src/main/java/nl/nn/testtool/web/api/TestToolApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,20 @@ public Response getViewsResponse() {
// ExtendedBeanInfo isn't used anymore with newer CXF versions)
Map<String, Map<String, Object>> response = new LinkedHashMap<>();
for (View view : views) {
response.put(view.getName(), view.toMap(view == views.getDefaultView()));
Map<String, Object> map = new HashMap<>();
map.put("name", view.getName());
map.put("storageName", view.getDebugStorage().getName());
map.put("defaultView", view == views.getDefaultView());
map.put("metadataNames", view.getMetadataNames());
map.put("metadataLabels", view.getMetadataLabels());
map.put("crudStorage", view.getDebugStorage() instanceof CrudStorage);
map.put("nodeLinkStrategy", view.getNodeLinkStrategy());
Map<String, String> metadataTypes = new HashMap<>();
for (String metadataName : view.getMetadataNames()) {
metadataTypes.put(metadataName, metadataExtractor.getType(metadataName));
}
map.put("metadataTypes", metadataTypes);
response.put(view.getName(), map);
}
return Response.ok(response).build();
}
Expand Down
Loading