|
69 | 69 | <select |
70 | 70 | id="filter-outcome" |
71 | 71 | aria-label="Filter by outcome" |
| 72 | + :value="outcomeSelectValue" |
72 | 73 | @change="onSuccessFilter($event.target.value)" |
73 | 74 | > |
74 | 75 | <option value=""> |
|
88 | 89 | <select |
89 | 90 | id="filter-timeline" |
90 | 91 | aria-label="Filter by timeline" |
| 92 | + :value="timelineSelectValue" |
91 | 93 | @change="onUpcomingFilter($event.target.value)" |
92 | 94 | > |
93 | 95 | <option value=""> |
|
108 | 110 | v-if="rocketsStore.items.length" |
109 | 111 | id="filter-vehicle" |
110 | 112 | aria-label="Filter by vehicle" |
| 113 | + :value="vehicleSelectValue" |
111 | 114 | @change="launchesStore.setFilters({ rocket_id: $event.target.value || null })" |
112 | 115 | > |
113 | 116 | <option value=""> |
@@ -232,6 +235,20 @@ const maxLaunches = computed((): number => { |
232 | 235 | return Math.max(...dashStore.data.launches_by_rocket.map((d) => d.count)) |
233 | 236 | }) |
234 | 237 |
|
| 238 | +const outcomeSelectValue = computed(() => { |
| 239 | + const s = launchesStore.filters.success |
| 240 | + if (s === null) return '' |
| 241 | + return s ? 'true' : 'false' |
| 242 | +}) |
| 243 | +
|
| 244 | +const timelineSelectValue = computed(() => { |
| 245 | + const u = launchesStore.filters.upcoming |
| 246 | + if (u === null) return '' |
| 247 | + return u ? 'true' : 'false' |
| 248 | +}) |
| 249 | +
|
| 250 | +const vehicleSelectValue = computed(() => launchesStore.filters.rocket_id ?? '') |
| 251 | +
|
235 | 252 | function barWidth(count: number): string { return Math.round((count / maxLaunches.value) * 100) + '%' } |
236 | 253 | function onSuccessFilter(val: string): void { launchesStore.setFilters({ success: val === '' ? null : val === 'true' }) } |
237 | 254 | function onUpcomingFilter(val: string): void { launchesStore.setFilters({ upcoming: val === '' ? null : val === 'true' }) } |
|
0 commit comments