portainer/app/react/docker/stacks/view-models/utils.ts

21 lines
633 B
TypeScript

import { ExternalStackViewModel } from './external-stack';
import { StackViewModel } from './stack';
export function isExternalStack(
stack: StackViewModel | ExternalStackViewModel
): stack is ExternalStackViewModel {
return 'External' in stack && stack.External;
}
export function isRegularStack(
stack: StackViewModel | ExternalStackViewModel
): stack is StackViewModel & { Regular: true } {
return 'Regular' in stack && stack.Regular;
}
export function isOrphanedStack(
stack: StackViewModel | ExternalStackViewModel
): stack is StackViewModel & { Orphaned: true } {
return 'Orphaned' in stack && stack.Orphaned;
}