mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 09:28:51 +00:00
[#138] Query.newQuery
This commit is contained in:
parent
df458c1052
commit
98ac23a843
@ -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', {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user