mirror of
https://github.com/portainer/portainer.git
synced 2025-07-22 06:49:40 +02:00
refactor(containers): migrate create view to react [EE-2307] (#9175)
This commit is contained in:
parent
bc0050a7b4
commit
d970f0e2bc
71 changed files with 2612 additions and 1399 deletions
24
app/react/docker/containers/CreateView/BaseForm/toRequest.ts
Normal file
24
app/react/docker/containers/CreateView/BaseForm/toRequest.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
import { CreateContainerRequest } from '../types';
|
||||
|
||||
import { Values } from './BaseForm';
|
||||
import { parsePortBindingRequest } from './PortsMappingField.requestModel';
|
||||
|
||||
export function toRequest(
|
||||
oldConfig: CreateContainerRequest,
|
||||
values: Values
|
||||
): CreateContainerRequest {
|
||||
const bindings = parsePortBindingRequest(values.ports);
|
||||
|
||||
return {
|
||||
...oldConfig,
|
||||
ExposedPorts: Object.fromEntries(
|
||||
Object.keys(bindings).map((key) => [key, {}])
|
||||
),
|
||||
HostConfig: {
|
||||
...oldConfig.HostConfig,
|
||||
PublishAllPorts: values.publishAllPorts,
|
||||
PortBindings: bindings,
|
||||
AutoRemove: values.autoRemove,
|
||||
},
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue