Skip to content
Snippets Groups Projects
Commit 09852ebe authored by Nico Vermaas's avatar Nico Vermaas
Browse files

add config screen

parent 1c5bd8a3
No related branches found
No related tags found
3 merge requests!73Master,!54Master,!51add config screen
...@@ -28,10 +28,7 @@ ...@@ -28,10 +28,7 @@
{% block extra_js %}{% endblock %} {% block extra_js %}{% endblock %}
</head> </head>
<!--
<body onload="readFromLocalStorage('search_box')"> <body onload="readFromLocalStorage('search_box')">
-->
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light"> <nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid"> <div class="container-fluid">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
...@@ -43,9 +40,12 @@ ...@@ -43,9 +40,12 @@
<li><a class="nav-link" href="{% url 'homepage' %}">Tasks</a></li> <li><a class="nav-link" href="{% url 'homepage' %}">Tasks</a></li>
<li><a class="nav-link" href="{% url 'task-details'%}">Details</a></li> <li><a class="nav-link" href="{% url 'task-details'%}">Details</a></li>
<li><a class="nav-link" href="{% url 'tables2' %}">Query</a></li> <li><a class="nav-link" href="{% url 'tables2' %}">Query</a></li>
<li><a class="nav-link" href="{% url 'diagram' %}">State Diagram</a></li> {% if user.is_superuser %}
<li><a class="nav-link" href="{% url 'config' %}">Configuration</a></li>
{% endif %}
<li><a class="nav-link" href="{% url 'diagram' %}">Diagram</a></li>
{% if user.is_staff %} {% if user.is_staff %}
<li><a class="nav-link" href="{% url 'admin:index' %}" target="_blank">Admin Page</a></li> <li><a class="nav-link" href="{% url 'admin:index' %}" target="_blank">Admin</a></li>
{% endif %} {% endif %}
</ul> </ul>
...@@ -78,4 +78,7 @@ ...@@ -78,4 +78,7 @@
{% endblock %} {% endblock %}
</body> </body>
</html> {% include "taskdatabase/modal/modal_script.html" %}
\ No newline at end of file {% include "taskdatabase/modal/modal.html" %}
</html>
{% extends 'taskdatabase/base.html' %}
{% load static %}
{% block myBlock %}
<div class="container">
<div class="card">
<div class="card-body">
<h3>Configuration </h3>
<table class="table table-striped">
<tbody>
{{ results | safe }}
</tbody>
</table>
</div>
</div>
<a href="/atdb/admin/taskdatabase/configuration/" class="btn btn-warning btn-sm" target="_blank" role="button"><i class="fas fa-cog"></i> Edit Configuration</a>&nbsp;
</div>
{% endblock %}
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
<div class="embed-responsive embed-responsive-21by9"> <div class="embed-responsive embed-responsive-21by9">
<iframe class="embed-responsive-item" src="{% static 'taskdatabase/ATDB-LDV Workflow Diagram.png' %}" allowfullscreen></iframe> <iframe class="embed-responsive-item" src="{% static 'taskdatabase/ATDB-LDV Workflow Diagram.png' %}" allowfullscreen></iframe>
</div> </div>
<p class="footer"> Version 1.0.0 (2 mar 2021 - 17:00)
{% endblock %} {% endblock %}
...@@ -45,45 +45,11 @@ ...@@ -45,45 +45,11 @@
{% include 'taskdatabase/pagination.html' %} {% include 'taskdatabase/pagination.html' %}
</div> </div>
</div> </div>
<p class="footer"> Version 1.0.0 (8 mar 2021 - 12:00) <p class="footer"> Version 1.0.0 (8 mar 2021 - 15:00)
</div> </div>
{% include 'taskdatabase/localstorage_scripts.html' %}
<script type="text/javascript">
(function(seconds) {
var refresh,
intvrefresh = function() {
clearInterval(refresh);
refresh = setTimeout(function() {
//location.href = location.href;
location.reload();
}, seconds * 1000);
};
$(document).on('keypress click', function() { intvrefresh() });
intvrefresh();
}(30));
</script>
<script type="text/javascript">
function readFromLocalStorage(id) {
var s = localStorage.getItem(id);
if (s !== null) {
document.getElementById(id).value = s;
}
}
</script>
<script type="text/javascript">
function writeToLocalStorage(id) {
var s = document.getElementById(id).value
localStorage.setItem(id, s);
}
</script>
{% endblock %} {% endblock %}
......
<script type="text/javascript">
(function(seconds) {
var refresh,
intvrefresh = function() {
clearInterval(refresh);
refresh = setTimeout(function() {
//location.href = location.href;
location.reload();
}, seconds * 1000);
};
$(document).on('keypress click', function() { intvrefresh() });
intvrefresh();
}(30));
</script>
<script type="text/javascript">
function readFromLocalStorage(id) {
var s = localStorage.getItem(id);
if (s !== null) {
document.getElementById(id).value = s;
}
}
</script>
<script type="text/javascript">
function writeToLocalStorage(id) {
var s = document.getElementById(id).value
localStorage.setItem(id, s);
}
</script>
\ No newline at end of file
...@@ -15,7 +15,7 @@ urlpatterns = [ ...@@ -15,7 +15,7 @@ urlpatterns = [
path('<page>', views.IndexView.as_view(), name='homepage_page'), path('<page>', views.IndexView.as_view(), name='homepage_page'),
path('task_details/<int:id>/<page>', views.TaskDetails, name='task-details'), path('task_details/<int:id>/<page>', views.TaskDetails, name='task-details'),
path('task_details', views.TaskDetails, name='task-details'), path('task_details/', views.TaskDetails, name='task-details'),
path('show-inputs/<int:id>/', views.ShowInputs, name='show-inputs'), path('show-inputs/<int:id>/', views.ShowInputs, name='show-inputs'),
path('show-outputs/<int:id>/', views.ShowOutputs, name='show-outputs'), path('show-outputs/<int:id>/', views.ShowOutputs, name='show-outputs'),
...@@ -29,6 +29,7 @@ urlpatterns = [ ...@@ -29,6 +29,7 @@ urlpatterns = [
path('tables2basic/', views.TaskTables2View.as_view(), name='tasktables2'), path('tables2basic/', views.TaskTables2View.as_view(), name='tasktables2'),
path('tables2/', views.FilteredTaskListView.as_view(), name='tables2'), path('tables2/', views.FilteredTaskListView.as_view(), name='tables2'),
path('config/', views.ShowConfig, name='config'),
path('diagram/', views.DiagramView.as_view(), name='diagram'), path('diagram/', views.DiagramView.as_view(), name='diagram'),
# --- REST API --- # --- REST API ---
......
...@@ -48,7 +48,7 @@ class TaskFilter(filters.FilterSet): ...@@ -48,7 +48,7 @@ class TaskFilter(filters.FilterSet):
'sas_id': ['exact', 'icontains'], 'sas_id': ['exact', 'icontains'],
'status': ['exact', 'icontains', 'in', 'startswith'], 'status': ['exact', 'icontains', 'in', 'startswith'],
'purge_policy': ['exact'], 'purge_policy': ['exact'],
'priority': ['exact'], 'priority': ['exact','lte','gte'],
} }
class TaskFilterGUI(filters.FilterSet): class TaskFilterGUI(filters.FilterSet):
...@@ -289,6 +289,34 @@ def ShowMetrics(request, id): ...@@ -289,6 +289,34 @@ def ShowMetrics(request, id):
return render(request, "taskdatabase/details/metrics.html", {'results': results}) return render(request, "taskdatabase/details/metrics.html", {'results': results})
def convert_config_to_html(querylist):
results = ""
try:
for record in querylist:
# iterate through the dict of key/values
key = record.key
value = record.value
try:
if "://" in value:
link = "<a href=" + '"' + value + '">' + key +"</a>"
value = link
except:
pass
line = "<tr><td><b>" + str(key) + "</b></td><td>" + str(value) + "</td></tr>"
results = results + line
except:
results = "<tr><td>no data</td></tr>"
return results
def ShowConfig(request):
configuration = Configuration.objects.all()
results = convert_config_to_html(configuration)
return render(request, "taskdatabase/config.html", {'results': results})
def WorkflowDetails(request, id): def WorkflowDetails(request, id):
workflow = Workflow.objects.get(id=id) workflow = Workflow.objects.get(id=id)
return render(request, "taskdatabase/details/workflow_details.html", {'workflow': workflow}) return render(request, "taskdatabase/details/workflow_details.html", {'workflow': workflow})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment