Skip to content
This repository has been archived by the owner on Jan 7, 2018. It is now read-only.

Commit

Permalink
Merge pull request #7 from NREL/admin-analytics-query-builder-ui
Browse files Browse the repository at this point in the history
Simpler query builder interface for constructing admin analytics queries
  • Loading branch information
GUI committed Feb 20, 2015
2 parents af28d43 + cfd356a commit 653e1e2
Show file tree
Hide file tree
Showing 42 changed files with 6,213 additions and 156 deletions.
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ AllCops:
- vendor/**/*
- config/compass.rb
- public/web-assets/**/*
- public/test-assets/**/*
RunRailsCops: true

Lint/LiteralInInterpolation:
Expand Down
4 changes: 4 additions & 0 deletions app/assets/javascripts/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
//= require livestampjs/livestamp
//= require numeral
//= require vendor/jquery.blockUI
//= require vendor/jQuery-QueryBuilder/query-builder.standalone.js
//= require spinjs
//= require vendor/dirtyforms/jquery.dirtyforms
//= require vendor/jquery.truncate
Expand Down Expand Up @@ -78,6 +79,9 @@ $(document).ready(function() {
event.preventDefault();
});

$.blockUI.defaults.fadeIn = 0;
$.blockUI.defaults.fadeOut = 0;

$(document).on('click', 'a[rel=popover]', function(event) {
$(this).qtip({
overwrite: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ Admin.StatsBaseController = Ember.ObjectController.extend({

actions: {
submit: function() {
this.set('query.params.search', $('#filter_form input[name=search]').val());
if($('#filter_type_advanced').css('display') === 'none') {
this.set('query.params.search', null);
this.set('query.params.query', JSON.stringify($('#query_builder').queryBuilder('getRules')));
} else {
this.set('query.params.query', null);
this.set('query.params.search', $('#filter_form input[name=search]').val());
}
},
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Admin.StatsDrilldownController = Admin.StatsBaseController.extend({

downloadUrl: function() {
return '/api-umbrella/v1/analytics/drilldown.csv?' + $.param(this.get('query.params')) + '&api_key=' + webAdminAjaxApiKey;
}.property('query.params', 'query.params.search', 'query.params.start_at', 'query.params.end_at', 'query.params.prefix'),
}.property('query.params', 'query.params.query', 'query.params.search', 'query.params.start_at', 'query.params.end_at', 'query.params.prefix'),
});

Admin.StatsDrilldownDefaultController = Admin.StatsDrilldownController.extend({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Admin.StatsLogsController = Admin.StatsBaseController.extend({
downloadUrl: function() {
return '/admin/stats/logs.csv?' + $.param(this.get('query.params'));
}.property('query.params', 'query.params.search', 'query.params.interval', 'query.params.start_at', 'query.params.end_at'),
}.property('query.params', 'query.params.query', 'query.params.search', 'query.params.interval', 'query.params.start_at', 'query.params.end_at'),
});

Admin.StatsLogsDefaultController = Admin.StatsLogsController.extend({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Admin.StatsMapController = Admin.StatsBaseController.extend({

downloadUrl: function() {
return '/admin/stats/map.csv?' + $.param(this.get('query.params'));
}.property('query.params', 'query.params.search', 'query.params.start_at', 'query.params.end_at'),
}.property('query.params', 'query.params.query', 'query.params.search', 'query.params.start_at', 'query.params.end_at'),
});

Admin.StatsMapDefaultController = Admin.StatsMapController.extend({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Admin.StatsUsersController = Admin.StatsBaseController.extend({
downloadUrl: function() {
return '/admin/stats/users.csv?' + $.param(this.get('query.params'));
}.property('query.params', 'query.params.search', 'query.params.start_at', 'query.params.end_at'),
}.property('query.params', 'query.params.query', 'query.params.search', 'query.params.start_at', 'query.params.end_at'),
});

Admin.StatsUsersDefaultController = Admin.StatsUsersController.extend({
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/admin/routes/stats/base_route.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Admin.StatsBaseRoute = Ember.Route.extend({
this.transitionTo('stats.logs', $.param(newQueryParams));
}
}
}.observes('query.params.search', 'query.params.interval', 'query.params.start_at', 'query.params.end_at'),
}.observes('query.params.query', 'query.params.search', 'query.params.interval', 'query.params.start_at', 'query.params.end_at'),

actions: {
error: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Admin.StatsDrilldownRoute = Admin.StatsBaseRoute.extend({
this.transitionTo('stats.drilldown', $.param(newQueryParams));
}
}
}.observes('query.params.search', 'query.params.interval', 'query.params.start_at', 'query.params.end_at'),
}.observes('query.params.query', 'query.params.search', 'query.params.interval', 'query.params.start_at', 'query.params.end_at'),

validateOptions: function() {
var valid = true;
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/admin/routes/stats/logs_route.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Admin.StatsLogsRoute = Admin.StatsBaseRoute.extend({
this.transitionTo('stats.logs', $.param(newQueryParams));
}
}
}.observes('query.params.search', 'query.params.interval', 'query.params.start_at', 'query.params.end_at'),
}.observes('query.params.query', 'query.params.search', 'query.params.interval', 'query.params.start_at', 'query.params.end_at'),

validateOptions: function() {
var valid = true;
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/admin/routes/stats/map_route.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Admin.StatsMapRoute = Admin.StatsBaseRoute.extend({
this.transitionTo('stats.map', $.param(newQueryParams));
}
}
}.observes('query.params.search', 'query.params.start_at', 'query.params.end_at', 'query.params.region'),
}.observes('query.params.query', 'query.params.search', 'query.params.start_at', 'query.params.end_at', 'query.params.region'),
});

Admin.StatsMapDefaultRoute = Admin.StatsMapRoute.extend({
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/admin/routes/stats/users_route.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Admin.StatsUsersRoute = Admin.StatsBaseRoute.extend({
this.transitionTo('stats.users', $.param(newQueryParams));
}
}
}.observes('query.params.search', 'query.params.start_at', 'query.params.end_at'),
}.observes('query.params.query', 'query.params.search', 'query.params.start_at', 'query.params.end_at'),
});

Admin.StatsUsersDefaultRoute = Admin.StatsUsersRoute.extend({
Expand Down
Loading

0 comments on commit 653e1e2

Please sign in to comment.