Skip to content

Commit b338be2

Browse files
Merge span and REST call into same group (#123)
1 parent 5fc5137 commit b338be2

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

ide-common/src/main/java/org/digma/intellij/plugin/insights/view/GroupListViewItemBuilder.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ public GroupListViewItemBuilder(InsightGroupType insightGroupType, Function<T, S
2727
@Override
2828
public List<ListViewItem<?>> build(Project project, T insight, ListGroupManager groupManager) {
2929
final String groupId = groupByFunction.apply(insight);
30-
final String groupKey = insightGroupType.name() + ":" + groupId;
3130
final InsightGroupListViewItem theGroup = (InsightGroupListViewItem)
32-
groupManager.getOrCreateGroup(groupKey, () -> new InsightGroupListViewItem(groupId, insightGroupType));
31+
groupManager.getOrCreateGroup(groupId, () -> new InsightGroupListViewItem(groupId, insightGroupType));
3332

3433
final var theListView = new InsightListViewItem<>(insight);
3534

ide-common/src/main/java/org/digma/intellij/plugin/insights/view/InsightsViewBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public List<ListViewItem<?>> build(Project project, @NotNull MethodInfo scope, L
3232

3333
codeObjectInsights.forEach(insight -> {
3434
final ListViewItemBuilder<CodeObjectInsight> builder = (ListViewItemBuilder<CodeObjectInsight>) buildersHolder.getBuilder(insight.getType());
35-
final List<ListViewItem<?>> insightListItems = builder.build(project,insight, groupManager);
35+
final List<ListViewItem<?>> insightListItems = builder.build(project, insight, groupManager);
3636
allItems.addAll(insightListItems);
3737
});
3838

ide-common/src/main/java/org/digma/intellij/plugin/view/ListGroupManager.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,20 @@
55
import java.util.Collection;
66
import java.util.HashMap;
77
import java.util.Map;
8+
import java.util.Optional;
89
import java.util.function.Supplier;
910

1011
public class ListGroupManager {
1112

1213
private final Map<String, GroupListViewItem> groups = new HashMap<>();
1314

1415
public GroupListViewItem getOrCreateGroup(String groupKey, Supplier<GroupListViewItem> supplier) {
15-
return groups.computeIfAbsent(groupKey, key -> supplier.get());
16+
Optional<String> existingMatchingGroupKey = groups.keySet()
17+
.stream()
18+
//FYI: Temporary fix because from BE we receive some insights with groupId = "epHTTP:POST Transfer/TransferFunds" and some insights with groupId = "HTTP POST Transfer/TransferFunds" but all these items should be displayed on the same group on UI
19+
.filter(s -> s.endsWith(groupKey.replace("HTTP ", "")))
20+
.findFirst();
21+
return groups.computeIfAbsent(existingMatchingGroupKey.orElse(groupKey), key -> supplier.get());
1622
}
1723

1824
public Collection<GroupListViewItem> getGroupItems() {

src/main/kotlin/org/digma/intellij/plugin/ui/list/insights/InsightsListCellRenderer.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ class InsightsListCellRenderer : AbstractPanelListCellRenderer() {
8383
}
8484

8585

86-
87-
private fun groupTitlePanel(labelText: String,icon: Icon): JPanel {
86+
private fun groupTitlePanel(labelText: String, icon: Icon): JPanel {
8887
return panel {
8988
row {
9089
icon(icon).applyToComponent {

0 commit comments

Comments
 (0)