mirror of
https://github.com/TwiN/gatus.git
synced 2024-11-28 10:53:20 +01:00
Implement toggleable average response time (frontend) + Persist refresh interval (frontend) + Update dependencies (frontend)
This commit is contained in:
parent
2b9d986932
commit
12c352254f
6967
web/app/package-lock.json
generated
6967
web/app/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -8,8 +8,13 @@
|
|||||||
<span v-if="data.results && data.results.length" class='text-gray-500 font-light'> | {{ data.results[data.results.length - 1].hostname }}</span>
|
<span v-if="data.results && data.results.length" class='text-gray-500 font-light'> | {{ data.results[data.results.length - 1].hostname }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class='w-1/4 text-right'>
|
<div class='w-1/4 text-right'>
|
||||||
<span class='font-light status-min-max-ms' v-if="data.results && data.results.length">
|
<span class='font-light overflow-x-hidden cursor-pointer select-none' v-if="data.results && data.results.length" @click="toggleShowAverageResponseTime" :title="showAverageResponseTime ? 'Average response time' : 'Minimum and maximum response time'">
|
||||||
{{ (minResponseTime === maxResponseTime ? minResponseTime : (minResponseTime + '-' + maxResponseTime)) }}ms
|
<slot v-if="showAverageResponseTime">
|
||||||
|
~{{ averageResponseTime }}ms
|
||||||
|
</slot>
|
||||||
|
<slot v-else>
|
||||||
|
{{ (minResponseTime === maxResponseTime ? minResponseTime : (minResponseTime + '-' + maxResponseTime)) }}ms
|
||||||
|
</slot>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -56,15 +61,18 @@ export default {
|
|||||||
props: {
|
props: {
|
||||||
maximumNumberOfResults: Number,
|
maximumNumberOfResults: Number,
|
||||||
data: Object,
|
data: Object,
|
||||||
|
showAverageResponseTime: Boolean
|
||||||
},
|
},
|
||||||
emits: ['showTooltip'],
|
emits: ['showTooltip', 'toggleShowAverageResponseTime'],
|
||||||
mixins: [helper],
|
mixins: [helper],
|
||||||
methods: {
|
methods: {
|
||||||
updateMinAndMaxResponseTimes() {
|
updateMinAndMaxResponseTimes() {
|
||||||
let minResponseTime = null;
|
let minResponseTime = null;
|
||||||
let maxResponseTime = null;
|
let maxResponseTime = null;
|
||||||
|
let totalResponseTime = 0;
|
||||||
for (let i in this.data.results) {
|
for (let i in this.data.results) {
|
||||||
const responseTime = parseInt((this.data.results[i].duration/1000000).toFixed(0));
|
const responseTime = parseInt((this.data.results[i].duration/1000000).toFixed(0));
|
||||||
|
totalResponseTime += responseTime;
|
||||||
if (minResponseTime == null || minResponseTime > responseTime) {
|
if (minResponseTime == null || minResponseTime > responseTime) {
|
||||||
minResponseTime = responseTime;
|
minResponseTime = responseTime;
|
||||||
}
|
}
|
||||||
@ -78,6 +86,9 @@ export default {
|
|||||||
if (this.maxResponseTime !== maxResponseTime) {
|
if (this.maxResponseTime !== maxResponseTime) {
|
||||||
this.maxResponseTime = maxResponseTime;
|
this.maxResponseTime = maxResponseTime;
|
||||||
}
|
}
|
||||||
|
if (this.data.results && this.data.results.length) {
|
||||||
|
this.averageResponseTime = (totalResponseTime/this.data.results.length).toFixed(0);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
generatePath() {
|
generatePath() {
|
||||||
if (!this.data) {
|
if (!this.data) {
|
||||||
@ -87,6 +98,9 @@ export default {
|
|||||||
},
|
},
|
||||||
showTooltip(result, event) {
|
showTooltip(result, event) {
|
||||||
this.$emit('showTooltip', result, event);
|
this.$emit('showTooltip', result, event);
|
||||||
|
},
|
||||||
|
toggleShowAverageResponseTime() {
|
||||||
|
this.$emit('toggleShowAverageResponseTime');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -100,7 +114,8 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
minResponseTime: 0,
|
minResponseTime: 0,
|
||||||
maxResponseTime: 0
|
maxResponseTime: 0,
|
||||||
|
averageResponseTime: 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -152,10 +167,6 @@ export default {
|
|||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-min-max-ms {
|
|
||||||
overflow-x: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.status.status-success::after {
|
.status.status-success::after {
|
||||||
content: "✓";
|
content: "✓";
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,12 @@
|
|||||||
</slot>
|
</slot>
|
||||||
<div v-if="!collapsed" :class="name === 'undefined' ? '' : 'service-group-content'">
|
<div v-if="!collapsed" :class="name === 'undefined' ? '' : 'service-group-content'">
|
||||||
<slot v-for="service in services" :key="service">
|
<slot v-for="service in services" :key="service">
|
||||||
<Service :data="service" @showTooltip="showTooltip" :maximumNumberOfResults="20"/>
|
<Service
|
||||||
|
:data="service"
|
||||||
|
:maximumNumberOfResults="20"
|
||||||
|
@showTooltip="showTooltip"
|
||||||
|
@toggleShowAverageResponseTime="toggleShowAverageResponseTime" :showAverageResponseTime="showAverageResponseTime"
|
||||||
|
/>
|
||||||
</slot>
|
</slot>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -31,9 +36,10 @@ export default {
|
|||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
name: String,
|
name: String,
|
||||||
services: Array
|
services: Array,
|
||||||
|
showAverageResponseTime: Boolean
|
||||||
},
|
},
|
||||||
emits: ['showTooltip'],
|
emits: ['showTooltip', 'toggleShowAverageResponseTime'],
|
||||||
methods: {
|
methods: {
|
||||||
healthCheck() {
|
healthCheck() {
|
||||||
if (this.services) {
|
if (this.services) {
|
||||||
@ -56,10 +62,13 @@ export default {
|
|||||||
},
|
},
|
||||||
toggleGroup() {
|
toggleGroup() {
|
||||||
this.collapsed = !this.collapsed;
|
this.collapsed = !this.collapsed;
|
||||||
sessionStorage.setItem(`service-group:${this.name}:collapsed`, this.collapsed);
|
sessionStorage.setItem(`gatus:service-group:${this.name}:collapsed`, this.collapsed);
|
||||||
},
|
},
|
||||||
showTooltip(result, event) {
|
showTooltip(result, event) {
|
||||||
this.$emit('showTooltip', result, event);
|
this.$emit('showTooltip', result, event);
|
||||||
|
},
|
||||||
|
toggleShowAverageResponseTime() {
|
||||||
|
this.$emit('toggleShowAverageResponseTime');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -73,7 +82,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
healthy: true,
|
healthy: true,
|
||||||
collapsed: sessionStorage.getItem(`service-group:${this.name}:collapsed`) === "true"
|
collapsed: sessionStorage.getItem(`gatus:service-group:${this.name}:collapsed`) === "true"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="results">
|
<div id="results">
|
||||||
<slot v-for="serviceGroup in serviceGroups" :key="serviceGroup">
|
<slot v-for="serviceGroup in serviceGroups" :key="serviceGroup">
|
||||||
<ServiceGroup :services="serviceGroup.services" :name="serviceGroup.name" @showTooltip="showTooltip"/>
|
<ServiceGroup :services="serviceGroup.services" :name="serviceGroup.name" @showTooltip="showTooltip" @toggleShowAverageResponseTime="toggleShowAverageResponseTime" :showAverageResponseTime="showAverageResponseTime" />
|
||||||
</slot>
|
</slot>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -17,9 +17,10 @@ export default {
|
|||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
showStatusOnHover: Boolean,
|
showStatusOnHover: Boolean,
|
||||||
serviceStatuses: Object
|
serviceStatuses: Object,
|
||||||
|
showAverageResponseTime: Boolean
|
||||||
},
|
},
|
||||||
emits: ['showTooltip'],
|
emits: ['showTooltip', 'toggleShowAverageResponseTime'],
|
||||||
methods: {
|
methods: {
|
||||||
process() {
|
process() {
|
||||||
let outputByGroup = {};
|
let outputByGroup = {};
|
||||||
@ -45,6 +46,9 @@ export default {
|
|||||||
},
|
},
|
||||||
showTooltip(result, event) {
|
showTooltip(result, event) {
|
||||||
this.$emit('showTooltip', result, event);
|
this.$emit('showTooltip', result, event);
|
||||||
|
},
|
||||||
|
toggleShowAverageResponseTime() {
|
||||||
|
this.$emit('toggleShowAverageResponseTime');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -5,12 +5,12 @@
|
|||||||
↻
|
↻
|
||||||
</div>
|
</div>
|
||||||
<select class="text-center text-gray-500 text-sm" id="refresh-rate" ref="refreshInterval" @change="handleChangeRefreshInterval">
|
<select class="text-center text-gray-500 text-sm" id="refresh-rate" ref="refreshInterval" @change="handleChangeRefreshInterval">
|
||||||
<option value="10">10s</option>
|
<option value="10" :selected="refreshInterval === 10">10s</option>
|
||||||
<option value="30" selected>30s</option>
|
<option value="30" :selected="refreshInterval === 30">30s</option>
|
||||||
<option value="60">1m</option>
|
<option value="60" :selected="refreshInterval === 60">1m</option>
|
||||||
<option value="120">2m</option>
|
<option value="120" :selected="refreshInterval === 120">2m</option>
|
||||||
<option value="300">5m</option>
|
<option value="300" :selected="refreshInterval === 300">5m</option>
|
||||||
<option value="600">10m</option>
|
<option value="600" :selected="refreshInterval === 600">10m</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -23,6 +23,7 @@ export default {
|
|||||||
props: {},
|
props: {},
|
||||||
methods: {
|
methods: {
|
||||||
setRefreshInterval(seconds) {
|
setRefreshInterval(seconds) {
|
||||||
|
sessionStorage.setItem('gatus:refresh-interval', seconds);
|
||||||
let that = this;
|
let that = this;
|
||||||
this.refreshIntervalHandler = setInterval(function () {
|
this.refreshIntervalHandler = setInterval(function () {
|
||||||
that.refreshData();
|
that.refreshData();
|
||||||
@ -38,6 +39,9 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
if (this.refreshInterval !== 10 && this.refreshInterval !== 30 && this.refreshInterval !== 60 && this.refreshInterval !== 120 && this.refreshInterval !== 300 && this.refreshInterval !== 600) {
|
||||||
|
this.refreshInterval = 60;
|
||||||
|
}
|
||||||
this.setRefreshInterval(this.refreshInterval);
|
this.setRefreshInterval(this.refreshInterval);
|
||||||
},
|
},
|
||||||
unmounted() {
|
unmounted() {
|
||||||
@ -45,14 +49,11 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
refreshInterval: 30,
|
refreshInterval: sessionStorage.getItem('gatus:refresh-interval') < 10 ? 60 : parseInt(sessionStorage.getItem('gatus:refresh-interval')),
|
||||||
refreshIntervalHandler: 0,
|
refreshIntervalHandler: 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// props.refreshInterval = 30
|
|
||||||
//$("#refresh-rate").val(30);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,7 +6,12 @@
|
|||||||
<slot v-if="serviceStatus">
|
<slot v-if="serviceStatus">
|
||||||
<h1 class="text-xl xl:text-3xl text-monospace text-gray-400">RECENT CHECKS</h1>
|
<h1 class="text-xl xl:text-3xl text-monospace text-gray-400">RECENT CHECKS</h1>
|
||||||
<hr class="mb-4" />
|
<hr class="mb-4" />
|
||||||
<Service :data="serviceStatus" :maximumNumberOfResults="20" @showTooltip="showTooltip" />
|
<Service
|
||||||
|
:data="serviceStatus"
|
||||||
|
:maximumNumberOfResults="20"
|
||||||
|
@showTooltip="showTooltip"
|
||||||
|
@toggleShowAverageResponseTime="toggleShowAverageResponseTime" :showAverageResponseTime="showAverageResponseTime"
|
||||||
|
/>
|
||||||
<Pagination @page="changePage"/>
|
<Pagination @page="changePage"/>
|
||||||
</slot>
|
</slot>
|
||||||
<div v-if="uptime" class="mt-12">
|
<div v-if="uptime" class="mt-12">
|
||||||
@ -139,13 +144,16 @@ export default {
|
|||||||
let minutes = Math.ceil((new Date(start) - new Date(end))/1000/60);
|
let minutes = Math.ceil((new Date(start) - new Date(end))/1000/60);
|
||||||
return minutes + (minutes === 1 ? ' minute' : ' minutes');
|
return minutes + (minutes === 1 ? ' minute' : ' minutes');
|
||||||
},
|
},
|
||||||
showTooltip(result, event) {
|
|
||||||
this.$emit('showTooltip', result, event);
|
|
||||||
},
|
|
||||||
changePage(page) {
|
changePage(page) {
|
||||||
this.currentPage = page;
|
this.currentPage = page;
|
||||||
this.fetchData();
|
this.fetchData();
|
||||||
},
|
},
|
||||||
|
showTooltip(result, event) {
|
||||||
|
this.$emit('showTooltip', result, event);
|
||||||
|
},
|
||||||
|
toggleShowAverageResponseTime() {
|
||||||
|
this.showAverageResponseTime = !this.showAverageResponseTime;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -155,6 +163,7 @@ export default {
|
|||||||
// Since this page isn't at the root, we need to modify the server URL a bit
|
// Since this page isn't at the root, we need to modify the server URL a bit
|
||||||
serverUrl: SERVER_URL === '.' ? '..' : SERVER_URL,
|
serverUrl: SERVER_URL === '.' ? '..' : SERVER_URL,
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
|
showAverageResponseTime: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<Services :serviceStatuses="serviceStatuses" :showStatusOnHover="true" @showTooltip="showTooltip"/>
|
<Services
|
||||||
|
:serviceStatuses="serviceStatuses"
|
||||||
|
:showStatusOnHover="true"
|
||||||
|
@showTooltip="showTooltip"
|
||||||
|
@toggleShowAverageResponseTime="toggleShowAverageResponseTime" :showAverageResponseTime="showAverageResponseTime"
|
||||||
|
/>
|
||||||
<Pagination @page="changePage"/>
|
<Pagination @page="changePage"/>
|
||||||
<Settings @refreshData="fetchData"/>
|
<Settings @refreshData="fetchData"/>
|
||||||
</template>
|
</template>
|
||||||
@ -17,7 +22,7 @@ export default {
|
|||||||
Services,
|
Services,
|
||||||
Settings,
|
Settings,
|
||||||
},
|
},
|
||||||
emits: ['showTooltip'],
|
emits: ['showTooltip', 'toggleShowAverageResponseTime'],
|
||||||
methods: {
|
methods: {
|
||||||
fetchData() {
|
fetchData() {
|
||||||
//console.log("[Home][fetchData] Fetching data");
|
//console.log("[Home][fetchData] Fetching data");
|
||||||
@ -29,18 +34,22 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
showTooltip(result, event) {
|
|
||||||
this.$emit('showTooltip', result, event);
|
|
||||||
},
|
|
||||||
changePage(page) {
|
changePage(page) {
|
||||||
this.currentPage = page;
|
this.currentPage = page;
|
||||||
this.fetchData();
|
this.fetchData();
|
||||||
},
|
},
|
||||||
|
showTooltip(result, event) {
|
||||||
|
this.$emit('showTooltip', result, event);
|
||||||
|
},
|
||||||
|
toggleShowAverageResponseTime() {
|
||||||
|
this.showAverageResponseTime = !this.showAverageResponseTime;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
serviceStatuses: {},
|
serviceStatuses: {},
|
||||||
currentPage: 1
|
currentPage: 1,
|
||||||
|
showAverageResponseTime: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user