@@ -31,7 +31,7 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
3131 const testStacks = useSelector (
3232 ( state : RootState ) => state ?. migration ?. newMigrationData ?. testStacks
3333 ) ;
34- console . info ( testStacks . length )
34+
3535 const mainStack = useSelector (
3636 ( state : RootState ) => state ?. migration ?. newMigrationData ?. stackDetails
3737 ) ;
@@ -54,8 +54,8 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
5454
5555 const [ selectedStack , setSelectedStack ] = useState < DropdownOption > (
5656 {
57- label : stackIds [ stackIds . length - 1 ] ?. label ?? '' ,
58- value : stackIds [ stackIds . length - 1 ] ?. value ?? ''
57+ label : stackIds [ stackIds ? .length - 1 ] ?. label ?? '' ,
58+ value : stackIds [ stackIds ? .length - 1 ] ?. value ?? ''
5959 }
6060 ) ;
6161
@@ -87,14 +87,14 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
8787 try {
8888 let filterValueCopy : FilterOption [ ] = [ ...filterOption ] ;
8989
90- if ( ! filterValueCopy . length && isChecked ) {
91- filterValueCopy . push ( value ) ;
90+ if ( ! filterValueCopy ? .length && isChecked ) {
91+ filterValueCopy ? .push ( value ) ;
9292 } else if ( isChecked ) {
9393 // Remove the old value and keep updated one in case old value exists
94- const updatedFilter = filterValueCopy . filter ( ( v ) => v . value !== value . value ) ;
94+ const updatedFilter = filterValueCopy ? .filter ( ( v ) => v ? .value !== value ? .value ) ;
9595 filterValueCopy = [ ...updatedFilter , value ] ;
9696 } else if ( ! isChecked ) {
97- filterValueCopy = filterValueCopy . filter ( ( v ) => v . value !== value . value ) ;
97+ filterValueCopy = filterValueCopy ? .filter ( ( v ) => v ? .value !== value ? .value ) ;
9898 }
9999
100100 setFilterOption ( filterValueCopy ) ;
@@ -106,7 +106,7 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
106106 // Method to handle Apply
107107 const onApply = ( ) => {
108108 try {
109- if ( ! filterOption . length ) {
109+ if ( ! filterOption ? .length ) {
110110 const newFilter = 'all' ;
111111 setFilterValue ( newFilter ) ;
112112 fetchData ( { filter : newFilter } ) ;
@@ -116,7 +116,7 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
116116
117117 const usersQueryArray = filterOption . map ( ( item ) => item . value ) ;
118118 const newFilter =
119- usersQueryArray . length > 1 ? usersQueryArray . join ( '-' ) : usersQueryArray [ 0 ] ;
119+ usersQueryArray ? .length > 1 ? usersQueryArray ? .join ( '-' ) : usersQueryArray [ 0 ] ;
120120
121121 setFilterValue ( newFilter ) ;
122122 fetchData ( { filter : newFilter } ) ;
@@ -177,8 +177,8 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
177177 Header : 'Timestamp' ,
178178 disableSortBy : true ,
179179 accessor : ( data : LogEntry ) => {
180- if ( data . timestamp ) {
181- const date = new Date ( data . timestamp ) ;
180+ if ( data ? .timestamp ) {
181+ const date = new Date ( data ? .timestamp ) ;
182182 const options : Intl . DateTimeFormatOptions = {
183183 month : 'short' ,
184184 day : '2-digit' ,
@@ -198,7 +198,7 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
198198 Header : 'Level' ,
199199 id : 'level' ,
200200 disableSortBy : true ,
201- accessor : ( data : LogEntry ) => < div > { data . level } </ div > ,
201+ accessor : ( data : LogEntry ) => < div > { data ? .level } </ div > ,
202202 width : 150 ,
203203 filter : ColumnFilter
204204 } ,
@@ -208,7 +208,7 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
208208 accessor : ( data : LogEntry ) => {
209209 return (
210210 < div >
211- < div > { data . message } </ div >
211+ < div > { data ? .message } </ div >
212212 </ div >
213213 ) ;
214214 } ,
@@ -220,7 +220,7 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
220220 accessor : ( data : LogEntry ) => {
221221 return (
222222 < div >
223- < div > { data . methodName } </ div >
223+ < div > { data ? .methodName } </ div >
224224 </ div >
225225 ) ;
226226 } ,
@@ -250,7 +250,7 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
250250 const response = await getMigrationLogs (
251251 selectedOrganisation ?. value || '' ,
252252 projectId ,
253- selectedStack . value ,
253+ selectedStack ? .value ,
254254 skip ,
255255 limit ,
256256 startIndex ,
@@ -264,8 +264,8 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
264264 setData ( [ ] ) ;
265265 setTotalCounts ( 0 ) ;
266266 } else {
267- setData ( response . data . logs ) ;
268- setTotalCounts ( response . data . total ) ;
267+ setData ( response ? .data . logs ) ;
268+ setTotalCounts ( response ? .data . total ) ;
269269 }
270270 } catch ( error ) {
271271 console . error ( 'Unexpected error while fetching logs:' , error ) ;
@@ -279,58 +279,61 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
279279 return (
280280 < div >
281281 < InfiniteScrollTable
282- tableHeight = { 590 }
283- itemSize = { 60 }
284- columns = { columns }
285- data = { data }
286- uniqueKey = { 'timestamp' }
287- fetchTableData = { fetchData }
288- totalCounts = { totalCounts }
289- loading = { loading }
290- rowPerPageOptions = { [ 10 , 30 , 50 , 100 ] }
291- minBatchSizeToFetch = { 30 }
292- v2Features = { {
293- pagination : true ,
294- isNewEmptyState : true
295- } }
296- isResizable = { true }
297- isRowSelect = { false }
298- columnSelector = { false }
299- canSearch = { true }
300- searchPlaceholder = { 'Search Execution Logs' }
301- searchValue = { searchText }
302- onSearchChangeEvent = { ( value : string ) => setSearchText ( value ) }
303- withExportCta = { {
304- component : (
305- < Select
306- className = 'dropdown-wrapper'
307- width = "250px"
308- version = "v2"
309- value = { testStacks . length ? selectedStack : '' }
310- options = { stackIds }
311- placeholder = 'Select a stack'
312- onChange = { ( s : DropdownOption ) => {
313- setSelectedStack ( { label : s . label , value : s . value } )
314- setSearchText ( '' ) ;
315- } }
316- />
317- ) ,
318- showExportCta : true
319- } }
320- customEmptyState = {
321- < EmptyState
322- forPage = "list"
323- heading = { searchText === '' ? 'No Logs' : 'No matching results found!' }
324- description = {
325- searchText === ''
326- ? 'Try Executing the Migration.'
327- : 'Try changing the search query to find what you are looking for.'
328- }
329- moduleIcon = { searchText === '' ? 'NoDataEmptyState' : 'NoSearchResult' }
330- type = "secondary"
331- className = "custom-empty-state"
332- />
282+ tableHeight = { 590 }
283+ itemSize = { 60 }
284+ columns = { columns }
285+ data = { data ?? [ ] }
286+ uniqueKey = { 'timestamp' }
287+ fetchTableData = { fetchData }
288+ totalCounts = { totalCounts ?? 0 }
289+ loading = { loading }
290+ rowPerPageOptions = { [ 10 , 30 , 50 , 100 ] }
291+ minBatchSizeToFetch = { 30 }
292+ v2Features = { {
293+ pagination : true ,
294+ isNewEmptyState : true
295+ } }
296+ isResizable = { true }
297+ isRowSelect = { false }
298+ columnSelector = { false }
299+ canSearch = { true }
300+ searchPlaceholder = { 'Search Execution Logs' }
301+ searchValue = { searchText ?? '' }
302+ onSearchChangeEvent = { ( value : string ) => setSearchText ( value ) }
303+ withExportCta = { {
304+ component : (
305+ < Select
306+ className = 'dropdown-wrapper'
307+ width = "250px"
308+ version = "v2"
309+ value = { testStacks ?. length ? selectedStack : '' }
310+ options = { stackIds ?? [ ] }
311+ placeholder = 'Select a stack'
312+ onChange = { ( s : DropdownOption ) => {
313+ setSelectedStack ( {
314+ label : s ?. label ?? '' ,
315+ value : s ?. value ?? ''
316+ } ) ;
317+ setSearchText ( '' ) ;
318+ } }
319+ />
320+ ) ,
321+ showExportCta : true
322+ } }
323+ customEmptyState = {
324+ < EmptyState
325+ forPage = "list"
326+ heading = { searchText === '' ? 'No Logs' : 'No matching results found!' }
327+ description = {
328+ searchText === ''
329+ ? 'Try Executing the Migration.'
330+ : 'Try changing the search query to find what you are looking for.'
333331 }
332+ moduleIcon = { searchText === '' ? 'NoDataEmptyState' : 'NoSearchResult' }
333+ type = "secondary"
334+ className = "custom-empty-state"
335+ />
336+ }
334337 />
335338 </ div >
336339 ) ;
0 commit comments