ui: change new series default expand state

This commit is contained in:
nick-delirium 2024-12-27 14:24:59 +01:00
parent 3a48e061ef
commit e3f3ccfe63
No known key found for this signature in database
GPG key ID: 93ABD695DF5FDBA0
2 changed files with 3 additions and 1 deletions

View file

@ -41,6 +41,7 @@ export default observer(WidgetFormNew);
const FilterSection = observer(({ metric, excludeFilterKeys }: any) => {
const defaultClosed = React.useRef(metric.exists())
const defaultSeries = React.useRef(metric.series.map(s => s.name))
const isTable = metric.metricType === TABLE;
const isHeatMap = metric.metricType === HEATMAP;
const isFunnel = metric.metricType === FUNNEL;
@ -75,7 +76,7 @@ const FilterSection = observer(({ metric, excludeFilterKeys }: any) => {
series={series}
onRemoveSeries={() => metric.removeSeries(index)}
canDelete={metric.series.length > 1}
defaultClosed={defaultClosed.current}
defaultClosed={metric.hasChanged ? defaultSeries.current.includes(series.name) : defaultClosed.current}
emptyMessage={
isTable
? 'Filter data using any event or attribute. Use Add Step button below to do so.'

View file

@ -131,6 +131,7 @@ export default class Widget {
}
addSeries() {
this.hasChanged = true;
const series = new FilterSeries();
series.name = 'Series ' + (this.series.length + 1);
this.series.push(series);