From 92c9001c9d1f2cbd272a5897ea1157d2cadbce2d Mon Sep 17 00:00:00 2001 From: sct Date: Mon, 14 Dec 2020 06:37:34 +0000 Subject: [PATCH 1/5] fix(frontend): new radarr/sonarr ports will be converted to a number before posting --- src/components/Common/Modal/index.tsx | 226 +++++++++--------- src/components/Settings/RadarrModal/index.tsx | 2 +- src/components/Settings/SonarrModal/index.tsx | 2 +- src/hooks/useClickOutside.ts | 2 +- 4 files changed, 114 insertions(+), 118 deletions(-) diff --git a/src/components/Common/Modal/index.tsx b/src/components/Common/Modal/index.tsx index 2a7347023..beb8ff8ee 100644 --- a/src/components/Common/Modal/index.tsx +++ b/src/components/Common/Modal/index.tsx @@ -63,126 +63,122 @@ const Modal: React.FC = ({ }); useLockBodyScroll(true, disableScrollLock); - return ( - <> - {ReactDOM.createPortal( - // eslint-disable-next-line jsx-a11y/no-static-element-interactions + return ReactDOM.createPortal( + // eslint-disable-next-line jsx-a11y/no-static-element-interactions +
{ + if (e.key === 'Escape') { + typeof onCancel === 'function' && backgroundClickable + ? onCancel() + : undefined; + } + }} + > + +
+ +
+
+
{ - if (e.key === 'Escape') { - typeof onCancel === 'function' && backgroundClickable - ? onCancel() - : undefined; - } - }} + className="inline-block align-bottom bg-gray-700 sm:rounded-lg px-4 pt-5 pb-4 text-left overflow-auto shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-3xl w-full sm:p-6 max-h-full" + role="dialog" + aria-modal="true" + aria-labelledby="modal-headline" + ref={modalRef} > - -
- -
-
- -
-
- {iconSvg && ( -
- {iconSvg} -
- )} -
- {title && ( - - )} -
+
+ {iconSvg && ( +
+ {iconSvg}
- {children && ( -
- {children} -
- )} - {(onCancel || onOk || onSecondary || onTertiary) && ( -
- {typeof onOk === 'function' && ( - - )} - {typeof onSecondary === 'function' && secondaryText && ( - - )} - {typeof onTertiary === 'function' && tertiaryText && ( - - )} - {typeof onCancel === 'function' && ( - - )} -
+ )} +
+ {title && ( + )}
- -
, - document.body - )} - +
+ {children && ( +
+ {children} +
+ )} + {(onCancel || onOk || onSecondary || onTertiary) && ( +
+ {typeof onOk === 'function' && ( + + )} + {typeof onSecondary === 'function' && secondaryText && ( + + )} + {typeof onTertiary === 'function' && tertiaryText && ( + + )} + {typeof onCancel === 'function' && ( + + )} +
+ )} +
+
+
, + document.body ); }; diff --git a/src/components/Settings/RadarrModal/index.tsx b/src/components/Settings/RadarrModal/index.tsx index 5542facfd..d536dfd91 100644 --- a/src/components/Settings/RadarrModal/index.tsx +++ b/src/components/Settings/RadarrModal/index.tsx @@ -108,7 +108,7 @@ const RadarrModal: React.FC = ({ { hostname, apiKey, - port, + port: Number(port), baseUrl, useSsl, } diff --git a/src/components/Settings/SonarrModal/index.tsx b/src/components/Settings/SonarrModal/index.tsx index c6674781e..ff13807fb 100644 --- a/src/components/Settings/SonarrModal/index.tsx +++ b/src/components/Settings/SonarrModal/index.tsx @@ -111,7 +111,7 @@ const SonarrModal: React.FC = ({ { hostname, apiKey, - port, + port: Number(port), baseUrl, useSsl, } diff --git a/src/hooks/useClickOutside.ts b/src/hooks/useClickOutside.ts index 3b8adf35e..0c762593a 100644 --- a/src/hooks/useClickOutside.ts +++ b/src/hooks/useClickOutside.ts @@ -15,7 +15,7 @@ const useClickOutside = ( ): void => { useEffect(() => { const handleBodyClick = (e: MouseEvent) => { - if (!ref.current?.contains(e.target as Node)) { + if (ref.current && !ref.current.contains(e.target as Node)) { callback(e); } }; From b96bd33982f7deae64a4a641ce743f3ce27aca6b Mon Sep 17 00:00:00 2001 From: sct Date: Mon, 14 Dec 2020 06:40:31 +0000 Subject: [PATCH 2/5] refactor(frontend): remove search filter buttons until they actually do something --- src/components/Search/index.tsx | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx index 31121b963..5d141777f 100644 --- a/src/components/Search/index.tsx +++ b/src/components/Search/index.tsx @@ -10,7 +10,6 @@ import ListView from '../Common/ListView'; import { LanguageContext } from '../../context/LanguageContext'; import { defineMessages, useIntl } from 'react-intl'; import Header from '../Common/Header'; -import globalMessages from '../../i18n/globalMessages'; const messages = defineMessages({ searchresults: 'Search Results', @@ -66,25 +65,7 @@ const Search: React.FC = () => { return ( <> -
-
{intl.formatMessage(messages.searchresults)}
-
- - - - -
-
+
{intl.formatMessage(messages.searchresults)}
Date: Mon, 14 Dec 2020 07:02:29 +0000 Subject: [PATCH 3/5] fix(frontend): also convert ports to numbers when saving radarr/sonarr servers --- src/components/Settings/RadarrModal/index.tsx | 2 +- src/components/Settings/SonarrModal/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Settings/RadarrModal/index.tsx b/src/components/Settings/RadarrModal/index.tsx index d536dfd91..265892787 100644 --- a/src/components/Settings/RadarrModal/index.tsx +++ b/src/components/Settings/RadarrModal/index.tsx @@ -185,7 +185,7 @@ const RadarrModal: React.FC = ({ const submission = { name: values.name, hostname: values.hostname, - port: values.port, + port: Number(values.port), apiKey: values.apiKey, useSsl: values.ssl, baseUrl: values.baseUrl, diff --git a/src/components/Settings/SonarrModal/index.tsx b/src/components/Settings/SonarrModal/index.tsx index ff13807fb..a6056b7ed 100644 --- a/src/components/Settings/SonarrModal/index.tsx +++ b/src/components/Settings/SonarrModal/index.tsx @@ -188,7 +188,7 @@ const SonarrModal: React.FC = ({ const submission = { name: values.name, hostname: values.hostname, - port: values.port, + port: Number(values.port), apiKey: values.apiKey, useSsl: values.ssl, baseUrl: values.baseUrl, From 7bf924f7e94a0e0834f41b4ec067ed277c652766 Mon Sep 17 00:00:00 2001 From: sct Date: Mon, 14 Dec 2020 07:17:32 +0000 Subject: [PATCH 4/5] fix(frontend): also convert activeProfileId to a number for radarr/sonarr submissions --- src/components/Settings/RadarrModal/index.tsx | 2 +- src/components/Settings/SonarrModal/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Settings/RadarrModal/index.tsx b/src/components/Settings/RadarrModal/index.tsx index 265892787..cce4c37b6 100644 --- a/src/components/Settings/RadarrModal/index.tsx +++ b/src/components/Settings/RadarrModal/index.tsx @@ -189,7 +189,7 @@ const RadarrModal: React.FC = ({ apiKey: values.apiKey, useSsl: values.ssl, baseUrl: values.baseUrl, - activeProfileId: values.activeProfileId, + activeProfileId: Number(values.activeProfileId), activeProfileName: profileName, activeDirectory: values.rootFolder, is4k: values.is4k, diff --git a/src/components/Settings/SonarrModal/index.tsx b/src/components/Settings/SonarrModal/index.tsx index a6056b7ed..248006dd6 100644 --- a/src/components/Settings/SonarrModal/index.tsx +++ b/src/components/Settings/SonarrModal/index.tsx @@ -192,7 +192,7 @@ const SonarrModal: React.FC = ({ apiKey: values.apiKey, useSsl: values.ssl, baseUrl: values.baseUrl, - activeProfileId: values.activeProfileId, + activeProfileId: Number(values.activeProfileId), activeProfileName: profileName, activeDirectory: values.rootFolder, is4k: values.is4k, From cb5c0403c16b21eb1be2eabc4ff4f8fe912555d4 Mon Sep 17 00:00:00 2001 From: sct Date: Mon, 14 Dec 2020 07:57:33 +0000 Subject: [PATCH 5/5] docs: update bug template with docker version question [skip ci] --- .github/ISSUE_TEMPLATE/bug_report.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 5ad981421..40ae9700e 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -9,6 +9,9 @@ assignees: '' **Describe the bug** A clear and concise description of what the bug is. +**Are you on latest or develop branch?** +Please fill in which docker image you are currently using. + **To Reproduce** Steps to reproduce the behavior: