22
22
<div @click.prevent="showWarning" style="cursor: pointer;">
23
23
<div style="pointer-events: none;">
24
24
<q-toggle
25
- v-model="dashboardPanelData.layout.showCustomQuery "
25
+ v-model="dashboardPanelData.data.customQuery "
26
26
:label="t('panel.customSql')"
27
- @update:model-value="onUpdateToggle(dashboardPanelData.layout.showCustomQuery )"
27
+ @update:model-value="onUpdateToggle(dashboardPanelData.data.customQuery )"
28
28
/>
29
29
</div>
30
30
</div>
45
45
v-model:fields="dashboardPanelData.meta.stream.selectedStreamFields"
46
46
v-model:functions="dashboardPanelData.meta.stream.functions"
47
47
@run-query="searchData"
48
- :readOnly="!dashboardPanelData.layout.showCustomQuery "
48
+ :readOnly="!dashboardPanelData.data.customQuery "
49
49
></query-editor>
50
50
<div style="color: red;" class="q-mx-sm">{{ dashboardPanelData.meta.errors.queryErrors.join(', ') }} </div>
51
51
</div>
61
61
62
62
<script lang="ts">
63
63
// @ts-nocheck
64
- import { defineComponent, ref, watch, reactive, toRaw } from "vue";
64
+ import { defineComponent, ref, watch, reactive, toRaw, onActivated } from "vue";
65
65
import { useI18n } from "vue-i18n";
66
66
import { useRouter } from "vue-router";
67
67
import { useQuasar } from "quasar";
@@ -101,17 +101,21 @@ export default defineComponent({
101
101
showQuery.value = !showQuery.value
102
102
}
103
103
104
+ onActivated(() => {
105
+ dashboardPanelData.meta.errors.queryErrors = []
106
+ })
107
+
104
108
// Generate the query when the fields are updated
105
109
watch(() => [
106
110
dashboardPanelData.data.fields.stream,
107
111
dashboardPanelData.data.fields.x,
108
112
dashboardPanelData.data.fields.y,
109
113
dashboardPanelData.data.fields.filter,
110
- dashboardPanelData.layout.showCustomQuery
114
+ dashboardPanelData.data.customQuery
111
115
], () => {
112
116
113
117
// only continue if current mode is auto query generation
114
- if(!dashboardPanelData.layout.showCustomQuery ){
118
+ if(!dashboardPanelData.data.customQuery ){
115
119
// console.log("Updating query");
116
120
117
121
// STEP 1: first check if there is at least 1 field selected
@@ -183,11 +187,11 @@ export default defineComponent({
183
187
}
184
188
}, {deep: true})
185
189
186
- watch(() => [dashboardPanelData.data.query, dashboardPanelData.layout.showCustomQuery ], ()=>{
187
- // console.log("query changes in search bar",dashboardPanelData.layout.showCustomQuery );
190
+ watch(() => [dashboardPanelData.data.query, dashboardPanelData.data.customQuery, dashboardPanelData.meta.stream.selectedStreamFields ], ()=>{
191
+ // console.log("query changes in search bar",dashboardPanelData.data.customQuery );
188
192
189
193
// only continue if current mode is show custom query
190
- if(dashboardPanelData.layout.showCustomQuery ){
194
+ if(dashboardPanelData.data.customQuery ){
191
195
updateQueryValue()
192
196
} else {
193
197
// auto query mode selected
@@ -202,7 +206,7 @@ export default defineComponent({
202
206
// dashboardPanelData.meta.editorValue = value;
203
207
// dashboardPanelData.data.query = value;
204
208
205
- if (dashboardPanelData.layout.showCustomQuery ) {
209
+ if (dashboardPanelData.data.customQuery ) {
206
210
// console.log("query: value", dashboardPanelData.data.query);
207
211
208
212
// empty the errors
@@ -269,7 +273,7 @@ export default defineComponent({
269
273
}
270
274
271
275
const changeToggle = () => {
272
- dashboardPanelData.layout.showCustomQuery = !dashboardPanelData.layout.showCustomQuery
276
+ dashboardPanelData.data.customQuery = !dashboardPanelData.data.customQuery
273
277
removeXYFilters()
274
278
}
275
279
0 commit comments