@@ -12,6 +12,7 @@ import './index.scss';
1212
1313import FilterModal from '../FilterModale' ;
1414import { getMigrationLogs } from '../../services/api/migration.service' ;
15+ import { EXECUTION_LOGS_UI_TEXT } from '../../utilities/constants' ;
1516
1617const ExecutionLogs = ( { projectId } : { projectId : string } ) => {
1718 const [ data , setData ] = useState < LogEntry [ ] > ( [ ] ) ;
@@ -40,7 +41,7 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
4041 state ?. migration ?. newMigrationData ?. migration_execution ?. migrationCompleted
4142 ) ;
4243
43- const stackIds = testStacks ?. map ( ( stack : StackIds ) => ( {
44+ const stackIds = testStacks ?. map ?. ( ( stack : StackIds ) => ( {
4445 label : stack ?. stackName ,
4546 value : stack ?. stackUid
4647 } ) ) ;
@@ -54,8 +55,8 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
5455
5556 const [ selectedStack , setSelectedStack ] = useState < DropdownOption > (
5657 {
57- label : stackIds [ stackIds ?. length - 1 ] ?. label ?? '' ,
58- value : stackIds [ stackIds ?. length - 1 ] ?. value ?? ''
58+ label : stackIds ?. [ stackIds ?. length - 1 ] ?. label ?? '' ,
59+ value : stackIds ?. [ stackIds ?. length - 1 ] ?. value ?? ''
5960 }
6061 ) ;
6162
@@ -114,10 +115,8 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
114115 return ;
115116 }
116117
117- const usersQueryArray = filterOption . map ( ( item ) => item . value ) ;
118- const newFilter =
119- usersQueryArray ?. length > 1 ? usersQueryArray ?. join ( '-' ) : usersQueryArray [ 0 ] ;
120-
118+ const usersQueryArray = filterOption ?. map ( ( item ) => item ?. value ) ;
119+ const newFilter = usersQueryArray ?. length > 1 ? usersQueryArray ?. join ( '-' ) : usersQueryArray ?. [ 0 ] ;
121120 setFilterValue ( newFilter ) ;
122121 fetchData ( { filter : newFilter } ) ;
123122 setIsFilterApplied ( true ) ;
@@ -136,8 +135,8 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
136135
137136 const iconProps = {
138137 className : isFilterApplied
139- ? 'filterWithAppliedIcon Icon--v2 Icon--medium'
140- : 'defaultFilterIcon Icon--v2 Icon--medium' ,
138+ ? EXECUTION_LOGS_UI_TEXT . FILTER_ICON . FILTER_ON
139+ : EXECUTION_LOGS_UI_TEXT . FILTER_ICON . FILTER_OFF ,
141140 withTooltip : true ,
142141 tooltipContent : 'Filter' ,
143142 tooltipPosition : 'left'
@@ -187,7 +186,7 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
187186 minute : '2-digit' ,
188187 hour12 : true
189188 } ;
190- const formatted = new Intl . DateTimeFormat ( 'en-US' , options ) . format ( date ) ;
189+ const formatted = new Intl . DateTimeFormat ( 'en-US' , options ) ? .format ( date ) ;
191190 return < div > { formatted } </ div > ;
192191 }
193192 return < div > No Data Available</ div > ;
@@ -264,8 +263,8 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
264263 setData ( [ ] ) ;
265264 setTotalCounts ( 0 ) ;
266265 } else {
267- setData ( response ?. data . logs ) ;
268- setTotalCounts ( response ?. data . total ) ;
266+ setData ( response ?. data ? .logs ) ;
267+ setTotalCounts ( response ?. data ? .total ) ;
269268 }
270269 } catch ( error ) {
271270 console . error ( 'Unexpected error while fetching logs:' , error ) ;
@@ -297,7 +296,7 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
297296 isRowSelect = { false }
298297 columnSelector = { false }
299298 canSearch = { true }
300- searchPlaceholder = { 'Search Execution Logs' }
299+ searchPlaceholder = { EXECUTION_LOGS_UI_TEXT . SEARCH_PLACEHOLDER }
301300 searchValue = { searchText ?? '' }
302301 onSearchChangeEvent = { ( value : string ) => setSearchText ( value ) }
303302 withExportCta = { {
@@ -308,7 +307,7 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
308307 version = "v2"
309308 value = { testStacks ?. length ? selectedStack : '' }
310309 options = { stackIds ?? [ ] }
311- placeholder = 'Select a stack'
310+ placeholder = { EXECUTION_LOGS_UI_TEXT . SELECT_PLACEHOLDER }
312311 onChange = { ( s : DropdownOption ) => {
313312 setSelectedStack ( {
314313 label : s ?. label ?? '' ,
@@ -323,13 +322,13 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
323322 customEmptyState = {
324323 < EmptyState
325324 forPage = "list"
326- heading = { searchText === '' ? 'No Logs' : 'No matching results found!' }
325+ heading = { searchText === '' ? EXECUTION_LOGS_UI_TEXT . EMPTY_STATE_HEADING . NO_LOGS : EXECUTION_LOGS_UI_TEXT . EMPTY_STATE_HEADING . NO_MATCH }
327326 description = {
328327 searchText === ''
329- ? 'Try Executing the Migration.'
330- : 'Try changing the search query to find what you are looking for.'
328+ ? EXECUTION_LOGS_UI_TEXT . EMPTY_STATE_DESCRIPTION . NO_LOGS
329+ : EXECUTION_LOGS_UI_TEXT . EMPTY_STATE_DESCRIPTION . NO_RESULT
331330 }
332- moduleIcon = { searchText === '' ? 'NoDataEmptyState' : 'NoSearchResult' }
331+ moduleIcon = { searchText === '' ? EXECUTION_LOGS_UI_TEXT . EMPTY_STATE_ICON . NO_LOGS : EXECUTION_LOGS_UI_TEXT . EMPTY_STATE_ICON . NO_MATCH }
333332 type = "secondary"
334333 className = "custom-empty-state"
335334 />
0 commit comments