Skip to content

Commit

Permalink
New Feature add Filters in webui (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
albingi authored and Nyholm committed Aug 8, 2018
1 parent 037b945 commit 0d26785
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
26 changes: 26 additions & 0 deletions Resources/public/js/webui.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,29 @@ function toggleElement(id) {
}
}

/**
* Show all empty messages
*/
function showOnlyEmptyMessages(el) {
var elements = document.getElementsByClassName('message');
for (var i = 0; i < elements.length; ++i) {
var element = elements[i];
element.classList.add("d-none");
}
elements = document.getElementsByClassName('empty');
for (var i = 0; i < elements.length; ++i) {
var element = elements[i];
element.classList.remove("d-none");
}
}

/**
* Show all messages
*/
function showAllMessages(el) {
var elements = document.getElementsByClassName('message');
for (var i = 0; i < elements.length; ++i) {
var element = elements[i];
element.classList.remove("d-none");
}
}
9 changes: 8 additions & 1 deletion Resources/views/WebUI/show.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
{{ domain }}
</a>
{% endfor %}
<h5 class="mt-2">Filter: <a class="show-only-empty" href="javascript:void(0);" onclick="showOnlyEmptyMessages(this)">
Only empty
</a> |
<a class="show-all" href="javascript:void(0);" onclick="showAllMessages(this)">
All
</a>
</h5>
</div>
<hr>
<div class="container message-list">
Expand Down Expand Up @@ -64,7 +71,7 @@
{% endblock %}

{% macro printMessage(idx, message, allow_delete, base_path) %}
<div class="row" id="{{ message.key }}">
<div class="row message {{ message.message ? '' : 'empty' }}" id="{{ message.key }}">
<div class="col-12">
<hr>
</div>
Expand Down

0 comments on commit 0d26785

Please sign in to comment.