feat: testing mode banner + snapshot storage fields fix
This commit is contained in:
@@ -6,6 +6,7 @@ import { observer } from "mobx-react-lite";
|
||||
export const PreviewLeftWidget = observer(() => {
|
||||
const { articleMedia, articleData } = articlesStore;
|
||||
const { language } = languageStore;
|
||||
const body = articleData?.[language]?.body;
|
||||
|
||||
return (
|
||||
<Paper
|
||||
@@ -66,7 +67,7 @@ export const PreviewLeftWidget = observer(() => {
|
||||
{articleData?.[language]?.heading || "Название информации"}
|
||||
</Typography>
|
||||
</Box>
|
||||
{articleData?.[language]?.body && (
|
||||
{body && (
|
||||
<Box
|
||||
sx={{
|
||||
padding: 1,
|
||||
@@ -77,7 +78,7 @@ export const PreviewLeftWidget = observer(() => {
|
||||
flexGrow: 1,
|
||||
}}
|
||||
>
|
||||
<ReactMarkdownComponent value={articleData?.[language]?.body} />
|
||||
<ReactMarkdownComponent value={body} />
|
||||
</Box>
|
||||
)}
|
||||
</Paper>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import {
|
||||
Button,
|
||||
Paper,
|
||||
TextField,
|
||||
Select,
|
||||
MenuItem,
|
||||
@@ -52,6 +51,7 @@ export const RouteCreatePage = observer(() => {
|
||||
const [turn, setTurn] = useState("");
|
||||
const [centerLat, setCenterLat] = useState("");
|
||||
const [centerLng, setCenterLng] = useState("");
|
||||
const [videoTimer, setVideoTimer] = useState(60);
|
||||
const [videoPreview, setVideoPreview] = useState<string>("");
|
||||
const [icon, setIcon] = useState<string>("");
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
@@ -279,6 +279,7 @@ export const RouteCreatePage = observer(() => {
|
||||
path,
|
||||
video_preview: !isMediaIdEmpty(videoPreview) ? videoPreview : undefined,
|
||||
icon: !isMediaIdEmpty(icon) ? icon : undefined,
|
||||
video_timer: videoTimer,
|
||||
};
|
||||
|
||||
if (governor_appeal !== undefined) {
|
||||
@@ -301,7 +302,7 @@ export const RouteCreatePage = observer(() => {
|
||||
);
|
||||
|
||||
return (
|
||||
<Paper className="w-full h-full p-3 flex flex-col gap-10">
|
||||
<div className="w-full h-full p-3 flex flex-col gap-10">
|
||||
<div className="flex items-center gap-4">
|
||||
<button
|
||||
className="flex items-center gap-2"
|
||||
@@ -375,6 +376,7 @@ export const RouteCreatePage = observer(() => {
|
||||
}
|
||||
placeholder="55.7558 37.6173 55.7539 37.6208"
|
||||
sx={{
|
||||
mt: 1,
|
||||
"& .MuiInputBase-root": {
|
||||
maxHeight: "500px",
|
||||
overflow: "auto",
|
||||
@@ -383,7 +385,6 @@ export const RouteCreatePage = observer(() => {
|
||||
fontFamily: "monospace",
|
||||
fontSize: "0.8rem",
|
||||
lineHeight: "1.2",
|
||||
padding: "8px 12px",
|
||||
},
|
||||
"& .MuiFormHelperText-root": {
|
||||
fontSize: "0.75rem",
|
||||
@@ -552,6 +553,18 @@ export const RouteCreatePage = observer(() => {
|
||||
value={centerLng}
|
||||
onChange={(e) => setCenterLng(e.target.value)}
|
||||
/>
|
||||
<TextField
|
||||
className="w-full"
|
||||
label="Таймер видео (сек)"
|
||||
type="number"
|
||||
value={videoTimer}
|
||||
onChange={(e) => {
|
||||
const val = Math.max(1, Math.round(Number(e.target.value)));
|
||||
if (Number.isFinite(val)) {
|
||||
setVideoTimer(val);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
<div className="flex w-full justify-end">
|
||||
<Button
|
||||
@@ -641,6 +654,6 @@ export const RouteCreatePage = observer(() => {
|
||||
onClose={() => setIsPreviewIconOpen(false)}
|
||||
mediaId={previewIconId}
|
||||
/>
|
||||
</Paper>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import {
|
||||
Button,
|
||||
Paper,
|
||||
TextField,
|
||||
Select,
|
||||
MenuItem,
|
||||
@@ -293,7 +292,7 @@ export const RouteEditPage = observer(() => {
|
||||
}
|
||||
|
||||
return (
|
||||
<Paper className="w-full h-full p-3 flex flex-col gap-10">
|
||||
<div className="w-full h-full p-3 flex flex-col gap-10">
|
||||
<div className="flex items-center gap-4">
|
||||
<button
|
||||
className="flex items-center gap-2"
|
||||
@@ -403,6 +402,7 @@ export const RouteEditPage = observer(() => {
|
||||
}
|
||||
placeholder="55.7558 37.6173 55.7539 37.6208"
|
||||
sx={{
|
||||
mt: 1,
|
||||
"& .MuiInputBase-root": {
|
||||
maxHeight: "500px",
|
||||
overflow: "auto",
|
||||
@@ -411,7 +411,6 @@ export const RouteEditPage = observer(() => {
|
||||
fontFamily: "monospace",
|
||||
fontSize: "0.8rem",
|
||||
lineHeight: "1.2",
|
||||
padding: "8px 12px",
|
||||
},
|
||||
"& .MuiFormHelperText-root": {
|
||||
fontSize: "0.75rem",
|
||||
@@ -547,6 +546,18 @@ export const RouteEditPage = observer(() => {
|
||||
})
|
||||
}
|
||||
/>
|
||||
<TextField
|
||||
className="w-full"
|
||||
label="Таймер видео (сек)"
|
||||
type="number"
|
||||
value={editRouteData.video_timer ?? 60}
|
||||
onChange={(e) => {
|
||||
const val = Math.max(1, Math.round(Number(e.target.value)));
|
||||
if (Number.isFinite(val)) {
|
||||
routeStore.setEditRouteData({ video_timer: val });
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
<Typography variant="subtitle1" sx={{ fontWeight: 600 }}>
|
||||
Обращение к пассажирам
|
||||
@@ -743,6 +754,6 @@ export const RouteEditPage = observer(() => {
|
||||
onCancel={() => setIsDeleteIconModalOpen(false)}
|
||||
edit
|
||||
/>
|
||||
</Paper>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -47,8 +47,8 @@ export const SnapshotListPage = observer(() => {
|
||||
pageSize: 50,
|
||||
});
|
||||
|
||||
const availableGB = storageInfo ? storageInfo.available_memory : null;
|
||||
const totalGB = storageInfo ? storageInfo.all_memory : null;
|
||||
const availableGB = storageInfo ? storageInfo.available_disk_space_gb : null;
|
||||
const totalGB = storageInfo ? storageInfo.total_disk_space_gb : null;
|
||||
const usedGB =
|
||||
totalGB !== null && availableGB !== null ? totalGB - availableGB : null;
|
||||
const isLowStorage =
|
||||
@@ -91,7 +91,7 @@ export const SnapshotListPage = observer(() => {
|
||||
},
|
||||
},
|
||||
{
|
||||
field: "occupied_memory",
|
||||
field: "occupied_disk_space_gb",
|
||||
headerName: "Размер",
|
||||
width: 120,
|
||||
renderCell: (params: GridRenderCellParams) => {
|
||||
@@ -151,12 +151,12 @@ export const SnapshotListPage = observer(() => {
|
||||
name: snapshot.Name,
|
||||
parent: snapshots.find((s) => s.ID === snapshot.ParentID)?.Name,
|
||||
created_at: formatCreationTime(snapshot.CreationTime),
|
||||
occupied_memory: snapshot.occupied_memory,
|
||||
occupied_disk_space_gb: snapshot.occupied_disk_space_gb,
|
||||
}));
|
||||
}, [snapshots, searchQuery]);
|
||||
|
||||
const snapshotsGB = rows.reduce(
|
||||
(sum, row) => sum + (row.occupied_memory ?? 0),
|
||||
(sum, row) => sum + (row.occupied_disk_space_gb ?? 0),
|
||||
0,
|
||||
);
|
||||
const systemGB = usedGB !== null ? Math.max(0, usedGB - snapshotsGB) : null;
|
||||
@@ -175,7 +175,7 @@ export const SnapshotListPage = observer(() => {
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
{usedGB !== null && totalGB !== null && (
|
||||
{usedGB != null && totalGB != null && (
|
||||
<div className="bg-white rounded-2xl p-5 mb-6 shadow-sm border border-gray-100">
|
||||
<div className="flex items-baseline gap-3 mb-3">
|
||||
<span className="text-lg font-semibold">Хранилище</span>
|
||||
@@ -187,8 +187,8 @@ export const SnapshotListPage = observer(() => {
|
||||
<div className="flex w-full h-3 rounded-lg overflow-hidden bg-gray-100">
|
||||
{rows.map((row, i) => {
|
||||
const pct =
|
||||
row.occupied_memory != null && totalGB > 0
|
||||
? (row.occupied_memory / totalGB) * 100
|
||||
row.occupied_disk_space_gb != null && totalGB > 0
|
||||
? (row.occupied_disk_space_gb / totalGB) * 100
|
||||
: 0;
|
||||
if (pct <= 0) return null;
|
||||
return (
|
||||
@@ -199,7 +199,7 @@ export const SnapshotListPage = observer(() => {
|
||||
backgroundColor:
|
||||
SEGMENT_COLORS[i % SEGMENT_COLORS.length],
|
||||
}}
|
||||
title={`${row.name}: ${row.occupied_memory?.toFixed(1)} ГБ`}
|
||||
title={`${row.name}: ${row.occupied_disk_space_gb?.toFixed(1)} ГБ`}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
@@ -216,7 +216,7 @@ export const SnapshotListPage = observer(() => {
|
||||
|
||||
<div className="flex flex-wrap gap-x-5 gap-y-1 mt-3">
|
||||
{rows.map((row, i) => {
|
||||
if (row.occupied_memory == null || row.occupied_memory <= 0)
|
||||
if (row.occupied_disk_space_gb == null || row.occupied_disk_space_gb <= 0)
|
||||
return null;
|
||||
return (
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user