@@ -350,21 +350,29 @@ const TemplateStore = () => {
350350 ) ;
351351 } ;
352352
353- const fetchRepoRevisions = ( e ) => {
353+ const fetchRepoRevisions = ( ) => {
354+ const repo = addForm . getFieldValue ( [ "ref" , "repo" ] ) ;
355+ const path = addForm . getFieldValue ( [ "ref" , "path" ] ) ;
356+
354357 axios
355- . get ( `/api/templates/revisions?repo=` + e . target . value )
358+ . get ( `/api/templates/revisions?repo=${ repo } &path= ${ path } ` )
356359 . then ( ( res ) => {
357360 setRepoRevisions ( res . data ) ;
361+
362+ const filtered = res . data . map ( ( item ) => ( { value : item } ) ) ;
363+ setRepoRevisionOptions ( filtered ) ;
358364 } )
359365 . catch ( ( ) => { } ) ;
360366 } ;
361367
362- const handleRepoInput = ( value ) => {
368+ const handleVersionInput = ( value ) => {
363369 if ( repoRevisions . length === 0 ) {
364370 setRepoRevisionOptions ( [ ] ) ;
365371 return ;
366372 }
367373
374+ console . log ( value ) ;
375+
368376 const filtered = repoRevisions
369377 . filter ( ( item ) => item . toLowerCase ( ) . includes ( value . toLowerCase ( ) ) )
370378 . map ( ( item ) => ( { value : item } ) ) ;
@@ -670,7 +678,7 @@ const TemplateStore = () => {
670678 rules = { [ { required : true , message : "Path is required" } ] }
671679 style = { { marginBottom : "12px" } }
672680 >
673- < Input />
681+ < Input onBlur = { fetchRepoRevisions } />
674682 </ Form . Item >
675683
676684 < Form . Item
@@ -680,7 +688,7 @@ const TemplateStore = () => {
680688 >
681689 < AutoComplete
682690 options = { repoRevisionOptions }
683- onSearch = { handleRepoInput }
691+ onSearch = { handleVersionInput }
684692 allowClear
685693 >
686694 < Input />
0 commit comments