Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { DataSourcePlugin } from '@grafana/data';
import { TestDataDataSource } from './datasource';
import { TestDataQueryCtrl } from './query_ctrl';
import { TestInfoTab } from './TestInfoTab';
import { ConfigEditor } from './ConfigEditor';
class TestDataAnnotationsQueryCtrl {
annotation: any;
constructor() {}
static template = '<h2>Annotation scenario</h2>';
}
export const plugin = new DataSourcePlugin(TestDataDataSource)
.setConfigEditor(ConfigEditor)
.setQueryCtrl(TestDataQueryCtrl)
.setAnnotationQueryCtrl(TestDataAnnotationsQueryCtrl)
.addConfigPage({
title: 'Setup',
icon: 'fa fa-list-alt',
body: TestInfoTab,
id: 'setup',
});
import { DataSourcePlugin } from '@grafana/data';
import { PrometheusDatasource } from './datasource';
import { PromQueryEditor } from './components/PromQueryEditor';
import PromCheatSheet from './components/PromCheatSheet';
import { PromExploreQueryEditor } from './components/PromExploreQueryEditor';
import { ConfigEditor } from './configuration/ConfigEditor';
class PrometheusAnnotationsQueryCtrl {
static templateUrl = 'partials/annotations.editor.html';
}
export const plugin = new DataSourcePlugin(PrometheusDatasource)
.setQueryEditor(PromQueryEditor)
.setConfigEditor(ConfigEditor)
.setExploreMetricsQueryField(PromExploreQueryEditor)
.setAnnotationQueryCtrl(PrometheusAnnotationsQueryCtrl)
.setExploreStartPage(PromCheatSheet);
import { DataSourcePlugin } from '@grafana/data';
import { AzureMonitorQueryCtrl } from './query_ctrl';
import Datasource from './datasource';
import { ConfigEditor } from './components/ConfigEditor';
import { AzureMonitorAnnotationsQueryCtrl } from './annotations_query_ctrl';
import { AzureMonitorQuery, AzureDataSourceJsonData } from './types';
export const plugin = new DataSourcePlugin(Datasource)
.setConfigEditor(ConfigEditor)
.setQueryCtrl(AzureMonitorQueryCtrl)
.setAnnotationQueryCtrl(AzureMonitorAnnotationsQueryCtrl);
import { DataSourcePlugin } from '@grafana/data';
import { DataSource } from './DataSource';
import { ConfigEditor, QueryEditor, MetaInspector } from './components';
import { SheetsQuery, SheetsSourceOptions } from './types';
export const plugin = new DataSourcePlugin(DataSource)
.setConfigEditor(ConfigEditor)
.setQueryEditor(QueryEditor)
.setMetadataInspector(MetaInspector);
onPasswordChange: ReturnType;
constructor() {
this.onPasswordReset = createResetHandler(this, PasswordFieldEnum.Password);
this.onPasswordChange = createChangeHandler(this, PasswordFieldEnum.Password);
this.current.jsonData.httpMode = this.current.jsonData.httpMode || 'GET';
}
httpMode = [{ name: 'GET', value: 'GET' }, { name: 'POST', value: 'POST' }];
}
class InfluxAnnotationsQueryCtrl {
static templateUrl = 'partials/annotations.editor.html';
}
export const plugin = new DataSourcePlugin(InfluxDatasource)
.setConfigCtrl(InfluxConfigCtrl)
.setQueryCtrl(InfluxQueryCtrl)
.setAnnotationQueryCtrl(InfluxAnnotationsQueryCtrl)
.setExploreLogsQueryField(InfluxLogsQueryField)
.setExploreStartPage(InfluxStartPage);
return importPluginModule(meta.module).then(pluginExports => {
if (pluginExports.plugin) {
const dsPlugin = pluginExports.plugin as GenericDataSourcePlugin;
dsPlugin.meta = meta;
return dsPlugin;
}
if (pluginExports.Datasource) {
const dsPlugin = new DataSourcePlugin<
DataSourceApi,
DataQuery,
DataSourceJsonData
>(pluginExports.Datasource);
dsPlugin.setComponentsFromLegacyExports(pluginExports);
dsPlugin.meta = meta;
return dsPlugin;
}
throw new Error('Plugin module is missing DataSourcePlugin or Datasource constructor export');
});
}
import { DataSourcePlugin } from '@grafana/data';
import Datasource from './datasource';
import LokiCheatSheet from './components/LokiCheatSheet';
import LokiQueryField from './components/LokiQueryField';
import LokiQueryEditor from './components/LokiQueryEditor';
import { LokiAnnotationsQueryCtrl } from './LokiAnnotationsQueryCtrl';
import { ConfigEditor } from './configuration/ConfigEditor';
export const plugin = new DataSourcePlugin(Datasource)
.setQueryEditor(LokiQueryEditor)
.setConfigEditor(ConfigEditor)
.setExploreQueryField(LokiQueryField)
.setExploreStartPage(LokiCheatSheet)
.setAnnotationQueryCtrl(LokiAnnotationsQueryCtrl);
import { DataSourcePlugin } from '@grafana/data';
import { DataSource } from './DataSource';
import { ConfigEditor } from './ConfigEditor';
import { QueryEditor } from './QueryEditor';
import { SQLiteQuery, MyDataSourceOptions } from './types';
export const plugin = new DataSourcePlugin(DataSource)
.setConfigEditor(ConfigEditor)
.setQueryEditor(QueryEditor);
import OpenTsDatasource from './datasource';
import { OpenTsQueryCtrl } from './query_ctrl';
import { DataSourcePlugin } from '@grafana/data';
import { ConfigEditor } from './components/ConfigEditor';
class AnnotationsQueryCtrl {
static templateUrl = 'partials/annotations.editor.html';
}
export const plugin = new DataSourcePlugin(OpenTsDatasource)
.setQueryCtrl(OpenTsQueryCtrl)
.setConfigEditor(ConfigEditor)
.setAnnotationQueryCtrl(AnnotationsQueryCtrl);
import { DataSourcePlugin } from '@grafana/data';
import { ANNOTATION_QUERY_STEP_DEFAULT, PrometheusDatasource } from './datasource';
import { PromQueryEditor } from './components/PromQueryEditor';
import PromCheatSheet from './components/PromCheatSheet';
import PromExploreQueryEditor from './components/PromExploreQueryEditor';
import { ConfigEditor } from './configuration/ConfigEditor';
class PrometheusAnnotationsQueryCtrl {
static templateUrl = 'partials/annotations.editor.html';
stepDefaultValuePlaceholder = ANNOTATION_QUERY_STEP_DEFAULT;
}
export const plugin = new DataSourcePlugin(PrometheusDatasource)
.setQueryEditor(PromQueryEditor)
.setConfigEditor(ConfigEditor)
.setExploreMetricsQueryField(PromExploreQueryEditor)
.setAnnotationQueryCtrl(PrometheusAnnotationsQueryCtrl)
.setExploreStartPage(PromCheatSheet);