diff --git a/rd_ui/app/scripts/directives/query_directives.js b/rd_ui/app/scripts/directives/query_directives.js index b06fdaad19..03e93f26a9 100644 --- a/rd_ui/app/scripts/directives/query_directives.js +++ b/rd_ui/app/scripts/directives/query_directives.js @@ -52,7 +52,7 @@ if (scope.queryResult.getId() == null) { element.attr('href', ''); } else { - element.attr('href', 'api/queries/' + scope.query.id + '/results/' + scope.queryResult.getId() + '.' + fileType); + element.attr('href', 'api/queries/' + scope.query.id + '/results/' + scope.queryResult.getId() + '.' + fileType + (scope.embed ? '?api_key=' + scope.apiKey : '')); element.attr('download', scope.query.name.replace(" ", "_") + moment(scope.queryResult.getUpdatedAt()).format("_YYYY_MM_DD") + "." + fileType); } }); diff --git a/rd_ui/app/scripts/embed.js b/rd_ui/app/scripts/embed.js index 0632786d4f..0fc71b8c20 100644 --- a/rd_ui/app/scripts/embed.js +++ b/rd_ui/app/scripts/embed.js @@ -49,6 +49,7 @@ angular.module('redash', [ $scope.embed = true; $scope.visualization = visualization; $scope.query = visualization.query; + $scope.apiKey = $location.search()['api_key']; query = new Query(visualization.query); $scope.queryResult = new QueryResult({query_result: query_result}); }])