From b13d567eee55429a26c3876580932bdf66f6af42 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 17 Sep 2025 20:33:12 +0200 Subject: [PATCH] chore: bump @grafana/create-plugin configuration to 5.26.4 (#2082) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [`@grafana/create-plugin`](https://github.com/grafana/plugin-tools/tree/main/packages/create-plugin) configuration from 4.2.1 to 5.26.4. **Notes for reviewer:** This is an auto-generated PR which ran `@grafana/create-plugin update`. Please consult the create-plugin [CHANGELOG.md](https://github.com/grafana/plugin-tools/blob/main/packages/create-plugin/CHANGELOG.md) to understand what may have changed. Please review the changes thoroughly before merging. --------- Co-authored-by: grafana-plugins-platform-bot[bot] <144369747+grafana-plugins-platform-bot[bot]@users.noreply.github.com> Co-authored-by: Zoltán Bedi --- .changeset/fine-snails-move.md | 5 + .config/.cprc.json | 2 +- .config/.eslintrc | 11 +- .config/Dockerfile | 42 +- .config/README.md | 11 +- .config/docker-compose-base.yaml | 25 + .config/entrypoint.sh | 18 + .config/jest-setup.js | 9 +- .config/jest.config.js | 3 +- .config/jest/utils.js | 6 + .config/supervisord/supervisord.conf | 15 + .config/tsconfig.json | 2 +- .config/types/bundler-rules.d.ts | 37 + .config/types/webpack-plugins.d.ts | 83 + .config/webpack/BuildModeWebpackPlugin.ts | 33 + .config/webpack/utils.ts | 26 +- .config/webpack/webpack.config.ts | 128 +- .cprc.json | 7 + .github/workflows/is-compatible.yml | 19 +- .github/workflows/publish.yaml | 5 +- .github/workflows/push.yaml | 4 +- .gitignore | 8 + .yarn/releases/yarn-4.9.4.cjs | 942 + .yarnrc.yml | 3 + debug-backend.sh | 31 - devenv/grafana.ini | 10 - devenv/zabbix50/docker-compose.yml | 7 +- devenv/zabbix60/docker-compose.yml | 7 +- devenv/zabbix70/docker-compose.yml | 7 +- devenv/zabbix72/docker-compose.yml | 7 +- devenv/zabbix74/docker-compose.yml | 7 +- docker-compose.yml | 18 +- go.mod | 2 +- package.json | 58 +- pkg/datasource/resource_handler.go | 12 +- pkg/datasource/response_handler.go | 5 +- pkg/timeseries/align.go | 2 +- pkg/timeseries/timeseries.go | 7 +- pkg/zabbix/methods.go | 5 +- pkg/zabbixapi/zabbix_api.go | 8 +- .../zabbix_api_72_integration_test.go | 2 +- .../zabbix_api_74_integration_test.go | 2 +- src/components/MetricPicker/MetricPicker.tsx | 2 +- .../MetricPicker/MetricPickerMenu.tsx | 2 +- .../QueryEditor/QueryOptionsEditor.tsx | 4 +- src/datasource/problemsHandler.ts | 8 +- src/datasource/responseHandler.ts | 43 +- .../connectors/influxdb/influxdbConnector.ts | 5 +- .../zabbix/connectors/sql/sqlConnector.ts | 4 +- src/panel-triggers/ProblemsPanel.tsx | 2 +- .../components/ExecScriptModal.tsx | 6 +- .../components/ProblemColorEditor.tsx | 4 +- src/plugin.json | 5 +- yarn.lock | 24065 +++++++++------- 54 files changed, 15452 insertions(+), 10339 deletions(-) create mode 100644 .changeset/fine-snails-move.md create mode 100644 .config/docker-compose-base.yaml create mode 100644 .config/entrypoint.sh create mode 100644 .config/supervisord/supervisord.conf create mode 100644 .config/types/bundler-rules.d.ts create mode 100644 .config/types/webpack-plugins.d.ts create mode 100644 .config/webpack/BuildModeWebpackPlugin.ts create mode 100644 .cprc.json create mode 100755 .yarn/releases/yarn-4.9.4.cjs create mode 100644 .yarnrc.yml delete mode 100755 debug-backend.sh delete mode 100644 devenv/grafana.ini diff --git a/.changeset/fine-snails-move.md b/.changeset/fine-snails-move.md new file mode 100644 index 0000000..66db925 --- /dev/null +++ b/.changeset/fine-snails-move.md @@ -0,0 +1,5 @@ +--- +'grafana-zabbix': major +--- + +Bump grafana dependency to 11.6.0 diff --git a/.config/.cprc.json b/.config/.cprc.json index 99f06ad..a267584 100644 --- a/.config/.cprc.json +++ b/.config/.cprc.json @@ -1,3 +1,3 @@ { - "version": "4.2.1" + "version": "5.26.4" } diff --git a/.config/.eslintrc b/.config/.eslintrc index 1486ed2..eed6ea6 100644 --- a/.config/.eslintrc +++ b/.config/.eslintrc @@ -2,7 +2,7 @@ * ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️ * * In order to extend the configuration follow the steps in - * https://grafana.com/developers/plugin-tools/create-a-plugin/extend-a-plugin/extend-configurations#extend-the-eslint-config + * https://grafana.com/developers/plugin-tools/how-to-guides/extend-configurations#extend-the-eslint-config */ { "extends": ["@grafana/eslint-config"], @@ -12,14 +12,19 @@ }, "overrides": [ { - "plugins": ["deprecation"], "files": ["src/**/*.{ts,tsx}"], "rules": { - "deprecation/deprecation": "warn" + "@typescript-eslint/no-deprecated": "warn" }, "parserOptions": { "project": "./tsconfig.json" } + }, + { + "files": ["./tests/**/*"], + "rules": { + "react-hooks/rules-of-hooks": "off" + } } ] } diff --git a/.config/Dockerfile b/.config/Dockerfile index e0f1b2d..c55d9e1 100644 --- a/.config/Dockerfile +++ b/.config/Dockerfile @@ -3,14 +3,52 @@ ARG grafana_image=grafana-enterprise FROM grafana/${grafana_image}:${grafana_version} +ARG anonymous_auth_enabled=true +ARG development=false +ARG TARGETARCH + + +ENV DEV "${development}" + # Make it as simple as possible to access the grafana instance for development purposes # Do NOT enable these settings in a public facing / production grafana instance ENV GF_AUTH_ANONYMOUS_ORG_ROLE "Admin" -ENV GF_AUTH_ANONYMOUS_ENABLED "true" +ENV GF_AUTH_ANONYMOUS_ENABLED "${anonymous_auth_enabled}" ENV GF_AUTH_BASIC_ENABLED "false" # Set development mode so plugins can be loaded without the need to sign ENV GF_DEFAULT_APP_MODE "development" -# Inject livereload script into grafana index.html + +LABEL maintainer="Grafana Labs " + +ENV GF_PATHS_HOME="/usr/share/grafana" +WORKDIR $GF_PATHS_HOME + USER root + +# Installing supervisor and inotify-tools +RUN if [ "${development}" = "true" ]; then \ + if grep -i -q alpine /etc/issue; then \ + apk add supervisor inotify-tools git; \ + elif grep -i -q ubuntu /etc/issue; then \ + DEBIAN_FRONTEND=noninteractive && \ + apt-get update && \ + apt-get install -y supervisor inotify-tools git && \ + rm -rf /var/lib/apt/lists/*; \ + else \ + echo 'ERROR: Unsupported base image' && /bin/false; \ + fi \ + fi + +COPY supervisord/supervisord.conf /etc/supervisor.d/supervisord.ini +COPY supervisord/supervisord.conf /etc/supervisor/conf.d/supervisord.conf + + + +# Inject livereload script into grafana index.html RUN sed -i 's|||g' /usr/share/grafana/public/views/index.html + + +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/.config/README.md b/.config/README.md index a23b6d1..5ba3186 100644 --- a/.config/README.md +++ b/.config/README.md @@ -106,9 +106,9 @@ We are going to use [`webpack-merge`](https://github.com/survivejs/webpack-merge // webpack.config.ts import type { Configuration } from 'webpack'; import { merge } from 'webpack-merge'; -import grafanaConfig from './.config/webpack/webpack.config'; +import grafanaConfig, { type Env } from './.config/webpack/webpack.config'; -const config = async (env): Promise => { +const config = async (env: Env): Promise => { const baseConfig = await grafanaConfig(env); return merge(baseConfig, { @@ -151,14 +151,15 @@ version: '3.7' services: grafana: - container_name: 'myorg-basic-app' + extends: + file: .config/docker-compose-base.yaml + service: grafana build: - context: ./.config args: grafana_version: ${GRAFANA_VERSION:-9.1.2} grafana_image: ${GRAFANA_IMAGE:-grafana} ``` -In this example, we assign the environment variable `GRAFANA_IMAGE` to the build arg `grafana_image` with a default value of `grafana`. This will allow you to set the value while running the docker-compose commands, which might be convenient in some scenarios. +In this example, we assign the environment variable `GRAFANA_IMAGE` to the build arg `grafana_image` with a default value of `grafana`. This will allow you to set the value while running the docker compose commands, which might be convenient in some scenarios. --- diff --git a/.config/docker-compose-base.yaml b/.config/docker-compose-base.yaml new file mode 100644 index 0000000..20027f4 --- /dev/null +++ b/.config/docker-compose-base.yaml @@ -0,0 +1,25 @@ +services: + grafana: + user: root + container_name: 'alexanderzobnin-zabbix-app' + + build: + context: . + args: + grafana_image: ${GRAFANA_IMAGE:-grafana-enterprise} + grafana_version: ${GRAFANA_VERSION:-12.1.1} + development: ${DEVELOPMENT:-false} + anonymous_auth_enabled: ${ANONYMOUS_AUTH_ENABLED:-true} + ports: + - 3000:3000/tcp + volumes: + - ../dist:/var/lib/grafana/plugins/alexanderzobnin-zabbix-app + - ../provisioning:/etc/grafana/provisioning + - ..:/root/alexanderzobnin-zabbix-app + + environment: + NODE_ENV: development + GF_LOG_FILTERS: plugin.alexanderzobnin-zabbix-app:debug + GF_LOG_LEVEL: debug + GF_DATAPROXY_LOGGING: 1 + GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS: alexanderzobnin-zabbix-app diff --git a/.config/entrypoint.sh b/.config/entrypoint.sh new file mode 100644 index 0000000..00c69f2 --- /dev/null +++ b/.config/entrypoint.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +if [ "${DEV}" = "false" ]; then + echo "Starting test mode" + exec /run.sh +fi + +echo "Starting development mode" + +if grep -i -q alpine /etc/issue; then + exec /usr/bin/supervisord -c /etc/supervisord.conf +elif grep -i -q ubuntu /etc/issue; then + exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf +else + echo 'ERROR: Unsupported base image' + exit 1 +fi + diff --git a/.config/jest-setup.js b/.config/jest-setup.js index 1b9fc2f..7b1771e 100644 --- a/.config/jest-setup.js +++ b/.config/jest-setup.js @@ -2,15 +2,18 @@ * ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️ * * In order to extend the configuration follow the steps in - * https://grafana.com/developers/plugin-tools/create-a-plugin/extend-a-plugin/extend-configurations#extend-the-jest-config + * https://grafana.com/developers/plugin-tools/how-to-guides/extend-configurations#extend-the-jest-config */ import '@testing-library/jest-dom'; +import { TextEncoder, TextDecoder } from 'util'; + +Object.assign(global, { TextDecoder, TextEncoder }); // https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom Object.defineProperty(global, 'matchMedia', { writable: true, - value: jest.fn().mockImplementation((query) => ({ + value: (query) => ({ matches: false, media: query, onchange: null, @@ -19,7 +22,7 @@ Object.defineProperty(global, 'matchMedia', { addEventListener: jest.fn(), removeEventListener: jest.fn(), dispatchEvent: jest.fn(), - })), + }), }); HTMLCanvasElement.prototype.getContext = () => {}; diff --git a/.config/jest.config.js b/.config/jest.config.js index 94489cb..efe1938 100644 --- a/.config/jest.config.js +++ b/.config/jest.config.js @@ -2,7 +2,7 @@ * ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️ * * In order to extend the configuration follow the steps in - * https://grafana.com/developers/plugin-tools/create-a-plugin/extend-a-plugin/extend-configurations#extend-the-jest-config + * https://grafana.com/developers/plugin-tools/how-to-guides/extend-configurations#extend-the-jest-config */ const path = require('path'); @@ -40,4 +40,5 @@ module.exports = { // Jest will throw `Cannot use import statement outside module` if it tries to load an // ES module without it being transformed first. ./config/README.md#esm-errors-with-jest transformIgnorePatterns: [nodeModulesToTransform(grafanaESModules)], + watchPathIgnorePatterns: ['/node_modules', '/dist'], }; diff --git a/.config/jest/utils.js b/.config/jest/utils.js index fdca0de..55d9cb6 100644 --- a/.config/jest/utils.js +++ b/.config/jest/utils.js @@ -14,12 +14,18 @@ const nodeModulesToTransform = (moduleNames) => `node_modules\/(?!.*(${moduleNam const grafanaESModules = [ '.pnpm', // Support using pnpm symlinked packages '@grafana/schema', + '@wojtekmaj/date-utils', 'd3', 'd3-color', 'd3-force', 'd3-interpolate', 'd3-scale-chromatic', + 'get-user-locale', + 'marked', + 'memoize', + 'mimic-function', 'ol', + 'react-calendar', 'react-colorful', 'rxjs', 'uuid', diff --git a/.config/supervisord/supervisord.conf b/.config/supervisord/supervisord.conf new file mode 100644 index 0000000..47624f0 --- /dev/null +++ b/.config/supervisord/supervisord.conf @@ -0,0 +1,15 @@ +[supervisord] +nodaemon=true +user=root + +[program:grafana] +user=root +directory=/var/lib/grafana +command=/run.sh +stdout_logfile=/dev/fd/1 +stdout_logfile_maxbytes=0 +redirect_stderr=true +killasgroup=true +stopasgroup=true +autostart=true + diff --git a/.config/tsconfig.json b/.config/tsconfig.json index 207b28f..c0fc6d4 100644 --- a/.config/tsconfig.json +++ b/.config/tsconfig.json @@ -2,7 +2,7 @@ * ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️ * * In order to extend the configuration follow the steps in - * https://grafana.com/developers/plugin-tools/create-a-plugin/extend-a-plugin/extend-configurations#extend-the-typescript-config + * https://grafana.com/developers/plugin-tools/how-to-guides/extend-configurations#extend-the-typescript-config */ { "compilerOptions": { diff --git a/.config/types/bundler-rules.d.ts b/.config/types/bundler-rules.d.ts new file mode 100644 index 0000000..e67197c --- /dev/null +++ b/.config/types/bundler-rules.d.ts @@ -0,0 +1,37 @@ +// Image declarations +declare module '*.gif' { + const src: string; + export default src; +} + +declare module '*.jpg' { + const src: string; + export default src; +} + +declare module '*.jpeg' { + const src: string; + export default src; +} + +declare module '*.png' { + const src: string; + export default src; +} + +declare module '*.webp' { + const src: string; + export default src; +} + +declare module '*.svg' { + const src: string; + export default src; +} + +// Font declarations +declare module '*.woff'; +declare module '*.woff2'; +declare module '*.eot'; +declare module '*.ttf'; +declare module '*.otf'; diff --git a/.config/types/webpack-plugins.d.ts b/.config/types/webpack-plugins.d.ts new file mode 100644 index 0000000..6dbab10 --- /dev/null +++ b/.config/types/webpack-plugins.d.ts @@ -0,0 +1,83 @@ +declare module 'replace-in-file-webpack-plugin' { + import { Compiler, Plugin } from 'webpack'; + + interface ReplaceRule { + search: string | RegExp; + replace: string | ((match: string) => string); + } + + interface ReplaceOption { + dir?: string; + files?: string[]; + test?: RegExp | RegExp[]; + rules: ReplaceRule[]; + } + + class ReplaceInFilePlugin extends Plugin { + constructor(options?: ReplaceOption[]); + options: ReplaceOption[]; + apply(compiler: Compiler): void; + } + + export = ReplaceInFilePlugin; +} + +declare module 'webpack-livereload-plugin' { + import { ServerOptions } from 'https'; + import { Compiler, Plugin, Stats, Compilation } from 'webpack'; + + interface Options extends Pick { + /** + * protocol for livereload `