Skip to content

Commit 2c19eff

Browse files
committed
Run npx @grafana/create-plugin@latest update
1 parent 3566435 commit 2c19eff

21 files changed

+1263
-1416
lines changed

.config/.cprc.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"version": "5.5.1"
3-
}
2+
"version": "6.1.1",
3+
"features": {}
4+
}

.config/.eslintrc

Lines changed: 0 additions & 25 deletions
This file was deleted.

.config/Dockerfile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ ARG grafana_image=grafana-enterprise
33

44
FROM grafana/${grafana_image}:${grafana_version}
55

6+
ARG anonymous_auth_enabled=true
67
ARG development=false
78
ARG TARGETARCH
89

@@ -14,7 +15,7 @@ ENV DEV "${development}"
1415
# Make it as simple as possible to access the grafana instance for development purposes
1516
# Do NOT enable these settings in a public facing / production grafana instance
1617
ENV GF_AUTH_ANONYMOUS_ORG_ROLE "Admin"
17-
ENV GF_AUTH_ANONYMOUS_ENABLED "true"
18+
ENV GF_AUTH_ANONYMOUS_ENABLED "${anonymous_auth_enabled}"
1819
ENV GF_AUTH_BASIC_ENABLED "false"
1920
# Set development mode so plugins can be loaded without the need to sign
2021
ENV GF_DEFAULT_APP_MODE "development"
@@ -30,14 +31,14 @@ USER root
3031
# Installing supervisor and inotify-tools
3132
RUN if [ "${development}" = "true" ]; then \
3233
if grep -i -q alpine /etc/issue; then \
33-
apk add supervisor inotify-tools git; \
34+
apk add supervisor inotify-tools git; \
3435
elif grep -i -q ubuntu /etc/issue; then \
35-
DEBIAN_FRONTEND=noninteractive && \
36-
apt-get update && \
37-
apt-get install -y supervisor inotify-tools git && \
38-
rm -rf /var/lib/apt/lists/*; \
36+
DEBIAN_FRONTEND=noninteractive && \
37+
apt-get update && \
38+
apt-get install -y supervisor inotify-tools git && \
39+
rm -rf /var/lib/apt/lists/*; \
3940
else \
40-
echo 'ERROR: Unsupported base image' && /bin/false; \
41+
echo 'ERROR: Unsupported base image' && /bin/false; \
4142
fi \
4243
fi
4344

.config/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ We are going to use [`webpack-merge`](https://github.com/survivejs/webpack-merge
106106
// webpack.config.ts
107107
import type { Configuration } from 'webpack';
108108
import { merge } from 'webpack-merge';
109-
import grafanaConfig from './.config/webpack/webpack.config';
109+
import grafanaConfig, { type Env } from './.config/webpack/webpack.config';
110110

111-
const config = async (env): Promise<Configuration> => {
111+
const config = async (env: Env): Promise<Configuration> => {
112112
const baseConfig = await grafanaConfig(env);
113113

114114
return merge(baseConfig, {
@@ -151,9 +151,10 @@ version: '3.7'
151151

152152
services:
153153
grafana:
154-
container_name: 'myorg-basic-app'
154+
extends:
155+
file: .config/docker-compose-base.yaml
156+
service: grafana
155157
build:
156-
context: ./.config
157158
args:
158159
grafana_version: ${GRAFANA_VERSION:-9.1.2}
159160
grafana_image: ${GRAFANA_IMAGE:-grafana}

.config/bundler/externals.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import type { Configuration, ExternalItemFunctionData } from 'webpack';
2+
3+
type ExternalsType = Configuration['externals'];
4+
5+
export const externals: ExternalsType = [
6+
// Required for dynamic publicPath resolution
7+
{ 'amd-module': 'module' },
8+
'lodash',
9+
'jquery',
10+
'moment',
11+
'slate',
12+
'emotion',
13+
'@emotion/react',
14+
'@emotion/css',
15+
'prismjs',
16+
'slate-plain-serializer',
17+
'@grafana/slate-react',
18+
'react',
19+
'react-dom',
20+
'react-redux',
21+
'redux',
22+
'rxjs',
23+
'i18next',
24+
'react-router',
25+
'react-router-dom',
26+
'd3',
27+
'angular',
28+
/^@grafana\/ui/i,
29+
/^@grafana\/runtime/i,
30+
/^@grafana\/data/i,
31+
32+
// Mark legacy SDK imports as external if their name starts with the "grafana/" prefix
33+
({ request }: ExternalItemFunctionData, callback: (error?: Error, result?: string) => void) => {
34+
const prefix = 'grafana/';
35+
const hasPrefix = (request: string) => request.indexOf(prefix) === 0;
36+
const stripPrefix = (request: string) => request.slice(prefix.length);
37+
38+
if (request && hasPrefix(request)) {
39+
return callback(undefined, stripPrefix(request));
40+
}
41+
42+
callback();
43+
},
44+
];

.config/docker-compose-base.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
services:
2+
grafana:
3+
user: root
4+
container_name: 'grafana-clickhouse-datasource'
5+
6+
build:
7+
context: .
8+
args:
9+
grafana_image: ${GRAFANA_IMAGE:-grafana-enterprise}
10+
grafana_version: ${GRAFANA_VERSION:-12.2.0}
11+
development: ${DEVELOPMENT:-false}
12+
anonymous_auth_enabled: ${ANONYMOUS_AUTH_ENABLED:-true}
13+
ports:
14+
- 3000:3000/tcp
15+
- 2345:2345/tcp # delve
16+
security_opt:
17+
- 'apparmor:unconfined'
18+
- 'seccomp:unconfined'
19+
cap_add:
20+
- SYS_PTRACE
21+
volumes:
22+
- ../dist:/var/lib/grafana/plugins/grafana-clickhouse-datasource
23+
- ../provisioning:/etc/grafana/provisioning
24+
- ..:/root/grafana-clickhouse-datasource
25+
26+
environment:
27+
NODE_ENV: development
28+
GF_LOG_FILTERS: plugin.grafana-clickhouse-datasource:debug
29+
GF_LOG_LEVEL: debug
30+
GF_DATAPROXY_LOGGING: 1
31+
GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS: grafana-clickhouse-datasource

.config/eslint.config.mjs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { defineConfig } from 'eslint/config';
2+
import grafanaConfig from '@grafana/eslint-config/flat.js';
3+
4+
export default defineConfig([
5+
...grafanaConfig,
6+
{
7+
rules: {
8+
'react/prop-types': 'off',
9+
},
10+
},
11+
{
12+
files: ['src/**/*.{ts,tsx}'],
13+
14+
languageOptions: {
15+
parserOptions: {
16+
project: './tsconfig.json',
17+
},
18+
},
19+
20+
rules: {
21+
'@typescript-eslint/no-deprecated': 'warn',
22+
},
23+
},
24+
{
25+
files: ['./tests/**/*'],
26+
27+
rules: {
28+
'react-hooks/rules-of-hooks': 'off',
29+
},
30+
},
31+
]);

.config/jest-setup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️
33
*
44
* In order to extend the configuration follow the steps in
5-
* https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-jest-config
5+
* https://grafana.com/developers/plugin-tools/how-to-guides/extend-configurations#extend-the-jest-config
66
*/
77

88
import '@testing-library/jest-dom';

.config/jest.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️
33
*
44
* In order to extend the configuration follow the steps in
5-
* https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-jest-config
5+
* https://grafana.com/developers/plugin-tools/how-to-guides/extend-configurations#extend-the-jest-config
66
*/
77

88
const path = require('path');
@@ -40,4 +40,5 @@ module.exports = {
4040
// Jest will throw `Cannot use import statement outside module` if it tries to load an
4141
// ES module without it being transformed first. ./config/README.md#esm-errors-with-jest
4242
transformIgnorePatterns: [nodeModulesToTransform(grafanaESModules)],
43+
watchPathIgnorePatterns: ['<rootDir>/node_modules', '<rootDir>/dist'],
4344
};

.config/jest/utils.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,18 @@ const nodeModulesToTransform = (moduleNames) => `node_modules\/(?!.*(${moduleNam
1414
const grafanaESModules = [
1515
'.pnpm', // Support using pnpm symlinked packages
1616
'@grafana/schema',
17+
'@wojtekmaj/date-utils',
1718
'd3',
1819
'd3-color',
1920
'd3-force',
2021
'd3-interpolate',
2122
'd3-scale-chromatic',
23+
'get-user-locale',
24+
'marked',
25+
'memoize',
26+
'mimic-function',
2227
'ol',
28+
'react-calendar',
2329
'react-colorful',
2430
'rxjs',
2531
'uuid',

0 commit comments

Comments
 (0)