Skip to content

Commit

Permalink
Add numeral package and neccessary changes written into axios
Browse files Browse the repository at this point in the history
  • Loading branch information
mirkan1 committed May 4, 2024
1 parent 4a13709 commit b6cfb49
Show file tree
Hide file tree
Showing 7 changed files with 1,095 additions and 15 deletions.
9 changes: 7 additions & 2 deletions client/app/services/query-result.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { QueryResultError } from "@/services/query";
import { Auth } from "@/services/auth";
import { isString, uniqBy, each, isNumber, includes, extend, forOwn, get } from "lodash";

const JSONbigString = require('json-bigint')({ storeAsString: true });
const logger = debug("redash:services:QueryResult");
const filterTypes = ["filter", "multi-filter", "multiFilter"];

Expand Down Expand Up @@ -45,7 +46,9 @@ function getColumnFriendlyName(column) {

const createOrSaveUrl = data => (data.id ? `api/query_results/${data.id}` : "api/query_results");
const QueryResultResource = {
get: ({ id }) => axios.get(`api/query_results/${id}`),
get: ({ id }) => axios.get(`api/query_results/${id}`, {
transformResponse: (response) => JSONbigString.parse(response)
}),
post: data => axios.post(createOrSaveUrl(data), data),
};

Expand Down Expand Up @@ -344,7 +347,9 @@ class QueryResult {
queryResult.deferred.onStatusChange(ExecutionStatus.LOADING_RESULT);

axios
.get(`api/queries/${queryId}/results/${id}.json`)
.get(`api/queries/${queryId}/results/${id}.json`, {
transformResponse: (response) => JSONbigString.parse(response)
})
.then(response => {
// Success handler
queryResult.isLoadingResult = false;
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"font-awesome": "^4.7.0",
"history": "^4.10.1",
"hoist-non-react-statics": "^3.3.0",
"json-bigint": "^1.0.0",
"markdown": "0.5.0",
"material-design-iconic-font": "^2.2.0",
"mousetrap": "^1.6.1",
Expand Down Expand Up @@ -179,8 +180,8 @@
]
},
"browser": {
"fs": false,
"path": false
"fs": false,
"path": false
},
"//": "browserslist set to 'Async functions' compatibility",
"browserslist": [
Expand Down
5 changes: 0 additions & 5 deletions redash/handlers/query_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,6 @@ def get(self, query_id=None, query_result_id=None, filetype="json"):
if query_result_id:
query_result = get_object_or_404(models.QueryResult.get_by_id_and_org, query_result_id, self.current_org)

for row in query_result.data['rows']:
for key, value in row.items():
if isinstance(value, int):
row[key] = str(value)

if query_id is not None:
query = get_object_or_404(models.Query.get_by_id_and_org, query_id, self.current_org)

Expand Down
Loading

0 comments on commit b6cfb49

Please sign in to comment.