From 0d088e085e68d39455fda21d1fd08ebcaef2c06b Mon Sep 17 00:00:00 2001 From: sct Date: Thu, 17 Dec 2020 02:08:09 +0000 Subject: [PATCH] feat(frontend): show alert when there are no default radarr/sonarr servers fixes #344 --- src/components/Settings/SettingsServices.tsx | 228 ++++++++++++------- src/i18n/locale/en.json | 3 + 2 files changed, 143 insertions(+), 88 deletions(-) diff --git a/src/components/Settings/SettingsServices.tsx b/src/components/Settings/SettingsServices.tsx index 07ccafd3a..5a3b1e8c5 100644 --- a/src/components/Settings/SettingsServices.tsx +++ b/src/components/Settings/SettingsServices.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { defineMessages, FormattedMessage } from 'react-intl'; +import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; import Badge from '../Common/Badge'; import Button from '../Common/Button'; import useSWR from 'swr'; @@ -31,8 +31,48 @@ const messages = defineMessages({ activeProfile: 'Active Profile', addradarr: 'Add Radarr Server', addsonarr: 'Add Sonarr Server', + nodefault: 'No default server selected!', + nodefaultdescription: + 'At least one server must be marked as default before any requests will make it to your services.', + no4kimplemented: '(Default 4K servers are not currently implemented)', }); +const NoDefaultAlert: React.FC = () => { + const intl = useIntl(); + return ( +
+
+
+ +
+
+

+ {intl.formatMessage(messages.nodefault)} +

+
+

{intl.formatMessage(messages.nodefaultdescription)}

+

+ {intl.formatMessage(messages.no4kimplemented)} +

+
+
+
+
+ ); +}; + interface ServerInstanceProps { name: string; isDefault?: boolean; @@ -249,51 +289,57 @@ const SettingsServices: React.FC = () => {
{!radarrData && !radarrError && } {radarrData && !radarrError && ( -
    - {radarrData.map((radarr) => ( - setEditRadarrModal({ open: true, radarr })} - onDelete={() => - setDeleteServerModal({ - open: true, - serverId: radarr.id, - type: 'radarr', - }) - } - /> - ))} -
  • -
    - -
    -
  • -
+ + + + + +
+ + + )}
@@ -307,52 +353,58 @@ const SettingsServices: React.FC = () => {
{!sonarrData && !sonarrError && } {sonarrData && !sonarrError && ( -
    - {sonarrData.map((sonarr) => ( - setEditSonarrModal({ open: true, sonarr })} - onDelete={() => - setDeleteServerModal({ - open: true, - serverId: sonarr.id, - type: 'sonarr', - }) - } - /> - ))} -
  • -
    - -
    -
  • -
+ + + + + +
+ + + )}
diff --git a/src/i18n/locale/en.json b/src/i18n/locale/en.json index b1d7b2bf0..8072e1464 100644 --- a/src/i18n/locale/en.json +++ b/src/i18n/locale/en.json @@ -207,6 +207,9 @@ "components.Settings.menuPlexSettings": "Plex", "components.Settings.menuServices": "Services", "components.Settings.nextexecution": "Next Execution", + "components.Settings.no4kimplemented": "(Default 4K servers are not currently implemented)", + "components.Settings.nodefault": "No default server selected!", + "components.Settings.nodefaultdescription": "At least one server must be marked as default before any requests will make it to your services.", "components.Settings.notificationsettings": "Notification Settings", "components.Settings.notificationsettingsDescription": "Here you can pick and choose what types of notifications to send and through what types of services.", "components.Settings.notrunning": "Not Running",