From 3b21067d07b208baf574a34fb06ec808b37c4ee3 Mon Sep 17 00:00:00 2001 From: Eugene Burkov Date: Fri, 29 Jul 2022 13:34:55 +0300 Subject: [PATCH] client: add warning toast --- client/src/__locales/en.json | 1 + client/src/actions/index.js | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/client/src/__locales/en.json b/client/src/__locales/en.json index 9fc65cac6d0..15f28c87a43 100644 --- a/client/src/__locales/en.json +++ b/client/src/__locales/en.json @@ -222,6 +222,7 @@ "updated_upstream_dns_toast": "Upstream servers successfully saved", "dns_test_ok_toast": "Specified DNS servers are working correctly", "dns_test_not_ok_toast": "Server \"{{key}}\": could not be used, please check that you've written it correctly", + "dns_test_warning_toast": "Server \"{{key}}\": doesn't respond for the test request and thus may not work properly", "unblock": "Unblock", "block": "Block", "disallow_this_client": "Disallow this client", diff --git a/client/src/actions/index.js b/client/src/actions/index.js index 8e153224c11..e1b4e96c38a 100644 --- a/client/src/actions/index.js +++ b/client/src/actions/index.js @@ -314,13 +314,15 @@ export const testUpstream = ( const testMessages = Object.keys(upstreamResponse) .map((key) => { const message = upstreamResponse[key]; - if (message !== 'OK') { + if (message.startsWith('WARNING:')) { + dispatch(addErrorToast({ error: i18next.t('dns_test_warning_toast', { key }) })); + } else if (message !== 'OK') { dispatch(addErrorToast({ error: i18next.t('dns_test_not_ok_toast', { key }) })); } return message; }); - if (testMessages.every((message) => message === 'OK')) { + if (testMessages.every((message) => message === 'OK' || message.startsWith('WARNING:'))) { dispatch(addSuccessToast('dns_test_ok_toast')); }