From 6fe47ffb77aeefb3a633ff9037ef226c0852a04f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20K=C3=B6nig?= Date: Sun, 31 Dec 2023 17:41:13 +0100 Subject: [PATCH 1/8] can autorefresh every second --- src/components/shared/TimerSelect.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/shared/TimerSelect.vue b/src/components/shared/TimerSelect.vue index af7cc801..63d0b654 100644 --- a/src/components/shared/TimerSelect.vue +++ b/src/components/shared/TimerSelect.vue @@ -16,6 +16,7 @@ const t = useTranslation() const timerSettings = [ { label: 'None', value: null }, + { label: '1s', value: 1 }, { label: '5s', value: 5 }, { label: '15s', value: 15 }, { label: '30s', value: 30 }, From 527db340560ad30c2e80595bf8823d56829e4a1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20K=C3=B6nig?= Date: Sun, 31 Dec 2023 17:54:29 +0100 Subject: [PATCH 2/8] upload more artifacts for windows & linux --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d495622b..2fb6d384 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,7 +68,7 @@ jobs: if: matrix.platform == 'ubuntu-latest' uses: actions/upload-artifact@v3 with: - path: src-tauri/target/release/bundle/appimage/elasticvue_*_amd64.AppImage + path: src-tauri/target/release/bundle/appimage/elasticvue_*_amd64.* - name: (linux) upload binary id: linux_upload_binary @@ -81,7 +81,7 @@ jobs: if: matrix.platform == 'windows-latest' uses: actions/upload-artifact@v3 with: - path: src-tauri/target/release/bundle/msi/elasticvue_*_x64_en-US.msi + path: src-tauri/target/release/bundle/msi/elasticvue_*_x64* - name: (windows) upload .exe if: matrix.platform == 'windows-latest' From 558887d268db634591314c2b845880576116b397 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20K=C3=B6nig?= Date: Tue, 2 Jan 2024 18:02:20 +0100 Subject: [PATCH 3/8] fix #182 --- CHANGELOG.md | 6 ++++++ src/composables/ClusterConnection.ts | 2 +- src/composables/components/home/ClusterHealth.ts | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b70651b..907bcbc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 1.0.2 + +* fixes issue with old versions of elasticsearch that do not provide a uuid, fixes [#182][i182] + +[i182]: https://github.com/cars10/elasticvue/issues/182 + ## 1.0.1 This release fixes some bugs that where introduced in `1.0`. It also adds the ability to configure clusters when using diff --git a/src/composables/ClusterConnection.ts b/src/composables/ClusterConnection.ts index ea4c6d50..3130fb13 100644 --- a/src/composables/ClusterConnection.ts +++ b/src/composables/ClusterConnection.ts @@ -110,7 +110,7 @@ export const useClusterConnection = (cluster: Ref) => { } } -const clusterUuid = (infoJson: any) => { +export const clusterUuid = (infoJson: any) => { if (infoJson.cluster_uuid) return infoJson.cluster_uuid // fallback for elasticsearch < 5 diff --git a/src/composables/components/home/ClusterHealth.ts b/src/composables/components/home/ClusterHealth.ts index 8af64b16..5fe94b26 100644 --- a/src/composables/components/home/ClusterHealth.ts +++ b/src/composables/components/home/ClusterHealth.ts @@ -1,5 +1,6 @@ import { ElasticsearchCluster, ElasticsearchClusterCredentials, useConnectionStore } from '../../../store/connection.ts' import ElasticsearchAdapter from '../../../services/ElasticsearchAdapter.ts' +import { clusterUuid } from '../../ClusterConnection.ts' export const useClusterHealth = () => { const connectionStore = useConnectionStore() @@ -34,7 +35,7 @@ export const checkHealth = async (cluster: ElasticsearchCluster) => { cluster.clusterName = pingBody.cluster_name cluster.version = version cluster.majorVersion = version[0] - if (pingBody.cluster_uuid) cluster.uuid = pingBody.cluster_uuid + if (!cluster.uuid || cluster.uuid.length === 0) cluster.uuid = clusterUuid(pingBody) delete cluster.loading } catch (e) { From 0137b5afc1c2e0aea6b7f456ef98a43d6bfa2568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20K=C3=B6nig?= Date: Sun, 7 Jan 2024 15:56:56 +0100 Subject: [PATCH 4/8] fix #187 --- CHANGELOG.md | 2 ++ src/components/search/EditDocument.vue | 14 ++++++++++- .../components/search/EditDocument.ts | 25 ++++++++++++++++++- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 907bcbc3..cc38dc3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,10 @@ ## 1.0.2 * 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] [i182]: https://github.com/cars10/elasticvue/issues/182 +[i187]: https://github.com/cars10/elasticvue/issues/187 ## 1.0.1 diff --git a/src/components/search/EditDocument.vue b/src/components/search/EditDocument.vue index 54cf1857..57056509 100644 --- a/src/components/search/EditDocument.vue +++ b/src/components/search/EditDocument.vue @@ -15,7 +15,18 @@ - + + + + {{ key }} + + + {{ value }} + + + + + @@ -54,6 +65,7 @@ const { document, + validDocumentMeta, ownValue, loadDocument, requestState, diff --git a/src/composables/components/search/EditDocument.ts b/src/composables/components/search/EditDocument.ts index 7b418166..728a0c39 100644 --- a/src/composables/components/search/EditDocument.ts +++ b/src/composables/components/search/EditDocument.ts @@ -1,4 +1,4 @@ -import { ref, watch, Ref } from 'vue' +import { ref, watch, Ref, computed } from 'vue' import { useTranslation } from '../../i18n.ts' import { defineElasticsearchRequest, @@ -17,10 +17,20 @@ export type ElasticsearchDocumentInfo = { _routing?: string } +type ElasticsearchDocumentMeta = { + _index?: string, + _type?: string, + _id?: string, + _version?: number, + _primary_term?: number, + _seq_no?: number +} + export const useEditDocument = (props: EditDocumentProps, emit: any) => { const ownValue = ref(false) const t = useTranslation() const document = ref('') + const documentMeta = ref({} as ElasticsearchDocumentMeta) const { requestState, callElasticsearch } = useElasticsearchAdapter() const data: Ref = ref(null) @@ -45,8 +55,20 @@ export const useEditDocument = (props: EditDocumentProps, emit: any) => { const loadDocument = async () => { await load() document.value = stringifyJson(data.value._source) + documentMeta.value = { + _index: data.value._index, + _type: data.value._type, + _id: data.value._id, + _version: data.value._version, + _primary_term: data.value._primary_term, + _seq_no: data.value._seq_no + } } + const validDocumentMeta = computed(() => { + return Object.fromEntries(Object.entries(documentMeta.value).filter(([_, v]) => v != null)) + }) + const { run, loading } = defineElasticsearchRequest({ emit, method: 'index' }) const updateDocument = async () => { await run({ @@ -63,6 +85,7 @@ export const useEditDocument = (props: EditDocumentProps, emit: any) => { return { document, + validDocumentMeta, ownValue, loadDocument, requestState, From be5488a6f5d3bef89a3a75a09e771ef7f2504842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20K=C3=B6nig?= Date: Sun, 7 Jan 2024 16:09:42 +0100 Subject: [PATCH 5/8] fix #183 --- CHANGELOG.md | 2 ++ src/composables/CodeEditor.ts | 4 ++-- src/composables/components/rest/RestQueryForm.ts | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc38dc3d..936e370a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,11 @@ * 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] [i182]: https://github.com/cars10/elasticvue/issues/182 [i187]: https://github.com/cars10/elasticvue/issues/187 +[i183]: https://github.com/cars10/elasticvue/issues/183 ## 1.0.1 diff --git a/src/composables/CodeEditor.ts b/src/composables/CodeEditor.ts index 40983c7d..0eb224fd 100644 --- a/src/composables/CodeEditor.ts +++ b/src/composables/CodeEditor.ts @@ -1,7 +1,7 @@ import { onMounted, Ref, watch } from 'vue' import { EditorView, basicSetup } from 'codemirror' import { KeyBinding, keymap } from '@codemirror/view' -import { Compartment } from '@codemirror/state' +import { Compartment, Prec } from '@codemirror/state' import { indentWithTab } from '@codemirror/commands' import { json } from '@codemirror/lang-json' import { baseTheme } from './CodeEditor/theme.ts' @@ -83,7 +83,7 @@ export const useCodeEditor = (editorRef: Ref, { autocompletion({ override: [completions] }), onChange, keymap.of([indentWithTab]), - keymap.of(commands || []), + Prec.highest(keymap.of(commands || [])), keymap.of([{ key: 'Ctrl-Alt-l', mac: 'Ctrl-Cmd-l', run: beautifyEditorValue }]), wrapLines.of(codeEditorStore.wrapLines ? EditorView.lineWrapping : []), theme.of(baseTheme) diff --git a/src/composables/components/rest/RestQueryForm.ts b/src/composables/components/rest/RestQueryForm.ts index 37d48e67..a58cbe67 100644 --- a/src/composables/components/rest/RestQueryForm.ts +++ b/src/composables/components/rest/RestQueryForm.ts @@ -128,7 +128,7 @@ export const useRestQueryForm = (props: RestQueryFormProps, emit: any) => { }) const editorCommands = [{ - key: 'Alt-Enter', mac: 'Cmd-Enter', run: () => { + key: 'Ctrl-Enter', mac: 'Cmd-Enter', run: () => { sendRequest() return true } From 56d6e758fc45ae2463001b78cdfc5d66842cef0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20K=C3=B6nig?= Date: Sun, 7 Jan 2024 16:19:39 +0100 Subject: [PATCH 6/8] fix #181 --- CHANGELOG.md | 2 ++ src/components/indices/IndicesTable.vue | 3 +-- src/components/shared/FilterInput.vue | 4 ++-- src/composables/components/indices/IndicesTable.ts | 6 ++---- src/composables/components/search/EditDocument.ts | 2 +- src/store/indices.ts | 2 ++ 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 936e370a..bfd374dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/components/indices/IndicesTable.vue b/src/components/indices/IndicesTable.vue index d3528478..08837bbb 100644 --- a/src/components/indices/IndicesTable.vue +++ b/src/components/indices/IndicesTable.vue @@ -9,7 +9,7 @@
- + @@ -95,7 +95,6 @@ const { indicesStore, resizeStore, - filter, items, tableKey, rowsPerPage, diff --git a/src/components/shared/FilterInput.vue b/src/components/shared/FilterInput.vue index 7599d412..42efa2a9 100644 --- a/src/components/shared/FilterInput.vue +++ b/src/components/shared/FilterInput.vue @@ -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))) diff --git a/src/composables/components/indices/IndicesTable.ts b/src/composables/components/indices/IndicesTable.ts index 6f24f6c3..c4f3d61e 100644 --- a/src/composables/components/indices/IndicesTable.ts +++ b/src/composables/components/indices/IndicesTable.ts @@ -31,7 +31,6 @@ export const useIndicesTable = (props: EsTableProps, emit: any) => { const indicesStore = useIndicesStore() const resizeStore = useResizeStore() - const filter = ref('') const items: Ref = ref([]) const tableKey = ref(0) @@ -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)) @@ -84,7 +83,6 @@ export const useIndicesTable = (props: EsTableProps, emit: any) => { return { indicesStore, resizeStore, - filter, items, tableKey, rowsPerPage, diff --git a/src/composables/components/search/EditDocument.ts b/src/composables/components/search/EditDocument.ts index 728a0c39..1f93989d 100644 --- a/src/composables/components/search/EditDocument.ts +++ b/src/composables/components/search/EditDocument.ts @@ -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' }) diff --git a/src/store/indices.ts b/src/store/indices.ts index 0a10325c..07c12190 100644 --- a/src/store/indices.ts +++ b/src/store/indices.ts @@ -2,6 +2,7 @@ import { defineStore } from 'pinia' import { DEFAULT_HIDE_INDICES_REGEX } from '../consts' type IndicesState = { + filter: string, showHiddenIndices: boolean, stickyTableHeader: boolean, hideIndicesRegex: string @@ -9,6 +10,7 @@ type IndicesState = { export const useIndicesStore = defineStore('indices', { state: (): IndicesState => ({ + filter: '', showHiddenIndices: false, stickyTableHeader: false, hideIndicesRegex: DEFAULT_HIDE_INDICES_REGEX From 1d15d8a41abccfa36c7dc213759ba35a33982f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20K=C3=B6nig?= Date: Sun, 7 Jan 2024 16:26:21 +0100 Subject: [PATCH 7/8] autoformat --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfd374dc..d0777d7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,8 +8,11 @@ * 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 From 9bda926441afc910a7714bd4d3b4d8b2c2d3f955 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20K=C3=B6nig?= Date: Sun, 7 Jan 2024 16:27:26 +0100 Subject: [PATCH 8/8] bumps version to 1.0.2 --- browser_extension/chrome/manifest.json | 2 +- browser_extension/firefox/manifest.json | 2 +- package.json | 2 +- src-tauri/tauri.conf.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/browser_extension/chrome/manifest.json b/browser_extension/chrome/manifest.json index fda3e91e..18b34bb1 100644 --- a/browser_extension/chrome/manifest.json +++ b/browser_extension/chrome/manifest.json @@ -1,6 +1,6 @@ { "name": "Elasticvue", - "version": "1.0.1", + "version": "1.0.2", "description": "Elasticsearch frontend", "manifest_version": 3, "icons": { diff --git a/browser_extension/firefox/manifest.json b/browser_extension/firefox/manifest.json index b7e014b5..33691f4b 100644 --- a/browser_extension/firefox/manifest.json +++ b/browser_extension/firefox/manifest.json @@ -1,6 +1,6 @@ { "name": "Elasticvue", - "version": "1.0.1", + "version": "1.0.2", "description": "Elasticsearch frontend", "manifest_version": 2, "icons": { diff --git a/package.json b/package.json index 328b8dc5..95bc37ac 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "elasticvue", "private": true, - "version": "1.0.1", + "version": "1.0.2", "scripts": { "dev": "vite", "build": "vite build", diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index aa76d925..6817457f 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "package": { "productName": "elasticvue", - "version": "1.0.1" + "version": "1.0.2" }, "build": { "distDir": "../dist",