Commit 132c7c9c authored by jan.koester's avatar jan.koester
Browse files

test

parent 0655cf80
Loading
Loading
Loading
Loading
+6 −3
Changes for modules/containers/containers.cpp: 6 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *   list                  -> {containers, images, jobs, bridges} or
 *                            {unavailable} when containerd isn't there
 *       containers: [{name, image, state, pid, started, exitCode, restarts,
 *           error?, network, address?, vlan?, lease?, autostart, restart, memory, tasks}]
 *           error?, network, address?, address6?, ipv6? (false if off), vlan?, lease?, autostart, restart, memory, tasks}]
 *       images: [{image, id, digest, size, layers, created, pulled,
 *           architecture, entrypoint?, cmd?, workdir?, user?, env[], ports[],
 *           volumes[], usedBy[]}]
@@ -41,7 +41,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *   create {container}    a container: name, image, entrypoint[], args[],
 *   update {name, container}   env[], user, workdir, hostname, boot,
 *                         autostart, restart, network, bridge, address,
 *                         gateway, mac, vlan (0: none), dns[], binds[], tmpfs[], devices[], readOnly,
 *                         gateway, address6, gateway6, ipv6, mac, vlan (0: none), dns[], binds[], tmpfs[], devices[], readOnly,
 *                         memoryMax, tasksMax, capabilities[],
 *                         dropCapabilities[] (update: name renames)
 *   delete {name}         (its files go in the background)
@@ -93,7 +93,7 @@ namespace {

using Fields = std::vector<std::pair<std::string, std::string>>;

const std::set<std::string> Flags = {"boot", "autostart", "read_only"};
const std::set<std::string> Flags = {"boot", "autostart", "read_only", "ipv6"};
const std::set<std::string> Numbers = {"pid", "started", "exit_code", "restarts", "memory", "tasks", "size", "layers",
                                       "pulled", "memory_max", "tasks_max", "seconds", "finished", "vlan"};
// repeated keys -> JSON list names
@@ -261,6 +261,9 @@ std::string settingsFields(json_object *c, Fields &f, bool create) {
    text("bridge", "bridge");
    text("address", "address");
    text("gateway", "gateway");
    text("address6", "address6");
    text("gateway6", "gateway6");
    flag("ipv6", "ipv6");
    text("mac", "mac");
    number("vlan", "vlan");
    flag("readOnly", "read_only");
+19 −1
Changes for www/modules/containers.js: 19 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -38,6 +38,10 @@
    'Only loopback': 'Nur Loopback', 'Own address in a bridge': 'Eigene Adresse in einer Bridge',
    'Bridge': 'Bridge', 'Address (CIDR)': 'Adresse (CIDR)', 'Gateway': 'Gateway', 'DNS servers': 'DNS-Server',
    'Address from DHCP': 'Adresse per DHCP', 'MAC address': 'MAC-Adresse',
    'IPv6': 'IPv6', 'IPv6 address (CIDR)': 'IPv6-Adresse (CIDR)', 'IPv6 gateway': 'IPv6-Gateway',
    'empty: by SLAAC': 'leer: per SLAAC', 'empty: from router advertisements': 'leer: aus Router-Advertisements',
    'Without an IPv6 address the container takes one by SLAAC when a router in the bridge advertises a prefix.':
      'Ohne IPv6-Adresse bezieht der Container eine per SLAAC, wenn ein Router in der Bridge ein Präfix ankündigt.',
    'VLAN (0: none)': 'VLAN (0: keins)', 'VLAN {0}': 'VLAN {0}',
    'The VLAN must be between 0 and 4094.': 'Das VLAN muss zwischen 0 und 4094 liegen.',
    'With a VLAN the container is an access port of it: the bridge filters VLANs (its other ports stay untagged), its uplinks carry the VLAN tagged, so the switch port must too.':
@@ -305,9 +309,19 @@
          h('p', {class: 'hint'}, t('With a VLAN the container is an access port of it: the bridge filters VLANs (its other ports stay untagged), its uplinks carry the VLAN tagged, so the switch port must too.')),
          h('label', {class: 'check'}, dhcp, t('Address from DHCP')),
          staticBox,
          h('label', {class: 'check'}, ipv6, t('IPv6')),
          ipv6Box,
          bridges.length ? null : h('p', {class: 'hint'}, t('No bridge yet: create one under Network.')));
        dhcp.addEventListener('change', () => { staticBox.hidden = dhcp.checked; });
        staticBox.hidden = dhcp.checked;
        const ipv6 = h('input', {type: 'checkbox', name: 'ipv6', checked: c.ipv6 !== false});
        const ipv6Box = h('div', {},
          h('div', {class: 'row'},
            h('label', {}, t('IPv6 address (CIDR)'), h('input', {name: 'address6', value: c.address6 || '', placeholder: t('empty: by SLAAC')})),
            h('label', {}, t('IPv6 gateway'), h('input', {name: 'gateway6', value: c.gateway6 || '', placeholder: t('empty: from router advertisements')}))),
          h('p', {class: 'hint'}, t('Without an IPv6 address the container takes one by SLAAC when a router in the bridge advertises a prefix.')));
        ipv6.addEventListener('change', () => { ipv6Box.hidden = !ipv6.checked; });
        ipv6Box.hidden = !ipv6.checked;
        const portsHint = h('p', {class: 'hint'});
        const volumesHint = h('p', {class: 'hint'});
        const entry = h('input', {name: 'entrypoint', value: joinWords(c.entrypoint), class: 'mono'});
@@ -382,7 +396,10 @@
          name: d.name.trim(), image: d.image, autostart: d.autostart, restart: d.restart, network: d.network,
          bridge: d.network === 'bridge' ? (d.bridge || '') : '',
          address: d.network !== 'bridge' ? '' : d.dhcp ? 'dhcp' : d.address.trim(),
          gateway: d.network === 'bridge' && !d.dhcp ? d.gateway.trim() : '', mac: d.network === 'bridge' ? d.mac.trim() : '', vlan,
          gateway: d.network === 'bridge' && !d.dhcp ? d.gateway.trim() : '',
          ipv6: d.network !== 'bridge' || d.ipv6,
          address6: d.network === 'bridge' && d.ipv6 ? d.address6.trim() : '',
          gateway6: d.network === 'bridge' && d.ipv6 ? d.gateway6.trim() : '', mac: d.network === 'bridge' ? d.mac.trim() : '', vlan,
          dns: words(d.dns), args: words(d.args),
          entrypoint: words(d.entrypoint), env: lines(d.env), binds: lines(d.binds), tmpfs: lines(d.tmpfs), devices: lines(d.devices),
          user: d.user.trim(), workdir: d.workdir.trim(), hostname: d.hostname.trim(),
@@ -431,6 +448,7 @@
          {title: t('Network'), render: c => c.network !== 'bridge' ? t(c.network || '')
            : [c.address === 'dhcp' ? h('span', {class: 'mono'}, c.lease ? t('DHCP: {0}', c.lease) : t('DHCP'))
                                    : h('span', {class: 'mono'}, c.address || t('bridge')),
               c.address6 ? [h('br'), h('span', {class: 'mono'}, c.address6)] : null,
               c.vlan ? [' ', h('span', {class: 'badge'}, t('VLAN {0}', c.vlan))] : null]},
          {title: t('Memory'), render: c => c.state === 'running' && c.memory ? mib(c.memory) : ''},
          {title: '', class: 'actions', render: c => {