luci-app-dockerman: move docker uci configuration to own page
authorFlorian Eckert <fe@dev.tdt.de>
Thu, 8 Apr 2021 14:11:07 +0000 (16:11 +0200)
committerFlorian Eckert <fe@dev.tdt.de>
Thu, 8 Apr 2021 14:26:04 +0000 (16:26 +0200)
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
applications/luci-app-dockerman/luasrc/controller/dockerman.lua
applications/luci-app-dockerman/luasrc/model/cbi/dockerman/configuration.lua [new file with mode: 0644]
applications/luci-app-dockerman/luasrc/model/cbi/dockerman/overview.lua

index def685ce7c765327155c71bc5e4fb06fb083d14a..6a60382289e16c69d7c5766c99323d11ccc1b4ae 100644 (file)
@@ -8,11 +8,12 @@ local docker = require "luci.model.docker"
 module("luci.controller.dockerman",package.seeall)
 
 function index()
-       local e = entry({"admin", "docker"}, firstchild(), "Docker", 40)
-       e.dependent = false
-       e.acl_depends = { "luci-app-dockerman" }
+       entry({"admin", "docker"},
+               alias("admin", "docker", "config"),
+               _("Docker"),
+               40).acl_depends = { "luci-app-dockerman" }
 
-       entry({"admin", "docker", "overview"},cbi("dockerman/overview"),_("Overview"), 1).leaf=true
+       entry({"admin", "docker", "config"},cbi("dockerman/configuration"),_("Configuration"), 1).leaf=true
 
        local remote = luci.model.uci.cursor():get_bool("dockerd", "globals", "remote_endpoint")
        if remote then
@@ -32,11 +33,12 @@ function index()
                return
        end
 
-       entry({"admin", "docker", "containers"}, form("dockerman/containers"), _("Containers"), 2).leaf=true
-       entry({"admin", "docker", "images"}, form("dockerman/images"), _("Images"), 3).leaf=true
-       entry({"admin", "docker", "networks"}, form("dockerman/networks"), _("Networks"), 4).leaf=true
-       entry({"admin", "docker", "volumes"}, form("dockerman/volumes"), _("Volumes"), 5).leaf=true
-       entry({"admin", "docker", "events"}, call("action_events"), _("Events"), 6)
+       entry({"admin", "docker", "overview"},cbi("dockerman/overview"),_("Overview"), 2).leaf=true
+       entry({"admin", "docker", "containers"}, form("dockerman/containers"), _("Containers"), 3).leaf=true
+       entry({"admin", "docker", "images"}, form("dockerman/images"), _("Images"), 4).leaf=true
+       entry({"admin", "docker", "networks"}, form("dockerman/networks"), _("Networks"), 5).leaf=true
+       entry({"admin", "docker", "volumes"}, form("dockerman/volumes"), _("Volumes"), 6).leaf=true
+       entry({"admin", "docker", "events"}, call("action_events"), _("Events"), 7)
 
        entry({"admin", "docker", "newcontainer"}, form("dockerman/newcontainer")).leaf=true
        entry({"admin", "docker", "newnetwork"}, form("dockerman/newnetwork")).leaf=true
diff --git a/applications/luci-app-dockerman/luasrc/model/cbi/dockerman/configuration.lua b/applications/luci-app-dockerman/luasrc/model/cbi/dockerman/configuration.lua
new file mode 100644 (file)
index 0000000..73987ca
--- /dev/null
@@ -0,0 +1,72 @@
+-- Copyright 2021 Florian Eckert <fe@dev.tdt.de>
+-- Licensed to the public under the Apache License 2.0.
+
+local m, s, o
+
+m = Map("dockerd",
+       translate("Docker"),
+       translate("DockerMan is a Simple Docker manager client for LuCI"))
+
+s = m:section(NamedSection, "globals", "section", translate("Setting"))
+
+o = s:option(Flag, "remote_endpoint",
+       translate("Remote Endpoint"),
+       translate("Connect to remote endpoint"))
+o.rmempty = false
+
+o = s:option(Value, "remote_host",
+       translate("Remote Host"),
+       translate("Host or IP Address for the connection to a remote docker instance"))
+o.datatype = "host"
+o.rmempty = false
+o.optional = false
+o.placeholder = "10.1.1.2"
+o:depends("remote_endpoint", 1)
+
+o = s:option(Value, "remote_port",
+       translate("Remote Port"))
+o.placeholder = "2375"
+o.datatype = "port"
+o.rmempty = false
+o.optional = false
+o:depends("remote_endpoint", 1)
+
+if nixio.fs.access("/usr/bin/dockerd") then
+       o = s:option(Value, "data_root",
+               translate("Docker Root Dir"))
+       o.placeholder = "/opt/docker/"
+       o:depends("remote_endpoint", 0)
+
+       o = s:option(Value, "bip",
+               translate("Default bridge"),
+               translate("Configure the default bridge network"))
+       o.placeholder = "172.17.0.1/16"
+       o.datatype = "ipaddr"
+       o:depends("remote_endpoint", 0)
+
+       o = s:option(DynamicList, "registry_mirrors",
+               translate("Registry Mirrors"),
+               translate("It replaces the daemon registry mirrors with a new set of registry mirrors"))
+       o.placeholder = translate("Example: https://hub-mirror.c.163.com")
+       o:depends("remote_endpoint", 0)
+
+       o = s:option(ListValue, "log_level",
+               translate("Log Level"),
+               translate('Set the logging level'))
+       o:value("debug", translate("Debug"))
+       o:value("", translate("Info")) -- This is the default debug level from the deamon is optin is not set
+       o:value("warn", translate("Warning"))
+       o:value("error", translate("Error"))
+       o:value("fatal", translate("Fatal"))
+       o.rmempty = true
+       o:depends("remote_endpoint", 0)
+
+       o = s:option(DynamicList, "hosts",
+               translate("Client connection"),
+               translate('Specifies where the Docker daemon will listen for client connections (default: unix:///var/run/docker.sock)'))
+       o.placeholder = translate("Example: tcp://0.0.0.0:2375")
+       o.rmempty = true
+       o:depends("remote_endpoint", 0)
+end
+
+return m
index e28343f1a75fc862990d6444a9e0e26a8e8695dc..76a4dfd79457896c3007d8b346455b05249caa0d 100644 (file)
@@ -90,66 +90,4 @@ if docker.new():_ping().code == 200 then
        s.volumes_total = tostring(#volumes_list)
 end
 
-s = m:section(NamedSection, "globals", "section", translate("Setting"))
-
-o = s:option(Flag, "remote_endpoint",
-       translate("Remote Endpoint"),
-       translate("Connect to remote endpoint"))
-o.rmempty = false
-
-o = s:option(Value, "remote_host",
-       translate("Remote Host"),
-       translate("Host or IP Address for the connection to a remote docker instance"))
-o.datatype = "host"
-o.rmempty = false
-o.optional = false
-o.placeholder = "10.1.1.2"
-o:depends("remote_endpoint", 1)
-
-o = s:option(Value, "remote_port",
-       translate("Remote Port"))
-o.placeholder = "2375"
-o.datatype = "port"
-o.rmempty = false
-o.optional = false
-o:depends("remote_endpoint", 1)
-
-if nixio.fs.access("/usr/bin/dockerd") then
-       o = s:option(Value, "data_root",
-               translate("Docker Root Dir"))
-       o.placeholder = "/opt/docker/"
-       o:depends("remote_endpoint", 0)
-
-       o = s:option(Value, "bip",
-               translate("Default bridge"),
-               translate("Configure the default bridge network"))
-       o.placeholder = "172.17.0.1/16"
-       o.datatype = "ipaddr"
-       o:depends("remote_endpoint", 0)
-
-       o = s:option(DynamicList, "registry_mirrors",
-               translate("Registry Mirrors"),
-               translate("It replaces the daemon registry mirrors with a new set of registry mirrors"))
-       o.placeholder = translate("Example: https://hub-mirror.c.163.com")
-       o:depends("remote_endpoint", 0)
-
-       o = s:option(ListValue, "log_level",
-               translate("Log Level"),
-               translate('Set the logging level'))
-       o:value("debug", translate("Debug"))
-       o:value("", translate("Info")) -- This is the default debug level from the deamon is optin is not set
-       o:value("warn", translate("Warning"))
-       o:value("error", translate("Error"))
-       o:value("fatal", translate("Fatal"))
-       o.rmempty = true
-       o:depends("remote_endpoint", 0)
-
-       o = s:option(DynamicList, "hosts",
-               translate("Client connection"),
-               translate('Specifies where the Docker daemon will listen for client connections (default: unix:///var/run/docker.sock)'))
-       o.placeholder = translate("Example: tcp://0.0.0.0:2375")
-       o.rmempty = true
-       o:depends("remote_endpoint", 0)
-end
-
 return m