TT#94606 Fix conversation infinite scroll

- Fixed infinite scroll
- Remove console.log

Change-Id: I09016a31a785fe34726ed54847a7d98bcd30cb41
mr9.1.1
Hans-Peter Herzog 5 years ago
parent 235f0ff30c
commit 598084b037

@ -214,7 +214,6 @@ export function uploadSoundFile (options) {
export function setLoopPlay (options) {
return new Promise((resolve, reject) => {
console.log(options)
patchReplaceFull({
path: 'api/soundfiles/' + options.soundFileId,
fieldPath: 'loopplay',

@ -55,7 +55,6 @@ export default {
return {}
},
mounted () {
console.log(this.$attrs)
}
}
</script>

@ -64,7 +64,6 @@ export default {
},
methods: {
fileInput (fileList) {
console.log(fileList)
this.selectedFile = fileList[0]
}
}

@ -263,7 +263,6 @@ export default {
this.cancel()
},
remove () {
console.log('remove')
this.$emit('remove')
},
init () {

@ -31,6 +31,7 @@
</q-page-sticky>
<q-infinite-scroll
ref="infiniteScroll"
:offset="500"
@load="loadNextPage"
>
<template
@ -48,26 +49,23 @@
class="col-sm-12 col-md-8"
no-border
>
<template
<csc-conversation-item
v-for="(item, index) in items"
>
<csc-conversation-item
:key="item.type + '-' + item.id"
:item="item"
:class="'q-pa-md csc-item-' + ((index % 2 === 0)?'odd':'even')"
:call-available="isCallEnabled"
:blocked-incoming="blockedIncoming(item)"
:blocked-outgoing="blockedOutgoing(item)"
@start-call="startCall"
@download-fax="downloadFax"
@download-voice-mail="downloadVoiceMail"
@play-voice-mail="playVoiceMail"
@toggle-block-incoming="toggleBlockIncoming"
@toggle-block-outgoing="toggleBlockOutgoing"
@toggle-block-both="toggleBlockBoth"
@delete-voicemail="$refs.confirmDeletionDialog.open();deletionId=$event.id"
/>
</template>
:key="item.type + '-' + item.id"
:item="item"
:class="'q-pa-md csc-item-' + ((index % 2 === 0)?'odd':'even')"
:call-available="isCallEnabled"
:blocked-incoming="blockedIncoming(item)"
:blocked-outgoing="blockedOutgoing(item)"
@start-call="startCall"
@download-fax="downloadFax"
@download-voice-mail="downloadVoiceMail"
@play-voice-mail="playVoiceMail"
@toggle-block-incoming="toggleBlockIncoming"
@toggle-block-outgoing="toggleBlockOutgoing"
@toggle-block-both="toggleBlockBoth"
@delete-voicemail="$refs.confirmDeletionDialog.open();deletionId=$event.id"
/>
</q-list>
<div
v-else-if="!isNextPageRequesting && items.length === 0"
@ -193,7 +191,8 @@
import platformMixin from '../../../mixins/platform'
import {
mapGetters,
mapActions
mapActions,
mapState
} from 'vuex'
import CscPage from '../../CscPage'
import CscConversationItem from './CscConversationItem'
@ -242,6 +241,9 @@ export default {
}
]
},
...mapState('conversations', [
'reachedLastPage'
]),
...mapGetters('conversations', [
'items',
'isNextPageRequesting',
@ -382,10 +384,11 @@ export default {
// }
// }
},
mounted () {
async mounted () {
this.topMargin = this.$refs.pageSticky.$el.offsetHeight
this.$store.dispatch('conversations/getBlockedNumbers')
this.reload()
this.$store.commit('conversations/resetList')
await this.$store.dispatch('conversations/getBlockedNumbers')
this.$refs.infiniteScroll.poll()
},
methods: {
loadNextPage (index, done) {
@ -400,11 +403,17 @@ export default {
})
},
async selectTab (tabName) {
this.selectedTab = tabName
this.$store.commit('conversations/resetList')
this.$refs.infiniteScroll.reset()
this.$refs.infiniteScroll.resume()
this.$refs.infiniteScroll.trigger()
if (this.selectedTab !== tabName) {
this.selectedTab = tabName
this.$store.commit('conversations/resetList')
this.$refs.infiniteScroll.reset()
if (this.reachedLastPage) {
this.$refs.infiniteScroll.resume()
this.$refs.infiniteScroll.trigger()
} else {
this.$refs.infiniteScroll.poll()
}
}
},
async reload () {
this.$store.commit('conversations/resetList')

@ -680,12 +680,10 @@ export default {
}
},
loadTimesetTimes (context, options) {
console.log(options)
loadTimesetTimes({
timeset: options.timeset,
subscriberId: context.getters.subscriberId
}).then((result) => {
console.log(result)
context.commit('loadTimesSucceeded', result)
})
},

@ -81,7 +81,7 @@ export default {
})
},
async nextPage (context, options) {
let res = { items: [] }
let res
try {
context.commit('nextPageRequesting')
res = await getConversations({
@ -94,7 +94,12 @@ export default {
} catch (err) {
context.commit('nextPageFailed', err.message)
} finally {
options.done(res.items.length === 0)
console.log(res)
if (options.done !== undefined && res.items && res.items.length === 0) {
options.done(true)
} else if (options.done !== undefined) {
options.done()
}
}
},
getBlockedNumbersIncoming (context) {

@ -77,20 +77,16 @@ export default {
},
resetList (state) {
state.items = []
state.currentPage = 0
state.reachedLastPage = false
},
nextPageRequesting (state) {
state.nextPageState = RequestState.requesting
state.nextPageError = null
},
nextPageSucceeded (state, items) {
nextPageSucceeded (state, res) {
state.nextPageState = RequestState.succeeded
state.nextPageError = null
state.items = state.items.concat(items.items)
state.reachedLastPage = items.items.length === 0
state.currentPage = state.currentPage + 1
linkCallsWithSameId(state)
state.items = state.items.concat(res.items)
state.reachedLastPage = res.items.length === 0
},
nextPageFailed (state, error) {
state.nextPageState = RequestState.failed

Loading…
Cancel
Save