Skip to content

Commit

Permalink
refactor(global): extract ResetButton component
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinplemelon authored and ysfscream committed Dec 25, 2024
1 parent 08faa56 commit b8c4dea
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 28 deletions.
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions src/components/Buttons/ResetButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<template>
<el-button :icon="RefreshLeft">
{{ t('Base.reset') }}
</el-button>
</template>

<script lang="ts" setup>
import { RefreshLeft } from '@element-plus/icons-vue'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
</script>
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions src/components/Buttons/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export { default as CreateButton } from './CreateButton.vue'
export { default as SearchButton } from './SearchButton.vue'
export { default as TableButton } from './TableButton.vue'
export { default as RefreshButton } from './RefreshButton.vue'
export { default as ResetButton } from './ResetButton.vue'
5 changes: 1 addition & 4 deletions src/components/global-components.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import CustomInputPassword from './CustomInputPassword.vue'
import CreateButton from './CreateButton.vue'
import TableButton from './TableButton.vue'
import RefreshButton from './RefreshButton.vue'
import SearchButton from './SearchButton.vue'
import { CreateButton, TableButton, RefreshButton, SearchButton } from './Buttons'
import type { App } from 'vue'

export default {
Expand Down
6 changes: 2 additions & 4 deletions src/views/Clients/Clients.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@
</template>
<el-col v-bind="{ sm: 12, md: 12, lg: showMoreQuery ? 12 : 6 }" class="col-oper">
<SearchButton @click="handleSearch" />
<el-button :icon="RefreshLeft" @click="handleReset">
{{ $t('Base.reset') }}
</el-button>
<ResetButton @click="handleReset" />
<el-tooltip
:content="!showMoreQuery ? $t('Base.showMore') : $t('Base.lessMore')"
placement="top"
Expand Down Expand Up @@ -185,7 +183,7 @@ import { useCursorPagination } from '@/hooks/usePagination'
import usePaginationRemember from '@/hooks/usePaginationRemember'
import { Client } from '@/types/client'
import { CheckStatus } from '@/types/enum'
import { ArrowDown, ArrowUp, Delete, RefreshLeft } from '@element-plus/icons-vue'
import { ArrowDown, ArrowUp, Delete } from '@element-plus/icons-vue'
import { isEmptyObj } from '@emqx/shared-ui-utils'
import { ElMessage, ElMessageBox } from 'element-plus'
import { computed } from 'vue'
Expand Down
6 changes: 2 additions & 4 deletions src/views/General/BannedClient.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@

<el-col v-bind="colProps" class="buttons-wrap">
<SearchButton @click="refreshListData" />
<el-button :icon="RefreshLeft" @click="handleReset">
{{ t('Base.reset') }}
</el-button>
<ResetButton @click="handleReset" />
</el-col>
</el-row>
</el-form>
Expand Down Expand Up @@ -94,7 +92,7 @@ import useBannedType from '@/hooks/Auth/useBannedType'
import useI18nTl from '@/hooks/useI18nTl'
import usePaginationWithHasNext from '@/hooks/usePaginationWithHasNext'
import { BannedItem } from '@/types/systemModule'
import { RefreshLeft, Remove } from '@element-plus/icons-vue'
import { Remove } from '@element-plus/icons-vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import moment from 'moment'
import { Banned } from 'src/types/auth'
Expand Down
6 changes: 2 additions & 4 deletions src/views/Retained/Retained.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
</el-col>
<el-col :span="8">
<SearchButton @click="handleSearch" />
<el-button :icon="RefreshLeft" @click="handleReset">
{{ $t('Base.reset') }}
</el-button>
<ResetButton @click="handleReset" />
</el-col>
</el-row>
</el-form>
Expand Down Expand Up @@ -106,7 +104,7 @@ import CommonPagination from '@/components/commonPagination.vue'
import useI18nTl from '@/hooks/useI18nTl'
import usePaginationWithHasNext from '@/hooks/usePaginationWithHasNext'
import { RetainerMessage } from '@/types/extension'
import { RefreshLeft, Remove, Setting } from '@element-plus/icons-vue'
import { Remove, Setting } from '@element-plus/icons-vue'
import { ElMessage, ElMessageBox, ElMessageBox as MB } from 'element-plus'
const { tl, t } = useI18nTl('Extension')
Expand Down
6 changes: 2 additions & 4 deletions src/views/RuleEngine/Rule/components/RuleFilterForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@
</template>
<el-col v-bind="colProps" class="col-oper">
<SearchButton @click="searchRule" />
<el-button :icon="RefreshLeft" @click="handleReset">
{{ $t('Base.reset') }}
</el-button>
<ResetButton @click="handleReset" />
<el-tooltip
:content="!showMoreQuery ? $t('Base.showMore') : $t('Base.lessMore')"
placement="top"
Expand All @@ -137,7 +135,7 @@ import useSourceList from '@/hooks/Rule/action/useSourceList'
import useBridgeTypeValue from '@/hooks/Rule/bridge/useBridgeTypeValue'
import useI18nTl from '@/hooks/useI18nTl'
import { FilterParamsForQueryRules } from '@/types/rule'
import { ArrowDown, ArrowUp, RefreshLeft } from '@element-plus/icons-vue'
import { ArrowDown, ArrowUp } from '@element-plus/icons-vue'
import { omit } from 'lodash'
import type { Ref } from 'vue'
import { computed, defineEmits, defineProps, ref } from 'vue'
Expand Down
6 changes: 2 additions & 4 deletions src/views/Subscriptions/Subscriptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@
</template>
<el-col class="col-oper" v-bind="colProps">
<SearchButton @click="handleSearch" />
<el-button :icon="RefreshLeft" @click="handleReset">
{{ $t('Base.reset') }}
</el-button>
<ResetButton @click="handleReset" />
<el-tooltip
:content="!showMoreQuery ? $t('Base.showMore') : $t('Base.lessMore')"
placement="top"
Expand Down Expand Up @@ -131,7 +129,7 @@ import InfoTooltip from '@/components/InfoTooltip.vue'
import useMQTTVersion5NewConfig from '@/hooks/useMQTTVersion5NewConfig'
import usePaginationWithHasNext from '@/hooks/usePaginationWithHasNext'
import useClusterNodes from '@/hooks/useClusterNodes'
import { ArrowDown, ArrowUp, RefreshLeft } from '@element-plus/icons-vue'
import { ArrowDown, ArrowUp } from '@element-plus/icons-vue'
import CommonPagination from '../../components/commonPagination.vue'
import 'element-plus/theme-chalk/display.css'
Expand Down
5 changes: 1 addition & 4 deletions src/views/Topics/Topics.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
</el-col>
<el-col :span="8">
<SearchButton @click="handleSearch" />
<el-button :icon="RefreshLeft" @click="handleReset">
{{ $t('Base.reset') }}
</el-button>
<ResetButton @click="handleReset" />
</el-col>
</el-row>
</el-form>
Expand Down Expand Up @@ -49,7 +47,6 @@ export default defineComponent({
<script lang="ts" setup>
import { listTopics } from '@/api/common'
import CommonPagination from '../../components/commonPagination.vue'
import { RefreshLeft } from '@element-plus/icons-vue'
import useI18nTl from '@/hooks/useI18nTl'
import usePaginationWithHasNext from '@/hooks/usePaginationWithHasNext'
import CommonOverflowTooltip from '@/components/CommonOverflowTooltip.vue'
Expand Down

0 comments on commit b8c4dea

Please sign in to comment.