@@ -4,6 +4,7 @@ import { useParams } from "react-router";
44import { useAgenticDispatch } from "../../../../containers/Agentic/hooks" ;
55import { useGetIncidentQuery } from "../../../../redux/services/digma" ;
66import { setIncidentToClose } from "../../../../redux/slices/incidentsSlice" ;
7+ import { intersperse } from "../../../../utils/intersperse" ;
78import { Tooltip } from "../../../common/v3/Tooltip" ;
89import { Divider } from "./Divider" ;
910import * as s from "./styles" ;
@@ -47,25 +48,25 @@ export const IncidentMetaData = () => {
4748 return < s . Container /> ;
4849 }
4950
50- return (
51- < s . Container >
52- < s . AttributesList >
53- { data . status_timestamps . active && (
54- < s . Attribute >
55- < s . AttributeLabel > Incident start time:</ s . AttributeLabel >
56- < Tooltip title = { new Date ( data . status_timestamps . active ) . toString ( ) } >
57- < s . AttributeValue >
58- { format ( data . status_timestamps . active , DATE_FORMAT ) }
59- </ s . AttributeValue >
60- </ Tooltip >
61- </ s . Attribute >
62- ) }
63- { data . status_timestamps . closed && (
64- < >
65- < s . DividerContainer >
66- < Divider color = { "currentColor" } />
67- </ s . DividerContainer >
68- < s . Attribute >
51+ const attributes = intersperse (
52+ [
53+ ... ( data . status_timestamps . active
54+ ? [
55+ < s . Attribute key = { "start-time" } >
56+ < s . AttributeLabel > Incident start time:</ s . AttributeLabel >
57+ < Tooltip
58+ title = { new Date ( data . status_timestamps . active ) . toString ( ) }
59+ >
60+ < s . AttributeValue >
61+ { format ( data . status_timestamps . active , DATE_FORMAT ) }
62+ </ s . AttributeValue >
63+ </ Tooltip >
64+ </ s . Attribute >
65+ ]
66+ : [ ] ) ,
67+ ... ( data . status_timestamps . closed
68+ ? [
69+ < s . Attribute key = { "close-time" } >
6970 < s . AttributeLabel > Incident close time:</ s . AttributeLabel >
7071 < Tooltip
7172 title = { new Date ( data . status_timestamps . closed ) . toString ( ) }
@@ -75,14 +76,11 @@ export const IncidentMetaData = () => {
7576 </ s . AttributeValue >
7677 </ Tooltip >
7778 </ s . Attribute >
78- </ >
79- ) }
80- { data . affected_services . length > 0 && (
81- < >
82- < s . DividerContainer >
83- < Divider color = { "currentColor" } />
84- </ s . DividerContainer >
85- < s . ServicesContainer >
79+ ]
80+ : [ ] ) ,
81+ ...( data . affected_services . length > 0
82+ ? [
83+ < s . ServicesContainer key = { "affected-services" } >
8684 < span > Affected services:</ span >
8785 { serviceTagsToShow . map ( ( x ) => (
8886 < Tooltip key = { x } title = { x } >
@@ -97,16 +95,23 @@ export const IncidentMetaData = () => {
9795 </ Tooltip >
9896 ) }
9997 </ s . ServicesContainer >
100- </ >
101- ) }
102- < s . DividerContainer >
103- < Divider color = { "currentColor" } />
104- </ s . DividerContainer >
105- < s . Attribute >
106- < s . AttributeLabel > Status:</ s . AttributeLabel >
107- < s . StatusAttributeValue > { data . status } </ s . StatusAttributeValue >
108- </ s . Attribute >
109- </ s . AttributesList >
98+ ]
99+ : [ ] ) ,
100+ < s . Attribute key = { "status" } >
101+ < s . AttributeLabel > Status:</ s . AttributeLabel >
102+ < s . StatusAttributeValue > { data . status } </ s . StatusAttributeValue >
103+ </ s . Attribute >
104+ ] ,
105+ ( i ) => (
106+ < s . DividerContainer key = { `separator-${ i } ` } >
107+ < Divider color = { "currentColor" } />
108+ </ s . DividerContainer >
109+ )
110+ ) ;
111+
112+ return (
113+ < s . Container >
114+ < s . AttributesList > { attributes } </ s . AttributesList >
110115 { data . status === "pending" && (
111116 < s . CloseIncidentButton
112117 label = { "Close incident" }
0 commit comments