From 06b14e5a1363ac402158b0981b02914338a61a69 Mon Sep 17 00:00:00 2001 From: Yury Moladau Date: Mon, 5 Feb 2024 11:41:15 +0100 Subject: [PATCH] init base structure project --- .config/.cprc.json | 3 + .config/.eslintrc | 25 + .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 | 58 + .config/webpack/webpack.config.ts | 218 + .cprc.json | 3 + .eslintrc | 29 + .github/workflows/ci.yml | 90 + .github/workflows/is-compatible.yml | 19 + .github/workflows/release.yml | 25 + .gitignore | 36 + .nvmrc | 1 + .prettierrc.js | 4 + .vscode/launch.json | 14 + CHANGELOG.md | 3 + LICENSE | 201 + Makefile | 117 + README.md | 133 + cypress.json | 3 + cypress/integration/01-smoke.spec.ts | 10 + docker-compose.yaml | 50 + go.mod | 66 + go.sum | 401 + jest-setup.js | 2 + jest.config.js | 8 + package-lock.json | 21638 ++++++++++++++++ package.json | 77 + pkg/main.go | 24 + pkg/plugin/datasource.go | 109 + pkg/plugin/datasource_test.go | 28 + provisioning/README.md | 1 + provisioning/datasources/.gitkeep | 0 provisioning/datasources/datasources.yml | 10 + src/README.md | 51 + .../QueryEditor/QueryCodeEditor.tsx | 99 + src/components/QueryEditor/QueryEditor.tsx | 220 + .../QueryEditor/QueryEditorByApp.tsx | 0 .../QueryEditor/QueryEditorForAlerting.tsx | 25 + src/components/QueryEditor/QueryField.tsx | 93 + src/components/QueryEditor/state.ts | 0 .../monaco-query-field/MonacoQueryField.tsx | 299 + .../MonacoQueryFieldLazy.tsx | 30 + .../MonacoQueryFieldProps.ts | 36 + .../MonacoQueryFieldWrapper.tsx | 52 + src/configuration/AlertingSettings.tsx | 40 + src/configuration/ConfigEditor.tsx | 95 + src/configuration/HelpfulLinks.tsx | 40 + src/configuration/QuerySettings.tsx | 88 + src/datasource.ts | 78 + src/img/logo.svg | 6 + src/module.ts | 9 + src/plugin.json | 36 + src/types.ts | 48 + tsconfig.json | 15 + 63 files changed, 25151 insertions(+) create mode 100644 .config/.cprc.json 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 .cprc.json create mode 100644 .eslintrc create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/is-compatible.yml create mode 100644 .github/workflows/release.yml create mode 100644 .gitignore create mode 100644 .nvmrc create mode 100644 .prettierrc.js create mode 100644 .vscode/launch.json create mode 100644 CHANGELOG.md create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 README.md create mode 100644 cypress.json create mode 100644 cypress/integration/01-smoke.spec.ts create mode 100644 docker-compose.yaml create mode 100644 go.mod create mode 100644 go.sum create mode 100644 jest-setup.js create mode 100644 jest.config.js create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 pkg/main.go create mode 100644 pkg/plugin/datasource.go create mode 100644 pkg/plugin/datasource_test.go create mode 100644 provisioning/README.md create mode 100644 provisioning/datasources/.gitkeep create mode 100644 provisioning/datasources/datasources.yml create mode 100644 src/README.md create mode 100644 src/components/QueryEditor/QueryCodeEditor.tsx create mode 100644 src/components/QueryEditor/QueryEditor.tsx create mode 100644 src/components/QueryEditor/QueryEditorByApp.tsx create mode 100644 src/components/QueryEditor/QueryEditorForAlerting.tsx create mode 100644 src/components/QueryEditor/QueryField.tsx create mode 100644 src/components/QueryEditor/state.ts create mode 100755 src/components/monaco-query-field/MonacoQueryField.tsx create mode 100755 src/components/monaco-query-field/MonacoQueryFieldLazy.tsx create mode 100755 src/components/monaco-query-field/MonacoQueryFieldProps.ts create mode 100755 src/components/monaco-query-field/MonacoQueryFieldWrapper.tsx create mode 100644 src/configuration/AlertingSettings.tsx create mode 100644 src/configuration/ConfigEditor.tsx create mode 100644 src/configuration/HelpfulLinks.tsx create mode 100644 src/configuration/QuerySettings.tsx create mode 100644 src/datasource.ts create mode 100644 src/img/logo.svg create mode 100644 src/module.ts create mode 100644 src/plugin.json create mode 100644 src/types.ts create mode 100644 tsconfig.json diff --git a/.config/.cprc.json b/.config/.cprc.json new file mode 100644 index 0000000..f27700c --- /dev/null +++ b/.config/.cprc.json @@ -0,0 +1,3 @@ +{ + "version": "3.0.0" +} diff --git a/.config/.eslintrc b/.config/.eslintrc new file mode 100644 index 0000000..1486ed2 --- /dev/null +++ b/.config/.eslintrc @@ -0,0 +1,25 @@ +/* + * ⚠️⚠️⚠️ 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" + }, + "overrides": [ + { + "plugins": ["deprecation"], + "files": ["src/**/*.{ts,tsx}"], + "rules": { + "deprecation/deprecation": "warn" + }, + "parserOptions": { + "project": "./tsconfig.json" + } + } + ] +} diff --git a/.config/.prettierrc.js b/.config/.prettierrc.js new file mode 100644 index 0000000..bf506f5 --- /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, +}; 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>/