Skip to content

Commit 2455d1e

Browse files
committed
[#137] Add light-weight protocol filter
1 parent 42b3b5c commit 2455d1e

File tree

4 files changed

+36
-7
lines changed

4 files changed

+36
-7
lines changed

frontend/src/App.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ import ManualControlView from "@/views/ManualControlView.vue";
88
import ProtocolList from "@/components/protocol/ProtocolList.vue";
99
import {useQuasar} from "quasar";
1010
import {useUiStateStore} from "@/store/uiState";
11+
import {useProtocolStore} from "@/store/protocolState";
1112
1213
const uiStore = useUiStateStore()
14+
const protocolStore = useProtocolStore()
1315
1416
const toggleLeftDrawer = () => {
1517
uiStore.leftDrawerOpen = !uiStore.leftDrawerOpen
@@ -99,7 +101,7 @@ const dev = computed(() => {
99101
<q-drawer v-model="uiStore.rightDrawerOpen" side="right" bordered :width="uiStore.rightDrawerWidth">
100102
<div v-touch-pan.preserveCursor.prevent.mouse.horizontal="resizeRightDrawer"
101103
class="q-right-drawer__resizer"></div>
102-
<ProtocolList dense/>
104+
<ProtocolList dense :protocol-entries="protocolStore.protocolEntries"/>
103105
</q-drawer>
104106

105107
<q-page-container>

frontend/src/components/protocol/ProtocolList.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
<script setup lang="ts">
22
import ProtocolItem from "@/components/protocol/ProtocolItem.vue";
3-
import {useProtocolStore} from "@/store/protocolState";
3+
import type {ProtocolEntry} from "@/proto/ssl_gc_api";
44
55
defineProps<{
66
dense?: boolean,
7+
protocolEntries: ProtocolEntry[],
78
}>()
89
9-
const store = useProtocolStore()
10-
1110
</script>
1211

1312
<template>
@@ -17,7 +16,7 @@ const store = useProtocolStore()
1716
virtual-scroll-item-size="50"
1817
virtual-scroll-slice-ratio-before="0.5"
1918
virtual-scroll-slice-ratio-after="0.5"
20-
:items="store.protocolEntries"
19+
:items="protocolEntries"
2120
>
2221
<template v-slot="{ item, index }">
2322
<ProtocolItem

frontend/src/helpers/ChangeDetails.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type {Change, Change_UpdateConfig, Change_UpdateTeamState} from "@/proto/
55
import type {GameEvent} from "@/proto/ssl_gc_game_event";
66
import type {Team} from "@/proto/ssl_gc_common";
77

8-
interface ChangeDetails {
8+
export interface ChangeDetails {
99
typeName: string,
1010
title: string,
1111
gameEvent?: GameEvent,

frontend/src/views/ProtocolView.vue

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,35 @@
11
<script setup lang="ts">
22
import ProtocolList from "@/components/protocol/ProtocolList.vue";
3+
import {useProtocolStore} from "@/store/protocolState";
4+
import {computed, ref} from "vue";
5+
import {changeDetails, type ChangeDetails} from "@/helpers/ChangeDetails";
6+
7+
const protocolStore = useProtocolStore()
8+
9+
const command = ref(true)
10+
const gameEvent = ref(true)
11+
const other = ref(true)
12+
13+
const showChange = (change: ChangeDetails) => {
14+
if (change.typeName === 'Command') {
15+
return command.value
16+
}
17+
if (change.typeName === 'Game Event') {
18+
return gameEvent.value
19+
}
20+
return other.value
21+
}
22+
23+
const protocolEntries = computed(() => {
24+
return protocolStore.protocolEntries.filter(entry => showChange(changeDetails(entry.change!)))
25+
})
326
</script>
427

528
<template>
6-
<ProtocolList/>
29+
<div class="q-ma-sm">
30+
<q-checkbox v-model="command" label="Command"/>
31+
<q-checkbox v-model="gameEvent" label="Game Event"/>
32+
<q-checkbox v-model="other" label="Other"/>
33+
</div>
34+
<ProtocolList :protocol-entries="protocolEntries"/>
735
</template>

0 commit comments

Comments
 (0)