diff --git a/.gitignore b/.gitignore
index 7847a62..ff65788 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,6 @@
__pycache__
db.sqlite3
venv
-static
+/static
*.log
*.pid
\ No newline at end of file
diff --git a/deployment/static/deployment/js/event_source.js b/deployment/static/deployment/js/event_source.js
new file mode 100644
index 0000000..09cd1ce
--- /dev/null
+++ b/deployment/static/deployment/js/event_source.js
@@ -0,0 +1,39 @@
+var start = function (url) {
+
+ var es = new ReconnectingEventSource(url);
+
+ es.onopen = function () {
+ console.log('connected');
+ };
+
+ es.addEventListener('stream-error', function (e) {
+ es.close();
+ message = JSON.parse(e.data);
+ console.log('stream error: ' + message.condition + ': ' + message.text);
+ }, false);
+
+ es.onerror = function (e) {
+ console.log('connection error');
+ };
+
+ // listening on `message` events and update the corresponding table line.
+ // If the status is `FAILED`, we reload the window to ensure a new csrf_token.
+ es.addEventListener('message', function (e) {
+ message = JSON.parse(e.data);
+ console.log("id: " + message.id);
+ console.log("status: " + message.status);
+
+ const tr = document.getElementById(message.id);
+ if (tr) {
+ var th = tr.querySelector("th[name='status']");
+ th.innerHTML = message.status;
+
+ if (message.status == "FAILED") {
+ setTimeout(() => {
+ window.location.reload();
+ }, 2000);
+ }
+ }
+
+ }, false);
+};
\ No newline at end of file
diff --git a/templates/base.html b/templates/base.html
index 98c11fb..79f6e95 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -1,23 +1,26 @@
+
{% block title %}mumui{% endblock %}
{% block headscript %}{% endblock %}
+
{% if user.is_authenticated or "login" in request.path %}
- {% block content %}
- {% endblock %}
- {% if user.is_authenticated %}
- log out
- {% endif %}
+ {% block content %}
+ {% endblock %}
+ {% if user.is_authenticated %}
+ log out
+ {% endif %}
{% else %}
- You are not logged in
- log In
+ You are not logged in
+ log In
{% endif %}
{% block script %}{% endblock %}
+
\ No newline at end of file
diff --git a/templates/deployment/board.html b/templates/deployment/board.html
index 1aded6f..0eb1059 100644
--- a/templates/deployment/board.html
+++ b/templates/deployment/board.html
@@ -2,16 +2,16 @@
{% load static %}
-{% block title %}deployment's board{% endblock %}
+{% block title %} deployment's board {% endblock %}
{% block headscript %}
-
-
-
+
+
+
{% endblock %}
{% block bodyattr %}
- onload="start();"
+ onload="start('{{ url|safe }}');"
{% endblock %}
{% block content %}
@@ -48,19 +48,19 @@
{% else %}
@@ -72,45 +72,6 @@
{% endblock %}
{% block script %}
-
{% endblock %}
\ No newline at end of file
diff --git a/templates/deployment/create.html b/templates/deployment/create.html
index c781bd2..e8b9ff0 100644
--- a/templates/deployment/create.html
+++ b/templates/deployment/create.html
@@ -1,6 +1,6 @@
{% extends 'base.html' %}
-{% block title %}new deployment{% endblock %}
+{% block title %} new deployment {% endblock %}
{% block content %}
{{ user.username }}'s new deployment
diff --git a/templates/deployment/details.html b/templates/deployment/details.html
index d5e1e8f..5d32916 100644
--- a/templates/deployment/details.html
+++ b/templates/deployment/details.html
@@ -1,24 +1,24 @@
{% extends 'base.html' %}
-{% block title %}deployment details: {{ deployment.name }}{% endblock %}
+{% block title %} deployment details: {{ deployment.name }} {% endblock %}
{% block content %}
- | id |
- name |
- type |
- status |
+ id |
+ name |
+ type |
+ status |
- | {{ deployment.id }} |
- {{ deployment.name }} |
- {{ deployment.type }} |
- {{ deployment.status }} |
+ {{ deployment.id }} |
+ {{ deployment.name }} |
+ {{ deployment.type }} |
+ {{ deployment.status }} |
+
{% endblock %}
\ No newline at end of file
diff --git a/templates/registration/login.html b/templates/registration/login.html
index 31a1048..9d46def 100644
--- a/templates/registration/login.html
+++ b/templates/registration/login.html
@@ -1,16 +1,16 @@
{% extends 'base.html' %}
-{% block title %}login{% endblock %}
+{% block title %} login {% endblock %}
{% block content %}
{% if not user.is_authenticated %}
log in
{% else %}
- you're already log in !
+ you're already log in !
{% endif %}
{% endblock %}
\ No newline at end of file