From f8676c4c136305c97eb70f6824804ce13f6593c4 Mon Sep 17 00:00:00 2001 From: Romein van Buren Date: Wed, 13 Jul 2022 13:51:10 +0200 Subject: [PATCH] Autotest error messages --- entities/webservice.js | 6 +++--- gui/components/formautotestfield.svelte | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/entities/webservice.js b/entities/webservice.js index ab7c447..a002120 100644 --- a/entities/webservice.js +++ b/entities/webservice.js @@ -353,7 +353,7 @@ module.exports = { return 'autotest must be an array'; } else if (newValues.autotest) { - for (const [ iEndpoint, endpoint ] of newValues.autotest.entries()) { + for (const endpoint of newValues.autotest) { if (!url.test(endpoint.uri)) { return 'not a valid url'; } @@ -365,10 +365,10 @@ module.exports = { const foundHeaders = []; for (const header of endpoint.headers) { if (foundHeaders.includes(header.name)) { - return 'found duplicate headers in endpoint #' + iEndpoint; + return 'found duplicate headers in endpoint ' + endpoint.uri; } else if (!header.name || !header.name.trim || !header.name.trim()) { - return 'empty header name in endpoint #' + iEndpoint; + return 'empty header name in endpoint ' + endpoint.uri; } else { foundHeaders.push(header.name); diff --git a/gui/components/formautotestfield.svelte b/gui/components/formautotestfield.svelte index 3ffd00c..f42baab 100644 --- a/gui/components/formautotestfield.svelte +++ b/gui/components/formautotestfield.svelte @@ -4,12 +4,14 @@ import { createEventDispatcher } from 'svelte'; import Toggle from 'components/webdesq/toggle.svelte'; import { operatorNames } from '../../lib/operators'; import { realValueNames } from '../../lib/realvalues'; +import { fade } from 'svelte/transition'; export let value = []; export let specs = {}; export let readonly = true; export let language = 'en'; export let translate = s => s; +export let error = false; const dispatch = createEventDispatcher(); const defaultEndpoint = { @@ -220,6 +222,10 @@ function removeEndpoint(i) { +{#if error} + {error} +{/if} +