Skip to content

Commit 01a7654

Browse files
committed
fix #39
1 parent 7eb8d21 commit 01a7654

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
*Please check the [releases](https://github.com/cars10/elasticvue/releases) page if you need version release dates.*
44

5+
## unreleased
6+
7+
* [feat]: support `_bulk` api, fixes [#39][f39]
8+
9+
[f39]: https://github.com/cars10/elasticvue/issues/39
10+
11+
512
## 0.30.1
613

714
The only change in this release is a fix to the Dockerfile. The docker image should build again.

src/components/Query/Rest.vue

+8-2
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,14 @@
118118
try {
119119
JSON.parse(requestBody.value)
120120
return true
121-
} catch (error) {
122-
return false
121+
} catch (_error) {
122+
try {
123+
const possibleBulk = `[${requestBody.value.trim().split('\n').join(',')}]`
124+
JSON.parse(possibleBulk)
125+
return true
126+
} catch (_bulkError) {
127+
return false
128+
}
123129
}
124130
})
125131

src/components/shared/CodeEditor.vue

+6-3
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
if (this.value === '') return true
6868
if (typeof this.value === 'object') return true
6969
try {
70-
(JSON.parse(this.value))
70+
JSON.parse(this.value)
7171
return true
7272
} catch (error) {
7373
return false
@@ -123,8 +123,11 @@
123123
methods: {
124124
beautify () {
125125
if (this.value) {
126-
let newValue = this.stringifyJson(JSON.parse(this.editor.getValue()))
127-
this.$emit('input', newValue)
126+
try {
127+
let newValue = this.stringifyJson(JSON.parse(this.editor.getValue()))
128+
this.$emit('input', newValue)
129+
} catch (error) {
130+
}
128131
}
129132
},
130133
setReadOnly (value) {

0 commit comments

Comments
 (0)