From 307888cc3b5e7d46c908c2d6bc9b87c32f888508 Mon Sep 17 00:00:00 2001 From: tanvipise <56138955+tanvipise@users.noreply.github.com> Date: Wed, 4 Oct 2023 13:39:38 -0500 Subject: [PATCH] Migrate from older Grafana toolkit to 'Create-plugin' (#46) * started plugin migration * migration completed * upgrade node version to 18 on github actions * Version update * Delete src/img/datasource-config.png * Add files via upload * updated jest setup file and updated snapshot * mpdified package.json . removed --watch from yarn test . * changed weboack cinfig * changed weboack config * changed weboack config --------- Co-authored-by: vishal kumar --- .config/.eslintrc | 13 + .config/.prettierrc.js | 16 + .config/Dockerfile | 16 + .config/README.md | 164 + .config/jest-setup.js | 25 + .config/jest.config.js | 43 + .config/jest/mocks/react-inlinesvg.tsx | 25 + .config/jest/utils.js | 31 + .config/tsconfig.json | 26 + .config/types/custom.d.ts | 37 + .config/webpack/constants.ts | 2 + .config/webpack/utils.ts | 59 + .config/webpack/webpack.config.ts | 213 + .eslintrc | 4 +- .github/workflows/frontend-unit-testing.yml | 6 +- .nvmrc | 1 + .prettierrc.js | 4 +- CHANGELOG.md | 5 + README.md | 1 + docker-compose.yaml | 16 + go.mod | 39 +- go.sum | 2166 ++- jest-setup.js | 32 + jest.config.js | 26 +- mage | 1 + package.json | 122 +- pkg/checkHealth_test.go | 9 +- pkg/datasource.go | 18 +- src/ConfigEditor.test.tsx | 28 +- src/PartListSection.tsx | 5 +- src/QueryEditor.tsx | 30 +- src/__snapshots__/ConfigEditor.test.tsx.snap | 630 +- src/datasource.ts | 2 +- src/img/datasource-config.png | Bin 89290 -> 66761 bytes src/{module.ts => module.js} | 0 src/types.ts | 2 + tsconfig.json | 14 +- yarn.lock | 17137 +++++++---------- 38 files changed, 10314 insertions(+), 10654 deletions(-) create mode 100644 .config/.eslintrc create mode 100644 .config/.prettierrc.js create mode 100644 .config/Dockerfile create mode 100644 .config/README.md create mode 100644 .config/jest-setup.js create mode 100644 .config/jest.config.js create mode 100644 .config/jest/mocks/react-inlinesvg.tsx create mode 100644 .config/jest/utils.js create mode 100644 .config/tsconfig.json create mode 100644 .config/types/custom.d.ts create mode 100644 .config/webpack/constants.ts create mode 100644 .config/webpack/utils.ts create mode 100644 .config/webpack/webpack.config.ts create mode 100644 .nvmrc create mode 100644 CHANGELOG.md create mode 100644 docker-compose.yaml create mode 100644 jest-setup.js create mode 160000 mage rename src/{module.ts => module.js} (100%) diff --git a/.config/.eslintrc b/.config/.eslintrc new file mode 100644 index 0000000..15ae260 --- /dev/null +++ b/.config/.eslintrc @@ -0,0 +1,13 @@ +/* + * ⚠️⚠️⚠️ 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 + */ + { + "extends": ["@grafana/eslint-config"], + "root": true, + "rules": { + "react/prop-types": "off" + } +} diff --git a/.config/.prettierrc.js b/.config/.prettierrc.js new file mode 100644 index 0000000..66a76ec --- /dev/null +++ b/.config/.prettierrc.js @@ -0,0 +1,16 @@ +/* + * ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️ + * + * In order to extend the configuration follow the steps in .config/README.md + */ + +module.exports = { + "endOfLine": "auto", + "printWidth": 120, + "trailingComma": "es5", + "semi": true, + "jsxSingleQuote": false, + "singleQuote": true, + "useTabs": false, + "tabWidth": 2 +}; \ No newline at end of file diff --git a/.config/Dockerfile b/.config/Dockerfile new file mode 100644 index 0000000..35d89bd --- /dev/null +++ b/.config/Dockerfile @@ -0,0 +1,16 @@ +ARG grafana_version=latest +ARG grafana_image=grafana-enterprise + +FROM grafana/${grafana_image}:${grafana_version} + +# 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_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 +USER root +RUN sed -i 's/<\/body><\/html>/