Skip to content

Commit

Permalink
Rebuild based on 9.0.0 (#5)
Browse files Browse the repository at this point in the history
* Rebuild using Grafana 8.5.3

* Rebuild based on 9.0.0

* Update Provisioning, add tests
  • Loading branch information
mikhail-vl authored Jun 17, 2022
1 parent 5475e59 commit 17e4f22
Show file tree
Hide file tree
Showing 12 changed files with 3,240 additions and 5,901 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## 2.0.0 (2022-06-17)

### Breaking changes

- Requires Grafana 8.5+ and 9.0+

### Features / Enhancements

- Rebuild based on 9.0.0 (#5)

## 1.2.0 (2022-05-01)

### Features / Enhancements
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![Dashboard](https://raw.githubusercontent.com/VolkovLabs/volkovlabs-env-datasource/main/src/img/dashboard.png)

[![Grafana 8](https://img.shields.io/badge/Grafana-8-orange)](https://www.grafana.com)
[![Grafana 9](https://img.shields.io/badge/Grafana-9-orange)](https://www.grafana.com)
![CI](https://github.com/volkovlabs/volkovlabs-env-datasource/workflows/CI/badge.svg)
[![codecov](https://codecov.io/gh/VolkovLabs/volkovlabs-env-datasource/branch/main/graph/badge.svg?token=2W9VR0PG5N)](https://codecov.io/gh/VolkovLabs/volkovlabs-env-datasource)
[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/VolkovLabs/volkovlabs-env-datasource.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/VolkovLabs/volkovlabs-env-datasource/context:javascript)
Expand All @@ -13,7 +13,8 @@ The Environment data source is a plugin for Grafana that returns environment var

### Requirements

Grafana 8.0 is required.
- **Grafana 8.5+**, **Grafana 9.0+** is required for version 2.X.
- **Grafana 8.0+** is required for version 1.X.

## Getting Started

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: '3.4'
services:
grafana:
container_name: grafana
image: grafana/grafana:latest
image: grafana/grafana:9.0.0
ports:
- 3000:3000
environment:
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"author": "Volkov Labs",
"description": "Data Source to return environment variables for Grafana",
"devDependencies": {
"@grafana/data": "8.5.1",
"@grafana/runtime": "8.5.1",
"@grafana/toolkit": "8.5.1",
"@grafana/ui": "8.5.1",
"@grafana/data": "9.0.0",
"@grafana/runtime": "9.0.0",
"@grafana/toolkit": "9.0.0",
"@grafana/ui": "9.0.0",
"@types/enzyme": "^3.10.12",
"@types/enzyme-adapter-react-16": "^1.0.6",
"enzyme": "^3.11.0",
Expand All @@ -29,5 +29,5 @@
"upgrade": "yarn upgrade --latest",
"watch": "grafana-toolkit plugin:dev --watch"
},
"version": "1.2.0"
"version": "2.0.0"
}
40 changes: 30 additions & 10 deletions provisioning/dashboards/panels.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"datasource": {
"type": "datasource",
"uid": "grafana"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
Expand All @@ -21,11 +24,15 @@
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"iteration": 1645328712939,
"iteration": 1655482705159,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "volkovlabs-env-datasource",
"uid": "P9E471951A1B4106E"
},
"fieldConfig": {
"defaults": {
"color": {
Expand Down Expand Up @@ -63,7 +70,7 @@
},
"textMode": "auto"
},
"pluginVersion": "8.4.1",
"pluginVersion": "9.0.0",
"title": "Edition",
"transformations": [
{
Expand All @@ -88,6 +95,10 @@
"type": "stat"
},
{
"datasource": {
"type": "volkovlabs-env-datasource",
"uid": "P9E471951A1B4106E"
},
"fieldConfig": {
"defaults": {
"color": {
Expand Down Expand Up @@ -125,7 +136,7 @@
},
"textMode": "value"
},
"pluginVersion": "8.4.1",
"pluginVersion": "9.0.0",
"title": "Version",
"transformations": [
{
Expand All @@ -150,14 +161,19 @@
"type": "stat"
},
{
"datasource": {
"type": "volkovlabs-env-datasource",
"uid": "P9E471951A1B4106E"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"displayMode": "auto"
"displayMode": "auto",
"inspect": false
},
"mappings": [],
"thresholds": {
Expand Down Expand Up @@ -197,21 +213,25 @@
}
]
},
"pluginVersion": "8.4.1",
"pluginVersion": "9.0.0",
"title": "Environment Variables",
"type": "table"
}
],
"schemaVersion": 35,
"schemaVersion": 36,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"current": {
"selected": false,
"text": "8.4.1",
"value": "8.4.1"
"text": "9.0.0",
"value": "9.0.0"
},
"datasource": {
"type": "volkovlabs-env-datasource",
"uid": "P9E471951A1B4106E"
},
"definition": "GF_VERSION",
"hide": 0,
Expand Down Expand Up @@ -239,6 +259,6 @@
"timezone": "",
"title": "Environment Variables",
"uid": "BiIFntf7k",
"version": 2,
"version": 1,
"weekStart": ""
}
1 change: 1 addition & 0 deletions provisioning/datasources/datasources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ datasources:
access: proxy
isDefault: true
orgId: 1
uid: P9E471951A1B4106E
version: 1
editable: true
jsonData:
Expand Down
2 changes: 0 additions & 2 deletions src/components/ConfigEditor/ConfigEditor.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@ const getOptions = ({
typeName: '',
access: '',
url: '',
password: '',
user: '',
database: '',
basicAuth: false,
basicAuthPassword: '',
basicAuthUser: '',
isDefault: false,
secureJsonFields: {},
Expand Down
49 changes: 49 additions & 0 deletions src/components/QueryEditor/QueryEditor.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { shallow, ShallowWrapper } from 'enzyme';
import React from 'react';
import { Query } from '../../types';
import { QueryEditor } from './QueryEditor';

/**
* Component
*/
type ShallowComponent = ShallowWrapper<QueryEditor['props'], QueryEditor['state'], QueryEditor>;

/**
* Get Query with default values and ability to override
*
* @param overrideQuery
*/
export const getQuery = (overrideQuery = {}): Query => ({
refId: 'A',
...overrideQuery,
});

/**
* Query Editor
*/
describe('QueryEditor', () => {
const onRunQuery = jest.fn();
const onChange = jest.fn();

beforeEach(() => {
onRunQuery.mockReset();
onChange.mockReset();
});

/**
* Component
*/
describe('Component', () => {
const getComponent = (wrapper: ShallowComponent) => wrapper;

it('Should apply feedType value and change', () => {
const query = getQuery();
const wrapper = shallow<QueryEditor>(
<QueryEditor datasource={[] as any} query={query} onRunQuery={onRunQuery} onChange={onChange} />
);

const testedComponent = getComponent(wrapper);
expect(testedComponent.exists());
});
});
});
Binary file modified src/img/dashboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/img/grafana-marketplace.png
Binary file not shown.
2 changes: 1 addition & 1 deletion src/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://raw.githubusercontent.com/grafana/grafana/master/docs/sources/developers/plugins/plugin.schema.json",
"backend": true,
"dependencies": {
"grafanaDependency": ">=8.0.0",
"grafanaDependency": ">=8.5.0",
"plugins": []
},
"executable": "env_datasource_backend",
Expand Down
Loading

0 comments on commit 17e4f22

Please sign in to comment.