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 runways: Vec<Runway>,
|
||||
pub frequencies: Vec<Frequency>,
|
||||
pub has_metar: bool,
|
||||
pub public: bool,
|
||||
}
|
||||
|
||||
impl Into<QueryAirport> for Airport {
|
||||
|
||||
@@ -26,7 +26,6 @@ async fn import(mut payload: Multipart, auth: JwtAuth) -> HttpResponse {
|
||||
return ResponseError::error_response(&err)
|
||||
};
|
||||
|
||||
|
||||
while let Some(item) = payload.next().await {
|
||||
let mut bytes = web::BytesMut::new();
|
||||
let mut field = match item {
|
||||
|
||||
@@ -67,6 +67,8 @@ export interface Airport {
|
||||
longitude: number;
|
||||
has_tower: boolean;
|
||||
has_beacon: boolean;
|
||||
has_metar: boolean;
|
||||
public: boolean;
|
||||
runways: Runway[];
|
||||
frequencies: Frequency[];
|
||||
latest_metar?: Metar;
|
||||
|
||||
@@ -25,12 +25,35 @@ export default function Page({ params }: { params: { icao: string } }) {
|
||||
|
||||
if (airport) {
|
||||
return (
|
||||
<Grid gutter={80} style={{ margin: '1em auto 0'}}>
|
||||
<Grid gutter={80} style={{ margin: '0 0.5em'}}>
|
||||
<Grid.Col span={12}>
|
||||
<Title className='title' order={1}>{airport.icao} - {airport.name}</Title>
|
||||
<Text c="dimmed">
|
||||
{airport.municipality} | {airport.iso_region} | {airport.iso_country}
|
||||
</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>
|
||||
);
|
||||
|
||||
@@ -26,6 +26,8 @@ export default function AirportForm({ title, airport, submitText, onSubmit, onDe
|
||||
longitude: airport?.longitude || 0,
|
||||
has_tower: airport?.has_tower || false,
|
||||
has_beacon: airport?.has_beacon || false,
|
||||
has_metar: airport?.has_metar || false,
|
||||
public: airport?.public || false,
|
||||
runways: airport?.runways || [],
|
||||
frequencies: airport?.frequencies || [],
|
||||
}
|
||||
@@ -99,18 +101,32 @@ export default function AirportForm({ title, airport, submitText, onSubmit, onDe
|
||||
{...form.getInputProps('municipality')}
|
||||
/>
|
||||
</Group>
|
||||
<Checkbox
|
||||
mt={'xs'}
|
||||
label='Has Tower'
|
||||
defaultChecked={form.values.has_tower}
|
||||
{...form.getInputProps('has_tower')}
|
||||
/>
|
||||
<Checkbox
|
||||
mt={'xs'}
|
||||
label='Has Beacon'
|
||||
defaultChecked={form.values.has_beacon}
|
||||
{...form.getInputProps('has_beacon')}
|
||||
/>
|
||||
<Group>
|
||||
<Checkbox
|
||||
mt={'xs'}
|
||||
label='Has Tower'
|
||||
defaultChecked={form.values.has_tower}
|
||||
{...form.getInputProps('has_tower')}
|
||||
/>
|
||||
<Checkbox
|
||||
mt={'xs'}
|
||||
label='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
|
||||
required
|
||||
hideControls
|
||||
|
||||
@@ -110,6 +110,13 @@ export default function AirportTablePanel({ setShowModal, setAirport }: { setSho
|
||||
Import
|
||||
</PanelFileButton>
|
||||
</Space>
|
||||
<Space mr={'sm'}>
|
||||
<PanelButton color={'blue'} onClick={async () => {
|
||||
|
||||
}}>
|
||||
Export
|
||||
</PanelButton>
|
||||
</Space>
|
||||
<Space>
|
||||
<PanelButton color={'red'} onClick={async () => {
|
||||
await removeAirport({});
|
||||
|
||||
Reference in New Issue
Block a user