diff --git a/frontend/src/components/content_value/ContentToolbar.vue b/frontend/src/components/content_value/ContentToolbar.vue
index d77ed6d..5617ccf 100644
--- a/frontend/src/components/content_value/ContentToolbar.vue
+++ b/frontend/src/components/content_value/ContentToolbar.vue
@@ -12,7 +12,7 @@ import useConnectionStore from 'stores/connections.js'
import Copy from '@/components/icons/Copy.vue'
import { ClipboardSetText } from 'wailsjs/runtime/runtime.js'
import { computed } from 'vue'
-import { isEmpty } from 'lodash'
+import { isEmpty, padStart } from 'lodash'
const props = defineProps({
server: String,
@@ -51,6 +51,23 @@ const keyName = computed(() => {
return !isEmpty(props.keyCode) ? props.keyCode : props.keyPath
})
+const ttlString = computed(() => {
+ let s = ''
+ if (props.ttl > 0) {
+ const hours = Math.floor(props.ttl / 3600)
+ s += padStart(hours + ':', 3, '0')
+ const minutes = Math.floor((props.ttl % 3600) / 60)
+ s += padStart(minutes + ':', 3, '0')
+ const seconds = Math.floor(props.ttl % 60)
+ s += padStart(seconds + '', 2, '0')
+ } else if (props.ttl < 0) {
+ s = i18n.t('interface.forever')
+ } else {
+ s = '00:00:00'
+ }
+ return s
+})
+
const onReloadKey = () => {
connectionStore.loadKeyValue(props.server, props.db, keyName.value)
}
@@ -104,15 +121,10 @@ const onDeleteKey = () => {
-
- {{ $t('interface.forever') }}
-
-
- {{ Math.floor(ttl/3600) }}:{{ Math.floor((ttl%3600)/60) }}:{{ Math.floor(ttl%60) }}
-
+ {{ ttlString }}
- TTL
+ TTL{{ `${ttl > 0 ? ': ' + ttl + $t('common.second') : ''}` }}