Skip to content

Commit

Permalink
Feature: search in event list.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rena-Yuan committed May 31, 2022
1 parent 621f750 commit 5b8a15e
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 24 deletions.
3 changes: 3 additions & 0 deletions frontend/src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export const getEvent = (options) => {
} else if (options && options.hasOwnProperty('page') && options.page) {
url += '/page/' + options.page
}
if (options.searchStr && options.searchStr.trim()) {
url += '/search/' + options.searchStr.trim().split(/\s+/).join('+')
}
return axios({
url: url
})
Expand Down
30 changes: 22 additions & 8 deletions frontend/src/components/BugitDevices.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<template>
<div class="split-right-bar">
<p style="line-height:28px;vertical-align:middle;">
<Row class="split-right-bar">
<i-col span="14">
<span style="padding-left:10px;padding-right:10px">
<b>Devices:</b>
</span>
<span v-if="noneDevices">
<b>N/A - Please connect your phone to your computer using a USB cable</b>
No devices
</span>
<span v-for="(device, index) in devicesInfo" :key="index" class="device-btn-group">
<a @click="addDevice(device)" class="device-btn">
<Tooltip max-width="400" placement="bottom-end">
<Tooltip max-width="400" placement="bottom-end" transfer>
<span>
<Icon v-if="device.platform === 'Android'" type="logo-android"/>
<Icon v-else type="logo-apple"/>
Expand All @@ -29,14 +29,19 @@
</Tooltip>
</a>
<a class="screenshot-btn" @click="takeScreenshot(device)">
<Tooltip placement="bottom-end">
<Tooltip placement="bottom-end" transfer>
<Icon type="md-images"/>
<div slot="content">Take a screenshot</div>
</Tooltip>
</a>
</span>
</p>
</div>
</i-col>
<i-col span="10" style="padding-right: 10px;">
<span>
<Input v-model="searchStr" prefix="ios-search" placeholder="Separate multiple keywords by spaces" size="small" type="text" style="vertical-align: baseline;" clearable />
</span>
</i-col>
</Row>
</template>

<script>
Expand All @@ -56,6 +61,14 @@ export default {
},
noneDevices () {
return this.devicesInfo === null || this.devicesInfo.length === 0
},
searchStr: {
get () {
return this.$store.state.event.searchStr
},
set (val) {
this.$store.commit('setSearchStr', val)
}
}
},
methods: {
Expand Down Expand Up @@ -84,11 +97,12 @@ export default {

<style scoped>
.split-right-bar {
height: 28px;
height: 32px;
overflow-x: auto;
overflow-y: hidden;
white-space: nowrap;
border-bottom: 1px solid #dcdee2;
line-height: 32px;
}
.device-btn-group {
margin: 2px 2px;
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/components/BugitExtra.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ export default {
EventInspector,
CodeEditor
},
data() {
data () {
return {
detailSplit: 0.6,
scrollRate: 0
}
},
created() {
created () {
this.$bus.$on('eventLitScroll', this.setEventContainerScroll)
},
computed: {
eventDetail: {
get() {
get () {
return this.$store.state.event.eventDetail
},
set(val) {
Expand All @@ -40,7 +40,7 @@ export default {
}
},
methods: {
addDescAttach(row) {
addDescAttach (row) {
if (this.channelAddToDesc.indexOf(row.channel) > -1) {
this.dispatch('addIntoDesc', row.id)
} else if (this.channelAddToAttach.indexOf(row.channel) > -1) {
Expand All @@ -50,7 +50,7 @@ export default {
'Add description and attachments have not supported yet!'
)
},
timestampToTime(timeStamp) {
timestampToTime (timeStamp) {
let date = new Date(timeStamp * 1000)
let hour = date.getHours() + ':'
let minute =
Expand All @@ -60,10 +60,10 @@ export default {
date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
return hour + minute + second
},
getColunmsFilterItem() {
getColunmsFilterItem () {
return []
},
setEventContainerScroll(event) {
setEventContainerScroll (event) {
this.scrollRate = event
setTimeout(() => {
const container = this.$refs.eventContainer
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/event/CodeEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ export default {
value: this.content,
language: this.language,
theme: 'vs',
readOnly: this.readOnly
readOnly: this.readOnly,
automaticLayout: true
}
)
this.editor.addAction({
Expand Down
20 changes: 19 additions & 1 deletion frontend/src/components/event/EventInspector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ export default {
tableRect: null,
isContextMenuShown: false,
contextMenuLeft: 0,
contextMenuTop: 0
contextMenuTop: 0,
refreshEventListTimer: null
}
},
computed: {
Expand Down Expand Up @@ -130,6 +131,23 @@ export default {
slot: 'content'
}
]
},
searchStr () {
return this.$store.state.event.searchStr
}
},
watch: {
searchStr (newValue, oldValue) {
if (newValue === null) {
newValue = ''
}
clearTimeout(this.refreshEventListTimer)
this.refreshEventListTimer = setTimeout(() => {
if (newValue.trim() !== oldValue.trim()) {
this.$store.dispatch('loadEvents')
clearTimeout(this.refreshEventListTimer)
}
}, 500)
}
},
methods: {
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/form/CompoundTextAreaFormItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ export default {
components: {
MovableDescription
},
created() {
created () {
this.$bus.$on('addMessage', this.addDesc)
},
methods: {
addDesc(desc) {
addDesc (desc) {
this.$store.commit('addExtraMsg', { index: this.index, value: desc })
},
deleteDesc(index) {
deleteDesc (index) {
this.$store.commit('deleteExtraMsg', { index, propsIndex: this.index })
},
sortDesc(index) {
sortDesc (index) {
this.$store.dispatch('setExtraMsgUpward', { index, propsIndex: this.index })
}
},
Expand Down
13 changes: 11 additions & 2 deletions frontend/src/store/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export default {
loadingEvents: false,
selectedEventId: null,
eventDetail: '',
page: null
page: null,
searchStr: ''
},
mutations: {
setChannelNames (state, channelNames) {
Expand All @@ -32,6 +33,9 @@ export default {
},
setPage (state, page) {
state.page = page
},
setSearchStr (state, searchStr) {
state.searchStr = searchStr
}
},
actions: {
Expand All @@ -51,7 +55,12 @@ export default {
eventId = state.selectedEventId
}
commit('setLoadingEvents', true)
api.getEvent({ channelFilters: state.channelFilters, eventId: eventId, page: options.page }).then(response => {
api.getEvent({
channelFilters: state.channelFilters,
eventId: eventId,
page: options.page,
searchStr: state.searchStr
}).then(response => {
if (response.data.code === 1000) {
let events = response.data.events
if (eventId) {
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name='lyrebird-bugit',
version='1.11.0',
version='1.12.0',
packages=['lyrebird_bugit'],
url='https://github.com/Meituan-Dianping/lyrebird-bugit',
author='HBQA',
Expand Down

0 comments on commit 5b8a15e

Please sign in to comment.