diff --git a/rd_ui/app/scripts/app.js b/rd_ui/app/scripts/app.js index 7ff54b51..9ed52fba 100644 --- a/rd_ui/app/scripts/app.js +++ b/rd_ui/app/scripts/app.js @@ -17,15 +17,6 @@ angular.module('redash', [ ]).config(['$routeProvider', '$locationProvider', '$compileProvider', 'growlProvider', function($routeProvider, $locationProvider, $compileProvider, growlProvider) { - function newQuery(Query) { - return new Query({ - query: "", - name: "New Query", - ttl: -1, - user: currentUser - }); - } - function getQuery(Query, $q, $route) { var defer = $q.defer(); @@ -56,7 +47,9 @@ angular.module('redash', [ controller: 'QueryEditCtrl', reloadOnSearch: false, resolve: { - 'query': ['Query', newQuery] + 'query': ['Query', function newQuery(Query) { + return Query.newQuery(); + }] } }); $routeProvider.when('/queries/:queryId', { diff --git a/rd_ui/app/scripts/services/services.js b/rd_ui/app/scripts/services/services.js index 8d5a5e5f..19fdcb17 100644 --- a/rd_ui/app/scripts/services/services.js +++ b/rd_ui/app/scripts/services/services.js @@ -304,6 +304,15 @@ var Query = function ($resource, QueryResult, DataSource) { var Query = $resource('/api/queries/:id', {id: '@id'}); + Query.newQuery = function() { + return new Query({ + query: "", + name: "New Query", + ttl: -1, + user: currentUser + }); + }; + Query.prototype.getQueryResult = function(ttl) { if (ttl == undefined) { ttl = this.ttl;