From ce697dc51fa59a79fa8f5999ac474016ed41c06c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Conde?= Date: Sun, 15 Jan 2023 18:43:41 +0100 Subject: [PATCH] feature: on session --- src/components/InSessionNow.vue | 69 +++++++++ src/components/SolariBoard.vue | 191 +++++++++++++++++++++++ src/components/SolariBoardRow.vue | 156 +++++++++++++++++++ src/components/TableAcars.vue | 75 +++++++++ src/components/TableIvao.vue | 135 +++++++++++++++++ src/data/http/listRequest.js | 12 ++ src/helpers/fakeData.js | 244 ++++++++++++++++++++++++++++++ src/helpers/time-helpers.js | 12 ++ src/router/index.js | 36 +++-- src/views/IvaoView.vue | 11 ++ 10 files changed, 926 insertions(+), 15 deletions(-) create mode 100644 src/components/InSessionNow.vue create mode 100644 src/components/SolariBoard.vue create mode 100644 src/components/SolariBoardRow.vue create mode 100644 src/components/TableAcars.vue create mode 100644 src/components/TableIvao.vue create mode 100644 src/helpers/fakeData.js create mode 100644 src/helpers/time-helpers.js create mode 100644 src/views/IvaoView.vue diff --git a/src/components/InSessionNow.vue b/src/components/InSessionNow.vue new file mode 100644 index 0000000..5d00526 --- /dev/null +++ b/src/components/InSessionNow.vue @@ -0,0 +1,69 @@ + + + + + \ No newline at end of file diff --git a/src/components/SolariBoard.vue b/src/components/SolariBoard.vue new file mode 100644 index 0000000..b881557 --- /dev/null +++ b/src/components/SolariBoard.vue @@ -0,0 +1,191 @@ + + + + + \ No newline at end of file diff --git a/src/components/SolariBoardRow.vue b/src/components/SolariBoardRow.vue new file mode 100644 index 0000000..e15657b --- /dev/null +++ b/src/components/SolariBoardRow.vue @@ -0,0 +1,156 @@ + + + + + \ No newline at end of file diff --git a/src/components/TableAcars.vue b/src/components/TableAcars.vue new file mode 100644 index 0000000..791d8da --- /dev/null +++ b/src/components/TableAcars.vue @@ -0,0 +1,75 @@ + + + + + \ No newline at end of file diff --git a/src/components/TableIvao.vue b/src/components/TableIvao.vue new file mode 100644 index 0000000..0e85ec6 --- /dev/null +++ b/src/components/TableIvao.vue @@ -0,0 +1,135 @@ + + + + + \ No newline at end of file diff --git a/src/data/http/listRequest.js b/src/data/http/listRequest.js index 0a88dce..eb7be41 100644 --- a/src/data/http/listRequest.js +++ b/src/data/http/listRequest.js @@ -11,4 +11,16 @@ export async function getWhitelist() { import.meta.env; const response = await request(`${VITE_API_BASE}${VITE_API_PATH_WHITELIST}`); return response; +} +export async function getInSessionNow() { + const { VITE_API_BASE, VITE_API_PATH_NOW_SESSIONS } = + import.meta.env; + const response = await request(`${VITE_API_BASE}${VITE_API_PATH_NOW_SESSIONS}`); + return response; +} +export async function getFlightplansNow() { + const { VITE_API_BASE, VITE_API_PATH_NOW_FLIGHTPLANS } = + import.meta.env; + const response = await request(`${VITE_API_BASE}${VITE_API_PATH_NOW_FLIGHTPLANS}`); + return response; } \ No newline at end of file diff --git a/src/helpers/fakeData.js b/src/helpers/fakeData.js new file mode 100644 index 0000000..b5abc60 --- /dev/null +++ b/src/helpers/fakeData.js @@ -0,0 +1,244 @@ +export const onSessionFakeData = [{ + 'time': 34031, + 'id': 51004653, + 'callsign': 'GIA88', + 'userId': 446688, + 'connectionType': 'PILOT', + 'serverId': 'WS', + 'createdAt': '2023-01-13T01:35:25.000Z', + 'pilotSession': { + 'simulatorId': 'P3D', + 'textureId': 355 + }, + 'lastTrack': { + 'altitude': 36202, + 'altitudeDifference': -200, + 'arrivalDistance': 2307.286865, + 'departureDistance': 4086.708252, + 'groundSpeed': 439, + 'heading': 287, + 'latitude': 28.503233, + 'longitude': 45.723396, + 'onGround': false, + 'state': 'En Route', + 'timestamp': '2023-01-13T11:02:27.000Z', + 'transponder': 2000, + 'transponderMode': 'N', + 'time': 34023 + }, + 'flightPlan': { + 'id': 54507818, + 'arrivalId': 'EHAM', + 'departureId': 'WIII', + 'aircraftId': 'B77W', + 'aircraft': { + 'icaoCode': 'B77W', + 'model': '777-300ER', + 'wakeTurbulence': 'H', + 'isMilitary': false, + 'description': 'LandPlane' + }, + 'departure': { + 'icao': 'WIII', + 'iata': 'CGK', + 'name': 'Soekarno Hatta', + 'countryId': 'ID', + 'longitude': 106.6611111111, + 'latitude': -6.1236111111, + 'military': false, + 'city': 'Jakarta' + }, + 'arrival': { + 'icao': 'EHAM', + 'iata': 'AMS', + 'name': 'Schiphol', + 'countryId': 'NL', + 'longitude': 4.7641666667, + 'latitude': 52.3080555556, + 'military': false, + 'city': 'Amsterdam' + } + }, + 'softwareType': { + 'id': 'altitude/win', + 'name': 'Altitude/win' + }, + 'user': { + 'id': 446688, + 'divisionId': 'ID', + 'firstName': null, + 'lastName': null, + 'rating': { + 'pilotRatingId': 4, + 'pilotRating': { + 'id': 4, + 'name': 'Advanced Flight Student', + 'shortName': 'FS3', + 'description': 'Rating requires at least 25 hours online as a pilot
and a successful theoretical IvAp test
' + } + } + } + }, + { + 'time': 33149, + 'id': 51004722, + 'callsign': 'DLH122', + 'userId': 671530, + 'connectionType': 'PILOT', + 'serverId': 'WS', + 'createdAt': '2023-01-13T01:50:07.000Z', + 'pilotSession': { + 'simulatorId': 'X-Plane11', + 'textureId': 1827 + }, + 'lastTrack': { + 'altitude': 34635, + 'altitudeDifference': 329, + 'arrivalDistance': 1223.80835, + 'departureDistance': 3178.239502, + 'groundSpeed': 463, + 'heading': 128, + 'latitude': 61.01244, + 'longitude': -22.375532, + 'onGround': false, + 'state': 'En Route', + 'timestamp': '2023-01-13T11:02:32.000Z', + 'transponder': 2000, + 'transponderMode': 'N', + 'time': 33146 + }, + 'flightPlan': { + 'id': 54507919, + 'arrivalId': 'EDDF', + 'departureId': 'CYVR', + 'aircraftId': 'A359', + 'aircraft': { + 'icaoCode': 'A359', + 'model': 'A350-900 XWB', + 'wakeTurbulence': 'H', + 'isMilitary': false, + 'description': 'LandPlane' + }, + 'departure': { + 'icao': 'CYVR', + 'iata': 'YVR', + 'name': 'Vancouver', + 'countryId': 'CA', + 'longitude': -123.1839694444, + 'latitude': 49.1946972222, + 'military': false, + 'city': 'Vancouver' + }, + 'arrival': { + 'icao': 'EDDF', + 'iata': 'FRA', + 'name': 'Frankfurt', + 'countryId': 'DE', + 'longitude': 8.5704555556, + 'latitude': 50.0333055556, + 'military': false, + 'city': 'Frankfurt/Main' + } + }, + 'softwareType': { + 'id': 'altitude/win', + 'name': 'Altitude/win' + }, + 'user': { + 'id': 671530, + 'divisionId': 'BR', + 'firstName': null, + 'lastName': null, + 'rating': { + 'pilotRatingId': 4, + 'pilotRating': { + 'id': 4, + 'name': 'Advanced Flight Student', + 'shortName': 'FS3', + 'description': 'Rating requires at least 25 hours online as a pilot
and a successful theoretical IvAp test
' + } + } + } + }, + { + 'time': 30300, + 'id': 51004897, + 'callsign': 'ABS9912', + 'userId': 697657, + 'connectionType': 'PILOT', + 'serverId': 'WS', + 'createdAt': '2023-01-13T02:37:36.000Z', + 'pilotSession': { + 'simulatorId': 'X-Plane11', + 'textureId': 67 + }, + 'lastTrack': { + 'altitude': 34959, + 'altitudeDifference': 33, + 'arrivalDistance': 1464.623535, + 'departureDistance': 3891.043701, + 'groundSpeed': 495, + 'heading': 134, + 'latitude': -7.272876, + 'longitude': -65.504532, + 'onGround': false, + 'state': 'En Route', + 'timestamp': '2023-01-13T11:02:27.000Z', + 'transponder': 7320, + 'transponderMode': 'N', + 'time': 30292 + }, + 'flightPlan': { + 'id': 54508190, + 'arrivalId': 'SBGR', + 'departureId': 'KLAX', + 'aircraftId': 'A346', + 'aircraft': { + 'icaoCode': 'A346', + 'model': 'A340-600', + 'wakeTurbulence': 'H', + 'isMilitary': false, + 'description': 'LandPlane' + }, + 'departure': { + 'icao': 'KLAX', + 'iata': 'LAX', + 'name': 'Los Angeles International', + 'countryId': 'US', + 'longitude': -118.40805, + 'latitude': 33.9424972222, + 'military': false, + 'city': 'Los Angeles' + }, + 'arrival': { + 'icao': 'SBGR', + 'iata': 'GRU', + 'name': 'São Paulo/Guarulhos / Governador André Franco Montoro Intl', + 'countryId': 'BR', + 'longitude': -46.4730555556, + 'latitude': -23.4355555556, + 'military': true, + 'city': 'Guarulhos' + } + }, + 'softwareType': { + 'id': 'altitude/win', + 'name': 'Altitude/win' + }, + 'user': { + 'id': 697657, + 'divisionId': 'BR', + 'firstName': null, + 'lastName': null, + 'rating': { + 'pilotRatingId': 4, + 'pilotRating': { + 'id': 4, + 'name': 'Advanced Flight Student', + 'shortName': 'FS3', + 'description': 'Rating requires at least 25 hours online as a pilot
and a successful theoretical IvAp test
' + } + } + } + }, +]; \ No newline at end of file diff --git a/src/helpers/time-helpers.js b/src/helpers/time-helpers.js new file mode 100644 index 0000000..8e92cb0 --- /dev/null +++ b/src/helpers/time-helpers.js @@ -0,0 +1,12 @@ +function format(num) { + return String(100 + num).substring(1); +} + +export function hoursFromSeconds(seconds) { + const h = format(Math.floor(seconds / 3600)); + const m = format(Math.round(seconds % 3600 * 60)); + return { + h, + m + }; +} \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index 35612dc..a388744 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,23 +1,29 @@ -import { createRouter, createWebHistory } from "vue-router"; -import HomeView from "../views/HomeView.vue"; +import { createRouter, createWebHistory } from 'vue-router'; +import TableAcars from '../components/TableAcars.vue'; +import IvaoView from '../views/IvaoView.vue'; const router = createRouter({ - history: createWebHistory(import.meta.env.BASE_URL), - routes: [ - { - path: "/", - name: "home", - component: HomeView, + history: createWebHistory( + import.meta.env.BASE_URL), + routes: [{ + path: '/', + name: 'home', + component: IvaoView, }, { - path: "/about", - name: "about", - // route level code-splitting - // this generates a separate chunk (About.[hash].js) for this route - // which is lazy-loaded when the route is visited. - component: () => import("../views/AboutView.vue"), + path: '/acars', + name: 'acars', + component: TableAcars, }, + // { + // path: '/about', + // name: 'about', + // // route level code-splitting + // // this generates a separate chunk (About.[hash].js) for this route + // // which is lazy-loaded when the route is visited. + // component: () => import('../views/AboutView.vue'), + // }, ], }); -export default router; +export default router; \ No newline at end of file diff --git a/src/views/IvaoView.vue b/src/views/IvaoView.vue new file mode 100644 index 0000000..2fa867e --- /dev/null +++ b/src/views/IvaoView.vue @@ -0,0 +1,11 @@ + + + \ No newline at end of file