Skip to content

Commit

Permalink
fix #181
Browse files Browse the repository at this point in the history
  • Loading branch information
cars10 committed Jan 7, 2024
1 parent be5488a commit 56d6e75
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
* fixes issue with old versions of elasticsearch that do not provide a uuid, fixes [#182][i182]
* adds document meta information when editing documents, fixes [#187][i187]
* remap hotkey for sending rest request to `Ctrl+Enter`, fixes [#183][i183]
* cache index table filter, fixes [#181][i181]

[i182]: https://github.com/cars10/elasticvue/issues/182
[i187]: https://github.com/cars10/elasticvue/issues/187
[i183]: https://github.com/cars10/elasticvue/issues/183
[i181]: https://github.com/cars10/elasticvue/issues/181

## 1.0.1

Expand Down
3 changes: 1 addition & 2 deletions src/components/indices/IndicesTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</div>

<div class="flex">
<filter-input v-model="filter" />
<filter-input v-model="indicesStore.filter" />

<q-btn icon="settings" round flat class="q-ml-sm">
<q-menu style="white-space: nowrap" anchor="bottom right" self="top end">
Expand Down Expand Up @@ -95,7 +95,6 @@
const {
indicesStore,
resizeStore,
filter,
items,
tableKey,
rowsPerPage,
Expand Down
4 changes: 2 additions & 2 deletions src/components/shared/FilterInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
const t = useTranslation()
defineProps<{ modelValue: string }>()
const props = defineProps<{ modelValue: string }>()
const emit = defineEmits(['update:modelValue'])
const filter = ref('')
const filter = ref(props.modelValue)
watch(filter, newValue => (emit('update:modelValue', newValue)))
</script>
6 changes: 2 additions & 4 deletions src/composables/components/indices/IndicesTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export const useIndicesTable = (props: EsTableProps, emit: any) => {
const indicesStore = useIndicesStore()
const resizeStore = useResizeStore()

const filter = ref('')
const items: Ref<ElasticsearchIndex[]> = ref([])
const tableKey = ref(0)

Expand All @@ -50,12 +49,12 @@ export const useIndicesTable = (props: EsTableProps, emit: any) => {
results = results.filter((item: any) => !item.index.match(new RegExp(indicesStore.hideIndicesRegex)))
}

results = filterItems(results, filter.value, ['index', 'uuid'])
results = filterItems(results, indicesStore.filter, ['index', 'uuid'])
items.value = results.map((index: any) => new ElasticsearchIndex(index))
}

const debouncedFilterTable = debounce(filterTable, 150)
watch(() => filter.value, debouncedFilterTable)
watch(() => indicesStore.filter, debouncedFilterTable)
watch(() => indicesStore.showHiddenIndices, filterTable)
watch(() => props.indices, filterTable)
watch(() => indicesStore.stickyTableHeader, () => (tableKey.value += 1))
Expand Down Expand Up @@ -84,7 +83,6 @@ export const useIndicesTable = (props: EsTableProps, emit: any) => {
return {
indicesStore,
resizeStore,
filter,
items,
tableKey,
rowsPerPage,
Expand Down
2 changes: 1 addition & 1 deletion src/composables/components/search/EditDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const useEditDocument = (props: EditDocumentProps, emit: any) => {
}

const validDocumentMeta = computed(() => {
return Object.fromEntries(Object.entries(documentMeta.value).filter(([_, v]) => v != null))
return Object.fromEntries(Object.entries(documentMeta.value).filter((keyval) => keyval[1] != null))
})

const { run, loading } = defineElasticsearchRequest({ emit, method: 'index' })
Expand Down
2 changes: 2 additions & 0 deletions src/store/indices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import { defineStore } from 'pinia'
import { DEFAULT_HIDE_INDICES_REGEX } from '../consts'

type IndicesState = {
filter: string,
showHiddenIndices: boolean,
stickyTableHeader: boolean,
hideIndicesRegex: string
}

export const useIndicesStore = defineStore('indices', {
state: (): IndicesState => ({
filter: '',
showHiddenIndices: false,
stickyTableHeader: false,
hideIndicesRegex: DEFAULT_HIDE_INDICES_REGEX
Expand Down

0 comments on commit 56d6e75

Please sign in to comment.