Skip to content

Commit

Permalink
fix: script setup for filterSelect
Browse files Browse the repository at this point in the history
  • Loading branch information
DevJoaoLopes committed Jan 13, 2025
1 parent e73f005 commit ac4e505
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 22 deletions.
30 changes: 8 additions & 22 deletions packages/ui/client/components/FilterSelect.vue
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
<script lang="ts">
import type { PropType } from 'vue'
import { defineComponent } from 'vue'
<script setup lang="ts">
defineProps<{ options: string[] }>()
const emit = defineEmits(['update'])
export default defineComponent({
name: 'FilterSelect',
props: {
options: {
type: Array as PropType<string[]>,
required: true,
},
},
data() {
return {
selected: 'All',
}
},
methods: {
onChange() {
this.$emit('update', this.selected)
},
},
})
const selected = ref('All')
function onChange() {
emit('update', selected.value)
}
</script>

<template>
Expand Down
3 changes: 3 additions & 0 deletions packages/ui/client/composables/explorer/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export function useSearch(searchBox: Ref<HTMLDivElement | undefined>) {
const disableClearSearch = computed(() => search.value === '')
const debouncedSearch = ref(search.value)

const workspaceProjects = computed(() => [...new Set(uiEntries.value.filter(entry => entry.parentId === 'root').map(entry => entry.projectName))])

debouncedWatch(() => search.value, (value) => {
debouncedSearch.value = value?.trim() ?? ''
}, { debounce: 256 })
Expand Down Expand Up @@ -104,5 +106,6 @@ export function useSearch(searchBox: Ref<HTMLDivElement | undefined>) {
filteredFiles,
testsTotal,
uiEntries,
workspaceProjects,
}
}

0 comments on commit ac4e505

Please sign in to comment.