You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/app/react/docker/containers/CreateView/RestartPolicyTab/toViewModel.ts

22 lines
571 B

import { ContainerDetailsJSON } from '../../queries/useContainer';
import { RestartPolicy } from './types';
export function toViewModel(config: ContainerDetailsJSON): RestartPolicy {
switch (config.HostConfig?.RestartPolicy?.Name) {
case 'always':
return RestartPolicy.Always;
case 'on-failure':
return RestartPolicy.OnFailure;
case 'unless-stopped':
return RestartPolicy.UnlessStopped;
case 'no':
default:
return RestartPolicy.No;
}
}
export function getDefaultViewModel(): RestartPolicy {
return RestartPolicy.No;
}