added revalidate btn
This commit is contained in:
@@ -378,15 +378,11 @@ export const MissionLayer = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const filteredMissions = useMemo(() => {
|
const filteredMissions = useMemo(() => {
|
||||||
if (!dispatcherConnected) {
|
|
||||||
return missions.filter((m: Mission) => {
|
return missions.filter((m: Mission) => {
|
||||||
m.state === "running";
|
if (m.state === "draft" && !dispatcherConnected) return false;
|
||||||
|
if (dispatchState.hideDraftMissions && m.state === "draft") return false;
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
}
|
|
||||||
if (dispatchState.hideDraftMissions) {
|
|
||||||
return missions.filter((m: Mission) => m.state !== "draft");
|
|
||||||
}
|
|
||||||
return missions;
|
|
||||||
}, [missions, dispatcherConnected, dispatchState.hideDraftMissions]);
|
}, [missions, dispatcherConnected, dispatchState.hideDraftMissions]);
|
||||||
|
|
||||||
// IDEA: Add Marker to Map Layer / LayerGroup
|
// IDEA: Add Marker to Map Layer / LayerGroup
|
||||||
|
|||||||
@@ -135,13 +135,14 @@ const PopupContent = ({
|
|||||||
|
|
||||||
export const MarkerCluster = () => {
|
export const MarkerCluster = () => {
|
||||||
const map = useMap();
|
const map = useMap();
|
||||||
|
const dispatchState = useDispatchConnectionStore((s) => s);
|
||||||
|
const dispatcherConnected = dispatchState.status === "connected";
|
||||||
const { data: aircrafts } = useQuery({
|
const { data: aircrafts } = useQuery({
|
||||||
queryKey: ["aircrafts"],
|
queryKey: ["aircrafts"],
|
||||||
queryFn: getConnectedAircraftsAPI,
|
queryFn: getConnectedAircraftsAPI,
|
||||||
refetchInterval: 10_000,
|
refetchInterval: 10_000,
|
||||||
});
|
});
|
||||||
|
|
||||||
const dispatcherConnected = useDispatchConnectionStore((s) => s.status) === "connected";
|
|
||||||
const { data: missions = [] } = useQuery({
|
const { data: missions = [] } = useQuery({
|
||||||
queryKey: ["missions"],
|
queryKey: ["missions"],
|
||||||
queryFn: () =>
|
queryFn: () =>
|
||||||
@@ -151,11 +152,12 @@ export const MarkerCluster = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const filteredMissions = useMemo(() => {
|
const filteredMissions = useMemo(() => {
|
||||||
if (!dispatcherConnected) {
|
return missions.filter((m: Mission) => {
|
||||||
return missions.filter((m: Mission) => m.state === "running");
|
if (m.state === "draft" && !dispatcherConnected) return false;
|
||||||
}
|
if (dispatchState.hideDraftMissions && m.state === "draft") return false;
|
||||||
return missions;
|
return true;
|
||||||
}, [missions, dispatcherConnected]);
|
});
|
||||||
|
}, [missions, dispatcherConnected, dispatchState.hideDraftMissions]);
|
||||||
|
|
||||||
// Track zoom level in state
|
// Track zoom level in state
|
||||||
const [zoom, setZoom] = useState(() => map.getZoom());
|
const [zoom, setZoom] = useState(() => map.getZoom());
|
||||||
|
|||||||
@@ -35,7 +35,12 @@ import {
|
|||||||
import { usePannelStore } from "_store/pannelStore";
|
import { usePannelStore } from "_store/pannelStore";
|
||||||
import { useSession } from "next-auth/react";
|
import { useSession } from "next-auth/react";
|
||||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
import { deleteMissionAPI, editMissionAPI, sendMissionAPI } from "_querys/missions";
|
import {
|
||||||
|
deleteMissionAPI,
|
||||||
|
editMissionAPI,
|
||||||
|
sendMissionAPI,
|
||||||
|
startHpgValidation,
|
||||||
|
} from "_querys/missions";
|
||||||
import { getConnectedAircraftsAPI } from "_querys/aircrafts";
|
import { getConnectedAircraftsAPI } from "_querys/aircrafts";
|
||||||
import { getStationsAPI } from "_querys/stations";
|
import { getStationsAPI } from "_querys/stations";
|
||||||
import { useDispatchConnectionStore } from "_store/dispatch/connectionStore";
|
import { useDispatchConnectionStore } from "_store/dispatch/connectionStore";
|
||||||
@@ -190,8 +195,8 @@ const Einsatzdetails = ({
|
|||||||
<div>
|
<div>
|
||||||
<div className="divider mt-0 mb-0" />
|
<div className="divider mt-0 mb-0" />
|
||||||
|
|
||||||
{hpgNeedsAttention && (
|
{true && (
|
||||||
<div className="form-control mb-2">
|
<div className="form-control mb-2 flex justify-between items-center">
|
||||||
<label className="flex items-center gap-2 cursor-pointer">
|
<label className="flex items-center gap-2 cursor-pointer">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
@@ -203,6 +208,18 @@ const Einsatzdetails = ({
|
|||||||
Ohne HPG-Mission alarmieren
|
Ohne HPG-Mission alarmieren
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
|
<button
|
||||||
|
className="btn btn-xs btn-outline btn-primary font-thin"
|
||||||
|
onClick={async () => {
|
||||||
|
await startHpgValidation(mission.id).catch((error) => {
|
||||||
|
toast.error(
|
||||||
|
error.response.data.error || "Fehler beim Validieren der HPG-Mission",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Validierung anstoßen
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user