@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_.
23 lines (20 loc) • 964 B
text/typescript
import { HistogramDataPoint } from '@prefecthq/vue-charts'
import { WorkspaceEventsCountResponse } from '@/models/api/workspaceEvents'
import { WorkspaceEventsCount } from '@/models/workspaceEventsCount'
import { MapFunction } from '@/services/Mapper'
export const mapWorkspaceEventsCountResponseToWorkspaceEventsCount: MapFunction<WorkspaceEventsCountResponse, WorkspaceEventsCount> = function(source) {
return new WorkspaceEventsCount({
count: source.count,
label: source.label,
value: source.value,
startTime: this.map('string', source.start_time, 'Date'),
endTime: this.map('string', source.end_time, 'Date'),
})
}
export const mapWorkspaceEventsCountResponseToHistogramDataPoint: MapFunction<WorkspaceEventsCountResponse, HistogramDataPoint> = function(source) {
return {
value: source.count,
intervalStart: this.map('string', source.start_time, 'Date'),
intervalEnd: this.map('string', source.end_time, 'Date'),
}
}