Skip to content

Commit

Permalink
fix #219
Browse files Browse the repository at this point in the history
  • Loading branch information
cars10 committed Mar 22, 2024
1 parent c572134 commit 8b9aa88
Show file tree
Hide file tree
Showing 4 changed files with 440 additions and 423 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
* adds request logging to desktop app
* fix issue when elasticsearch url ends with a slash, fixes [#214](https://github.com/cars10/elasticvue/pull/214)
* fix build setup when hosting elasticvue on a subdirectory
* fix error when showing documents that include `id` prop, fixes [#219](https://github.com/cars10/elasticvue/issues/219)

## 1.0.4

* show shard size on hover, fixes [#199](https://github.com/cars10/elasticvue/pull/199) and [#203](https://github.com/cars10/elasticvue/pull/203)
* show shard size on hover, fixes [#199](https://github.com/cars10/elasticvue/pull/199)
and [#203](https://github.com/cars10/elasticvue/pull/203)
* fix cluster selection filter, fixes [#210](https://github.com/cars10/elasticvue/issues/210)
* limit index bulk actions to 16 indices sent in chunks, fixes [#213](https://github.com/cars10/elasticvue/issues/213)

Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
"pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^3.2.1",
"pretty-bytes": "^6.1.1",
"quasar": "^2.14.7",
"quasar": "^2.15.1",
"vue": "^3.4.21",
"vue-i18n": "^9.10.1",
"vue-i18n": "^9.10.2",
"vue-resizable": "^2.1.7",
"vue-router": "^4.3.0"
},
Expand All @@ -42,12 +42,12 @@
"@vue/eslint-config-typescript": "^13.0.0",
"@vue/tsconfig": "^0.5.1",
"eslint": "^8.57.0",
"eslint-plugin-vue": "^9.22.0",
"sass": "^1.71.1",
"typescript": "^5.4.2",
"vite": "^5.1.5",
"vite-bundle-visualizer": "^1.0.1",
"vitest": "^1.3.1",
"vue-tsc": "^2.0.6"
"eslint-plugin-vue": "^9.23.0",
"sass": "^1.72.0",
"typescript": "^5.4.3",
"vite": "^5.2.3",
"vite-bundle-visualizer": "^1.1.0",
"vitest": "^1.4.0",
"vue-tsc": "^2.0.7"
}
}
17 changes: 16 additions & 1 deletion src/models/SearchResults.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { DEFAULT_SEARCH_RESULT_COLUMNS } from '../consts'

const RENAMED_ID = ' id'

export default class SearchResults {
columns: string[]
indices: string[]
Expand All @@ -20,12 +22,25 @@ export default class SearchResults {
add (result: any) {
let key = '_source'
if (!result._source && result.fields) key = 'fields'
if (result[key]) this.columns = this.columns.concat(Object.keys(result[key]))
if (result[key]) {
const newKeys = Object.keys(result[key])
const idIndex = newKeys.indexOf('id')
if (idIndex > -1 && !this.columns.includes(RENAMED_ID)) {
newKeys.splice(idIndex, 1)
newKeys.push(RENAMED_ID)
}
this.columns = this.columns.concat(newKeys)
}
this.indices.push(result._index)

const el = Object.assign({}, result, result[key])
if (!el._type) el._type = '_doc'
delete el[key]

if (el.hasOwnProperty('id')) {
el[RENAMED_ID] = el.id
delete el.id
}
this.docs.push(el)
}
}
Loading

0 comments on commit 8b9aa88

Please sign in to comment.