feat: big update 07.05.26
This commit is contained in:
@@ -628,41 +628,57 @@ export const DevicesTable = observer(() => {
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
{canWriteDevices && (
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
navigate(`/vehicle/${row.vehicle_id}/edit`);
|
||||
}}
|
||||
title="Редактировать транспорт"
|
||||
>
|
||||
<Pencil size={16} />
|
||||
</button>
|
||||
{!isMaintenanceOnly && (
|
||||
<>
|
||||
{canWriteDevices && (
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
navigate(`/vehicle/${row.vehicle_id}/edit`);
|
||||
}}
|
||||
title="Редактировать транспорт"
|
||||
>
|
||||
<Pencil size={16} />
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
handleReloadStatus();
|
||||
}}
|
||||
title="Перезапросить статус"
|
||||
disabled={
|
||||
!row.device_uuid || !devices.includes(row.device_uuid)
|
||||
}
|
||||
>
|
||||
<RotateCcw size={16} />
|
||||
</button>
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
if (row.device_uuid) {
|
||||
navigator.clipboard.writeText(row.device_uuid);
|
||||
toast.success("UUID скопирован");
|
||||
}
|
||||
}}
|
||||
title="Копировать UUID"
|
||||
>
|
||||
<Copy size={16} />
|
||||
</button>
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
if (row.device_uuid) {
|
||||
setLogsModalDeviceUuid(row.device_uuid);
|
||||
setLogsModalOpen(true);
|
||||
}
|
||||
}}
|
||||
title="Логи устройства"
|
||||
>
|
||||
<ScrollText size={16} />
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
handleReloadStatus();
|
||||
}}
|
||||
title="Перезапросить статус"
|
||||
disabled={
|
||||
!row.device_uuid || !devices.includes(row.device_uuid)
|
||||
}
|
||||
>
|
||||
<RotateCcw size={16} />
|
||||
</button>
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
if (row.device_uuid) {
|
||||
navigator.clipboard.writeText(row.device_uuid);
|
||||
toast.success("UUID скопирован");
|
||||
}
|
||||
}}
|
||||
title="Копировать UUID"
|
||||
>
|
||||
<Copy size={16} />
|
||||
</button>
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
@@ -674,18 +690,6 @@ export const DevicesTable = observer(() => {
|
||||
>
|
||||
<Wrench size={16} />
|
||||
</button>
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
if (row.device_uuid) {
|
||||
setLogsModalDeviceUuid(row.device_uuid);
|
||||
setLogsModalOpen(true);
|
||||
}
|
||||
}}
|
||||
title="Логи устройства"
|
||||
>
|
||||
<ScrollText size={16} />
|
||||
</button>
|
||||
</Box>
|
||||
);
|
||||
},
|
||||
@@ -714,9 +718,11 @@ export const DevicesTable = observer(() => {
|
||||
|
||||
const visibleColumns = useMemo(() => {
|
||||
if (isMaintenanceOnly) {
|
||||
return columns.filter((c) =>
|
||||
["model", "tail_number", "maintenance_mode_on"].includes(c.field),
|
||||
);
|
||||
return columns
|
||||
.filter((c) =>
|
||||
["model", "tail_number", "maintenance_mode_on", "actions"].includes(c.field),
|
||||
)
|
||||
.map((c) => ({ ...c, flex: 1, width: undefined, minWidth: undefined }));
|
||||
}
|
||||
if (!canWriteDevices) {
|
||||
return columns.filter(
|
||||
@@ -729,20 +735,26 @@ export const DevicesTable = observer(() => {
|
||||
useEffect(() => {
|
||||
const fetchData = async () => {
|
||||
setIsLoading(true);
|
||||
await Promise.all([
|
||||
getVehicles(),
|
||||
getDevices(),
|
||||
getSnapshots(),
|
||||
getRoutes(),
|
||||
]);
|
||||
if (isMaintenanceOnly) {
|
||||
await Promise.all([getVehicles(), getDevices()]);
|
||||
} else {
|
||||
await Promise.all([
|
||||
getVehicles(),
|
||||
getDevices(),
|
||||
getSnapshots(),
|
||||
getRoutes(),
|
||||
]);
|
||||
}
|
||||
setIsLoading(false);
|
||||
};
|
||||
fetchData();
|
||||
}, [getDevices, getSnapshots, getVehicles, getRoutes]);
|
||||
}, [getDevices, getSnapshots, getVehicles, getRoutes, isMaintenanceOnly]);
|
||||
|
||||
useEffect(() => {
|
||||
carrierStore.getCarriers("ru");
|
||||
}, []);
|
||||
if (!isMaintenanceOnly) {
|
||||
carrierStore.getCarriers("ru");
|
||||
}
|
||||
}, [isMaintenanceOnly]);
|
||||
|
||||
const handleOpenSendSnapshotModal = () => {
|
||||
if (!canWriteDevices) {
|
||||
|
||||
Reference in New Issue
Block a user