Skip to content

Commit 194d7d2

Browse files
committed
ci config
1 parent 81a9010 commit 194d7d2

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

.circleci/config.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,21 @@ jobs:
4949
- run:
5050
name: Build and test frontend
5151
command: ./node_modules/.bin/grafana-toolkit plugin:ci-build
52+
- run:
53+
name: Run test with coverage
54+
command: ./node_modules/.bin/grafana-toolkit plugin:test --coverage
55+
- run:
56+
name: Setup Code Climate test-reporter
57+
command: |
58+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
59+
chmod +x ./cc-test-reporter
60+
./cc-test-reporter before-build
61+
when: always
62+
- run:
63+
name: Send coverage report to Code Climate
64+
command:
65+
./cc-test-reporter after-build -t lcov
66+
when: always
5267
- run:
5368
name: Move results to ci folder
5469
command: ./node_modules/.bin/grafana-toolkit plugin:ci-build --finish
@@ -63,5 +78,7 @@ jobs:
6378
- ci/packages
6479
- ci/dist
6580
- ci/grafana-test-env
81+
- coverage/lcov.info
6682
- store_artifacts:
6783
path: ci
84+
path: coverage/lcov.info

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Grafana Button Control Panel
22

3+
[![CircleCI](https://circleci.com/gh/speakyourcode/grafana-button-panel.svg?style=shield)](https://circleci.com/gh/speakyourcode/grafana-button-panel)
4+
[![David Dependency Status](https://david-dm.org/speakyourcode/grafana-button-panel.svg)](https://david-dm.org/speakyourcode/grafana-button-panel)
5+
[![David Dev Dependency Status](https://david-dm.org/speakyourcode/grafana-button-panel/dev-status.svg)](https://david-dm.org/speakyourcode/grafana-button-panel/?type=dev)
6+
[![Known Vulnerabilities](https://snyk.io/test/github/speakyourcode/grafana-button-panel/badge.svg)](https://snyk.io/test/github/speakyourcode/grafana-button-panel)
7+
[![Maintainability](https://api.codeclimate.com/v1/badges/3d8db85bc1cc2b95d314/maintainability)](https://codeclimate.com/github/speakyourcode/grafana-button-panel/maintainability)
8+
[![Test Coverage](https://api.codeclimate.com/v1/badges/3d8db85bc1cc2b95d314/test_coverage)](https://codeclimate.com/github/speakyourcode/grafana-button-panel/test_coverage)
9+
310
This panel allows you to create buttons and define actions for them. It can be
411
used to add controlling functionality to your dashboards. Actions are defined as
512
queries to Datasources.

src/editor.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,17 @@ export interface EditorProps {
1818
}
1919

2020
export const Editor: React.FC<EditorProps> = ({ buttons, onChange }) => {
21-
const [elems, setElems] = React.useState<SelectableValue<string>[]>();
21+
const [elems, setElems] = React.useState<Array<SelectableValue<string>>>();
2222
const [isOpen, setOpen] = React.useState<boolean[]>(buttons.map(e => false));
2323
React.useEffect(() => {
2424
let cancel = false;
2525
const fetchData = async () => {
2626
const ds = await getBackendSrv().get('/api/datasources');
27-
if (!cancel)
27+
if (!cancel) {
2828
setElems(
2929
ds.map((i: any) => ({ label: i.name, value: i.name, name: i.name }))
3030
);
31+
}
3132
};
3233
fetchData();
3334
return (): void => {

0 commit comments

Comments
 (0)