|
1 | 1 | importtype{CSSObject,Interpolation,Theme}from"@emotion/react";
|
| 2 | +importInfoOutlinedfrom"@mui/icons-material/InfoOutlined"; |
2 | 3 | importCollapsefrom"@mui/material/Collapse";
|
3 | 4 | importLinkfrom"@mui/material/Link";
|
4 | 5 | importTableCellfrom"@mui/material/TableCell";
|
| 6 | +importTooltipfrom"@mui/material/Tooltip"; |
5 | 7 | import{typeFC,useState}from"react";
|
6 | 8 | import{LinkasRouterLink}from"react-router-dom";
|
7 | 9 | importuserAgentParserfrom"ua-parser-js";
|
@@ -115,42 +117,80 @@ export const AuditLogRow: FC<AuditLogRowProps> = ({
|
115 | 117 | </Stack>
|
116 | 118 |
|
117 | 119 | <Stackdirection="row"alignItems="center">
|
118 |
| -<Stackdirection="row"spacing={1}alignItems="baseline"> |
119 |
| -{auditLog.ip&&( |
120 |
| -<spancss={styles.auditLogInfo}> |
121 |
| -<>IP:</> |
122 |
| -<strong>{auditLog.ip}</strong> |
123 |
| -</span> |
124 |
| -)} |
125 |
| -{os.name&&( |
126 |
| -<spancss={styles.auditLogInfo}> |
127 |
| -<>OS:</> |
128 |
| -<strong>{os.name}</strong> |
129 |
| -</span> |
130 |
| -)} |
131 |
| -{browser.name&&( |
132 |
| -<spancss={styles.auditLogInfo}> |
133 |
| -<>Browser:</> |
134 |
| -<strong> |
135 |
| -{browser.name}{browser.version} |
136 |
| -</strong> |
137 |
| -</span> |
138 |
| -)} |
139 |
| -{showOrgDetails&&auditLog.organization&&( |
140 |
| -<spancss={styles.auditLogInfo}> |
141 |
| -<>Org:</> |
142 |
| -<Link |
143 |
| -component={RouterLink} |
144 |
| -to={`/organizations/${auditLog.organization.name}`} |
145 |
| -> |
| 120 | +{/* With multi-org, there is not enough space so show |
| 121 | + everything in a tooltip. */} |
| 122 | +{showOrgDetails ?( |
| 123 | +<Tooltip |
| 124 | +title={ |
| 125 | +<divcss={styles.auditLogInfoTooltip}> |
| 126 | +{auditLog.ip&&( |
| 127 | +<div> |
| 128 | +<h4css={styles.auditLogInfoHeader}>IP:</h4> |
| 129 | +<div>{auditLog.ip}</div> |
| 130 | +</div> |
| 131 | +)} |
| 132 | +{os.name&&( |
| 133 | +<div> |
| 134 | +<h4css={styles.auditLogInfoHeader}>OS:</h4> |
| 135 | +<div>{os.name}</div> |
| 136 | +</div> |
| 137 | +)} |
| 138 | +{browser.name&&( |
| 139 | +<div> |
| 140 | +<h4css={styles.auditLogInfoHeader}>Browser:</h4> |
| 141 | +<div> |
| 142 | +{browser.name}{browser.version} |
| 143 | +</div> |
| 144 | +</div> |
| 145 | +)} |
| 146 | +{auditLog.organization&&( |
| 147 | +<div> |
| 148 | +<h4css={styles.auditLogInfoHeader}> |
| 149 | + Organization: |
| 150 | +</h4> |
| 151 | +<Link |
| 152 | +component={RouterLink} |
| 153 | +to={`/organizations/${auditLog.organization.name}`} |
| 154 | +> |
| 155 | +{auditLog.organization.display_name|| |
| 156 | +auditLog.organization.name} |
| 157 | +</Link> |
| 158 | +</div> |
| 159 | +)} |
| 160 | +</div> |
| 161 | +} |
| 162 | +> |
| 163 | +<InfoOutlined |
| 164 | +css={(theme)=>({ |
| 165 | +fontSize:20, |
| 166 | +color:theme.palette.info.light, |
| 167 | +})} |
| 168 | +/> |
| 169 | +</Tooltip> |
| 170 | +) :( |
| 171 | +<Stackdirection="row"spacing={1}alignItems="baseline"> |
| 172 | +{auditLog.ip&&( |
| 173 | +<spancss={styles.auditLogInfo}> |
| 174 | +<span>IP:</span> |
| 175 | +<strong>{auditLog.ip}</strong> |
| 176 | +</span> |
| 177 | +)} |
| 178 | +{os.name&&( |
| 179 | +<spancss={styles.auditLogInfo}> |
| 180 | +<span>OS:</span> |
| 181 | +<strong>{os.name}</strong> |
| 182 | +</span> |
| 183 | +)} |
| 184 | +{browser.name&&( |
| 185 | +<spancss={styles.auditLogInfo}> |
| 186 | +<span>Browser:</span> |
146 | 187 | <strong>
|
147 |
| -{auditLog.organization.display_name|| |
148 |
| -auditLog.organization.name} |
| 188 | +{browser.name}{browser.version} |
149 | 189 | </strong>
|
150 |
| -</Link> |
151 |
| -</span> |
152 |
| -)} |
153 |
| -</Stack> |
| 190 | +</span> |
| 191 | +)} |
| 192 | +</Stack> |
| 193 | +)} |
154 | 194 |
|
155 | 195 | <Pill
|
156 | 196 | css={styles.httpStatusPill}
|
@@ -212,6 +252,20 @@ const styles = {
|
212 | 252 | display:"block",
|
213 | 253 | }),
|
214 | 254 |
|
| 255 | +auditLogInfoHeader:(theme)=>({ |
| 256 | +margin:0, |
| 257 | +color:theme.palette.text.primary, |
| 258 | +fontSize:14, |
| 259 | +lineHeight:"150%", |
| 260 | +fontWeight:600, |
| 261 | +}), |
| 262 | + |
| 263 | +auditLogInfoTooltip:{ |
| 264 | +display:"flex", |
| 265 | +flexDirection:"column", |
| 266 | +gap:8, |
| 267 | +}, |
| 268 | + |
215 | 269 | // offset the absence of the arrow icon on diff-less logs
|
216 | 270 | columnWithoutDiff:{
|
217 | 271 | marginLeft:"24px",
|
|