Improving quickview

This commit is contained in:
Axel 2021-12-19 14:46:08 +01:00
parent d34a4ff21f
commit ea673e0083
4 changed files with 71 additions and 58 deletions

View file

@ -41,7 +41,7 @@ class DB {
public function get_all_tasks($status = null) { public function get_all_tasks($status = null) {
if (is_null($status)) { if (is_null($status)) {
$query = ' $query = '
SELECT DISTINCT t.id, t.host, t.type, t.params, t.frequency, t.creation_date, t.last_execution, t.active, t.group_id, h.status, g.name as group_name SELECT DISTINCT t.id, t.host, t.type, t.params, t.frequency, t.creation_date, t.last_execution, t.active, t.group_id, h.status, h.output, g.name as group_name
FROM `tasks` as t FROM `tasks` as t
LEFT JOIN `tasks_history` as h ON (h.task_id = t.id) LEFT JOIN `tasks_history` as h ON (h.task_id = t.id)
LEFT JOIN `groups` as g ON (g.id = t.group_id) LEFT JOIN `groups` as g ON (g.id = t.group_id)

View file

@ -92,24 +92,25 @@ td {
.new-group { .new-group {
margin: .2rem; margin: .1rem;
display: inline-block; display: inline-block;
border: 1px solid rgba(7, 7, 7, 0.432); border-radius: .4rem;
padding: 1px; overflow: hidden;
cursor: pointer;
} }
.quick-view .square { .quick-view .square {
width: 1rem; height: 100%;
min-width: 1rem; margin: 0;
max-width: 1rem;
height: 1rem;
min-height: 1rem;
max-height: 1rem;
margin: 0.1rem;
text-align: center; text-align: center;
vertical-align: middle; vertical-align: middle;
float: left; float: left;
line-height: 1.2rem;
min-width: 1.4rem;
}
.quick-view .square:not(:first-of-type) {
border-left: 1px solid white;
} }
.spacer { .spacer {
@ -132,7 +133,6 @@ td {
} }
.highlight { .highlight {
background-color: #000; background-color: #000;
padding: 0px 1rem; padding: 0px 1rem;

BIN
web/img/info.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 448 B

View file

@ -7,7 +7,7 @@
<title>MonitoLite - Network monitoring tool</title> <title>MonitoLite - Network monitoring tool</title>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script> <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script type="text/javascript" src="js/scripts.js"></script> <script type="text/javascript" type="module" src="js/scripts.js"></script>
<link type="text/css" rel="stylesheet" href="css/styles.css" /> <link type="text/css" rel="stylesheet" href="css/styles.css" />
</head> </head>
@ -21,22 +21,23 @@
v-for="group in tasks" v-for="group in tasks"
v-bind:key="group.id" v-bind:key="group.id"
class="new-group" class="new-group"
:title="group.name" :title="'Group: '+group.name"
> >
<a <p
v-for="task in group.tasks" v-for="task in group.tasks"
v-bind:key="task.id" v-bind:key="task.id"
:href="'#task-'+task.id" :href="'#task-'+task.id"
:class="statusText(task.status)"
class="square"
> >
<p :class="statusText(task.status)" class="square"> &nbsp;
<!--<img :src="'/img/'+statusText(task.status)+'.png'" width="16" alt="">-->
</p> </p>
</a>
</div> </div>
<p class="spacer">&nbsp;</p> <p class="spacer">&nbsp;</p>
</div> </div>
<div class="tasks">
<div <div
v-for="group in tasks" v-for="group in tasks"
v-bind:key="group.group_id" v-bind:key="group.group_id"
@ -69,7 +70,18 @@
<td> <td>
<img :src="task.type == 'http' ? 'img/http.png' : 'img/ping.png'" width="16" alt="Type of check" :title="'Type: '+task.type" /> <img :src="task.type == 'http' ? 'img/http.png' : 'img/ping.png'" width="16" alt="Type of check" :title="'Type: '+task.type" />
</td> </td>
<td>{{ task.last_execution ?? 'never' }}</td> <td>
<span
v-if="task.last_execution"
>
{{ task.last_execution }}
<img src="img/info.png" alt="Infos" width="16" :title="'Result: '+task.output" />
</span>
<span
v-else
>
Never
</span>
<td>{{ task.frequency }}</td> <td>{{ task.frequency }}</td>
<td>{{ task.active == 1 ? 'Yes' : 'No' }}</td> <td>{{ task.active == 1 ? 'Yes' : 'No' }}</td>
</tr> </tr>
@ -77,6 +89,7 @@
</table> </table>
</div> </div>
</div> </div>
</div>
<script> <script>
var vm = new Vue({ var vm = new Vue({