After upgrading to Grafana 7.1.0 from Grafna 7.0.6, the script in Text panel stopped working.
Configuration in custom.ini
[panels]
enable_alpha = true
disable_sanitize_html = true
Here is what I have in Text Panel
<div style="width: 100%; font-size: 22px; font-weight: 500; text-align: right;" id="time_range_info"></div>
<div style="width: 100%; font-size: 100%; text-align: right;" id="time_range_text"></div>
<script>
function getDashboardTimeRange(){
var dateFormat = "ll";
var tr = angular.element('grafana-app').injector().get('timeSrv').timeRange();
return ["<img src='/public/stealth/calendar.png'/> ", tr.from.format(dateFormat), ' - ', tr.to.format(dateFormat)].join('');
}
function textFill(){
$('#time_range_info').html(getDashboardTimeRange());
$('#time_range_text').html($("button[aria-label='TimePicker Open Button'] > span.css-1cvxpvr > span").html());
}
angular.element('grafana-app').injector().get('dashboardSrv').getCurrent().events.on('refresh', function () {textFill()});
textFill();
</script>