Skip to content

Commit

Permalink
Add Tenant level topics count, null constraints
Browse files Browse the repository at this point in the history
Signed-off-by: muralibasani <[email protected]>
  • Loading branch information
muralibasani committed Jan 9, 2024
1 parent aef0009 commit 1ad83c2
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,9 @@ public Map<String, String> getDashboardInfo(Integer teamId, int tenantId) {
log.debug("getDashboardInfo {}", teamId);
Map<String, String> dashboardInfo = new HashMap<>();
Integer topicListSize = topicRepo.findDistinctCountTopicnameByTeamId(teamId, tenantId);
int topicListSizeForOrg = topicRepo.countByTenantId(tenantId);
dashboardInfo.put("myteamtopics", "" + topicListSize);
dashboardInfo.put("myOrgTopics", "" + topicListSizeForOrg);

return dashboardInfo;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@ public class AuthenticationInfo {
@NotNull private String adAuthRoleEnabled;
@NotNull private String supportlink;
@NotNull private String myteamtopics;
@NotNull private String myOrgTopics;
@NotNull private String googleFeedbackFormLink;
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package io.aiven.klaw.model.response;

import io.aiven.klaw.model.enums.RequestEntityType;
import jakarta.validation.constraints.NotNull;
import java.util.Set;
import lombok.Data;

@Data
public class RequestEntityStatusCount {
RequestEntityType requestEntityType; // TOPIC,ACL,SCHEMA,CONNECTOR
Set<RequestStatusCount> requestStatusCountSet; // created/approved/deleted/declined
@NotNull RequestEntityType requestEntityType; // TOPIC,ACL,SCHEMA,CONNECTOR

@NotNull Set<RequestStatusCount> requestStatusCountSet; // created/approved/deleted/declined

@NotNull
Set<RequestsOperationTypeCount> requestsOperationTypeCountSet; // Create/Delete/Update/Claim
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package io.aiven.klaw.model.response;

import io.aiven.klaw.model.enums.RequestStatus;
import jakarta.validation.constraints.NotNull;
import lombok.Builder;
import lombok.Data;

@Data
@Builder
public class RequestStatusCount {
RequestStatus requestStatus; // CREATED,DELETED,APPROVED,DECLINED
long count;
@NotNull RequestStatus requestStatus; // CREATED,DELETED,APPROVED,DECLINED

@NotNull long count;
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package io.aiven.klaw.model.response;

import jakarta.validation.constraints.NotNull;
import java.util.Set;
import lombok.Data;

@Data
public class RequestsCountOverview {
Set<RequestEntityStatusCount> requestEntityStatistics;
@NotNull Set<RequestEntityStatusCount> requestEntityStatistics;
}
2 changes: 2 additions & 0 deletions core/src/main/java/io/aiven/klaw/repository/TopicRepo.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ Integer findDistinctCountTopicnameByTeamId(
nativeQuery = true)
List<Object[]> findAllTopicsGroupByTeamId(@Param("tenantId") Integer tenantId);

int countByTenantId(int tenantId);

@Query(value = "select count(*) from kwtopics", nativeQuery = true)
int findAllTopicsCount();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ public AuthenticationInfo getAuth() {
Map<String, String> teamTopics =
reqsHandle.getDashboardInfo(commonUtilsService.getTeamId(userName), tenantId);
authenticationInfo.setMyteamtopics(teamTopics.get("myteamtopics"));
authenticationInfo.setMyOrgTopics(teamTopics.get("myOrgTopics"));
authenticationInfo.setContextPath(kwContextPath);
authenticationInfo.setTeamsize("" + manageDatabase.getTeamsForTenant(tenantId).size());
authenticationInfo.setSchema_clusters_count(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ public void getDashboardInfo() {
Map<String, String> res1 = selectDataJdbc.getDashboardInfo(101, 101);
Map<String, String> res2 = selectDataJdbc.getDashboardInfo(103, 103);

assertThat(res1.size()).isEqualTo(1);
assertThat(res2.size()).isEqualTo(1);
assertThat(res1.size()).isEqualTo(2); // team topics and tenant topics
assertThat(res2.size()).isEqualTo(2); // team topics and tenant topics
}

@Test
Expand Down
14 changes: 10 additions & 4 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7708,7 +7708,8 @@
},
"uniqueItems" : true
}
}
},
"required" : [ "requestEntityType", "requestStatusCountSet", "requestsOperationTypeCountSet" ]
},
"RequestStatusCount" : {
"properties" : {
Expand All @@ -7720,7 +7721,8 @@
"type" : "integer",
"format" : "int64"
}
}
},
"required" : [ "count", "requestStatus" ]
},
"RequestsCountOverview" : {
"properties" : {
Expand All @@ -7731,7 +7733,8 @@
},
"uniqueItems" : true
}
}
},
"required" : [ "requestEntityStatistics" ]
},
"RequestsOperationTypeCount" : {
"properties" : {
Expand Down Expand Up @@ -9355,11 +9358,14 @@
"myteamtopics" : {
"type" : "string"
},
"myOrgTopics" : {
"type" : "string"
},
"googleFeedbackFormLink" : {
"type" : "string"
}
},
"required" : [ "adAuthRoleEnabled", "addDeleteEditClusters", "addDeleteEditEnvs", "addEditRoles", "addTeams", "addUser", "approveAtleastOneRequest", "approveDeclineConnectors", "approveDeclineOperationalReqs", "approveDeclineSchemas", "approveDeclineSubscriptions", "approveDeclineTopics", "authenticationType", "broadcastText", "canShutdownKw", "canSwitchTeams", "canUpdatePermissions", "companyinfo", "contextPath", "coralAvailableForUser", "coralEnabled", "googleFeedbackFormLink", "kafka_clusters_count", "kafkaconnect_clusters_count", "klawversion", "manageConnectors", "myteamtopics", "notifications", "notificationsAcls", "notificationsConnectors", "notificationsSchemas", "notificationsUsers", "pendingApprovalsRedirectionPage", "requestItems", "saasEnabled", "schema_clusters_count", "showAddDeleteTenants", "showServerConfigEnvProperties", "supportlink", "syncBackAcls", "syncBackSchemas", "syncBackTopics", "syncConnectors", "syncSchemas", "syncTopicsAcls", "teamId", "teamname", "teamsize", "tenantActiveStatus", "tenantName", "updateServerConfig", "username", "userrole", "viewKafkaConnect", "viewTopics" ]
"required" : [ "adAuthRoleEnabled", "addDeleteEditClusters", "addDeleteEditEnvs", "addEditRoles", "addTeams", "addUser", "approveAtleastOneRequest", "approveDeclineConnectors", "approveDeclineOperationalReqs", "approveDeclineSchemas", "approveDeclineSubscriptions", "approveDeclineTopics", "authenticationType", "broadcastText", "canShutdownKw", "canSwitchTeams", "canUpdatePermissions", "companyinfo", "contextPath", "coralAvailableForUser", "coralEnabled", "googleFeedbackFormLink", "kafka_clusters_count", "kafkaconnect_clusters_count", "klawversion", "manageConnectors", "myOrgTopics", "myteamtopics", "notifications", "notificationsAcls", "notificationsConnectors", "notificationsSchemas", "notificationsUsers", "pendingApprovalsRedirectionPage", "requestItems", "saasEnabled", "schema_clusters_count", "showAddDeleteTenants", "showServerConfigEnvProperties", "supportlink", "syncBackAcls", "syncBackSchemas", "syncBackTopics", "syncConnectors", "syncSchemas", "syncTopicsAcls", "teamId", "teamname", "teamsize", "tenantActiveStatus", "tenantName", "updateServerConfig", "username", "userrole", "viewKafkaConnect", "viewTopics" ]
},
"KwPropertiesResponse" : {
"properties" : {
Expand Down

0 comments on commit 1ad83c2

Please sign in to comment.