ui fixes asked by support team

This commit is contained in:
2026-07-22 14:39:45 +05:30
parent c7c3d46c62
commit a76f92dbdd
2 changed files with 37 additions and 19 deletions

View File

@@ -29,8 +29,15 @@ export const PreviewPanel: React.FC = () => {
: "https://auditor-master-images.seekright.com/SeekRight/"; : "https://auditor-master-images.seekright.com/SeekRight/";
const IMAGES_TEST_AUDIT_PREFIX = "https://dashboard-images.seekright.com/SeekRight/"; const IMAGES_TEST_AUDIT_PREFIX = "https://dashboard-images.seekright.com/SeekRight/";
// Linear rectification has no master image; show the open defect's most
// recent detection frame (recent_image from the anomaly table) as the
// left-side reference instead.
const showingRecentImage = !!(isRectActive && anomaly.Algorithm === 'linear' && anomaly.recent_image);
let masterImageSrc = ''; let masterImageSrc = '';
if (anomaly.Frame_Master) { if (showingRecentImage) {
masterImageSrc = IMAGES_TEST_AUDIT_PREFIX + anomaly.recent_image;
} else if (anomaly.Frame_Master) {
masterImageSrc = IMAGES_AWS_PREFIX + anomaly.Frame_Master; masterImageSrc = IMAGES_AWS_PREFIX + anomaly.Frame_Master;
} else if (!anomaly.Frame_Master && !anomaly.Frame_Test) { } else if (!anomaly.Frame_Master && !anomaly.Frame_Test) {
masterImageSrc = '/assets/images/master_and_shift_image_not_available.png'; masterImageSrc = '/assets/images/master_and_shift_image_not_available.png';
@@ -58,7 +65,7 @@ export const PreviewPanel: React.FC = () => {
}} }}
/> />
<Box sx={{ bgcolor: 'rgba(255,255,255,0.05)', color: 'text.primary', textAlign: 'center', py: 0.5 }}> <Box sx={{ bgcolor: 'rgba(255,255,255,0.05)', color: 'text.primary', textAlign: 'center', py: 0.5 }}>
<Typography variant="body2" sx={{ fontWeight: 'bold' }}>MASTER IMAGE</Typography> <Typography variant="body2" sx={{ fontWeight: 'bold' }}>{showingRecentImage ? 'RECENT IMAGE' : 'MASTER IMAGE'}</Typography>
</Box> </Box>
</Box> </Box>

View File

@@ -3,6 +3,7 @@ import { Box, Typography, Button, Chip, Switch, Dialog, DialogTitle, DialogConte
import { useNavigate, useLocation } from 'react-router-dom'; import { useNavigate, useLocation } from 'react-router-dom';
import ArrowBackIcon from '@mui/icons-material/ArrowBack'; import ArrowBackIcon from '@mui/icons-material/ArrowBack';
import { ZoomableImage } from './ZoomableImage'; import { ZoomableImage } from './ZoomableImage';
import { TEST_IMAGE_PREFIX } from '../../constants/media';
import SearchIcon from '@mui/icons-material/Search'; import SearchIcon from '@mui/icons-material/Search';
import { activityFeedsService } from '../../api/activityFeedsService'; import { activityFeedsService } from '../../api/activityFeedsService';
import { axiosClient } from '../../api/axiosClient'; import { axiosClient } from '../../api/axiosClient';
@@ -508,8 +509,15 @@ export const AuditSession: React.FC = () => {
let latStr = 'N/A'; let latStr = 'N/A';
let longStr = 'E/A'; let longStr = 'E/A';
// Linear rectification records have no master image; on the left, show the
// matching open defect's most recent detection frame (recent_image from the
// anomaly table, provided by the history query) as a "last seen" reference.
const showingRecentImage = !!(isRectActive && currentAnomaly?.Algorithm === 'linear' && currentAnomaly?.recent_image);
if (currentAnomaly) { if (currentAnomaly) {
if (currentAnomaly.Frame_Master) { if (showingRecentImage) {
masterImageSrc = TEST_IMAGE_PREFIX + currentAnomaly.recent_image;
} else if (currentAnomaly.Frame_Master) {
masterImageSrc = IMAGES_AWS_PREFIX + currentAnomaly.Frame_Master; masterImageSrc = IMAGES_AWS_PREFIX + currentAnomaly.Frame_Master;
} else if (!currentAnomaly.Frame_Master && !currentAnomaly.Frame_Test) { } else if (!currentAnomaly.Frame_Master && !currentAnomaly.Frame_Test) {
masterImageSrc = '/assets/images/master_and_shift_image_not_available.png'; masterImageSrc = '/assets/images/master_and_shift_image_not_available.png';
@@ -1627,7 +1635,7 @@ export const AuditSession: React.FC = () => {
{/* Previous Image Pane */} {/* Previous Image Pane */}
<Box sx={{ flex: 1, bgcolor: '#0f172a', borderRadius: 2, border: '1px solid #1e293b', overflow: 'hidden', display: 'flex', flexDirection: 'column' }}> <Box sx={{ flex: 1, bgcolor: '#0f172a', borderRadius: 2, border: '1px solid #1e293b', overflow: 'hidden', display: 'flex', flexDirection: 'column' }}>
<Box sx={{ px: 2, py: 1, borderBottom: '1px solid #1e293b', display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}> <Box sx={{ px: 2, py: 1, borderBottom: '1px solid #1e293b', display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<Typography sx={{ fontSize: '0.75rem', fontWeight: 'bold', color: '#94a3b8', letterSpacing: 1 }}>MASTER IMAGE</Typography> <Typography sx={{ fontSize: '0.75rem', fontWeight: 'bold', color: '#94a3b8', letterSpacing: 1 }}>{showingRecentImage ? 'RECENT IMAGE' : 'MASTER IMAGE'}</Typography>
</Box> </Box>
<Box sx={{ flex: 1, position: 'relative', overflow: 'hidden' }}> <Box sx={{ flex: 1, position: 'relative', overflow: 'hidden' }}>
{masterImageSrc ? ( {masterImageSrc ? (
@@ -1784,15 +1792,18 @@ export const AuditSession: React.FC = () => {
{/* Anomaly/Safe Toggle */} {/* Anomaly/Safe Toggle */}
<Box> <Box>
<Box sx={{ display: 'flex', justifyContent: 'space-between', mb: 1 }}> <Box sx={{ display: 'flex', justifyContent: 'space-between', mb: 1 }}>
<Typography sx={{ fontSize: '0.75rem', fontWeight: 'bold', color: '#94a3b8', letterSpacing: 1 }}>ANOMALY?</Typography> <Typography sx={{ fontSize: '0.75rem', fontWeight: 'bold', color: '#94a3b8', letterSpacing: 1 }}>{isRectActive ? 'RECTIFIED?' : 'ANOMALY?'}</Typography>
<Typography sx={{ fontSize: '0.75rem', color: '#64748b' }}>A / S</Typography> <Typography sx={{ fontSize: '0.75rem', color: '#64748b' }}>A / S</Typography>
</Box> </Box>
<Box sx={{ display: 'flex', gap: 1 }}> <Box sx={{ display: 'flex', gap: 1 }}>
{/* In rectification mode the verdict is "Rectified / Not Rectified":
A (isAnomaly=true) = Rectified (green), S (isAnomaly=false) =
Not Rectified (red). In audits mode it's Anomaly / Safe. */}
<Button <Button
fullWidth fullWidth
disabled={isLocked} disabled={isLocked}
variant={isAnomaly === true ? "contained" : "outlined"} variant={isAnomaly === true ? "contained" : "outlined"}
color={isAnomaly === true ? "error" : "inherit"} color={isAnomaly === true ? (isRectActive ? "success" : "error") : "inherit"}
onClick={() => setIsAnomaly(true)} onClick={() => setIsAnomaly(true)}
sx={{ sx={{
borderRadius: 2, borderRadius: 2,
@@ -1800,17 +1811,17 @@ export const AuditSession: React.FC = () => {
borderColor: '#334155', borderColor: '#334155',
color: isAnomaly === true ? 'white' : '#cbd5e1', color: isAnomaly === true ? 'white' : '#cbd5e1',
transition: 'all 0.15s ease', transition: 'all 0.15s ease',
border: activeKeyFlash === 'a' ? '2px solid #ef4444' : '1px solid #334155', border: activeKeyFlash === 'a' ? `2px solid ${isRectActive ? '#22c55e' : '#ef4444'}` : '1px solid #334155',
boxShadow: activeKeyFlash === 'a' ? '0 0 12px #ef4444' : 'none' boxShadow: activeKeyFlash === 'a' ? `0 0 12px ${isRectActive ? '#22c55e' : '#ef4444'}` : 'none'
}} }}
> >
Anomaly {isRectActive ? '✓ Rectified' : '⚠️ Anomaly'}
</Button> </Button>
<Button <Button
fullWidth fullWidth
disabled={isLocked} disabled={isLocked}
variant={isAnomaly === false ? "contained" : "outlined"} variant={isAnomaly === false ? "contained" : "outlined"}
color={isAnomaly === false ? "success" : "inherit"} color={isAnomaly === false ? (isRectActive ? "error" : "success") : "inherit"}
onClick={() => { onClick={() => {
setIsAnomaly(false); setIsAnomaly(false);
setSelectedCategory(null); setSelectedCategory(null);
@@ -1822,11 +1833,11 @@ export const AuditSession: React.FC = () => {
borderColor: '#334155', borderColor: '#334155',
color: isAnomaly === false ? 'white' : '#cbd5e1', color: isAnomaly === false ? 'white' : '#cbd5e1',
transition: 'all 0.15s ease', transition: 'all 0.15s ease',
border: activeKeyFlash === 's' ? '2px solid #22c55e' : '1px solid #334155', border: activeKeyFlash === 's' ? `2px solid ${isRectActive ? '#ef4444' : '#22c55e'}` : '1px solid #334155',
boxShadow: activeKeyFlash === 's' ? '0 0 12px #22c55e' : 'none' boxShadow: activeKeyFlash === 's' ? `0 0 12px ${isRectActive ? '#ef4444' : '#22c55e'}` : 'none'
}} }}
> >
Safe {isRectActive ? '⚠️ Not Rectified' : '✓ Safe'}
</Button> </Button>
</Box> </Box>
</Box> </Box>
@@ -2118,11 +2129,11 @@ export const AuditSession: React.FC = () => {
<> <>
<Box> <Box>
<Chip label="A" size="small" sx={{ height: 20, fontSize: '0.65rem', bgcolor: '#1e293b', color: '#cbd5e1' }} /> <Chip label="A" size="small" sx={{ height: 20, fontSize: '0.65rem', bgcolor: '#1e293b', color: '#cbd5e1' }} />
<Typography sx={{ fontSize: '0.75rem', color: '#94a3b8' }}>Anomaly</Typography> <Typography sx={{ fontSize: '0.75rem', color: '#94a3b8' }}>{isRectActive ? 'Rectified' : 'Anomaly'}</Typography>
</Box> </Box>
<Box> <Box>
<Chip label="S" size="small" sx={{ height: 20, fontSize: '0.65rem', bgcolor: '#1e293b', color: '#cbd5e1' }} /> <Chip label="S" size="small" sx={{ height: 20, fontSize: '0.65rem', bgcolor: '#1e293b', color: '#cbd5e1' }} />
<Typography sx={{ fontSize: '0.75rem', color: '#94a3b8' }}>Safe</Typography> <Typography sx={{ fontSize: '0.75rem', color: '#94a3b8' }}>{isRectActive ? 'Not Rectified' : 'Safe'}</Typography>
</Box> </Box>
<Box> <Box>
<Chip label={isRectActive ? "1-2" : "0-9"} size="small" sx={{ height: 20, fontSize: '0.65rem', bgcolor: '#1e293b', color: '#cbd5e1' }} /> <Chip label={isRectActive ? "1-2" : "0-9"} size="small" sx={{ height: 20, fontSize: '0.65rem', bgcolor: '#1e293b', color: '#cbd5e1' }} />
@@ -2363,20 +2374,20 @@ export const AuditSession: React.FC = () => {
<Button <Button
fullWidth fullWidth
variant={aaIsAnomaly ? 'contained' : 'outlined'} variant={aaIsAnomaly ? 'contained' : 'outlined'}
color={aaIsAnomaly ? 'error' : 'inherit'} color={aaIsAnomaly ? (isRectActive ? 'success' : 'error') : 'inherit'}
onClick={() => { setAaIsAnomaly(true); setAaCategory(null); setAaPlantSub(null); setAaNotAnAnomalySub(null); }} onClick={() => { setAaIsAnomaly(true); setAaCategory(null); setAaPlantSub(null); setAaNotAnAnomalySub(null); }}
sx={{ borderRadius: 2, textTransform: 'none', borderColor: '#334155', color: aaIsAnomaly ? 'white' : '#cbd5e1' }} sx={{ borderRadius: 2, textTransform: 'none', borderColor: '#334155', color: aaIsAnomaly ? 'white' : '#cbd5e1' }}
> >
Anomaly {isRectActive ? '✓ Rectified' : '⚠️ Anomaly'}
</Button> </Button>
<Button <Button
fullWidth fullWidth
variant={!aaIsAnomaly ? 'contained' : 'outlined'} variant={!aaIsAnomaly ? 'contained' : 'outlined'}
color={!aaIsAnomaly ? 'success' : 'inherit'} color={!aaIsAnomaly ? (isRectActive ? 'error' : 'success') : 'inherit'}
onClick={() => { setAaIsAnomaly(false); setAaCategory(null); setAaPlantSub(null); setAaNotAnAnomalySub(null); }} onClick={() => { setAaIsAnomaly(false); setAaCategory(null); setAaPlantSub(null); setAaNotAnAnomalySub(null); }}
sx={{ borderRadius: 2, textTransform: 'none', borderColor: '#334155', color: !aaIsAnomaly ? 'white' : '#cbd5e1' }} sx={{ borderRadius: 2, textTransform: 'none', borderColor: '#334155', color: !aaIsAnomaly ? 'white' : '#cbd5e1' }}
> >
Safe {isRectActive ? '⚠️ Not Rectified' : '✓ Safe'}
</Button> </Button>
</Box> </Box>