Skip to content

Commit

Permalink
Merge branch 'master' of github.com:TACC/tacc_stats
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenlienharrell committed Jul 27, 2023
2 parents 2d034c2 + 5544e5f commit b6da9f3
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
22 changes: 16 additions & 6 deletions tacc_stats/site/machine/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from django.db.models.functions import Cast
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django import forms
from django.shortcuts import get_object_or_404
from django.contrib import messages

import os,sys,pwd

Expand Down Expand Up @@ -67,14 +69,22 @@ def search(request):
job_objects = job_data.objects
job = job_objects.get(jid = request.GET['jid'])
return HttpResponseRedirect("/machine/job/"+str(job.jid)+"/")
except: pass
except:
messages.error(request, "No result found in search")
pass
elif 'host' in request.GET and request.GET["host"]:
print("try to get host")
return host_detail(request)
try:
print("try to get host")
return host_detail(request)
except:
messages.error(request, "No result found in search")
pass
else:
#try:
return index(request)
#except: pass
try:
return index(request)
except:
messages.error(request, "No result found in search")
pass

return home(request, error = True)

Expand Down
5 changes: 5 additions & 0 deletions tacc_stats/site/tacc_stats_site/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
import tacc_stats.site.tacc_stats_site as tacc_stats_site
DIR = os.path.dirname(os.path.abspath(__file__))

from django.contrib.messages import constants as messages
MESSAGE_TAGS = {
messages.ERROR: 'danger',
}

DEBUG = True

ADMINS = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@
</style>
</head>

{% if messages %}
<div class="messages">
{% for message in messages %}
<div class="alert {% if message.tags %}alert-{{ message.tags }}"{% endif %}>
{{ message }}
</div>
{% endfor %}
</div>
{% endif %}

<body>
<div class ="container-fluid">
<nav class="navbar navbar-default" role="navigation">
Expand Down

0 comments on commit b6da9f3

Please sign in to comment.