diff --git a/src/components/CustomInputPassword.vue b/src/components/CustomInputPassword.vue index f7375fbb6..578797c67 100644 --- a/src/components/CustomInputPassword.vue +++ b/src/components/CustomInputPassword.vue @@ -13,6 +13,7 @@ import { computed, defineEmits, defineProps } from 'vue' const props = defineProps<{ modelValue?: string + [key: string]: any }>() const emit = defineEmits<{ diff --git a/src/components/SchemaFormItem.tsx b/src/components/SchemaFormItem.tsx index 1df8a16ee..00ead7a09 100644 --- a/src/components/SchemaFormItem.tsx +++ b/src/components/SchemaFormItem.tsx @@ -10,6 +10,7 @@ import InputWithUnit from './InputWithUnit.vue' import KeyAndValueEditor from './KeyAndValueEditor.vue' import OneOf from './Oneof.vue' import TimeInputWithUnitSelect from './TimeInputWithUnitSelect.vue' +import CustomInputPassword from './CustomInputPassword.vue' type FormItemType = | 'string' @@ -159,6 +160,16 @@ export default defineComponent({ {...customProps} /> ) + } else if (props.format === 'password') { + return ( + + ) } return stringInput } diff --git a/src/hooks/Rule/RuleFunc.json b/src/hooks/Rule/RuleFunc.json index 710b0214f..1a9ed579d 100644 --- a/src/hooks/Rule/RuleFunc.json +++ b/src/hooks/Rule/RuleFunc.json @@ -336,6 +336,16 @@ "required": true } ] + }, + { + "name": "is_empty", + "args": [ + { + "name": "Value", + "type": "any", + "required": true + } + ] } ] }, @@ -756,6 +766,16 @@ "required": true } ] + }, + { + "name": "map_size", + "args": [ + { + "name": "Map", + "type": "object", + "required": true + } + ] } ] }, diff --git a/src/hooks/Rule/bridge/useComponentsHandlers.ts b/src/hooks/Rule/bridge/useComponentsHandlers.ts index 01a3ac2e0..0adfaa4d5 100644 --- a/src/hooks/Rule/bridge/useComponentsHandlers.ts +++ b/src/hooks/Rule/bridge/useComponentsHandlers.ts @@ -98,6 +98,8 @@ export default ( const walk = (prop: Property) => { if (prop.properties) { Object.values(prop.properties).forEach((item) => walk(item)) + } else if (prop.type === 'array' && prop.items?.properties) { + Object.values(prop.items.properties).forEach((item) => walk(item)) } else if (prop.type === 'oneof') { prop.oneOf?.forEach((item) => walk(item)) } else if ( @@ -106,6 +108,9 @@ export default ( prop.is_template ) { setComponentProps(prop, { completionProvider }) + } else if (prop.type === 'boolean' && prop.is_template) { + prop.type = 'enum' + prop.symbols = [true, false] } else if (prop.type === 'object' && !prop.properties && prop.is_template) { setComponentProps(prop, { supportPlaceholder: ['key', 'value'] }) } diff --git a/src/hooks/Schema/useSchemaForm.ts b/src/hooks/Schema/useSchemaForm.ts index d7b0c3c66..ee01145d3 100644 --- a/src/hooks/Schema/useSchemaForm.ts +++ b/src/hooks/Schema/useSchemaForm.ts @@ -210,7 +210,6 @@ export default function useSchemaForm( return item }) as Property[] property.is_template = getIsTemplateFromOneOfArr(property.oneOf) - console.log(property.path) } if (!label) { property.label = lastLabel diff --git a/src/i18n/RuleSyntax.js b/src/i18n/RuleSyntax.js index 19932a3c8..d5436e515 100644 --- a/src/i18n/RuleSyntax.js +++ b/src/i18n/RuleSyntax.js @@ -1164,6 +1164,30 @@ Typical JQ programs describe simple transformations or filters for JSON data, bu zh: '返回值为执行生成生成的 JSON 对象列表。如果执行超时或者 JQ 程序抛出异常,该函数将抛出异常。', en: 'list of objects corresponding to the JSON objects generated by the given JQ program (parameter 1) when given the input provided by parameter 2. The function throws an exception if the execution did not finish before the timeout or if the jq program throws an exception.', }, + isEmptyDesc: { + zh: '判断 Map 或数组是否为空', + en: 'Return true if the map or array is empty', + }, + isEmptyParams: { + zh: '要检查的值', + en: 'Value to check', + }, + isEmptyReturns: { + zh: '布尔值,为空时返回 true', + en: 'Boolean value, true if empty', + }, + mapSizeDesc: { + zh: '获取 Map 的大小', + en: 'Return the size of a map', + }, + mapSizeParams: { + zh: 'Map 对象', + en: 'Map object', + }, + mapSizeReturns: { + zh: 'Map 的大小', + en: 'The size of the map', + }, schemaDecodeDesc: { zh: `将数据解码为目标数据结构`, en: `Decode data to target data structure`, diff --git a/src/style/rule.scss b/src/style/rule.scss index e5a8679c4..dd52b27ac 100644 --- a/src/style/rule.scss +++ b/src/style/rule.scss @@ -40,6 +40,13 @@ .detail-header img { height: 40px; } + .block-title { + max-width: 400px; + overflow: hidden; + text-overflow: ellipsis; + word-wrap: nowrap; + margin: 0; + } .info-tags { .el-tag, .node-status { diff --git a/src/views/RuleEngine/Bridge/BridgeDetail.vue b/src/views/RuleEngine/Bridge/BridgeDetail.vue index 7a33f933e..a2adab0f2 100644 --- a/src/views/RuleEngine/Bridge/BridgeDetail.vue +++ b/src/views/RuleEngine/Bridge/BridgeDetail.vue @@ -5,7 +5,13 @@