mirror of
https://github.com/taylanbakircioglu/haproxy-openmanager.git
synced 2026-09-12 05:48:58 +00:00
fix: auto-correct redirect target when switching type to scheme
When user changes redirect type from location/prefix to scheme, the target field (e.g. "https://example.com") stays as-is but the UI shows a blank Select. If saved without re-selecting, invalid config would be sent. Now auto-sets target to "https" when switching to scheme type. Made-with: Cursor
This commit is contained in:
@@ -538,7 +538,13 @@ function RedirectRuleCard({ rule, index, onChange, onDelete }) {
|
||||
<Col flex="100px">
|
||||
<Select
|
||||
value={rule.type}
|
||||
onChange={(val) => onChange(index, { ...rule, type: val })}
|
||||
onChange={(val) => {
|
||||
const newRule = { ...rule, type: val };
|
||||
if (val === 'scheme' && rule.target !== 'http' && rule.target !== 'https') {
|
||||
newRule.target = 'https';
|
||||
}
|
||||
onChange(index, newRule);
|
||||
}}
|
||||
placeholder="Type"
|
||||
size="small"
|
||||
style={{ width: '100%' }}
|
||||
|
||||
Reference in New Issue
Block a user