Improve UI usability

modern-tables
Mark Veidemanis 2 years ago
parent 6b820f96a3
commit cd82740662
Signed by: m
GPG Key ID: 5ACFCEED46C0904F

@ -96,6 +96,7 @@ class ThresholdInfoModal(LoginRequiredMixin, APIView):
else: else:
inter_chans = [] inter_chans = []
context = { context = {
"net": net,
"nick": nick, "nick": nick,
"channel": channel, "channel": channel,
"chans": channels, "chans": channels,

@ -21,6 +21,8 @@ new Chart(ctx, {
], ],
}, },
options: { options: {
responsive: true,
maintainAspectRatio: false,
parsing: { parsing: {
xAxisKey: 'date', xAxisKey: 'date',
yAxisKey: 'value', yAxisKey: 'value',

@ -60,7 +60,7 @@
</div> </div>
<div id="tab-content"> <div id="tab-content">
<div class="is-active" data-content="1"> <div class="is-active" data-content="1">
<h4 class="subtitle is-4">Channels {{ nick }} is on</h4> <h4 class="subtitle is-4">Channels for {{ nick }} on {{ net }}</h4>
{% for channel in chans %} {% for channel in chans %}
<a class="panel-block"> <a class="panel-block">
<span class="panel-icon"> <span class="panel-icon">
@ -71,7 +71,7 @@
{% endfor %} {% endfor %}
</div> </div>
<div data-content="2"> <div data-content="2">
<h4 class="subtitle is-4">Users on {{ channel }}</h4> <h4 class="subtitle is-4">Users on {{ channel }} for {{ net }}</h4>
{% for user in users %} {% for user in users %}
<a class="panel-block"> <a class="panel-block">
<span class="panel-icon"> <span class="panel-icon">
@ -82,7 +82,7 @@
{% endfor %} {% endfor %}
</div> </div>
<div data-content="3"> <div data-content="3">
<h4 class="subtitle is-4">Users sharing channels with {{ nick }}</h4> <h4 class="subtitle is-4">Users sharing channels with {{ nick }} on {{ net }}</h4>
{% for user in inter_users %} {% for user in inter_users %}
<a class="panel-block"> <a class="panel-block">
<span class="panel-icon"> <span class="panel-icon">
@ -93,7 +93,7 @@
{% endfor %} {% endfor %}
</div> </div>
<div data-content="4"> <div data-content="4">
<h4 class="subtitle is-4">Channels sharing users with {{ channel }}</h4> <h4 class="subtitle is-4">Channels sharing users with {{ channel }} on {{ net }}</h4>
{% for channel in inter_chans %} {% for channel in inter_chans %}
<a class="panel-block"> <a class="panel-block">
<span class="panel-icon"> <span class="panel-icon">

@ -3,6 +3,7 @@
{% block content %} {% block content %}
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script> <script>
// tabbed browsing for the modal
function initTabs() { function initTabs() {
TABS.forEach((tab) => { TABS.forEach((tab) => {
tab.addEventListener('click', (e) => { tab.addEventListener('click', (e) => {

@ -5,20 +5,18 @@
<div style="display: none" id="jsonData" data-json="{{ data }}"> <div style="display: none" id="jsonData" data-json="{{ data }}">
</div> </div>
<div class="box"> <div class="box">
<canvas id="volume"></canvas> <div style="height: 30rem">
<canvas id="volume"></canvas>
</div>
<script src="{% static 'chart.js' %}"></script> <script src="{% static 'chart.js' %}"></script>
</div> </div>
<div class="box"> <div class="box">
<span class="tag is-success">Online</span>
<span class="tag is-danger">Offline</span>
<span class="tag is-warning">Unknown</span>
IRC: <i class="fa-solid fa-hashtag" aria-hidden="true"></i>
Discord: <i class="fa-brands fa-discord" aria-hidden="true"></i>
<div class="table-container"> <div class="table-container">
<table class="table is-striped is-hoverable is-fullwidth"> <table class="table is-striped is-hoverable is-fullwidth">
<thead> <thead>
<tr> <tr>
<th>src</th> <th>src</th>
<th>type</th>
<th>ts</th> <th>ts</th>
<th>msg</th> <th>msg</th>
<th>host</th> <th>host</th>
@ -28,15 +26,51 @@
<th>net</th> <th>net</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for item in results %} {% for item in results %}
<tr> <tr>
<td> <td>
{% if item.src == 'irc' %} {% if item.src == 'irc' %}
<i class="fa-solid fa-hashtag" aria-hidden="true"></i> <span class="icon" data-tooltip="IRC">
<i class="fa-solid fa-hashtag" aria-hidden="true"></i>
</span>
{% elif item.src == 'dis' %} {% elif item.src == 'dis' %}
<i class="fa-brands fa-discord" aria-hidden="true"></i> <span class="icon" data-tooltip="Discord">
<i class="fa-brands fa-discord" aria-hidden="true"></i>
</span>
{% endif %}
</td>
<td>
{% if item.type == 'msg' %}
<span class="icon" data-tooltip="Message">
<i class="fa-solid fa-message"></i>
</span>
{% elif item.type == 'join' %}
<span class="icon" data-tooltip="Join">
<i class="fa-solid fa-person-to-portal"></i>
</span>
{% elif item.type == 'part' %}
<span class="icon" data-tooltip="Part">
<i class="fa-solid fa-person-from-portal"></i>
</span>
{% elif item.type == 'quit' %}
<span class="icon" data-tooltip="Quit">
<i class="fa-solid fa-circle-xmark"></i>
</span>
{% elif item.type == 'kick' %}
<span class="icon" data-tooltip="Kick">
<i class="fa-solid fa-user-slash"></i>
</span>
{% elif item.type == 'nick' %}
<span class="icon" data-tooltip="Nick">
<i class="fa-solid fa-signature"></i>
</span>
{% elif item.type == 'mode' %}
<span class="icon" data-tooltip="Mode">
<i class="fa-solid fa-gear"></i>
</span>
{% else %}
{{ item.type }}
{% endif %} {% endif %}
</td> </td>
<td> <td>
@ -47,11 +81,20 @@
<td>{{ item.host }}</td> <td>{{ item.host }}</td>
<td> <td>
{% if item.online is True %} {% if item.online is True %}
<span class="tag is-success">{{ item.nick }}</span> <span class="icon has-text-success has-tooltip-success" data-tooltip="Online">
<i class="fa-solid fa-circle"></i>
</span>
{{ item.nick }}
{% elif item.online is False %} {% elif item.online is False %}
<span class="tag is-danger">{{ item.nick }}</span> <span class="icon has-text-danger has-tooltip-danger" data-tooltip="Offline">
<i class="fa-solid fa-circle"></i>
</span>
{{ item.nick }}
{% else %} {% else %}
<span class="tag is-warning">{{ item.nick }}</span> <span class="icon has-text-warning has-tooltip-warning" data-tooltip="Unknown">
<i class="fa-solid fa-circle"></i>
</span>
{{ item.nick }}
{% endif %} {% endif %}
</td> </td>
<td> <td>
@ -62,9 +105,8 @@
hx-vals='{"net": "{{ item.net }}", "nick": "{{ item.nick }}", "channel": "{{ item.channel }}"}' hx-vals='{"net": "{{ item.net }}", "nick": "{{ item.nick }}", "channel": "{{ item.channel }}"}'
hx-target="#modals-here" hx-target="#modals-here"
hx-trigger="click" hx-trigger="click"
class="btn btn-primary" class="btn btn-primary">
_="on htmx:afterOnLoad wait 10ms then add .show to #modal then add .show to #modal-backdrop"> Information
Information
</button> </button>
<div id="modals-here"></div> <div id="modals-here"></div>
{% endif %} {% endif %}

Loading…
Cancel
Save