Skip to content

Commit

Permalink
Show heartbeat timeout left
Browse files Browse the repository at this point in the history
  • Loading branch information
satterly committed Apr 14, 2019
1 parent 1999234 commit ca03ae2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/components/HeartbeatList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@
<td>
{{ diffTime(props.item.createTime, props.item.receiveTime) }} ms
</td>
<td>{{ props.item.timeout | hhmmss }}</td>
<td
class="text-xs-center text-no-wrap"
>
{{ timeoutLeft(props.item) | hhmmss }}
</td>
<td>{{ props.item.receiveTime | timeago }}</td>
<td class="text-no-wrap">
<v-btn
Expand Down Expand Up @@ -101,6 +105,7 @@

<script>
import DateTime from './lib/DateTime'
import moment from 'moment'
export default {
components: {
Expand Down Expand Up @@ -152,6 +157,10 @@ export default {
this.getHeartbeats()
},
methods: {
timeoutLeft(item) {
let expireTime = moment(item.createTime).add(item.timeout, 'seconds')
return expireTime.isAfter() ? expireTime.diff(moment(), 'seconds') : moment.duration()
},
getHeartbeats() {
this.$store.dispatch('heartbeats/getHeartbeats')
},
Expand Down

0 comments on commit ca03ae2

Please sign in to comment.