@@ -17,11 +17,10 @@ import {
1717 SplitLayout ,
1818} from '@grafana/scenes' ;
1919import { IconButton , InlineLabel , useStyles2 } from '@grafana/ui' ;
20- import { useResizeObserver } from '@react-aria/utils' ;
2120import { displayError , displaySuccess } from '@shared/domain/displayStatus' ;
2221import { reportInteraction } from '@shared/domain/reportInteraction' ;
2322import { VersionInfoTooltip } from '@shared/ui/VersionInfoTooltip' ;
24- import React , { useRef , useState } from 'react' ;
23+ import React from 'react' ;
2524
2625import { SceneExploreAllServices } from '../../components/SceneExploreAllServices/SceneExploreAllServices' ;
2726import { SceneExploreFavorites } from '../../components/SceneExploreFavorites/SceneExploreFavorites' ;
@@ -45,7 +44,7 @@ import { ScenePanelTypeSwitcher } from '../SceneByVariableRepeaterGrid/component
4544import { SceneQuickFilter } from '../SceneByVariableRepeaterGrid/components/SceneQuickFilter' ;
4645import { GridItemData } from '../SceneByVariableRepeaterGrid/types/GridItemData' ;
4746import { SceneExploreServiceFlameGraph } from '../SceneExploreServiceFlameGraph/SceneExploreServiceFlameGraph' ;
48- import { ExplorationTypeSelector , ExplorationTypeSelectorProps } from './ui/ExplorationTypeSelector' ;
47+ import { ExplorationTypeSelector } from './ui/ExplorationTypeSelector' ;
4948
5049export interface SceneProfilesExplorerState extends Partial < EmbeddedSceneState > {
5150 explorationType ?: ExplorationType ;
@@ -87,6 +86,7 @@ export class SceneProfilesExplorer extends SceneObjectBase<SceneProfilesExplorer
8786 value : ExplorationType . FAVORITES ,
8887 label : 'Favorites' ,
8988 description : 'Overview of favorited visualizations' ,
89+ icon : 'favorite' ,
9090 } ,
9191 ] ;
9292
@@ -300,29 +300,6 @@ export class SceneProfilesExplorer extends SceneObjectBase<SceneProfilesExplorer
300300 } catch { }
301301 } ;
302302
303- useExplorationTypeSelectorLayout = ( ) => {
304- const headerRef = useRef < HTMLDivElement > ( null ) ;
305- const headerLeftRef = useRef < HTMLDivElement > ( null ) ;
306- const headerRightRef = useRef < HTMLDivElement > ( null ) ;
307-
308- const [ layout , setLayout ] = useState < ExplorationTypeSelectorProps [ 'layout' ] > ( 'radio' ) ;
309-
310- const onResize = ( ) => {
311- const currentRight = headerRightRef . current ?. getBoundingClientRect ( ) ;
312- setLayout ( Math . ceil ( currentRight ?. left || 970 ) >= 970 ? 'radio' : 'select' ) ;
313- } ;
314-
315- useResizeObserver ( { ref : headerRef , onResize } ) ;
316- useResizeObserver ( { ref : headerRightRef , onResize } ) ;
317-
318- return {
319- headerRef,
320- headerLeftRef,
321- headerRightRef,
322- layout,
323- } ;
324- } ;
325-
326303 useProfilesExplorer = ( ) => {
327304 const { explorationType, controls, body } = this . useState ( ) ;
328305
@@ -334,25 +311,12 @@ export class SceneProfilesExplorer extends SceneObjectBase<SceneProfilesExplorer
334311 gridControls : Array < SceneObject & { key ?: string } > ;
335312 } ;
336313
337- const {
338- headerRef,
339- headerLeftRef,
340- headerRightRef,
341- layout : explorationTypeSelectorLayout ,
342- } = this . useExplorationTypeSelectorLayout ( ) ;
343-
344314 return {
345315 data : {
346316 explorationType,
347317 dataSourceVariable,
348318 timePickerControl,
349319 refreshPickerControl,
350- headerRefs : {
351- full : headerRef ,
352- left : headerLeftRef ,
353- right : headerRightRef ,
354- } ,
355- explorationTypeSelectorLayout,
356320 sceneVariables,
357321 gridControls,
358322 body,
@@ -373,32 +337,29 @@ export class SceneProfilesExplorer extends SceneObjectBase<SceneProfilesExplorer
373337 dataSourceVariable,
374338 timePickerControl,
375339 refreshPickerControl,
376- headerRefs,
377- explorationTypeSelectorLayout,
378340 sceneVariables,
379341 gridControls,
380342 body,
381343 } = data ;
382344
383345 return (
384346 < >
385- < div ref = { headerRefs . full } className = { styles . header } >
347+ < div className = { styles . header } >
386348 < div className = { styles . controls } >
387- < div ref = { headerRefs . left } className = { styles . headerLeft } >
349+ < div className = { styles . headerLeft } >
388350 < div className = { styles . dataSourceVariable } >
389351 < InlineLabel width = "auto" > { dataSourceVariable . state . label } </ InlineLabel >
390352 < dataSourceVariable . Component model = { dataSourceVariable } />
391353 </ div >
392354
393355 < ExplorationTypeSelector
394- layout = { explorationTypeSelectorLayout }
395356 options = { SceneProfilesExplorer . EXPLORATION_TYPE_OPTIONS }
396357 value = { explorationType as string }
397358 onChange = { actions . onChangeExplorationType }
398359 />
399360 </ div >
400361
401- < div ref = { headerRefs . right } className = { styles . headerRight } >
362+ < div className = { styles . headerRight } >
402363 < timePickerControl . Component key = { timePickerControl . state . key } model = { timePickerControl } />
403364 < refreshPickerControl . Component key = { refreshPickerControl . state . key } model = { refreshPickerControl } />
404365 < IconButton
@@ -447,24 +408,13 @@ const getStyles = (theme: GrafanaTheme2) => ({
447408 display : flex;
448409 gap : ${ theme . spacing ( 1 ) } ;
449410 ` ,
450- dataSourceVariable : css `
451- display : flex;
452- min-width : 160px ;
453- ` ,
454- explorationTypeContainer : css `
455- display : flex;
456- ` ,
457- explorationTypeRadio : css `
458- display : flex;
459- ` ,
460- explorationTypeSelect : css `
461- display : flex;
462- min-width : 180px ;
463- ` ,
464411 headerRight : css `
465412 display : flex;
466413 gap : ${ theme . spacing ( 1 ) } ;
467414 ` ,
415+ dataSourceVariable : css `
416+ display : flex;
417+ ` ,
468418 variable : css `
469419 display : flex;
470420 ` ,
0 commit comments