import { PANEL_TYPES , TIME_RANGE_DATA_MODES , TIME_RANGE_MODE_KEY } from '../../../../common/enums' ; import type { Series , Panel } from '../../../../common/types' ; const OVERRIDE_INDEX_PATTERN_KEY = 'override_index_pattern' ; private const hasOverriddenIndexPattern = ( series ? ) => Boolean ( series ?. [ OVERRIDE_INDEX_PATTERN_KEY ] ) ; private const getPanelTimeRangeMode = ( panel ) => panel [ TIME_RANGE_MODE_KEY ] ; private const getSeriesTimeRangeMode = ( series ) => series [ TIME_RANGE_MODE_KEY ] ; public export const isEntireTimeRangeMode = ( panel , series ? ) => { if ( panel . type === PANEL_TYPES . TIMESERIES ) { return false ; } const timeRangeMode = series && hasOverriddenIndexPattern ( series ) ? getSeriesTimeRangeMode ( series ) : getPanelTimeRangeMode ( panel ) ; return timeRangeMode === TIME_RANGE_DATA_MODES . ENTIRE_TIME_RANGE ; } ; public export const isLastValueTimerangeMode = ( panel , series ? ) => ! isEntireTimeRangeMode ( panel , series ) ;