mirror of
https://github.com/langgenius/dify.git
synced 2026-05-22 09:58:42 +08:00
29 lines
991 B
TypeScript
29 lines
991 B
TypeScript
import type { AppDeployEnvironment } from '@dify/contracts/enterprise/types.gen'
|
|
|
|
export function environmentId(environment?: AppDeployEnvironment) {
|
|
return environment?.id ?? ''
|
|
}
|
|
|
|
export function environmentName(environment?: AppDeployEnvironment) {
|
|
return environment?.name || environment?.id || '—'
|
|
}
|
|
|
|
export function environmentMode(environment?: AppDeployEnvironment) {
|
|
const type = environment?.type?.toLowerCase() ?? ''
|
|
return type.includes('isolated') ? 'isolated' : 'shared'
|
|
}
|
|
|
|
function environmentRuntimeName(environment?: AppDeployEnvironment) {
|
|
return environment?.backend ?? ''
|
|
}
|
|
|
|
export function environmentBackend(environment?: AppDeployEnvironment) {
|
|
const runtime = environmentRuntimeName(environment).toLowerCase()
|
|
return runtime.includes('host') ? 'host' : 'k8s'
|
|
}
|
|
|
|
export function environmentHealth(environment?: AppDeployEnvironment) {
|
|
const status = environment?.status?.toLowerCase() ?? ''
|
|
return status.includes('ready') ? 'ready' : 'degraded'
|
|
}
|