Ivan Galakhov 5 лет назад
Родитель
Сommit
ba17ff4d86

+ 18 - 0
dashboard/src/main/home/cluster-dashboard/expanded-chart/NotificationSettingsSection.tsx

@@ -28,6 +28,7 @@ const NotificationSettingsSection: React.FC<Props> = (props) => {
   const [initLoading, setInitLoading] = useState(true);
   const [saveLoading, setSaveLoading] = useState(false);
   const [numSaves, setNumSaves] = useState(0);
+  const [hasNotifications, setHasNotifications] = useState(null);
 
   const { currentProject, currentCluster } = useContext(Context);
 
@@ -52,6 +53,17 @@ const NotificationSettingsSection: React.FC<Props> = (props) => {
         });
         setInitLoading(false);
       });
+    api
+      .getSlackIntegrations(
+        "<token>",
+        {},
+        {
+          id: currentProject.id,
+        }
+      )
+      .then(({ data }) => {
+        setHasNotifications(data.length > 0);
+      });
   }, []);
 
   const saveChanges = () => {
@@ -88,6 +100,12 @@ const NotificationSettingsSection: React.FC<Props> = (props) => {
         <Loading />
       ) : (
         <>
+          {hasNotifications != null && !hasNotifications && (
+            <Helper>
+              This message appears when there are no notification integrations
+              for the project
+            </Helper>
+          )}
           <CheckboxRow
             label={"Notifications Enabled"}
             checked={notificationsOn}