refactor: use import alias name

This commit is contained in:
tiny-craft 2023-08-02 17:57:39 +08:00
parent 5750170f5e
commit af289319ed
45 changed files with 236 additions and 227 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
build/bin build/bin
node_modules node_modules
frontend/dist frontend/dist
frontend/wailsjs
.vscode .vscode
.idea .idea

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -17,7 +17,7 @@ import useConnectionStore from './stores/connections.js'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { darkTheme, lightTheme, useOsTheme } from 'naive-ui' import { darkTheme, lightTheme, useOsTheme } from 'naive-ui'
import KeyFilterDialog from './components/dialogs/KeyFilterDialog.vue' import KeyFilterDialog from './components/dialogs/KeyFilterDialog.vue'
import { WindowSetDarkTheme, WindowSetLightTheme } from '../wailsjs/runtime/runtime.js' import { WindowSetDarkTheme, WindowSetLightTheme } from 'wailsjs/runtime/runtime.js'
hljs.registerLanguage('json', json) hljs.registerLanguage('json', json)
hljs.registerLanguage('plaintext', plaintext) hljs.registerLanguage('plaintext', plaintext)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

View File

@ -1,9 +1,9 @@
<script setup> <script setup>
import IconButton from './IconButton.vue' import IconButton from './IconButton.vue'
import Delete from '../icons/Delete.vue' import Delete from '@/components/icons/Delete.vue'
import Edit from '../icons/Edit.vue' import Edit from '@/components/icons/Edit.vue'
import Close from '../icons/Close.vue' import Close from '@/components/icons/Close.vue'
import Save from '../icons/Save.vue' import Save from '@/components/icons/Save.vue'
const props = defineProps({ const props = defineProps({
bindKey: String, bindKey: String,

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
import { computed } from 'vue' import { computed } from 'vue'
import { typesBgColor, typesColor, validType } from '../../consts/support_redis_type.js' import { typesBgColor, typesColor, validType } from '@/consts/support_redis_type.js'
const props = defineProps({ const props = defineProps({
type: { type: {

View File

@ -1,8 +1,8 @@
<script setup> <script setup>
import { computed, nextTick, onActivated, reactive, ref } from 'vue' import { computed, nextTick, onActivated, reactive, ref } from 'vue'
import IconButton from '../common/IconButton.vue' import IconButton from '@/components/common/IconButton.vue'
import Refresh from '../icons/Refresh.vue' import Refresh from '@/components/icons/Refresh.vue'
import useConnectionStore from '../../stores/connections.js' import useConnectionStore from 'stores/connections.js'
import { map, uniqBy } from 'lodash' import { map, uniqBy } from 'lodash'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import dayjs from 'dayjs' import dayjs from 'dayjs'
@ -132,7 +132,7 @@ onActivated(() => {
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
@import 'content'; @import '@/styles/content';
.content-container { .content-container {
padding: 5px; padding: 5px;

View File

@ -1,19 +1,19 @@
<script setup> <script setup>
import { computed, onMounted, onUnmounted, ref, watch } from 'vue' import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
import { types } from '../../consts/support_redis_type.js' import { types } from '@/consts/support_redis_type.js'
import ContentValueHash from '../content_value/ContentValueHash.vue' import ContentValueHash from '@/components/content_value/ContentValueHash.vue'
import ContentValueList from '../content_value/ContentValueList.vue' import ContentValueList from '@/components/content_value/ContentValueList.vue'
import ContentValueString from '../content_value/ContentValueString.vue' import ContentValueString from '@/components/content_value/ContentValueString.vue'
import ContentValueSet from '../content_value/ContentValueSet.vue' import ContentValueSet from '@/components/content_value/ContentValueSet.vue'
import ContentValueZset from '../content_value/ContentValueZSet.vue' import ContentValueZset from '@/components/content_value/ContentValueZSet.vue'
import { get, isEmpty, map, toUpper } from 'lodash' import { get, isEmpty, map, toUpper } from 'lodash'
import useTabStore from '../../stores/tab.js' import useTabStore from 'stores/tab.js'
import { useDialog } from 'naive-ui' import { useDialog } from 'naive-ui'
import useConnectionStore from '../../stores/connections.js' import useConnectionStore from 'stores/connections.js'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useConfirmDialog } from '../../utils/confirm_dialog.js' import { useConfirmDialog } from '@/utils/confirm_dialog.js'
import ContentServerStatus from '../content_value/ContentServerStatus.vue' import ContentServerStatus from '@/components/content_value/ContentServerStatus.vue'
import ContentValueStream from '../content_value/ContentValueStream.vue' import ContentValueStream from '@/components/content_value/ContentValueStream.vue'
const serverInfo = ref({}) const serverInfo = ref({})
const autoRefresh = ref(false) const autoRefresh = ref(false)
@ -183,7 +183,7 @@ const onCloseTab = (tabIndex) => {
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
@import 'content'; @import '@/styles/content';
.content-container { .content-container {
padding: 5px; padding: 5px;

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
import AddLink from '../icons/AddLink.vue' import AddLink from '@/components/icons/AddLink.vue'
import useDialogStore from '../../stores/dialog.js' import useDialogStore from 'stores/dialog.js'
const dialogStore = useDialogStore() const dialogStore = useDialogStore()
</script> </script>
@ -22,7 +22,7 @@ const dialogStore = useDialogStore()
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
@import 'content'; @import '@/styles/content';
.content-container { .content-container {
justify-content: center; justify-content: center;

View File

@ -1,8 +1,8 @@
<script setup> <script setup>
import { ref } from 'vue' import { ref } from 'vue'
import { ConnectionType } from '../../consts/connection_type.js' import { ConnectionType } from '@/consts/connection_type.js'
import Close from '../icons/Close.vue' import Close from '@/components/icons/Close.vue'
import useConnectionStore from '../../stores/connections.js' import useConnectionStore from 'stores/connections.js'
import { useThemeVars } from 'naive-ui' import { useThemeVars } from 'naive-ui'
const emit = defineEmits(['switchTab', 'closeTab', 'update:modelValue']) const emit = defineEmits(['switchTab', 'closeTab', 'update:modelValue'])

View File

@ -1,10 +1,10 @@
<script setup> <script setup>
import { get, isEmpty, map, mapValues, pickBy, split, sum, toArray, toNumber } from 'lodash' import { get, isEmpty, map, mapValues, pickBy, split, sum, toArray, toNumber } from 'lodash'
import { computed, ref } from 'vue' import { computed, ref } from 'vue'
import Help from '../icons/Help.vue' import Help from '@/components/icons/Help.vue'
import IconButton from '../common/IconButton.vue' import IconButton from '@/components/common/IconButton.vue'
import Filter from '../icons/Filter.vue' import Filter from '@/components/icons/Filter.vue'
import Refresh from '../icons/Refresh.vue' import Refresh from '@/components/icons/Refresh.vue'
const props = defineProps({ const props = defineProps({
server: String, server: String,

View File

@ -1,18 +1,18 @@
<script setup> <script setup>
import { validType } from '../../consts/support_redis_type.js' import { validType } from '@/consts/support_redis_type.js'
import useDialog from '../../stores/dialog.js' import useDialog from 'stores/dialog.js'
import Delete from '../icons/Delete.vue' import Delete from '@/components/icons/Delete.vue'
import Edit from '../icons/Edit.vue' import Edit from '@/components/icons/Edit.vue'
import Refresh from '../icons/Refresh.vue' import Refresh from '@/components/icons/Refresh.vue'
import Timer from '../icons/Timer.vue' import Timer from '@/components/icons/Timer.vue'
import RedisTypeTag from '../common/RedisTypeTag.vue' import RedisTypeTag from '@/components/common/RedisTypeTag.vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useMessage } from 'naive-ui' import { useMessage } from 'naive-ui'
import IconButton from '../common/IconButton.vue' import IconButton from '@/components/common/IconButton.vue'
import useConnectionStore from '../../stores/connections.js' import useConnectionStore from 'stores/connections.js'
import { useConfirmDialog } from '../../utils/confirm_dialog.js' import { useConfirmDialog } from '@/utils/confirm_dialog.js'
import Copy from '../icons/Copy.vue' import Copy from '@/components/icons/Copy.vue'
import { ClipboardSetText } from '../../../wailsjs/runtime/runtime.js' import { ClipboardSetText } from 'wailsjs/runtime/runtime.js'
const props = defineProps({ const props = defineProps({
server: String, server: String,

View File

@ -2,12 +2,12 @@
import { computed, h, reactive, ref } from 'vue' import { computed, h, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import ContentToolbar from './ContentToolbar.vue' import ContentToolbar from './ContentToolbar.vue'
import AddLink from '../icons/AddLink.vue' import AddLink from '@/components/icons/AddLink.vue'
import { NButton, NCode, NIcon, NInput, useMessage } from 'naive-ui' import { NButton, NCode, NIcon, NInput, useMessage } from 'naive-ui'
import { types, types as redisTypes } from '../../consts/support_redis_type.js' import { types, types as redisTypes } from '@/consts/support_redis_type.js'
import EditableTableColumn from '../common/EditableTableColumn.vue' import EditableTableColumn from '@/components/common/EditableTableColumn.vue'
import useDialogStore from '../../stores/dialog.js' import useDialogStore from 'stores/dialog.js'
import useConnectionStore from '../../stores/connections.js' import useConnectionStore from 'stores/connections.js'
const i18n = useI18n() const i18n = useI18n()
@ -120,7 +120,7 @@ const actionColumn = {
props.name, props.name,
props.db, props.db,
props.keyPath, props.keyPath,
row.key row.key,
) )
if (success) { if (success) {
connectionStore.loadKeyValue(props.name, props.db, props.keyPath).then((r) => {}) connectionStore.loadKeyValue(props.name, props.db, props.keyPath).then((r) => {})
@ -146,7 +146,7 @@ const actionColumn = {
props.keyPath, props.keyPath,
row.key, row.key,
currentEditRow.value.key, currentEditRow.value.key,
currentEditRow.value.value currentEditRow.value.value,
) )
if (success) { if (success) {
connectionStore.loadKeyValue(props.name, props.db, props.keyPath).then((r) => {}) connectionStore.loadKeyValue(props.name, props.db, props.keyPath).then((r) => {})

View File

@ -2,13 +2,13 @@
import { computed, h, reactive, ref } from 'vue' import { computed, h, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import ContentToolbar from './ContentToolbar.vue' import ContentToolbar from './ContentToolbar.vue'
import AddLink from '../icons/AddLink.vue' import AddLink from '@/components/icons/AddLink.vue'
import { NButton, NCode, NIcon, NInput, useMessage } from 'naive-ui' import { NButton, NCode, NIcon, NInput, useMessage } from 'naive-ui'
import { size } from 'lodash' import { size } from 'lodash'
import { types, types as redisTypes } from '../../consts/support_redis_type.js' import { types, types as redisTypes } from '@/consts/support_redis_type.js'
import EditableTableColumn from '../common/EditableTableColumn.vue' import EditableTableColumn from '@/components/common/EditableTableColumn.vue'
import useDialogStore from '../../stores/dialog.js' import useDialogStore from 'stores/dialog.js'
import useConnectionStore from '../../stores/connections.js' import useConnectionStore from 'stores/connections.js'
const i18n = useI18n() const i18n = useI18n()
@ -77,7 +77,7 @@ const actionColumn = {
props.name, props.name,
props.db, props.db,
props.keyPath, props.keyPath,
row.no - 1 row.no - 1,
) )
if (success) { if (success) {
connectionStore.loadKeyValue(props.name, props.db, props.keyPath).then((r) => {}) connectionStore.loadKeyValue(props.name, props.db, props.keyPath).then((r) => {})
@ -100,7 +100,7 @@ const actionColumn = {
props.db, props.db,
props.keyPath, props.keyPath,
currentEditRow.value.no - 1, currentEditRow.value.no - 1,
currentEditRow.value.value currentEditRow.value.value,
) )
if (success) { if (success) {
connectionStore.loadKeyValue(props.name, props.db, props.keyPath).then((r) => {}) connectionStore.loadKeyValue(props.name, props.db, props.keyPath).then((r) => {})

View File

@ -2,13 +2,13 @@
import { computed, h, reactive, ref } from 'vue' import { computed, h, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import ContentToolbar from './ContentToolbar.vue' import ContentToolbar from './ContentToolbar.vue'
import AddLink from '../icons/AddLink.vue' import AddLink from '@/components/icons/AddLink.vue'
import { NButton, NCode, NIcon, NInput, useMessage } from 'naive-ui' import { NButton, NCode, NIcon, NInput, useMessage } from 'naive-ui'
import { size } from 'lodash' import { size } from 'lodash'
import useDialogStore from '../../stores/dialog.js' import useDialogStore from 'stores/dialog.js'
import { types, types as redisTypes } from '../../consts/support_redis_type.js' import { types, types as redisTypes } from '@/consts/support_redis_type.js'
import EditableTableColumn from '../common/EditableTableColumn.vue' import EditableTableColumn from '@/components/common/EditableTableColumn.vue'
import useConnectionStore from '../../stores/connections.js' import useConnectionStore from 'stores/connections.js'
const i18n = useI18n() const i18n = useI18n()
const props = defineProps({ const props = defineProps({
@ -78,7 +78,7 @@ const actionColumn = {
props.name, props.name,
props.db, props.db,
props.keyPath, props.keyPath,
row.value row.value,
) )
if (success) { if (success) {
connectionStore.loadKeyValue(props.name, props.db, props.keyPath).then((r) => {}) connectionStore.loadKeyValue(props.name, props.db, props.keyPath).then((r) => {})
@ -99,7 +99,7 @@ const actionColumn = {
props.db, props.db,
props.keyPath, props.keyPath,
row.value, row.value,
currentEditRow.value.value currentEditRow.value.value,
) )
if (success) { if (success) {
connectionStore.loadKeyValue(props.name, props.db, props.keyPath).then((r) => {}) connectionStore.loadKeyValue(props.name, props.db, props.keyPath).then((r) => {})

View File

@ -2,12 +2,12 @@
import { computed, h, reactive, ref } from 'vue' import { computed, h, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import ContentToolbar from './ContentToolbar.vue' import ContentToolbar from './ContentToolbar.vue'
import AddLink from '../icons/AddLink.vue' import AddLink from '@/components/icons/AddLink.vue'
import { NButton, NCode, NIcon, NInput, useMessage } from 'naive-ui' import { NButton, NCode, NIcon, NInput, useMessage } from 'naive-ui'
import { types, types as redisTypes } from '../../consts/support_redis_type.js' import { types, types as redisTypes } from '@/consts/support_redis_type.js'
import EditableTableColumn from '../common/EditableTableColumn.vue' import EditableTableColumn from '@/components/common/EditableTableColumn.vue'
import useDialogStore from '../../stores/dialog.js' import useDialogStore from 'stores/dialog.js'
import useConnectionStore from '../../stores/connections.js' import useConnectionStore from 'stores/connections.js'
import { includes, keys, some, values } from 'lodash' import { includes, keys, some, values } from 'lodash'
const i18n = useI18n() const i18n = useI18n()

View File

@ -2,17 +2,18 @@
import { computed, onMounted, ref, watch } from 'vue' import { computed, onMounted, ref, watch } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import ContentToolbar from './ContentToolbar.vue' import ContentToolbar from './ContentToolbar.vue'
import Copy from '../icons/Copy.vue' import Copy from '@/components/icons/Copy.vue'
import Save from '../icons/Save.vue' import Save from '@/components/icons/Save.vue'
import { useMessage, useThemeVars } from 'naive-ui' import { useMessage, useThemeVars } from 'naive-ui'
import { types } from '../../consts/value_view_type.js' import { types } from '@/consts/value_view_type.js'
import Close from '../icons/Close.vue' import Close from '@/components/icons/Close.vue'
import Edit from '../icons/Edit.vue' import Edit from '@/components/icons/Edit.vue'
import { IsJson } from '../../utils/check_string_format.js' import { IsJson } from '@/utils/check_string_format.js'
import { types as redisTypes } from '../../consts/support_redis_type.js' import { types as redisTypes } from '@/consts/support_redis_type.js'
import { ClipboardSetText } from '../../../wailsjs/runtime/runtime.js' import { ClipboardSetText } from 'wailsjs/runtime/runtime.js'
import { toLower } from 'lodash' import { toLower } from 'lodash'
import useConnectionStore from '../../stores/connections.js' import useConnectionStore from 'stores/connections.js'
const themeVars = useThemeVars() const themeVars = useThemeVars()
const props = defineProps({ const props = defineProps({
@ -70,7 +71,7 @@ watch(
() => props.value, () => props.value,
(value) => { (value) => {
autoDetectFormat() autoDetectFormat()
} },
) )
const keyType = redisTypes.STRING const keyType = redisTypes.STRING
@ -148,7 +149,7 @@ const onSaveValue = async () => {
props.keyPath, props.keyPath,
toLower(keyType), toLower(keyType),
editValue.value, editValue.value,
-1 -1,
) )
if (success) { if (success) {
await connectionStore.loadKeyValue(props.name, props.db, props.keyPath) await connectionStore.loadKeyValue(props.name, props.db, props.keyPath)

View File

@ -2,13 +2,13 @@
import { computed, h, reactive, ref } from 'vue' import { computed, h, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import ContentToolbar from './ContentToolbar.vue' import ContentToolbar from './ContentToolbar.vue'
import AddLink from '../icons/AddLink.vue' import AddLink from '@/components/icons/AddLink.vue'
import { NButton, NCode, NIcon, NInput, NInputNumber, useMessage } from 'naive-ui' import { NButton, NCode, NIcon, NInput, NInputNumber, useMessage } from 'naive-ui'
import { types, types as redisTypes } from '../../consts/support_redis_type.js' import { types, types as redisTypes } from '@/consts/support_redis_type.js'
import EditableTableColumn from '../common/EditableTableColumn.vue' import EditableTableColumn from '@/components/common/EditableTableColumn.vue'
import { isEmpty, replace } from 'lodash' import { isEmpty } from 'lodash'
import useDialogStore from '../../stores/dialog.js' import useDialogStore from 'stores/dialog.js'
import useConnectionStore from '../../stores/connections.js' import useConnectionStore from 'stores/connections.js'
const i18n = useI18n() const i18n = useI18n()
@ -150,7 +150,7 @@ const actionColumn = {
props.name, props.name,
props.db, props.db,
props.keyPath, props.keyPath,
row.value row.value,
) )
if (success) { if (success) {
connectionStore.loadKeyValue(props.name, props.db, props.keyPath).then((r) => {}) connectionStore.loadKeyValue(props.name, props.db, props.keyPath).then((r) => {})
@ -175,7 +175,7 @@ const actionColumn = {
props.keyPath, props.keyPath,
row.value, row.value,
newValue, newValue,
currentEditRow.value.score currentEditRow.value.score,
) )
if (success) { if (success) {
connectionStore.loadKeyValue(props.name, props.db, props.keyPath).then((r) => {}) connectionStore.loadKeyValue(props.name, props.db, props.keyPath).then((r) => {})

View File

@ -1,16 +1,16 @@
<script setup> <script setup>
import { computed, reactive, watch } from 'vue' import { computed, reactive, watch } from 'vue'
import { types } from '../../consts/support_redis_type' import { types } from '@/consts/support_redis_type.js'
import useDialog from '../../stores/dialog' import useDialog from 'stores/dialog'
import NewStringValue from '../new_value/NewStringValue.vue' import NewStringValue from '@/components/new_value/NewStringValue.vue'
import NewSetValue from '../new_value/NewSetValue.vue' import NewSetValue from '@/components/new_value/NewSetValue.vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useMessage } from 'naive-ui' import { useMessage } from 'naive-ui'
import AddListValue from '../new_value/AddListValue.vue' import AddListValue from '@/components/new_value/AddListValue.vue'
import AddHashValue from '../new_value/AddHashValue.vue' import AddHashValue from '@/components/new_value/AddHashValue.vue'
import AddZSetValue from '../new_value/AddZSetValue.vue' import AddZSetValue from '@/components/new_value/AddZSetValue.vue'
import useConnectionStore from '../../stores/connections.js' import useConnectionStore from 'stores/connections.js'
import NewStreamValue from '../new_value/NewStreamValue.vue' import NewStreamValue from '@/components/new_value/NewStreamValue.vue'
import { size, slice } from 'lodash' import { size, slice } from 'lodash'
const i18n = useI18n() const i18n = useI18n()

View File

@ -2,11 +2,11 @@
import { get, isEmpty, map } from 'lodash' import { get, isEmpty, map } from 'lodash'
import { computed, nextTick, ref, watch } from 'vue' import { computed, nextTick, ref, watch } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { TestConnection } from '../../../wailsjs/go/services/connectionService.js' import { TestConnection } from 'wailsjs/go/services/connectionService.js'
import useDialog from '../../stores/dialog' import useDialog from 'stores/dialog'
import { useMessage } from 'naive-ui' import { useMessage } from 'naive-ui'
import Close from '../icons/Close.vue' import Close from '@/components/icons/Close.vue'
import useConnectionStore from '../../stores/connections.js' import useConnectionStore from 'stores/connections.js'
/** /**
* Dialog for new or edit connection * Dialog for new or edit connection
@ -110,7 +110,7 @@ watch(
editName.value = get(dialogStore.connParam, 'name', '') editName.value = get(dialogStore.connParam, 'name', '')
generalForm.value = dialogStore.connParam || connectionStore.newDefaultConnection() generalForm.value = dialogStore.connParam || connectionStore.newDefaultConnection()
} }
} },
) )
const onTestConnection = async () => { const onTestConnection = async () => {

View File

@ -1,9 +1,9 @@
<script setup> <script setup>
import { reactive, watch } from 'vue' import { reactive, watch } from 'vue'
import useDialog from '../../stores/dialog' import useDialog from 'stores/dialog'
import { useMessage } from 'naive-ui' import { useMessage } from 'naive-ui'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import useConnectionStore from '../../stores/connections.js' import useConnectionStore from 'stores/connections.js'
import { isEmpty, size } from 'lodash' import { isEmpty, size } from 'lodash'
const deleteForm = reactive({ const deleteForm = reactive({
@ -29,7 +29,7 @@ watch(
deleteForm.loadingAffected = false deleteForm.loadingAffected = false
deleteForm.affectedKeys = [] deleteForm.affectedKeys = []
} }
} },
) )
const scanAffectedKey = async () => { const scanAffectedKey = async () => {

View File

@ -1,9 +1,9 @@
<script setup> <script setup>
import { computed, reactive, ref, watch } from 'vue' import { computed, reactive, ref, watch } from 'vue'
import useDialog from '../../stores/dialog' import useDialog from 'stores/dialog'
import { useMessage } from 'naive-ui' import { useMessage } from 'naive-ui'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import useConnectionStore from '../../stores/connections.js' import useConnectionStore from 'stores/connections.js'
import { isEmpty } from 'lodash' import { isEmpty } from 'lodash'
/** /**
@ -25,7 +25,7 @@ watch(
if (visible) { if (visible) {
groupForm.name = editGroup.value = dialogStore.editGroup groupForm.name = editGroup.value = dialogStore.editGroup
} }
} },
) )
const i18n = useI18n() const i18n = useI18n()

View File

@ -1,9 +1,9 @@
<script setup> <script setup>
import { computed, reactive, ref, watch } from 'vue' import { computed, reactive, ref, watch } from 'vue'
import useDialog from '../../stores/dialog' import useDialog from 'stores/dialog'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import useConnectionStore from '../../stores/connections.js' import useConnectionStore from 'stores/connections.js'
import { types } from '../../consts/support_redis_type.js' import { types } from '@/consts/support_redis_type.js'
const i18n = useI18n() const i18n = useI18n()
const filterForm = reactive({ const filterForm = reactive({
@ -37,7 +37,7 @@ watch(
filterForm.type = type || '' filterForm.type = type || ''
filterForm.pattern = pattern || '*' filterForm.pattern = pattern || '*'
} }
} },
) )
const connectionStore = useConnectionStore() const connectionStore = useConnectionStore()

View File

@ -1,18 +1,18 @@
<script setup> <script setup>
import { computed, h, reactive, ref, watch } from 'vue' import { computed, h, reactive, ref, watch } from 'vue'
import { types, typesColor } from '../../consts/support_redis_type' import { types, typesColor } from '@/consts/support_redis_type.js'
import useDialog from '../../stores/dialog' import useDialog from 'stores/dialog'
import { isEmpty, keys, map } from 'lodash' import { isEmpty, keys, map } from 'lodash'
import NewStringValue from '../new_value/NewStringValue.vue' import NewStringValue from '@/components/new_value/NewStringValue.vue'
import NewHashValue from '../new_value/NewHashValue.vue' import NewHashValue from '@/components/new_value/NewHashValue.vue'
import NewListValue from '../new_value/NewListValue.vue' import NewListValue from '@/components/new_value/NewListValue.vue'
import NewZSetValue from '../new_value/NewZSetValue.vue' import NewZSetValue from '@/components/new_value/NewZSetValue.vue'
import NewSetValue from '../new_value/NewSetValue.vue' import NewSetValue from '@/components/new_value/NewSetValue.vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import useConnectionStore from '../../stores/connections.js' import useConnectionStore from 'stores/connections.js'
import { NSpace, useMessage } from 'naive-ui' import { NSpace, useMessage } from 'naive-ui'
import useTabStore from '../../stores/tab.js' import useTabStore from 'stores/tab.js'
import NewStreamValue from '../new_value/NewStreamValue.vue' import NewStreamValue from '@/components/new_value/NewStreamValue.vue'
const i18n = useI18n() const i18n = useI18n()
const newForm = reactive({ const newForm = reactive({

View File

@ -1,8 +1,8 @@
<script setup> <script setup>
import { ref, watch } from 'vue' import { ref, watch } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import useDialog from '../../stores/dialog' import useDialog from 'stores/dialog'
import usePreferencesStore from '../../stores/preferences.js' import usePreferencesStore from 'stores/preferences.js'
import { useMessage } from 'naive-ui' import { useMessage } from 'naive-ui'
const prefStore = usePreferencesStore() const prefStore = usePreferencesStore()

View File

@ -1,9 +1,9 @@
<script setup> <script setup>
import { reactive, watch } from 'vue' import { reactive, watch } from 'vue'
import useDialog from '../../stores/dialog' import useDialog from 'stores/dialog'
import { useMessage } from 'naive-ui' import { useMessage } from 'naive-ui'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import useConnectionStore from '../../stores/connections.js' import useConnectionStore from 'stores/connections.js'
const renameForm = reactive({ const renameForm = reactive({
server: '', server: '',
@ -24,7 +24,7 @@ watch(
renameForm.key = key renameForm.key = key
renameForm.newKey = key renameForm.newKey = key
} }
} },
) )
const i18n = useI18n() const i18n = useI18n()

View File

@ -1,8 +1,8 @@
<script setup> <script setup>
import { reactive, ref, watch } from 'vue' import { reactive, ref, watch } from 'vue'
import useDialog from '../../stores/dialog' import useDialog from 'stores/dialog'
import useTabStore from '../../stores/tab.js' import useTabStore from 'stores/tab.js'
import useConnectionStore from '../../stores/connections.js' import useConnectionStore from 'stores/connections.js'
const ttlForm = reactive({ const ttlForm = reactive({
ttl: -1, ttl: -1,
@ -34,7 +34,7 @@ watch(
currentKey.value = tab.key currentKey.value = tab.key
} }
} }
} },
) )
const onClose = () => { const onClose = () => {

View File

@ -1,9 +1,9 @@
<script setup> <script setup>
import { ref } from 'vue' import { ref } from 'vue'
import { flatMap, reject } from 'lodash' import { flatMap, reject } from 'lodash'
import Add from '../icons/Add.vue' import Add from '@/components/icons/Add.vue'
import Delete from '../icons/Delete.vue' import Delete from '@/components/icons/Delete.vue'
import IconButton from '../common/IconButton.vue' import IconButton from '@/components/common/IconButton.vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
const props = defineProps({ const props = defineProps({
@ -39,7 +39,7 @@ const onUpdate = (val) => {
val = reject(val, { key: '' }) val = reject(val, { key: '' })
emit( emit(
'update:value', 'update:value',
flatMap(val, (item) => [item.key, item.value]) flatMap(val, (item) => [item.key, item.value]),
) )
} }
</script> </script>

View File

@ -1,9 +1,9 @@
<script setup> <script setup>
import { ref } from 'vue' import { ref } from 'vue'
import { compact } from 'lodash' import { compact } from 'lodash'
import Add from '../icons/Add.vue' import Add from '@/components/icons/Add.vue'
import Delete from '../icons/Delete.vue' import Delete from '@/components/icons/Delete.vue'
import IconButton from '../common/IconButton.vue' import IconButton from '@/components/common/IconButton.vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
const props = defineProps({ const props = defineProps({

View File

@ -1,9 +1,9 @@
<script setup> <script setup>
import { defineOptions, ref } from 'vue' import { defineOptions, ref } from 'vue'
import { isEmpty, reject } from 'lodash' import { isEmpty, reject } from 'lodash'
import Add from '../icons/Add.vue' import Add from '@/components/icons/Add.vue'
import Delete from '../icons/Delete.vue' import Delete from '@/components/icons/Delete.vue'
import IconButton from '../common/IconButton.vue' import IconButton from '@/components/common/IconButton.vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
const props = defineProps({ const props = defineProps({

View File

@ -1,9 +1,9 @@
<script setup> <script setup>
import { ref } from 'vue' import { ref } from 'vue'
import { flatMap, isEmpty, reject } from 'lodash' import { flatMap, isEmpty, reject } from 'lodash'
import Add from '../icons/Add.vue' import Add from '@/components/icons/Add.vue'
import Delete from '../icons/Delete.vue' import Delete from '@/components/icons/Delete.vue'
import IconButton from '../common/IconButton.vue' import IconButton from '@/components/common/IconButton.vue'
const props = defineProps({ const props = defineProps({
value: Array, value: Array,

View File

@ -1,9 +1,9 @@
<script setup> <script setup>
import { ref } from 'vue' import { ref } from 'vue'
import { compact, isEmpty } from 'lodash' import { compact, isEmpty } from 'lodash'
import Add from '../icons/Add.vue' import Add from '@/components/icons/Add.vue'
import Delete from '../icons/Delete.vue' import Delete from '@/components/icons/Delete.vue'
import IconButton from '../common/IconButton.vue' import IconButton from '@/components/common/IconButton.vue'
const props = defineProps({ const props = defineProps({
value: Array, value: Array,

View File

@ -1,9 +1,9 @@
<script setup> <script setup>
import { ref } from 'vue' import { ref } from 'vue'
import { compact, isEmpty, uniq } from 'lodash' import { compact, isEmpty, uniq } from 'lodash'
import Add from '../icons/Add.vue' import Add from '@/components/icons/Add.vue'
import Delete from '../icons/Delete.vue' import Delete from '@/components/icons/Delete.vue'
import IconButton from '../common/IconButton.vue' import IconButton from '@/components/common/IconButton.vue'
const props = defineProps({ const props = defineProps({
value: Array, value: Array,

View File

@ -1,9 +1,9 @@
<script setup> <script setup>
import { defineOptions, ref } from 'vue' import { defineOptions, ref } from 'vue'
import { flatMap, isEmpty, reject } from 'lodash' import { flatMap, isEmpty, reject } from 'lodash'
import Add from '../icons/Add.vue' import Add from '@/components/icons/Add.vue'
import Delete from '../icons/Delete.vue' import Delete from '@/components/icons/Delete.vue'
import IconButton from '../common/IconButton.vue' import IconButton from '@/components/common/IconButton.vue'
const props = defineProps({ const props = defineProps({
value: Array, value: Array,

View File

@ -1,9 +1,9 @@
<script setup> <script setup>
import { ref } from 'vue' import { ref } from 'vue'
import { flatMap, isEmpty, reject } from 'lodash' import { flatMap, isEmpty, reject } from 'lodash'
import Add from '../icons/Add.vue' import Add from '@/components/icons/Add.vue'
import Delete from '../icons/Delete.vue' import Delete from '@/components/icons/Delete.vue'
import IconButton from '../common/IconButton.vue' import IconButton from '@/components/common/IconButton.vue'
const props = defineProps({ const props = defineProps({
value: Array, value: Array,

View File

@ -1,20 +1,19 @@
<script setup> <script setup>
import { useMessage, useThemeVars } from 'naive-ui' import { useMessage, useThemeVars } from 'naive-ui'
import AddLink from '../icons/AddLink.vue' import AddLink from '@/components/icons/AddLink.vue'
import BrowserTree from './BrowserTree.vue' import BrowserTree from './BrowserTree.vue'
import IconButton from '../common/IconButton.vue' import IconButton from '@/components/common/IconButton.vue'
import useTabStore from '../../stores/tab.js' import useTabStore from 'stores/tab.js'
import { computed, reactive } from 'vue' import { computed, reactive } from 'vue'
import { get } from 'lodash' import { get } from 'lodash'
import Delete from '../icons/Delete.vue' import Delete from '@/components/icons/Delete.vue'
import Refresh from '../icons/Refresh.vue' import Refresh from '@/components/icons/Refresh.vue'
import useDialogStore from '../../stores/dialog.js' import useDialogStore from 'stores/dialog.js'
import { useConfirmDialog } from '../../utils/confirm_dialog.js' import { useConfirmDialog } from '@/utils/confirm_dialog.js'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import useConnectionStore from '../../stores/connections.js' import useConnectionStore from 'stores/connections.js'
import Filter from '../icons/Filter.vue' import { types } from '@/consts/support_redis_type.js'
import { types } from '../../consts/support_redis_type.js' import Search from '@/components/icons/Search.vue'
import Search from '../icons/Search.vue'
const themeVars = useThemeVars() const themeVars = useThemeVars()
const dialogStore = useDialogStore() const dialogStore = useDialogStore()

View File

@ -1,28 +1,28 @@
<script setup> <script setup>
import { computed, h, nextTick, onMounted, reactive, ref } from 'vue' import { computed, h, nextTick, onMounted, reactive, ref } from 'vue'
import { ConnectionType } from '../../consts/connection_type.js' import { ConnectionType } from '@/consts/connection_type.js'
import { NIcon, NSpace, NTag, useDialog, useMessage } from 'naive-ui' import { NIcon, NSpace, NTag, useDialog, useMessage } from 'naive-ui'
import Key from '../icons/Key.vue' import Key from '@/components/icons/Key.vue'
import ToggleDb from '../icons/ToggleDb.vue' import ToggleDb from '@/components/icons/ToggleDb.vue'
import { find, get, includes, indexOf, isEmpty, remove } from 'lodash' import { find, get, includes, indexOf, isEmpty, remove } from 'lodash'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import Refresh from '../icons/Refresh.vue' import Refresh from '@/components/icons/Refresh.vue'
import CopyLink from '../icons/CopyLink.vue' import CopyLink from '@/components/icons/CopyLink.vue'
import Add from '../icons/Add.vue' import Add from '@/components/icons/Add.vue'
import Layer from '../icons/Layer.vue' import Layer from '@/components/icons/Layer.vue'
import Delete from '../icons/Delete.vue' import Delete from '@/components/icons/Delete.vue'
import Connect from '../icons/Connect.vue' import Connect from '@/components/icons/Connect.vue'
import useDialogStore from '../../stores/dialog.js' import useDialogStore from 'stores/dialog.js'
import { ClipboardSetText } from '../../../wailsjs/runtime/runtime.js' import { ClipboardSetText } from 'wailsjs/runtime/runtime.js'
import useConnectionStore from '../../stores/connections.js' import useConnectionStore from 'stores/connections.js'
import { useConfirmDialog } from '../../utils/confirm_dialog.js' import { useConfirmDialog } from '@/utils/confirm_dialog.js'
import ToggleServer from '../icons/ToggleServer.vue' import ToggleServer from '@/components/icons/ToggleServer.vue'
import Unlink from '../icons/Unlink.vue' import Unlink from '@/components/icons/Unlink.vue'
import Filter from '../icons/Filter.vue' import Filter from '@/components/icons/Filter.vue'
import Close from '../icons/Close.vue' import Close from '@/components/icons/Close.vue'
import { typesBgColor, typesColor } from '../../consts/support_redis_type.js' import { typesBgColor, typesColor } from '@/consts/support_redis_type.js'
import useTabStore from '../../stores/tab.js' import useTabStore from 'stores/tab.js'
import IconButton from '../common/IconButton.vue' import IconButton from '@/components/common/IconButton.vue'
const props = defineProps({ const props = defineProps({
server: String, server: String,

View File

@ -1,13 +1,13 @@
<script setup> <script setup>
import useDialogStore from '../../stores/dialog.js' import useDialogStore from 'stores/dialog.js'
import { NIcon, useThemeVars } from 'naive-ui' import { NIcon, useThemeVars } from 'naive-ui'
import AddGroup from '../icons/AddGroup.vue' import AddGroup from '@/components/icons/AddGroup.vue'
import AddLink from '../icons/AddLink.vue' import AddLink from '@/components/icons/AddLink.vue'
import IconButton from '../common/IconButton.vue' import IconButton from '@/components/common/IconButton.vue'
import Filter from '../icons/Filter.vue' import Filter from '@/components/icons/Filter.vue'
import ConnectionTree from './ConnectionTree.vue' import ConnectionTree from './ConnectionTree.vue'
import Unlink from '../icons/Unlink.vue' import Unlink from '@/components/icons/Unlink.vue'
import useConnectionStore from '../../stores/connections.js' import useConnectionStore from 'stores/connections.js'
import { ref } from 'vue' import { ref } from 'vue'
const themeVars = useThemeVars() const themeVars = useThemeVars()

View File

@ -1,21 +1,21 @@
<script setup> <script setup>
import useDialogStore from '../../stores/dialog.js' import useDialogStore from 'stores/dialog.js'
import { h, nextTick, reactive, ref } from 'vue' import { h, nextTick, reactive, ref } from 'vue'
import useConnectionStore from '../../stores/connections.js' import useConnectionStore from 'stores/connections.js'
import { NIcon, useDialog, useMessage, useThemeVars } from 'naive-ui' import { NIcon, useDialog, useMessage, useThemeVars } from 'naive-ui'
import { ConnectionType } from '../../consts/connection_type.js' import { ConnectionType } from '@/consts/connection_type.js'
import ToggleFolder from '../icons/ToggleFolder.vue' import ToggleFolder from '@/components/icons/ToggleFolder.vue'
import ToggleServer from '../icons/ToggleServer.vue' import ToggleServer from '@/components/icons/ToggleServer.vue'
import { debounce, indexOf, isEmpty } from 'lodash' import { debounce, indexOf, isEmpty } from 'lodash'
import Config from '../icons/Config.vue' import Config from '@/components/icons/Config.vue'
import Delete from '../icons/Delete.vue' import Delete from '@/components/icons/Delete.vue'
import Unlink from '../icons/Unlink.vue' import Unlink from '@/components/icons/Unlink.vue'
import CopyLink from '../icons/CopyLink.vue' import CopyLink from '@/components/icons/CopyLink.vue'
import Connect from '../icons/Connect.vue' import Connect from '@/components/icons/Connect.vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import useTabStore from '../../stores/tab.js' import useTabStore from 'stores/tab.js'
import Edit from '../icons/Edit.vue' import Edit from '@/components/icons/Edit.vue'
import { useConfirmDialog } from '../../utils/confirm_dialog.js' import { useConfirmDialog } from '@/utils/confirm_dialog.js'
const themeVars = useThemeVars() const themeVars = useThemeVars()
const i18n = useI18n() const i18n = useI18n()
@ -130,7 +130,7 @@ const renderPrefix = ({ option }) => {
{ size: 20 }, { size: 20 },
{ {
default: () => h(ToggleFolder, { modelValue: opened }), default: () => h(ToggleFolder, { modelValue: opened }),
} },
) )
case ConnectionType.Server: case ConnectionType.Server:
const connected = connectionStore.isConnected(option.name) const connected = connectionStore.isConnected(option.name)
@ -139,7 +139,7 @@ const renderPrefix = ({ option }) => {
{ size: 20 }, { size: 20 },
{ {
default: () => h(ToggleServer, { modelValue: !!connected }), default: () => h(ToggleServer, { modelValue: !!connected }),
} },
) )
} }
} }
@ -330,7 +330,10 @@ const handleDrop = ({ node, dragNode, dropPosition }) => {
</script> </script>
<template> <template>
<n-empty v-if="isEmpty(connectionStore.connections)" class="empty-content" :description="$t('empty_server_list')" />
<n-tree <n-tree
v-else
class="fill-height"
:animated="false" :animated="false"
:block-line="true" :block-line="true"
:block-node="true" :block-node="true"
@ -347,7 +350,6 @@ const handleDrop = ({ node, dragNode, dropPosition }) => {
:render-suffix="renderSuffix" :render-suffix="renderSuffix"
@drop="handleDrop" @drop="handleDrop"
:pattern="props.filterPattern" :pattern="props.filterPattern"
class="fill-height"
virtual-scroll virtual-scroll
/> />
@ -383,4 +385,6 @@ const handleDrop = ({ node, dragNode, dropPosition }) => {
/> />
</template> </template>
<style lang="scss" scoped></style> <style lang="scss" scoped>
@import '@/styles/content';
</style>

View File

@ -1,17 +1,17 @@
<script setup> <script setup>
import { computed, h } from 'vue' import { computed, h } from 'vue'
import { NIcon, useThemeVars } from 'naive-ui' import { NIcon, useThemeVars } from 'naive-ui'
import ToggleDb from '../icons/ToggleDb.vue' import ToggleDb from '@/components/icons/ToggleDb.vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import ToggleServer from '../icons/ToggleServer.vue' import ToggleServer from '@/components/icons/ToggleServer.vue'
import IconButton from '../common/IconButton.vue' import IconButton from '@/components/common/IconButton.vue'
import Config from '../icons/Config.vue' import Config from '@/components/icons/Config.vue'
import useDialogStore from '../../stores/dialog.js' import useDialogStore from 'stores/dialog.js'
import Github from '../icons/Github.vue' import Github from '@/components/icons/Github.vue'
import { BrowserOpenURL } from '../../../wailsjs/runtime/runtime.js' import { BrowserOpenURL } from 'wailsjs/runtime/runtime.js'
import Log from '../icons/Log.vue' import Log from '@/components/icons/Log.vue'
import useConnectionStore from '../../stores/connections.js' import useConnectionStore from 'stores/connections.js'
import Help from '../icons/Help.vue' import Help from '@/components/icons/Help.vue'
const themeVars = useThemeVars() const themeVars = useThemeVars()

View File

@ -132,6 +132,7 @@
"spec_field_required": "\"{key}\" should not be blank", "spec_field_required": "\"{key}\" should not be blank",
"nonexist_tab_content": "The selected key does not exist. Please retry", "nonexist_tab_content": "The selected key does not exist. Please retry",
"empty_server_content": "Connect server from left list", "empty_server_content": "Connect server from left list",
"empty_server_list": "No redis server",
"reload_when_succ": "Reload immediately after success", "reload_when_succ": "Reload immediately after success",
"server": "Server", "server": "Server",
"browser": "Browser", "browser": "Browser",

View File

@ -134,6 +134,7 @@
"spec_field_required": "{key} 不能为空", "spec_field_required": "{key} 不能为空",
"nonexist_tab_content": "所选键不存在,请尝试刷新重试", "nonexist_tab_content": "所选键不存在,请尝试刷新重试",
"empty_server_content": "可以从左边选择并打开连接", "empty_server_content": "可以从左边选择并打开连接",
"empty_server_list": "还没添加Redis服务器",
"reload_when_succ": "操作成功后立即重新加载", "reload_when_succ": "操作成功后立即重新加载",
"server": "服务器", "server": "服务器",
"browser": "浏览器", "browser": "浏览器",

View File

@ -30,10 +30,10 @@ import {
SetSetItem, SetSetItem,
UpdateSetItem, UpdateSetItem,
UpdateZSetValue, UpdateZSetValue,
} from '../../wailsjs/go/services/connectionService.js' } from 'wailsjs/go/services/connectionService.js'
import { ConnectionType } from '../consts/connection_type.js' import { ConnectionType } from '@/consts/connection_type.js'
import useTabStore from './tab.js' import useTabStore from './tab.js'
import { types } from '../consts/support_redis_type.js' import { types } from '@/consts/support_redis_type.js'
const useConnectionStore = defineStore('connections', { const useConnectionStore = defineStore('connections', {
/** /**

View File

@ -1,12 +1,12 @@
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import { lang } from '../langs/index.js' import { lang } from '@/langs/index.js'
import { camelCase, clone, find, get, isEmpty, isObject, map, set, snakeCase, split } from 'lodash' import { camelCase, clone, find, get, isEmpty, isObject, map, set, snakeCase, split } from 'lodash'
import { import {
GetFontList, GetFontList,
GetPreferences, GetPreferences,
RestorePreferences, RestorePreferences,
SetPreferences, SetPreferences,
} from '../../wailsjs/go/services/preferencesService.js' } from 'wailsjs/go/services/preferencesService.js'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
const usePreferencesStore = defineStore('preferences', { const usePreferencesStore = defineStore('preferences', {

View File

@ -25,6 +25,8 @@ export default defineConfig({
resolve: { resolve: {
alias: { alias: {
'@': rootPath + 'src', '@': rootPath + 'src',
stores: rootPath + 'src/stores',
wailsjs: rootPath + 'wailsjs',
}, },
}, },
}) })