Build Grafana dashboards directly in your Grafana app plugins.
APACHE-2.0 License
Bot releases are visible (Hide)
Published by grafanabot over 1 year ago
You can now use multiple time zones in Scene. SceneTimeRange
and SceneTimePicker
respect time zone settings. Additionally, a new object was added, SceneTimeZoneOverride
. It can be used to override the time zone provided by a time range object higher in the scene hierarchy. Objects within SceneTimeZoneOverride
scope will use the closest SceneTimeRange
range, but a locally specified time zone.
Example:
const scene = new EmbeddedScene({
$timeRange: new SceneTimeRange({ from: 'now-6h', to: 'now', timeZone: 'browser'}),
children: [
// Will use global time range and time zone
new VizPanel({
$data: new SceneQueryRunner({ ... }),
...
}),
// Will use global time range and locally specified time zone
new VizPanel({
$timeRange: new SceneTimeZoneOverride({ timeZone: 'America/New_York' }),
$data: new SceneQueryRunner({ ... }),
...
}),
],
...
})
@grafana/scenes
Published by grafanabot over 1 year ago
@grafana/scenes
Published by grafanabot over 1 year ago
You can now augment any scene object with runtime state & behavior using the new $behaviors
state key. Behaviors are implemented as SceneObjects that are activated when their parent is activated or as pure functions that get called when the SceneObject they are attached to get's activated.
With behaviors you can easily implement conditional display of panels using the new isHidden
property on SceneFlexItem. and other dynamic layout behaviors. View the behaviors demo for some examples.
@grafana/scenes
@grafana/scenes
Published by grafanabot over 1 year ago
SceneObjectStatePlain
is now named SceneObjectState
. So if you have custom scene objects that extends SceneObjectStatePlain
just do a search and replace for SceneObjectStatePlain
and replace withSceneObjectState
.
@grafana/scenes
@grafana/scenes
main
@grafana/scenes
Published by grafanabot over 1 year ago
The interface of SceneFlexLayout
and SceneGridLayout
has changed. These scene objects now accept only dedicated layout item objects as children:
SceneFlexItem
for SceneFlexLayout
SceneGridItem
and SceneGridRow
for SceneGridLayout
placement
property has been replaced by those layout-specific objects.
Example
// BEFORE
const layout = new SceneFlexLayout({
direction: 'column',
children: [
new VizPanel({
placement: {
width: '50%',
height: '400',
},
...
})
],
...
})
// AFTER
const layout = new SceneFlexLayout({
direction: 'column',
children: [
new SceneFlexItem({
width: '50%',
height: '400',
body: new VizPanel({ ... }),
}),
],
...
})
@grafana/scenes
Published by grafanabot over 1 year ago
The SceneObjectUrlSyncHandler interface has changed. The function getUrlState
no longer takes state as parameter. The implementation needs to use the current scene object state instead.
Published by grafanabot over 1 year ago
@grafana/scenes
Published by torkelo over 1 year ago
SceneObject subscribeToState parameter change
Signature change. Now the parameter to this function expects a simple function that takes two args (newState, prevState).
Before:
this._subs.add(
sourceData.subscribeToState({
next: (state) => this.transform(state.data),
})
);
Becomes:
this._subs.add(sourceData.subscribeToState((state) => this.transform(state.data)));
addActivationHandler
SceneObject now has a new function called addActivationHandler that makes it much easier to add external behaviors to core scene componenents. The
activation handler (callback) can return a deactivation handler. This works very similar to useEffect.
For custom components that used to override activate and then call super.activate() we now recommend that you instead use addActivationHandler from
the constructor. See https://github.com/grafana/scenes/pull/77 for some examples.
VizPanelMenu
A new scene object to enable panel menu for VizPanel
.
Example usage:
const menu = new VizPanelMenu({});
// Configure menu items
menu.addActivationHandler(() => {
menu.setItems(menuItems);
});
// Attach menu to VizPanel
const panelWithMenu = new VizPanel({
title: 'Panel with menu',
menu,
// ... VizPanel configuration
});