Skip to content

Commit 25e0104

Browse files
authored
Merge pull request #4799 from gchq/gh-4788_selection_handler_deep_copy
#4788 Deep copy selection handlers when duplicating dashboard tables
2 parents bcc684b + 177160c commit 25e0104

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

Diff for: stroom-core-shared/src/main/java/stroom/dashboard/shared/EmbeddedQueryComponentSettings.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import com.fasterxml.jackson.annotation.JsonProperty;
2828
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
2929

30+
import java.util.ArrayList;
3031
import java.util.List;
3132
import java.util.Objects;
3233

@@ -142,8 +143,12 @@ private Builder(final EmbeddedQueryComponentSettings settings) {
142143
super(settings);
143144
this.queryRef = settings.queryRef;
144145
this.showTable = settings.showTable;
145-
this.queryTablePreferences = settings.queryTablePreferences;
146-
this.selectionFilter = settings.selectionFilter;
146+
this.queryTablePreferences = settings.queryTablePreferences == null
147+
? null
148+
: settings.queryTablePreferences.copy().build();
149+
this.selectionFilter = settings.selectionFilter == null
150+
? null
151+
: new ArrayList<>(settings.selectionFilter);
147152
}
148153

149154
public Builder queryRef(final DocRef queryRef) {

Diff for: stroom-core-shared/src/main/java/stroom/dashboard/shared/TableComponentSettings.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,9 @@ private Builder(final TableComponentSettings tableSettings) {
343343
: new ArrayList<>(tableSettings.conditionalFormattingRules);
344344
this.modelVersion = tableSettings.modelVersion;
345345
this.applyValueFilters = tableSettings.applyValueFilters;
346-
this.selectionFilter = tableSettings.selectionHandlers;
346+
this.selectionFilter = tableSettings.selectionHandlers == null
347+
? null
348+
: new ArrayList<>(tableSettings.selectionHandlers);
347349
}
348350

349351
private List<ConditionalFormattingRule> copyConditionalFormattingRules(

Diff for: unreleased_changes/20250303_121512_235__4788.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
* Issue **#4788** : Deep copy selection handlers when duplicating dashboard tables.
2+
3+
4+
```sh
5+
# ********************************************************************************
6+
# Issue title: Selection Handlers are not deep copied when a table is duplicated
7+
# Issue link: https://github.com/gchq/stroom/issues/4788
8+
# ********************************************************************************
9+
10+
# ONLY the top line will be included as a change entry in the CHANGELOG.
11+
# The entry should be in GitHub flavour markdown and should be written on a SINGLE
12+
# line with no hard breaks. You can have multiple change files for a single GitHub issue.
13+
# The entry should be written in the imperative mood, i.e. 'Fix nasty bug' rather than
14+
# 'Fixed nasty bug'.
15+
#
16+
# Examples of acceptable entries are:
17+
#
18+
#
19+
# * Issue **123** : Fix bug with an associated GitHub issue in this repository
20+
#
21+
# * Issue **namespace/other-repo#456** : Fix bug with an associated GitHub issue in another repository
22+
#
23+
# * Fix bug with no associated GitHub issue.
24+
```

0 commit comments

Comments
 (0)