From 87a7585d7820b2e5305aa22aa8775ad82aedd4f1 Mon Sep 17 00:00:00 2001 From: c8y3 <25362953+c8y3@users.noreply.github.com> Date: Fri, 9 Jun 2023 10:05:53 +0200 Subject: [PATCH] Factored code to display [not set] --- src/web/components/LoggingAlertConfig.jsx | 28 ++++++++++++++--------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/web/components/LoggingAlertConfig.jsx b/src/web/components/LoggingAlertConfig.jsx index 60f3b93..727a2ec 100755 --- a/src/web/components/LoggingAlertConfig.jsx +++ b/src/web/components/LoggingAlertConfig.jsx @@ -66,7 +66,13 @@ const _formatOption = (key, value) => { return { value: value, label: key }; }; -// TODO factor all [not set] with a function displayConfigurationValue() +const _displayOptionalConfigurationValue = (value) => { + if (!value) { + return '[not set]'; + } + return value; +}; + const LoggingAlertConfig = ({ config = DEFAULT_CONFIG, updateConfig }) => { const [nextConfiguration, setNextConfiguration] = useState(config); const { streams: streamList = [] } = useStore(StreamsStore); @@ -75,11 +81,11 @@ const LoggingAlertConfig = ({ config = DEFAULT_CONFIG, updateConfig }) => { const configurationModal = useRef(); const _openModal = () => { - configurationModal.current.open() + configurationModal.current.open(); }; const _closeModal = () => { - configurationModal.current.close() + configurationModal.current.close(); }; /* TODO is this necessary? @@ -145,49 +151,49 @@ const LoggingAlertConfig = ({ config = DEFAULT_CONFIG, updateConfig }) => {