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

feat(dashboards): Add browse end point for charts and dashboards #2143

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -2,6 +2,8 @@

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.linkedin.chart.client.Charts;
import com.linkedin.dashboard.client.Dashboards;
import com.linkedin.data.template.StringArray;
import com.linkedin.datahub.util.DatasetUtil;
import com.linkedin.dataset.client.Datasets;
Expand Down Expand Up @@ -30,6 +32,10 @@ public JsonNode browse(@Nonnull String path, @Nonnull Map<String, String> reques
final BrowseResult resp;
if (_client instanceof Datasets) {
resp = ((Datasets) _client).browse(path, requestFilters, start, count);
} else if (_client instanceof Dashboards) {
resp = ((Dashboards) _client).browse(path, requestFilters, start, count);
} else if (_client instanceof Charts) {
resp = ((Charts) _client).browse(path, requestFilters, start, count);
} else {
throw new IllegalArgumentException("Unexpected client type: " + _client.getClass().getName());
}
Expand Down
24 changes: 24 additions & 0 deletions gms/api/src/main/idl/com.linkedin.chart.charts.restspec.json
Expand Up @@ -92,6 +92,30 @@
"optional" : true
} ],
"returns" : "com.linkedin.metadata.restli.BackfillResult"
}, {
"name" : "browse",
"parameters" : [ {
"name" : "path",
"type" : "string"
}, {
"name" : "filter",
"type" : "com.linkedin.metadata.query.Filter",
"optional" : true
}, {
"name" : "start",
"type" : "int"
}, {
"name" : "limit",
"type" : "int"
} ],
"returns" : "com.linkedin.metadata.query.BrowseResult"
}, {
"name" : "getBrowsePaths",
"parameters" : [ {
"name" : "urn",
"type" : "com.linkedin.common.Urn"
} ],
"returns" : "{ \"type\" : \"array\", \"items\" : \"string\" }"
}, {
"name" : "getSnapshot",
"parameters" : [ {
Expand Down
Expand Up @@ -92,6 +92,30 @@
"optional" : true
} ],
"returns" : "com.linkedin.metadata.restli.BackfillResult"
}, {
"name" : "browse",
"parameters" : [ {
"name" : "path",
"type" : "string"
}, {
"name" : "filter",
"type" : "com.linkedin.metadata.query.Filter",
"optional" : true
}, {
"name" : "start",
"type" : "int"
}, {
"name" : "limit",
"type" : "int"
} ],
"returns" : "com.linkedin.metadata.query.BrowseResult"
}, {
"name" : "getBrowsePaths",
"parameters" : [ {
"name" : "urn",
"type" : "com.linkedin.common.Urn"
} ],
"returns" : "{ \"type\" : \"array\", \"items\" : \"string\" }"
}, {
"name" : "getSnapshot",
"parameters" : [ {
Expand Down
100 changes: 100 additions & 0 deletions gms/api/src/main/snapshot/com.linkedin.chart.charts.snapshot.json
Expand Up @@ -406,6 +406,82 @@
"doc" : "A list of typeahead suggestions"
} ]
}, {
"type" : "record",
"name" : "BrowseResult",
"namespace" : "com.linkedin.metadata.query",
"doc" : "The model for the result of a browse query",
"fields" : [ {
"name" : "entities",
"type" : {
"type" : "array",
"items" : {
"type" : "record",
"name" : "BrowseResultEntity",
"doc" : "Data model for an entity returned as part of a browse query",
"fields" : [ {
"name" : "name",
"type" : "string",
"doc" : "Name of the entity",
"optional" : true
}, {
"name" : "urn",
"type" : "com.linkedin.common.Urn",
"doc" : "URN of the entity"
} ]
}
},
"doc" : "A list of entities under the queried path"
}, {
"name" : "metadata",
"type" : {
"type" : "record",
"name" : "BrowseResultMetadata",
"doc" : "The model for browse result metadata",
"fields" : [ {
"name" : "path",
"type" : "string",
"doc" : "Path that is being browsed"
}, {
"name" : "groups",
"type" : {
"type" : "array",
"items" : {
"type" : "record",
"name" : "BrowseResultGroup",
"fields" : [ {
"name" : "name",
"type" : "string",
"doc" : "Name of the group"
}, {
"name" : "count",
"type" : "long",
"doc" : "Number of entities that can be reached from this path"
} ]
}
},
"doc" : "A list of groups and total number of entities inside those groups under the queried path",
"default" : [ ]
}, {
"name" : "totalNumEntities",
"type" : "long",
"doc" : "Total number of entities we can reach from path"
} ]
},
"doc" : "Metadata specific to the browse result of the queried path"
}, {
"name" : "from",
"type" : "int",
"doc" : "Offset of the first entity in the result"
}, {
"name" : "pageSize",
"type" : "int",
"doc" : "Size of each page in the result"
}, {
"name" : "numEntities",
"type" : "int",
"doc" : "The total number of entities directly under queried path"
} ]
}, "com.linkedin.metadata.query.BrowseResultEntity", "com.linkedin.metadata.query.BrowseResultGroup", "com.linkedin.metadata.query.BrowseResultMetadata", {
"type" : "enum",
"name" : "Condition",
"namespace" : "com.linkedin.metadata.query",
Expand Down Expand Up @@ -645,6 +721,30 @@
"optional" : true
} ],
"returns" : "com.linkedin.metadata.restli.BackfillResult"
}, {
"name" : "browse",
"parameters" : [ {
"name" : "path",
"type" : "string"
}, {
"name" : "filter",
"type" : "com.linkedin.metadata.query.Filter",
"optional" : true
}, {
"name" : "start",
"type" : "int"
}, {
"name" : "limit",
"type" : "int"
} ],
"returns" : "com.linkedin.metadata.query.BrowseResult"
}, {
"name" : "getBrowsePaths",
"parameters" : [ {
"name" : "urn",
"type" : "com.linkedin.common.Urn"
} ],
"returns" : "{ \"type\" : \"array\", \"items\" : \"string\" }"
}, {
"name" : "getSnapshot",
"parameters" : [ {
Expand Down
Expand Up @@ -353,6 +353,82 @@
"doc" : "A list of typeahead suggestions"
} ]
}, {
"type" : "record",
"name" : "BrowseResult",
"namespace" : "com.linkedin.metadata.query",
"doc" : "The model for the result of a browse query",
"fields" : [ {
"name" : "entities",
"type" : {
"type" : "array",
"items" : {
"type" : "record",
"name" : "BrowseResultEntity",
"doc" : "Data model for an entity returned as part of a browse query",
"fields" : [ {
"name" : "name",
"type" : "string",
"doc" : "Name of the entity",
"optional" : true
}, {
"name" : "urn",
"type" : "com.linkedin.common.Urn",
"doc" : "URN of the entity"
} ]
}
},
"doc" : "A list of entities under the queried path"
}, {
"name" : "metadata",
"type" : {
"type" : "record",
"name" : "BrowseResultMetadata",
"doc" : "The model for browse result metadata",
"fields" : [ {
"name" : "path",
"type" : "string",
"doc" : "Path that is being browsed"
}, {
"name" : "groups",
"type" : {
"type" : "array",
"items" : {
"type" : "record",
"name" : "BrowseResultGroup",
"fields" : [ {
"name" : "name",
"type" : "string",
"doc" : "Name of the group"
}, {
"name" : "count",
"type" : "long",
"doc" : "Number of entities that can be reached from this path"
} ]
}
},
"doc" : "A list of groups and total number of entities inside those groups under the queried path",
"default" : [ ]
}, {
"name" : "totalNumEntities",
"type" : "long",
"doc" : "Total number of entities we can reach from path"
} ]
},
"doc" : "Metadata specific to the browse result of the queried path"
}, {
"name" : "from",
"type" : "int",
"doc" : "Offset of the first entity in the result"
}, {
"name" : "pageSize",
"type" : "int",
"doc" : "Size of each page in the result"
}, {
"name" : "numEntities",
"type" : "int",
"doc" : "The total number of entities directly under queried path"
} ]
}, "com.linkedin.metadata.query.BrowseResultEntity", "com.linkedin.metadata.query.BrowseResultGroup", "com.linkedin.metadata.query.BrowseResultMetadata", {
"type" : "enum",
"name" : "Condition",
"namespace" : "com.linkedin.metadata.query",
Expand Down Expand Up @@ -592,6 +668,30 @@
"optional" : true
} ],
"returns" : "com.linkedin.metadata.restli.BackfillResult"
}, {
"name" : "browse",
"parameters" : [ {
"name" : "path",
"type" : "string"
}, {
"name" : "filter",
"type" : "com.linkedin.metadata.query.Filter",
"optional" : true
}, {
"name" : "start",
"type" : "int"
}, {
"name" : "limit",
"type" : "int"
} ],
"returns" : "com.linkedin.metadata.query.BrowseResult"
}, {
"name" : "getBrowsePaths",
"parameters" : [ {
"name" : "urn",
"type" : "com.linkedin.common.Urn"
} ],
"returns" : "{ \"type\" : \"array\", \"items\" : \"string\" }"
}, {
"name" : "getSnapshot",
"parameters" : [ {
Expand Down