From cfb4dbdc1188a9b680655598f58324cfc102b6d5 Mon Sep 17 00:00:00 2001 From: kudukm Date: Fri, 15 May 2026 17:14:38 +0200 Subject: [PATCH 1/7] (SKY-40) Add GET /api/aircraft API request --- skyroster-frontend/src/stores/aircraft.js | 47 ++++++++++++++++--- skyroster-frontend/src/views/AircraftView.vue | 6 ++- 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/skyroster-frontend/src/stores/aircraft.js b/skyroster-frontend/src/stores/aircraft.js index a38496b..5b1c35f 100644 --- a/skyroster-frontend/src/stores/aircraft.js +++ b/skyroster-frontend/src/stores/aircraft.js @@ -1,19 +1,51 @@ -import { ref, computed } from 'vue' -import { defineStore } from 'pinia' -import { initialAircraft, AIRCRAFT_TYPES, BASES, AVAILABILITY_STATUSES } from '../data/mockData' +import {computed, ref} from 'vue' +import {defineStore} from 'pinia' +import apiClient from '../api/axios' +import {AIRCRAFT_TYPES, AVAILABILITY_STATUSES, BASES} from '../data/mockData' + +async function getAircraftList() { + const res = await apiClient.get('http://localhost:8001/api/aircraft', { + headers: { + 'Content-Type': 'application/json' + } + }); + + if (!res.ok) { + let errorData = {}; + + try { + errorData = await res.json(); + } catch { + errorData = {message: 'Failed to fetch aircraft data'}; + } + + const error = new Error( + errorData.message || 'Failed to fetch aircraft data' + ); + + error.code = errorData.code; + throw error; + } + + return await res.json(); +} export const useAircraftStore = defineStore('aircraft', () => { - const aircraft = ref([...initialAircraft]) + const aircraft = ref([]); const aircraftTypeOptions = AIRCRAFT_TYPES const baseOptions = BASES const availabilityOptions = AVAILABILITY_STATUSES const aircraftCount = computed(() => aircraft.value.length) - - const availableAircraft = computed(() => + + const availableAircraft = computed(() => aircraft.value.filter(a => a.dostepnosc === 'dostepny') ) + async function fetchAircraftList() { + aircraft.value = await getAircraftList(); + } + function generateId() { const maxId = aircraft.value.reduce((max, a) => { const num = parseInt(a.id.replace('A', '')) @@ -74,6 +106,7 @@ export const useAircraftStore = defineStore('aircraft', () => { deleteAircraft, getAircraftById, getAircraftDisplay, - getAvailabilityInfo + getAvailabilityInfo, + fetchAircraftList } }) diff --git a/skyroster-frontend/src/views/AircraftView.vue b/skyroster-frontend/src/views/AircraftView.vue index 8afc6da..b5f99e4 100644 --- a/skyroster-frontend/src/views/AircraftView.vue +++ b/skyroster-frontend/src/views/AircraftView.vue @@ -1,5 +1,5 @@ From bea0e234e43040c34a0aeaf929ee23dbdd8bbbf4 Mon Sep 17 00:00:00 2001 From: kudukm Date: Sat, 16 May 2026 11:43:13 +0200 Subject: [PATCH 4/7] (SKY-40) SchedulerView repaired --- skyroster-frontend/src/views/SchedulerView.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/skyroster-frontend/src/views/SchedulerView.vue b/skyroster-frontend/src/views/SchedulerView.vue index 4667fd2..601e66b 100644 --- a/skyroster-frontend/src/views/SchedulerView.vue +++ b/skyroster-frontend/src/views/SchedulerView.vue @@ -25,8 +25,9 @@ const selectedFlight = ref(null) const flightForm = ref(getEmptyForm()) -onMounted(() => { - flightsStore.loadPlanningSchedules() +onMounted(async () => { + await aircraftStore.fetchAircraftList(); + await flightsStore.loadPlanningSchedules() }) const baseOptions = BASES.map(b => ({ From 0618a68263250c65b1a12e65b07ca27e32fd3a22 Mon Sep 17 00:00:00 2001 From: kudukm Date: Sat, 16 May 2026 11:57:34 +0200 Subject: [PATCH 5/7] (SKY-40) CI/CD warning suppression --- skyroster-frontend/src/views/AircraftView.vue | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/skyroster-frontend/src/views/AircraftView.vue b/skyroster-frontend/src/views/AircraftView.vue index 9c7a294..5ebd602 100644 --- a/skyroster-frontend/src/views/AircraftView.vue +++ b/skyroster-frontend/src/views/AircraftView.vue @@ -1,14 +1,14 @@