What has been done: - TT#37310, Fix infinite scroll component update mechanism - TT#37313, Implement update of infinite scroll on call ended event Change-Id: Ib3ffd236d64a7948252a4d2e220fe7e50965977fchanges/37/21337/10
parent
a60edd324e
commit
e7d974e208
@ -1,40 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<q-infinite-scroll :handler="loadMore" :offset=1 ref="infinite">
|
|
||||||
<csc-conversation v-for="(conversation, index) in conversations"
|
|
||||||
:conversation="conversation" :key="conversation._id">
|
|
||||||
</csc-conversation>
|
|
||||||
<div slot="message" class="row justify-center">
|
|
||||||
<q-spinner-dots :size="40"></q-spinner-dots>
|
|
||||||
</div>
|
|
||||||
</q-infinite-scroll>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import CscConversation from './CscConversation'
|
|
||||||
import { QInfiniteScroll, QSpinnerDots } from 'quasar-framework'
|
|
||||||
export default {
|
|
||||||
name: 'csc-conversations',
|
|
||||||
props: ['conversations'],
|
|
||||||
components: {
|
|
||||||
CscConversation,
|
|
||||||
QInfiniteScroll,
|
|
||||||
QSpinnerDots
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
loadMore(index, done) {
|
|
||||||
this.$store.dispatch('conversations/loadConversations')
|
|
||||||
.then(() => {
|
|
||||||
done();
|
|
||||||
}).catch(() => {
|
|
||||||
done();
|
|
||||||
this.$refs.infinite.stop();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="stylus" rel="stylesheet/stylus">
|
|
||||||
</style>
|
|
@ -0,0 +1,71 @@
|
|||||||
|
<template>
|
||||||
|
<q-infinite-scroll
|
||||||
|
:handler="loadMore"
|
||||||
|
:offset=1
|
||||||
|
ref="infinite"
|
||||||
|
>
|
||||||
|
<csc-conversation
|
||||||
|
v-for="(conversation, index) in conversations"
|
||||||
|
:conversation="conversation"
|
||||||
|
:key="conversation._id"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
slot="message"
|
||||||
|
class="row justify-center"
|
||||||
|
>
|
||||||
|
<q-spinner-dots :size="40" />
|
||||||
|
</div>
|
||||||
|
</q-infinite-scroll>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import CscConversation from './CscConversation'
|
||||||
|
import { mapGetters } from 'vuex'
|
||||||
|
import {
|
||||||
|
QInfiniteScroll,
|
||||||
|
QSpinnerDots
|
||||||
|
} from 'quasar-framework'
|
||||||
|
export default {
|
||||||
|
name: 'csc-conversations',
|
||||||
|
props: ['conversations'],
|
||||||
|
components: {
|
||||||
|
CscConversation,
|
||||||
|
QInfiniteScroll,
|
||||||
|
QSpinnerDots
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters('call', [
|
||||||
|
'callState'
|
||||||
|
])
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
reloadConversations() {
|
||||||
|
this.$store.dispatch('conversations/reloadConversations', 1);
|
||||||
|
this.$refs.infinite.reset();
|
||||||
|
this.$refs.infinite.resume();
|
||||||
|
},
|
||||||
|
loadMore(index, done) {
|
||||||
|
this.$store.dispatch('conversations/loadConversations')
|
||||||
|
.then(() => {
|
||||||
|
done();
|
||||||
|
}).catch(() => {
|
||||||
|
done();
|
||||||
|
this.$refs.infinite.stop();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
callState(newState, oldState) {
|
||||||
|
let endedA = newState === 'ended';
|
||||||
|
let endedB = oldState === 'established' && newState === 'input';
|
||||||
|
let endedC = oldState === 'ringing' && newState === 'input';
|
||||||
|
if (endedA || endedB || endedC) {
|
||||||
|
this.reloadConversations();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="stylus" rel="stylesheet/stylus">
|
||||||
|
</style>
|
Loading…
Reference in new issue