@@ -354,6 +354,19 @@ function headerChange() {
354354 } as Pair )
355355 }
356356}
357+
358+ const headerValues = ref ([] as Pair [])
359+ const headerSelect = (item : Record <string , any >) => {
360+ headerValues .value = []
361+ pupularHeaderPairs .value .filter ((v ) => {
362+ if (v .key === item .value ) {
363+ headerValues .value .push ({
364+ key: v .value ,
365+ value: v .value
366+ } as Pair )
367+ }
368+ })
369+ }
357370function expectedHeaderChange() {
358371 const header = testCaseWithSuite .value .data .response .header
359372 let lastItem = header [header .length - 1 ]
@@ -420,8 +433,26 @@ function insertOrUpdateIntoMap(pair: Pair, pairs: Pair[]) {
420433}
421434
422435const pupularHeaders = ref ([] as Pair [])
436+ const pupularHeaderPairs = ref ([] as Pair [])
423437API .PopularHeaders ((e ) => {
424- pupularHeaders .value = e .data
438+ const headerCache = new Map <string , string >();
439+ for (var i = 0 ; i < e .data .length ; i ++ ) {
440+ const pair = {
441+ key: e .data [i ].key ,
442+ value: e .data [i ].value
443+ } as Pair
444+
445+ pupularHeaderPairs .value .push (pair )
446+
447+ if (! headerCache .get (pair .key )) {
448+ headerCache .set (pair .key , " index" )
449+
450+ pupularHeaders .value .push ({
451+ key: e .data [i ].key ,
452+ value: e .data [i ].value
453+ } as Pair )
454+ }
455+ }
425456})
426457
427458const queryPupularHeaders = (queryString : string , cb : (arg : any ) => void ) => {
@@ -434,6 +465,16 @@ const queryPupularHeaders = (queryString: string, cb: (arg: any) => void) => {
434465 })
435466 cb (results )
436467}
468+ const queryHeaderValues = (queryString : string , cb : (arg : any ) => void ) => {
469+ const results = queryString
470+ ? headerValues .value .filter (CreateFilter (queryString ))
471+ : headerValues .value
472+
473+ results .forEach ((e ) => {
474+ e .value = e .key
475+ })
476+ cb (results )
477+ }
437478 </script >
438479
439480<template >
@@ -520,13 +561,18 @@ const queryPupularHeaders = (queryString: string, cb: (arg: any) => void) => {
520561 :fetch-suggestions =" queryPupularHeaders"
521562 placeholder =" Key"
522563 @change =" headerChange"
564+ @select =" headerSelect"
523565 />
524566 </template >
525567 </el-table-column >
526568 <el-table-column label =" Value" >
527569 <template #default =" scope " >
528570 <div style =" display : flex ; align-items : center " >
529- <el-input v-model =" scope.row.value" placeholder =" Value" />
571+ <el-autocomplete
572+ v-model =" scope.row.value"
573+ :fetch-suggestions =" queryHeaderValues"
574+ style =" width : 100% ;"
575+ />
530576 </div >
531577 </template >
532578 </el-table-column >
0 commit comments