Register system knowledge panels (#13412)

* Register system knowledge panels

* Add Recently Viewed Knowledge Panel

* Fix test
This commit is contained in:
Sriharsha Chintalapani 2023-10-08 07:34:01 -07:00 committed by GitHub
parent 4ea5549bf9
commit 21bba1c23b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 87 additions and 9 deletions

View File

@ -25,6 +25,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.io.IOException;
import java.util.List;
import java.util.UUID;
import javax.json.JsonPatch;
@ -53,6 +54,7 @@ import org.openmetadata.schema.type.EntityHistory;
import org.openmetadata.schema.type.Include;
import org.openmetadata.schema.type.MetadataOperation;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationConfig;
import org.openmetadata.service.jdbi3.DocumentRepository;
import org.openmetadata.service.jdbi3.ListFilter;
import org.openmetadata.service.resources.Collection;
@ -89,6 +91,12 @@ public class DocStoreResource extends EntityResource<Document, DocumentRepositor
/* Required for serde */
}
@Override
public void initialize(OpenMetadataApplicationConfig config) throws IOException {
// Load any existing rules from database, before loading seed data.
repository.initSeedDataFromResources();
}
@GET
@Valid
@Operation(

View File

@ -0,0 +1,10 @@
{
"name": "ActivityFeed",
"displayName": "Activity Feed KnowledgePanel",
"description": "Activity Feed KnowledgePanel shows Activity Feed,Mentions and Tasks that are assigned to User.",
"entityType": "KnowledgePanel",
"fullyQualifiedName": "KnowledgePanel.ActivityFeed",
"data": {
"gridSizes": ["large"]
}
}

View File

@ -0,0 +1,10 @@
{
"name": "Announcements",
"displayName": "Announcements KnowledgePanel",
"description": "Announcements KnowledgePanel shows the Announcements from teams,users published on Data Assets.",
"entityType": "KnowledgePanel",
"fullyQualifiedName": "KnowledgePanel.Announcements",
"data": {
"gridSizes": ["small"]
}
}

View File

@ -0,0 +1,10 @@
{
"name": "Following",
"displayName": "Following KnowledgePanel",
"description": "Following KnowledgePanel shows all the Assets that the User is Following.",
"entityType": "KnowledgePanel",
"fullyQualifiedName": "KnowledgePanel.Following",
"data": {
"gridSizes": ["small"]
}
}

View File

@ -0,0 +1,10 @@
{
"name": "KPI",
"displayName": "KPI KnowledgePanel",
"description": "KPI KnowledgePanel shows the Organization's KPIs on description, owner coverage.",
"entityType": "KnowledgePanel",
"fullyQualifiedName": "KnowledgePanel.KPI",
"data": {
"gridSizes": ["small", "medium"]
}
}

View File

@ -0,0 +1,10 @@
{
"name": "MyData",
"displayName": "MyData KnowledgePanel",
"description": "MyData KnowledgePanel shows the list of Assets that is owned by User or User's Team.",
"entityType": "KnowledgePanel",
"fullyQualifiedName": "KnowledgePanel.MyData",
"data": {
"gridSizes": ["small"]
}
}

View File

@ -0,0 +1,10 @@
{
"name": "RecentlyViewed",
"displayName": "Recently Viewed",
"description": "Recently Viewed KnowledgePanel shows list of Data Assets that User visited.",
"entityType": "KnowledgePanel",
"fullyQualifiedName": "KnowledgePanel.RecentlyViewed",
"data": {
"gridSizes": ["small"]
}
}

View File

@ -0,0 +1,10 @@
{
"name": "TotalAssets",
"displayName": "Total Assets KnowledgePanel",
"description": "Total Assets KnowledgePanel shows Data Asset growth across the organization.",
"entityType": "KnowledgePanel",
"fullyQualifiedName": "KnowledgePanel.TotalAssets",
"data": {
"gridSizes": ["medium","large"]
}
}

View File

@ -80,10 +80,10 @@ public class DocStoreResourceTest extends EntityResourceTest<Document, CreateDoc
new KnowledgePanel()
.withConfiguration(
new Configuration().withAdditionalProperty("configuration", "{'api':'/api/v1/activityFeed'}"));
String fqn = FullyQualifiedName.build(knowledgePanel.getEntityType().toString(), "ActivityFeed");
String fqn = FullyQualifiedName.build(knowledgePanel.getEntityType().toString(), "ActivityFeedTest");
CreateDocument create =
createRequest(test, 1)
.withName("ActivityFeed")
.withName("ActivityFeedTest")
.withFullyQualifiedName(fqn)
.withData(new Data().withAdditionalProperty(knowledgePanel.getEntityType().toString(), knowledgePanel))
.withEntityType(knowledgePanel.getEntityType().toString());
@ -94,10 +94,10 @@ public class DocStoreResourceTest extends EntityResourceTest<Document, CreateDoc
new KnowledgePanel()
.withConfiguration(
new Configuration().withAdditionalProperty("configuration", "{'api':'/api/v1/knowledgePanel'}"));
fqn = FullyQualifiedName.build(knowledgePanel.getEntityType().toString(), "MyData");
fqn = FullyQualifiedName.build(knowledgePanel.getEntityType().toString(), "MyDataTest");
create =
createRequest(test, 1)
.withName("MyData")
.withName("MyDataTest")
.withFullyQualifiedName(fqn)
.withData(new Data().withAdditionalProperty(knowledgePanel.getEntityType().toString(), knowledgePanel))
.withEntityType(knowledgePanel.getEntityType().toString());
@ -105,10 +105,10 @@ public class DocStoreResourceTest extends EntityResourceTest<Document, CreateDoc
panelDocs.add(myData);
knowledgePanel = new KnowledgePanel();
fqn = FullyQualifiedName.build(knowledgePanel.getEntityType().toString(), "Following");
fqn = FullyQualifiedName.build(knowledgePanel.getEntityType().toString(), "FollowingTest");
create =
createRequest(test, 1)
.withName("Following")
.withName("FollowingTest")
.withFullyQualifiedName(fqn)
.withData(new Data().withAdditionalProperty(knowledgePanel.getEntityType().toString(), knowledgePanel))
.withEntityType(knowledgePanel.getEntityType().toString());
@ -130,7 +130,7 @@ public class DocStoreResourceTest extends EntityResourceTest<Document, CreateDoc
Map<String, String> queryParams = new HashMap<>();
queryParams.put("fqnPrefix", FullyQualifiedName.build(knowledgePanel.getEntityType().toString()));
ResultList<Document> panelList = listEntities(queryParams, ADMIN_AUTH_HEADERS);
assertEquals(panelDocs.size(), panelList.getPaging().getTotal());
assertEquals(panelDocs.size() + 7, panelList.getPaging().getTotal());
// docs
List<Document> pageDocs = new ArrayList<>();
@ -146,7 +146,7 @@ public class DocStoreResourceTest extends EntityResourceTest<Document, CreateDoc
page.getPageType().toString());
create =
createRequest(test, 1)
.withName("LandingPage")
.withName("LandingPageTest")
.withFullyQualifiedName(fqn)
.withEntityType(page.getEntityType().toString())
.withData(new Data().withAdditionalProperty(page.getEntityType().toString(), page));
@ -165,7 +165,7 @@ public class DocStoreResourceTest extends EntityResourceTest<Document, CreateDoc
page.getPageType().toString());
create =
createRequest(test, 1)
.withName("GlossaryTermLandingPage")
.withName("GlossaryTermLandingPageTest")
.withFullyQualifiedName(fqn)
.withEntityType(page.getEntityType().toString())
.withData(new Data().withAdditionalProperty(page.getEntityType().toString(), page));