support grafana 9.4.0+ #17

Merged
rozetko merged 3 commits from api-tokens-for-non-original-organizations into master 2 years ago
  1. 6
      src/panels/corpglory-dataexporter-panel/components/Panel.tsx

6
src/panels/corpglory-dataexporter-panel/components/Panel.tsx

@ -55,6 +55,7 @@ import { RefreshEvent } from '@grafana/runtime';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import * as _ from 'lodash'; import * as _ from 'lodash';
import PluginState from 'plugin_state';
const PANEL_ID = 'corpglory-dataexporter-panel'; const PANEL_ID = 'corpglory-dataexporter-panel';
const APP_ID = 'corpglory-dataexporter-app'; const APP_ID = 'corpglory-dataexporter-app';
@ -215,6 +216,7 @@ export function Panel({ width, height, timeRange, eventBus, timeZone }: Props) {
queries: selectedQueries, queries: selectedQueries,
csvDelimiter, csvDelimiter,
}; };
const token = await PluginState.createGrafanaToken();
// TODO: move this function to API Service // TODO: move this function to API Service
await queryApi('/task', { await queryApi('/task', {
method: 'POST', method: 'POST',
@ -222,6 +224,7 @@ export function Panel({ width, height, timeRange, eventBus, timeZone }: Props) {
task, task,
url: window.location.toString(), url: window.location.toString(),
timeZoneName, timeZoneName,
apiKey: token.key,
}, },
}); });
@ -261,6 +264,7 @@ export function Panel({ width, height, timeRange, eventBus, timeZone }: Props) {
custom: { custom: {
filterable: false, filterable: false,
displayMode: 'image', displayMode: 'image',
cellOptions: { type: 'image' },
}, },
links: [ links: [
{ {
@ -330,6 +334,7 @@ export function Panel({ width, height, timeRange, eventBus, timeZone }: Props) {
custom: { custom: {
filterable: false, filterable: false,
displayMode: 'image', displayMode: 'image',
cellOptions: { type: 'image' },
}, },
links: [ links: [
{ {
@ -394,6 +399,7 @@ export function Panel({ width, height, timeRange, eventBus, timeZone }: Props) {
custom: { custom: {
filterable: false, filterable: false,
displayMode: 'image', displayMode: 'image',
cellOptions: { type: 'image' },
}, },
links: [ links: [
{ {

Loading…
Cancel
Save