fix event source conn
This commit is contained in:
@@ -4,20 +4,6 @@
|
||||
|
||||
{% block title %} Deployment details: {{ deployment.name }} {% endblock %}
|
||||
|
||||
{% block bodyattr %}
|
||||
{% if deployment.status == "RUNNING" or deployment.status == "PENDING" %}
|
||||
onload="start('{{ url|safe }}');"
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block headscript %}
|
||||
{% if deployment.status == "RUNNING" or deployment.status == "PENDING" %}
|
||||
<script src="{% static 'django_eventstream/json2.js' %}"></script>
|
||||
<script src="{% static 'django_eventstream/eventsource.min.js' %}"></script>
|
||||
<script src="{% static 'django_eventstream/reconnecting-eventsource.js' %}"></script>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container-fluid">
|
||||
<div class="row justify-content-md-center">
|
||||
@@ -71,7 +57,7 @@
|
||||
{% csrf_token %}
|
||||
</form>
|
||||
{% endif %}
|
||||
<button type="button" onclick="goBack()" class="btn btn-secondary">Back</button>
|
||||
<button id="btn-back" durl="{% url 'deployments' %}" type="button" class="btn btn-secondary">Back</button>
|
||||
{% if deployment.status != "RUNNING" and deployment.status != "PENDING" %}
|
||||
<button form="delete-deployment" type="submit" class="btn btn-danger">Delete</button>
|
||||
{% else %}
|
||||
@@ -87,12 +73,23 @@
|
||||
|
||||
{% block script %}
|
||||
{% if deployment.status == "RUNNING" or deployment.status == "PENDING" %}
|
||||
<script src="{% static 'deployment/js/event_source_details.js' %}" />
|
||||
</script>
|
||||
<script src="{% static 'django_eventstream/json2.js' %}"></script>
|
||||
<script src="{% static 'django_eventstream/eventsource.min.js' %}"></script>
|
||||
<script src="{% static 'django_eventstream/reconnecting-eventsource.js' %}"></script>
|
||||
<script src="{% static 'deployment/js/event_source_details.js' %}" /></script>
|
||||
<script>start('{{ url|safe }}');</script>
|
||||
{% endif %}
|
||||
<script>
|
||||
function goBack() {
|
||||
window.location={% url 'deployments' %};
|
||||
}
|
||||
document.querySelector("#btn-back").addEventListener("click", function(e) {
|
||||
const durl = e.currentTarget.getAttribute("durl");
|
||||
console.log("deployment url:", durl);
|
||||
|
||||
if (window.es) {
|
||||
window.es.close()
|
||||
console.log("closing sse....");
|
||||
};
|
||||
|
||||
window.location = durl;
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user