-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update: add countdown timer to token expiration warning dialog (#1096)
- add a countdown timer to the token expiration warning dialog - wrote unit tests for the frontend changes - added multi lang to the new components created
- Loading branch information
1 parent
3b3cd06
commit e14f09f
Showing
26 changed files
with
480 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<template> | ||
<div class="d-flex flex-row"> | ||
<div class="d-flex flex-row"> | ||
<div>{{ minutes }}</div> | ||
<div class="ml-1" :lang="lang" :class="{ 'dir-rtl': isRTL }"> | ||
{{ $t('trans.baseTime.minutes') }} | ||
</div> | ||
</div> | ||
<div class="d-flex flex-row ml-2"> | ||
<div>{{ seconds }}</div> | ||
<div class="ml-1" :lang="lang" :class="{ 'dir-rtl': isRTL }"> | ||
{{ $t('trans.baseTime.seconds') }} | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
<script> | ||
import moment from 'moment'; | ||
import { mapGetters } from 'vuex'; | ||
export default { | ||
name: 'BaseTime', | ||
props: { | ||
action: { type: String, default: '' }, | ||
}, | ||
data() { | ||
return { | ||
timerDate: moment().add(15, 'minutes'), | ||
now: moment(), | ||
timerInterval: null, | ||
}; | ||
}, | ||
computed: { | ||
...mapGetters('form', ['isRTL', 'lang']), | ||
seconds() { | ||
let sec = Math.trunc(this.timerDate.diff(this.now, 'seconds') % 60); | ||
if (this.minutes === 0 && sec === 28) { | ||
this.$emit('timer-stopped'); | ||
} | ||
return sec; | ||
}, | ||
minutes() { | ||
return this.timerDate.diff(this.now, 'minutes'); | ||
}, | ||
}, | ||
watch: { | ||
action: { | ||
immediate: true, | ||
handler() { | ||
if (this.action === 'start') { | ||
clearInterval(this.timerInterval); | ||
this.timerInterval = window.setInterval(() => { | ||
this.now = moment(); | ||
}, 1000); | ||
} else if (this.action === 'stop') { | ||
clearInterval(this.timerInterval); | ||
this.timerDate = ''; | ||
this.now = ''; | ||
this.timerInterval = null; | ||
} | ||
}, | ||
}, | ||
}, | ||
beforeUnmount() { | ||
clearInterval(this.timerInterval); | ||
}, | ||
}; | ||
</script> | ||
<style lang="scss" scoped> | ||
.v-text-field > .v-input__control > .v-input__slot:before { | ||
border-style: none !important; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.