Skip to content

Commit

Permalink
Merge pull request #29 from jtdub/task-refresh
Browse files Browse the repository at this point in the history
add page refresh to task details page
  • Loading branch information
jtdub authored Jul 11, 2022
2 parents badaaa9 + c1a52c2 commit b8b5694
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
23 changes: 22 additions & 1 deletion netopsio/home/templates/home/task_details.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
{% extends "base.html" %}
{% block content %}
<meta id="job_status" data-name="{{ job.status }}">

<script type="text/javascript">
let jobStatus = $('#job_status').data();

if (jobStatus.name != "SUCCESS") {
function autoRefreshPage() {
window.location = window.location.href;
}
setInterval('autoRefreshPage()', 2000);
}
</script>
<div class="container">
<div class="mb-3">
<label for="statusArea" class="form-label"><h3>Status</h3></label>
<input type="input" class="form-control" id="statusArea" placeholder="{{ job.status }}">
</div>
<div class="mb-3">
<label for="resultTextArea" class="form-label"><h3>{{ title }}</h3></label>
<textarea class="form-control" id="resultTextArea" rows="10">{{ result }}</textarea>
{%if job.status != "SUCCESS" %}
<div class="spinner-border spinner-grow text-secondary" role="status">
<span class="sr-only"></span>
</div>
<textarea class="form-control" id="resultTextArea" rows="10"></textarea>
{% else %}
<textarea class="form-control" id="resultTextArea" rows="10">
{{ result }}
</textarea>
{% endif %}
</div>
</div>
{% endblock %}
1 change: 1 addition & 0 deletions netopsio/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">NetOps.io</a>
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "netops.io"
version = "0.3.0"
version = "0.3.1"
description = "netops.io web application and rest framework"
authors = ["James Williams <james.williams@packetgeek.net>"]
license = "Apache"
Expand Down

0 comments on commit b8b5694

Please sign in to comment.