Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a53e1393
authored
Feb 27, 2026
by
Seefs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: support header token-map rewrite and improve set_header editor UX
parent
054370ab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
3 deletions
+32
-3
web/src/components/table/channels/modals/ParamOverrideEditorModal.jsx
+32
-3
No files found.
web/src/components/table/channels/modals/ParamOverrideEditorModal.jsx
View file @
a53e1393
...
...
@@ -1485,6 +1485,24 @@ const ParamOverrideEditorModal = ({ visible, value, onSave, onCancel }) => {
);
};
const
formatSelectedOperationValueAsJson
=
useCallback
(()
=>
{
if
(
!
selectedOperation
)
return
;
const
raw
=
String
(
selectedOperation
.
value_text
||
''
).
trim
();
if
(
!
raw
)
return
;
if
(
!
verifyJSON
(
raw
))
{
showError
(
t
(
'当前值不是合法 JSON,无法格式化'
));
return
;
}
try
{
updateOperation
(
selectedOperation
.
id
,
{
value_text
:
JSON
.
stringify
(
JSON
.
parse
(
raw
),
null
,
2
),
});
showSuccess
(
t
(
'JSON 已格式化'
));
}
catch
(
error
)
{
showError
(
t
(
'当前值不是合法 JSON,无法格式化'
));
}
},
[
selectedOperation
,
t
,
updateOperation
]);
const
updateReturnErrorDraft
=
(
operationId
,
draftPatch
=
{})
=>
{
const
current
=
operations
.
find
((
item
)
=>
item
.
id
===
operationId
);
if
(
!
current
)
return
;
...
...
@@ -2608,9 +2626,20 @@ const ParamOverrideEditorModal = ({ visible, value, onSave, onCancel }) => {
</
div
>
)
:
(
<
div
className=
'mt-2'
>
<
Text
type=
'tertiary'
size=
'small'
>
{
t
(
getModeValueLabel
(
mode
))
}
</
Text
>
<
div
className=
'flex items-center justify-between gap-2'
>
<
Text
type=
'tertiary'
size=
'small'
>
{
t
(
getModeValueLabel
(
mode
))
}
</
Text
>
{
mode
===
'set_header'
?
(
<
Button
size=
'small'
type=
'tertiary'
onClick=
{
formatSelectedOperationValueAsJson
}
>
{
t
(
'格式化 JSON'
)
}
</
Button
>
)
:
null
}
</
div
>
<
TextArea
value=
{
selectedOperation
.
value_text
}
autosize=
{
{
minRows
:
1
,
maxRows
:
4
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment