فهرست منبع

no release message

Ivan Galakhov 4 سال پیش
والد
کامیت
20b947b5ac
1فایلهای تغییر یافته به همراه14 افزوده شده و 4 حذف شده
  1. 14 4
      dashboard/src/main/home/cluster-dashboard/expanded-chart/NotificationSettingsSection.tsx

+ 14 - 4
dashboard/src/main/home/cluster-dashboard/expanded-chart/NotificationSettingsSection.tsx

@@ -29,7 +29,7 @@ const NotificationSettingsSection: React.FC<Props> = (props) => {
   const [saveLoading, setSaveLoading] = useState(false);
   const [numSaves, setNumSaves] = useState(0);
   const [hasNotifications, setHasNotifications] = useState(null);
-  const [hasRelease, setHasRelease] = useState(false);
+  const [hasRelease, setHasRelease] = useState(true);
 
   const { currentProject, currentCluster } = useContext(Context);
 
@@ -53,6 +53,10 @@ const NotificationSettingsSection: React.FC<Props> = (props) => {
           ...data,
         });
         setInitLoading(false);
+      })
+      .catch(() => {
+        setHasRelease(false);
+        setInitLoading(false);
       });
     api
       .getSlackIntegrations(
@@ -64,9 +68,6 @@ const NotificationSettingsSection: React.FC<Props> = (props) => {
       )
       .then(({ data }) => {
         setHasNotifications(data.length > 0);
-      })
-      .catch((ret) => {
-        console.log(ret);
       });
   }, []);
 
@@ -94,6 +95,10 @@ const NotificationSettingsSection: React.FC<Props> = (props) => {
       .then(() => {
         setNumSaves(numSaves + 1);
         setSaveLoading(false);
+      })
+      .catch(() => {
+        setHasRelease(false);
+        setSaveLoading(false);
       });
   };
 
@@ -102,6 +107,11 @@ const NotificationSettingsSection: React.FC<Props> = (props) => {
       <Heading>Notification Settings</Heading>
       {initLoading ? (
         <Loading />
+      ) : !hasRelease ? (
+        <Heading>
+          This message appears when the release isn't in the database, so Porter
+          can't laod in notifications for it
+        </Heading>
       ) : (
         <>
           {hasNotifications != null && !hasNotifications && (