Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- // Get data like panel table (get your data from the query editor)
- var requestData = {
- "url": "api/datasources/proxy/1/query",
- "data": {
- "timezone": "browser",
- "panelId": 10,
- "dashboardId": 5,
- "range": {
- "from": 1538697600000,
- "to": 1553507193501,
- "raw": {
- "from": "2018-10-05T00:00:00.000Z",
- "to": "now"
- }
- },
- "rangeRaw": {
- "from": "2018-10-05T00:00:00.000Z",
- "to": "now"
- },
- "interval": "1d",
- "intervalMs": 86400000,
- "targets": [
- {
- "refId": "A",
- "type": "timeserie",
- "measurement": "data",
- "field": {
- "name": "PYCycComp_NDOO_Cycle02",
- "tag": null
- }
- },
- {
- "refId": "B",
- "type": "timeserie",
- "measurement": "data",
- "field": {
- "name": "Sup1_Par1_WAIT_Norm_OV",
- "tag": null
- }
- }
- ],
- "maxDataPoints": 80,
- "scopedVars": {
- "__interval": {
- "text": "1d",
- "value": "1d"
- },
- "__interval_ms": {
- "text": 86400000,
- "value": 86400000
- }
- },
- "adhocFilters": [],
- "source": "processdb_5",
- "orgId": 1,
- "conversionOptions": {}
- }
- }
- requestData.url = window.location.origin + '/' + requestData.url;
- var url_string = window.location.href;
- var url = new URL(url_string);
- requestData.data.orgId = url.searchParams.get("orgId");
- // requestData.data.source = processdb_X; // In case you need to change it
- refreshGeoMap();
- angular.element('grafana-app').injector().get('timeSrv').$rootScope.$on('refresh', function(event, data) { refreshGeoMap(); });
- function refreshGeoMap( )
- {
- var timeRange = angular.element('grafana-app').injector().get('timeSrv').timeRange();
- requestData.data.range = {from: timeRange.from.valueOf(), to: timeRange.to.valueOf()};
- console.log(requestData.data.range);
- requestData.data.rangeRaw = requestData.data.range.raw;
- }
- console.log(requestData);
- $.ajax({
- method: "POST",
- url: requestData.url,
- data: JSON.stringify(requestData.data),
- dataType: "json",
- contentType: "application/json",
- success: function(res){
- console.log(res);
- }
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement