Skip to content

Commit

Permalink
auto-update schedule, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-tsugranes committed Feb 11, 2021
1 parent 56f9528 commit 5dd0500
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 27 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ oc expose service/redhat-airline-ui
```
oc label deployment -l app=redhat-airline app.kubernetes.io/name=nodejs
--this doesn't work with serverless - figure it out
oc annotate deployment -l app=redhat-airline-ui app.openshift.io/connects-to='[{"apiVersion":"apps/v1","kind":"Deployment","name":"redhat-airline-airport-api"},{"apiVersion":"apps/v1","kind":"Deployment","name":"redhat-airline-crewmember-api"},{"apiVersion":"apps/v1","kind":"Deployment","name":"redhat-airline-flight-api"}]'
```
<img src="https://github.com/vincent-tsugranes/redhat-airline-ui/raw/main/public/redhat-airline-openshift-console.png"></img>
Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
"luxon": "^1.25.0",
"material-design-icons-iconfont": "^6.1.0",
"register-service-worker": "^1.7.1",
"typescript": "~3.9.3",
"typescript": "^3.9.9",
"vue": "^2.6.11",
"vue-class-component": "^7.2.3",
"vue-property-decorator": "^8.4.2",
"vue-router": "^3.5.1",
"vue-sidebar-menu": "^4.7.4",
"vue-template-compiler": "^2.6.11",
"vuetify": "^2.4.3",
"vuetify": "^2.4.4",
"vuex": "^3.6.2",
"vuex-class": "^0.3.2"
},
Expand All @@ -53,7 +53,7 @@
"babel-eslint": "^10.1.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-promise": "^4.3.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^6.2.2"
},
Expand Down
21 changes: 8 additions & 13 deletions src/components/Schedule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ export default class Schedule extends Vue {
aircraftLineHeightMax = 80
flightPuckHeight = 25
headerOffset = 20
updateFrequency = 30 // seconds between redraws - current timeline moves
displayMouseOverFlight = false
overlay = true
overlay = false
showDelays = false
flight: Flight | null = null
Expand All @@ -134,6 +135,7 @@ export default class Schedule extends Vue {
mounted () {
this.GetAndDisplayFlights()
window.setInterval(this.updateDisplay, this.updateFrequency * 1000)
}
showDays (count: number) {
Expand All @@ -159,20 +161,13 @@ export default class Schedule extends Vue {
}
private GetAndDisplayFlights () {
console.log('Flight Schedule from', this.startDate.toISODate(), 'to', this.endDate.toISODate())
/*
while (this.$store.state.flights.length === 0) {
this.overlay = true
}
*/
this.overlay = false
console.log(luxon.DateTime.local().toUTC().toFormat('HHmm') + ' - Flight Schedule from', this.startDate.toISODate(), 'to', this.endDate.minus({ days: 1 }).toISODate())
this.$store.dispatch('ENSURE_LOADED_FLIGHTS').then(() => {
this.flights = this.$store.state.flights
this.aircraft = this.$store.state.aircraft
console.log('flights: ' + this.flights.length)
console.log('aircraft: ' + this.aircraft)
// console.log('flights: ' + this.flights.length)
// console.log('aircraft: ' + this.aircraft)
this.DrawCanvas()
this.DrawGrid()
this.DisplayAircraft()
Expand All @@ -192,7 +187,7 @@ export default class Schedule extends Vue {
screenHeight = minCanvasHeight
}
window.addEventListener('resize', this.windowResize)
window.addEventListener('resize', this.updateDisplay)
const totalMinutes = this.endDate.diff(this.startDate, 'minutes').minutes
// this is a critical field - we use it to calculate flight width
Expand Down Expand Up @@ -226,7 +221,7 @@ export default class Schedule extends Vue {
this.DrawCurrentTimeline()
}
private windowResize () {
private updateDisplay () {
this.DrawCanvas()
this.DrawGrid()
this.DisplayAircraft()
Expand Down
1 change: 0 additions & 1 deletion src/services/FlightService.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Flight } from '../entity/flight'

const flightApiUrl = process.env.VUE_APP_FLIGHT_API_URL
console.log('flightApiUrl: ' + flightApiUrl)

export async function GetFlightSchedule (start: string, end: string, aircraftCount: number = 15, flightCount: number = 20) {
const scheduleUrl = flightApiUrl + '/schedule?start=' + start + '&end=' + end + '&aircraftCount=' + aircraftCount + '&flightCount=' + flightCount
Expand Down

0 comments on commit 5dd0500

Please sign in to comment.