diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5c974d6..3bed8ae 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -95,6 +95,7 @@ jobs: echo "::set-output name=checksum::$(cat ./${{ steps.metadata.outputs.archive-checksum }} | cut -d' ' -f1)" - name: Lint plugin + continue-on-error: true run: | git clone https://github.com/grafana/plugin-validator pushd ./plugin-validator/pkg/cmd/plugincheck diff --git a/CHANGELOG.md b/CHANGELOG.md index 892e058..c34a8fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log -## 1.0.0 (IN PROGRESS) +## 1.0.0 (2021-12-01) ### Features / Enhancements diff --git a/README.md b/README.md index 1c4f68e..23c3a1e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Abc panel plugin for Grafana +# Template to create a new Grafana panel plugin [![Grafana 8](https://img.shields.io/badge/Grafana-8-orange)](https://www.grafana.com) ![CI](https://github.com/volkovlabs/grafana-abc-panel/workflows/CI/badge.svg) @@ -6,7 +6,7 @@ ## Introduction -The ABC Panel is a template to create new panel plugin for Grafana. +The ABC Panel is a template to create a new panel plugin for Grafana. ### Requirements @@ -14,17 +14,37 @@ Grafana 8.0 is required. ## Getting Started -Use the `grafana-cli` tool to install from the command line: +1. Install packages ```bash -grafana-cli plugins install abc-panel +yarn install +``` + +2. Build the plugin + +```bash +yarn build +``` + +3. Sign the plugins + +``` +export GRAFANA_API_KEY=erXXXX== +yarn sign +``` + +4. Start Docker container + +```bash +yarn run start ``` ## Features -- Use `docker-compose` to start development environment with provisioned datasource and dashboard. +- Use `docker-compose` to start development environment with provisioned data source and dashboard. - Provides unit test configuration. - Based on the latest version of Grafana. +- Includes GitHub Actions for CI and Release. ## Feedback diff --git a/package.json b/package.json index 3520fdb..6db4ff1 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "engines": { "node": ">=14" }, - "name": "abc-panel", + "name": "grafana-abc-panel", "scripts": { "build": "grafana-toolkit plugin:build --coverage", "dev": "grafana-toolkit plugin:dev", diff --git a/src/abc-panel/abc-panel.test.tsx b/src/abc-panel/abc-panel.test.tsx index f656718..a919365 100644 --- a/src/abc-panel/abc-panel.test.tsx +++ b/src/abc-panel/abc-panel.test.tsx @@ -20,8 +20,34 @@ describe('Panel', () => { return ; }; - const wrapper = shallow(getComponent({ date: { series: [] } })); + const wrapper = shallow(getComponent({})); const div = wrapper.find('div'); expect(div.exists()).toBeTruthy(); }); + + it('Should get the latest value', async () => { + const getComponent = ({ options = { name: 'data' }, ...restProps }: any) => { + const data = { + series: [ + toDataFrame({ + name: 'data', + refId: 'A', + fields: [ + { + name: 'data', + type: 'string', + values: ['Hello World!'], + }, + ], + }), + ], + }; + return ; + }; + + const wrapper = shallow(getComponent({})); + const div = wrapper.find('div'); + expect(div.exists()).toBeTruthy(); + expect(div.text()).toEqual('Hello World!'); + }); }); diff --git a/src/module.test.ts b/src/module.test.ts index 44bff1d..13b9625 100644 --- a/src/module.test.ts +++ b/src/module.test.ts @@ -17,9 +17,11 @@ describe('plugin', () => { addFieldNamePicker: jest.fn().mockImplementation(() => builder), }; + plugin['registerOptionEditors'](builder); + /** * Inputs */ - plugin['registerOptionEditors'](builder); + expect(builder.addFieldNamePicker).toHaveBeenCalled(); }); });