Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.

Commit

Permalink
Prefill the visualisation field on module type select
Browse files Browse the repository at this point in the history
fill with {} for now
  • Loading branch information
jcbashdown committed Apr 17, 2015
1 parent a6e3991 commit fddfd59
Show file tree
Hide file tree
Showing 19 changed files with 113 additions and 51 deletions.
5 changes: 4 additions & 1 deletion application/static/javascripts/edit_dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
$('.js-module-type-selector').on('change', function () {
var type = $(this).find('[value="' + $(this).val() + '"]').text(),
$queryParams = $(this).closest('.module').find('.js-query-parameters');
$visualisationParams = $(this).closest('.module').find('.js-visualisation-parameters');

$.getJSON('/static/json/' + type + '.json')
.done(function (data) {
$queryParams.val(JSON.stringify(data, null, '\t'));
$queryParams.val(JSON.stringify(data['query'], null, '\t'));
$visualisationParams.val(JSON.stringify(data['visualisation'], null, '\t'));
})
.fail(function() {
$queryParams.val('{}');
$visualisationParams.val('{}');
});
});
}
Expand Down
6 changes: 5 additions & 1 deletion application/static/json/applications.json
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
{}
{
'query': {},
'visualisation': {}
}

5 changes: 4 additions & 1 deletion application/static/json/bar_chart_with_number.json
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
{}
{
'query': {},
'visualisation': {}
}
5 changes: 4 additions & 1 deletion application/static/json/column.json
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
{}
{
'query': {},
'visualisation': {}
}
20 changes: 12 additions & 8 deletions application/static/json/completion_rate.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
{
"duration": 52,
"collect": [
"count:sum"
],
"group_by": [
"channel"
],
"period": "week"
"query": {
"duration": 52,
"collect": [
"count:sum"
],
"group_by": [
"channel"
],
"period": "week"
},
"visualisation" : {
}
}
5 changes: 4 additions & 1 deletion application/static/json/completion_table.json
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
{}
{
'query': {},
'visualisation': {}
}
20 changes: 12 additions & 8 deletions application/static/json/grouped_timeseries.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
{
"duration": 52,
"collect": [
"count:sum"
],
"group_by": [
"channel"
],
"period": "week"
"query": {
"duration": 52,
"collect": [
"count:sum"
],
"group_by": [
"channel"
],
"period": "week"
},
"visualisation" : {
}
}
5 changes: 4 additions & 1 deletion application/static/json/headline_figure.json
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
{}
{
'query': {},
'visualisation': {}
}
5 changes: 4 additions & 1 deletion application/static/json/journey.json
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
{}
{
'query': {},
'visualisation': {}
}
16 changes: 10 additions & 6 deletions application/static/json/kpi.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"sort_by": "_timestamp:descending",
"filter_by": [
"service_id:<service-id>",
"type:seasonally-adjusted"
]
{
"query": {
"sort_by": "_timestamp:descending",
"filter_by": [
"service_id:<service-id>",
"type:seasonally-adjusted"
]
},
"visualisation" : {
}
}
5 changes: 4 additions & 1 deletion application/static/json/list.json
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
{}
{
'query': {},
'visualisation': {}
}
10 changes: 7 additions & 3 deletions application/static/json/realtime.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"limit": 722,
"sort_by": "_timestamp:descending"
{
"query": {
"limit": 722,
"sort_by": "_timestamp:descending"
},
"visualisation" : {
}
}
5 changes: 4 additions & 1 deletion application/static/json/section.json
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
{}
{
'query': {},
'visualisation': {}
}
28 changes: 16 additions & 12 deletions application/static/json/single_timeseries.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
{
"duration": 52,
"collect": [
"avgSessionDuration:sum"
],
"group_by": [
"stage"
],
"period": "week",
"filter_by": [
"stage:thank-you"
]
{
"query": {
"duration": 52,
"collect": [
"avgSessionDuration:sum"
],
"group_by": [
"stage"
],
"period": "week",
"filter_by": [
"stage:thank-you"
]
},
"visualisation" : {
}
}
5 changes: 4 additions & 1 deletion application/static/json/tab.json
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
{}
{
'query': {},
'visualisation': {}
}
6 changes: 5 additions & 1 deletion application/static/json/table.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"start_at": "2015-01-01T00:00:00Z"
"query": {
"start_at": "2015-01-01T00:00:00Z"
},
"visualisation" : {
}
}
6 changes: 5 additions & 1 deletion application/static/json/user_satisfaction.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"sort_by": "_timestamp:ascending"
"query": {
"sort_by": "_timestamp:ascending"
},
"visualisation" : {
}
}
5 changes: 4 additions & 1 deletion application/static/json/user_satisfaction_graph.json
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
{}
{
'query': {},
'visualisation': {}
}
2 changes: 1 addition & 1 deletion application/templates/dashboards/create.html
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ <h2>Modules</h2>
<div class="form-group">
{{ module.options.label(class='col-sm-2 control-label') }}
<div class="col-sm-10">
{{ module.options(class='form-control json-field') }}
{{ module.options(class='form-control json-field js-visualisation-parameters') }}
<p class="help-block">Adjust how the visualisation looks. Settings must be <a href="http://jsonlint.com/" target="_blank">valid JSON</a></p>
</div>
</div>
Expand Down

0 comments on commit fddfd59

Please sign in to comment.