fix: show empty state for search results, es6
This commit is contained in:
@@ -30,6 +30,15 @@
|
|||||||
{{ key }}
|
{{ key }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="theOutput.length === 0"
|
||||||
|
class="flex flex-col text-secondaryLight p-4 items-center justify-center"
|
||||||
|
>
|
||||||
|
<i class="opacity-75 pb-2 material-icons">manage_search</i>
|
||||||
|
<span class="text-center">
|
||||||
|
{{ $t("state.nothing_found") }} "{{ search }}"
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -138,16 +147,14 @@ export default {
|
|||||||
async output(search) {
|
async output(search) {
|
||||||
const that = this
|
const that = this
|
||||||
if ((await this.idx) && (await this.idx.search)) {
|
if ((await this.idx) && (await this.idx.search)) {
|
||||||
return this.idx.search(`${search}*`).map(function (valu) {
|
return this.idx
|
||||||
return that.input[+valu.ref]
|
.search(`${search}*`)
|
||||||
}, that)
|
.map(({ ref }) => that.input[+ref], that)
|
||||||
}
|
}
|
||||||
if (this.idx.then)
|
if (this.idx.then)
|
||||||
return this.idx.then((index) => {
|
return this.idx.then((index) =>
|
||||||
return index.search(`${search}*`).map(function (valu) {
|
index.search(`${search}*`).map(({ ref }) => that.input[+ref], that)
|
||||||
return that.input[+valu.ref]
|
)
|
||||||
}, that)
|
|
||||||
})
|
|
||||||
// no index
|
// no index
|
||||||
return this.input
|
return this.input
|
||||||
},
|
},
|
||||||
@@ -158,7 +165,7 @@ export default {
|
|||||||
// if (this.log) console.log("feilds from ", first)
|
// if (this.log) console.log("feilds from ", first)
|
||||||
|
|
||||||
const stopWords = this.stopWords
|
const stopWords = this.stopWords
|
||||||
const documents = this.input.map(function (val, i) {
|
const documents = this.input.map((val, i) => {
|
||||||
const doc = {}
|
const doc = {}
|
||||||
const seen = []
|
const seen = []
|
||||||
function replacer(key, value) {
|
function replacer(key, value) {
|
||||||
@@ -170,7 +177,7 @@ export default {
|
|||||||
}
|
}
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
Object.keys(val).forEach(function (key) {
|
Object.keys(val).forEach((key) => {
|
||||||
doc[key] = JSON.stringify(val[key], replacer)
|
doc[key] = JSON.stringify(val[key], replacer)
|
||||||
})
|
})
|
||||||
return { __id: i, ...val }
|
return { __id: i, ...val }
|
||||||
@@ -211,7 +218,7 @@ export default {
|
|||||||
hex32(val) {
|
hex32(val) {
|
||||||
val &= 0xffffffff
|
val &= 0xffffffff
|
||||||
const hex = val.toString(16).toUpperCase()
|
const hex = val.toString(16).toUpperCase()
|
||||||
return ("00000000" + hex).slice(-8)
|
return `00000000${hex}`.slice(-8)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,11 +102,11 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
hideModal() {
|
hideModal() {
|
||||||
|
this.search = ""
|
||||||
this.$emit("hide-modal")
|
this.$emit("hide-modal")
|
||||||
},
|
},
|
||||||
runAction(command) {
|
runAction(command) {
|
||||||
invokeAction(command, "path_from_invokeAction")
|
invokeAction(command, "path_from_invokeAction")
|
||||||
this.search = ""
|
|
||||||
this.hideModal()
|
this.hideModal()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user