Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(topic rewrite): add tip and remove rule for re #2705

Merged
merged 3 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/i18n/Base.js
Original file line number Diff line number Diff line change
Expand Up @@ -631,4 +631,8 @@ export default {
zh: '选择列',
en: 'Select Column',
},
oneColumnRequired: {
zh: '至少选择一列',
en: 'At least one column is required',
},
}
4 changes: 4 additions & 0 deletions src/i18n/Extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,4 +329,8 @@ export default {
zh: '通过自动订阅为客户端订阅主题时,不会经过 AuthZ 检查权限。',
en: 'The authorization will not check permission when clients subscribe to topics through Auto Subscribe.',
},
rewriteTip: {
zh: '通过主题重写新订阅的主题不会经过 AuthZ 检查权限。',
en: 'The authorization will not check permission when clients subscribe to topics through Topic Rewrite.',
},
}
1 change: 1 addition & 0 deletions src/views/AdvancedMQTT/DelayedPub.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ const updateDelayedConfig = async function () {
saveLoading.value = true
await requestUpdateConfig(delayedConfig)
ElMessage({ type: 'success', message: t('Base.updateSuccess') })
setRawData(delayedConfig)
} catch (error) {
//
} finally {
Expand Down
3 changes: 2 additions & 1 deletion src/views/AdvancedMQTT/Rewrite.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
:title="(isEdit ? $t('Base.edit') : $t('Base.add')) + ' ' + tl('rewrite')"
@close="initForm"
>
<TipContainer :content="tl('rewriteTip')" />
<el-form
ref="rewriteForm"
:model="rewriteInput"
Expand Down Expand Up @@ -72,6 +73,7 @@
<script lang="ts" setup>
import { editTopicRewrite, getTopicRewrite } from '@/api/extension'
import { getLabelFromValueInOptionList } from '@/common/tools'
import TipContainer from '@/components/TipContainer.vue'
import useI18nTl from '@/hooks/useI18nTl'
import { Rewrite } from '@/types/extension'
import { Plus } from '@element-plus/icons-vue'
Expand Down Expand Up @@ -113,7 +115,6 @@ let validatorRules = [
let rewriteRules = {
action: validatorRules,
source_topic: validatorRules,
re: validatorRules,
dest_topic: validatorRules,
}

Expand Down
5 changes: 5 additions & 0 deletions src/views/Clients/components/ClientFieldSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import { DEFAULT_CLIENT_TABLE_COLUMNS } from '@/common/constants'
import useClientFields from '@/hooks/Clients/useClientFields'
import useI18nTl from '@/hooks/useI18nTl'
import { Setting } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus'
import { isEqual } from 'lodash'
import { defineEmits, defineProps, ref, watch } from 'vue'

Expand Down Expand Up @@ -99,6 +100,10 @@ const fieldOptIndex = fieldOpts.reduce((map, { value }, index) => {

const DropdownCom = ref()
const confirm = () => {
if (!checkList.value.length) {
ElMessage.warning(t('Base.oneColumnRequired'))
return
}
// The checklist is not in order, so reorder it.
const list = checkList.value.sort(
(a, b) => (fieldOptIndex.get(a) ?? 99) - (fieldOptIndex.get(b) ?? 99),
Expand Down
1 change: 1 addition & 0 deletions src/views/Config/BasicConfig/SystemTopics.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ const updateConfigData = async () => {
saveLoading.value = true
await updateSystemTopicConfig(sysTopics.value)
ElMessage.success(t('Base.updateSuccess'))
setRawData(sysTopics.value)
} catch (error) {
// ignore error
} finally {
Expand Down
Loading