mirror of
https://github.com/portainer/portainer.git
synced 2025-07-22 23:09:41 +02:00
refactor(containers): migrate volumes tab to react [EE-5209] (#10284)
This commit is contained in:
parent
16ccf5871e
commit
e92f067e42
18 changed files with 398 additions and 143 deletions
|
@ -0,0 +1,33 @@
|
|||
import { CreateContainerRequest } from '../types';
|
||||
|
||||
import { Values } from './types';
|
||||
|
||||
export function toRequest(
|
||||
oldConfig: CreateContainerRequest,
|
||||
values: Values
|
||||
): CreateContainerRequest {
|
||||
const validValues = values.filter(
|
||||
(volume) => volume.containerPath && volume.name
|
||||
);
|
||||
|
||||
const volumes = Object.fromEntries(
|
||||
validValues.map((volume) => [volume.containerPath, {}])
|
||||
);
|
||||
const binds = validValues.map((volume) => {
|
||||
let bind = `${volume.name}:${volume.containerPath}`;
|
||||
if (volume.readOnly) {
|
||||
bind += ':ro';
|
||||
}
|
||||
|
||||
return bind;
|
||||
});
|
||||
|
||||
return {
|
||||
...oldConfig,
|
||||
Volumes: volumes,
|
||||
HostConfig: {
|
||||
...oldConfig.HostConfig,
|
||||
Binds: binds,
|
||||
},
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue