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(retainer): adapt max_publish_rate #3181

Open
wants to merge 4 commits into
base: dev/1.10.5
Choose a base branch
from
Open
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: 3 additions & 1 deletion src/common/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import { BridgeType } from '@/types/enum'

export const dateFormat = (
date: Date | string | number | (number | string)[] | null | undefined,
errorReturn?: string,
): string => {
return moment(date).format('YYYY-MM-DD HH:mm:ss')
const ret = moment(date).format('YYYY-MM-DD HH:mm:ss')
return ret === 'Invalid date' ? errorReturn ?? ret : ret
}

export const caseInsensitiveCompare = (w: string, k: string): boolean => {
Expand Down
8 changes: 8 additions & 0 deletions src/i18n/Auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,14 @@ export default {
zh: '认证源',
en: 'Auth Source',
},
authzMongoLimit: {
zh: '记录条数限制',
en: 'Record Limit',
},
authzMongoSkip: {
zh: '跳过记录数',
en: 'Skip',
},
srvRecord: {
zh: 'SRV 记录',
en: 'SRV Record',
Expand Down
6 changes: 5 additions & 1 deletion src/i18n/Base.js
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,11 @@ export default {
en: ', ',
},
lastModified: {
zh: '最后修改',
zh: '更新时间',
en: 'Last Modified',
},
createdAt: {
zh: '创建时间',
en: 'Created At',
},
}
8 changes: 8 additions & 0 deletions src/i18n/Extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ export default {
zh: '派发保留消息的最大速率',
en: 'The maximum rate of delivering retained messages',
},
maxPublishRate: {
zh: '最大发布速率',
en: 'Max Publish Rate',
},
maxPublishRateDesc: {
zh: '发布保留消息的最大速率。超过限制发布的消息会被投递,但不会存储为保留消息。',
en: 'The maximum rate of publishing retained messages. Messages that are published over the limit are delivered but not stored as retained.',
},
storageMethod: {
zh: '存储方式',
en: 'Storage Method',
Expand Down
1 change: 1 addition & 0 deletions src/types/extension.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface Retainer {
allow_never_expire: boolean
msg_clear_interval: string
delivery_rate: string
max_publish_rate: string
backend: {
type: string
storage_type: string
Expand Down
4 changes: 3 additions & 1 deletion src/types/schemas/actions.schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,11 @@ export interface ActionsAndSourcesResponseNodeStatus {
}

export interface ActionsAndSourcesResponseSummary {
enabled?: boolean
enable?: boolean
name?: string
type?: string
description?: string
created_at?: number
last_modified_at?: number
node_status?: ActionsAndSourcesResponseNodeStatus[]
rules?: string[]
Expand Down
4 changes: 3 additions & 1 deletion src/types/schemas/sources.schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,11 @@ export interface ActionsAndSourcesResponseNodeStatus {
}

export interface ActionsAndSourcesResponseSummary {
enabled?: boolean
enable?: boolean
name?: string
type?: string
description?: string
created_at?: number
last_modified_at?: number
node_status?: ActionsAndSourcesResponseNodeStatus[]
rules?: string[]
Expand Down
12 changes: 12 additions & 0 deletions src/views/Auth/components/DatabaseConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,18 @@
</el-select>
</el-form-item>
</el-col>
<template v-if="!isAuthn">
<el-col :span="12">
<el-form-item :label="t('Auth.authzMongoLimit')">
<CustomInputNumber v-model="databaseConfig.limit" :min="1" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="t('Auth.authzMongoSkip')">
<CustomInputNumber v-model="databaseConfig.skip" :min="0" />
</el-form-item>
</el-col>
</template>
</template>

<el-col :span="12">
Expand Down
13 changes: 13 additions & 0 deletions src/views/Config/BasicConfig/Retainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,18 @@
/>
</el-form-item>
</el-col>
<el-col :span="21" class="custom-col">
<el-form-item prop="max_publish_rate">
<template #label>
<FormItemLabel :label="tl('maxPublishRate')" :desc="tl('maxPublishRateDesc')" />
</template>
<InputWithUnit
v-model="retainerConfig.max_publish_rate"
:units="[{ label: `/${t('Base.second')}`, value: '/s' }]"
:disabled="!configEnable"
/>
</el-form-item>
</el-col>
<el-col :span="21" class="custom-col">
<el-form-item prop="delivery_rate">
<template #label>
Expand Down Expand Up @@ -192,6 +204,7 @@ let retainerConfig = ref<Retainer>({
msg_expiry_interval_override: DISABLED_VALUE,
allow_never_expire: true,
delivery_rate: '1000/s',
max_publish_rate: '1000/s',
backend: {
storage_type: 'ram',
type: 'built_in_database',
Expand Down
33 changes: 19 additions & 14 deletions src/views/RuleEngine/components/ActionAndSourceList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
row-key="id"
@sort-change="handleSortChange"
>
<el-table-column :label="tl('name')" :min-width="120" sortable="custom" prop="id">
<el-table-column :label="tl('name')" :min-width="172" sortable="custom" prop="id">
<template #default="{ row }">
<router-link :to="getDetailPageRoute(row.id)" class="first-column-with-icon-type">
<img v-if="row.type" class="icon-type" :src="getBridgeIcon(row.type)" />
Expand All @@ -26,7 +26,7 @@
<TargetItemStatus type="action" :target="row" />
</template>
</el-table-column>
<el-table-column prop="enable" :label="$t('Base.isEnabled')" :min-width="92" sortable>
<el-table-column prop="enable" :label="$t('Base.isEnabled')" :min-width="102" sortable>
<template #default="{ row }">
<OperateWebhookAssociatedPopover
:disabled="!judgeIsWebhookAction(row)"
Expand All @@ -47,20 +47,10 @@
:label="t('BridgeSchema.common.description.label')"
:min-width="108"
/>
<el-table-column
prop="last_modified_at"
:label="t('Base.lastModified')"
:min-width="162"
sortable
>
<template #default="{ row }">
{{ dateFormat(row.last_modified_at) }}
</template>
</el-table-column>
<el-table-column
sortable
prop="rules.length"
:min-width="120"
:min-width="168"
:label="tl('associatedRules')"
:sort-method="(row:BridgeItem) => row.rules?.length ?? 0"
>
Expand All @@ -80,7 +70,22 @@
</div>
</template>
</el-table-column>
<el-table-column :label="$t('Base.operation')" :min-width="168">
<el-table-column prop="created_at" :label="t('Base.createdAt')" :min-width="162" sortable>
<template #default="{ row }">
{{ dateFormat(row.created_at, '') }}
</template>
</el-table-column>
<el-table-column
prop="last_modified_at"
:label="t('Base.lastModified')"
:min-width="162"
sortable
>
<template #default="{ row }">
{{ dateFormat(row.last_modified_at, '') }}
</template>
</el-table-column>
<el-table-column :label="$t('Base.operation')" :min-width="180">
<template #default="{ row }">
<TableButton
v-if="
Expand Down
Loading