2022-12-05 22:25:36 +00:00
|
|
|
const modeMap = {
|
|
|
|
"WT": "Waiting for Launch",
|
|
|
|
"LD": "Launch Detected",
|
|
|
|
"LV": "Low velocity Detected",
|
|
|
|
"AP": "Nose-Over",
|
|
|
|
"DR": "Drogue Fired",
|
|
|
|
"MN": "Main Fired",
|
|
|
|
"FS": "Failsafe Triggered ",
|
|
|
|
"TD": "Landing Detected"
|
|
|
|
}
|
|
|
|
|
|
|
|
class MissionInfoWidget extends Widget {
|
|
|
|
update(data) {
|
|
|
|
const extractedData = this.extractor(data)
|
|
|
|
this.time.textContent = formatSeconds(extractedData.time)
|
|
|
|
this.mode.textContent = modeMap[extractedData.mode]
|
|
|
|
this.mode.className = ['mission-info-mode', 'mission-info-mode-' + extractedData.mode.toLowerCase()].join(' ')
|
|
|
|
}
|
|
|
|
|
|
|
|
initDOM() {
|
|
|
|
const container = document.createElement('div')
|
|
|
|
container.className = 'mission-info-container'
|
|
|
|
|
|
|
|
this.time = document.createElement('div')
|
|
|
|
this.time.className = 'mission-info-time'
|
|
|
|
container.appendChild(this.time)
|
|
|
|
|
|
|
|
this.mode = document.createElement('div')
|
|
|
|
this.mode.className = 'mission-info-mode'
|
|
|
|
container.appendChild(this.mode)
|
|
|
|
|
|
|
|
return container
|
|
|
|
}
|
|
|
|
|
|
|
|
initContent() {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|