You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think this functionality can be retrofitted into the existing system pretty cleanly actually:
diff --git a/src/main/java/io/cryostat/net/web/http/api/v2/graph/FilterInput.java b/src/main/java/io/cryostat/net/web/http/api/v2/graph/FilterInput.java
index ee783a7c..a845453d 100644
--- a/src/main/java/io/cryostat/net/web/http/api/v2/graph/FilterInput.java+++ b/src/main/java/io/cryostat/net/web/http/api/v2/graph/FilterInput.java@@ -67,6 +67,7 @@ class FilterInput {
enum Key {
ID("id"),
NAME("name"),
+ NAMES("names"),
LABELS("labels"),
ANNOTATIONS("annotations"),
SOURCE_TARGET("sourceTarget"),
diff --git a/src/main/java/io/cryostat/net/web/http/api/v2/graph/TargetNodesFetcher.java b/src/main/java/io/cryostat/net/web/http/api/v2/graph/TargetNodesFetcher.java
index 2e6df720..a966d1bd 100644
--- a/src/main/java/io/cryostat/net/web/http/api/v2/graph/TargetNodesFetcher.java+++ b/src/main/java/io/cryostat/net/web/http/api/v2/graph/TargetNodesFetcher.java@@ -112,6 +112,16 @@ class TargetNodesFetcher extends AbstractPermissionedDataFetcher<List<TargetNode
.filter(n -> Objects.equals(n.getName(), nodeName))
.collect(Collectors.toList());
}
+ if (filter.contains(FilterInput.Key.NAMES)) {+ List<String> names = filter.get(FilterInput.Key.NAMES);+ for (String name : names) {+ result =+ result.stream()+ .filter(n -> LabelSelectorMatcher.parse(name).test(Map.of("name",+ n.getName())))+ .collect(Collectors.toList());+ }+ }
if (filter.contains(FilterInput.Key.LABELS)) {
List<String> labels = filter.get(FilterInput.Key.LABELS);
for (String label : labels) {
diff --git a/src/main/resources/types.graphqls b/src/main/resources/types.graphqls
index 410efb66..5b15af3d 100644
--- a/src/main/resources/types.graphqls+++ b/src/main/resources/types.graphqls@@ -17,6 +17,7 @@ input EnvironmentNodeFilterInput {
input TargetNodesFilterInput {
id: Int
name: String
+ names: [String]
labels: [String]
annotations: [String]
}
haven't tested this, just an idea. This would just allow for a single query to match a given node if its name is not just equal to a specific value, but if its name is a member of a given set. Then clients can make much more flexible requests targeting sets of nodes and doing further queries on those all server-side. Thoughts? If this makes sense I will go ahead and work on a PR.
https://github.com/cryostatio/cryostat/blob/9bcda3f42ad05349a38d3767f33f11042aa767d2/src/main/java/io/cryostat/net/web/http/api/v2/graph/FilterInput.java#L69
https://github.com/cryostatio/cryostat/blob/9bcda3f42ad05349a38d3767f33f11042aa767d2/src/main/java/io/cryostat/net/web/http/api/v2/graph/TargetNodesFetcher.java#L108 / https://github.com/cryostatio/cryostat/blob/9bcda3f42ad05349a38d3767f33f11042aa767d2/src/main/java/io/cryostat/net/web/http/api/v2/graph/TargetNodesFetcher.java#L115
https://github.com/cryostatio/cryostat/blob/9bcda3f42ad05349a38d3767f33f11042aa767d2/src/main/java/io/cryostat/net/web/http/api/v2/graph/ActiveRecordingsFetcher.java#L97 / https://github.com/cryostatio/cryostat/blob/9bcda3f42ad05349a38d3767f33f11042aa767d2/src/main/java/io/cryostat/net/web/http/api/v2/graph/ActiveRecordingsFetcher.java#L104
I think this functionality can be retrofitted into the existing system pretty cleanly actually:
haven't tested this, just an idea. This would just allow for a single query to match a given node if its name is not just equal to a specific value, but if its name is a member of a given set. Then clients can make much more flexible requests targeting sets of nodes and doing further queries on those all server-side. Thoughts? If this makes sense I will go ahead and work on a PR.
Originally posted by @andrewazores in cryostatio/cryostat-web#920 (comment)
The text was updated successfully, but these errors were encountered: