This commit is contained in:
Romein van Buren 2022-08-29 12:22:17 +02:00
parent e11645932d
commit 9b4b71d25f
Signed by: romein
GPG Key ID: 0EFF8478ADDF6C49
6 changed files with 22 additions and 17 deletions

View File

@ -21,7 +21,7 @@ const defaultEndpoint = {
{ type: 'httpstatus', { type: 'httpstatus',
truth: 'true', truth: 'true',
operator: 'equal', operator: 'equal',
string: '200' string: '200',
}, },
], ],
}; };
@ -29,7 +29,7 @@ const defaultReq = {
type: 'httpstatus', type: 'httpstatus',
truth: 'true', truth: 'true',
operator: 'equal', operator: 'equal',
string: '' string: '',
}; };
const defaultHeader = { const defaultHeader = {
name: '', name: '',
@ -110,6 +110,7 @@ function removeEndpoint(i) {
/> />
<button on:click={() => { <button on:click={() => {
endpoint.headers.splice(iHeader, 1); endpoint.headers.splice(iHeader, 1);
// eslint-disable-next-line no-self-assign
endpoint = endpoint; endpoint = endpoint;
}}> }}>
&times; &times;
@ -123,7 +124,7 @@ function removeEndpoint(i) {
{/if} {/if}
<div> <div>
<button on:click={() => endpoint.headers = [...endpoint.headers, defaultHeader]}> <button on:click={() => endpoint.headers = [ ...endpoint.headers, defaultHeader ]}>
{translate('add request header', language)} {translate('add request header', language)}
</button> </button>
</div> </div>
@ -161,7 +162,7 @@ function removeEndpoint(i) {
inline inline
labels={{ labels={{
on: translate('is', language), on: translate('is', language),
off: translate('isn\'t', language) off: translate('isn\'t', language),
}} }}
bind:value={req.truth} bind:value={req.truth}
on:change={changeValue} on:change={changeValue}
@ -196,6 +197,7 @@ function removeEndpoint(i) {
/> />
<button on:click={() => { <button on:click={() => {
endpoint.requirements.splice(iReq, 1); endpoint.requirements.splice(iReq, 1);
// eslint-disable-next-line no-self-assign
endpoint = endpoint; endpoint = endpoint;
}}> }}>
&times; &times;
@ -209,7 +211,7 @@ function removeEndpoint(i) {
{/if} {/if}
<div> <div>
<button on:click={() => endpoint.requirements = [...endpoint.requirements, defaultReq]}> <button on:click={() => endpoint.requirements = [ ...endpoint.requirements, defaultReq ]}>
{translate('add requirement', language)} {translate('add requirement', language)}
</button> </button>
</div> </div>

View File

@ -28,7 +28,7 @@ const severity = {
name: 'no impact', name: 'no impact',
class: 'l4', class: 'l4',
}, },
} };
const dispatch = createEventDispatcher(); const dispatch = createEventDispatcher();
const service = value; // for clarity const service = value; // for clarity
let outages = []; let outages = [];

View File

@ -17,7 +17,7 @@
let hasData = false; let hasData = false;
function tileProps(service) { function tileProps(service) {
let props = { const props = {
title: service.name.en, title: service.name.en,
subtitle: service.cluster, subtitle: service.cluster,
date: service.lastBeat?.date ? new Date(service.lastBeat.date) : undefined, date: service.lastBeat?.date ? new Date(service.lastBeat.date) : undefined,
@ -87,7 +87,9 @@
settings.subscribe(s => { settings.subscribe(s => {
size = (s.cols || 4) * (s.rows || 3); size = (s.cols || 4) * (s.rows || 3);
if (hasData) organiseGrid(); if (hasData) {
organiseGrid();
}
}); });
return () => clearInterval(clockInterval); return () => clearInterval(clockInterval);

View File

@ -14,13 +14,13 @@
}) : ''; }) : '';
onMount(() => { onMount(() => {
if (since) { function updateDuration() {
function updateDuration() { formattedDuration = formatDuration(
formattedDuration = formatDuration( new Date().getTime() - since.getTime()
new Date().getTime() - since.getTime() );
); }
}
if (since) {
updateDuration(); updateDuration();
const interval = setInterval(updateDuration, 100); const interval = setInterval(updateDuration, 100);
return () => clearInterval(interval); return () => clearInterval(interval);

View File

@ -5,7 +5,9 @@
onMount(() => { onMount(() => {
let url = window.location.href; let url = window.location.href;
if (!url.endsWith('/')) url += '/'; if (!url.endsWith('/')) {
url += '/';
}
url += 'status/dashboard'; url += 'status/dashboard';
window.open(url, '_blank').focus(); window.open(url, '_blank').focus();

View File

@ -3,7 +3,6 @@
const { makeId } = require('core/makeid'); const { makeId } = require('core/makeid');
const decoder = new TextDecoder('utf-8'); const decoder = new TextDecoder('utf-8');
let uws;
let downIdsBefore = []; let downIdsBefore = [];
let downIdsAfter = []; let downIdsAfter = [];
@ -16,7 +15,7 @@ const mapService = (s, beat) => ({
}); });
async function createDashboardSocket(server) { async function createDashboardSocket(server) {
uws = server.ws({ server.ws({
route: '/status/dashboard/socket', route: '/status/dashboard/socket',
onOpen: async ws => { onOpen: async ws => {
async function sendStatuses() { async function sendStatuses() {