diff --git a/README.md b/README.md index 1ca0c6e..d88f2ba 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ your production-ready server of choice. ## Screenshots -The index lists available UPS devices, along with their description, +The index lists available UPS devices on each server, along with their description, status, and battery charge: ![Index](screenshots/ups_index.png "Index") @@ -27,3 +27,5 @@ status indicator, as well as the values of all variables set on the device: ![UPS View](screenshots/ups_view.png "UPS View") + +Clicking on the power icon will return to the index page. \ No newline at end of file diff --git a/screenshots/ups_index.png b/screenshots/ups_index.png index 3789a62..0b4f43c 100644 Binary files a/screenshots/ups_index.png and b/screenshots/ups_index.png differ diff --git a/screenshots/ups_view.png b/screenshots/ups_view.png index 2383263..a3ff508 100644 Binary files a/screenshots/ups_view.png and b/screenshots/ups_view.png differ diff --git a/webnut/__init__.py b/webnut/__init__.py index 83e98ae..0549098 100644 --- a/webnut/__init__.py +++ b/webnut/__init__.py @@ -8,10 +8,11 @@ def main(global_config, **settings): config = Configurator(settings=settings) config.include('pyramid_chameleon') config.add_static_view('static', 'static', cache_max_age=3600) + config.add_route("favicon", "/favicon.ico") config.add_route('home', '/') config.add_route('ups_view', '/{ups}') config.add_view('webnut.views.notfound', - renderer='webnut:templates/404.pt', - context='pyramid.exceptions.NotFound') + renderer='webnut:templates/404.pt', + context='pyramid.exceptions.NotFound') config.scan() return config.make_wsgi_app() diff --git a/webnut/config.example.py b/webnut/config.example.py index c3cd265..68c2d2b 100644 --- a/webnut/config.example.py +++ b/webnut/config.example.py @@ -1,6 +1,18 @@ # User-defined configuration. # Rename this to config.py. + +# Single server configuration, backwards compatible: + server = '127.0.0.1' port = 3493 username = None password = None + +# Multi-server configuration: + +from .webnut import NUTServer + +servers = [ + NUTServer('192.168.1.3', 3493, None, None), + NUTServer('192.168.1.6', 3493, None, None) +] diff --git a/webnut/static/favicon.ico b/webnut/static/favicon.ico new file mode 100644 index 0000000..0af01ac Binary files /dev/null and b/webnut/static/favicon.ico differ diff --git a/webnut/templates/404.pt b/webnut/templates/404.pt index 6734592..8891467 100644 --- a/webnut/templates/404.pt +++ b/webnut/templates/404.pt @@ -1,6 +1,5 @@
-

404 Not Found

Sorry, no UPS with that name exists.
diff --git a/webnut/templates/index.pt b/webnut/templates/index.pt index 8a62e3b..60d2ad7 100644 --- a/webnut/templates/index.pt +++ b/webnut/templates/index.pt @@ -1,29 +1,36 @@
-
+ + + - + +
NameServer Description Status BatteryRuntime
- ${ups} + ${ups_list[ups]['name']} ${ups_list[ups]['server']} ${ups_list[ups]['description']} ${ups_list[ups]['status']}${ups_list[ups]['battery']}%${ups_list[ups]['battery']}${ups_list[ups]['runtime']}
- - + + + + + + - + + + + + + + +
-
+
-

${title}

+

 ${title}

+
+
-
-


-
diff --git a/webnut/templates/ups_view.pt b/webnut/templates/ups_view.pt index bfc542e..fd3fd63 100644 --- a/webnut/templates/ups_view.pt +++ b/webnut/templates/ups_view.pt @@ -1,9 +1,15 @@
- Status: ${ups_status} -
- Battery charge: ${ups_vars['battery.charge'][0]}% -
+
+
+
Status:
+
${ups_status}
+
+
+
Battery charge:
+
${ups_battery}
+
+

UPS Variables

@@ -11,6 +17,7 @@ + @@ -18,12 +25,17 @@ +
Name Description ValueWritable
${var} ${ups_vars[var][1]} ${ups_vars[var][0]}${ups_vars[var][2]}
- - + + + + + +