@@ -44,6 +44,9 @@ Prometheus.Graph.prototype.initialize = function() {
4444 if ( self . options . tab === undefined ) {
4545 self . options . tab = 1 ;
4646 }
47+ if ( self . options . max_source_resolution === undefined ) {
48+ self . options . max_source_resolution = "0s" ;
49+ }
4750
4851 // Draw graph controls and container from Handlebars template.
4952
@@ -93,6 +96,8 @@ Prometheus.Graph.prototype.initialize = function() {
9396 self . stacked = self . queryForm . find ( "input[name=stacked]" ) ;
9497 self . insertMetric = self . queryForm . find ( "select[name=insert_metric]" ) ;
9598 self . refreshInterval = self . queryForm . find ( "select[name=refresh]" ) ;
99+ self . maxSourceResolutionInput = self . queryForm . find ( "select[name=max_source_resolution_input]" ) ;
100+
96101
97102 self . consoleTab = graphWrapper . find ( ".console" ) ;
98103 self . graphTab = graphWrapper . find ( ".graph_container" ) ;
@@ -231,6 +236,8 @@ Prometheus.Graph.prototype.initialize = function() {
231236 stylePartialResponseBtn ( ) ;
232237 } ) ;
233238
239+ self . maxSourceResolutionInput . val ( self . options . max_source_resolution ) ;
240+
234241 self . queryForm . submit ( function ( ) {
235242 self . consoleTab . addClass ( "reload" ) ;
236243 self . graphTab . addClass ( "reload" ) ;
@@ -377,7 +384,6 @@ Prometheus.Graph.prototype.getOptions = function() {
377384 "range_input" ,
378385 "end_input" ,
379386 "step_input" ,
380- "downsample_input" ,
381387 "stacked" ,
382388 "moment_input"
383389 ] ;
@@ -390,6 +396,9 @@ Prometheus.Graph.prototype.getOptions = function() {
390396 }
391397 }
392398 } ) ;
399+
400+ options . max_source_resolution = self . maxSourceResolutionInput . val ( ) ;
401+
393402 options . expr = self . expr . val ( ) ;
394403 options . tab = self . options . tab ;
395404 return options ;
@@ -521,7 +530,11 @@ Prometheus.Graph.prototype.submitQuery = function() {
521530 var startTime = new Date ( ) . getTime ( ) ;
522531 var rangeSeconds = self . parseDuration ( self . rangeInput . val ( ) ) ;
523532 var resolution = parseInt ( self . queryForm . find ( "input[name=step_input]" ) . val ( ) ) || Math . max ( Math . floor ( rangeSeconds / 250 ) , 1 ) ;
524- var maxSourceResolution = self . queryForm . find ( "select[name=max_source_resolution_input]" ) . val ( ) ;
533+ var maxSourceResolution = self . maxSourceResolutionInput . val ( )
534+ // normalize max_source_resolution parameter
535+ if ( maxSourceResolution == "auto" ) {
536+ maxSourceResolution = ""
537+ }
525538 var endDate = self . getEndDate ( ) / 1000 ;
526539 var moment = self . getMoment ( ) / 1000 ;
527540
0 commit comments