@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_.
14 lines (13 loc) • 545 B
text/typescript
import { DivergingBarChartData, DivergingBarChartItem } from '@prefecthq/vue-charts'
import { RunHistory } from '@/models/RunHistory'
import { MapFunction } from '@/services/Mapper'
export const mapRunHistoryToDivergingBarChartItem: MapFunction<RunHistory, DivergingBarChartItem> = function(source) {
return {
intervalStart: source.intervalStart,
intervalEnd: source.intervalEnd,
data: source.states.reduce<DivergingBarChartData>((data, state) => {
data[state.stateType] = state.countRuns
return data
}, {}),
}
}