mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-06 08:09:24 +00:00
fix: loader error message and throw error when limit exist in query in sqlmode (#326)
This commit is contained in:
@@ -559,6 +559,18 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
if (searchObj.meta.sqlMode == true) {
|
||||
const parsedSQL = parser.astify(searchObj.data.query);
|
||||
if (parsedSQL.limit != null) {
|
||||
$q.notify({
|
||||
message: "Limit clause is not allowed in the query.",
|
||||
color: "negative",
|
||||
position: "top",
|
||||
timeout: 2000,
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
req.query.sql = query + " limit " + req.query.size;
|
||||
req.query["sql_mode"] = "full";
|
||||
delete req.aggs;
|
||||
@@ -623,7 +635,10 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
req.query.sql = b64EncodeUnicode(req.query.sql);
|
||||
if (!searchObj.meta.sqlMode) {
|
||||
if (
|
||||
!searchObj.meta.sqlMode &&
|
||||
searchObj.data.resultGrid.currentPage == 0
|
||||
) {
|
||||
req.aggs.histogram = b64EncodeUnicode(req.aggs.histogram);
|
||||
}
|
||||
|
||||
@@ -665,6 +680,11 @@ export default defineComponent({
|
||||
|
||||
const queryReq = buildSearch();
|
||||
|
||||
if (queryReq == null) {
|
||||
dismiss();
|
||||
return false;
|
||||
}
|
||||
|
||||
searchService
|
||||
.search({
|
||||
org_identifier: searchObj.organizationIdetifier,
|
||||
|
||||
@@ -233,12 +233,18 @@ export default defineComponent({
|
||||
const plotChart: any = ref(null);
|
||||
|
||||
const reDrawChart = () => {
|
||||
plotChart.value.reDraw(
|
||||
searchObj.data.histogram.xData,
|
||||
searchObj.data.histogram.yData,
|
||||
searchObj.data.histogram.chartParams
|
||||
);
|
||||
plotChart.value.forceReLayout();
|
||||
if (
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
searchObj.data.histogram.hasOwnProperty("xData") &&
|
||||
searchObj.data.histogram.xData.length > 0
|
||||
) {
|
||||
plotChart.value.reDraw(
|
||||
searchObj.data.histogram.xData,
|
||||
searchObj.data.histogram.yData,
|
||||
searchObj.data.histogram.chartParams
|
||||
);
|
||||
plotChart.value.forceReLayout();
|
||||
}
|
||||
};
|
||||
|
||||
const changeMaxRecordToReturn = (val: any) => {
|
||||
|
||||
Reference in New Issue
Block a user