add link from alarm summary to installation itself
This commit is contained in:
parent
aefeb75641
commit
bf0aa4d959
|
|
@ -270,6 +270,39 @@ function Report() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Deep-link to an installation's Log tab (mirrors the Ticket detail navigation).
|
||||||
|
const openInstallationLog = (product: number, installationId: number) => {
|
||||||
|
const productRoutes: Record<number, string> = {
|
||||||
|
0: routes.installations,
|
||||||
|
1: routes.salidomo_installations,
|
||||||
|
2: routes.sodiohome_installations,
|
||||||
|
3: routes.sodistore_installations,
|
||||||
|
4: routes.sodistoregrid_installations,
|
||||||
|
5: routes.sodistorepro_installations
|
||||||
|
};
|
||||||
|
const prefix = productRoutes[product] ?? routes.installations;
|
||||||
|
navigate(prefix + routes.list + routes.installation + installationId + '/' + routes.log);
|
||||||
|
};
|
||||||
|
|
||||||
|
const installationCell = (name: string, product: number, installationId: number) => (
|
||||||
|
<TableCell>
|
||||||
|
<Typography
|
||||||
|
variant="body2"
|
||||||
|
onClick={() => openInstallationLog(product, installationId)}
|
||||||
|
sx={{
|
||||||
|
color: 'primary.main',
|
||||||
|
cursor: 'pointer',
|
||||||
|
'&:hover': { textDecoration: 'underline' }
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{name}
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="caption" color="text.secondary">
|
||||||
|
{productLabel(product)}
|
||||||
|
</Typography>
|
||||||
|
</TableCell>
|
||||||
|
);
|
||||||
|
|
||||||
const severityIcon = (sev: 'error' | 'warning') =>
|
const severityIcon = (sev: 'error' | 'warning') =>
|
||||||
sev === 'error' ? (
|
sev === 'error' ? (
|
||||||
<ErrorIcon color="error" />
|
<ErrorIcon color="error" />
|
||||||
|
|
@ -640,12 +673,7 @@ function Report() {
|
||||||
)}
|
)}
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
{installationCell(g.installationName, g.product, g.installationId)}
|
||||||
<Typography variant="body2">{g.installationName}</Typography>
|
|
||||||
<Typography variant="caption" color="text.secondary">
|
|
||||||
{productLabel(g.product)}
|
|
||||||
</Typography>
|
|
||||||
</TableCell>
|
|
||||||
<TableCell>{deviceLabel(g.device)}</TableCell>
|
<TableCell>{deviceLabel(g.device)}</TableCell>
|
||||||
<TableCell>{alarmDisplayName(g.description)}</TableCell>
|
<TableCell>{alarmDisplayName(g.description)}</TableCell>
|
||||||
<TableCell align="center">{severityIcon(g.severity)}</TableCell>
|
<TableCell align="center">{severityIcon(g.severity)}</TableCell>
|
||||||
|
|
@ -682,12 +710,7 @@ function Report() {
|
||||||
))
|
))
|
||||||
: rawSorted.map((r) => (
|
: rawSorted.map((r) => (
|
||||||
<TableRow hover key={r.id}>
|
<TableRow hover key={r.id}>
|
||||||
<TableCell>
|
{installationCell(r.installationName, r.product, r.installationId)}
|
||||||
<Typography variant="body2">{r.installationName}</Typography>
|
|
||||||
<Typography variant="caption" color="text.secondary">
|
|
||||||
{productLabel(r.product)}
|
|
||||||
</Typography>
|
|
||||||
</TableCell>
|
|
||||||
<TableCell>{deviceLabel(r.device)}</TableCell>
|
<TableCell>{deviceLabel(r.device)}</TableCell>
|
||||||
<TableCell>{alarmDisplayName(r.description)}</TableCell>
|
<TableCell>{alarmDisplayName(r.description)}</TableCell>
|
||||||
<TableCell align="center">{severityIcon(r.severity)}</TableCell>
|
<TableCell align="center">{severityIcon(r.severity)}</TableCell>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue