Closed vanimesh closed 1 week ago
hi @mikhail-vl , how are you doing? I wanted to display a alert to the user if the start date is selected with old date. So i am trying to use the panel with "Javascript code aftrer content Ready" and passing the below script just to test the event "time-range-updated" it works but strangely it produces multiple alerts. Can you please help ? Below is the code
const subscription = context.grafana.eventBus.subscribe(
{ type: "time-range-updated" },
() => {
console.log("time-range-updated");
alert("Start datetime cannot be older than Present-5Minutes panel 1");
}
);
@vanimesh You need to add unsubscribe
as described in documentation after to avoid multiple subscriptions:
Hi @mikhail-vl , i tried to unsubscribe but still it doesnt seem to work. Below is the code `const subscription = context.grafana.eventBus.subscribe( { type: "time-range-updated" }, () => { console.log("React to Data Hover"); alert("popup") } );
return () => { subscription.unsubscribe(); console.log("Unsubscribed"); };`
Hi everyone,
I need help, where i am trying to build a date time picker with the help of this link. But somehow i am not able to follow complete steps. My requirement is to notify a user with message if the user selects the time in past like yesterday . So below are my questions
`