Skip to content

Commit

Permalink
Fix incorrect check for environments and also remove leading empty sp…
Browse files Browse the repository at this point in the history
…ace in graph unless there is no data.

Signed-off-by: Aindriu Lavelle <aindriu.lavelle@aiven.io>
  • Loading branch information
aindriu-aiven committed Nov 16, 2023
1 parent e24ce82 commit f600dbd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package io.aiven.klaw.helpers.db.rdbms;

import static io.aiven.klaw.helpers.KwConstants.*;
import static org.reflections.Reflections.log;
import static io.aiven.klaw.helpers.KwConstants.DATE_TIME_DDMMMYYYY_HHMMSS_FORMATTER;
import static io.aiven.klaw.helpers.KwConstants.REQUESTOR_SUBSCRIPTIONS;

import com.google.common.collect.Lists;
import io.aiven.klaw.dao.*;
Expand Down Expand Up @@ -1284,14 +1285,15 @@ public List<CommonUtilsService.ChartsOverviewItem<Integer, Integer>> selectAclsC

Map<String, Env> name2envsFromDb =
StreamSupport.stream(selectEnvsDetails(envIds.keySet(), tenantId).spliterator(), false)
.collect(Collectors.toMap(Env::getName, Function.identity()));
.collect(Collectors.toMap(Env::getId, Function.identity()));

for (var envIdEntry : envIds.entrySet()) {
if (!name2envsFromDb.containsKey(envIdEntry.getKey())) {
log.error("Error: Environment not found for env {}", envIdEntry.getKey());
} else {
totalTopicCount.add(
CommonUtilsService.ChartsOverviewItem.of(envIdEntry.getKey(), envIdEntry.getValue()));
CommonUtilsService.ChartsOverviewItem.of(
name2envsFromDb.get(envIdEntry.getKey()).getName(), envIdEntry.getValue()));
}
}
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,10 @@ public <X> ChartsJsOverview getChartsJsOverview(
List<String> labels = new ArrayList<>(size);
List<String> colors = new ArrayList<>(size);

data.add(0);
labels.add("");
if (activityCountList.isEmpty()) {
data.add(0);
labels.add("");
}

int totalCount = 0;

Expand Down

0 comments on commit f600dbd

Please sign in to comment.