@@ -587,6 +587,8 @@ export const convertToExternalTileChartConfig = (
587587 ? config . select . map ( convertToExternalSelectItem )
588588 : [ DEFAULT_SELECT_ITEM ] ,
589589 orderBy : stringValueOrDefault ( config . orderBy , undefined ) ,
590+ limitAfter : config . limit ?. after || undefined ,
591+ limitUntil : config . limit ?. until || undefined ,
590592 ...externalFormulaFields ,
591593 ...externalShowOperandSeriesField ,
592594 } ;
@@ -597,6 +599,8 @@ export const convertToExternalTileChartConfig = (
597599 select : stringValueOrDefault ( config . select , '' ) ,
598600 where : config . where ,
599601 whereLanguage : config . whereLanguage ?? 'lucene' ,
602+ limitAfter : config . limit ?. after || undefined ,
603+ limitUntil : config . limit ?. until || undefined ,
600604 } ;
601605 case DisplayType . Markdown :
602606 return {
@@ -917,6 +921,23 @@ const convertExternalPromqlConfigToInternal = (
917921 }
918922} ;
919923
924+ function limitAfterUntilFields ( externalConfig : {
925+ limitAfter ?: string ;
926+ limitUntil ?: string ;
927+ } ) : { limit ?: { after ?: string ; until ?: string } } {
928+ const after = externalConfig . limitAfter ?. trim ( ) ;
929+ const until = externalConfig . limitUntil ?. trim ( ) ;
930+ if ( ! after && ! until ) {
931+ return { } ;
932+ }
933+ return {
934+ limit : {
935+ ...( after ? { after } : { } ) ,
936+ ...( until ? { until } : { } ) ,
937+ } ,
938+ } ;
939+ }
940+
920941export function convertToInternalTileConfig (
921942 externalTile : ConfigTile ,
922943) : DashboardDocument [ 'tiles' ] [ number ] {
@@ -1049,6 +1070,7 @@ export function convertToInternalTileConfig(
10491070 source : externalConfig . sourceId ,
10501071 where : '' ,
10511072 seriesReturnType : externalConfig . asRatio ? 'ratio' : undefined ,
1073+ ...limitAfterUntilFields ( externalConfig ) ,
10521074 name,
10531075 description,
10541076 } satisfies BuilderSavedChartConfig ;
@@ -1190,6 +1212,7 @@ export function convertToInternalTileConfig(
11901212 name,
11911213 description,
11921214 whereLanguage : externalConfig . whereLanguage ?? 'lucene' ,
1215+ ...limitAfterUntilFields ( externalConfig ) ,
11931216 } satisfies BuilderSavedChartConfig ;
11941217 break ;
11951218 case 'event_patterns' :
0 commit comments