Merge branch 'feature/new_logo' into 'dev'

new logo, table status filter, disable take to work if updating data

See merge request spatial/postamates_frontend!43
dev
Anton Vlasov 2 years ago
commit aeaf90f136

BIN
dist/favicon.ico vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

@ -11,7 +11,6 @@ import { LAYER_IDS } from "./constants";
import { RANGE_FILTERS_KEYS, usePendingPointsFilters } from "../../stores/usePendingPointsFilters"; import { RANGE_FILTERS_KEYS, usePendingPointsFilters } from "../../stores/usePendingPointsFilters";
import { fieldHasChanged, predictionHasChanged } from "../../utils.js"; import { fieldHasChanged, predictionHasChanged } from "../../utils.js";
import { useSourceLayerName } from "../../api.js"; import { useSourceLayerName } from "../../api.js";
import { useMode } from "../../stores/useMode.js";
const rawStatusExpression = ["==", ["get", "status"], STATUSES.pending]; const rawStatusExpression = ["==", ["get", "status"], STATUSES.pending];
@ -19,7 +18,6 @@ const useFilterExpression = () => {
const { filters, ranges } = usePendingPointsFilters(); const { filters, ranges } = usePendingPointsFilters();
const { prediction, categories, region } = filters; const { prediction, categories, region } = filters;
const { selection } = usePointSelection(); const { selection } = usePointSelection();
const { isImportMode } = useMode();
const includedArr = [...selection.included]; const includedArr = [...selection.included];
const excludedArr = [...selection.excluded]; const excludedArr = [...selection.excluded];
@ -50,7 +48,7 @@ const useFilterExpression = () => {
? ["in", ["get", "category"], ["literal", categories]] ? ["in", ["get", "category"], ["literal", categories]]
: true; : true;
const statusExpression = isImportMode ? true : rawStatusExpression; const statusExpression = rawStatusExpression;
const predictionExpression = predictionHasChanged(filters, ranges) ? rawPredictionExpression : [true]; const predictionExpression = predictionHasChanged(filters, ranges) ? rawPredictionExpression : [true];
const matchFilterExpression = [ const matchFilterExpression = [

@ -21,7 +21,7 @@ const LegendPointItem = ({color, imageSrc, name, hideImage, border}) => {
/> />
)} )}
{!imageSrc && !color && !hideImage && ( {!imageSrc && !color && !hideImage && (
<Logo width={12} height={12} fill="#E63941"/> <Logo width={12} height={12} />
)} )}
<span className='text-xs text-grey'>{name}</span> <span className='text-xs text-grey'>{name}</span>

@ -26,7 +26,7 @@ export const useDbTableName = () => {
export const useSourceLayerName = () => { export const useSourceLayerName = () => {
const {isImportMode} = useMode(); const {isImportMode} = useMode();
if (isImportMode) return "public.service_preplacementpoint"; if (isImportMode) return "public.prepoints_with_dist";
return "public.points_with_dist"; return "public.points_with_dist";
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

@ -1,24 +1,8 @@
export const Logo = ({ width = 40, height = 40, fill }) => { import logo from "../assets/logopng.png";
export const Logo = ({ width = 40, height = 40 }) => {
return ( return (
<svg <img width={width} height={height} src={logo} alt={"logo"}/>
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width={width}
height={height}
>
<g>
<polygon
style={{ fill: fill ?? "#3B555E" }}
points="19.6,24 21.4,24 22.5,23.9 23,23.8 23.5,23.4 23.8,22.9 24,22.3 24,20.4 24,1.9 23.9,1.4 23.6,0.8
23.3,0.4 22.9,0.1 22.3,0 14.2,0 8.9,0 11.2,4.6 19.5,4.5 19.6,4.5 "
/>
<polygon
style={{ fill: fill ?? "#E63941" }}
points="13.6,6.4 17.7,6.4 16.2,9.4 14.1,14.2 12.3,18.4 11.7,18.4 9.8,14.5 6.8,8.8 4.5,4.5 4.7,23.9 1.7,24
1,23.8 0.5,23.2 0.2,22.7 0,22.1 0,1.8 0.1,1.3 0.4,0.8 0.8,0.4 1.1,0.2 1.4,0.1 2,0.1 7,0.1 11.9,10.6 "
/>
</g>
</svg>
); );
}; };

@ -2,11 +2,16 @@ import { Alert, Button, Modal, Spin } from "antd";
import { useQueryClient } from "@tanstack/react-query"; import { useQueryClient } from "@tanstack/react-query";
import { usePointSelection } from "../../../stores/usePointSelection"; import { usePointSelection } from "../../../stores/usePointSelection";
import { STATUSES } from "../../../config"; import { STATUSES } from "../../../config";
import { useState } from "react"; import { useMemo, useState } from "react";
import { useUpdateStatus } from "../../../hooks/useUpdateStatus"; import { useUpdateStatus } from "../../../hooks/useUpdateStatus";
import { ArrowRightOutlined } from "@ant-design/icons"; import { ArrowRightOutlined } from "@ant-design/icons";
import { Title } from "../../../components/Title"; import { Title } from "../../../components/Title";
import { usePendingPointsFilters } from "../../../stores/usePendingPointsFilters"; import { usePendingPointsFilters } from "../../../stores/usePendingPointsFilters";
import { useLastMLRun } from "../../../api.js";
const TASK_STATUSES = {
finished: "Завершено"
}
export const TakeToWorkButton = ({ disabled }) => { export const TakeToWorkButton = ({ disabled }) => {
const { filters } = usePendingPointsFilters(); const { filters } = usePendingPointsFilters();
@ -14,6 +19,11 @@ export const TakeToWorkButton = ({ disabled }) => {
const { selection } = usePointSelection(); const { selection } = usePointSelection();
const queryClient = useQueryClient(); const queryClient = useQueryClient();
const [isModalOpened, setIsModalOpened] = useState(false); const [isModalOpened, setIsModalOpened] = useState(false);
const { data: statusData } = useLastMLRun();
const disableButton = useMemo(() => {
return statusData?.task_status !== TASK_STATUSES.finished
}, [statusData])
const { const {
mutate: updateStatus, mutate: updateStatus,
@ -79,7 +89,7 @@ export const TakeToWorkButton = ({ disabled }) => {
block block
className={"mt-2"} className={"mt-2"}
onClick={() => setIsModalOpened(true)} onClick={() => setIsModalOpened(true)}
disabled={disabled} disabled={disabled || disableButton}
> >
<span className="mr-1">Взять в работу</span> <span className="mr-1">Взять в работу</span>
<ArrowRightOutlined /> <ArrowRightOutlined />

@ -27,7 +27,7 @@ export const usePendingTableData = (page, resetPage, pageSize, setPageSize, sort
}); });
appendFiltersInUse(params, filters, ranges); appendFiltersInUse(params, filters, ranges);
if (!isImportMode) params.append("status[]", STATUSES.pending) if (!isImportMode) params.append("status[]", [STATUSES.pending, STATUSES.cancelled].join(","))
return params; return params;
} }

Loading…
Cancel
Save