-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9792adb
commit cc71d01
Showing
2 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
src/components/Explore/TracesByService/Tabs/ServicesTabScene.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
SceneCanvasText, | ||
SceneComponentProps, | ||
SceneFlexItem, | ||
SceneFlexLayout, | ||
SceneObjectBase, | ||
SceneObjectState, | ||
} from '@grafana/scenes'; | ||
|
||
export interface ServicesTabSceneState extends SceneObjectState { | ||
loading?: boolean; | ||
panel?: SceneFlexLayout; | ||
} | ||
|
||
export class ServicesTabScene extends SceneObjectBase<ServicesTabSceneState> { | ||
constructor(state: Partial<ServicesTabSceneState>) { | ||
super({ | ||
...state, | ||
}); | ||
|
||
this.addActivationHandler(this._onActivate.bind(this)); | ||
} | ||
|
||
public _onActivate() { | ||
if (!this.state.panel) { | ||
this.setState({ | ||
panel: this.getVizPanel(), | ||
}); | ||
} | ||
} | ||
|
||
private getVizPanel() { | ||
return new SceneFlexLayout({ | ||
direction: 'row', | ||
children: [ | ||
new SceneFlexItem({ | ||
body: new SceneCanvasText({ | ||
text: 'No content available yet', | ||
fontSize: 20, | ||
align: 'center', | ||
}), | ||
}), | ||
], | ||
}); | ||
} | ||
|
||
public static Component = ({ model }: SceneComponentProps<ServicesTabScene>) => { | ||
const { panel } = model.useState(); | ||
|
||
if (!panel) { | ||
return; | ||
} | ||
|
||
return <panel.Component model={panel} />; | ||
}; | ||
} | ||
|
||
export function buildServicesTabScene() { | ||
return new SceneFlexItem({ | ||
body: new ServicesTabScene({}), | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters