@@ -25,12 +25,19 @@ import { ConcordId } from '../../../api/common';
2525import { isFinal , ProcessStatus } from '../../../api/process' ;
2626
2727import './styles.css' ;
28- import { listLogSegments as apiListLogSegments , LogSegmentEntry } from '../../../api/process/log' ;
28+ import { listLogSegments as apiListLogSegments , LogSegmentEntry , SegmentStatus } from '../../../api/process/log' ;
2929import { usePolling } from '../../../api/usePolling' ;
3030import { RequestErrorActivity } from '../../organisms' ;
3131import LogSegmentActivity from './LogSegmentActivity' ;
3232import { FormWizardAction , ProcessToolbar } from '../../molecules' ;
33- import { Button , Divider , Popup , Radio } from 'semantic-ui-react' ;
33+ import {
34+ Button ,
35+ Divider ,
36+ Dropdown ,
37+ DropdownProps ,
38+ Popup ,
39+ Radio ,
40+ } from 'semantic-ui-react' ;
3441import { LogProcessorOptions } from '../../../state/data/processes/logs/processors' ;
3542import { Route } from 'react-router' ;
3643import { FormListEntry , list as apiListForms } from '../../../api/process/form' ;
@@ -47,6 +54,38 @@ const DEFAULT_OPTS: LogOptions = {
4754 segmentOptions : DEFAULT_SEGMENT_OPTS
4855} ;
4956
57+ const LOG_SEGMENT_STATUS_OPTS = [
58+ {
59+ key : 'ALL' ,
60+ text : 'All logs' ,
61+ value : 'ALL' ,
62+ } ,
63+ {
64+ key : SegmentStatus . OK ,
65+ text : SegmentStatus . OK ,
66+ value : SegmentStatus . OK ,
67+ icon : { name : 'circle' , color : 'green' } ,
68+ } ,
69+ {
70+ key : SegmentStatus . FAILED ,
71+ text : SegmentStatus . FAILED ,
72+ value : SegmentStatus . FAILED ,
73+ icon : { name : 'close' , color : 'red' } ,
74+ } ,
75+ {
76+ key : SegmentStatus . RUNNING ,
77+ text : SegmentStatus . RUNNING ,
78+ value : SegmentStatus . RUNNING ,
79+ icon : { name : 'spinner' , color : 'teal' } ,
80+ } ,
81+ {
82+ key : SegmentStatus . SUSPENDED ,
83+ text : SegmentStatus . SUSPENDED ,
84+ value : SegmentStatus . SUSPENDED ,
85+ icon : { name : 'hourglass half' , color : 'blue' } ,
86+ } ,
87+ ]
88+
5089interface LogOptions {
5190 expandAllSegments : boolean ;
5291 showSystemSegment : boolean ;
@@ -72,6 +111,12 @@ const ProcessLogActivityV2 = ({
72111 const [ logOpts , setLogOptions ] = useState < LogOptions > ( getStoredOpts ( ) ) ;
73112 const [ forms , setForms ] = useState < FormListEntry [ ] > ( [ ] ) ;
74113
114+ const [ logSegmentStatusFilter , setLogSegmentStatusFilter ] = useState < string > ( LOG_SEGMENT_STATUS_OPTS [ 0 ] . value ) ;
115+
116+ const handleLogSegmentStatusFilterChange = useCallback ( ( e : React . SyntheticEvent < HTMLElement > , data : DropdownProps ) => {
117+ setLogSegmentStatusFilter ( data . value as string ) ;
118+ } , [ ] ) ;
119+
75120 const segmentOptsHandler = useCallback ( ( o : LogProcessorOptions ) => {
76121 setLogOptions ( ( prev ) => {
77122 return { ...prev , segmentOptions : o } ;
@@ -119,6 +164,20 @@ const ProcessLogActivityV2 = ({
119164 return (
120165 < >
121166 < ProcessToolbar >
167+ < Dropdown
168+ icon = 'filter'
169+ labeled = { true }
170+ button = { true }
171+ basic = { true }
172+ className = 'icon'
173+ style = { { marginRight : 20 , width : 160 } }
174+ options = { LOG_SEGMENT_STATUS_OPTS }
175+ onChange = { handleLogSegmentStatusFilterChange }
176+ value = { logSegmentStatusFilter }
177+ />
178+
179+ < div style = { { flexGrow : 1 } } />
180+
122181 { forms . length > 0 && processStatus === ProcessStatus . SUSPENDED && (
123182 < div style = { { marginRight : 20 } } >
124183 < Route
@@ -213,6 +272,9 @@ const ProcessLogActivityV2 = ({
213272 ( value ) =>
214273 logOpts . showSystemSegment || ( ! logOpts . showSystemSegment && value . id !== 0 )
215274 )
275+ . filter (
276+ ( value ) => logSegmentStatusFilter === 'ALL' || value . status === undefined || logSegmentStatusFilter === value . status
277+ )
216278 . map ( ( s ) => {
217279 return (
218280 < LogSegmentActivity
0 commit comments