Complete rewrite full VueJS
This commit is contained in:
parent
6074009936
commit
92e6921cf9
17 changed files with 17118 additions and 334 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@ web/vendor/**/*
|
||||||
.env
|
.env
|
||||||
web/sync.php
|
web/sync.php
|
||||||
/**/node_modules
|
/**/node_modules
|
||||||
|
/**/dist
|
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 273 KiB |
222
web/css/app.scss
Normal file
222
web/css/app.scss
Normal file
|
@ -0,0 +1,222 @@
|
||||||
|
@import url('https://fonts.googleapis.com/css2?family=Hind:wght@300;400;500;600;700&display=swap');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SETTINGS
|
||||||
|
**/
|
||||||
|
$bg_color: #0a9f9a;
|
||||||
|
$up_color: #8adf8a;
|
||||||
|
$down_color: #f79292;
|
||||||
|
$unknown_color: rgb(245, 214, 158);
|
||||||
|
|
||||||
|
* {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
font-size: 100%;
|
||||||
|
scroll-behavior: smooth;
|
||||||
|
|
||||||
|
body {
|
||||||
|
padding: 10px;
|
||||||
|
font-family: 'Hind', sans-serif;
|
||||||
|
font-size: 1rem;
|
||||||
|
color: #3D3D3D;
|
||||||
|
background-image: url(../img/bush.png);
|
||||||
|
background-attachment: fixed;
|
||||||
|
|
||||||
|
|
||||||
|
a, a:visited {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: inherit;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 auto;
|
||||||
|
max-width: 1000px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, h2, h3, h4 {
|
||||||
|
margin-top: .8rem;
|
||||||
|
margin-bottom: .8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 2.4rem;
|
||||||
|
text-align: center;
|
||||||
|
margin: 3rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: 1.4rem;
|
||||||
|
margin-top: 0;
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
font-size: 1.4rem;
|
||||||
|
background-color: $bg_color;
|
||||||
|
margin: 0;
|
||||||
|
padding: .8rem;
|
||||||
|
color: rgb(240, 240, 240);
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
small {
|
||||||
|
font-size: .9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.context-menu {
|
||||||
|
position: absolute;
|
||||||
|
right: .7rem;
|
||||||
|
top: .7rem;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
img {
|
||||||
|
vertical-align: sub;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
border: 1px solid #ABC;
|
||||||
|
font-size: 14px;
|
||||||
|
border-spacing : 0;
|
||||||
|
border-collapse : collapse;
|
||||||
|
|
||||||
|
th {
|
||||||
|
background-color: #e6EEEE;
|
||||||
|
border: 1px solid #9ccece;
|
||||||
|
padding: 0.3rem;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
color: #3D3D3D;
|
||||||
|
padding: 0.3rem;
|
||||||
|
background-color: #FFF;
|
||||||
|
vertical-align: top;
|
||||||
|
border: 1px solid #9ccece;
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
&#tasks_tbl, &#contacts_tbl {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.quick-view {
|
||||||
|
-webkit-box-shadow: 3px 3px 6px 0px rgba(0,0,0,0.3);
|
||||||
|
-moz-box-shadow: 3px 3px 6px 0px rgba(0,0,0,0.3);
|
||||||
|
box-shadow: 3px 3px 6px 0px rgba(0,0,0,0.3);
|
||||||
|
border-radius: 5px;
|
||||||
|
position: relative;
|
||||||
|
background-color: white;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.new-group {
|
||||||
|
margin: .1rem;
|
||||||
|
display: inline-block;
|
||||||
|
border-radius: .4rem;
|
||||||
|
overflow: hidden;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
.square {
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: middle;
|
||||||
|
float: left;
|
||||||
|
line-height: 1.2rem;
|
||||||
|
min-width: 1.4rem;
|
||||||
|
|
||||||
|
&:not(:first-of-type) {
|
||||||
|
border-left: 1px solid white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.tasks {
|
||||||
|
.task {
|
||||||
|
margin-top: 2rem;
|
||||||
|
padding: 0;
|
||||||
|
-webkit-box-shadow: 3px 3px 6px 0px rgba(0,0,0,0.3);
|
||||||
|
-moz-box-shadow: 3px 3px 6px 0px rgba(0,0,0,0.3);
|
||||||
|
box-shadow: 3px 3px 6px 0px rgba(0,0,0,0.3);
|
||||||
|
border-radius: 5px;
|
||||||
|
position: relative;
|
||||||
|
background-color: white;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.spacer {
|
||||||
|
clear:both;
|
||||||
|
line-height: 0;
|
||||||
|
padding: 0;
|
||||||
|
margin:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-content {
|
||||||
|
padding: .8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.highlight {
|
||||||
|
background-color: #166260;
|
||||||
|
padding: 0px 1rem;
|
||||||
|
display: inline-block;
|
||||||
|
color: #FFF;
|
||||||
|
font-size: 1rem;
|
||||||
|
vertical-align: middle;
|
||||||
|
border-radius: .5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.up {
|
||||||
|
background-color: $up_color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.down {
|
||||||
|
background-color: $down_color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.unknown {
|
||||||
|
background-color: $unknown_color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@keyframes shake {
|
||||||
|
10%, 90% {
|
||||||
|
transform: translate3d(-1px, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
20%, 80% {
|
||||||
|
transform: translate3d(2px, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
30%, 50%, 70% {
|
||||||
|
transform: translate3d(-4px, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
40%, 60% {
|
||||||
|
transform: translate3d(4px, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,211 +0,0 @@
|
||||||
@import url('https://fonts.googleapis.com/css2?family=Hind:wght@300;400;500;600;700&display=swap');
|
|
||||||
|
|
||||||
* {
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
html {
|
|
||||||
font-size: 100%;
|
|
||||||
scroll-behavior: smooth;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
padding: 10px;
|
|
||||||
font-family: 'Hind', sans-serif;
|
|
||||||
font-size: 1rem;
|
|
||||||
color: #3D3D3D;
|
|
||||||
}
|
|
||||||
|
|
||||||
a, a:visited {
|
|
||||||
color: inherit;
|
|
||||||
text-decoration: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
a:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1, h2, h3, h4 {
|
|
||||||
margin-top: .8rem;
|
|
||||||
margin-bottom: .8rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: 2.4rem;
|
|
||||||
text-align: center;
|
|
||||||
margin: 3rem 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
font-size: 1.4rem;
|
|
||||||
margin-top: 0;
|
|
||||||
padding-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
h3 {
|
|
||||||
font-size: 1.4rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
img {
|
|
||||||
vertical-align: sub;
|
|
||||||
}
|
|
||||||
|
|
||||||
table {
|
|
||||||
border: 1px solid #ABC;
|
|
||||||
font-size: 14px;
|
|
||||||
border-spacing : 0;
|
|
||||||
border-collapse : collapse;
|
|
||||||
}
|
|
||||||
|
|
||||||
th {
|
|
||||||
background-color: #e6EEEE;
|
|
||||||
border: 1px solid #9ccece;
|
|
||||||
padding: 0.3rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
td {
|
|
||||||
color: #3D3D3D;
|
|
||||||
padding: 0.3rem;
|
|
||||||
background-color: #FFF;
|
|
||||||
vertical-align: top;
|
|
||||||
border: 1px solid #9ccece;
|
|
||||||
text-align: center;
|
|
||||||
vertical-align: middle;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#tasks_tbl, #contacts_tbl {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.quick-view {
|
|
||||||
margin: 3rem auto;
|
|
||||||
max-width: 1000px;
|
|
||||||
padding: 1rem;
|
|
||||||
-webkit-box-shadow: 5px 5px 15px 0px rgba(0,0,0,0.3);
|
|
||||||
-moz-box-shadow: 5px 5px 15px 0px rgba(0,0,0,0.3);
|
|
||||||
box-shadow: 5px 5px 15px 0px rgba(0,0,0,0.3);
|
|
||||||
border-radius: 5px;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.new-group {
|
|
||||||
margin: .1rem;
|
|
||||||
display: inline-block;
|
|
||||||
border-radius: .4rem;
|
|
||||||
overflow: hidden;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.quick-view .square {
|
|
||||||
height: 100%;
|
|
||||||
margin: 0;
|
|
||||||
text-align: center;
|
|
||||||
vertical-align: middle;
|
|
||||||
float: left;
|
|
||||||
line-height: 1.2rem;
|
|
||||||
min-width: 1.4rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.quick-view .square:not(:first-of-type) {
|
|
||||||
border-left: 1px solid white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.spacer {
|
|
||||||
clear:both;
|
|
||||||
line-height: 0;
|
|
||||||
padding: 0;
|
|
||||||
margin:0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.task {
|
|
||||||
margin: 3rem auto;
|
|
||||||
max-width: 1000px;
|
|
||||||
padding: 1rem;
|
|
||||||
-webkit-box-shadow: 5px 5px 15px 0px rgba(0,0,0,0.3);
|
|
||||||
-moz-box-shadow: 5px 5px 15px 0px rgba(0,0,0,0.3);
|
|
||||||
box-shadow: 5px 5px 15px 0px rgba(0,0,0,0.3);
|
|
||||||
border-radius: 5px;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.highlight {
|
|
||||||
background-color: #000;
|
|
||||||
padding: 0px 1rem;
|
|
||||||
display: inline-block;
|
|
||||||
color: #FFF;
|
|
||||||
font-size: 1rem;
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.task.show .task-overlay {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.exp-icon {
|
|
||||||
position: absolute;
|
|
||||||
right: 1rem;
|
|
||||||
top: 1rem;
|
|
||||||
width: 20px;
|
|
||||||
min-height: 27px;
|
|
||||||
height: 27px;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
cursor: pointer;
|
|
||||||
animation: shake 0.82s cubic-bezier(.36,.07,.19,.97) both;
|
|
||||||
transform: translate3d(0, 0, 0);
|
|
||||||
backface-visibility: hidden;
|
|
||||||
animation-iteration-count: 3;
|
|
||||||
animation-delay: 3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.task .exp-icon {
|
|
||||||
background-image: url('../img/expand.png');
|
|
||||||
}
|
|
||||||
|
|
||||||
.task.active .exp-icon {
|
|
||||||
background-image: url('../img/collapse.png');
|
|
||||||
}
|
|
||||||
|
|
||||||
.up {
|
|
||||||
background-color: #8adf8a;
|
|
||||||
}
|
|
||||||
|
|
||||||
.down {
|
|
||||||
background-color: #f79292;
|
|
||||||
}
|
|
||||||
|
|
||||||
.unknown {
|
|
||||||
background-color: rgb(245, 214, 158);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.square.unknown img, .square.down img, .square.up img {
|
|
||||||
opacity: .5;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes shake {
|
|
||||||
10%, 90% {
|
|
||||||
transform: translate3d(-1px, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
20%, 80% {
|
|
||||||
transform: translate3d(2px, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
30%, 50%, 70% {
|
|
||||||
transform: translate3d(-4px, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
40%, 60% {
|
|
||||||
transform: translate3d(4px, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
BIN
web/img/bush.png
Normal file
BIN
web/img/bush.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
1
web/img/menu.svg
Normal file
1
web/img/menu.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<?xml version="1.0" ?><svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><g><path d="M0 0h24v24H0z" fill="none"/><path d="M12 3c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 14c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/></g></svg>
|
After Width: | Height: | Size: 290 B |
126
web/index.php
126
web/index.php
|
@ -1,134 +1,14 @@
|
||||||
<?php require_once __DIR__.'/DB.php'; ?>
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
<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 type="text/javascript" type="module" src="dist/app.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
|
<link type="text/css" rel="stylesheet" href="dist/app.css" />
|
||||||
<script type="text/javascript" type="module" src="js/scripts.js"></script>
|
|
||||||
<link type="text/css" rel="stylesheet" href="css/styles.css" />
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="app">
|
<div id="app"></div>
|
||||||
<h1>MonitoLite Dashboard</h1>
|
|
||||||
|
|
||||||
<div class="quick-view">
|
|
||||||
<h3>Quick overview</h3>
|
|
||||||
<div
|
|
||||||
v-for="group in tasks"
|
|
||||||
v-bind:key="group.id"
|
|
||||||
class="new-group"
|
|
||||||
:title="'Group: '+group.name"
|
|
||||||
>
|
|
||||||
<a :href="'#group-'+group.id">
|
|
||||||
<p
|
|
||||||
v-for="task in group.tasks"
|
|
||||||
v-bind:key="task.id"
|
|
||||||
:href="'#task-'+task.id"
|
|
||||||
:class="statusText(task.status)"
|
|
||||||
class="square"
|
|
||||||
>
|
|
||||||
|
|
||||||
</p>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<p class="spacer"> </p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="tasks">
|
|
||||||
<div
|
|
||||||
v-for="group in tasks"
|
|
||||||
v-bind:key="group.id"
|
|
||||||
class="task"
|
|
||||||
>
|
|
||||||
<a :name="'group-'+group.id"></a>
|
|
||||||
<h3>Tasks for group <span class="highlight">{{ group.name }}</span> <small>(#{{ group.id }})</small> </h3>
|
|
||||||
<table id="tasks_tbl">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th width="5%">Up?</th>
|
|
||||||
<th width="*">Host</th>
|
|
||||||
<th width="5%">Type</th>
|
|
||||||
<th width="20%">Last execution</th>
|
|
||||||
<th width="20%">Frequency (min)</th>
|
|
||||||
<th width="5%">Active</th$query>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr
|
|
||||||
v-for="task in group.tasks"
|
|
||||||
v-bind:key="task.id"
|
|
||||||
>
|
|
||||||
<td :class="statusText(task.status)">
|
|
||||||
<img :src="'img/'+statusText(task.status)+'.png'" width="16" alt="Status" />
|
|
||||||
</td>
|
|
||||||
<td :class="statusText(task.status)">
|
|
||||||
<a :href="task.host" target="_blank">{{ task.host }}</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<img :src="task.type == 'http' ? 'img/http.png' : 'img/ping.png'" width="16" alt="Type of check" :title="'Type: '+task.type" />
|
|
||||||
</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.active == 1 ? 'Yes' : 'No' }}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
var vm = new Vue({
|
|
||||||
el: '#app',
|
|
||||||
props: [
|
|
||||||
'refresh'
|
|
||||||
],
|
|
||||||
data: {
|
|
||||||
tasks: []
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
// a computed getter
|
|
||||||
statusText: function (status) {
|
|
||||||
switch (status) {
|
|
||||||
case '1':
|
|
||||||
return 'up';
|
|
||||||
break;
|
|
||||||
case '0':
|
|
||||||
return 'down';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return 'unknown';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getTasks: function() {
|
|
||||||
axios.get('api.php?a=get_tasks')
|
|
||||||
.then(response => this.tasks = response.data)
|
|
||||||
.catch(error => window.alert('Cannot get tasks'))
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted: function() {
|
|
||||||
this.getTasks()
|
|
||||||
this.refresh = window.setInterval(() => {
|
|
||||||
this.getTasks();
|
|
||||||
}, 60000)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
18
web/js/app.js
Normal file
18
web/js/app.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
//window.Vue = require('vue')
|
||||||
|
|
||||||
|
import Vue from 'vue'
|
||||||
|
import App from '../resources/app.vue'
|
||||||
|
|
||||||
|
import axios from 'axios'
|
||||||
|
Vue.prototype.$http = axios
|
||||||
|
|
||||||
|
import moment from 'moment'
|
||||||
|
Vue.prototype.moment = moment
|
||||||
|
|
||||||
|
var runApp = function() {
|
||||||
|
const app = new Vue(App).$mount('#app');
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('load', function () {
|
||||||
|
runApp();
|
||||||
|
})
|
4
web/mix-manifest.json
Normal file
4
web/mix-manifest.json
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"/dist/app.js": "/dist/app.js",
|
||||||
|
"/dist/app.css": "/dist/app.css"
|
||||||
|
}
|
16618
web/package-lock.json
generated
Normal file
16618
web/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
15
web/package.json
Normal file
15
web/package.json
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"devDependencies": {
|
||||||
|
"laravel-mix": "^6.0.39",
|
||||||
|
"resolve-url-loader": "^4.0.0",
|
||||||
|
"sass": "^1.45.0",
|
||||||
|
"sass-loader": "^12.4.0",
|
||||||
|
"vue-loader": "^15.9.8",
|
||||||
|
"vue-template-compiler": "^2.6.14"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^0.24.0",
|
||||||
|
"moment": "^2.29.1",
|
||||||
|
"vue": "^2.6.14"
|
||||||
|
}
|
||||||
|
}
|
57
web/resources/app.vue
Normal file
57
web/resources/app.vue
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
<template>
|
||||||
|
<div class="container">
|
||||||
|
<h1>MonitoLite Dashboard</h1>
|
||||||
|
<p class="refreshed-time">Data refreshed: {{ refreshedTime }}</p>
|
||||||
|
<quick-view :tasks="tasks"></quick-view>
|
||||||
|
<group-list :tasks="tasks"></group-list>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import QuickView from '../resources/quickview.vue'
|
||||||
|
import GroupList from './grouplist.vue'
|
||||||
|
|
||||||
|
export default{
|
||||||
|
components: {
|
||||||
|
QuickView,
|
||||||
|
GroupList
|
||||||
|
},
|
||||||
|
props: [
|
||||||
|
'refresh'
|
||||||
|
],
|
||||||
|
data: {
|
||||||
|
tasks: [],
|
||||||
|
refreshed_time: null
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
refreshedTime: function() {
|
||||||
|
return this.refreshed_time != null ? this.moment(this.refreshed_time).format('H:mm:ss') : 'never'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getTasks: function() {
|
||||||
|
this.$http.get('api.php?a=get_tasks')
|
||||||
|
.then(response => this.tasks = response.data)
|
||||||
|
.then(() => {
|
||||||
|
this.refreshed_time = this.moment();
|
||||||
|
})
|
||||||
|
.catch(error => window.alert('Cannot get tasks'))
|
||||||
|
this.refreshed_time = this.moment();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted: function() {
|
||||||
|
this.getTasks()
|
||||||
|
this.refresh = window.setInterval(() => {
|
||||||
|
this.getTasks();
|
||||||
|
}, 60000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.refreshed-time {
|
||||||
|
text-align: right;
|
||||||
|
font-size: .8rem;
|
||||||
|
}
|
||||||
|
</style>
|
48
web/resources/grouplist.vue
Normal file
48
web/resources/grouplist.vue
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
<template>
|
||||||
|
<div class="tasks">
|
||||||
|
<div
|
||||||
|
v-for="group in tasks"
|
||||||
|
v-bind:key="group.id"
|
||||||
|
class="task"
|
||||||
|
>
|
||||||
|
<a :name="'group-'+group.id"></a>
|
||||||
|
<h3>
|
||||||
|
Tasks for group <span class="highlight">{{ group.name }} <small>(#{{ group.id }})</small></span>
|
||||||
|
<p class="context-menu"><img src="img/menu.svg" width="40" /></p>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="block-content">
|
||||||
|
<task-list :tasks="group.tasks"></task-list>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import TaskList from './tasklist.vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
TaskList
|
||||||
|
},
|
||||||
|
props: [
|
||||||
|
'tasks'
|
||||||
|
],
|
||||||
|
methods: {
|
||||||
|
statusText: function (status) {
|
||||||
|
switch (status) {
|
||||||
|
case '1':
|
||||||
|
return 'up';
|
||||||
|
break;
|
||||||
|
case '0':
|
||||||
|
return 'down';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return 'unknown';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
52
web/resources/quickview.vue
Normal file
52
web/resources/quickview.vue
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
<template>
|
||||||
|
<div class="quick-view">
|
||||||
|
<h3>
|
||||||
|
Quick overview
|
||||||
|
</h3>
|
||||||
|
<div class="block-content">
|
||||||
|
<div
|
||||||
|
v-for="group in tasks"
|
||||||
|
v-bind:key="group.id"
|
||||||
|
class="new-group"
|
||||||
|
:title="'Group: '+group.name"
|
||||||
|
>
|
||||||
|
<a :href="'#group-'+group.id">
|
||||||
|
<p
|
||||||
|
v-for="task in group.tasks"
|
||||||
|
v-bind:key="task.id"
|
||||||
|
:href="'#task-'+task.id"
|
||||||
|
:class="statusText(task.status)"
|
||||||
|
class="square"
|
||||||
|
>
|
||||||
|
|
||||||
|
</p>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<p class="spacer"> </p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: [
|
||||||
|
'tasks'
|
||||||
|
],
|
||||||
|
methods: {
|
||||||
|
statusText: function (status) {
|
||||||
|
switch (status) {
|
||||||
|
case '1':
|
||||||
|
return 'up';
|
||||||
|
break;
|
||||||
|
case '0':
|
||||||
|
return 'down';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return 'unknown';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
70
web/resources/tasklist.vue
Normal file
70
web/resources/tasklist.vue
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<table id="tasks_tbl">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="5%">Up?</th>
|
||||||
|
<th width="*">Host</th>
|
||||||
|
<th width="5%">Type</th>
|
||||||
|
<th width="20%">Last execution</th>
|
||||||
|
<th width="20%">Frequency (min)</th>
|
||||||
|
<th width="5%">Active</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr
|
||||||
|
v-for="task in tasks"
|
||||||
|
v-bind:key="task.id"
|
||||||
|
>
|
||||||
|
<td :class="statusText(task.status)">
|
||||||
|
<img :src="'img/'+statusText(task.status)+'.png'" width="16" alt="Status" />
|
||||||
|
</td>
|
||||||
|
<td :class="statusText(task.status)">
|
||||||
|
<a :href="task.host" target="_blank">{{ task.host }}</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<img :src="task.type == 'http' ? 'img/http.png' : 'img/ping.png'" width="16" alt="Type of check" :title="'Type: '+task.type" />
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span
|
||||||
|
v-if="task.last_execution"
|
||||||
|
>
|
||||||
|
{{ moment(task.last_execution).fromNow() }}
|
||||||
|
<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.active == 1 ? 'Yes' : 'No' }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: [
|
||||||
|
'tasks'
|
||||||
|
],
|
||||||
|
methods: {
|
||||||
|
statusText: function (status) {
|
||||||
|
switch (status) {
|
||||||
|
case '1':
|
||||||
|
return 'up';
|
||||||
|
break;
|
||||||
|
case '0':
|
||||||
|
return 'down';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return 'unknown';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
9
web/webpack.mix.js
Normal file
9
web/webpack.mix.js
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
let mix = require('laravel-mix');
|
||||||
|
|
||||||
|
mix
|
||||||
|
.js('js/app.js', 'dist').vue()
|
||||||
|
.sass('css/app.scss', 'dist').options({
|
||||||
|
processCssUrls: false
|
||||||
|
})
|
||||||
|
.sourceMaps()
|
||||||
|
;
|
Loading…
Add table
Reference in a new issue