ソースを参照

rfac: more banners for empty logs

Soham Parekh 3 年 前
コミット
96b4e03bcf

+ 2 - 2
dashboard/src/main/home/cluster-dashboard/expanded-chart/logs-section/LogsSection.tsx

@@ -126,7 +126,7 @@ const LogsSection: React.FC<Props> = ({
 
     setTimeout(() => {
       setNotification(undefined);
-    }, 3000);
+    }, 5000);
   };
 
   const { loading, logs, refresh, moveCursor, paginationInfo } = useLogs(
@@ -670,7 +670,7 @@ const NotificationWrapper = styled.div<{ active?: boolean }>`
   width: fit-content;
   padding-inline: 10px;
   background: #101420;
-  animation: bounceIn 0.3s ease-out;
+  zIndex: 9999;
 
   @keyframes bounceIn {
     0% {

+ 15 - 4
dashboard/src/main/home/cluster-dashboard/expanded-chart/logs-section/useAgentLogs.ts

@@ -288,6 +288,12 @@ export const useLogs = (
 
     updateLogs(initialLogs);
 
+    if (!isLive && !initialLogs.length) {
+      notify(
+        "You have no logs for this time period. Try with a different time range."
+      );
+    }
+
     closeWebsocket(websocketKey);
 
     setLoading(false);
@@ -312,10 +318,15 @@ export const useLogs = (
         Direction.backward
       );
 
-      updateLogs(
-        paginationInfo.previousCursor ? newLogs.slice(0, -1) : newLogs,
-        direction
-      );
+      const logsToUpdate = paginationInfo.previousCursor
+        ? newLogs.slice(0, -1)
+        : newLogs;
+
+      updateLogs(logsToUpdate, direction);
+
+      if (!logsToUpdate.length) {
+        notify("You have reached the beginning of the logs");
+      }
 
       setPaginationInfo((paginationInfo) => ({
         ...paginationInfo,