Skip to content

Commit

Permalink
Merge remote-tracking branch 'grafana/master' into stream-mixed-query
Browse files Browse the repository at this point in the history
* grafana/master:
  FormLabel: allow any rather than just a string for tooltip (grafana#16841)
  prometheus: fix regression after adding support for tracing headers (grafana#16829)
  area/circleci: Speed up circleci build process for branches and pr (grafana#16778)
  DataProxy: Restore Set-Cookie header after proxy request (grafana#16838)
  docs: clarify page parameter version support for folder/dashboard search (grafana#16836)
  Chore: revise some of the gosec rules (grafana#16713)
  Refactor: consistant plugin/meta usage (grafana#16834)
  Explore: Use SeriesData format for loki/logs (grafana#16793)
  Refactor: move NavModel to @grafana/ui (grafana#16813)
  • Loading branch information
ryantxu committed May 1, 2019
2 parents 331e177 + 2e326d1 commit 837ef31
Show file tree
Hide file tree
Showing 89 changed files with 1,303 additions and 755 deletions.
126 changes: 122 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,117 @@ jobs:
paths:
- dist/*

build-fast-backend:
docker:
- image: grafana/build-container:1.2.6
working_directory: /go/src/github.com/grafana/grafana
steps:
- checkout
- run:
name: prepare build tools
command: '/tmp/bootstrap.sh'
- run:
name: build grafana backend
command: './scripts/build/build.sh --fast --backend-only'
- persist_to_workspace:
root: .
paths:
- bin/*

build-fast-frontend:
docker:
- image: grafana/build-container:1.2.6
working_directory: /go/src/github.com/grafana/grafana
steps:
- checkout
- run:
name: prepare build tools
command: '/tmp/bootstrap.sh'
- restore_cache:
key: frontend-dependency-cache-{{ checksum "yarn.lock" }}
- run:
name: build grafana frontend
command: './scripts/build/build.sh --fast --frontend-only'
- save_cache:
key: frontend-dependency-cache-{{ checksum "yarn.lock" }}
paths:
- node_modules
- persist_to_workspace:
root: .
paths:
- public/build/*
- tools/phantomjs/*

build-fast-package:
docker:
- image: grafana/build-container:1.2.6
working_directory: /go/src/github.com/grafana/grafana
steps:
- checkout
- attach_workspace:
at: .
- restore_cache:
key: frontend-dependency-cache-{{ checksum "yarn.lock" }}
- run:
name: prepare build tools
command: '/tmp/bootstrap.sh'
- run:
name: package grafana
command: './scripts/build/build.sh --fast --package-only'
- run:
name: sha-sum packages
command: 'go run build.go sha-dist'
- run:
name: Test Grafana.com release publisher
command: 'cd scripts/build/release_publisher && go test .'
- persist_to_workspace:
root: /go/src/github.com/grafana/grafana
paths:
- dist/*

build-fast-save:
docker:
- image: grafana/build-container:1.2.6
working_directory: /go/src/github.com/grafana/grafana
steps:
- checkout
- attach_workspace:
at: .
- restore_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
- run:
name: debug cache
command: 'ls -al /go/src/github.com/grafana/grafana/node_modules'
- run:
name: prepare build tools
command: '/tmp/bootstrap.sh'
- run:
name: build grafana backend
command: './scripts/build/build.sh --fast --backend-only'
- run:
name: build grafana frontend
command: './scripts/build/build.sh --fast --frontend-only'
- save_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
paths:
- /go/src/github.com/grafana/grafana/node_modules
- run:
name: package grafana
command: './scripts/build/build.sh --fast --package-only'
- run:
name: sign packages
command: './scripts/build/sign_packages.sh'
- run:
name: sha-sum packages
command: 'go run build.go sha-dist'
- run:
name: Test Grafana.com release publisher
command: 'cd scripts/build/release_publisher && go test .'
- persist_to_workspace:
root: .
paths:
- dist/*

grafana-docker-master:
machine:
image: circleci/classic:201808-01
Expand All @@ -224,7 +335,7 @@ jobs:
- run: docker info
- run: docker run --privileged linuxkit/binfmt:v0.6
- run: cp dist/grafana-latest.linux-*.tar.gz packaging/docker
- run: cd packaging/docker && ./build.sh "${CIRCLE_SHA1}"
- run: cd packaging/docker && ./build.sh --fast "${CIRCLE_SHA1}"

grafana-docker-release:
machine:
Expand Down Expand Up @@ -556,8 +667,15 @@ workflows:

build-branches-and-prs:
jobs:
- build:
- build-fast-backend:
filters: *filter-not-release-or-master
- build-fast-frontend:
filters: *filter-not-release-or-master
- build-fast-package:
filters: *filter-not-release-or-master
requires:
- build-fast-backend
- build-fast-frontend
- codespell:
filters: *filter-not-release-or-master
- backend-lint:
Expand All @@ -574,7 +692,7 @@ workflows:
filters: *filter-not-release-or-master
- grafana-docker-pr:
requires:
- build
- build-fast-package
- test-backend
- test-frontend
- codespell
Expand All @@ -585,7 +703,7 @@ workflows:
filters: *filter-not-release-or-master
- store-build-artifacts:
requires:
- build
- build-fast-package
- test-backend
- test-frontend
- codespell
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/http_api/folder_dashboard_search.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Query parameters:
- **folderIds** – List of folder id's to search in for dashboards
- **starred** – Flag indicating if only starred Dashboards should be returned
- **limit** – Limit the number of returned results (max 5000)
- **page** – Use this parameter to access hits beyond limit. Numbering starts at 1. limit param acts as page size.
- **page** – Use this parameter to access hits beyond limit. Numbering starts at 1. limit param acts as page size. Only available in Grafana v6.2+.

**Example request for retrieving folders and dashboards of the general folder**:

Expand Down
15 changes: 13 additions & 2 deletions packages/grafana-ui/src/components/FormField/FormField.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import React, { InputHTMLAttributes, FunctionComponent } from 'react';
import { FormLabel } from '../FormLabel/FormLabel';
import { PopperContent } from '../Tooltip/PopperController';

export interface Props extends InputHTMLAttributes<HTMLInputElement> {
label: string;
tooltip?: PopperContent<any>;
labelWidth?: number;
inputWidth?: number;
inputEl?: React.ReactNode;
Expand All @@ -17,10 +19,19 @@ const defaultProps = {
* Default form field including label used in Grafana UI. Default input element is simple <input />. You can also pass
* custom inputEl if required in which case inputWidth and inputProps are ignored.
*/
export const FormField: FunctionComponent<Props> = ({ label, labelWidth, inputWidth, inputEl, ...inputProps }) => {
export const FormField: FunctionComponent<Props> = ({
label,
tooltip,
labelWidth,
inputWidth,
inputEl,
...inputProps
}) => {
return (
<div className="form-field">
<FormLabel width={labelWidth}>{label}</FormLabel>
<FormLabel width={labelWidth} tooltip={tooltip}>
{label}
</FormLabel>
{inputEl || <input type="text" className={`gf-form-input width-${inputWidth}`} {...inputProps} />}
</div>
);
Expand Down
3 changes: 2 additions & 1 deletion packages/grafana-ui/src/components/FormLabel/FormLabel.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import React, { FunctionComponent, ReactNode } from 'react';
import classNames from 'classnames';
import { Tooltip } from '../Tooltip/Tooltip';
import { PopperContent } from '../Tooltip/PopperController';

interface Props {
children: ReactNode;
className?: string;
htmlFor?: string;
isFocused?: boolean;
isInvalid?: boolean;
tooltip?: string;
tooltip?: PopperContent<any>;
width?: number;
}

Expand Down
6 changes: 6 additions & 0 deletions packages/grafana-ui/src/types/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ export interface QueryResultMeta {

// Match the result to the query
requestId?: string;

// Used in Explore for highlighting
search?: string;

// Used in Explore to show limit applied to search result
limit?: number;
}

export interface QueryResultBase {
Expand Down
7 changes: 5 additions & 2 deletions packages/grafana-ui/src/types/datasource.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import { ComponentClass } from 'react';
import { TimeRange } from './time';
import { PluginMeta } from './plugin';
import { PluginMeta, GrafanaPlugin } from './plugin';
import { TableData, TimeSeries, SeriesData, LoadingState } from './data';
import { PanelData } from './panel';

export interface DataSourcePluginOptionsEditorProps<TOptions> {
options: TOptions;
onOptionsChange: (options: TOptions) => void;
}
export class DataSourcePlugin<TOptions = {}, TQuery extends DataQuery = DataQuery> {
export class DataSourcePlugin<TOptions = {}, TQuery extends DataQuery = DataQuery> extends GrafanaPlugin<
DataSourcePluginMeta
> {
DataSourceClass: DataSourceConstructor<TQuery>;
components: DataSourcePluginComponents<TOptions, TQuery>;

constructor(DataSourceClass: DataSourceConstructor<TQuery>) {
super();
this.DataSourceClass = DataSourceClass;
this.components = {};
}
Expand Down
1 change: 1 addition & 0 deletions packages/grafana-ui/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export * from './datasource';
export * from './theme';
export * from './graph';
export * from './threshold';
export * from './navModel';
export * from './input';
export * from './logs';
export * from './displayValue';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
export interface NavModelItem {
text: string;
url: string;
url?: string;
subTitle?: string;
icon?: string;
img?: string;
id: string;
id?: string;
active?: boolean;
hideFromTabs?: boolean;
divider?: boolean;
children?: NavModelItem[];
breadcrumbs?: Array<{ title: string; url: string }>;
breadcrumbs?: NavModelBreadcrumb[];
target?: string;
parentItem?: NavModelItem;
}

export interface NavModel {
main: NavModelItem;
node: NavModelItem;
breadcrumbs?: NavModelItem[];
}

export interface NavModelBreadcrumb {
title: string;
url?: string;
}

export type NavIndex = { [s: string]: NavModelItem };
23 changes: 8 additions & 15 deletions packages/grafana-ui/src/types/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@ 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';
import { PluginMeta, GrafanaPlugin } 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
Expand Down Expand Up @@ -72,14 +69,20 @@ export type PanelTypeChangedHandler<TOptions = any> = (
prevOptions: any
) => Partial<TOptions>;

export class PanelPlugin<TOptions = any> {
export class PanelPlugin<TOptions = any> extends GrafanaPlugin<PanelPluginMeta> {
panel: ComponentType<PanelProps<TOptions>>;
editor?: ComponentClass<PanelEditorProps<TOptions>>;
defaults?: TOptions;
onPanelMigration?: PanelMigrationHandler<TOptions>;
onPanelTypeChanged?: PanelTypeChangedHandler<TOptions>;

/**
* Legacy angular ctrl. If this exists it will be used instead of the panel
*/
angularPanelCtrl?: any;

constructor(panel: ComponentType<PanelProps<TOptions>>) {
super();
this.panel = panel;
}

Expand Down Expand Up @@ -114,16 +117,6 @@ export class PanelPlugin<TOptions = any> {
}
}

export class AngularPanelPlugin {
components: {
PanelCtrl: any;
};

constructor(PanelCtrl: any) {
this.components = { PanelCtrl: PanelCtrl };
}
}

export interface PanelSize {
width: number;
height: number;
Expand Down
15 changes: 10 additions & 5 deletions packages/grafana-ui/src/types/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,20 @@ export interface PluginMetaInfo {
version: string;
}

export class AppPlugin {
meta: PluginMeta;
export class GrafanaPlugin<T extends PluginMeta> {
// Meta is filled in by the plugin loading system
meta?: T;

// Soon this will also include common config options
}

export class AppPlugin extends GrafanaPlugin<PluginMeta> {
angular?: {
ConfigCtrl?: any;
pages: { [component: string]: any };
};

constructor(meta: PluginMeta, pluginExports: any) {
this.meta = meta;
setComponentsFromLegacyExports(pluginExports: any) {
const legacy = {
ConfigCtrl: undefined,
pages: {} as any,
Expand All @@ -89,7 +93,8 @@ export class AppPlugin {
this.angular = legacy;
}

if (meta.includes) {
const { meta } = this;
if (meta && meta.includes) {
for (const include of meta.includes) {
const { type, component } = include;
if (type === PluginIncludeType.page && component) {
Expand Down
Loading

0 comments on commit 837ef31

Please sign in to comment.