diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index 6593c4fb..79c47532 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -38,7 +38,7 @@ jobs: - name: Build and start containers uses: appleboy/ssh-action@v1 with: - host: ${{ vars.STAGING_HOST }} + host: ${{ vars.PRODUCTION_HOST }} username: ${{ secrets.SSH_USERNAME }} password: ${{ secrets.SSH_PASSWORD }} port: 22 @@ -46,4 +46,4 @@ jobs: export NVM_DIR="$HOME/.nvm" source "$NVM_DIR/nvm.sh" cd ~/docker/var-monorepo - pnpm staging-start + pnpm prod-start diff --git a/apps/dispatch/app/(app)/dispatch/_components/StationSelect.tsx b/apps/dispatch/app/(app)/dispatch/_components/StationSelect.tsx index f435050e..7c685caa 100644 --- a/apps/dispatch/app/(app)/dispatch/_components/StationSelect.tsx +++ b/apps/dispatch/app/(app)/dispatch/_components/StationSelect.tsx @@ -45,16 +45,9 @@ export function StationsSelect({ queryFn: () => getStationsAPI(), }); - const [value, setValue] = useState(selectedStations?.map((id) => String(id)) || []); - - useEffect(() => { - setValue([ - ...(selectedStations || []).map((id) => String(id)), - ...(vehicleStates.hpgAmbulanceState !== HpgState.NOT_REQUESTED || undefined ? ["RTW"] : []), - ...(vehicleStates.hpgFireEngineState !== HpgState.NOT_REQUESTED || undefined ? ["FW"] : []), - ...(vehicleStates.hpgPoliceState !== HpgState.NOT_REQUESTED || undefined ? ["POL"] : []), - ]); - }, [selectedStations, vehicleStates]); + const [value, setValue] = useState( + selectedStations?.map((id) => String(id)) || [], + ); // Helper to check if a station is a vehicle and its state is NOT_REQUESTED const stationsOptions = [ @@ -101,6 +94,20 @@ export function StationsSelect({ return true; }); + useEffect(() => { + if (isMulti) { + setValue([ + ...(selectedStations || []).map((id) => String(id)), + ...(vehicleStates.hpgAmbulanceState !== HpgState.NOT_REQUESTED || undefined ? ["RTW"] : []), + ...(vehicleStates.hpgFireEngineState !== HpgState.NOT_REQUESTED || undefined ? ["FW"] : []), + ...(vehicleStates.hpgPoliceState !== HpgState.NOT_REQUESTED || undefined ? ["POL"] : []), + ]); + } else { + console.log("clear selected stations"); + setValue(null); + } + }, [selectedStations, vehicleStates, isMulti]); + return ( { const { isOpen, missionFormValues } = usePannelStore((state) => state); + const dispatcherConnectionState = useDispatchConnectionStore((state) => state.status); const { data: missions = [] } = useQuery({ queryKey: ["missions"], queryFn: () => @@ -32,6 +34,7 @@ export const MapAdditionals = () => { m.hpgValidationState === "POSITION_AMANDED" && m.state === "draft" && m.hpgLocationLat && + dispatcherConnectionState === "connected" && m.hpgLocationLng, ); diff --git a/apps/dispatch/app/_components/map/MissionMarkers.tsx b/apps/dispatch/app/_components/map/MissionMarkers.tsx index 36d2a8bc..3dee1d2e 100644 --- a/apps/dispatch/app/_components/map/MissionMarkers.tsx +++ b/apps/dispatch/app/_components/map/MissionMarkers.tsx @@ -82,7 +82,7 @@ const MissionPopupContent = ({ return ( <>
{ setOpenMissionMarker({ open: [], @@ -95,7 +95,7 @@ const MissionPopupContent = ({
{mission.state === "draft" && (
{ className="min-w-[320px] flex-1" isMulti={false} onChange={(v) => { + console.log("Selected Station:", v); setSelectedStation({ selectedStationId: v?.selectedStationIds[0], - hpgAmbulanceState: mission.hpgAmbulanceState || HpgState.NOT_REQUESTED, - hpgFireEngineState: mission.hpgFireEngineState || HpgState.NOT_REQUESTED, - hpgPoliceState: mission.hpgPoliceState || HpgState.NOT_REQUESTED, + hpgAmbulanceState: + v.hpgAmbulanceState || mission.hpgAmbulanceState || HpgState.NOT_REQUESTED, + hpgFireEngineState: + v.hpgFireEngineState || mission.hpgFireEngineState || HpgState.NOT_REQUESTED, + hpgPoliceState: + v.hpgPoliceState || mission.hpgPoliceState || HpgState.NOT_REQUESTED, }); }} selectedStations={mission.missionStationIds} @@ -548,6 +552,7 @@ const Rettungsmittel = ({ mission }: { mission: Mission }) => {