ソースを参照

change polling interval and add query for app event

Feroze Mohideen 2 年 前
コミット
a2e8ae8d1d

+ 1 - 1
dashboard/src/main/home/app-dashboard/expanded-app/activity-feed/ActivityFeed.tsx

@@ -26,7 +26,7 @@ type Props = {
   appData: any;
 };
 
-const EVENTS_POLL_INTERVAL = 10000;
+const EVENTS_POLL_INTERVAL = 5000; // poll every 5 seconds
 
 const ActivityFeed: React.FC<Props> = ({ chart, stackName, appData }) => {
   const { currentProject, currentCluster } = useContext(Context);

+ 6 - 27
dashboard/src/main/home/app-dashboard/expanded-app/activity-feed/events/cards/AppEventCard.tsx

@@ -72,17 +72,15 @@ const AppEventCard: React.FC<Props> = ({ event, appData }) => {
       <Container row spaced>
         <Container row>
           <Icon height="16px" src={app_event} />
-          <Spacer inline width="10px" />
-          <Text>{event.metadata.detail}</Text>
+          <Spacer inline x={1} />
+          <Text>{event.metadata.summary}</Text>
         </Container>
       </Container>
       <Spacer y={0.5} />
       <Container row spaced>
-        <TempWrapper>
-          <Link onClick={getAppLogs} hasunderline>
-            View details
-          </Link>
-        </TempWrapper>
+        <Link onClick={getAppLogs} hasunderline>
+          View details
+        </Link>
       </Container>
       {showModal && (
         <AppEventModal
@@ -90,7 +88,7 @@ const AppEventCard: React.FC<Props> = ({ event, appData }) => {
           logs={logs}
           porterAppName={appData.app.name}
           timestamp={readableDate(event.updated_at)}
-          expandedAppEventMessage={event.metadata.summary}
+          expandedAppEventMessage={event.metadata.detail}
         />
       )}
     </StyledEventCard>
@@ -99,22 +97,3 @@ const AppEventCard: React.FC<Props> = ({ event, appData }) => {
 
 export default AppEventCard;
 
-const TempWrapper = styled.div`
-  margin-top: -3px;
-`;
-
-const ViewDetailsButton = styled.div<{ width?: string }>`
-  border-radius: 5px;
-  height: 30px;
-  font-size: 13px;
-  color: white;
-  display: flex;
-  align-items: center;
-  padding: 0px 10px;
-  background: #ffffff11;
-  border: 1px solid #aaaabb33;
-  cursor: pointer;
-  :hover {
-    border: 1px solid #7a7b80;
-  }
-`;

+ 15 - 0
internal/repository/gorm/porter_app_event.go

@@ -123,3 +123,18 @@ func (repo *PorterAppEventRepository) ReadEvent(ctx context.Context, id uuid.UUI
 
 	return appEvent, nil
 }
+
+func (repo *PorterAppEventRepository) FindDeployEventByRevision(ctx context.Context, porterAppID uint, revision float64) (models.PorterAppEvent, error) {
+	appEvent := models.PorterAppEvent{}
+
+	id := strconv.Itoa(int(porterAppID))
+	if id == "" {
+		return appEvent, errors.New("invalid porter app id supplied")
+	}
+
+	if err := repo.db.Where("porter_app_id = ? AND type = 'DEPLOY' AND metadata ->> 'revision' = ?", id, revision).First(&appEvent).Error; err != nil {
+		return appEvent, err
+	}
+
+	return appEvent, nil
+}