diff --git a/backend/services/connection_service.go b/backend/services/connection_service.go
index b27fe53..0737bbe 100644
--- a/backend/services/connection_service.go
+++ b/backend/services/connection_service.go
@@ -1040,6 +1040,7 @@ func (c *connectionService) RenameKey(connName string, db int, key, newKey strin
return
}
+// GetCmdHistory get redis command history
func (c *connectionService) GetCmdHistory(pageNo, pageSize int) (resp types.JSResp) {
resp.Success = true
if pageSize <= 0 || pageNo <= 0 {
@@ -1062,6 +1063,13 @@ func (c *connectionService) GetCmdHistory(pageNo, pageSize int) (resp types.JSRe
return
}
+// CleanCmdHistory clean redis command history
+func (c *connectionService) CleanCmdHistory() (resp types.JSResp) {
+ c.cmdHistory = []cmdHistoryItem{}
+ resp.Success = true
+ return
+}
+
// update or insert key info to database
//func (c *connectionService) updateDBKey(connName string, db int, keys []string, separator string) {
// dbStruct := map[string]any{}
diff --git a/frontend/src/components/content/ContentLogPane.vue b/frontend/src/components/content/ContentLogPane.vue
index 3701949..a1e4f90 100644
--- a/frontend/src/components/content/ContentLogPane.vue
+++ b/frontend/src/components/content/ContentLogPane.vue
@@ -5,6 +5,7 @@ import Refresh from '@/components/icons/Refresh.vue'
import useConnectionStore from 'stores/connections.js'
import { map, uniqBy } from 'lodash'
import { useI18n } from 'vue-i18n'
+import Delete from '@/components/icons/Delete.vue'
import dayjs from 'dayjs'
const connectionStore = useConnectionStore()
@@ -43,6 +44,20 @@ const loadHistory = () => {
})
}
+const cleanHistory = async () => {
+ $dialog.warning(i18n.t('confirm_clean_log'), () => {
+ data.loading = true
+ connectionStore.cleanCmdHistory().then((success) => {
+ if (success) {
+ data.history = []
+ data.loading = false
+ tableRef.value?.scrollTo({ top: 0 })
+ $message.success(i18n.t('success'))
+ }
+ })
+ })
+}
+
defineExpose({
refresh: () => nextTick().then(loadHistory),
})
@@ -67,6 +82,9 @@ defineExpose({