Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise the upper limit of MAX_JSON_SIZE #3310

Merged
merged 5 commits into from
Feb 13, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions client/app/components/dynamic-table/json-cell/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ import { isUndefined, isString } from 'lodash';
import renderJsonView from './json-view-interactive';
import template from './template.html';

const MAX_JSON_SIZE = 50000;

function parseValue(value) {
if (isString(value) && value.length <= MAX_JSON_SIZE) {
function parseValue(value, clientConfig) {
if (isString(value) && value.length <= clientConfig.tableCellMaxJSONSize) {
try {
return JSON.parse(value);
} catch (e) {
Expand All @@ -14,8 +12,8 @@ function parseValue(value) {
}
}

export default function init(ngModule) {
ngModule.directive('dynamicTableJsonCell', () => ({
function DynamicTableJsonCell(clientConfig) {
return {
template,
restrict: 'E',
replace: true,
Expand All @@ -30,13 +28,17 @@ export default function init(ngModule) {
$scope.parsedValue = null;

$scope.$watch('value', () => {
$scope.parsedValue = parseValue($scope.value);
$scope.parsedValue = parseValue($scope.value, clientConfig);
$scope.isValid = !isUndefined($scope.parsedValue);
container.empty();
renderJsonView(container, $scope.parsedValue);
});
},
}));
};
}

export default function init(ngModule) {
ngModule.directive('dynamicTableJsonCell', DynamicTableJsonCell);
}

init.init = true;
1 change: 1 addition & 0 deletions redash/handlers/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ def client_config():
'googleLoginEnabled': settings.GOOGLE_OAUTH_ENABLED,
'pageSize': settings.PAGE_SIZE,
'pageSizeOptions': settings.PAGE_SIZE_OPTIONS,
'tableCellMaxJSONSize': settings.TABLE_CELL_MAX_JSON_SIZE,
}

client_config.update(defaults)
Expand Down
1 change: 1 addition & 0 deletions redash/settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ def all_settings():
QUERY_REFRESH_INTERVALS = map(int, array_from_string(os.environ.get("REDASH_QUERY_REFRESH_INTERVALS", "60, 300, 600, 900, 1800, 3600, 7200, 10800, 14400, 18000, 21600, 25200, 28800, 32400, 36000, 39600, 43200, 86400, 604800, 1209600, 2592000")))
PAGE_SIZE = int(os.environ.get('REDASH_PAGE_SIZE', 20))
PAGE_SIZE_OPTIONS = map(int, array_from_string(os.environ.get("REDASH_PAGE_SIZE_OPTIONS", "5,10,20,50,100")))
TABLE_CELL_MAX_JSON_SIZE = 200000
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep previous value 50000 as default (you can override it in your setup)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to get it as an environment var? 🤔
WDYT @kravets-levko, @arikfr ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gabrieldutra Good point! Yes, let's take it from env with default 50000


# Features:
VERSION_CHECK = parse_boolean(os.environ.get("REDASH_VERSION_CHECK", "true"))
Expand Down