Skip to content

Commit 76dfd98

Browse files
authored
Merge pull request #1 from JuanToledo23/fix/mission-log-filters-persist-on-navigation
Add computed properties for filter values in LaunchesView to enhance …
2 parents 9efdeab + 418cdb5 commit 76dfd98

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

frontend/src/views/LaunchesView.vue

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
<select
7070
id="filter-outcome"
7171
aria-label="Filter by outcome"
72+
:value="outcomeSelectValue"
7273
@change="onSuccessFilter($event.target.value)"
7374
>
7475
<option value="">
@@ -88,6 +89,7 @@
8889
<select
8990
id="filter-timeline"
9091
aria-label="Filter by timeline"
92+
:value="timelineSelectValue"
9193
@change="onUpcomingFilter($event.target.value)"
9294
>
9395
<option value="">
@@ -108,6 +110,7 @@
108110
v-if="rocketsStore.items.length"
109111
id="filter-vehicle"
110112
aria-label="Filter by vehicle"
113+
:value="vehicleSelectValue"
111114
@change="launchesStore.setFilters({ rocket_id: $event.target.value || null })"
112115
>
113116
<option value="">
@@ -232,6 +235,20 @@ const maxLaunches = computed((): number => {
232235
return Math.max(...dashStore.data.launches_by_rocket.map((d) => d.count))
233236
})
234237
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+
235252
function barWidth(count: number): string { return Math.round((count / maxLaunches.value) * 100) + '%' }
236253
function onSuccessFilter(val: string): void { launchesStore.setFilters({ success: val === '' ? null : val === 'true' }) }
237254
function onUpcomingFilter(val: string): void { launchesStore.setFilters({ upcoming: val === '' ? null : val === 'true' }) }

0 commit comments

Comments
 (0)