@@ -53,6 +53,12 @@ type DomElements = {
5353 historicalToTimestamp : HTMLInputElement ,
5454 buttonFromOldestTimestamp : HTMLButtonElement ,
5555 buttonToMostRecentTimestamp : HTMLButtonElement ,
56+ quickFetchRevisionButtons : HTMLSpanElement ,
57+ buttonLastNRevisions10 : HTMLButtonElement ,
58+ buttonLastNRevisions100 : HTMLButtonElement ,
59+ quickFetchTimestampButtons : HTMLSpanElement ,
60+ buttonLastTime1h : HTMLButtonElement ,
61+ buttonLastTime24h : HTMLButtonElement ,
5662 inputHistoricalRqlFilter : HTMLInputElement ,
5763 buttonFetchHistorical : HTMLButtonElement ,
5864 buttonStopHistorical : HTMLButtonElement ,
@@ -82,6 +88,12 @@ let dom: DomElements = {
8288 historicalToTimestamp : null ,
8389 buttonFromOldestTimestamp : null ,
8490 buttonToMostRecentTimestamp : null ,
91+ quickFetchRevisionButtons : null ,
92+ buttonLastNRevisions10 : null ,
93+ buttonLastNRevisions100 : null ,
94+ quickFetchTimestampButtons : null ,
95+ buttonLastTime1h : null ,
96+ buttonLastTime24h : null ,
8597 inputHistoricalRqlFilter : null ,
8698 buttonFetchHistorical : null ,
8799 buttonStopHistorical : null ,
@@ -153,6 +165,11 @@ export function ready() {
153165 dom . historicalToRevision . value = String ( probedMaxRevision ) ;
154166 dom . historicalToRevisionSlider . value = String ( probedMaxRevision ) ;
155167 } ;
168+ dom . buttonLastNRevisions10 . onclick = ( ) => quickFetchLastRevisions ( 10 ) ;
169+ dom . buttonLastNRevisions100 . onclick = ( ) => quickFetchLastRevisions ( 100 ) ;
170+ dom . buttonLastTime1h . onclick = ( ) => quickFetchLastTime ( 1 ) ;
171+ dom . buttonLastTime24h . onclick = ( ) => quickFetchLastTime ( 24 ) ;
172+
156173 dom . buttonFromOldestTimestamp . onclick = ( ) => {
157174 if ( probedOldestTimestamp ) {
158175 dom . historicalFromTimestamp . value = probedOldestTimestamp ;
@@ -432,6 +449,26 @@ function onRangeModeChange() {
432449 const byRevision = dom . historicalRangeModeRevision . checked ;
433450 dom . historicalRevisionRange . hidden = ! byRevision ;
434451 dom . historicalTimestampRange . hidden = byRevision ;
452+ dom . quickFetchRevisionButtons . hidden = ! byRevision ;
453+ dom . quickFetchTimestampButtons . hidden = byRevision ;
454+ }
455+
456+ function quickFetchLastRevisions ( count : number ) {
457+ const from = Math . max ( probedMinRevision , probedMaxRevision - count + 1 ) ;
458+ const to = probedMaxRevision ;
459+ dom . historicalFromRevision . value = String ( from ) ;
460+ dom . historicalFromRevisionSlider . value = String ( from ) ;
461+ dom . historicalToRevision . value = String ( to ) ;
462+ dom . historicalToRevisionSlider . value = String ( to ) ;
463+ onFetchHistorical ( ) ;
464+ }
465+
466+ function quickFetchLastTime ( hours : number ) {
467+ const now = new Date ( ) ;
468+ const from = new Date ( now . getTime ( ) - hours * 60 * 60 * 1000 ) ;
469+ dom . historicalFromTimestamp . value = Utils . toDatetimeLocalValue ( from . toISOString ( ) ) ;
470+ dom . historicalToTimestamp . value = Utils . toDatetimeLocalValue ( now . toISOString ( ) ) ;
471+ onFetchHistorical ( ) ;
435472}
436473
437474function onFetchHistorical ( ) {
0 commit comments