Skip to content

Commit

Permalink
fix result status and log
Browse files Browse the repository at this point in the history
  • Loading branch information
Davide Arcuri committed Feb 7, 2024
1 parent 0610eab commit f59a430
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion orochi/templates/website/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -640,8 +640,8 @@ <h4>${data.name}</h4>

// EXPORT FORM
$(document).on("click", ".misp_export", function () {
var btn = $(this);
bootbox.confirm("Are you sure??", function (result) {
var btn = $(this);
$.ajax({
url: "{% url 'website:export'%}",
type: 'get',
Expand Down
9 changes: 7 additions & 2 deletions orochi/website/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from orochi.website.models import (
RESULT_STATUS_DISABLED,
RESULT_STATUS_NOT_STARTED,
RESULT_STATUS_RUNNING,
Bookmark,
)
Expand All @@ -27,7 +28,7 @@ def process_template_response(self, request, response):
):
news = []

colors = {1: "green", 2: "green", 3: "orange", 4: "red"}
colors = {2: "green", 3: "green", 4: "yellow", 5: "red"}

dumps = get_objects_for_user(request.user, "website.can_see")
for dump in dumps:
Expand All @@ -38,7 +39,11 @@ def process_template_response(self, request, response):
f"Status: <b style='color:{colors[result.result]}'>{result.get_result_display()}</b>",
}
for result in dump.result_set.exclude(
result__in=[RESULT_STATUS_RUNNING, RESULT_STATUS_DISABLED]
result__in=[
RESULT_STATUS_NOT_STARTED,
RESULT_STATUS_RUNNING,
RESULT_STATUS_DISABLED,
]
).select_related("plugin")
)
news = sorted(news, key=itemgetter("date"), reverse=True)
Expand Down

0 comments on commit f59a430

Please sign in to comment.