@@ -105,13 +105,15 @@ export const ReactTimeSeriesWithoutContext = ({
105105
106106 const durationGroups = useMemo ( ( ) => {
107107 if ( ! annotation ?. durations )
108- return [
109- {
110- color : "#888888" ,
111- misc : true ,
112- durations : [ ] ,
113- } ,
114- ]
108+ return ! enabledTools . includes ( "create-durations" )
109+ ? [ ]
110+ : [
111+ {
112+ color : "#888888" ,
113+ misc : true ,
114+ durations : [ ] ,
115+ } ,
116+ ]
115117
116118 const availableLabels = Array . from (
117119 new Set (
@@ -138,15 +140,18 @@ export const ReactTimeSeriesWithoutContext = ({
138140 } )
139141 . filter ( ( dg ) => dg . durations . length > 0 )
140142
141- durationGroups . push ( {
142- color : "#888888" ,
143- misc : true ,
144- durations : durationGroups
145- . filter ( ( dg ) => dg . durations . length === 1 )
146- . flatMap ( ( dg ) => dg . durations )
147- . concat ( annotation . durations . filter ( ( d ) => ! d . label ) )
148- . map ( ( d ) => ( { ...d , color : getRandomColorUsingHash ( d . label ) } ) ) ,
149- } )
143+ if ( enabledTools . includes ( "create-durations" ) ) {
144+ durationGroups . push ( {
145+ color : "#888888" ,
146+ misc : true ,
147+ durations : durationGroups
148+ . filter ( ( dg ) => dg . durations . length === 1 )
149+ . flatMap ( ( dg ) => dg . durations )
150+ . concat ( annotation . durations . filter ( ( d ) => ! d . label ) )
151+ . map ( ( d ) => ( { ...d , color : getRandomColorUsingHash ( d . label ) } ) ) ,
152+ } )
153+ }
154+
150155 durationGroups = durationGroups . filter (
151156 ( dg ) => dg . misc || dg . durations . length > 1
152157 )
@@ -155,6 +160,8 @@ export const ReactTimeSeriesWithoutContext = ({
155160 // eslint-disable-next-line
156161 } , [ annotation ?. durations ] )
157162
163+ console . log ( { durationGroups } )
164+
158165 const onChangeDurationGroups = useEventCallback ( ( newDurationGroups ) => {
159166 onModifySample (
160167 setIn (
0 commit comments