END-722 - map icons overlap

END-723 - update count on delete
END-724 - start ml styling
END-725 - legend styling
dev
RekHoto 2 years ago
parent 82e3cb8cab
commit 58f9fcb7b2

@ -1,21 +1,39 @@
import { useLastMLRun } from "../api.js"; import { startML, useLastMLRun } from "../api.js";
import {Button, Popover, Tooltip} from "antd"; import { Button, Popover, Spin, Tooltip } from "antd";
import {InfoCircleOutlined} from "@ant-design/icons"; import { InfoCircleOutlined } from "@ant-design/icons";
import { useMemo } from "react";
const TASK_STATUSES = {
finished: "Перерасчет ML завершен"
}
export function LastMLRun() { export function LastMLRun() {
const { data } = useLastMLRun(); const { data } = useLastMLRun();
const hasFinishedUpdate = useMemo(() => {
return data?.task_status === TASK_STATUSES.finished
}, [data]);
const lastMLRunRender = () => { const lastMLRunRender = () => {
return ( if (hasFinishedUpdate) return (
<> <>
<div className="text-xs text-grey z-10 bg-white-background rounded-xl p-2 space-y-3"> <div className="text-xs text-grey z-10 bg-white-background rounded-xl px-2 py-0.5 space-y-3">
Последний запуск: {new Date(data?.last_time).toLocaleString('ru-RU')} Последний запуск модели
</div> </div>
<div className="text-xs text-grey z-10 bg-white-background rounded-xl p-2 space-y-3"> <div className="text-xs text-grey z-10 bg-white-background rounded-xl px-2 py-0.5 space-y-3">
{data?.task_status} {new Date(data?.last_time).toLocaleString('ru-RU')}
</div> </div>
<Button type="text" className="flex items-center p-2 text-[#C50000] hover:text-[#C50000] text-xs" onClick={() => startML()}>
Обновить систему
</Button>
</> </>
); );
return (
<div className="flex items-center gap-2">
<div>Идет обновление системы...</div>
<Spin />
</div>
)
}; };
return ( return (
@ -23,6 +41,7 @@ export function LastMLRun() {
content={lastMLRunRender} content={lastMLRunRender}
trigger="click" trigger="click"
placement={"leftBottom"} placement={"leftBottom"}
color="#ffffff"
> >
<Tooltip title="Инфо"> <Tooltip title="Инфо">
<Button className="absolute bottom-[64px] right-[20px] flex items-center justify-center p-3"> <Button className="absolute bottom-[64px] right-[20px] flex items-center justify-center p-3">

@ -38,6 +38,8 @@ export const Layers = ({ postGroups, otherGroups }) => {
<SelectedRegion /> <SelectedRegion />
<Points />
<Source <Source
id="pvz" id="pvz"
type="vector" type="vector"
@ -69,9 +71,6 @@ export const Layers = ({ postGroups, otherGroups }) => {
); );
})} })}
</Source> </Source>
<Points />
</> </>
); );
}; };

@ -15,10 +15,12 @@ const LegendPointItem = ({color, imageSrc, name, hideImage, border}) => {
<div className="flex gap-2 items-center"> <div className="flex gap-2 items-center">
{imageSrc && <Image src={imageSrc} width={18} height={18} className='flex items-center' preview={false}/>} {imageSrc && <Image src={imageSrc} width={18} height={18} className='flex items-center' preview={false}/>}
{color && !imageSrc && ( {color && !imageSrc && (
<span <span className="w-4 h-[100%] flex items-center justify-center">
className={`rounded-xl w-3 h-3 inline-block ${border && "border-black border-[1px] border-solid"}`} <span
style={{backgroundColor: color}} className={`rounded-xl w-3 h-3 inline-block ${border && "border-black border-[1px] border-solid"}`}
/> style={{backgroundColor: color}}
/>
</span>
)} )}
{!imageSrc && !color && !hideImage && ( {!imageSrc && !color && !hideImage && (
<Logo width={18} height={18} /> <Logo width={18} height={18} />

@ -29,7 +29,6 @@ import {
RANGE_FILTERS_KEYS, RANGE_FILTERS_KEYS,
RANGE_FILTERS_MAP RANGE_FILTERS_MAP
} from "../stores/usePendingPointsFilters.js"; } from "../stores/usePendingPointsFilters.js";
import { StartML } from "./StartML.jsx";
export const MapComponent = () => { export const MapComponent = () => {
const mapRef = useRef(null); const mapRef = useRef(null);
@ -222,7 +221,6 @@ export const MapComponent = () => {
<Layers postGroups={filteredPostamatesGroups} otherGroups={filteredOtherGroups} /> <Layers postGroups={filteredPostamatesGroups} otherGroups={filteredOtherGroups} />
<Legend postGroups={filteredPostamatesGroups} otherGroups={filteredOtherGroups} /> <Legend postGroups={filteredPostamatesGroups} otherGroups={filteredOtherGroups} />
<StartML />
<LastMLRun /> <LastMLRun />
<SignOut /> <SignOut />
<LayersControl postGroups={filteredPostamatesGroups} otherGroups={filteredOtherGroups} /> <LayersControl postGroups={filteredPostamatesGroups} otherGroups={filteredOtherGroups} />

@ -1,14 +0,0 @@
import { Button, Tooltip } from "antd";
import { RxUpdate } from "react-icons/all.js";
import { startML } from "../api.js";
export const StartML = () => {
return (
<Tooltip title="Обновить данные">
<Button className="absolute bottom-[108px] right-[20px] flex items-center justify-center p-3" onClick={() => startML()}>
<RxUpdate className="w-4 h-4" />
</Button>
</Tooltip>
);
}

@ -6,6 +6,7 @@ import { RANGE_FILTERS_KEYS, usePendingPointsFilters } from "./stores/usePending
import { appendFiltersInUse } from "./utils.js"; import { appendFiltersInUse } from "./utils.js";
import { useMode } from "./stores/useMode.js"; import { useMode } from "./stores/useMode.js";
import { useMemo } from "react"; import { useMemo } from "react";
import { useUpdateLayerCounter } from "./stores/useUpdateLayerCounter.js";
export const BASE_URL = import.meta.env.VITE_API_URL; export const BASE_URL = import.meta.env.VITE_API_URL;
@ -103,8 +104,9 @@ export const importPoints = async (id) => {
export const useGetTotalInitialPointsCount = () => { export const useGetTotalInitialPointsCount = () => {
const { isImportMode } = useMode(); const { isImportMode } = useMode();
const dbTable = useDbTableName(); const dbTable = useDbTableName();
const { updateCounter } = useUpdateLayerCounter();
return useQuery( return useQuery(
["all-initial-count", dbTable], ["all-initial-count", dbTable, updateCounter],
async () => { async () => {
const params = new URLSearchParams({ const params = new URLSearchParams({
page: 1, page: 1,
@ -121,6 +123,7 @@ export const useGetTotalInitialPointsCount = () => {
export const useGetFilteredPendingPointsCount = (isMerge) => { export const useGetFilteredPendingPointsCount = (isMerge) => {
const { filters, ranges } = usePendingPointsFilters(); const { filters, ranges } = usePendingPointsFilters();
const { isImportMode } = useMode(); const { isImportMode } = useMode();
const { updateCounter } = useUpdateLayerCounter();
const { const {
categories, categories,
region, region,
@ -153,7 +156,7 @@ export const useGetFilteredPendingPointsCount = (isMerge) => {
const dbTable = useDbTableName(); const dbTable = useDbTableName();
return useQuery( return useQuery(
["filtered-points", filters, dbTable, includedIds], ["filtered-points", filters, dbTable, includedIds, updateCounter],
async () => { async () => {
const params = isMerge ? getMergeParams() : getParams(); const params = isMerge ? getMergeParams() : getParams();
@ -214,7 +217,7 @@ export const useCanEdit = () => {
const hasFinishedUpdate = useMemo(() => { const hasFinishedUpdate = useMemo(() => {
return statusData?.task_status === TASK_STATUSES.finished return statusData?.task_status === TASK_STATUSES.finished
}, [statusData]) }, [statusData]);
return data === "editor" && hasFinishedUpdate; return data === "editor" && hasFinishedUpdate;
}; };

Loading…
Cancel
Save