@@ -73,6 +73,7 @@ const NameServerGroupAdd = () => {
73
73
const inputNameRef = useRef < any > ( null ) ;
74
74
const inputDescriptionRef = useRef < any > ( null ) ;
75
75
const [ selectCustom , setSelectCustom ] = useState ( false ) ;
76
+ const [ matchDomains , setMatchDomains ] = useState ( 0 ) ;
76
77
77
78
useEffect ( ( ) => {
78
79
if ( editName )
@@ -87,7 +88,6 @@ const NameServerGroupAdd = () => {
87
88
cursor : "end" ,
88
89
} ) ;
89
90
} , [ editDescription ] ) ;
90
-
91
91
useEffect ( ( ) => {
92
92
if ( ! nsGroup ) return ;
93
93
@@ -117,6 +117,7 @@ const NameServerGroupAdd = () => {
117
117
nameservers : [ ] as NameServer [ ] ,
118
118
groups : [ ] ,
119
119
enabled : false ,
120
+ search_domains_enabled : false ,
120
121
} as NameServerGroup )
121
122
) ;
122
123
setEditName ( false ) ;
@@ -156,6 +157,7 @@ const NameServerGroupAdd = () => {
156
157
] ,
157
158
groups : [ ] ,
158
159
enabled : true ,
160
+ search_domains_enabled : false ,
159
161
} ,
160
162
{
161
163
name : cloudflareChoice ,
@@ -176,6 +178,7 @@ const NameServerGroupAdd = () => {
176
178
] ,
177
179
groups : [ ] ,
178
180
enabled : true ,
181
+ search_domains_enabled : false ,
179
182
} ,
180
183
{
181
184
name : quad9Choice ,
@@ -196,6 +199,7 @@ const NameServerGroupAdd = () => {
196
199
] ,
197
200
groups : [ ] ,
198
201
enabled : true ,
202
+ search_domains_enabled : false ,
199
203
} ,
200
204
] ;
201
205
@@ -262,6 +266,8 @@ const NameServerGroupAdd = () => {
262
266
groups : existingGroups ,
263
267
groupsToCreate : newGroups ,
264
268
enabled : values . enabled ,
269
+ search_domains_enabled :
270
+ matchDomains > 0 ? formNSGroup . search_domains_enabled : false ,
265
271
} as NameServerGroupToSave ;
266
272
} ;
267
273
@@ -462,6 +468,7 @@ const NameServerGroupAdd = () => {
462
468
</ Col >
463
469
</ Space >
464
470
</ Row >
471
+ { setMatchDomains ( fields . length ) }
465
472
{ fields . map ( ( field , index ) => {
466
473
return (
467
474
< Row key = { index } style = { { marginBottom : "5px" } } >
@@ -522,6 +529,13 @@ const NameServerGroupAdd = () => {
522
529
} ) ;
523
530
} ;
524
531
532
+ const handleChangeMarkDomain = ( checked : boolean ) => {
533
+ setFormNSGroup ( {
534
+ ...formNSGroup ,
535
+ search_domains_enabled : checked ,
536
+ } ) ;
537
+ } ;
538
+
525
539
return (
526
540
< >
527
541
{ nsGroup && (
@@ -701,6 +715,46 @@ const NameServerGroupAdd = () => {
701
715
< Col span = { 24 } >
702
716
< Form . List name = "domains" > { renderDomains } </ Form . List >
703
717
</ Col >
718
+
719
+ { matchDomains > 0 && (
720
+ < Col span = { 24 } >
721
+ < Form . Item name = "search_domains_enabled" label = "" >
722
+ < div
723
+ style = { {
724
+ display : "flex" ,
725
+ gap : "15px" ,
726
+ } }
727
+ >
728
+ < Switch
729
+ onChange = { handleChangeMarkDomain }
730
+ size = "small"
731
+ />
732
+ < div >
733
+ < label
734
+ style = { {
735
+ color : "rgba(0, 0, 0, 0.88)" ,
736
+ fontSize : "14px" ,
737
+ fontWeight : "500" ,
738
+ } }
739
+ >
740
+ Mark match domains as search domains
741
+ </ label >
742
+ < Paragraph
743
+ type = { "secondary" }
744
+ style = { {
745
+ marginTop : "-2" ,
746
+ fontWeight : "400" ,
747
+ marginBottom : "0" ,
748
+ } }
749
+ >
750
+ E.g., "peer.example.com" will be accessible with
751
+ "peer"
752
+ </ Paragraph >
753
+ </ div >
754
+ </ div >
755
+ </ Form . Item >
756
+ </ Col >
757
+ ) }
704
758
< Col span = { 24 } >
705
759
< label
706
760
style = { {
0 commit comments