Skip to content

Commit

Permalink
Merge remote-tracking branch 'grafana/master' into react-app-pages
Browse files Browse the repository at this point in the history
* grafana/master:
  Plugins: rename vizPlugin to panelPlugin (grafana#16802)
  Plugins: move app/feature/plugin properties into PluginMeta (grafana#16809)
  Plugins: move PanelPluginMeta to grafana/ui (grafana#16804)
  Plugins: move datasource specific meta out of the main meta type (grafana#16803)
  updates changelog for 6.1.6
  Fix: Fetch histogram series from other api route (grafana#16768)
  phantomjs: set web-security to true
  Chore: Lowered implicit anys limit to 5668
  • Loading branch information
ryantxu committed Apr 29, 2019
2 parents 5f63e3a + 7dbe719 commit 35e5efc
Show file tree
Hide file tree
Showing 41 changed files with 210 additions and 194 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# 6.2.0 (unreleased)

# 6.1.6 (2019-04-29)
### Features / Enhancements
* **Security**: Bump jQuery to 3.4.0 . [#16761](https://github.com/grafana/grafana/pull/16761), [@dprokop](https://github.com/dprokop)

### Bug Fixes
* **Playlist**: Fix loading dashboards by tag. [#16727](https://github.com/grafana/grafana/pull/16727), [@marefr](https://github.com/marefr)

# 6.1.5 (2019-04-29)

* **Security**: Urgent security patch release. Please read more in our [blog](https://grafana.com/blog/2019/04/29/grafana-5.4.4-and-6.1.6-released-with-important-security-fix/)

# 6.1.4 (2019-04-16)

### Bug Fixes
Expand Down
4 changes: 2 additions & 2 deletions latest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"stable": "6.1.3",
"testing": "6.1.3"
"stable": "6.1.6",
"testing": "6.1.6"
}
28 changes: 25 additions & 3 deletions packages/grafana-ui/src/types/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,24 @@ export class DataSourcePlugin<TOptions = {}, TQuery extends DataQuery = DataQuer
}
}

export interface DataSourcePluginMeta extends PluginMeta {
builtIn?: boolean; // Is this for all
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 DataSourcePluginComponents<TOptions = {}, TQuery extends DataQuery = DataQuery> {
QueryCtrl?: any;
AnnotationsQueryCtrl?: any;
Expand Down Expand Up @@ -133,7 +151,11 @@ export interface DataSourceApi<TQuery extends DataQuery = DataQuery> {
* we attach the components to this instance for easy access
*/
components?: DataSourcePluginComponents;
meta?: PluginMeta;

/**
* static information about the datasource
*/
meta?: DataSourcePluginMeta;
}

export interface ExploreDataSourceApi<TQuery extends DataQuery = DataQuery> extends DataSourceApi {
Expand Down Expand Up @@ -336,7 +358,7 @@ export interface DataSourceInstanceSettings {
id: number;
type: string;
name: string;
meta: PluginMeta;
meta: DataSourcePluginMeta;
url?: string;
jsonData: { [str: string]: any };
username?: string;
Expand All @@ -355,6 +377,6 @@ export interface DataSourceInstanceSettings {
export interface DataSourceSelectItem {
name: string;
value: string | null;
meta: PluginMeta;
meta: DataSourcePluginMeta;
sort: string;
}
19 changes: 19 additions & 0 deletions packages/grafana-ui/src/types/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,28 @@ import { ComponentClass, ComponentType } from 'react';
import { LoadingState, SeriesData } from './data';
import { TimeRange } from './time';
import { ScopedVars, DataQueryRequest, DataQueryError, LegacyResponseData } from './datasource';
import { PluginMeta } from './plugin';

export type InterpolateFunction = (value: string, scopedVars?: ScopedVars, format?: string | Function) => string;

export interface PanelPluginMeta extends PluginMeta {
hideFromList?: boolean;
sort: number;
angularPlugin: AngularPanelPlugin | null;
panelPlugin: PanelPlugin | null;
hasBeenImported?: boolean;

// if length>0 the query tab will show up
// Before 6.2 this could be table and/or series, but 6.2+ supports both transparently
// so it will be deprecated soon
dataFormats?: PanelDataFormat[];
}

export enum PanelDataFormat {
Table = 'table',
TimeSeries = 'time_series',
}

export interface PanelData {
state: LoadingState;
series: SeriesData[];
Expand Down
21 changes: 4 additions & 17 deletions packages/grafana-ui/src/types/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,10 @@ export interface PluginMeta {
// Filled in by the backend
jsonData?: { [str: string]: any };
enabled?: boolean;

// Datasource-specific
builtIn?: boolean;
metrics?: boolean;
tables?: boolean;
logs?: boolean;
explore?: boolean;
annotations?: boolean;
mixed?: boolean;
hasQueryHelp?: boolean;
queryOptions?: PluginMetaQueryOptions;
}

interface PluginMetaQueryOptions {
cacheTimeout?: boolean;
maxDataPoints?: boolean;
minInterval?: boolean;
defaultNavUrl?: string;
hasUpdate?: boolean;
latestVersion?: string;
pinned?: boolean;
}

export enum PluginIncludeType {
Expand Down
3 changes: 2 additions & 1 deletion pkg/services/rendering/phantomjs.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ func (rs *RenderingService) renderViaPhantomJS(ctx context.Context, opts Opts) (

cmdArgs := []string{
"--ignore-ssl-errors=true",
"--web-security=false",
"--web-security=true",
"--local-url-access=false",
phantomDebugArg,
scriptPath,
fmt.Sprintf("url=%v", url),
Expand Down
3 changes: 1 addition & 2 deletions public/app/core/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import _ from 'lodash';
import { PanelPluginMeta } from 'app/types/plugins';
import { GrafanaTheme, getTheme, GrafanaThemeType, DataSourceInstanceSettings } from '@grafana/ui';
import { GrafanaTheme, getTheme, GrafanaThemeType, PanelPluginMeta, DataSourceInstanceSettings } from '@grafana/ui';

export interface BuildInfo {
version: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import config from 'app/core/config';
import { DashboardExporter } from './DashboardExporter';
import { DashboardModel } from '../../state/DashboardModel';
import { DatasourceSrv } from 'app/features/plugins/datasource_srv';
import { PanelPluginMeta } from 'app/types';
import { PanelPluginMeta } from '@grafana/ui';

describe('given dashboard with repeated panels', () => {
let dash: any, exported: any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import config from 'app/core/config';
import { DashboardModel } from '../../state/DashboardModel';
import DatasourceSrv from 'app/features/plugins/datasource_srv';
import { PanelModel } from 'app/features/dashboard/state';
import { PanelPluginMeta } from 'app/types/plugins';
import { PanelPluginMeta } from '@grafana/ui';

interface Input {
name: string;
Expand Down
7 changes: 3 additions & 4 deletions public/app/features/dashboard/dashgrid/DashboardPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ import { PanelResizer } from './PanelResizer';

// Types
import { PanelModel, DashboardModel } from '../state';
import { PanelPluginMeta } from 'app/types';
import { AngularPanelPlugin, PanelPlugin } from '@grafana/ui/src/types/panel';
import { PanelPluginMeta, AngularPanelPlugin, PanelPlugin } from '@grafana/ui/src/types/panel';
import { AutoSizer } from 'react-virtualized';

export interface Props {
Expand Down Expand Up @@ -102,7 +101,7 @@ export class DashboardPanel extends PureComponent<Props, State> {
if (importedPlugin instanceof AngularPanelPlugin) {
plugin.angularPlugin = importedPlugin as AngularPanelPlugin;
} else if (importedPlugin instanceof PanelPlugin) {
plugin.vizPlugin = importedPlugin as PanelPlugin;
plugin.panelPlugin = importedPlugin as PanelPlugin;
}
} catch (e) {
plugin = getPanelPluginNotFound(plugin.id);
Expand Down Expand Up @@ -210,7 +209,7 @@ export class DashboardPanel extends PureComponent<Props, State> {
onMouseLeave={this.onMouseLeave}
style={styles}
>
{plugin.vizPlugin && this.renderReactPanel()}
{plugin.panelPlugin && this.renderReactPanel()}
{plugin.angularPlugin && this.renderAngularPanel()}
</div>
)}
Expand Down
7 changes: 3 additions & 4 deletions public/app/features/dashboard/dashgrid/PanelChrome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import config from 'app/core/config';

// Types
import { DashboardModel, PanelModel } from '../state';
import { PanelPluginMeta } from 'app/types';
import { LoadingState, PanelData } from '@grafana/ui';
import { PanelPluginMeta, LoadingState, PanelData } from '@grafana/ui';
import { ScopedVars } from '@grafana/ui';

import templateSrv from 'app/features/templating/template_srv';
Expand Down Expand Up @@ -216,7 +215,7 @@ export class PanelChrome extends PureComponent<Props, State> {
renderPanel(width: number, height: number): JSX.Element {
const { panel, plugin } = this.props;
const { renderCounter, data, isFirstLoad } = this.state;
const PanelComponent = plugin.vizPlugin.panel;
const PanelComponent = plugin.panelPlugin.panel;

// This is only done to increase a counter that is used by backend
// image rendering (phantomjs/headless chrome) to know when to capture image
Expand All @@ -237,7 +236,7 @@ export class PanelChrome extends PureComponent<Props, State> {
<PanelComponent
data={data}
timeRange={data.request ? data.request.range : this.timeSrv.timeRange()}
options={panel.getOptions(plugin.vizPlugin.defaults)}
options={panel.getOptions(plugin.panelPlugin.defaults)}
width={width - 2 * config.theme.panelPadding.horizontal}
height={height - PANEL_HEADER_HEIGHT - config.theme.panelPadding.vertical}
renderCounter={renderCounter}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import React, { PureComponent } from 'react';
import { AlertBox } from 'app/core/components/AlertBox/AlertBox';

// Types
import { PanelPluginMeta, AppNotificationSeverity } from 'app/types';
import { PanelProps, PanelPlugin, PluginType } from '@grafana/ui';
import { AppNotificationSeverity } from 'app/types';
import { PanelPluginMeta, PanelProps, PanelPlugin, PluginType } from '@grafana/ui';

interface Props {
pluginId: string;
Expand Down Expand Up @@ -63,7 +63,7 @@ export function getPanelPluginNotFound(id: string): PanelPluginMeta {
updated: '',
version: '',
},
vizPlugin: new PanelPlugin(NotFound),
panelPlugin: new PanelPlugin(NotFound),
angularPlugin: null,
};
}
4 changes: 1 addition & 3 deletions public/app/features/dashboard/panel_editor/PanelEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import { AngularComponent } from 'app/core/services/AngularLoader';

import { PanelModel } from '../state/PanelModel';
import { DashboardModel } from '../state/DashboardModel';
import { PanelPluginMeta } from 'app/types/plugins';

import { Tooltip } from '@grafana/ui';
import { PanelPluginMeta, Tooltip } from '@grafana/ui';

interface PanelEditorProps {
panel: PanelModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import { FadeIn } from 'app/core/components/Animations/FadeIn';
// Types
import { PanelModel } from '../state';
import { DashboardModel } from '../state';
import { PanelPluginMeta } from 'app/types/plugins';
import { VizPickerSearch } from './VizPickerSearch';
import PluginStateinfo from 'app/features/plugins/PluginStateInfo';
import { PanelPluginMeta } from '@grafana/ui';

interface Props {
panel: PanelModel;
Expand Down Expand Up @@ -54,7 +54,7 @@ export class VisualizationTab extends PureComponent<Props, State> {

getReactPanelOptions = () => {
const { panel, plugin } = this.props;
return panel.getOptions(plugin.vizPlugin.defaults);
return panel.getOptions(plugin.panelPlugin.defaults);
};

renderPanelOptions() {
Expand All @@ -64,8 +64,8 @@ export class VisualizationTab extends PureComponent<Props, State> {
return <div ref={element => (this.element = element)} />;
}

if (plugin.vizPlugin) {
const PanelEditor = plugin.vizPlugin.editor;
if (plugin.panelPlugin) {
const PanelEditor = plugin.panelPlugin.editor;

if (PanelEditor) {
return <PanelEditor options={this.getReactPanelOptions()} onOptionsChange={this.onPanelOptionsChanged} />;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React, { PureComponent } from 'react';

import { FilterInput } from 'app/core/components/FilterInput/FilterInput';

import { PanelPluginMeta } from 'app/types';
import { PanelPluginMeta } from '@grafana/ui';

interface Props {
plugin: PanelPluginMeta;
Expand Down
3 changes: 1 addition & 2 deletions public/app/features/dashboard/panel_editor/VizTypePicker.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React, { PureComponent } from 'react';

import config from 'app/core/config';
import { PanelPluginMeta } from 'app/types/plugins';
import VizTypePickerPlugin from './VizTypePickerPlugin';
import { EmptySearchResult } from '@grafana/ui';
import { PanelPluginMeta, EmptySearchResult } from '@grafana/ui';

export interface Props {
current: PanelPluginMeta;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import classNames from 'classnames';
import { PanelPluginMeta } from 'app/types/plugins';
import { PanelPluginMeta } from '@grafana/ui';

interface Props {
isCurrent: boolean;
Expand Down
2 changes: 1 addition & 1 deletion public/app/features/dashboard/state/PanelModel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ describe('PanelModel', () => {
model.changePlugin(
getPanelPlugin({
id: 'react',
vizPlugin: reactPlugin,
panelPlugin: reactPlugin,
})
);
});
Expand Down
9 changes: 4 additions & 5 deletions public/app/features/dashboard/state/PanelModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import { Emitter } from 'app/core/utils/emitter';
import { getNextRefIdChar } from 'app/core/utils/query';

// Types
import { DataQuery, Threshold, ScopedVars, DataQueryResponseData } from '@grafana/ui';
import { PanelPluginMeta } from 'app/types';
import { PanelPluginMeta, DataQuery, Threshold, ScopedVars, DataQueryResponseData } from '@grafana/ui';
import config from 'app/core/config';

import { PanelQueryRunner } from './PanelQueryRunner';
Expand Down Expand Up @@ -256,10 +255,10 @@ export class PanelModel {
pluginLoaded(plugin: PanelPluginMeta) {
this.plugin = plugin;

if (plugin.vizPlugin && plugin.vizPlugin.onPanelMigration) {
if (plugin.panelPlugin && plugin.panelPlugin.onPanelMigration) {
const version = this.getPluginVersion(plugin);
if (version !== this.pluginVersion) {
this.options = plugin.vizPlugin.onPanelMigration(this);
this.options = plugin.panelPlugin.onPanelMigration(this);
this.pluginVersion = version;
}
}
Expand Down Expand Up @@ -292,7 +291,7 @@ export class PanelModel {
this.plugin = newPlugin;

// Let panel plugins inspect options from previous panel and keep any that it can use
const reactPanel = newPlugin.vizPlugin;
const reactPanel = newPlugin.panelPlugin;

if (reactPanel) {
if (reactPanel.onPanelTypeChanged) {
Expand Down
7 changes: 4 additions & 3 deletions public/app/features/datasources/NewDataSourcePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ import React, { PureComponent } from 'react';
import { connect } from 'react-redux';
import { hot } from 'react-hot-loader';
import Page from 'app/core/components/Page/Page';
import { NavModel, Plugin, StoreState } from 'app/types';
import { NavModel, StoreState } from 'app/types';
import { addDataSource, loadDataSourceTypes, setDataSourceTypeSearchQuery } from './state/actions';
import { getNavModel } from 'app/core/selectors/navModel';
import { getDataSourceTypes } from './state/selectors';
import { FilterInput } from 'app/core/components/FilterInput/FilterInput';
import { DataSourcePluginMeta } from '@grafana/ui';

export interface Props {
navModel: NavModel;
dataSourceTypes: Plugin[];
dataSourceTypes: DataSourcePluginMeta[];
isLoading: boolean;
addDataSource: typeof addDataSource;
loadDataSourceTypes: typeof loadDataSourceTypes;
Expand All @@ -23,7 +24,7 @@ class NewDataSourcePage extends PureComponent<Props> {
this.props.loadDataSourceTypes();
}

onDataSourceTypeClicked = (plugin: Plugin) => {
onDataSourceTypeClicked = (plugin: DataSourcePluginMeta) => {
this.props.addDataSource(plugin);
};

Expand Down
Loading

0 comments on commit 35e5efc

Please sign in to comment.