Forráskód Böngészése

Moved plugin types to @grafana/ui

Torkel Ödegaard 7 éve
szülő
commit
4fc9d794ca

+ 51 - 0
packages/grafana-ui/src/types/plugin.ts

@@ -18,3 +18,54 @@ export interface PluginExports {
   PanelDefaults?: any;
 }
 
+export interface PluginMeta {
+  id: string;
+  name: string;
+  info: PluginMetaInfo;
+  includes: PluginInclude[];
+
+  // Datasource-specific
+  metrics?: boolean;
+  tables?: boolean;
+  logs?: boolean;
+  explore?: boolean;
+  annotations?: boolean;
+  mixed?: boolean;
+  hasQueryHelp?: boolean;
+  queryOptions?: PluginMetaQueryOptions;
+}
+
+interface PluginMetaQueryOptions {
+  cacheTimeout?: boolean;
+  maxDataPoints?: boolean;
+  minInterval?: boolean;
+}
+
+export interface PluginInclude {
+  type: string;
+  name: string;
+  path: string;
+}
+
+interface PluginMetaInfoLink {
+  name: string;
+  url: string;
+}
+
+export interface PluginMetaInfo {
+  author: {
+    name: string;
+    url?: string;
+  };
+  description: string;
+  links: PluginMetaInfoLink[];
+  logos: {
+    large: string;
+    small: string;
+  };
+  screenshots: any[];
+  updated: string;
+  version: string;
+}
+
+

+ 2 - 1
public/app/features/datasources/state/navModel.ts

@@ -1,4 +1,5 @@
-import { DataSource, NavModel, NavModelItem, PluginMeta } from 'app/types';
+import { DataSource, NavModel, NavModelItem } from 'app/types';
+import { PluginMeta } from '@grafana/ui/src/types';
 import config from 'app/core/config';
 
 export function buildNavModel(dataSource: DataSource, pluginMeta: PluginMeta): NavModelItem {

+ 2 - 1
public/app/features/plugins/state/navModel.ts

@@ -1,5 +1,6 @@
 import _ from 'lodash';
-import { DataSource, PluginMeta, NavModel } from 'app/types';
+import { DataSource, NavModel } from 'app/types';
+import { PluginMeta } from '@grafana/ui/src/types';
 import config from 'app/core/config';
 
 export function buildNavModel(ds: DataSource, plugin: PluginMeta, currentPage: string): NavModel {

+ 2 - 1
public/app/plugins/datasource/loki/datasource.ts

@@ -2,7 +2,8 @@ import _ from 'lodash';
 
 import * as dateMath from 'app/core/utils/datemath';
 import { LogsStream, LogsModel, makeSeriesForLogs } from 'app/core/logs_model';
-import { PluginMeta, DataQuery } from 'app/types';
+import { DataQuery } from 'app/types';
+import { PluginMeta } from '@grafana/ui/src/types';
 import { addLabelToSelector } from 'app/plugins/datasource/prometheus/add_label_to_query';
 
 import LanguageProvider from './language_provider';

+ 12 - 0
public/app/plugins/datasource/testdata/QueryEditor.tsx

@@ -0,0 +1,12 @@
+import React, { PureComponent } from 'react';
+
+interface Props {
+}
+
+export class QueryEditor extends PureComponent<Props> {
+  render() {
+    return (
+      <h2>Test data</h2>
+    );
+  }
+}

+ 2 - 2
public/app/types/datasources.ts

@@ -1,6 +1,6 @@
 import { LayoutMode } from '../core/components/LayoutSelector/LayoutSelector';
-import { Plugin, PluginMeta } from './plugins';
-import { PluginExports } from '@grafana/ui';
+import { Plugin } from './plugins';
+import { PluginExports, PluginMeta } from '@grafana/ui/src/types';
 
 export interface DataSource {
   id: number;

+ 1 - 51
public/app/types/plugins.ts

@@ -1,4 +1,4 @@
-import { PluginExports } from '@grafana/ui/src/types';
+import { PluginExports, PluginMetaInfo } from '@grafana/ui/src/types';
 
 export interface PanelPlugin {
   id: string;
@@ -11,56 +11,6 @@ export interface PanelPlugin {
   exports?: PluginExports;
 }
 
-interface PluginMetaQueryOptions {
-  cacheTimeout?: boolean;
-  maxDataPoints?: boolean;
-  minInterval?: boolean;
-}
-
-export interface PluginMeta {
-  id: string;
-  name: string;
-  info: PluginMetaInfo;
-  includes: PluginInclude[];
-
-  // Datasource-specific
-  metrics?: boolean;
-  tables?: boolean;
-  logs?: boolean;
-  explore?: boolean;
-  annotations?: boolean;
-  mixed?: boolean;
-  hasQueryHelp?: boolean;
-  queryOptions?: PluginMetaQueryOptions;
-}
-
-export interface PluginInclude {
-  type: string;
-  name: string;
-  path: string;
-}
-
-interface PluginMetaInfoLink {
-  name: string;
-  url: string;
-}
-
-export interface PluginMetaInfo {
-  author: {
-    name: string;
-    url?: string;
-  };
-  description: string;
-  links: PluginMetaInfoLink[];
-  logos: {
-    large: string;
-    small: string;
-  };
-  screenshots: any[];
-  updated: string;
-  version: string;
-}
-
 export interface Plugin {
   defaultNavUrl: string;
   enabled: boolean;

+ 1 - 2
public/app/types/series.ts

@@ -1,5 +1,4 @@
-import { PluginMeta } from './plugins';
-import { TimeSeries, TimeRange, RawTimeRange, PluginExports } from '@grafana/ui';
+import { TimeSeries, TimeRange, RawTimeRange, PluginExports, PluginMeta } from '@grafana/ui/src/types';
 
 export interface DataQueryResponse {
   data: TimeSeries[];