Skip to content

Commit

Permalink
automatic merge to finish v1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
cars10 committed Jan 7, 2024
2 parents 5d1570c + 9bda926 commit 83d3c64
Show file tree
Hide file tree
Showing 17 changed files with 72 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion browser_extension/chrome/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Elasticvue",
"version": "1.0.1",
"version": "1.0.2",
"description": "Elasticsearch frontend",
"manifest_version": 3,
"icons": {
Expand Down
2 changes: 1 addition & 1 deletion browser_extension/firefox/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Elasticvue",
"version": "1.0.1",
"version": "1.0.2",
"description": "Elasticsearch frontend",
"manifest_version": 2,
"icons": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "elasticvue",
"private": true,
"version": "1.0.1",
"version": "1.0.2",
"scripts": {
"dev": "vite",
"build": "vite build",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"package": {
"productName": "elasticvue",
"version": "1.0.1"
"version": "1.0.2"
},
"build": {
"distDir": "../dist",
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
14 changes: 13 additions & 1 deletion src/components/search/EditDocument.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,18 @@

<q-card-section>
<loader-status :request-state="requestState">
<resizable-container v-model="resizeStore.documentEdit">
<q-list v-if="validDocumentMeta" class="flex justify-between q-mb-md">
<q-item v-for="(value, key) of validDocumentMeta" :key="`${key}_${value}`" class="q-px-none q-mx-sm">
<q-item-section>
<q-item-label>{{ key }}</q-item-label>
</q-item-section>
<q-item-section side style="padding-left: 8px;">
<q-item-label>{{ value }}</q-item-label>
</q-item-section>
</q-item>
</q-list>

<resizable-container v-model="resizeStore.documentEdit" dense>
<code-editor v-model="document" />
</resizable-container>
</loader-status>
Expand Down Expand Up @@ -54,6 +65,7 @@
const {
document,
validDocumentMeta,
ownValue,
loadDocument,
requestState,
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>
1 change: 1 addition & 0 deletions src/components/shared/TimerSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
2 changes: 1 addition & 1 deletion src/composables/ClusterConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export const useClusterConnection = (cluster: Ref<ElasticsearchCluster>) => {
}
}

const clusterUuid = (infoJson: any) => {
export const clusterUuid = (infoJson: any) => {
if (infoJson.cluster_uuid) return infoJson.cluster_uuid

// fallback for elasticsearch < 5
Expand Down
4 changes: 2 additions & 2 deletions src/composables/CodeEditor.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -83,7 +83,7 @@ export const useCodeEditor = (editorRef: Ref<HTMLElement | null>, {
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)
Expand Down
3 changes: 2 additions & 1 deletion src/composables/components/home/ClusterHealth.ts
Original file line number Diff line number Diff line change
@@ -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()
Expand Down Expand Up @@ -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) {
Expand Down
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/rest/RestQueryForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
25 changes: 24 additions & 1 deletion src/composables/components/search/EditDocument.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ref, watch, Ref } from 'vue'
import { ref, watch, Ref, computed } from 'vue'
import { useTranslation } from '../../i18n.ts'
import {
defineElasticsearchRequest,
Expand All @@ -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<any> = ref(null)
Expand All @@ -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({
Expand All @@ -63,6 +85,7 @@ export const useEditDocument = (props: EditDocumentProps, emit: any) => {

return {
document,
validDocumentMeta,
ownValue,
loadDocument,
requestState,
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 83d3c64

Please sign in to comment.