@@ -13,21 +13,18 @@ import styled from '@emotion/styled';
1313import { openModal } from 'app/actionCreators/modal' ;
1414import GuideAnchor from 'app/components/assistant/guideAnchor' ;
1515import Button from 'app/components/button' ;
16- import EmptyStateWarning from 'app/components/emptyStateWarning' ;
1716import EventDataSection from 'app/components/events/eventDataSection' ;
1817import { getImageRange , parseAddress } from 'app/components/events/interfaces/utils' ;
1918import { PanelTable } from 'app/components/panels' ;
2019import QuestionTooltip from 'app/components/questionTooltip' ;
2120import SearchBar from 'app/components/searchBar' ;
22- import { IconSearch } from 'app/icons/iconSearch' ;
2321import { t } from 'app/locale' ;
2422import DebugMetaStore , { DebugMetaActions } from 'app/stores/debugMetaStore' ;
2523import overflowEllipsis from 'app/styles/overflowEllipsis' ;
2624import space from 'app/styles/space' ;
2725import { Organization , Project } from 'app/types' ;
2826import { Image , ImageStatus } from 'app/types/debugImage' ;
2927import { Event } from 'app/types/event' ;
30- import EmptyMessage from 'app/views/settings/components/emptyMessage' ;
3128
3229import Status from './debugImage/status' ;
3330import DebugImage from './debugImage' ;
@@ -294,7 +291,10 @@ class DebugMeta extends React.PureComponent<Props, State> {
294291 this . setState ( {
295292 filteredImages,
296293 filterOptions,
297- filteredImagesByFilter : filteredImages ,
294+ filteredImagesByFilter : this . getFilteredImagesByFilter (
295+ filteredImages ,
296+ filterOptions
297+ ) ,
298298 filteredImagesBySearch : filteredImages ,
299299 } ) ;
300300 }
@@ -303,7 +303,7 @@ class DebugMeta extends React.PureComponent<Props, State> {
303303 return [ ...new Set ( images . map ( image => image . status ) ) ] . map ( status => ( {
304304 id : status ,
305305 symbol : < Status status = { status } /> ,
306- isChecked : false ,
306+ isChecked : status !== ImageStatus . UNUSED ,
307307 } ) ) ;
308308 }
309309
@@ -435,48 +435,40 @@ class DebugMeta extends React.PureComponent<Props, State> {
435435 ) ;
436436 }
437437
438- renderContent ( ) {
438+ getEmptyMessage ( ) {
439439 const { searchTerm, filteredImagesByFilter : images , filterOptions} = this . state ;
440440
441- if ( searchTerm && ! images . length ) {
442- const hasActiveFilter = filterOptions . find ( filterOption => filterOption . isChecked ) ;
443- return (
444- < EmptyMessage
445- icon = { < IconSearch size = "xl" /> }
446- action = {
447- hasActiveFilter ? (
448- < Button onClick = { this . handleResetFilter } priority = "primary" >
449- { t ( 'Reset Filter' ) }
450- </ Button >
451- ) : (
452- < Button onClick = { this . handleResetSearchBar } priority = "primary" >
453- { t ( 'Clear Search Bar' ) }
454- </ Button >
455- )
456- }
457- >
458- { t ( 'Sorry, no images match your search query.' ) }
459- </ EmptyMessage >
460- ) ;
441+ if ( ! ! images . length ) {
442+ return null ;
461443 }
462444
463- if ( ! images . length ) {
445+ if ( searchTerm && ! images . length ) {
446+ const hasActiveFilter = filterOptions . find ( filterOption => filterOption . isChecked ) ;
464447 return (
465- < EmptyStateWarning >
466- < p > { t ( 'There are no images to be displayed' ) } </ p >
467- </ EmptyStateWarning >
448+ < React . Fragment >
449+ < p > { t ( 'Sorry, no images match your search query' ) } </ p >
450+ { hasActiveFilter ? (
451+ < Button onClick = { this . handleResetFilter } priority = "primary" >
452+ { t ( 'Reset filter' ) }
453+ </ Button >
454+ ) : (
455+ < Button onClick = { this . handleResetSearchBar } priority = "primary" >
456+ { t ( 'Clear search bar' ) }
457+ </ Button >
458+ ) }
459+ </ React . Fragment >
468460 ) ;
469461 }
470462
471- return < div ref = { this . panelTableRef } > { this . renderList ( ) } </ div > ;
463+ return t ( 'There are no images to be displayed' ) ;
472464 }
473465
474466 render ( ) {
475467 const {
476468 searchTerm,
477469 filterOptions,
478- filteredImagesByFilter : images ,
479470 scrollbarWidth,
471+ filteredImagesByFilter : images ,
480472 } = this . state ;
481473
482474 return (
@@ -510,12 +502,12 @@ class DebugMeta extends React.PureComponent<Props, State> {
510502 isCentered
511503 >
512504 < StyledPanelTable
505+ isEmpty = { ! images . length }
513506 scrollbarWidth = { scrollbarWidth }
514507 headers = { [ t ( 'Status' ) , t ( 'Image' ) , t ( 'Processing' ) , t ( 'Details' ) , '' ] }
515- isEmpty = { ! images . length }
516- emptyMessage = { t ( 'There are no images to display' ) }
508+ emptyMessage = { this . getEmptyMessage ( ) }
517509 >
518- { this . renderContent ( ) }
510+ < div ref = { this . panelTableRef } > { this . renderList ( ) } </ div >
519511 </ StyledPanelTable >
520512 </ StyledEventDataSection >
521513 ) ;
@@ -551,13 +543,15 @@ const StyledPanelTable = styled(PanelTable)<{scrollbarWidth?: number}>`
551543 }
552544 }
553545
554- ${ p =>
555- ! p . isEmpty &&
556- `:nth-child(n + 6) {
557- display: grid;
558- grid-column: 1/-1;
559- padding: 0;
560- }` }
546+ :nth-child(n + 6) {
547+ grid-column: 1/-1;
548+ ${ p =>
549+ ! p . isEmpty &&
550+ `
551+ display: grid;
552+ padding: 0;
553+ ` }
554+ }
561555 }
562556
563557 ${ p => layout ( p . theme , p . scrollbarWidth ) }
0 commit comments