Updated data with public and has_metar
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -45,6 +45,8 @@ pub struct Airport {
|
|||||||
pub has_beacon: Option<bool>,
|
pub has_beacon: Option<bool>,
|
||||||
pub runways: Vec<Runway>,
|
pub runways: Vec<Runway>,
|
||||||
pub frequencies: Vec<Frequency>,
|
pub frequencies: Vec<Frequency>,
|
||||||
|
pub has_metar: bool,
|
||||||
|
pub public: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Into<QueryAirport> for Airport {
|
impl Into<QueryAirport> for Airport {
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ async fn import(mut payload: Multipart, auth: JwtAuth) -> HttpResponse {
|
|||||||
return ResponseError::error_response(&err)
|
return ResponseError::error_response(&err)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
while let Some(item) = payload.next().await {
|
while let Some(item) = payload.next().await {
|
||||||
let mut bytes = web::BytesMut::new();
|
let mut bytes = web::BytesMut::new();
|
||||||
let mut field = match item {
|
let mut field = match item {
|
||||||
|
|||||||
@@ -67,6 +67,8 @@ export interface Airport {
|
|||||||
longitude: number;
|
longitude: number;
|
||||||
has_tower: boolean;
|
has_tower: boolean;
|
||||||
has_beacon: boolean;
|
has_beacon: boolean;
|
||||||
|
has_metar: boolean;
|
||||||
|
public: boolean;
|
||||||
runways: Runway[];
|
runways: Runway[];
|
||||||
frequencies: Frequency[];
|
frequencies: Frequency[];
|
||||||
latest_metar?: Metar;
|
latest_metar?: Metar;
|
||||||
|
|||||||
@@ -25,12 +25,35 @@ export default function Page({ params }: { params: { icao: string } }) {
|
|||||||
|
|
||||||
if (airport) {
|
if (airport) {
|
||||||
return (
|
return (
|
||||||
<Grid gutter={80} style={{ margin: '1em auto 0'}}>
|
<Grid gutter={80} style={{ margin: '0 0.5em'}}>
|
||||||
<Grid.Col span={12}>
|
<Grid.Col span={12}>
|
||||||
<Title className='title' order={1}>{airport.icao} - {airport.name}</Title>
|
<Title className='title' order={1}>{airport.icao} - {airport.name}</Title>
|
||||||
<Text c="dimmed">
|
<Text c="dimmed">
|
||||||
{airport.municipality} | {airport.iso_region} | {airport.iso_country}
|
{airport.municipality} | {airport.iso_region} | {airport.iso_country}
|
||||||
</Text>
|
</Text>
|
||||||
|
{metar && (
|
||||||
|
<Text c="dimmed">
|
||||||
|
{metar.raw_text}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
<h3>Frequencies</h3>
|
||||||
|
{airport.frequencies.map((frequency) => (
|
||||||
|
<div key={frequency.frequency_mhz}>
|
||||||
|
<ul>
|
||||||
|
<li>{frequency.id}: {frequency.frequency_mhz} MHz</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
<h3>Runway Information</h3>
|
||||||
|
{airport.runways.map((runway) => (
|
||||||
|
<div key={runway.id}>
|
||||||
|
<b>Runway {runway.id}</b>
|
||||||
|
<ul>
|
||||||
|
<li>Dimensions: {runway.length_ft} x {runway.width_ft} ft.</li>
|
||||||
|
<li>Surface: {runway.surface}</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ export default function AirportForm({ title, airport, submitText, onSubmit, onDe
|
|||||||
longitude: airport?.longitude || 0,
|
longitude: airport?.longitude || 0,
|
||||||
has_tower: airport?.has_tower || false,
|
has_tower: airport?.has_tower || false,
|
||||||
has_beacon: airport?.has_beacon || false,
|
has_beacon: airport?.has_beacon || false,
|
||||||
|
has_metar: airport?.has_metar || false,
|
||||||
|
public: airport?.public || false,
|
||||||
runways: airport?.runways || [],
|
runways: airport?.runways || [],
|
||||||
frequencies: airport?.frequencies || [],
|
frequencies: airport?.frequencies || [],
|
||||||
}
|
}
|
||||||
@@ -99,18 +101,32 @@ export default function AirportForm({ title, airport, submitText, onSubmit, onDe
|
|||||||
{...form.getInputProps('municipality')}
|
{...form.getInputProps('municipality')}
|
||||||
/>
|
/>
|
||||||
</Group>
|
</Group>
|
||||||
<Checkbox
|
<Group>
|
||||||
mt={'xs'}
|
<Checkbox
|
||||||
label='Has Tower'
|
mt={'xs'}
|
||||||
defaultChecked={form.values.has_tower}
|
label='Has Tower'
|
||||||
{...form.getInputProps('has_tower')}
|
defaultChecked={form.values.has_tower}
|
||||||
/>
|
{...form.getInputProps('has_tower')}
|
||||||
<Checkbox
|
/>
|
||||||
mt={'xs'}
|
<Checkbox
|
||||||
label='Has Beacon'
|
mt={'xs'}
|
||||||
defaultChecked={form.values.has_beacon}
|
label='Has Beacon'
|
||||||
{...form.getInputProps('has_beacon')}
|
defaultChecked={form.values.has_beacon}
|
||||||
/>
|
{...form.getInputProps('has_beacon')}
|
||||||
|
/>
|
||||||
|
<Checkbox
|
||||||
|
mt={'xs'}
|
||||||
|
label='Has Metar'
|
||||||
|
defaultChecked={form.values.has_metar}
|
||||||
|
{...form.getInputProps('has_metar')}
|
||||||
|
/>
|
||||||
|
<Checkbox
|
||||||
|
mt={'xs'}
|
||||||
|
label='Public'
|
||||||
|
defaultChecked={form.values.public}
|
||||||
|
{...form.getInputProps('public')}
|
||||||
|
/>
|
||||||
|
</Group>
|
||||||
<NumberInput
|
<NumberInput
|
||||||
required
|
required
|
||||||
hideControls
|
hideControls
|
||||||
|
|||||||
@@ -110,6 +110,13 @@ export default function AirportTablePanel({ setShowModal, setAirport }: { setSho
|
|||||||
Import
|
Import
|
||||||
</PanelFileButton>
|
</PanelFileButton>
|
||||||
</Space>
|
</Space>
|
||||||
|
<Space mr={'sm'}>
|
||||||
|
<PanelButton color={'blue'} onClick={async () => {
|
||||||
|
|
||||||
|
}}>
|
||||||
|
Export
|
||||||
|
</PanelButton>
|
||||||
|
</Space>
|
||||||
<Space>
|
<Space>
|
||||||
<PanelButton color={'red'} onClick={async () => {
|
<PanelButton color={'red'} onClick={async () => {
|
||||||
await removeAirport({});
|
await removeAirport({});
|
||||||
|
|||||||
Reference in New Issue
Block a user