Skip to content
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
6 changes: 6 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @emqx/shared-ui-components

## 0.0.13

### Patch Changes

- Fixed some issues in flow

## 0.0.12

### Patch Changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ export default (): {
getFallbackItemDataFromNode: (node: NodeData | Node) => FallbackAction | undefined
getFilterStrFromNodes: (nodes: Array<NodeData>) => string
getBridgesFromNodes: (nodes: Array<NodeData>) => Array<BridgeData>
getAIProvidersAndCompletionsFromNodes: (nodes: Array<NodeData>) => {
getAIProvidersAndCompletionsFromNodes: (
nodes: Array<NodeData>,
emqxVersion?: string,
) => {
aiProviders: Array<FlowDataItemForSubmit<AIProviderForm>>
aiCompletions: Array<FlowDataItemForSubmit<AICompletionProfile>>
}
Expand Down
8 changes: 7 additions & 1 deletion packages/components/flow/composables/useParseWhere.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createRandomString } from '@emqx/shared-ui-utils'
import { FilterLogicalOperator, RULE_LOGICAL_OPERATORS } from '@emqx/shared-ui-constants'
import { cloneDeep } from 'lodash'
import { cloneDeep, escapeRegExp } from 'lodash'
import type { FilterFormData, FilterItem } from '../types'

const parseWhere = (sql: string): FilterFormData | FilterItem => {
Expand Down Expand Up @@ -73,6 +73,12 @@ const splitCondition = (sql: string, separator: string) => {
const separator = new RegExp(
`(${cloneDeep(RULE_LOGICAL_OPERATORS)
.sort((a, b) => b.length - a.length)
.map((item) => {
if (/^\w+$/.test(item)) {
return `\\b${escapeRegExp(item)}\\b`
}
return escapeRegExp(item)
})
.join('|')})`,
'i',
)
Expand Down
3 changes: 2 additions & 1 deletion packages/components/flow/form/processing/FunctionForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ const rules: Rules = {
const errors = []
if (source.func.name && !value) {
errors.push(new Error(t('ruleFunction.aliasRequired')))
} else if (!correctAliasReg.test(value)) {
} else if (value && !correctAliasReg.test(value)) {
// alias is optional
errors.push(new Error(t('ruleFunction.aliasFormatError')))
}
return errors
Expand Down
1 change: 1 addition & 0 deletions packages/components/flow/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export interface FallbackActionReference {
kind: FallbackActionKind.Reference
type: string
name: string
tags?: Array<string>
}

export type FallbackAction = FallbackActionRepublish | FallbackActionReference
Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emqx/shared-ui-components",
"version": "0.0.12",
"version": "0.0.13",
"homepage": "https://emqx.io",
"license": "Apache-2.0",
"repository": {
Expand Down