Skip to content

Commit

Permalink
Fix query history order error
Browse files Browse the repository at this point in the history
  • Loading branch information
qianmoQ committed Jul 12, 2021
1 parent 09c8941 commit 99c86a5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
6 changes: 5 additions & 1 deletion src/renderer/i18n/en_US.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ export default {
add: 'Add',
datasource: 'DataSource',
status: 'Status',
delete: 'Delete'
delete: 'Delete',
query: 'Query',
history: 'History',
clear: 'Clear',
notification: 'Notification'
},
prompt: {
component: {
Expand Down
6 changes: 5 additions & 1 deletion src/renderer/i18n/zh_CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ export default {
add: '添加',
datasource: '数据源',
status: '状态',
delete: '删除'
delete: '删除',
query: '查询',
history: '历史',
clear: '清除',
notification: '通知'
},
prompt: {
component: {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/services/Query.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export function saveQuery(queryHistory) {
}
if (index < 100) {
queryHistory.id = index
histroy.push(queryHistory)
histroy.unshift(queryHistory)
localStorage.setItem('QueryHistory', JSON.stringify(histroy))
}
return queryHistory
Expand Down
15 changes: 6 additions & 9 deletions src/renderer/views/components/query/QueryHistory.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
<template>
<el-dialog
title="Query History"
:title="stringFormat('{0}{1}', [this.$t('common.query'), this.$t('common.history')])"
:visible.sync="bodyLoading"
:width="width"
@close="closeDialog">
<el-row style="margin-top: -10px;">
<el-tooltip class="item" effect="dark" content="Clear Query History" placement="top">
<el-tooltip class="item" effect="dark" :content="stringFormat('{0}{1}{2}', [$t('common.clear'), $t('common.query'), $t('common.history')])" placement="top">
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handlerClearHistory()"></el-button>
</el-tooltip>
</el-row>

<el-table v-loading.body="tableBodyLoading"
style="width: 100%"
:data="data.columns">
<el-table v-loading.body="tableBodyLoading" style="width: 100%" :data="data.columns">
<el-table-column>
<template slot-scope="scope">
<el-card :class="'box-card ' + (scope.row.status ? 'success' : 'error')">
Expand All @@ -29,7 +26,6 @@
</template>
</el-table-column>
</el-table>

<div slot="footer" class="dialog-footer">
<el-button @click="bodyLoading = false" size="mini">{{ this.$t('common.cancel') }}</el-button>
</div>
Expand All @@ -39,6 +35,7 @@
<script>
import TableDetail from '@/components/Table'
import { getQueryHistory, clearQueryHistory } from '@/services/Query'
import { stringFormat } from '@/utils/Utils'
export default {
name: 'QueryHistory',
Expand Down Expand Up @@ -72,9 +69,9 @@ export default {
handlerClearHistory() {
clearQueryHistory()
this.$notify({
title: 'Notification',
title: this.$t('common.notification'),
type: 'success',
message: 'Clear Query History successful!'
message: stringFormat('{0} {1} {2} {3}!', [this.$t('common.clear'), this.$t('common.query'), this.$t('common.history'), this.$t('common.success')])
})
this._initialize()
},
Expand Down

0 comments on commit 99c86a5

Please sign in to comment.