Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combined metreport #82

Merged
merged 22 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b595d8c
Testing (not working yet)
maxlk96 Oct 7, 2024
bcf2900
Replaced API by local calculation/airport db
maxlk96 Oct 11, 2024
8c8b92f
Replaced manual selection with menu integration
maxlk96 Oct 11, 2024
00df2e1
Updated combined MET window
maxlk96 Oct 11, 2024
a92b9a7
Tweaked display of times, added "Separate VFR"
maxlk96 Oct 11, 2024
1ad7444
Merge pull request #59 from minsulander/sunrise-sunset
maxlk96 Oct 11, 2024
3c3f9e8
Sun-met: updated window size and avbl "full"/"sun" windows
maxlk96 Oct 12, 2024
690f826
Removed duplicate "sun" window entries
maxlk96 Oct 12, 2024
604ae53
"ALL" renamed "FULL"
maxlk96 Oct 12, 2024
fe35ff3
ATIS Initial implementation
maxlk96 Oct 12, 2024
8584f0b
ATIS: Remedy line break that kaput data extraction
maxlk96 Oct 12, 2024
396b5c2
Update package-lock.json
maxlk96 Oct 12, 2024
afef988
ATIS added conditions and blueflash
maxlk96 Oct 25, 2024
c009afc
ATIS separating ARR/DEP for ESSA
maxlk96 Oct 25, 2024
f2e257d
Merge remote-tracking branch 'github/atis-view' into combined-metreport
minsulander Oct 28, 2024
8a94489
Merge remote-tracking branch 'github/sun-met' into combined-metreport
minsulander Oct 28, 2024
aa9b64e
Fix build
minsulander Oct 28, 2024
4d6a7ae
Fixotrix ATIS view, remove gazillions of airports in airports.csv etc
minsulander Oct 28, 2024
baff85c
Implement combined metreport with auto source switching
minsulander Oct 29, 2024
d3f342a
More metreport stuff, differing rwys, wx qnh trend in store, etc
minsulander Oct 30, 2024
d75254a
Implement qnh trends, updates, TAF in full view, etc etc
minsulander Oct 30, 2024
b9b9150
Rename 'full' to 'airport'
minsulander Oct 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"metar-taf-parser": "^9.0.1",
"moment": "^2.30.1",
"ol": "^9.2.2",
"papaparse": "^5.4.1",
"pinia": "^2.1.7",
"suncalc": "^1.9.0",
"uuid": "^9.0.1",
"vue": "^3.4.21",
"vue-router": "^4.3.0",
Expand All @@ -33,6 +35,8 @@
"@tsconfig/node20": "^20.1.4",
"@types/diff": "^5.2.1",
"@types/node": "^20.12.5",
"@types/papaparse": "^5.3.15",
"@types/suncalc": "^1.9.2",
"@types/uuid": "^9.0.8",
"@vitejs/plugin-vue": "^5.0.4",
"@vue/eslint-config-prettier": "^9.0.0",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Notam.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div style="height: 30px; background: #666">
<div style="height: 25px; margin-top: -5px; background: #777">
<v-btn
variant="text"
rounded="0"
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Notepad.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div style="width: 100%; height: 100%; background: #666; overflow-y: hidden">
<div style="height: 30px; background: #666">
<div style="height: 25px; margin-top: -5px; background: #777">
<v-btn
variant="text"
rounded="0"
Expand Down
21 changes: 18 additions & 3 deletions frontend/src/components/menu/MainMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ const dct = useDctStore()

const menuItems = reactive({
MET: {
AIRPORT: {
// This will be filled in with ICAO codes
} as { [key: string]: string },
METREPORT: {
// filled in code
} as { [key: string]: string },
Expand All @@ -36,6 +39,9 @@ const menuItems = reactive({
SMHI: "smhi",
"SWC NORDEN": "swc",
VFR: "vfr",
SUN: {
// This will be filled in with ICAO codes
} as { [key: string]: string },
},
NOTAM: "notam",
eCharts: "echarts",
Expand Down Expand Up @@ -143,16 +149,25 @@ const menuItems = reactive({
"AIRCRAFT TYPES": "aircraft",
NOTEPAD: "notepad",
},
DCT: {}, // We'll populate this dynamically
DCT: {}, // We'll populate this dynamically
} as any)

import { wxAirports } from "@/stores/wx"
import { metarAirports, wxAirports } from "@/metcommon"

for (const icao of wxAirports) {
menuItems.MET.METREPORT[icao] = `metrep${icao}`
menuItems.MET.AIRPORT[icao] = `airport${icao}`
menuItems.MET.METSENSOR[icao] = `metsen${icao}`
}

for (const icao of metarAirports) {
menuItems.MET.METREPORT[icao] = `metrep${icao}`
if (icao == "ESSA") {
menuItems.MET.METREPORT[`${icao} ARR`] = `metrep${icao}arr`
menuItems.MET.METREPORT[`${icao} DEP`] = `metrep${icao}dep`
}
menuItems.MET.SUN[icao] = `sun${icao}`
}

import { useDctStore } from "@/stores/dct"

for (const [id, groups] of Object.entries(dct.menuItems)) {
Expand Down
35 changes: 35 additions & 0 deletions frontend/src/components/met/Airport.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<template>
<div class="full-component">
<Sun :id="props.id" />
<hr class="component-divider">
<Metreport :id="props.id" />
<hr v-if="tafAvailable" class="component-divider">
<Taf v-if="tafAvailable" :id="props.id" />
<hr class="component-divider">
<Metsensor :id="props.id" />
</div>
</template>

<script setup lang="ts">
import Sun from "@/components/met/Sun.vue"
import Metreport from "@/components/met/Metreport.vue"
import Taf from "@/components/met/Taf.vue"
import Metsensor from "@/components/met/MetsensorWX.vue"
import { tafAirports } from "@/metcommon"
import { computed } from "vue"

const props = defineProps<{ id: string }>()

const tafAvailable = computed(() => tafAirports.includes(props.id))

</script>

<style scoped>
.component-divider {
width: 100%;
border: none;
border-top: 2px solid #808080;
margin-top: 5px;
margin-bottom: 5px;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ TAF {{ icao }} N/A</pre
</template>

<script setup lang="ts">
import { useMetarStore, metarAirports } from "@/stores/metar"
import { useMetarStore } from "@/stores/metar"
import { useTafStore } from "@/stores/taf"
import { metarAirports } from "@/metcommon";
import { computed, onMounted, onUnmounted, reactive, ref, watch } from "vue"

const metarStore = useMetarStore()
Expand Down
99 changes: 99 additions & 0 deletions frontend/src/components/met/Metreport.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<template>
<div class="float-right text-caption">
<a
title="Source: METAR"
class="mx-1 font-weight-bold"
@click="source = 'metar'"
:style="{ color: source == 'metar' ? '#444' : '#999' }"
>M</a
>
<a
v-if="awosAvailable"
title="Source: WX.AWOS.SE"
class="mx-1 font-weight-bold"
@click="source = 'awos'"
:style="{ color: source == 'awos' ? '#444' : '#999' }"
>W</a
>
<a
v-if="atisAvailable"
title="Source: ATIS"
class="mx-1 font-weight-bold"
@click="source = 'atis'"
:style="{ color: source == 'atis' ? '#444' : '#999' }"
>A</a
>
</div>
<MetreportMETAR v-if="source == 'metar'" :id="id" />
<MetreportWX v-else-if="awosAvailable && source == 'awos'" :id="id" :type="type" />
<MetreportATIS v-else-if="atisAvailable && source == 'atis'" :id="id" :type="type" />
<div class="pa-1" v-else>Source is what now??</div>
</template>

<script setup lang="ts">
import { computed, onMounted, onUnmounted, ref, watch } from "vue"
import MetreportMETAR from "./MetreportMETAR.vue"
import MetreportWX from "./MetreportWX.vue"
import MetreportATIS from "./MetreportATIS.vue"
import { useWxStore } from "@/stores/wx"
import { useMetarStore } from "@/stores/metar"
import { useVatsimStore } from "@/stores/vatsim"
import { wxAirports, atisAirports } from "@/metcommon"

const props = defineProps<{ id: string; type?: "ARR" | "DEP" }>()

const wx = useWxStore()
const metar = useMetarStore()
const vatsim = useVatsimStore()

const source = ref("metar")

const awosAvailable = computed(() =>
wxAirports.includes(props.id) &&
(wx.metreport(props.id) || wx.info(props.id) || wx.metar(props.id))
? true
: false,
)
const atisAvailable = computed(() =>
atisAirports.includes(props.id) &&
vatsim.data &&
vatsim.data.atis &&
vatsim.data.atis.find(
(a) =>
a.callsign.startsWith(
props.id +
(props.type == "ARR" ? "_A_ATIS" : props.type == "DEP" ? "_D_ATIS" : "_ATIS"),
) &&
a.text_atis &&
a.text_atis.length > 0,
)
? true
: false,
)

let wxSubscription = ""
let metarSubscription = ""

onMounted(() => {
wxSubscription = wx.subscribe(props.id)
metarSubscription = metar.subscribe(props.id)
source.value = atisAvailable.value ? "atis" : awosAvailable.value ? "awos" : "metar"
})

onUnmounted(() => {
if (wxSubscription) wx.unsubscribe(wxSubscription)
if (metarSubscription) metar.unsubscribe(metarSubscription)
})

watch([awosAvailable, atisAvailable], (newValues, oldValues) => {
let changed = false
for (let i = 0; i < newValues.length; i++) {
if (newValues[i] != oldValues[i]) changed = true
}
if (changed) {
if (atisAvailable.value) source.value = "atis"
else if (awosAvailable.value) source.value = "awos"
else source.value = "metar"
}
})
</script>
Loading