diff --git a/app/client_mgt.py b/app/client_mgt.py index 3eb7a27..8bd003e 100644 --- a/app/client_mgt.py +++ b/app/client_mgt.py @@ -182,8 +182,10 @@ def list_clients_threshold(self): clientlist = query_db(query) return clientlist - def list_clients_page(self): - query = ("SELECT name,status,joindate,threshold,ssh_key,lastseen from clients;") + def list_clients_page(self, orderby="id", order="asc"): + self.orderby = orderby + self.order = order + query = (f"SELECT name,status,joindate,threshold,ssh_key,lastseen from clients order by {orderby} {order};") res = query_db(query) return res diff --git a/app/routes.py b/app/routes.py index b632d0d..6f2bd66 100644 --- a/app/routes.py +++ b/app/routes.py @@ -154,8 +154,10 @@ def status(): @app.route("/clients", methods=['GET']) @basic_auth.required def clients(): + orderby = request.args.get('orderby', 'id') + order = request.args.get('order', 'asc') client = ClientMgt("all-clients-page") - res = client.list_clients_page() + res = client.list_clients_page(orderby, order) #print (res) return render_template("clients.html", clients=res) diff --git a/app/static/style.css b/app/static/style.css index dcdfa78..4b245da 100644 --- a/app/static/style.css +++ b/app/static/style.css @@ -150,4 +150,14 @@ .topnav_autoindex a.active { background-color: #4CAF50; color: white; +} + +a.navlink:link { + color: white; + text-decoration: none; +} + +a.navlink:visited { + color: white; + text-decoration: none; } \ No newline at end of file diff --git a/app/templates/clients.html b/app/templates/clients.html index b65bc15..668f7e4 100644 --- a/app/templates/clients.html +++ b/app/templates/clients.html @@ -6,11 +6,11 @@ - - - - - + + + + + {% set red = "#ff0000" %} {% set green = "#008000" %}
ClientStatusLast SeenJoin DateSync StatusClient   Status   Last Seen   Join Date   Sync Status