@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_.
24 lines (21 loc) • 984 B
text/typescript
import { StateHistoryResponse } from '@/models/api/StateHistoryResponse'
import { StateHistory } from '@/models/StateHistory'
import { MapFunction } from '@/services/Mapper'
export const mapStateHistoryResponseToStateHistory: MapFunction<StateHistoryResponse, StateHistory> = function(source) {
return new StateHistory({
stateType: this.map('ServerStateType', source.state_type, 'StateType'),
stateName: source.state_name,
countRuns: source.count_runs,
sumEstimatedRunTime: source.sum_estimated_run_time,
sumEstimatedLateness: source.sum_estimated_lateness,
})
}
export const mapStateHistoryToStateHistoryResponse: MapFunction<StateHistory, StateHistoryResponse> = function(source) {
return {
state_type: this.map('StateType', source.stateType, 'ServerStateType'),
state_name: source.stateName,
count_runs: source.countRuns,
sum_estimated_run_time: source.sumEstimatedRunTime,
sum_estimated_lateness: source.sumEstimatedLateness,
}
}