mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 09:28:51 +00:00
CR fixes
This commit is contained in:
parent
cc9e89bb69
commit
ed380fefaa
@ -19,6 +19,7 @@
|
||||
$scope.sourceMode = true;
|
||||
$scope.canEdit = currentUser.canEdit($scope.query) || clientConfig.allowAllToEditQueries;
|
||||
$scope.isDirty = false;
|
||||
$scope.base_url = $location.protocol()+"://"+$location.host()+":"+$location.port();
|
||||
|
||||
$scope.newVisualization = undefined;
|
||||
|
||||
|
@ -13,35 +13,25 @@ from redash.utils import json_dumps
|
||||
@login_required
|
||||
def embed(query_id, visualization_id):
|
||||
|
||||
v = models.Visualization.get(models.Visualization.id == visualization_id)
|
||||
query = models.Query.get_by_id(query_id)
|
||||
vis = query.visualizations.where(models.Visualization.id == visualization_id).first()
|
||||
qr = {}
|
||||
if v:
|
||||
q = v.query
|
||||
if q.id == int(query_id):
|
||||
v = v.to_dict()
|
||||
query_result_id = q._data['latest_query_data']
|
||||
if query_result_id:
|
||||
qr = models.QueryResult.get_by_id(query_result_id)
|
||||
qr = qr.to_dict()
|
||||
else:
|
||||
abort(400, message="No Results for this query")
|
||||
if vis is not None:
|
||||
vis = vis.to_dict()
|
||||
qr = query.latest_query_data
|
||||
if qr is None:
|
||||
abort(400, message="No Results for this query")
|
||||
else:
|
||||
logging.error("%r != %r" % (q.id,query_id))
|
||||
abort(404, message="Invalid visualization for query")
|
||||
qr = qr.to_dict()
|
||||
else:
|
||||
abort(404, message="Visualization not found.")
|
||||
|
||||
client_config = {
|
||||
'clientSideMetrics': settings.CLIENT_SIDE_METRICS,
|
||||
'allowScriptsInUserInput': settings.ALLOW_SCRIPTS_IN_USER_INPUT,
|
||||
'highChartsTurboThreshold': settings.HIGHCHARTS_TURBO_THRESHOLD,
|
||||
'dateFormat': settings.DATE_FORMAT,
|
||||
'dateTimeFormat': "{0} HH:mm".format(settings.DATE_FORMAT)
|
||||
}
|
||||
client_config = {}
|
||||
client_config.update(settings.COMMON_CLIENT_CONFIG)
|
||||
|
||||
return render_template("embed.html",
|
||||
name=settings.NAME,
|
||||
client_config=json_dumps(client_config),
|
||||
visualization=json_dumps(v),
|
||||
visualization=json_dumps(vis),
|
||||
query_result=json_dumps(qr),
|
||||
analytics=settings.ANALYTICS)
|
||||
|
@ -38,15 +38,10 @@ def index(**kwargs):
|
||||
}
|
||||
|
||||
client_config = {
|
||||
'clientSideMetrics': settings.CLIENT_SIDE_METRICS,
|
||||
'allowScriptsInUserInput': settings.ALLOW_SCRIPTS_IN_USER_INPUT,
|
||||
'highChartsTurboThreshold': settings.HIGHCHARTS_TURBO_THRESHOLD,
|
||||
'allowAllToEditQueries': settings.FEATURE_ALLOW_ALL_TO_EDIT_QUERIES,
|
||||
'dateFormat': settings.DATE_FORMAT,
|
||||
'dateTimeFormat': "{0} HH:mm".format(settings.DATE_FORMAT),
|
||||
'newVersionAvailable': get_latest_version(),
|
||||
'version': __version__
|
||||
}
|
||||
client_config.update(settings.COMMON_CLIENT_CONFIG)
|
||||
|
||||
return render_template("index.html", user=json.dumps(user), name=settings.NAME,
|
||||
client_config=json.dumps(client_config),
|
||||
|
@ -166,4 +166,14 @@ VERSION_CHECK = parse_boolean(os.environ.get("REDASH_VERSION_CEHCK", "true"))
|
||||
BIGQUERY_HTTP_TIMEOUT = int(os.environ.get("REDASH_BIGQUERY_HTTP_TIMEOUT", "600"))
|
||||
|
||||
# Enhance schema fetching
|
||||
SCHEMA_RUN_TABLE_SIZE_CALCULATIONS = parse_boolean(os.environ.get("REDASH_SCHEMA_RUN_TABLE_SIZE_CALCULATIONS", "false"))
|
||||
SCHEMA_RUN_TABLE_SIZE_CALCULATIONS = parse_boolean(os.environ.get("REDASH_SCHEMA_RUN_TABLE_SIZE_CALCULATIONS", "false"))
|
||||
|
||||
### Common Client config
|
||||
COMMON_CLIENT_CONFIG = {
|
||||
'clientSideMetrics': CLIENT_SIDE_METRICS,
|
||||
'allowScriptsInUserInput': ALLOW_SCRIPTS_IN_USER_INPUT,
|
||||
'highChartsTurboThreshold': HIGHCHARTS_TURBO_THRESHOLD,
|
||||
'dateFormat': DATE_FORMAT,
|
||||
'dateTimeFormat': "{0} HH:mm".format(DATE_FORMAT),
|
||||
'allowAllToEditQueries': FEATURE_ALLOW_ALL_TO_EDIT_QUERIES,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user