updated as in the terminal and gate api's
This commit is contained in:
parent
76744c1b6f
commit
74c8ed661c
13 changed files with 109 additions and 75 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import DisplayDrawer from "common/DisplayDrawer";
|
||||
import { Gate as IGate } from "models/Gate";
|
||||
import Gate from "pages/Gate";
|
||||
import { useGateAPI, useSnackbar } from "providers";
|
||||
import { useGateAPI, useGlobalState, useSnackbar } from "providers";
|
||||
import React, { useEffect, useState } from "react";
|
||||
|
||||
interface Props {
|
||||
|
|
@ -15,6 +15,7 @@ interface Props {
|
|||
|
||||
export default function GateDrawer(props: Props) {
|
||||
const { open, onClose, gates, selectedGate, moveMap, removeMarker } = props;
|
||||
const [{as}] = useGlobalState();
|
||||
const [gate, setGate] = useState(IGate.create());
|
||||
const gateAPI = useGateAPI();
|
||||
const { openSnack } = useSnackbar();
|
||||
|
|
@ -91,7 +92,7 @@ export default function GateDrawer(props: Props) {
|
|||
settings.longitude = 0;
|
||||
settings.latitude = 0;
|
||||
gateAPI
|
||||
.updateGate(gate.key, gate.name, settings)
|
||||
.updateGate(gate.key, gate.name, settings, as)
|
||||
.then(resp => {
|
||||
openSnack("Marker Removed");
|
||||
//then use the removeMarker prop function to update the markers in the parent map
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import DisplayDrawer from "common/DisplayDrawer";
|
||||
import { Terminal as ITerminal } from "models/Terminal";
|
||||
import Terminal from "pages/Terminals";
|
||||
import { useSnackbar, useTerminalAPI } from "providers";
|
||||
import { useGlobalState, useSnackbar, useTerminalAPI } from "providers";
|
||||
import React, { useState, useEffect } from "react";
|
||||
|
||||
interface Props {
|
||||
|
|
@ -15,6 +15,7 @@ interface Props {
|
|||
|
||||
export default function TerminalDrawer(props: Props) {
|
||||
const { terminals, selectedKey, open, onClose, moveMap, removeMarker } = props;
|
||||
const [{as}] = useGlobalState();
|
||||
const [terminal, setTerminal] = useState<ITerminal>(ITerminal.create());
|
||||
const terminalAPI = useTerminalAPI();
|
||||
const { openSnack } = useSnackbar();
|
||||
|
|
@ -91,7 +92,7 @@ export default function TerminalDrawer(props: Props) {
|
|||
settings.longitude = 0;
|
||||
settings.latitude = 0;
|
||||
terminalAPI
|
||||
.updateTerminal(terminal.key, terminal.name, settings)
|
||||
.updateTerminal(terminal.key, terminal.name, settings, as)
|
||||
.then(resp => {
|
||||
openSnack("Marker Removed");
|
||||
//then use the removeMarker prop function to update the markers in the parent map
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ interface Props {
|
|||
}
|
||||
|
||||
export default function AviationMapController(props: Props) {
|
||||
const [{ user }] = useGlobalState();
|
||||
const [{ user, as }] = useGlobalState();
|
||||
const transDuration = 3000;
|
||||
const [currentView, setCurrentView] = useState(
|
||||
props.startingView
|
||||
|
|
@ -99,7 +99,7 @@ export default function AviationMapController(props: Props) {
|
|||
settings.longitude = longitude;
|
||||
settings.latitude = latitude;
|
||||
terminalAPI
|
||||
.updateTerminal(terminal.key, terminal.name, settings)
|
||||
.updateTerminal(terminal.key, terminal.name, settings, as)
|
||||
.then(resp => {
|
||||
openSnack("Terminal Location Updated");
|
||||
if (newMarker) {
|
||||
|
|
@ -139,7 +139,7 @@ export default function AviationMapController(props: Props) {
|
|||
settings.longitude = longitude;
|
||||
settings.latitude = latitude;
|
||||
gateAPI
|
||||
.updateGate(gate.key, gate.name, settings)
|
||||
.updateGate(gate.key, gate.name, settings, as)
|
||||
.then(resp => {
|
||||
openSnack("Gate Location Updated");
|
||||
if (newMarker) {
|
||||
|
|
@ -170,7 +170,7 @@ export default function AviationMapController(props: Props) {
|
|||
};
|
||||
|
||||
const loadTerminals = useCallback(() => {
|
||||
terminalAPI.listTerminals(0, 0, undefined, undefined, undefined).then(resp => {
|
||||
terminalAPI.listTerminals(0, 0, undefined, undefined, undefined, as).then(resp => {
|
||||
let terminalMap: Map<string, Terminal> = new Map();
|
||||
let terminalMarkers: Map<string, MarkerData> = new Map();
|
||||
let terminalOps: Terminal[] = [];
|
||||
|
|
@ -212,10 +212,10 @@ export default function AviationMapController(props: Props) {
|
|||
setTerminalSearchEntries(searchEntries);
|
||||
setTerminalOptions(terminalOps);
|
||||
});
|
||||
}, [terminalAPI]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
}, [terminalAPI, as]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
const loadGates = useCallback(() => {
|
||||
gateAPI.listGates(0, 0, undefined, undefined, undefined, true).then(resp => {
|
||||
gateAPI.listGates(0, 0, undefined, undefined, undefined, true, undefined, undefined, undefined, undefined, as).then(resp => {
|
||||
let gates: Map<string, Gate> = new Map();
|
||||
let gateOptions: Gate[] = [];
|
||||
let gateMarkers: Map<string, MarkerData> = new Map();
|
||||
|
|
@ -255,7 +255,7 @@ export default function AviationMapController(props: Props) {
|
|||
setGateMarkers(gateMarkers);
|
||||
setGateSearchEntries(searchEntries);
|
||||
});
|
||||
}, [gateAPI]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
}, [gateAPI, as]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
useEffect(() => {
|
||||
loadTerminals();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue