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' diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b70651b..d0777d7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 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] +* 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 This release fixes some bugs that where introduced in `1.0`. It also adds the ability to configure clusters when using 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", 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/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/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/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 }, 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/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/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) { 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/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 } diff --git a/src/composables/components/search/EditDocument.ts b/src/composables/components/search/EditDocument.ts index 7b418166..1f93989d 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((keyval) => keyval[1] != 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, 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