status polling fix and minior gui tweaks

pull/2/head
riley 1 year ago
parent 5fcdd11797
commit 18089e8810

@ -11,7 +11,7 @@ m = taskd.docker_map("nodered", "nodered", "/usr/libexec/apps/nodered/nodered.sh
translate("Node-RED is a programming tool for wiring together hardware devices, APIs and online services in new and interesting ways.")
.. translate("Official website:") .. ' <a href=\"https://www.nodered.org/\" target=\"_blank\">https://www.nodered.org/</a>')
s = m:section(SimpleSection, translate("Service Status"), translate("nodered status:"))
s = m:section(SimpleSection, translate("Service Status"))
s:append(Template("nodered/status"))
s = m:section(TypedSection, "nodered", translate("Setup"), translate("Refresh to update settings."))

@ -94,8 +94,13 @@ case "${ACTION}" in
;;
"status")
APP_NAME="node-red"
CONTAINER_NAMES=$(docker ps -a --filter "name=${APP_NAME}" --format '{{.Names}}')
docker ps --all -f "name=${CONTAINER_NAMES}" --format '{{.Status}}'
CONTAINER_NAME=$(docker ps -a --filter "name=${APP_NAME}" --format '{{.Names}}')
CONTAINER_STATUS=$(docker ps --all --filter "name=${CONTAINER_NAME}" --format '{{.Status}}' | awk '/^Up/ { print "up " substr($0, 4) } !/^Up/ && /.+/ { print "down" }')
if [ -z "$CONTAINER_NAME" ]; then
echo "${APP_NAME} is not installed"
else
echo "${CONTAINER_STATUS}"
fi
;;
"port")
APP_NAME="node-red"

Loading…
Cancel
Save