dify/web/features/deployments/runtime-status.ts
Stephen Zhou 6d0d0763b1
tweaks
2026-05-11 21:16:28 +08:00

17 lines
699 B
TypeScript

import type { RuntimeInstanceRow } from '@dify/contracts/enterprise/types.gen'
type DeploymentUiStatus = 'ready' | 'deploying' | 'deploy_failed'
export function isUndeployedDeploymentRow(row?: RuntimeInstanceRow) {
return (row?.status?.toLowerCase() ?? '').includes('undeployed') || (!row?.id && !row?.currentRelease && !row?.detail)
}
export function deploymentStatus(row: RuntimeInstanceRow): DeploymentUiStatus {
const runtimeStatus = row.status?.toLowerCase() ?? ''
if (runtimeStatus.includes('deploying') || runtimeStatus.includes('pending'))
return 'deploying'
if (runtimeStatus.includes('fail') || runtimeStatus.includes('error'))
return 'deploy_failed'
return 'ready'
}