@@ -16,6 +16,7 @@ import HorizontalDivider from 'components/atoms/common/HorizontalDivider';
1616import { JsonView , allExpanded , collapseAllNested , darkStyles , defaultStyles } from 'react-json-view-lite' ;
1717import 'react-json-view-lite/dist/index.css' ;
1818import { LogLevel } from '../flow/graph/GraphLogger' ;
19+ import { ShieldCheckIcon , BarsArrowUpIcon , ExclamationTriangleIcon } from '@heroicons/react/24/outline' ;
1920import GenAIUsageDisclaimer from '../modals/GenAIUsageDisclaimer' ;
2021import { getLocalStorageItem } from 'utils/common' ;
2122
@@ -37,6 +38,34 @@ const TabPanelHeader = () => {
3738 const [ genAiUsageDisclaimerModalOpen , setGenAiUsageDisclaimerModalOpen ] = useState ( false ) ;
3839 const [ generateFlowTestModalOpen , setGenerateFlowTestModalOpen ] = useState ( false ) ;
3940
41+ const renderFlowScan = ( flowScan ) => {
42+ if ( flowScan . upload === 'disabled' ) {
43+ return (
44+ < div className = 'flex flex-col items-start' >
45+ < Tippy content = { flowScan . message } placement = 'top' >
46+ < BarsArrowUpIcon className = 'h-4 w-4' />
47+ </ Tippy >
48+ { 'Activate Flow Scan' }
49+ </ div >
50+ ) ;
51+ } else if ( flowScan . upload === 'success' ) {
52+ return (
53+ < div className = 'flex flex-col items-start' >
54+ < ShieldCheckIcon className = 'h-4 w-4' />
55+ { flowScan . url }
56+ </ div >
57+ ) ;
58+ } else if ( flowScan . upload === 'fail' ) {
59+ return (
60+ < div className = 'flex flex-col items-start' >
61+ < ExclamationTriangleIcon className = 'h-4 w-4' />
62+ { flowScan . message }
63+ { flowScan ?. reason }
64+ </ div >
65+ ) ;
66+ }
67+ } ;
68+
4069 const renderLog = ( log ) => {
4170 if ( log . logLevel === LogLevel . INFO ) {
4271 let message = '' ;
@@ -47,28 +76,30 @@ const TabPanelHeader = () => {
4776
4877 if ( log . node != undefined ) {
4978 const type = log . node . type ;
79+ const data = log . node . data ;
5080 if ( type === 'outputNode' ) {
5181 json = {
52- output : log . node . data ,
82+ output : data . output ,
5383 } ;
5484 }
5585
86+ if ( type === 'authNode' ) {
87+ message = `${ data . authType } ` ;
88+ }
89+
5690 if ( type === 'assertNode' ) {
57- const data = log . node . data ;
5891 message = `Assert : ${ data . var1 } of type ${ typeof data . var1 } ${ data . operator } ${ data . var2 } of type ${ typeof data . var2 } = ${ data . result } ` ;
5992 }
6093
6194 if ( type === 'delayNode' ) {
62- message = `Waiting for ${ log . node . data } ms` ;
95+ message = `Waiting for ${ data . delay } ms` ;
6396 }
6497
6598 if ( type === 'setVarNode' ) {
66- const data = log . node . data ;
6799 message = `Setting Variable: ${ data . name } = ${ data . value } ` ;
68100 }
69101
70102 if ( type === 'requestNode' ) {
71- const data = log . node . data ;
72103 message = `${ data . request . type . toUpperCase ( ) } ${ data . request . url } ` ;
73104 json = data ;
74105 }
@@ -142,7 +173,7 @@ const TabPanelHeader = () => {
142173 < div className = 'flex h-12 items-center justify-center' >
143174 < SaveFlowModal tab = { focusTab } />
144175 </ div >
145- { focusTab . type === OBJ_TYPES . flowtest && graphRunLogs . length != 0 ? (
176+ { focusTab . type === OBJ_TYPES . flowtest && focusTab . run . logs && focusTab . run . logs . length != 0 ? (
146177 < div >
147178 < Button
148179 id = 'graph-logs-side-sheet'
@@ -186,7 +217,8 @@ const TabPanelHeader = () => {
186217 className = 'drawer-overlay'
187218 > </ label >
188219 < ul className = 'menu min-h-full bg-base-200 p-4 text-base-content' >
189- { graphRunLogs . map ( ( item , index ) => (
220+ < li key = 'scan' > { renderFlowScan ( focusTab . run . scan ) } </ li >
221+ { focusTab . run . logs . map ( ( item , index ) => (
190222 < li key = { index } > { renderLog ( item ) } </ li >
191223 ) ) }
192224 </ ul >
0 commit comments