UNPKG

@prefecthq/prefect-ui-library

Version:

This library is the Vue and Typescript component library for [Prefect 2](https://github.com/PrefectHQ/prefect) and [Prefect Cloud 2](https://www.prefect.io/cloud/). _The components and utilities in this project are not meant to be used independently_.

35 lines (28 loc) 919 B
import { FlowRunsFilter, TaskRunsFilter } from '@/models' import { MapFunction } from '@/services/Mapper' import { FlowStatsFilter } from '@/types/flow' export const mapFlowStatsFilterToFlowRunsFilter: MapFunction<FlowStatsFilter, FlowRunsFilter> = function(source) { const { startDate, endDate } = this.map('DateRangeSelectValue', source.range, 'DateRange') const filter: FlowRunsFilter = { flows: { id: [source.flowId], }, flowRuns: { startTimeAfter: startDate, startTimeBefore: endDate, }, } return filter } export const mapFlowStatsFilterToTaskRunsFilter: MapFunction<FlowStatsFilter, TaskRunsFilter> = function(source) { const { startDate, endDate } = this.map('DateRangeSelectValue', source.range, 'DateRange') return { flows: { id: [source.flowId], }, taskRuns: { startTimeAfter: startDate, startTimeBefore: endDate, }, } }