Zobrazeni pocasi po trase planu

This commit is contained in:
Michal Kváček
2024-09-09 17:41:34 +02:00
parent 7011aa3223
commit 786c59cc4a
7 changed files with 126 additions and 9 deletions
@@ -18,7 +18,6 @@ const props = defineProps({
const columns = [
{
// name: 'from',
label: 'Z',
align: "left",
field: 'from'
@@ -0,0 +1,97 @@
<script setup>
import {computed} from "vue";
import {textEllipsis} from "src/composables/utils";
import {minutesToHumanReadable} from "src/composables/datetimeUtils";
import {useFlightPlanUtils} from "src/composables/flightPlan";
import {useQuasar} from "quasar";
import {useUnitsConvertors} from "src/composables/units";
import CloudCoverIcon from "components/weather/CloudCoverIcon.vue";
const props = defineProps({
flightPlan: {
type: Object,
required: true
}
})
const columns = [
{
label: 'Místo',
align: "left",
name: 'place',
},
{
align: 'right',
label: 'Teplota',
name: 'temperature',
},
{
align: 'right',
label: 'Vítr',
name: 'wind',
},
{
align: 'right',
label: 'Oblačnost',
name: 'clouds',
},
];
const {screen} = useQuasar();
const {getMarkersFrom} = useFlightPlanUtils();
const {kmhToKnots} = useUnitsConvertors();
const markers = getMarkersFrom(props.flightPlan);
</script>
<template>
<q-table
:grid="screen.xs"
:dense="screen.lt.md"
flat bordered
hide-bottom
:title="flightPlan.name"
:rows="markers"
:columns="columns"
:rows-per-page-options="[0]"
>
<template v-slot:body-cell-place="props">
<q-td :props="props">
{{ props.row.name }}
</q-td>
</template>
<template v-slot:body-cell-temperature="props">
<q-td :props="props">
{{ props.row.weatherInfo.temperatureSurface }}° C
<br>
Rosný bod {{ props.row.weatherInfo.dewpointSurface }}° C
</q-td>
</template>
<template v-slot:body-cell-wind="props">
<q-td :props="props">
<q-icon name="navigation" :style="`transform: rotate(${props.row.weatherInfo.windDirectionSurface}deg)`"/>
<br>
{{ props.row.weatherInfo.windDirectionSurface }}°
<br>
{{ kmhToKnots(props.row.weatherInfo.windSpeedSurface) }} kt
</q-td>
</template>
<template v-slot:body-cell-clouds="props">
<q-td :props="props">
<CloudCoverIcon :cloudcover="props.row.weatherInfo.cloudcoverTotal"/>
<br>
celkové pokrytí oblačností {{ props.row.weatherInfo.cloudcoverTotal }} %
<br>
nízké mraky {{ props.row.weatherInfo.cloudcoverLow }} %
</q-td>
</template>
</q-table>
</template>
+2 -3
View File
@@ -1,6 +1,7 @@
<script setup>
import {ref} from "vue";
import CloudCoverIcon from "components/weather/CloudCoverIcon.vue";
import {useUnitsConvertors} from "src/composables/units";
const props = defineProps({
weather: {
@@ -9,9 +10,7 @@ const props = defineProps({
}
})
const kmhToKnots = (speedKmh) => {
return Math.round(speedKmh * 0.53996);
}
const {kmhToKnots} = useUnitsConvertors();
const openDetail = ref(false);
</script>
+7 -2
View File
@@ -1,3 +1,8 @@
export const ktToKph = (speedInKt) => {
return speedInKt;
export const useUnitsConvertors = () => {
const kmhToKnots = (speedKmh) => {
return Math.round(speedKmh * 0.53996);
}
return {kmhToKnots}
}
+7
View File
@@ -1,4 +1,5 @@
import gql from "graphql-tag";
import {FRAGMENT_WEATHER_FULL_INFO} from "src/graphql/fragments/flight";
export const FRAGMENT_FLIGHT_PLAN_MARKER = gql`
fragment flightPlanMarker on FlightPlanMarker {
@@ -9,7 +10,13 @@ fragment flightPlanMarker on FlightPlanMarker {
gpsLongitude
pointOfInterestId
airportId
weatherInfo {
...weatherFullInfo
}
}
${FRAGMENT_WEATHER_FULL_INFO}
`
export const FRAGMENT_FLIGHT_PLAN_FULL_INFO = gql`
@@ -22,12 +22,13 @@ import FlightPlanSideControls from "components/flightPlans/FlightPlanSideControl
import {useAircraftsStore} from "stores/Aircrafts";
import {errorObject, successObject} from "src/composables/dialog";
import {useQuasar} from "quasar";
import FlightPlanRouteTable from "components/flightPlans/FlightPlanRouteTable.vue";
import FlightPlanNavLogTable from "components/flightPlans/FlightPlanNavLogTable.vue";
import FlightPlanForm from "components/flightPlans/FlightPlanForm.vue";
import {useFlightsStore} from "stores/Flights";
import {useRouter} from "vue-router";
import FlightFromPlanForm from "components/flightPlans/FlightFromPlanForm.vue";
import BasicInfoBanner from "components/banners/BasicInfoBanner.vue";
import FlightPlanWeatherInfo from "components/flightPlans/FlightPlanWeatherInfo.vue";
const {flightPlan} = storeToRefs(useFlightPlansStore());
const flightPlanName = computed(() => flightPlan.value.name || "Nepojmenovaný plán");
@@ -156,6 +157,11 @@ const createNewFlightFromPlan = (formData) => {
Informace
</q-tab>
<q-tab name="weather">
<q-icon name="mdi-weather-windy"/>
Počasí
</q-tab>
<q-tab name="navLog">
<q-icon name="navigation"/>
Navigační štítek
@@ -208,12 +214,16 @@ const createNewFlightFromPlan = (formData) => {
</q-tab-panel>
<q-tab-panel name="navLog">
<FlightPlanRouteTable
<FlightPlanNavLogTable
:flight-plan="flightPlan"
:planned-speed="flightPlan.plannedSpeed"
/>
</q-tab-panel>
<q-tab-panel name="weather">
<FlightPlanWeatherInfo :flight-plan="flightPlan" />
</q-tab-panel>
<q-tab-panel name="flight" v-if="flightPlan.aircraft">
<BasicInfoBanner v-if="!takeoffAirport || !landingAirport" color="error">
V plánu nemáš žádné letiště vzletu nebo přistání. Pro import letu musíš nahrát trasu.
@@ -21,7 +21,7 @@ import {usePointsOfInterestStore} from "stores/PointsOfInterest";
import {useAirportsStore} from "stores/Airports";
import {formatDatetime, minutesToHumanReadable} from "src/composables/datetimeUtils";
import {useFlightPlanCalculations, useFlightPlanUtils} from "src/composables/flightPlan";
import FlightPlanRouteTable from "components/flightPlans/FlightPlanRouteTable.vue";
import FlightPlanRouteTable from "components/flightPlans/FlightPlanNavLogTable.vue";
import {useMeta} from "quasar";
import {metaData} from "src/composables/meta";