Skip to content

Commit db52189

Browse files
authored
Fix DAVE-757
reset chart if options are dirty
1 parent 214f5ee commit db52189

File tree

1 file changed

+33
-4
lines changed

1 file changed

+33
-4
lines changed

frontend/src/views/AuswertungView.vue

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
:height="stepperHeightVh"
2121
:all-visible-messstellen="allVisibleMessstellen"
2222
:preset-data="presetData"
23+
@reset-chart="resetChart"
2324
/>
2425
<v-spacer />
2526
<v-card-actions>
@@ -97,8 +98,16 @@ import type MessstelleAuswertungIdDTO from "@/types/messstelle/auswertung/Messst
9798
import type MessstelleAuswertungOptionsDTO from "@/types/messstelle/auswertung/MessstelleAuswertungOptionsDTO";
9899
import type LadeZaehldatenSteplineDTO from "@/types/zaehlung/zaehldaten/LadeZaehldatenSteplineDTO";
99100
100-
import { cloneDeep, head, isEmpty, isNil, toArray, valuesIn } from "lodash";
101-
import { computed, onMounted, ref } from "vue";
101+
import {
102+
cloneDeep,
103+
head,
104+
isEmpty,
105+
isEqual,
106+
isNil,
107+
toArray,
108+
valuesIn,
109+
} from "lodash";
110+
import { computed, onMounted, ref, watch } from "vue";
102111
import { useDisplay } from "vuetify";
103112
104113
import { ApiError, Levels } from "@/api/error";
@@ -120,8 +129,6 @@ import { useReportTools } from "@/util/ReportTools";
120129
const NUMBER_OF_MAX_XAXIS_ELEMENTS_TO_SHOW = 96;
121130
const NUMBER_OF_MAX_MST_TO_SHOW = 10;
122131
123-
const minWidth = 600;
124-
125132
const reportTools = useReportTools();
126133
const display = useDisplay();
127134
const downloadUtils = useDownloadUtils();
@@ -157,6 +164,28 @@ onMounted(() => {
157164
auswertungLoaded.value = presetData.value;
158165
});
159166
167+
watch(
168+
auswertungsOptions,
169+
() => {
170+
resetChart();
171+
},
172+
{ deep: true, immediate: true }
173+
);
174+
175+
function resetChart() {
176+
if (
177+
auswertungLoaded.value &&
178+
!isEqual(
179+
auswertungsOptions.value,
180+
gesamtauswertungStore.getAuswertungMessstelleOptions
181+
)
182+
) {
183+
zaehldatenMessstellen.value =
184+
DefaultObjectCreator.createDefaultLadeZaehldatenSteplineDTO();
185+
auswertungLoaded.value = false;
186+
}
187+
}
188+
160189
const textForNonShownDiagram = computed(() => {
161190
const text = [];
162191
if (!isNumberOfChosenMstShowable.value) {

0 commit comments

Comments
 (0)