File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed
resources/report/dashboard Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,16 @@ document.querySelectorAll(".tab-link").forEach(button => {
1212// Initialize selection widgets
1313const choicesInstances = { } ;
1414
15+ choicesInstances [ "region-select" ] = new Choices ( "#region-select" , {
16+ searchEnabled : false ,
17+ removeItemButton : true ,
18+ shouldSort : false ,
19+ itemSelectText : "" ,
20+ placeholder : false
21+ } ) ;
22+ document . getElementById ( "region-select" ) . addEventListener ( "change" , updateChart ) ;
23+
24+
1525choicesInstances [ "source-select" ] = new Choices ( "#source-select" , {
1626 searchEnabled : false ,
1727 removeItemButton : true ,
@@ -102,13 +112,17 @@ function getSelectedValues(id) {
102112}
103113
104114function updateChart ( ) {
115+ const selectedRegions = getSelectedValues ( "region-select" ) ;
105116 const selectedSources = getSelectedValues ( "source-select" ) ;
106117 const selectedparams = getSelectedValues ( "param-select" ) ;
107118 const selectedMetrics = getSelectedValues ( "metric-select" ) ;
108119
109120 const newSpec = JSON . parse ( JSON . stringify ( spec ) ) ;
110121 const filters = [ ] ;
111122
123+ if ( selectedRegions . length > 0 ) {
124+ filters . push ( { field : "region" , oneOf : selectedRegions } ) ;
125+ }
112126 if ( selectedSources . length > 0 ) {
113127 filters . push ( { field : "source" , oneOf : selectedSources } ) ;
114128 }
Original file line number Diff line number Diff line change 107107 </p >
108108 </div >
109109 <div class =" controls" >
110+ <div class =" control-group" >
111+ <label >Regions(s)</label >
112+ <select id =" region-select" >
113+ {% for region in regions %}
114+ <option value =" {{region}}" {% if region == ' all' %} selected{% endif %} >{{region}}</option >
115+ {% endfor %}
116+ </select >
117+ </div >
110118 <div class =" control-group" >
111119 <label >Source(s)</label >
112120 <select id =" source-select" multiple >
Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ def main(args):
5353 sources = df ["source" ].unique ()
5454 params = df ["param" ].unique ()
5555 metrics = df ["metric" ].unique ()
56+ regions = df ["region" ].unique ()
5657
5758 # get json string to embed in the HTML
5859 df_json = df .to_json (orient = "records" , lines = False )
@@ -76,6 +77,7 @@ def main(args):
7677 sources = sources ,
7778 params = params ,
7879 metrics = metrics ,
80+ regions = regions ,
7981 header_text = args .header_text ,
8082 )
8183 LOG .info ("Size of generated HTML: %d bytes" , len (html .encode ("utf-8" )))
You can’t perform that action at this time.
0 commit comments