From e271f2ea192c53d756e438af7bf6e8fcbcc300e6 Mon Sep 17 00:00:00 2001 From: Sai Nikhil Date: Tue, 15 Apr 2025 10:38:40 +0530 Subject: [PATCH] fix: base64 encode should be only in logs page (#6543) encoding of sql to base64 from UI when specified only in logs page not in alerts or pipelines page --- web/src/components/alerts/AddAlert.vue | 4 ++++ web/src/components/pipeline/NodeForm/Query.vue | 5 +++++ web/src/composables/useLogs.ts | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/web/src/components/alerts/AddAlert.vue b/web/src/components/alerts/AddAlert.vue index 7d3ea3542b..c3451641e4 100644 --- a/web/src/components/alerts/AddAlert.vue +++ b/web/src/components/alerts/AddAlert.vue @@ -1217,6 +1217,10 @@ export default defineComponent({ query.query.start_time = query.query.start_time + 780000000; query.query.sql = formData.value.query_condition.sql; + //removed the encoding as it is not required for the alert queries + if(store.state.zoConfig.sql_base64_enabled && query?.encoding){ + delete query.encoding; + } if (formData.value.query_condition.vrl_function) query.query.query_fn = b64EncodeUnicode( diff --git a/web/src/components/pipeline/NodeForm/Query.vue b/web/src/components/pipeline/NodeForm/Query.vue index 2f42288237..361b069965 100644 --- a/web/src/components/pipeline/NodeForm/Query.vue +++ b/web/src/components/pipeline/NodeForm/Query.vue @@ -479,6 +479,11 @@ const validateSqlQuery = () => { query.query.sql = streamRoute.value.query_condition.sql; + //removed the encoding as it is not required for the pipeline queries + if(store.state.zoConfig.sql_base64_enabled && query?.encoding){ + delete query.encoding; + } + validateSqlQueryPromise.value = new Promise((resolve, reject) => { searchService .search({ diff --git a/web/src/composables/useLogs.ts b/web/src/composables/useLogs.ts index a834b727a6..d5caba659d 100644 --- a/web/src/composables/useLogs.ts +++ b/web/src/composables/useLogs.ts @@ -1099,8 +1099,8 @@ const useLogs = () => { if (store.state.zoConfig.sql_base64_enabled) { req["encoding"] = "base64"; req.query.sql = b64EncodeUnicode(req.query.sql); + //encode the histogram only if the current page is 1 if ( - !searchObj.meta.sqlMode && searchObj.data.resultGrid.currentPage == 1 ) { req.aggs.histogram = b64EncodeUnicode(req.aggs.histogram);