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
10 changes: 8 additions & 2 deletions ui/src/components/dynamics-form/FormItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ const to_rule = (rule: any) => {
if (typeof rule.validator === 'string' || rule.validator === 'component') {
return { ...rule, validator: component_validator }
}
if (
rule.required &&
['TextInput', 'TextareaInput', 'PasswordInput'].includes(props.formfield.input_type)
) {
return { ...rule, type: 'string', whitespace: true }
}
return rule
}

Expand All @@ -152,11 +158,11 @@ const to_rule = (rule: any) => {
const rules = computed(() => {
return props_info.value.rules
? props_info.value.rules.map(to_rule)
: {
: to_rule({
message: errMsg.value,
trigger: props.formfield.input_type === 'Slider' ? 'blur' : ['blur', 'change'],
required: props.formfield.required === false ? false : true,
}
})
})

/**

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are my findings:

Potential Issues

  1. Return type inconsistency in to_rule

    • The function sometimes returns an object (from spread) and sometimes the original rule. If rule could be undefined or non-object, { ...rule } spreads nothing. Consider guarding input type.
  2. computed return shape mismatch

    • Before: fallback was an object { message, trigger, required }.
    • After: fallback is wrapped with to_rule(...) returning an object too — consistent. But note upstream consumers (rules.map(to_rule) returns an array) now differ:
      • props_info.value.rules present → returns an array
      • absent → returns a single object
    • If the consumer expects an array consistently (e.g., passed to Ant Design's rules prop which accepts array or single), this is fine for antd but fragile elsewhere. Safer to wrap fallback in [...].
  3. Order of conditions in to_rule

    • The new required branch executes after the validator branch. Since validator branch returns early, that's correct. But the new branch overwrites any existing type/whitespace on the incoming rule without checking. If rule.type was already set (e.g. string), it will be overwritten. Prefer merging only when unset:
      return { type: 'string', whitespace: true, ...rule }
      so caller-supplied overrides win.
  4. Missing null-check on props.formfield

    • Accessing props.formfield.input_type assumes formfield is defined. Elsewhere it's also accessed, so probably safe, but worth verifying.
  5. whitespace: true semantics

    • For PasswordInput, rejecting whitespace-only passwords may be intentional, but be aware some validators treat whitespace differently. Confirm product requirement — passwords with trailing spaces would now fail.
  6. TextareaInput whitespace

    • Multi-line textareas legitimately receive blank lines; whitespace: true will reject purely-whitespace content. Usually desired for "required", but confirm UX.
  7. includes on possibly undefined input_type

    • ['...'].includes(undefined) returns false, so safe. Fine.
  8. Recomputing component_validator reference

    • Same as before; no change introduced.

Optimization / Style Suggestions

  • Extract the list of input types to a module-level constant (const WHITESPACE_CHECKED_INPUTS = [...]) to avoid recreating the array on every to_rule call.
  • Consider ordering merged props to let explicit rule values take precedence:
    return { type: 'string', whitespace: true, ...rule, required: rule.required }
    Note spreading rule after resets nothing but keeps user intent separate from enforced defaults.
  • Ensure fallback wraps in array for consistency:
    : [to_rule({ message: errMsg.value, trigger: ..., required: ... })]
  • Add a unit test asserting that a PasswordInput with required: true gets { type: 'string', whitespace: true } and that a custom validator still takes priority (it does, due to the early return).
  • The @@ -143,6 +143,12 @@ header looks like a diff annotation pasted into source — verify it isn't accidentally committed into actual code.

Expand Down
4 changes: 2 additions & 2 deletions ui/src/components/dynamics-form/constructor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ const form_data = ref<any>({
const visibility_rules = ref<any>(null)
const visibilityRef = ref()
const rules = {
label: [{ required: true, message: t('dynamicsForm.paramForm.name.requiredMessage') }],
field: [{ required: true, message: t('dynamicsForm.paramForm.field.requiredMessage') }],
label: [{ required: true, whitespace: true, message: t('dynamicsForm.paramForm.name.requiredMessage') }],
field: [{ required: true, whitespace: true, message: t('dynamicsForm.paramForm.field.requiredMessage') }],
required: [{ required: true, message: t('dynamicsForm.paramForm.required.requiredMessage') }],
input_type: [{ required: true, message: t('dynamicsForm.paramForm.input_type.requiredMessage') }],
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
prop="default_value"
:label="$t('dynamicsForm.default.label')"
:rules="
formValue.required ? [{ required: true, message: `${$t('dynamicsForm.default.label')}${$t('dynamicsForm.default.requiredMessage')}` }, ...rules] : rules
formValue.required ? [{ required: true, whitespace: true, message: `${$t('dynamicsForm.default.label')}${$t('dynamicsForm.default.requiredMessage')}` }, ...rules] : rules
"
>
<div class="defaultValueCheckbox">
Expand Down Expand Up @@ -117,6 +117,7 @@ const getData = () => {
? [
{
required: true,
whitespace: true,
message: `${formValue.value.label} ${t('dynamicsForm.default.requiredMessage')}`
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
prop="default_value"
:label="$t('dynamicsForm.default.label')"
:rules="
formValue.required ? [{ required: true, message: `${$t('dynamicsForm.default.label')}${$t('dynamicsForm.default.requiredMessage')}` }, ...rules] : rules
formValue.required ? [{ required: true, whitespace: true, message: `${$t('dynamicsForm.default.label')}${$t('dynamicsForm.default.requiredMessage')}` }, ...rules] : rules
"
>
<div class="defaultValueCheckbox">
Expand Down Expand Up @@ -110,7 +110,7 @@ const getData = () => {
props_info: {
rules: formValue.value.required
? [
{ required: true, message: `${formValue.value.label} ${t('dynamicsForm.default.requiredMessage')}` },
{ required: true, whitespace: true, message: `${formValue.value.label} ${t('dynamicsForm.default.requiredMessage')}` },
{
min: formValue.value.minlength,
max: formValue.value.maxlength,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
? [
{
required: true,
whitespace: true,
message: `${$t('dynamicsForm.default.label')}${$t('dynamicsForm.default.requiredMessage')}`,
},
...rules,
Expand Down Expand Up @@ -122,6 +123,7 @@ const getData = () => {
? [
{
required: true,
whitespace: true,
message: `${formValue.value.label} ${t('dynamicsForm.default.requiredMessage')}`,
},
{
Expand Down
2 changes: 0 additions & 2 deletions ui/src/stores/modules/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ const useUserStore = defineStore('user', {
this.workspace_list = workspace_list
useLocalStorage<string>(localeConfigKey, 'en-US').value =
ok?.data?.language || this.getLanguage()
const theme = useThemeStore()
theme.setTheme()
return this.asyncGetProfile()
})
},
Expand Down
4 changes: 4 additions & 0 deletions ui/src/styles/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
margin: 0;
padding: 0;
}
/* 全局焦点轮廓 */
*:focus-visible {
outline: none !important;
}

html {
height: 100%;
Expand Down
10 changes: 5 additions & 5 deletions ui/src/styles/element-plus.scss
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@
&:focus-visible {
outline: none !important;
}
&.is-link:focus {
background: none;
&.is-link {
border: none;
}
&.is-link:not(.is-disabled):hover {
color: var(--el-color-primary);
&:focus {
background: none;
border: none;
}
}
}
.el-button--text {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review: SCSS Button Style Changes

Summary of Changes

The diff refactors .is-link styles by:

  1. Moving border: none from the :focus variant to the base .is-link selector.
  2. Nesting &:focus inside .is-link.
  3. Removing the &.is-link:not(.is-disabled):hover rule entirely.

Issues & Concerns

🔴 1. Unintentional Removal of Hover Style (likely a bug)

-  &.is-link:not(.is-disabled):hover {
-    color: var(--el-color-primary);
-  }

This hover rule is deleted with no replacement. If this was meant to be refactored rather than removed, link buttons will lose their primary-color hover feedback. This is likely an accidental deletion. Verify whether hover styling is now handled elsewhere; if not, restore it (e.g., nested under .is-link).

🟡 2. border: none Now Applied to All States

Previously border: none only applied on :focus. Now it applies to all .is-link states including hover/active/disabled. Usually desirable for link buttons, but confirm it doesn't override a needed border on :active or disabled states defined in other rules.

🟡 3. Redundant Declarations in :focus

&:focus {
  background: none;
  border: none;   // redundant — already set on .is-link parent
}

Since border: none is inherited from the parent .is-link block, redeclaring it in :focus is redundant. Can be removed.

🟢 4. Use of !important (pre-existing)

outline: none !important;

Not introduced here, but !important on outline harms accessibility (removes visible focus indicator). Consider using a custom visible focus style instead for keyboard users.

🟢 5. Stylelint Max-Nesting-Depth

Moving :focus inside .is-link increases nesting depth. Typically fine, but check your project's linter config (max-nesting-depth) and CSS specificity budget.


Suggested Refactor

&.is-link {
  border: none;

  &:focus {
    background: none;
  }

  &:not(.is-disabled):hover {
    color: var(--el-color-primary);   // restored
  }
}

Optimization Notes

  • Consolidate the split .is-link blocks into one block (currently scattered) to reduce selector duplication.
  • Prefer logical properties / minimal nesting where specificty allows.
  • Confirm the removal of the hover rule was intentional and documented in the commit message.

Expand Down
1 change: 1 addition & 0 deletions ui/src/views/paragraph/component/ParagraphCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
<el-dropdown
class="w-full"
trigger="hover"
:teleported="false"
:show-arrow="false"
placement="right-start"
popper-class="move-position-popper"
Expand Down
7 changes: 2 additions & 5 deletions ui/src/workflow/common/NodeContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div @mousedown="mousedown" class="workflow-node-container p-16" style="overflow: visible">
<div
class="step-container white-bg border-r-8 p-16"
:class="{ isSelected: props.nodeModel.isSelected, error: node_status !== 200 }"
:class="{ error: node_status !== 200 }"
style="overflow: visible"
>
<div v-resize="resizeStepContainer">
Expand Down Expand Up @@ -562,15 +562,12 @@ onMounted(() => {
<style lang="scss" scoped>
.workflow-node-container {
.step-container {
border: 2px solid #ffffff !important;
border: 2px solid var(--workflow-node-border-color) !important;
box-sizing: border-box;
box-shadow: 0px 2px 4px 0px rgba(var(--el-text-color-primary-rgb), 0.12);
&:hover {
box-shadow: 0px 6px 24px 0px rgba(var(--el-text-color-primary-rgb), 0.08);
}
&.isSelected {
border: 2px solid var(--el-color-primary) !important;
}
&.error {
border: 1px solid #f54a45 !important;
}
Expand Down
8 changes: 8 additions & 0 deletions ui/src/workflow/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,12 @@ defineExpose({
.lf-drag-able {
cursor: pointer;
}

.lf-node {
--workflow-node-border-color: #ffffff;

&.lf-node-selected {
--workflow-node-border-color: var(--el-color-primary);
}
}
</style>
7 changes: 2 additions & 5 deletions ui/src/workflow/nodes/loop-body-node/LoopBodyContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div @mousedown="mousedown" class="workflow-node-container p-16" style="overflow: visible">
<div
class="step-container white-bg border-r-8 p-16"
:class="{ isSelected: props.nodeModel.isSelected, error: node_status !== 200 }"
:class="{ error: node_status !== 200 }"
style="overflow: visible;"
>
<div>
Expand Down Expand Up @@ -227,15 +227,12 @@ defineExpose({ close, zoom })
<style lang="scss" scoped>
.workflow-node-container {
.step-container {
border: 2px solid #ffffff !important;
border: 2px solid var(--workflow-node-border-color) !important;
box-sizing: border-box;
box-shadow: 0px 2px 4px 0px rgba(var(--el-text-color-primary-rgb), 0.12);
&:hover {
box-shadow: 0px 6px 24px 0px rgba(var(--el-text-color-primary-rgb), 0.08);
}
&.isSelected {
border: 2px solid var(--el-color-primary) !important;
}
&.error {
border: 1px solid #f54a45 !important;
}
Expand Down
16 changes: 8 additions & 8 deletions ui/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {fileURLToPath, URL} from 'node:url'
import type {ProxyOptions} from 'vite'
import {defineConfig, loadEnv} from 'vite'
import { fileURLToPath, URL } from 'node:url'
import type { ProxyOptions } from 'vite'
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import DefineOptions from 'unplugin-vue-define-options/vite'
import path from 'path'
import {createHtmlPlugin} from 'vite-plugin-html'
import { createHtmlPlugin } from 'vite-plugin-html'
import fs from 'fs'
// import vueDevTools from 'vite-plugin-vue-devtools'
const envDir = './env'
Expand Down Expand Up @@ -36,15 +36,15 @@ export default defineConfig((conf: any) => {
const ENV = loadEnv(mode, envDir)
const proxyConf: Record<string, string | ProxyOptions> = {}
proxyConf['/admin/api'] = {
target: 'http://127.0.0.1:8080',
target: 'https://mk-ee.fit2cloud.cn',
changeOrigin: true,
}
proxyConf['/chat/api'] = {
target: 'http://127.0.0.1:8080',
target: 'https://mk-ee.fit2cloud.cn',
changeOrigin: true,
}
proxyConf['/doc'] = {
target: 'http://127.0.0.1:8080',
target: 'https://mk-ee.fit2cloud.cn',
changeOrigin: true,
rewrite: (path: string) => path.replace(ENV.VITE_BASE_PATH, '/'),
}
Expand Down Expand Up @@ -89,7 +89,7 @@ export default defineConfig((conf: any) => {
vue(),
vueJsx(),
DefineOptions(),
createHtmlPlugin({template: ENV.VITE_ENTRY}),
createHtmlPlugin({ template: ENV.VITE_ENTRY }),
renameHtmlPlugin(`dist${ENV.VITE_BASE_PATH}`, ENV.VITE_ENTRY),
],
server: {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's my review of the diff:

Issues & Concerns

1. Hardcoded external proxy targets (⚠️ Most significant)

The change from http://127.0.0.1:8080 to https://mk-ee.fit2cloud.cn hardcodes a remote production/staging server into dev proxy config.

Problems:

  • Developers will silently hit a shared remote backend during local dev → side effects on shared data, confusing debugging.
  • No way to switch per environment. Should read from env instead:
    proxyConf['/admin/api'] = {
      target: ENV.VITE_PROXY_TARGET ?? 'http://127.0.0.1:8080',
      changeOrigin: true,
      // enable if target uses self-signed cert
      secure: false,
    }
  • Since the new target is HTTPS, you may need secure: false if it uses an internal/self-signed certificate, otherwise Vite will reject the TLS handshake.

2. Unnecessary /doc rewrite safety check

The /doc rewrite uses ENV.VITE_BASE_PATH — if that's empty it becomes '', and path.replace('', '/') returns / + original path, corrupting routes. Guard it:

rewrite: (p) => ENV.VITE_BASE_PATH ? p.replace(ENV.VITE_BASE_PATH, '/') : p

3. Formatting-only changes are noisy

Most hunks (import { fileURLToPath, URL }, etc.) are pure whitespace/prettier formatting mixed with the functional change. Consider committing formatting separately (e.g., run Prettier once in its own commit) to keep the diff focused and reviewable via git blame.

4. Minor pre-existing observations

  • mode / conf: any — the config callback ignores conf.command; typing param as any loses type safety. Use ConfigEnv from vite.
  • proxyConf typed as Record<string, string | ProxyOptions> — values are always objects here; Record<string, ProxyOptions> is more precise.
  • Trailing commas / no semicolons look fine but ensure project lint matches the reformatted style.

Recommendation

Revert the localhost→remote proxy change, or gate it behind an env variable (e.g., VITE_PROXY_TARGET), and add secure: false for the HTTPS case. Keep formatting changes in a separate commit.

Expand Down
Loading