@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_.
21 lines (18 loc) • 780 B
text/typescript
import { createTuple } from '@/utilities/tuples'
export const { values: workPoolStatus, isValue: isWorkPoolStatus } = createTuple(['ready', 'not_ready', 'paused'])
export type WorkPoolStatus = typeof workPoolStatus[number]
export const { values: serverWorkPoolStatus, isValue: isServerWorkPoolStatus } = createTuple(['READY', 'NOT_READY', 'PAUSED'])
export type ServerWorkPoolStatus = typeof serverWorkPoolStatus[number]
export function getWorkPoolStatusLabel(status: WorkPoolStatus): string {
switch (status) {
case 'not_ready':
return 'Not Ready'
case 'paused':
return 'Paused'
case 'ready':
return 'Ready'
default:
const exhaustive: never = status
throw new Error(`getWorkPoolStatusLabel missing case for ${exhaustive}`)
}
}