From c728f4f2af854c8fffe5ea0cb52a21523e6a3291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20=C5=A0trauch?= Date: Tue, 14 Jul 2020 23:40:47 +0200 Subject: [PATCH] UI: Load data into vue --- api.http | 3 ++- main.go | 11 +++++------ ui/index.html | 33 ++++++++++++++++++++++++--------- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/api.http b/api.http index d510dd8..1ecb124 100644 --- a/api.http +++ b/api.http @@ -17,7 +17,8 @@ Content-type: application/json { "ssh_port": 46500, - "http_port": 46501 + "http_port": 46501, + "memory": 128 } diff --git a/main.go b/main.go index 885165c..a488778 100644 --- a/main.go +++ b/main.go @@ -134,6 +134,10 @@ func main() { } err = container.Destroy() + if err != nil && err.Error() == "no container found" { + // We don't care if the container didn't exist anyway + err = nil + } if err != nil { return c.JSONPretty(http.StatusInternalServerError, Message{Message: err.Error()}, JSONIndent) } @@ -143,12 +147,7 @@ func main() { return c.JSONPretty(http.StatusInternalServerError, Message{Message: err.Error()}, JSONIndent) } - err = container.Start() - if err != nil { - return c.JSONPretty(http.StatusInternalServerError, Message{Message: err.Error()}, JSONIndent) - } - - return c.JSON(http.StatusOK, map[string]string{}) + return c.JSON(http.StatusOK, Message{Message: "ok"}) }) // Stop existing app diff --git a/ui/index.html b/ui/index.html index 4b24ccc..10ea451 100644 --- a/ui/index.html +++ b/ui/index.html @@ -18,7 +18,7 @@ -
+

Node

@@ -37,6 +37,7 @@ Name Status + Image CPU Memory Disk space @@ -46,14 +47,15 @@ - - test_1234 - running - 34 % - 50/128 MB - 5 GB - 12 598 - user:cx + + {( app.name )} + {( app.state.state )} + {( app.image )} + - / {( app.cpu )} % + - / {( app.memory )} MB + - GB + - + - @@ -72,6 +74,19 @@ +