Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format code #94

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:

- name: Check types
run: yarn run typecheck
- name: Check formatting
run: yarn run format:check
- name: Lint
run: yarn run lint
- name: Unit tests
Expand Down
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore artifacts
dist

# Ignore files created by `@grafana/create-plugin`
.config
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Add the plugin and acquire your Bitmovin Analytics API key from the [bitmovin da
Configure the datasource:

| Setting | Value |
|--------------|----------------------------------------------------------|
| ------------ | -------------------------------------------------------- |
| URL | `https://api.bitmovin.com/v1` |
| API Key | Your API key |
| Ad Analytics | If checked, the datasource is switched to query ads data |
Expand All @@ -27,18 +27,18 @@ See the [example_dashboard.json](example_dashboard.json) for a demo. Configure t
Add a new panel and select the bitmovin analytics datasource.
Configure the metric with following settings:

| Setting | Description |
|------------------------|------------------------------------------------------------------------------------------|
| License* | Your analytics license |
| Metric* | Aggregation method to use, e.g. `count`, `sum` |
| Dimension* | Dimension to aggregate over |
| Filter | Apply filters to the query |
| Format as time series* | Check the switch to see time series data |
| Group By | Group query by dimension and plot as individual time series |
| Order By | Order query ascending or descending by dimension |
| Limit | Limit the result to given number |
| Interval* | Time granularity of queries, select `AUTO` to automatically adapt to selected time range |
| Alias By | Set the name of series (only visible with multiple queries in one Graph) |
| Setting | Description |
| ----------------------- | ---------------------------------------------------------------------------------------- |
| License\* | Your analytics license |
| Metric\* | Aggregation method to use, e.g. `count`, `sum` |
| Dimension\* | Dimension to aggregate over |
| Filter | Apply filters to the query |
| Format as time series\* | Check the switch to see time series data |
| Group By | Group query by dimension and plot as individual time series |
| Order By | Order query ascending or descending by dimension |
| Limit | Limit the result to given number |
| Interval\* | Time granularity of queries, select `AUTO` to automatically adapt to selected time range |
| Alias By | Set the name of series (only visible with multiple queries in one Graph) |

Settings marked with `*` are required for the time series graph.

Expand All @@ -52,7 +52,7 @@ Configure the metric as described in [Time Series Graph](#time-series-graph) but

## Gauges

Configure the Gauge's `Value Options`, depending on your query.
Configure the Gauge's `Value Options`, depending on your query.

- For table data (`Format as time series` option **unchecked**) for the `Show` option select `All Values`.
- For time series data (`Format as time series` option **checked**) for the `Show` option select `Calculate` and choose a reducer function.
Expand All @@ -61,7 +61,7 @@ Configure the Gauge's `Value Options`, depending on your query.

Please refer to our [Documentation](https://developer.bitmovin.com/playback/docs/integrating-bitmovin-analytics-with-grafana) and [Analytics Api Reference](https://developer.bitmovin.com/playback/reference/overview) for more information or reach out to us at [bitmovin.com](https://bitmovin.com/contact-bitmovin/).

-----
---

## Development

Expand Down
40 changes: 10 additions & 30 deletions example_dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -621,9 +621,7 @@
"value": "0"
}
],
"groupBy": [
"BROWSER"
],
"groupBy": ["BROWSER"],
"interval": "AUTO",
"license": "<YOUR-API-KEY>",
"metric": "count",
Expand Down Expand Up @@ -723,9 +721,7 @@
"value": "0"
}
],
"groupBy": [
"COUNTRY"
],
"groupBy": ["COUNTRY"],
"interval": "AUTO",
"license": "<YOUR-API-KEY>",
"metric": "count",
Expand Down Expand Up @@ -781,9 +777,7 @@
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"reducer": ["sum"],
"show": false
},
"showHeader": true
Expand All @@ -800,9 +794,7 @@
"value": "0"
}
],
"groupBy": [
"PLAYER_TECH"
],
"groupBy": ["PLAYER_TECH"],
"interval": "AUTO",
"license": "<YOUR-API-KEY>",
"metric": "count",
Expand Down Expand Up @@ -863,9 +855,7 @@
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"reducer": ["sum"],
"show": false
},
"showHeader": true
Expand All @@ -882,9 +872,7 @@
"value": "0"
}
],
"groupBy": [
"OPERATINGSYSTEM"
],
"groupBy": ["OPERATINGSYSTEM"],
"interval": "AUTO",
"license": "<YOUR-API-KEY>",
"limit": 10,
Expand Down Expand Up @@ -946,9 +934,7 @@
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"reducer": ["sum"],
"show": false
},
"showHeader": true
Expand All @@ -959,9 +945,7 @@
"datasource": {},
"dimension": "IMPRESSION_ID",
"filter": [],
"groupBy": [
"BROWSER"
],
"groupBy": ["BROWSER"],
"interval": "AUTO",
"license": "<YOUR-API-KEY>",
"limit": 10,
Expand Down Expand Up @@ -1023,9 +1007,7 @@
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"reducer": ["sum"],
"show": false
},
"showHeader": true
Expand All @@ -1036,9 +1018,7 @@
"datasource": {},
"dimension": "IMPRESSION_ID",
"filter": [],
"groupBy": [
"COUNTRY"
],
"groupBy": ["COUNTRY"],
"interval": "AUTO",
"license": "<YOUR-API-KEY>",
"limit": 10,
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"typecheck": "tsc --noEmit",
"lint": "eslint --cache --ignore-pattern 'dist/**' --ignore-path ./.gitignore --ext .js,.jsx,.ts,.tsx .",
"lint:fix": "yarn run lint --fix",
"format": "yarn prettier . --write",
"format:check": "yarn prettier --check .",
"e2e": "yarn exec cypress install && yarn exec grafana-e2e run",
"e2e:update": "yarn exec cypress install && yarn exec grafana-e2e run --update-screenshots",
"server": "docker-compose up --build",
Expand Down
28 changes: 14 additions & 14 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Add the plugin and acquire your Bitmovin Analytics API key from the [bitmovin da
Configure the datasource:

| Setting | Value |
|--------------|----------------------------------------------------------|
| ------------ | -------------------------------------------------------- |
| URL | `https://api.bitmovin.com/v1` |
| API Key | Your API key |
| Ad Analytics | If checked, the datasource is switched to query ads data |
Expand All @@ -27,18 +27,18 @@ See the [example_dashboard.json](example_dashboard.json) for a demo. Configure t
Add a new panel and select the bitmovin analytics datasource.
Configure the metric with following settings:

| Setting | Description |
|------------------------|------------------------------------------------------------------------------------------|
| License* | Your analytics license |
| Metric* | Aggregation method to use, e.g. `count`, `sum` |
| Dimension* | Dimension to aggregate over |
| Filter | Apply filters to the query |
| Format as time series* | Check the switch to see time series data |
| Group By | Group query by dimension and plot as individual time series |
| Order By | Order query ascending or descending by dimension |
| Limit | Limit the result to given number |
| Interval* | Time granularity of queries, select `AUTO` to automatically adapt to selected time range |
| Alias By | Set the name of series (only visible with multiple queries in one Graph) |
| Setting | Description |
| ----------------------- | ---------------------------------------------------------------------------------------- |
| License\* | Your analytics license |
| Metric\* | Aggregation method to use, e.g. `count`, `sum` |
| Dimension\* | Dimension to aggregate over |
| Filter | Apply filters to the query |
| Format as time series\* | Check the switch to see time series data |
| Group By | Group query by dimension and plot as individual time series |
| Order By | Order query ascending or descending by dimension |
| Limit | Limit the result to given number |
| Interval\* | Time granularity of queries, select `AUTO` to automatically adapt to selected time range |
| Alias By | Set the name of series (only visible with multiple queries in one Graph) |

Settings marked with `*` are required for the time series graph.

Expand All @@ -52,7 +52,7 @@ Configure the metric as described in [Time Series Graph](#time-series-graph) but

## Gauges

Configure the Gauge's `Value Options`, depending on your query.
Configure the Gauge's `Value Options`, depending on your query.

- For table data (`Format as time series` option **unchecked**) for the `Show` option select `All Values`.
- For time series data (`Format as time series` option **checked**) for the `Show` option select `Calculate` and choose a reducer function.
Expand Down
2 changes: 1 addition & 1 deletion src/components/FilterRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Props = {

export function FilterRow(props: Props) {
const [hasNewQueryFilter, setHasNewQueryFilter] = useState<boolean>(false);
const paddingTop= props.filters.length === 0 ? 4 : 0
const paddingTop = props.filters.length === 0 ? 4 : 0;

function handleQueryFilterDelete(queryFilterIndex: number) {
const newQueryFilters = [...props.filters];
Expand Down
2 changes: 1 addition & 1 deletion src/components/GroupByRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type Props = {
};

export function GroupByRow(props: Props) {
const paddingTop= props.groupBys.length === 0 ? 4 : 0
const paddingTop = props.groupBys.length === 0 ? 4 : 0;
const deleteGroupByInput = (index: number) => {
const newSelectedGroupBys = [...props.groupBys];
newSelectedGroupBys.splice(index, 1);
Expand Down
2 changes: 1 addition & 1 deletion src/components/OrderByRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type Props = {
};

export function OrderByRow(props: Props) {
const paddingTop= props.orderBys.length === 0 ? 4 : 0
const paddingTop = props.orderBys.length === 0 ? 4 : 0;
const deleteOrderByInput = (index: number) => {
const newOrderBys = [...props.orderBys];
newOrderBys.splice(index, 1);
Expand Down
3 changes: 3 additions & 0 deletions src/components/QueryFilterInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ import { convertFilterValueToProperType } from 'utils/filterUtils';
interface QueryFilterInputProps {
/** `undefined` when component is used to create new filter (no values yet) */
value: undefined | QueryFilter;

onChange(queryFilter: QueryFilter): void;

onDelete(): void;

isAdAnalytics: boolean;
/** Selected query filters are used to filter out used values from attribute select options */
selectedQueryFilters: QueryFilter[];
Expand Down
10 changes: 8 additions & 2 deletions src/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@
"large": "img/logo.svg"
},
"links": [
{"name": "Project site", "url": "https://github.com/bitmovin/analytics-grafana-datasource"},
{"name": "Apache License", "url": "https://github.com/bitmovin/analytics-grafana-datasource/blob/main/LICENSE"}
{
"name": "Project site",
"url": "https://github.com/bitmovin/analytics-grafana-datasource"
},
{
"name": "Apache License",
"url": "https://github.com/bitmovin/analytics-grafana-datasource/blob/main/LICENSE"
}
],
"screenshots": [],
"version": "%VERSION%",
Expand Down
Loading