Skip to content

Commit

Permalink
version 1.0.15, includes fix for issue 38 (grafana#44)
Browse files Browse the repository at this point in the history
* move unit tests, and process template vars in clickthroughurl

* move test helper

* clickthrough transformer class and unit tests

* integrate clickthrough transformations

* move default clickthrough processing after sorting is applied

* move sorting ahead of overides

* cleanup

* set version to 1.0.15 and update dist
  • Loading branch information
briangann authored Jan 16, 2019
1 parent 2e0e958 commit 9475cd3
Show file tree
Hide file tree
Showing 55 changed files with 1,465 additions and 235 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@
- Refactor UI for composites, implement enable/disable
- Implement global fill color for no thresholds
- Now correctly parses custom color selection
## v1.0.15
- implemented metric referencing for clickthroughs (issue #38)
- implemented composite name referencing
- implemented template variables for clickthroughs
- fixed bug with default clickthrough and sanitize url
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,44 @@ This shows composites configured for GPU 0,1,2,3, and non-grouped metrics from G

![State with partial composites](https://raw.githubusercontent.com/grafana/grafana-polystat-panel/master/src/screenshots/polystat-gpu-state-composites.png)

### Templating

#### Using Dashboard Template Variables

Template variables are available in the clickThroughUrl setting, specified by using ${varname}.
They can also be passed to another dashboard by appending var-VARNAME=value to the url
```
/dasboard/xyz?var-VARNAME=${VARNAME}
```

#### Using Polystat Variables
Each polygon represents either a single metric, or a composite metric

An example drilldown clickthrough url can be specified like this:
```
dashboard/db/drilldown?var-HOSTNAME=${__cell_name}
```

NOTE: Metrics are sorted using the global options "Sorting" settings. Global filters are also applied before dereferencing is performed.

##### Single Metric Variables
The name and value of a polygon can be referenced using the following syntax:

* Metric Name: `${__cell_name}`
* Metric Value: `${__cell}`
* Metric Raw Value: `${__cell:raw}` syntax.
By default values are URI encoded. Use this syntax to *disable* encoding

##### Composite Metric Variables
The names and values of a composite polygon can be referenced using the following syntax:

* Composite Name: `${__composite_name}`
* Metric Name: `${__cell_name_n}`
* Metric Value: `${__cell_n}`
* Metric Raw Value: `${__cell_n:raw}` syntax.
By default values are URI encoded. Use this syntax to *disable* encoding


## Building

This plugin relies on Grunt/NPM/Bower, typical build sequence:
Expand Down
5 changes: 5 additions & 0 deletions dist/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@
- Refactor UI for composites, implement enable/disable
- Implement global fill color for no thresholds
- Now correctly parses custom color selection
## v1.0.15
- implemented metric referencing for clickthroughs (issue #38)
- implemented composite name referencing
- implemented template variables for clickthroughs
- fixed bug with default clickthrough and sanitize url
40 changes: 39 additions & 1 deletion dist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

This panel plugin provides a [D3-based](http://www.d3js.org) multistat panel for [Grafana](http://www.grafana.org) 3.x/4.x/5.x.

A hexagon is create for each metric received, with the ability to group metrics into a composite metric, and display the triggered state of the composite.
A hexagon is created for each metric received, with the ability to group metrics into a composite metric, and display the triggered state of the composite.

## Screenshots

Expand Down Expand Up @@ -127,6 +127,44 @@ This shows composites configured for GPU 0,1,2,3, and non-grouped metrics from G

![State with partial composites](https://raw.githubusercontent.com/grafana/grafana-polystat-panel/master/src/screenshots/polystat-gpu-state-composites.png)

### Templating

#### Using Dashboard Template Variables

Template variables are available in the clickThroughUrl setting, specified by using ${varname}.
They can also be passed to another dashboard by appending var-VARNAME=value to the url
```
/dasboard/xyz?var-VARNAME=${VARNAME}
```

#### Using Polystat Variables
Each polygon represents either a single metric, or a composite metric

An example drilldown clickthrough url can be specified like this:
```
dashboard/db/drilldown?var-HOSTNAME=${__cell_name}
```

NOTE: Metrics are sorted using the global options "Sorting" settings. Global filters are also applied before dereferencing is performed.

##### Single Metric Variables
The name and value of a polygon can be referenced using the following syntax:

* Metric Name: `${__cell_name}`
* Metric Value: `${__cell}`
* Metric Raw Value: `${__cell:raw}` syntax.
By default values are URI encoded. Use this syntax to *disable* encoding

##### Composite Metric Variables
The names and values of a composite polygon can be referenced using the following syntax:

* Composite Name: `${__composite_name}`
* Metric Name: `${__cell_name_n}`
* Metric Value: `${__cell_n}`
* Metric Raw Value: `${__cell_n:raw}` syntax.
By default values are URI encoded. Use this syntax to *disable* encoding


## Building

This plugin relies on Grunt/NPM/Bower, typical build sequence:
Expand Down
14 changes: 14 additions & 0 deletions dist/clickThroughTransformer.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { PolystatModel } from "./polystatmodel";
declare class ClickThroughTransformer {
static cellName: RegExp;
static cellValue: RegExp;
static cellRawValue: RegExp;
static nthCellName: RegExp;
static nthCellValue: RegExp;
static nthCellRawValue: RegExp;
static compositeName: RegExp;
static tranformSingleMetric(index: number, url: string, data: Array<PolystatModel>): string;
static tranformNthMetric(url: string, data: Array<PolystatModel>): string;
static tranformComposite(name: string, url: string): string;
}
export { ClickThroughTransformer };
73 changes: 73 additions & 0 deletions dist/clickThroughTransformer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion dist/composites_manager.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/// <reference path="../node_modules/grafana-sdk-mocks/app/headers/common.d.ts" />
export declare class MetricComposite {
compositeName: string;
members: Array<any>;
Expand Down
17 changes: 12 additions & 5 deletions dist/composites_manager.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ctrl.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ declare class D3PolystatPanelCtrl extends MetricsPanelCtrl {
validateBorderSizeValue(): void;
updatePolygonBorderColor(): void;
updatePolygonGlobalFillColor(): void;
getDefaultClickThrough(): any;
getDefaultClickThrough(index: number): any;
setGlobalUnitFormat(subItem: any): void;
}
export { D3PolystatPanelCtrl, D3PolystatPanelCtrl as MetricsPanelCtrl };
Loading

0 comments on commit 9475cd3

Please sign in to comment.