diff --git a/.betterer.results b/.betterer.results index fbe38508f3d..6ad6560471f 100644 --- a/.betterer.results +++ b/.betterer.results @@ -447,9 +447,6 @@ exports[`better eslint`] = { "packages/grafana-prometheus/src/components/PromQueryField.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], - "packages/grafana-prometheus/src/components/PrometheusMetricsBrowser.tsx:5381": [ - [0, 0, 0, "\'HorizontalGroup\' import from \'@grafana/ui\' is restricted from being used by a pattern. Use Stack component instead.", "0"] - ], "packages/grafana-prometheus/src/datasource.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"], @@ -2907,6 +2904,9 @@ exports[`better eslint`] = { "public/app/features/dashboard-scene/scene/PanelMenuBehavior.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], + "public/app/features/dashboard-scene/scene/Scopes/ScopesInput.tsx:5381": [ + [0, 0, 0, "Do not use any type assertions.", "0"] + ], "public/app/features/dashboard-scene/scene/row-actions/RowActions.tsx:5381": [ [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], @@ -3085,9 +3085,6 @@ exports[`better eslint`] = { [0, 0, 0, "Do not re-export imported variable (\`./VersionHistoryButtons\`)", "3"], [0, 0, 0, "Do not re-export imported variable (\`./VersionHistoryComparison\`)", "4"] ], - "public/app/features/dashboard-scene/sharing/ShareButton/ShareButton.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], "public/app/features/dashboard-scene/sharing/ShareExportTab.tsx:5381": [ [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] ], @@ -6430,8 +6427,7 @@ exports[`better eslint`] = { [0, 0, 0, "Styles should be written using objects.", "0"] ], "public/app/plugins/datasource/graphite/components/GraphiteFunctionEditor.tsx:5381": [ - [0, 0, 0, "\'HorizontalGroup\' import from \'@grafana/ui\' is restricted from being used by a pattern. Use Stack component instead.", "0"], - [0, 0, 0, "Styles should be written using objects.", "1"] + [0, 0, 0, "Styles should be written using objects.", "0"] ], "public/app/plugins/datasource/graphite/components/GraphiteQueryEditor.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"], @@ -6571,9 +6567,6 @@ exports[`better eslint`] = { [0, 0, 0, "Styles should be written using objects.", "0"], [0, 0, 0, "Styles should be written using objects.", "1"] ], - "public/app/plugins/datasource/influxdb/components/editor/query/influxql/code/RawInfluxQLEditor.tsx:5381": [ - [0, 0, 0, "\'HorizontalGroup\' import from \'@grafana/ui\' is restricted from being used by a pattern. Use Stack component instead.", "0"] - ], "public/app/plugins/datasource/influxdb/components/editor/query/influxql/visual/VisualInfluxQLEditor.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"] ], diff --git a/.eslintrc b/.eslintrc index 71d0b6fbcac..9ad2a337f47 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,5 +1,5 @@ { - "extends": ["@grafana/eslint-config"], + "extends": ["@grafana/eslint-config", "plugin:react/jsx-runtime"], "root": true, "plugins": ["@emotion", "lodash", "jest", "import", "jsx-a11y", "@grafana", "no-barrel-files"], "settings": { diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 2b3f0c836ab..0e8ccfc1f9b 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -443,7 +443,7 @@ playwright.config.ts @grafana/plugins-platform-frontend /public/app/features/storage/ @grafana/grafana-app-platform-squad /public/app/features/teams/ @grafana/access-squad /public/app/features/templating/ @grafana/dashboards-squad -/public/app/features/trails/ @torkelo +/public/app/features/trails/ @grafana/observability-metrics /public/app/features/transformers/ @grafana/dataviz-squad /public/app/features/transformers/timeSeriesTable/ @grafana/dataviz-squad @grafana/app-o11y-visualizations /public/app/features/users/ @grafana/access-squad @@ -673,6 +673,7 @@ embed.go @grafana/grafana-as-code /.github/workflows/bump-version.yml @grafana/grafana-release-guild /.github/workflows/close-milestone.yml @grafana/grafana-release-guild /.github/workflows/release-pr.yml @grafana/grafana-release-guild +/.github/workflows/release-comms.yml @grafana/grafana-release-guild /.github/workflows/codeowners-validator.yml @tolzhabayev /.github/workflows/codeql-analysis.yml @DanCech /.github/workflows/commands.yml @torkelo diff --git a/.github/commands.json b/.github/commands.json index f61aedbe409..9a6cc66fb79 100644 --- a/.github/commands.json +++ b/.github/commands.json @@ -112,7 +112,7 @@ "name":"datasource/InfluxDB", "action":"addToProject", "addToProject":{ - "url":"https://github.com/orgs/grafana/projects/112" + "url":"https://github.com/orgs/grafana/projects/190" } }, { @@ -120,7 +120,7 @@ "name":"datasource/Graphite", "action":"addToProject", "addToProject":{ - "url":"https://github.com/orgs/grafana/projects/112" + "url":"https://github.com/orgs/grafana/projects/190" } }, { @@ -128,7 +128,7 @@ "name":"datasource/OpenTSDB", "action":"addToProject", "addToProject":{ - "url":"https://github.com/orgs/grafana/projects/112" + "url":"https://github.com/orgs/grafana/projects/190" } }, { diff --git a/.github/workflows/auto-milestone.yml b/.github/workflows/auto-milestone.yml index 7b38cb0b01d..0697888fba0 100644 --- a/.github/workflows/auto-milestone.yml +++ b/.github/workflows/auto-milestone.yml @@ -9,6 +9,7 @@ on: permissions: pull-requests: write + contents: write # Note: this action runs with write permissions on GITHUB_TOKEN even from forks # so it must not run untrusted code (such as checking out the pull request) diff --git a/.github/workflows/release-comms.yml b/.github/workflows/release-comms.yml new file mode 100644 index 00000000000..8e5e862ed61 --- /dev/null +++ b/.github/workflows/release-comms.yml @@ -0,0 +1,36 @@ +# This workflow runs whenever the release PR is merged. It includes post-release communication processes like +# posting to slack, the website, community forums, etc. +# Only things that happen after a release is completed and all of the necessary code changes (like the changelog) are made. +name: Post-release +on: + workflow_dispatch: + inputs: + dry_run: + required: false + default: true + version: + required: true + pull_request: + types: + - closed + branches: + - 'main' + - 'v*.*.*' +jobs: + post_release: + name: Post-release comms + env: + steps: + - if: github.event.workflow_dispatch + run: | + echo "VERSION=${{ inputs.version }}" >> $GITHUB_ENV + echo "DRY_RUN=${{ inputs.dry_run }}" >> $GITHUB_ENV + - if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/') + run: | + echo "VERSION=$(echo ${{ github.head_ref }} | sed -e 's/release\///g')" >> $GITHUB_ENV + echo "DRY_RUN=false" >> $GITHUB_ENV + - run: "echo push-grafana-tag $VERSION (dry run: $DRY_RUN)" + - run: "echo post changelog to forums for $VERSION (dry run: $DRY_RUN)" + - run: "echo create github release" + - run: "echo publish docs for $VERSION (dry run: $DRY_RUN)" + - run: "announce on slack that $VERSION has been released (dry run: $DRY_RUN)" diff --git a/CHANGELOG.md b/CHANGELOG.md index d523e856cf8..564fcd92374 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,289 @@ + + +# 11.1.0 (2024-06-21) + +### Features and enhancements + +- **Tracing:** Enable traces to profiles. [#88896](https://github.com/grafana/grafana/issues/88896), [@marefr](https://github.com/marefr) +- **Auth:** Add org to role mappings support to Google integration. [#88891](https://github.com/grafana/grafana/issues/88891), [@kalleep](https://github.com/kalleep) +- **Alerting:** Support AWS SNS integration in Grafana. [#88867](https://github.com/grafana/grafana/issues/88867), [@yuri-tceretian](https://github.com/yuri-tceretian) +- **Auth:** Add org to role mappings support to Okta integration. [#88770](https://github.com/grafana/grafana/issues/88770), [@mgyongyosi](https://github.com/mgyongyosi) +- **Auth:** Add org to role mappings support to Gitlab integration. [#88751](https://github.com/grafana/grafana/issues/88751), [@kalleep](https://github.com/kalleep) +- **Cloudwatch:** Use the metric map from grafana-aws-sdk. [#88733](https://github.com/grafana/grafana/issues/88733), [@iwysiu](https://github.com/iwysiu) +- **Alerting:** Add option to use Redis in cluster mode for Alerting HA. [#88696](https://github.com/grafana/grafana/issues/88696), [@fayzal-g](https://github.com/fayzal-g) +- **VizTooltip:** Allow setting the `maxWidth` option. [#88652](https://github.com/grafana/grafana/issues/88652), [@adela-almasan](https://github.com/adela-almasan) +- **Auth:** Add org to role mappings support to GitHub integration . [#88537](https://github.com/grafana/grafana/issues/88537), [@mgyongyosi](https://github.com/mgyongyosi) +- **CloudWatch:** Handle permissions error and update docs. [#88524](https://github.com/grafana/grafana/issues/88524), [@iwysiu](https://github.com/iwysiu) +- ** Alerting:** Correctly handle duplicating notification templates. [#88487](https://github.com/grafana/grafana/issues/88487), [@gillesdemey](https://github.com/gillesdemey) +- **Alerting:** Mute Timing service to prevent changing provenance status to none. [#88462](https://github.com/grafana/grafana/issues/88462), [@yuri-tceretian](https://github.com/yuri-tceretian) +- **Alerting:** Ensure we fetch AM config before saving new configuration. [#88458](https://github.com/grafana/grafana/issues/88458), [@tomratcliffe](https://github.com/tomratcliffe) +- **Alerting:** Remove regex reference in silences filter tooltip. [#88455](https://github.com/grafana/grafana/issues/88455), [@tomratcliffe](https://github.com/tomratcliffe) +- **Cloudwatch:** Update AWS DynamoDB Metrics. [#88418](https://github.com/grafana/grafana/issues/88418), [@LeonardoBoleli](https://github.com/LeonardoBoleli) +- **Alerting:** Make regex notification routing preview consistent with notification policies implementation. [#88413](https://github.com/grafana/grafana/issues/88413), [@tomratcliffe](https://github.com/tomratcliffe) +- **DateTimePicker:** Return cleared value in onChange. [#88377](https://github.com/grafana/grafana/issues/88377), [@Clarity-89](https://github.com/Clarity-89) +- **NodeGraph:** Add msagl and the layered layout code. [#88375](https://github.com/grafana/grafana/issues/88375), [@aocenas](https://github.com/aocenas) +- **API:** Add in theme support to /render/\* endpoint. [#88304](https://github.com/grafana/grafana/issues/88304), [@timlevett](https://github.com/timlevett) +- **Alerting:** Add filters for RouteGetRuleStatuses. [#88295](https://github.com/grafana/grafana/issues/88295), [@fayzal-g](https://github.com/fayzal-g) +- **Plugins:** Update the `plugin.json` schema with UI extensions meta-data. [#88288](https://github.com/grafana/grafana/issues/88288), [@leventebalogh](https://github.com/leventebalogh) +- **Auth:** Update SAML lib to improve HTTP-Post binding. [#88287](https://github.com/grafana/grafana/issues/88287), [@mgyongyosi](https://github.com/mgyongyosi) +- **Tempo:** Send current filters when retrieving tags for AdHocFilters. [#88270](https://github.com/grafana/grafana/issues/88270), [@joey-grafana](https://github.com/joey-grafana) +- **Tempo:** Support standard span convention. [#88268](https://github.com/grafana/grafana/issues/88268), [@fabrizio-grafana](https://github.com/fabrizio-grafana) +- **ValueFormats:** Add Uruguay peso currency. [#88260](https://github.com/grafana/grafana/issues/88260), [@lfdominguez](https://github.com/lfdominguez) +- **DateTimePicker:** Add clearable prop. [#88215](https://github.com/grafana/grafana/issues/88215), [@Clarity-89](https://github.com/Clarity-89) +- **Correlations:** Enable feature toggle by default (on-prem). [#88208](https://github.com/grafana/grafana/issues/88208), [@ifrost](https://github.com/ifrost) +- **Stat:** Add percent change color modes. [#88205](https://github.com/grafana/grafana/issues/88205), [@drew08t](https://github.com/drew08t) +- **Logs:** Added multi-line display control to the "wrap lines" option. [#88144](https://github.com/grafana/grafana/issues/88144), [@matyax](https://github.com/matyax) +- **Tempo:** Update lezer autocomplete (histogram, quantile) and add missing functions. [#88131](https://github.com/grafana/grafana/issues/88131), [@joey-grafana](https://github.com/joey-grafana) +- **AnnotationsPlugin2:** Implement support for rectangular annotations in Heatmap. [#88107](https://github.com/grafana/grafana/issues/88107), [@adrapereira](https://github.com/adrapereira) +- **CodeEditor:** Improved styles when the code editor is loading. [#88102](https://github.com/grafana/grafana/issues/88102), [@NWRichmond](https://github.com/NWRichmond) +- **CloudWatch:** Add additional AWS/KinesisAnalytics metrics . [#88101](https://github.com/grafana/grafana/issues/88101), [@tristanburgess](https://github.com/tristanburgess) +- **Cloudwatch:** Add AWS/Events Metrics. [#88097](https://github.com/grafana/grafana/issues/88097), [@LeonardoBoleli](https://github.com/LeonardoBoleli) +- **Azure:** Basic Logs support. [#88025](https://github.com/grafana/grafana/issues/88025), [@aangelisc](https://github.com/aangelisc) +- **Dashboard:** Make dashboard search faster. [#88019](https://github.com/grafana/grafana/issues/88019), [@knuzhdin](https://github.com/knuzhdin) +- **Alerting:** Support custom API URL for PagerDuty integration. [#88007](https://github.com/grafana/grafana/issues/88007), [@gaurav1999](https://github.com/gaurav1999) +- **Alerting:** Add optional metadata via query param to silence GET requests. [#88000](https://github.com/grafana/grafana/issues/88000), [@JacobsonMT](https://github.com/JacobsonMT) +- **Store:** Enable adding extra middleware. [#87984](https://github.com/grafana/grafana/issues/87984), [@Clarity-89](https://github.com/Clarity-89) +- **Tempo:** Don't modify the passed time range when using timeShiftEnabled. [#87980](https://github.com/grafana/grafana/issues/87980), [@aocenas](https://github.com/aocenas) +- **InfluxDB:** Introduce maxDataPoints setting for flux variable query editor. [#87935](https://github.com/grafana/grafana/issues/87935), [@itsmylife](https://github.com/itsmylife) +- **Alerting:** New list view UI – Part 1. [#87907](https://github.com/grafana/grafana/issues/87907), [@gillesdemey](https://github.com/gillesdemey) +- **NodeGraph:** Remove msagl lib and layered layout option. [#87905](https://github.com/grafana/grafana/issues/87905), [@aocenas](https://github.com/aocenas) +- **InfluxDB:** Introduce custom variable support. [#87903](https://github.com/grafana/grafana/issues/87903), [@itsmylife](https://github.com/itsmylife) +- **Gops:** Add tracking for data source check. [#87886](https://github.com/grafana/grafana/issues/87886), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron) +- **AzureMonitor:** Prometheus exemplars support . [#87742](https://github.com/grafana/grafana/issues/87742), [@aangelisc](https://github.com/aangelisc) +- **Feature Management:** Move awsDatasourcesNewFormStyling to GA. [#87696](https://github.com/grafana/grafana/issues/87696), [@idastambuk](https://github.com/idastambuk) +- **TimeRangePicker:** Announce to screen reader when time range is updated. [#87692](https://github.com/grafana/grafana/issues/87692), [@tskarhed](https://github.com/tskarhed) +- **Alerting:** Template selector in contact points form. [#87689](https://github.com/grafana/grafana/issues/87689), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron) +- **Azure:** Load custom clouds from ini file. [#87667](https://github.com/grafana/grafana/issues/87667), [@JonCole](https://github.com/JonCole) +- **Loki:** Kick start your query now applies templates to the current query. [#87658](https://github.com/grafana/grafana/issues/87658), [@matyax](https://github.com/matyax) +- **Elasticsearch:** Queries no longer executed while typing. [#87652](https://github.com/grafana/grafana/issues/87652), [@matyax](https://github.com/matyax) +- **Alerting:** Add options to configure TLS for HA using Redis. [#87567](https://github.com/grafana/grafana/issues/87567), [@fayzal-g](https://github.com/fayzal-g) +- **VizLegend:** Represent line style in series legend and tooltip. [#87558](https://github.com/grafana/grafana/issues/87558), [@domasx2](https://github.com/domasx2) +- **FeatureBadge:** Update FeatureBadge to support current release stages. [#87555](https://github.com/grafana/grafana/issues/87555), [@ivanahuckova](https://github.com/ivanahuckova) +- **Logs:** Infinite scrolling in Explore enabled by default. [#87493](https://github.com/grafana/grafana/issues/87493), [@matyax](https://github.com/matyax) +- **Plugins:** Improve frontend loader cache. [#87488](https://github.com/grafana/grafana/issues/87488), [@jackw](https://github.com/jackw) +- **Chore:** Upgrade go from 1.21.0 to 1.21.10. [#87479](https://github.com/grafana/grafana/issues/87479), [@stephaniehingtgen](https://github.com/stephaniehingtgen) +- **Chore:** Upgrade go to 1.22.3. [#87463](https://github.com/grafana/grafana/issues/87463), [@stephaniehingtgen](https://github.com/stephaniehingtgen) +- **Team:** Add an endpoint for bulk team membership updates. [#87441](https://github.com/grafana/grafana/issues/87441), [@IevaVasiljeva](https://github.com/IevaVasiljeva) +- **Flamegraph:** Add collapse and expand group buttons to toolbar. [#87395](https://github.com/grafana/grafana/issues/87395), [@aocenas](https://github.com/aocenas) +- **OIDC:** Support Generic OAuth org to role mappings. [#87394](https://github.com/grafana/grafana/issues/87394), [@sathieu](https://github.com/sathieu) +- **Search:** Announce to screen reader when query returns no result. [#87382](https://github.com/grafana/grafana/issues/87382), [@tskarhed](https://github.com/tskarhed) +- **Logs:** Added support for numeric log levels. [#87366](https://github.com/grafana/grafana/issues/87366), [@nailgun](https://github.com/nailgun) +- **Prometheus:** Place custom inputs first when using regex filter values in the query builder. [#87360](https://github.com/grafana/grafana/issues/87360), [@NWRichmond](https://github.com/NWRichmond) +- **Alerting:** Remove requirement for datasource query on rule read. [#87349](https://github.com/grafana/grafana/issues/87349), [@rwwiv](https://github.com/rwwiv) +- **Alerting:** Add RBAC logic for silences creation. [#87322](https://github.com/grafana/grafana/issues/87322), [@tomratcliffe](https://github.com/tomratcliffe) +- **Alerting:** Update silences creation to support `__alert_rule_uid__` and move into drawer. [#87320](https://github.com/grafana/grafana/issues/87320), [@tomratcliffe](https://github.com/tomratcliffe) +- **Flamegraph:** Add diff mode color legend. [#87319](https://github.com/grafana/grafana/issues/87319), [@aocenas](https://github.com/aocenas) +- **Dashboard:** Keyboard and mouse panel shortcuts improvement. [#87317](https://github.com/grafana/grafana/issues/87317), [@tskarhed](https://github.com/tskarhed) +- **PanelHeaderCorner:** Remove font-awesome icons. [#87303](https://github.com/grafana/grafana/issues/87303), [@Clarity-89](https://github.com/Clarity-89) +- **Alerting:** Add OAuth2 to HTTP settings for vanilla Alertmanager / Mimir. [#87272](https://github.com/grafana/grafana/issues/87272), [@gillesdemey](https://github.com/gillesdemey) +- **Plugins:** Allow apps to expose components. Update the extensions API. [#87236](https://github.com/grafana/grafana/issues/87236), [@leventebalogh](https://github.com/leventebalogh) +- **Plugins:** Catalog to show all plugins by default. [#87168](https://github.com/grafana/grafana/issues/87168), [@sympatheticmoose](https://github.com/sympatheticmoose) +- **Prometheus:** Ensure values in metric selector are visible. [#87150](https://github.com/grafana/grafana/issues/87150), [@NWRichmond](https://github.com/NWRichmond) +- **Select:** Add data-testid to Input. [#87105](https://github.com/grafana/grafana/issues/87105), [@Clarity-89](https://github.com/Clarity-89) +- **Prometheus:** Add native histogram types metric explorer to allow filter by type. [#87090](https://github.com/grafana/grafana/issues/87090), [@bohandley](https://github.com/bohandley) +- **Prometheus:** Add hints for native histograms. [#87017](https://github.com/grafana/grafana/issues/87017), [@bohandley](https://github.com/bohandley) +- **Alerting:** Reduce number of request fetching rules in the dashboard view using rtkq. [#86991](https://github.com/grafana/grafana/issues/86991), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron) +- **Plugins:** Make grafana-com API URL usage consistent. [#86920](https://github.com/grafana/grafana/issues/86920), [@oshirohugo](https://github.com/oshirohugo) +- **Stack:** Add size props. [#86900](https://github.com/grafana/grafana/issues/86900), [@Clarity-89](https://github.com/Clarity-89) +- **Table Panel:** Enable Text Wrapping. [#86895](https://github.com/grafana/grafana/issues/86895), [@codeincarnate](https://github.com/codeincarnate) +- **Alerting:** Get grafana-managed alert rule by UID. [#86845](https://github.com/grafana/grafana/issues/86845), [@fayzal-g](https://github.com/fayzal-g) +- **Cloudwatch:** Add Kendra metrics. [#86809](https://github.com/grafana/grafana/issues/86809), [@scottschreckengaust](https://github.com/scottschreckengaust) +- **Auth:** Added support to filter for parent teams in GitHub connector's team membership filter. [#86754](https://github.com/grafana/grafana/issues/86754), [@wasim-nihal](https://github.com/wasim-nihal) +- **Alerting:** Hook up GMA silence APIs to new authentication handler. [#86625](https://github.com/grafana/grafana/issues/86625), [@JacobsonMT](https://github.com/JacobsonMT) +- **GeoMap:** Pan and zoom keyboard support. [#86573](https://github.com/grafana/grafana/issues/86573), [@tskarhed](https://github.com/tskarhed) +- **Alerting:** Optimize rule status gathering APIs when a limit is applied. [#86568](https://github.com/grafana/grafana/issues/86568), [@stevesg](https://github.com/stevesg) +- **Plugins:** Add an auto-generated part to the `plugin.json` schema. [#86520](https://github.com/grafana/grafana/issues/86520), [@leventebalogh](https://github.com/leventebalogh) +- **Loki/Prometheus Query Editor:** Disabled cmd/ctrl+f keybinding within the editor. [#86418](https://github.com/grafana/grafana/issues/86418), [@matyax](https://github.com/matyax) +- **Grafana packages:** Remove E2E workspace. [#86416](https://github.com/grafana/grafana/issues/86416), [@sunker](https://github.com/sunker) +- **RefreshPicker:** Change running state to be less distracting . [#86405](https://github.com/grafana/grafana/issues/86405), [@torkelo](https://github.com/torkelo) +- **Prometheus:** Cancellable label values requests. [#86403](https://github.com/grafana/grafana/issues/86403), [@NWRichmond](https://github.com/NWRichmond) +- **SQLStore:** Improve recursive CTE support detection. [#86397](https://github.com/grafana/grafana/issues/86397), [@mildwonkey](https://github.com/mildwonkey) +- **CloudMonitoring:** Ensure variables can be used in all variable queries. [#86377](https://github.com/grafana/grafana/issues/86377), [@aangelisc](https://github.com/aangelisc) +- **Common labels/displayed fields:** Show label names with values. [#86345](https://github.com/grafana/grafana/issues/86345), [@matyax](https://github.com/matyax) +- **AuthZ:** Further protect admin endpoints. [#86285](https://github.com/grafana/grafana/issues/86285), [@IevaVasiljeva](https://github.com/IevaVasiljeva) +- **Explore:** Deprecate local storage singular datasource key. [#86250](https://github.com/grafana/grafana/issues/86250), [@gelicia](https://github.com/gelicia) +- **Loki:** Add label filters after label_format if present. [#86124](https://github.com/grafana/grafana/issues/86124), [@matyax](https://github.com/matyax) +- **Alerting:** Immutable plugin rules and alerting plugins extensions. [#86042](https://github.com/grafana/grafana/issues/86042), [@konrad147](https://github.com/konrad147) +- **Tempo:** Group by template vars. [#86022](https://github.com/grafana/grafana/issues/86022), [@joey-grafana](https://github.com/joey-grafana) +- **Short Links:** Add setting for changing expiration time. [#86003](https://github.com/grafana/grafana/issues/86003), [@gelicia](https://github.com/gelicia) +- **Prometheus:** Add native histogram functions. [#86002](https://github.com/grafana/grafana/issues/86002), [@bohandley](https://github.com/bohandley) +- **Plugins:** Removed feature toggle pluginsDynamicAngularDetectionPatterns. [#85956](https://github.com/grafana/grafana/issues/85956), [@xnyo](https://github.com/xnyo) +- **Plugins:** Removed feature toggle enablePluginsTracingByDefault. [#85953](https://github.com/grafana/grafana/issues/85953), [@xnyo](https://github.com/xnyo) +- **Tracing:** Allow otel service name and attributes to be overridden from env. [#85937](https://github.com/grafana/grafana/issues/85937), [@marefr](https://github.com/marefr) +- **PanelChrome:** Improve accessibility landmark markup. [#85863](https://github.com/grafana/grafana/issues/85863), [@tskarhed](https://github.com/tskarhed) +- **Gops:** Add configuration tracker on the existing IRM page. [#85838](https://github.com/grafana/grafana/issues/85838), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron) +- **CloudWatch:** Add additional Glue metrics. [#85798](https://github.com/grafana/grafana/issues/85798), [@tristanburgess](https://github.com/tristanburgess) +- **CloudWatch:** Add labels for Metric Query type queries. [#85766](https://github.com/grafana/grafana/issues/85766), [@kevinwcyu](https://github.com/kevinwcyu) +- **Util:** Support parsing and splitting strings enclosed in quotes in util.SplitString. [#85735](https://github.com/grafana/grafana/issues/85735), [@mgyongyosi](https://github.com/mgyongyosi) +- **Loki:** Handle `X-Scope-OrgID` and tenant IDs. [#85726](https://github.com/grafana/grafana/issues/85726), [@fabrizio-grafana](https://github.com/fabrizio-grafana) +- **CloudWatch:** Add a Performance Insights and other missing metrics to aws/rds. [#85680](https://github.com/grafana/grafana/issues/85680), [@kgeckhart](https://github.com/kgeckhart) +- **Prometheus:** Respect dashboard queries when querying ad hoc filter labels. [#85674](https://github.com/grafana/grafana/issues/85674), [@itsmylife](https://github.com/itsmylife) +- **Pyroscope:** Add adhoc filters support. [#85601](https://github.com/grafana/grafana/issues/85601), [@aocenas](https://github.com/aocenas) +- **Table Panel:** Update background colors to respect transparency. [#85565](https://github.com/grafana/grafana/issues/85565), [@codeincarnate](https://github.com/codeincarnate) +- **Canvas:** Add support for line animation. [#85556](https://github.com/grafana/grafana/issues/85556), [@adela-almasan](https://github.com/adela-almasan) +- **Reducers:** Add in basic Percentile Support. [#85554](https://github.com/grafana/grafana/issues/85554), [@timlevett](https://github.com/timlevett) +- **Storage:** Watch tests. [#85496](https://github.com/grafana/grafana/issues/85496), [@DanCech](https://github.com/DanCech) +- **Plugins:** Show update buttons when instance version is different. [#85486](https://github.com/grafana/grafana/issues/85486), [@oshirohugo](https://github.com/oshirohugo) +- **Tempo:** Always use time range even if timeShiftEnabled is false. [#85477](https://github.com/grafana/grafana/issues/85477), [@ogxd](https://github.com/ogxd) +- **Alerting:** Gops labels integration. [#85467](https://github.com/grafana/grafana/issues/85467), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron) +- **Explore:** Set X-Cache-Skip to true for query requests. [#85460](https://github.com/grafana/grafana/issues/85460), [@Elfo404](https://github.com/Elfo404) +- **Explore:** Make Explore breadcrumb clickable. [#85437](https://github.com/grafana/grafana/issues/85437), [@Elfo404](https://github.com/Elfo404) +- **Prometheus:** Fuzzy search for metric names in Code Mode. [#85396](https://github.com/grafana/grafana/issues/85396), [@NWRichmond](https://github.com/NWRichmond) +- **Storage Api:** Adds traces. [#85391](https://github.com/grafana/grafana/issues/85391), [@owensmallwood](https://github.com/owensmallwood) +- **Storage Api:** Add metrics. [#85316](https://github.com/grafana/grafana/issues/85316), [@owensmallwood](https://github.com/owensmallwood) +- **Alerting:** Improve paused alert visibility and allow pausing/resuming from alert list view. [#85116](https://github.com/grafana/grafana/issues/85116), [@tomratcliffe](https://github.com/tomratcliffe) +- **CloudWatch:** Clarify match exact tooltip and docs. [#85095](https://github.com/grafana/grafana/issues/85095), [@iwysiu](https://github.com/iwysiu) +- **Alerting:** Evaluation quick buttons. [#85010](https://github.com/grafana/grafana/issues/85010), [@gillesdemey](https://github.com/gillesdemey) +- **Alerting:** Add state history polling interval. [#84837](https://github.com/grafana/grafana/issues/84837), [@gillesdemey](https://github.com/gillesdemey) +- **CloudWatch:** Improve metric label parsing. [#84835](https://github.com/grafana/grafana/issues/84835), [@iwysiu](https://github.com/iwysiu) +- **Alerting:** Improve template preview. [#84798](https://github.com/grafana/grafana/issues/84798), [@konrad147](https://github.com/konrad147) +- **Alerting:** New settings page. [#84501](https://github.com/grafana/grafana/issues/84501), [@gillesdemey](https://github.com/gillesdemey) +- **Explore:** Move Query History to be screen wide. [#84321](https://github.com/grafana/grafana/issues/84321), [@gelicia](https://github.com/gelicia) +- **MixedDataSource:** Support multi value data source variable that issues a query to each data source. [#83356](https://github.com/grafana/grafana/issues/83356), [@torkelo](https://github.com/torkelo) +- **PluginExtensions:** Make the extensions registry reactive. [#83085](https://github.com/grafana/grafana/issues/83085), [@mckn](https://github.com/mckn) +- **Loki:** Use label/<name>/values API instead of series API for label values discovery. [#83044](https://github.com/grafana/grafana/issues/83044), [@yuri-rs](https://github.com/yuri-rs) +- **Tempo:** Escape backslash in span name for promsql query. [#83024](https://github.com/grafana/grafana/issues/83024), [@ttshivers](https://github.com/ttshivers) +- **Alerting:** Export and provisioning rules into subfolders. [#77450](https://github.com/grafana/grafana/issues/77450), [@papagian](https://github.com/papagian) +- **Notification banner:** Integrate with RBAC. (Enterprise) +- **Auth:** Assign users using SAML to AutoAssignOrgRole if no role matches. (Enterprise) +- **Notification banner:** Display preview. (Enterprise) +- **Auth:** Add None and Viewer roles as options to SAML UI config. (Enterprise) +- **SAML:** Add nonce to the generated script tag. (Enterprise) +- **Notification banner:** Add settings page. (Enterprise) +- **Notification banner:** Add API client. (Enterprise) +- **Chore:** Upgrade go version to 1.22.3. (Enterprise) +- **Auditing:** Correctly parse the URL for auditing through Loki. (Enterprise) +- **Auditlog:** Refactor action to post-action in default auditlogging. (Enterprise) +- **Plugins:** Make grafana-com API URL usage consistent. (Enterprise) +- **Plugins:** Make grafana-com API URL usage consistent. (Enterprise) +- **Caching:** Implement mtls-enabled memcached integration. (Enterprise) +- **OpenAPI:** Document the datasource caching API. (Enterprise) + +### Bug fixes + +- **Alerting:** Fix go-swagger extraction and several embedded types from Alertmanager in Swagger docs. [#88879](https://github.com/grafana/grafana/issues/88879), [@alexweav](https://github.com/alexweav) +- **DashboardScene:** Fixes inspect with transforms issue. [#88843](https://github.com/grafana/grafana/issues/88843), [@torkelo](https://github.com/torkelo) +- **Elasticsearch:** Fix stripping of trailing slashes in datasource URLs. [#88779](https://github.com/grafana/grafana/issues/88779), [@ivanahuckova](https://github.com/ivanahuckova) +- **Loki:** Fix editor history in wrong order. [#88666](https://github.com/grafana/grafana/issues/88666), [@svennergr](https://github.com/svennergr) +- **Cli:** Fix bug where password is hashed twice. [#88589](https://github.com/grafana/grafana/issues/88589), [@kalleep](https://github.com/kalleep) +- **AzureMonitor:** Fix bug detecting app insights queries. [#88572](https://github.com/grafana/grafana/issues/88572), [@aangelisc](https://github.com/aangelisc) +- **SSE:** Fix threshold unmarshal to avoid panic. [#88521](https://github.com/grafana/grafana/issues/88521), [@yuri-tceretian](https://github.com/yuri-tceretian) +- **Dashboard:** Fix Variables query hides fields with non-supported datasources. [#88516](https://github.com/grafana/grafana/issues/88516), [@axelavargas](https://github.com/axelavargas) +- **Explore:** Align time filters properly to day boundaries in query history. [#88498](https://github.com/grafana/grafana/issues/88498), [@aocenas](https://github.com/aocenas) +- **Access Control:** Clean up permissions for deprovisioned data sources. [#88483](https://github.com/grafana/grafana/issues/88483), [@IevaVasiljeva](https://github.com/IevaVasiljeva) +- **Dashboards:** Correctly display Admin access to dashboards in the UI. [#88439](https://github.com/grafana/grafana/issues/88439), [@IevaVasiljeva](https://github.com/IevaVasiljeva) +- **LibraryPanels/RBAC:** Ignore old folder permission check when deleting/patching lib panel. [#88422](https://github.com/grafana/grafana/issues/88422), [@kaydelaney](https://github.com/kaydelaney) +- **LogsTable:** Fix default sort by time. [#88398](https://github.com/grafana/grafana/issues/88398), [@svennergr](https://github.com/svennergr) +- **Dashboards:** Fix regression when deleting folder. [#88311](https://github.com/grafana/grafana/issues/88311), [@papagian](https://github.com/papagian) +- **Docker:** Fix renderer plugin in custom Dockerfile. [#88223](https://github.com/grafana/grafana/issues/88223), [@AgnesToulet](https://github.com/AgnesToulet) +- **Alerting:** Fix rules deleting when reordering whilst filtered. [#88221](https://github.com/grafana/grafana/issues/88221), [@tomratcliffe](https://github.com/tomratcliffe) +- **Alerting:** Fix "copy link" not including full URL. [#88210](https://github.com/grafana/grafana/issues/88210), [@tomratcliffe](https://github.com/tomratcliffe) +- **Alerting:** Fix typo in JSON response for rule export. [#88028](https://github.com/grafana/grafana/issues/88028), [@yuri-tceretian](https://github.com/yuri-tceretian) +- **Alerting:** Fix scheduler to sort rules before evaluation. [#88006](https://github.com/grafana/grafana/issues/88006), [@yuri-tceretian](https://github.com/yuri-tceretian) +- **CloudMonitoring:** Fix query type selection issue. [#87990](https://github.com/grafana/grafana/issues/87990), [@aangelisc](https://github.com/aangelisc) +- **Alerting:** Assume built-in AM is receiving alerts in case of not having admin config. [#87893](https://github.com/grafana/grafana/issues/87893), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron) +- **DashboardScene:** Skip panel repeats when values are the same. [#87788](https://github.com/grafana/grafana/issues/87788), [@torkelo](https://github.com/torkelo) +- **Alerting:** Fix deleting rules when silencing/resuming rule from a panel alert tab. [#87710](https://github.com/grafana/grafana/issues/87710), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron) +- **Dashboards:** Don't set dashboard creator/updater if the action is done by an API key. [#87704](https://github.com/grafana/grafana/issues/87704), [@IevaVasiljeva](https://github.com/IevaVasiljeva) +- **Elasticsearch:** Fix setting of default maxConcurrentShardRequests. [#87703](https://github.com/grafana/grafana/issues/87703), [@ivanahuckova](https://github.com/ivanahuckova) +- **Graphite:** Fix alignment of elements in the query editor. [#87662](https://github.com/grafana/grafana/issues/87662), [@NWRichmond](https://github.com/NWRichmond) +- **DashboardScene:** Fixing major row repeat issues. [#87539](https://github.com/grafana/grafana/issues/87539), [@torkelo](https://github.com/torkelo) +- **Alerting:** Do not store series values from past evaluations in state manager for no reason. [#87525](https://github.com/grafana/grafana/issues/87525), [@alexweav](https://github.com/alexweav) +- **RBAC:** Update role picker in team page, fix a bug with roles being removed upon team setting update. [#87519](https://github.com/grafana/grafana/issues/87519), [@IevaVasiljeva](https://github.com/IevaVasiljeva) +- **Transformations:** Fix true inner join in `joinByField` transformation. [#87409](https://github.com/grafana/grafana/issues/87409), [@baldm0mma](https://github.com/baldm0mma) +- **Alerting:** Do not retry rule evaluations with "input data must be a wide series but got type long" style errors. [#87343](https://github.com/grafana/grafana/issues/87343), [@alexweav](https://github.com/alexweav) +- **Tempo:** Fix sorting for nested tables. [#87214](https://github.com/grafana/grafana/issues/87214), [@fabrizio-grafana](https://github.com/fabrizio-grafana) +- **Cloudwatch Logs:** Fix bug where we did not return errors to user. [#87190](https://github.com/grafana/grafana/issues/87190), [@sarahzinger](https://github.com/sarahzinger) +- **CloudWatch:** Fix apostrophes in dimension values not being escaped. [#87182](https://github.com/grafana/grafana/issues/87182), [@kevinwcyu](https://github.com/kevinwcyu) +- **AnnotationList:** Fix link for annotation with no panel or dashboard. [#87048](https://github.com/grafana/grafana/issues/87048), [@tskarhed](https://github.com/tskarhed) +- **Graphite:** Fix splitting expressions in tag_value with template variables. [#86958](https://github.com/grafana/grafana/issues/86958), [@EduardZaydler](https://github.com/EduardZaydler) +- **SQL Query Editor:** Fix label-for IDs, associate "Table" label. [#86944](https://github.com/grafana/grafana/issues/86944), [@timo](https://github.com/timo) +- **SSO:** Add SSO settings to secrets migrator. [#86913](https://github.com/grafana/grafana/issues/86913), [@dmihai](https://github.com/dmihai) +- **Plugins:** Preserve trailing slash in plugin proxy. [#86859](https://github.com/grafana/grafana/issues/86859), [@marefr](https://github.com/marefr) +- **TimeSeries:** Improve keyboard focus and fix spacebar override. [#86848](https://github.com/grafana/grafana/issues/86848), [@tskarhed](https://github.com/tskarhed) +- **NodeGraph:** Use values from fixedX/fixedY column for layout. [#86643](https://github.com/grafana/grafana/issues/86643), [@timo](https://github.com/timo) +- **Alerting:** Prevent simplified routing zero duration GroupInterval and RepeatInterval. [#86561](https://github.com/grafana/grafana/issues/86561), [@JacobsonMT](https://github.com/JacobsonMT) +- **Loki:** Fix setting of tenant ID. [#86433](https://github.com/grafana/grafana/issues/86433), [@fabrizio-grafana](https://github.com/fabrizio-grafana) +- **DashboardScene:** Fixes checkbox orienation in save forms. [#86408](https://github.com/grafana/grafana/issues/86408), [@torkelo](https://github.com/torkelo) +- **CloudMonitoring:** Correctly interpolate multi-valued template variables in PromQL queries. [#86391](https://github.com/grafana/grafana/issues/86391), [@aangelisc](https://github.com/aangelisc) +- **Expressions:** Fix erroneous sorting of metrics and expressions. [#86372](https://github.com/grafana/grafana/issues/86372), [@NWRichmond](https://github.com/NWRichmond) +- **CloudMonitoring:** Allow a custom group by value. [#86288](https://github.com/grafana/grafana/issues/86288), [@aangelisc](https://github.com/aangelisc) +- **DataLinks:** Fixes datalinks with onClick and variables in url not being interpolated . [#86253](https://github.com/grafana/grafana/issues/86253), [@gng0](https://github.com/gng0) +- **I18N:** Fix untranslated descriptions in data source picker. [#86216](https://github.com/grafana/grafana/issues/86216), [@joshhunt](https://github.com/joshhunt) +- **RBAC:** Fix global role deletion in hosted Grafana. [#85980](https://github.com/grafana/grafana/issues/85980), [@IevaVasiljeva](https://github.com/IevaVasiljeva) +- **Expression:** Fix a bug of the display name of the threshold expression result. [#85912](https://github.com/grafana/grafana/issues/85912), [@lingyufei](https://github.com/lingyufei) +- **Alerting:** Fix incorrect display of pending period in alert rule form. [#85893](https://github.com/grafana/grafana/issues/85893), [@tomratcliffe](https://github.com/tomratcliffe) +- **Alerting:** Fix redirect after saving a notification template. [#85667](https://github.com/grafana/grafana/issues/85667), [@tomratcliffe](https://github.com/tomratcliffe) +- **Alerting:** Get oncall metada only when we have alert manager configuration data. [#85622](https://github.com/grafana/grafana/issues/85622), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron) +- **Alerting:** Return better error for invalid time range on alert queries. [#85611](https://github.com/grafana/grafana/issues/85611), [@alexweav](https://github.com/alexweav) +- **CloudWatch:** Fix SageMaker MBP namespace typo. [#85557](https://github.com/grafana/grafana/issues/85557), [@tristanburgess](https://github.com/tristanburgess) +- **Alerting:** Only append `/alertmanager` when sending alerts to mimir targets if not already present. [#85543](https://github.com/grafana/grafana/issues/85543), [@alexweav](https://github.com/alexweav) +- **Alerting:** Set mimir implementation in jsonData by default when creating a new a…. [#85513](https://github.com/grafana/grafana/issues/85513), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron) +- **Alerting:** Persist silence state immediately on Create/Delete . [#84705](https://github.com/grafana/grafana/issues/84705), [@JacobsonMT](https://github.com/JacobsonMT) +- **NodeGraph:** Fix configuring arc colors with mixed case field names. [#84609](https://github.com/grafana/grafana/issues/84609), [@timo](https://github.com/timo) +- **Auditing:** Fix Loki URL parsing. (Enterprise) +- **Provisioning:** Add override option to role provisioning. (Enterprise) +- **Alerting:** Check pointers before use to prevent segfault. (Enterprise) +- **Reporting:** Fix UI errors when using linked variables. (Enterprise) + +### Breaking changes + +Users that provision alert rules into folders whose titles contain slashes from now on they should escape them: +eg. if an alert group contains: +`folder: folder_with_/_in_title` +it should become: +`folder: folder_with_\/_in_title` Issue [#77450](https://github.com/grafana/grafana/issues/77450) + +### Deprecations + +The `grafana.explore.richHistory.activeDatasourceOnly` local storage key is deprecated, and will be removed in Grafana 12. You may experience loss of your Explore query history or autocomplete data if you upgrade to Grafana 12 under 2 weeks of Grafana 11.1. Actual risk of data loss depends on your query history retention policy. Issue [#86250](https://github.com/grafana/grafana/issues/86250) + +### Plugin development fixes & changes + +- **Select:** Change `Select` group headers to always be visible. [#88178](https://github.com/grafana/grafana/issues/88178), [@ashharrison90](https://github.com/ashharrison90) +- **Select:** Ensure virtualised menu scrolls active option into view when using arrow keys. [#87743](https://github.com/grafana/grafana/issues/87743), [@ashharrison90](https://github.com/ashharrison90) +- **Switch:** Improve disabled active state. [#87694](https://github.com/grafana/grafana/issues/87694), [@ashharrison90](https://github.com/ashharrison90) +- **Button:** Allow disabled button to still be focused. [#87516](https://github.com/grafana/grafana/issues/87516), [@JoaoSilvaGrafana](https://github.com/JoaoSilvaGrafana) +- **GrafanaUI:** Add `tabular` prop to Text component for tabular numbers. [#87440](https://github.com/grafana/grafana/issues/87440), [@JoaoSilvaGrafana](https://github.com/JoaoSilvaGrafana) + + + + +# 11.0.1 (2024-06-21) + +### Bug fixes + +- **Echo:** Suppress errors from frontend-metrics API call failing. [#89493](https://github.com/grafana/grafana/issues/89493), [@joshhunt](https://github.com/joshhunt) +- **Fix:** Portuguese Brazilian wasn't loading translations. [#89374](https://github.com/grafana/grafana/issues/89374), [@JoaoSilvaGrafana](https://github.com/JoaoSilvaGrafana) +- **Analytics:** Fix ApplicationInsights integration. [#89300](https://github.com/grafana/grafana/issues/89300), [@ashharrison90](https://github.com/ashharrison90) +- **DashboardScene:** Fixes issue removing override rule. [#89134](https://github.com/grafana/grafana/issues/89134), [@torkelo](https://github.com/torkelo) +- **BrowseDashboards:** Prepend subpath to New Browse Dashboard actions. [#89130](https://github.com/grafana/grafana/issues/89130), [@joshhunt](https://github.com/joshhunt) +- **Alerting:** Fix rule storage to filter by group names using case-sensitive comparison. [#89063](https://github.com/grafana/grafana/issues/89063), [@yuri-tceretian](https://github.com/yuri-tceretian) +- **RBAC:** List only the folders that the user has access to. [#89015](https://github.com/grafana/grafana/issues/89015), [@IevaVasiljeva](https://github.com/IevaVasiljeva) +- **DashboardScene:** Fixes lack of re-render when updating field override properties. [#88985](https://github.com/grafana/grafana/issues/88985), [@torkelo](https://github.com/torkelo) +- **DashboardScene:** Fixes inspect with transforms issue. [#88862](https://github.com/grafana/grafana/issues/88862), [@torkelo](https://github.com/torkelo) +- **AzureMonitor:** Fix bug detecting app insights queries. [#88787](https://github.com/grafana/grafana/issues/88787), [@aangelisc](https://github.com/aangelisc) +- **Access Control:** Clean up permissions for deprovisioned data sources. [#88700](https://github.com/grafana/grafana/issues/88700), [@IevaVasiljeva](https://github.com/IevaVasiljeva) +- **Loki:** Fix editor history in wrong order. [#88669](https://github.com/grafana/grafana/issues/88669), [@svennergr](https://github.com/svennergr) +- **SSE:** Fix threshold unmarshal to avoid panic. [#88651](https://github.com/grafana/grafana/issues/88651), [@yuri-tceretian](https://github.com/yuri-tceretian) +- **LibraryPanels/RBAC:** Ignore old folder permission check when deleting/patching lib panel. [#88493](https://github.com/grafana/grafana/issues/88493), [@kaydelaney](https://github.com/kaydelaney) +- **Dashboards:** Correctly display Admin access to dashboards in the UI. [#88473](https://github.com/grafana/grafana/issues/88473), [@IevaVasiljeva](https://github.com/IevaVasiljeva) +- **LogsTable:** Fix default sort by time. [#88434](https://github.com/grafana/grafana/issues/88434), [@svennergr](https://github.com/svennergr) +- **Alerting:** Fix rules deleting when reordering whilst filtered. [#88285](https://github.com/grafana/grafana/issues/88285), [@gillesdemey](https://github.com/gillesdemey) +- **Alerting:** Fix typo in JSON response for rule export. [#88090](https://github.com/grafana/grafana/issues/88090), [@yuri-tceretian](https://github.com/yuri-tceretian) +- **CloudMonitoring:** Fix query type selection issue. [#88024](https://github.com/grafana/grafana/issues/88024), [@aangelisc](https://github.com/aangelisc) +- **Alerting:** Fix scheduler to sort rules before evaluation. [#88021](https://github.com/grafana/grafana/issues/88021), [@yuri-tceretian](https://github.com/yuri-tceretian) +- **DashboardScene:** Skip panel repeats when values are the same. [#87896](https://github.com/grafana/grafana/issues/87896), [@torkelo](https://github.com/torkelo) +- **Alerting:** Do not store series values from past evaluations in state manager for no reason. [#87845](https://github.com/grafana/grafana/issues/87845), [@alexweav](https://github.com/alexweav) +- **DashboardScene:** Fixing major row repeat issues. [#87800](https://github.com/grafana/grafana/issues/87800), [@torkelo](https://github.com/torkelo) +- **DashboardScene:** Fixes checkbox orienation in save forms. [#86490](https://github.com/grafana/grafana/issues/86490), [@torkelo](https://github.com/torkelo) +- **Provisioning:** Add override option to role provisioning. (Enterprise) + +### Breaking changes + +If you had selected your language as "Português Brasileiro" previously, this will be reset. You have to select it again in your Preferences for the fix to be applied and the translations will then be shown. Issue [#89374](https://github.com/grafana/grafana/issues/89374) + + # 11.0.0 (2024-05-14) @@ -350,6 +636,16 @@ The deprecated `email` field to send a report via `/api/reports/email` endpoint - **Grafana UI:** Add code variant to Text component. [#82318](https://github.com/grafana/grafana/issues/82318), [@tskarhed](https://github.com/tskarhed) + + +# 10.4.5 (2024-06-21) + +### Bug fixes + +- **Echo:** Suppress errors from frontend-metrics API call failing. [#89498](https://github.com/grafana/grafana/issues/89498), [@joshhunt](https://github.com/joshhunt) +- **Azure Monitor:** Add validation for namespace field in AdvancedResourcePicker when entering a forward slash. [#89313](https://github.com/grafana/grafana/issues/89313), [@adamyeats](https://github.com/adamyeats) + + # 10.4.4 (2024-06-13) @@ -651,6 +947,15 @@ Any consumers of the specific API should be appropriately adapted. Issue [#74600 - **Grafana/UI:** Add new Splitter component . [#82357](https://github.com/grafana/grafana/issues/82357), [@torkelo](https://github.com/torkelo) + + +# 10.3.7 (2024-06-21) + +### Bug fixes + +- **Echo:** Suppress errors from frontend-metrics API call failing. [#89497](https://github.com/grafana/grafana/issues/89497), [@joshhunt](https://github.com/joshhunt) + + # 10.3.6 (2024-05-13) @@ -827,6 +1132,15 @@ Users who have InfluxDB datasource configured with SQL querying language must up Removes `NamespaceID` from responses of all GET routes underneath the path `/api/ruler/grafana/api/v1/rules` - 3 affected endpoints. All affected routes are not in the publicly documented or `stable` marked portion of the ngalert API. This only breaks clients who are directly using the unstable portion of the API. Such clients should use `NamespaceUID` rather than `NamespaceID` to identify namespaces. Issue [#79359](https://github.com/grafana/grafana/issues/79359) + + +# 10.2.8 (2024-06-21) + +### Bug fixes + +- **Elasticsearch:** Fix URL creation and allowlist for `/_mapping` requests. [#87711](https://github.com/grafana/grafana/issues/87711), [@svennergr](https://github.com/svennergr) + + # 10.2.7 (2024-05-13) @@ -2650,6 +2964,11 @@ The `database` field has been deprecated in the Elasticsearch datasource provisi - **InteractiveTable:** Updated design and minor tweak to Correlactions page. [#66443](https://github.com/grafana/grafana/issues/66443), [@torkelo](https://github.com/torkelo) + + +# 9.5.20 (2024-06-21) + + # 9.5.19 (2024-05-13) diff --git a/conf/defaults.ini b/conf/defaults.ini index f9e230c580e..aa746872133 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -1387,6 +1387,12 @@ loki_basic_auth_password = # Optional max query length for queries sent to Loki. Default is 721h which matches the default Loki value. loki_max_query_length = 721h +# For "loki" only. +# Maximum size in bytes for queries sent to Loki. This limit is applied to user provided filters as well as system defined ones, e.g. applied by access control. +# If filter exceeds the limit, API returns error with code "alerting.state-history.loki.requestTooLong". +# Default is 64kb +loki_max_query_size = 65536 + [unified_alerting.state_history.external_labels] # Optional extra labels to attach to outbound state history records or log streams. # Any number of label key-value-pairs can be provided. diff --git a/conf/sample.ini b/conf/sample.ini index 5257c046add..e261822eb57 100644 --- a/conf/sample.ini +++ b/conf/sample.ini @@ -1379,6 +1379,12 @@ disabled_labels = # Optional max query length for queries sent to Loki. Default is 721h which matches the default Loki value. ; loki_max_query_length = 360h +# For "loki" only. +# Maximum size in bytes for queries sent to Loki. This limit is applied to user provided filters as well as system defined ones, e.g. applied by access control. +# If filter exceeds the limit, API returns error with code "alerting.state-history.loki.requestTooLong". +# Default is 64kb +;loki_max_query_size = 65536 + [unified_alerting.state_history.external_labels] # Optional extra labels to attach to outbound state history records or log streams. # Any number of label key-value-pairs can be provided. diff --git a/contribute/backend/communication.md b/contribute/backend/communication.md index a86176de5f3..ae13b8a6aab 100644 --- a/contribute/backend/communication.md +++ b/contribute/backend/communication.md @@ -1,30 +1,30 @@ # Communication -Grafana use dependency injection and method calls on Go interfaces to +Grafana uses dependency injection and method calls on Go interfaces to communicate between different parts of the backend. ## Commands and queries -Grafana structures arguments to [services](services.md) using a command/query +Grafana structures arguments to [services](services.md) using a "command/query" separation where commands are instructions for a mutation and queries retrieve records from a service. -Services should define their methods as `func[T, U any](ctx context.Context, args T) (U, error)`. +Services should define their methods as follows: + +- `func[T, U any](ctx context.Context, args T) (U, error)` Each function should take two arguments. First, a `context.Context` that carries information about the tracing span, cancellation, and similar -runtime information that might be relevant to the call. Secondly, `T` is -a `struct` defined in the service's root package (see the instructions -for [package hierarchy](package-hierarchy.md)) that contains zero or +runtime information that might be relevant to the call. Secondly, `T`, +a struct defined in the service's root package. Refer to the instructions +for [package hierarchy](package-hierarchy.md) that contains zero or more arguments that can be passed to the method. -The return values is more flexible, and may consist of none, one, or two -values. If there are two values returned, the second value should be -either an `bool` or `error` indicating the success or failure of the -call. The first value `U` carries a value of any exported type that -makes sense for the service. +The return values are more flexible, and these may consist of none, one, or two values. +If the function returns two values, the second value should be either a `bool` or `error` to indicate the success or failure of the call. +The first value `U` carries a value of any exported type appropriate for the service. -Following is an example of an interface providing method signatures for +The following example shows an interface that provides method signatures for some calls adhering to these guidelines: ``` @@ -39,23 +39,20 @@ type Alphabetical interface { } ``` -> Because we request an operation to be performed, command are written in imperative mood, such as `CreateFolderCommand`, `GetDashboardQuery` and `DeletePlaylistCommand`. +> **Note:** Because we request an operation to be performed, command are written in imperative mood, such as `CreateFolderCommand`, `GetDashboardQuery` and `DeletePlaylistCommand`. The use of complex types for arguments in Go means a few different -things for us, it provides us with the equivalent of named parameters -from other languages, and it reduces the headache of figuring out which -argument is which that often occurs with three or more arguments. +things for us. Most importantly, it provides us with the equivalent of named parameters from other languages, and it reduces the headache of figuring out which argument is which that often occurs with three or more arguments. -On the flip-side, it means that all input parameters are optional and -that it is up to the programmer to make sure that the zero value is -useful or at least safe for all fields and that while it's easy to add -another field, if that field must be set for the correct function of the -service that is not detectable at compile time. +However, it means that all input parameters are optional and +that it's up to the developer to make sure that the zero value is +useful or at least safe for all fields. +Also, although it's easy to add another field, the field must be set for the correct function of the service that isn't detectable at compile time. ### Queries with Result fields -Some queries have a Result field that is mutated and populated by the -method being called. This is a remainder from when the _bus_ was used +Some queries have a `Result` field that is mutated and populated by the +method being called. This is a remainder from when the `_bus_` was used for sending commands and queries as well as for events. All bus commands and queries had to implement the Go type @@ -63,8 +60,8 @@ All bus commands and queries had to implement the Go type and mutation of the `msg` variable or returning structured information in `error` were the two most convenient ways to communicate with the caller. -All `Result` fields should be refactored so that they are returned from -the query method: +You should refactor all `Result` fields so that they are returned from +the query method. For example: ``` type GetQuery struct { @@ -95,9 +92,9 @@ func (s *Service) Get(ctx context.Context, cmd GetQuery) (ResultType, error) { ## Events -An event is something that happened in the past. Since an event has already happened, you can't change it. Instead, you can react to events by triggering additional application logic to be run, whenever they occur. +An _event_ is something that happened in the past. Since an event has already happened, you can't change it. Instead, you can react to events by triggering additional application logic to be run, whenever they occur. -> Because they happened in the past, event names are written in past tense, such as `UserCreated`, and `OrgUpdated`. +> **Note:** Because events happened in the past, their names are written in the past tense, such as `UserCreated` and `OrgUpdated`. ### Subscribe to an event @@ -116,11 +113,11 @@ func (s *MyService) UserCreated(event *events.UserCreated) error { } ``` -**Tip:** Browse the available events in the `events` package. +> **Tip:** To learn about the available events, refer to the documentation in the `events` package. ### Publish an event -If you want to let other parts of the application react to changes in a service, you can publish your own events: +If you want to let other parts of the application react to changes in a service, you can publish your own events. For example: ```go event := &events.StickersSentEvent { diff --git a/contribute/backend/database.md b/contribute/backend/database.md index c44f54c2f96..16965d0ba98 100644 --- a/contribute/backend/database.md +++ b/contribute/backend/database.md @@ -1,6 +1,8 @@ # Database -Grafana uses a database to persist settings between restarts. In fact, if you don't specify one, Grafana creates a [SQLite3](https://www.sqlite.org/) database file on your local disk. This guide explains how to store and retrieve data from the database. +Grafana uses databases to persist settings between restarts. If you don't specify one, Grafana creates a [SQLite3](https://www.sqlite.org/) database file on your local disk. This guide explains how to store and retrieve data from the default or other databases. + +## Supported databases and services Grafana supports the [following databases](https://grafana.com/docs/installation/requirements/#database): @@ -16,7 +18,7 @@ Grafana uses the [XORM](https://xorm.io) framework for persisting objects to the > **Deprecated:** We are deprecating `sqlstore` handlers in favor of using the `SQLStore` object directly in each service. Since most services still use the `sqlstore` handlers, we still want to explain how they work. -The `sqlstore` package allows you to register [command handlers](communication.md#handle-commands) that either store, or retrieve objects from the database. `sqlstore` handlers are similar to services: +The `sqlstore` package allows you to register [command handlers](communication.md#handle-commands) that either store or retrieve objects from the database. The `sqlstore` handlers are similar to services: - [Services](services.md) are command handlers that _contain business logic_. - `sqlstore` handlers are command handlers that _access the database_. @@ -27,7 +29,7 @@ The `sqlstore` package allows you to register [command handlers](communication.m To register a handler: -- Create a new file `myrepo.go` in the `sqlstore` package. +- Create a new file, `myrepo.go`, in the `sqlstore` package. - Create a [command handler](communication.md#handle-commands). - Register the handler in the `init` function: @@ -48,7 +50,7 @@ Here, `inTransactionCtx` is a helper function in the `sqlstore` package that pro ## `SQLStore` -As opposed to a `sqlstore` handler, the `SQLStore` is a service itself. The `SQLStore` has the same responsibility however: to store and retrieve objects, to and from the database. +As opposed to a `sqlstore` handler, the `SQLStore` is a service itself. Like the handler, the `SQLStore` is responsible for storing and retrieving objects, to and from the database. To use the `SQLStore`, inject it in your service struct: @@ -73,13 +75,13 @@ For transactions, use the `WithTransactionalDbSession` method instead. ## Migrations -As Grafana evolves, it becomes necessary to create _schema migrations_ for one or more database tables. +As your use of Grafana evolves, you may need to create _schema migrations_ for one or more database tables. To see all the types of migrations you can add, refer to [migrations.go](/pkg/services/sqlstore/migrator/migrations.go). Before you add a migration, make sure that you: -- Never change a migration that has been committed and pushed to main. +- Never change a migration that has been committed and pushed to `main`. - Always add new migrations, to change or undo previous migrations. Add a migration using one of the following methods: @@ -87,7 +89,7 @@ Add a migration using one of the following methods: - Add migrations in the `migrations` package. - Implement the `DatabaseMigrator` for the service. -**Important:** If there are previous migrations for a service, use that method. By adding migrations using both methods, you risk running migrations in the wrong order. +> **Important:** If there are previous migrations for a service, use that method. Don't add migrations using both methods or you risk running migrations in the wrong order. ### Add migrations in `migrations` package @@ -97,11 +99,11 @@ To add a migration: - Open the [migrations.go](/pkg/services/sqlstore/migrations/migrations.go) file. - In the `AddMigrations` function, find the `addXxxMigration` function for the service you want to create a migration for. -- At the end of the `addXxxMigration` function, register your migration: +- At the end of the `addXxxMigration` function, register your migration (refer to the following example). -> **NOTE:** Putting migrations behind feature flags is no longer recommended as it may cause the migration skip integration testing. +- [Example](https://github.com/grafana/grafana/blob/00d0640b6e778ddaca021670fe851fe00982acf2/pkg/services/sqlstore/migrations/migrations.go#L55-L70) -[Example](https://github.com/grafana/grafana/blob/00d0640b6e778ddaca021670fe851fe00982acf2/pkg/services/sqlstore/migrations/migrations.go#L55-L70) +> **Note:** We no longer recommend putting migrations behind feature flags because this could cause the migration to skip integration testing. ### Implement `DatabaseMigrator` diff --git a/contribute/backend/errors.md b/contribute/backend/errors.md index 2d79cb8a6e1..925f34c424a 100644 --- a/contribute/backend/errors.md +++ b/contribute/backend/errors.md @@ -1,26 +1,24 @@ # Errors -Grafana introduced its own error type [github.com/grafana/grafana/pkg/util/errutil.Error](../../pkg/util/errutil/errors.go) -in June 2022. It's built on top of the Go `error` interface extended to -contain all the information necessary by Grafana to handle errors in an -informative and safe way. +Grafana includes its own error type [github.com/grafana/grafana/pkg/util/errutil.Error](../../pkg/util/errutil/errors.go). +Introduced in June 2022, the type is built on top of the Go `error` interface. +It extends the interface to contain all the information necessary by Grafana to handle errors in an informative and safe way. -Previously, Grafana has passed around regular Go errors and have had to +Previously, Grafana passed around regular Go errors and therefore had to rely on bespoke solutions in API handlers to communicate informative messages to the end-user. With the new `errutil.Error`, the API handlers -can be slimmed as information about public messaging, structured data -related to the error, localization metadata, log level, HTTP status -code, and so forth are carried by the error. +can be streamlined. The error carries information about public messaging, +structured data related to the error, localization metadata, log level, +HTTP status code, and so on. -## Basic use - -### Declaring errors +## Declare errors For a service, declare the different categories of errors that may occur -from your service (this corresponds to what you might want to have -specific public error messages or their templates for) by globally -constructing variables using the `errutil.(status, messageID, opts...)` -functions, e.g. +from your service (this corresponds to categories for which you might want +to have specific public error messages or templates). + +Globally construct variables using the `errutil.(status, messageID, opts...) +functions. For example: - `errutil.NotFound(messageID, opts...)` - `errutil.BadRequest(messageID, opts...)` @@ -33,44 +31,41 @@ functions, e.g. - `errutil.NotImplemented(messageID, opts...)` - `errutil.ClientClosedRequest(messageID, opts...)` -Above functions uses `errutil.NewBase(status, messageID, opts...)` under the covers, and that function should in general only be used outside the `errutil` package for `errutil.StatusUnknown`, e.g. when there are no accurate status code available/provided. +The previous functions use `errutil.NewBase(status, messageID, opts...)` under the covers, and that function should in general only be used outside the `errutil` package for `errutil.StatusUnknown`. For example, you can use that function when there are no accurate status code available. The status code loosely corresponds to HTTP status codes and provides a -default log level for errors to ensure that the request logging is -properly informing administrators about various errors occurring in -Grafana (e.g. `StatusBadRequest` is generally speaking not as relevant -as `StatusInternal`). All available status codes live in the `errutil` -package and have names starting with `Status`. +default log level for errors. +The default log levels ensure that the request logging is properly informing administrators about various errors occurring in Grafana (for example, `StatusBadRequest` isn't usually as relevant as `StatusInternal`). +All available status codes live in the `errutil` package and have names starting with `Status`. -The messageID is constructed as `.` where +The `messageID` is constructed as `.` where the `` corresponds to the root service directory per [the package hierarchy](package-hierarchy.md) and `` is a camelCased short identifier that identifies the specific category of errors within the service. -Errors should be grouped together (i.e. share `errutil.Base`) based on -their public facing properties, a single messageID should represent a -translatable string and what metadata is carried with it. -_service.MissingRequiredFields_ and _service.MessageTooLong_ are likely +Group errors together (that is, share `errutil.Base`) based on +their public-facing properties. A single `messageID` should represent a +translatable string and its metadata. +`_service.MissingRequiredFields_` and `_service.MessageTooLong_` are likely to be two different errors that are both validation failures, as their -user-friendly expansions are likely different. This is the maximization -rule of declaring as many `errutil.Error`s as you need public message -structures. +user-friendly expansions are likely different. +This is the maximization rule of declaring as many errors with `errutil.Error` as you need public message structures. -The other side of this is that even though a login service's -"user is ratelimited", "user does not exist", "wrong username", and -"wrong password" are reasonable errors to separate between internally, -for security reasons the end-user should not be told which particular +The other side of the coin is that even though such messages as +"user is rate limited", "user doesn't exist", "wrong username", and +"wrong password" are reasonable errors to distinguish internally, +for security reasons the end-user shouldn't be told which particular error they struck. This means that they should share the same base (such -as _login.Failed_). This is the minimization rule of grouping together -distinct logged errors that provide the same information via the API. +as _login.Failed_). +This is the minimization rule of grouping together distinct logged errors that provide the same information via the API. -To set a static message sent to the client when the error occurs, the -`errutil.WithPublicMessage(message string)` option may be appended to -the NewBase function call. For dynamic messages or more options, refer +To set a static message sent to the client when the error occurs, append the +`errutil.WithPublicMessage(message string)` option to +the `NewBase` function call. For dynamic messages or more options, refer to the `errutil` package's GoDocs. -Errors are then constructed using the `Base.Errorf` method, which +You can then construct errors using the `Base.Errorf` method, which functions like the [fmt.Errorf](https://pkg.go.dev/fmt#Errorf) method except that it creates an `errutil.Error`. @@ -95,34 +90,27 @@ func Look(id int) (*Thing, error) { } ``` -Errors consider themselves to be both its `errutil.Base` or -`errutil.Template` and whatever errors it wraps for the purposes of the -`errors.Is` function. +Errors are considered to be part of `errutil.Base` and +`errutil.Template`, and whatever errors are wrapped for the purposes of the +`errors.Is` function.a -Check out the package and method documentation for -github.com/grafana/grafana/pkg/util/errutil for details on how to -construct and use Grafana style errors. This documentation is -unfortunately not readily available on pkg.go.dev because Grafana is not -fully Go modules compatible, but can be viewed using -[godoc](https://go.dev/cmd/godoc/) from the Grafana directory. +Refer to the package and method documentation for +`github.com/grafana/grafana/pkg/util/errutil` for details on how to +construct and use Grafana style errors. +This documentation isn't readily available on `pkg.go.dev`, but it can be viewed using [godoc](https://go.dev/cmd/godoc/) from the Grafana directory. -### Error source +## Error source -You can optionally specify an error source that describes from where an -error originates. By default, it's _server_ and means the error originates -from within the application, e.g. Grafana. The `errutil.WithDownstream()` -option may be appended to the NewBase function call to denote an error -originates from a _downstream_ server/service. The error source information -is used in the API layer to distinguish between Grafana errors and -non-Grafana errors to include this information when instrumenting the -application and by that allowing Grafana operators to define SLO's -based on actual Grafana errors. +You can optionally specify an error source that describes an error's origin. +By default, it's `_server_` and means the error originates from within the application, for example, Grafana. +The `errutil.WithDownstream()` option may be appended to the `NewBase` function call to denote an error originates from a _downstream_ server or service. +The error source information is used in the API layer to distinguish between Grafana errors and non-Grafana errors. Error source information is given for use when instrumenting the application, allowing Grafana operators to define SLOs based on actual Grafana errors. -### Handling errors in the API +## Handle errors in the API API handlers use the `github.com/grafana/grafana/pkg/api/response.Err` or `github.com/grafana/grafana/pkg/api/response.ErrWithFallback` (same signature as `response.Error`) function to create responses based on `errutil.Error`. -Using `response.Err` requires all errors to be Grafana style errors. +> **Note:** Using `response.Err` requires all errors to be Grafana style errors. diff --git a/contribute/style-guides/styling.md b/contribute/style-guides/styling.md index 73790ce463b..15ed1684ef2 100644 --- a/contribute/style-guides/styling.md +++ b/contribute/style-guides/styling.md @@ -13,7 +13,6 @@ To access the theme in your styles, use the `useStyles` hook. It provides basic > Please remember to put `getStyles` function at the end of the file! ```tsx -import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { useStyles2 } from '@grafana/ui'; import { css } from '@emotion/css'; @@ -40,7 +39,6 @@ Let's say you need to style a component that has a different background dependin ```tsx import { css, cx } from '@emotion/css'; -import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { useStyles2 } from '@grafana/ui'; diff --git a/contribute/style-guides/testing.md b/contribute/style-guides/testing.md index 7ca50d926b9..18e4c13e248 100644 --- a/contribute/style-guides/testing.md +++ b/contribute/style-guides/testing.md @@ -176,7 +176,6 @@ Here's how the test would look like for this [OrgPicker](https://github.com/graf ```tsx import { screen, render } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { OrgPicker } from './OrgPicker'; diff --git a/contribute/style-guides/themes.md b/contribute/style-guides/themes.md index 5d4a2e0f877..971f63145f9 100644 --- a/contribute/style-guides/themes.md +++ b/contribute/style-guides/themes.md @@ -20,7 +20,7 @@ Here's how to use Grafana themes in React components. `useStyles2` memoizes the function and provides access to the theme. ```tsx -import React, { FC } from 'react'; +import { FC } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { useStyles2 } from '@grafana/ui'; import { css } from '@emotion/css'; @@ -39,7 +39,7 @@ const getStyles = (theme: GrafanaTheme2) => #### Get the theme object ```tsx -import React, { FC } from 'react'; +import { FC } from 'react'; import { useTheme2 } from '@grafana/ui'; const Foo: FC = () => { diff --git a/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/configure-email.md b/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/configure-email.md index a490f375241..f9700eac7e6 100644 --- a/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/configure-email.md +++ b/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/configure-email.md @@ -80,13 +80,13 @@ To set up email integration, complete the following steps. ## Next steps -To add the contact point and integration you created to your default notification policy, complete the following steps. +The email contact point is ready to receive alert notifications. -1. Navigate to **Alerts & IRM** -> **Alerting** -> **Notification policies**. -1. In the **Default policy**, click the ellipsis icon (…) and then **Edit**. -1. Change the default policy to the contact point you created. -1. Click **Update default policy**. +To add this contact point to your alert, complete the following steps. -{{% admonition type="note" %}} -If you have more than one contact point, add a new child notification policy rather than edit the default one, so you can route specific alerts to one or multiple email addresses. -{{% /admonition %}} +1. In Grafana, navigate to **Alerting** > **Alert rules**. +1. Edit or create a new alert rule. +1. Scroll down to the **Configure labels and notifications** section. +1. Under Notifications click **Select contact point**. +1. From the drop-down menu, select the previously created contact point. +1. **Click Save rule and exit**. diff --git a/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/configure-oncall.md b/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/configure-oncall.md index c238f12bf10..e71c6a7ee4f 100644 --- a/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/configure-oncall.md +++ b/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/configure-oncall.md @@ -57,9 +57,9 @@ To set up the Grafana OnCall integration using the Grafana Alerting application, 1. Enter a contact point name. 1. From the Integration list, select Grafana OnCall. - **Note:** - - The Grafana OnCall integration is only available for Grafana Alertmanager. +{{< admonition type="note" >}} +The Grafana OnCall integration is only available for Grafana Alertmanager. +{{< /admonition >}} 1. Choose whether to add a new OnCall integration or add an existing one. diff --git a/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/configure-slack.md b/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/configure-slack.md index e23b5947e1c..c4b13837906 100644 --- a/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/configure-slack.md +++ b/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/configure-slack.md @@ -62,7 +62,7 @@ If you are using a Slack API Token, complete the following steps. If you are using a Webhook URL, follow steps 1 and 5 in the [Slack API Quickstart](https://api.slack.com/start/quickstart). {{< admonition type="note" >}} -Make sure you copy the Slack app Webhook URL. You will need this when setting up your contact point integration in Grafana Alerting. +Make sure you copy the Slack app Webhook URL. You need this when setting up your contact point integration in Grafana Alerting. {{< /admonition >}} ## Procedure @@ -82,12 +82,13 @@ To create your Slack integration in Grafana Alerting, complete the following ste ## Next steps -To add the contact point and integration you created to your default notification policy, complete the following steps. +The Slack contact point is ready to receive alert notifications. -1. Navigate to **Alerts & IRM** -> **Alerting** -> **Notification policies**. -1. In the **Default policy**, click the ellipsis icon (…) and then **Edit**. -1. Change the default policy to the contact point you created. -1. Click **Update default policy**. +To add this contact point to your alert, complete the following steps. -**Note:** -If you have more than one contact point, add a new notification policy rather than edit the default one, so you can route specific alerts to Slack. For more information, refer to [Notification policies](ref:nested-policy). +1. In Grafana, navigate to **Alerting** > **Alert rules**. +1. Edit or create a new alert rule. +1. Scroll down to the **Configure labels and notifications** section. +1. Under Notifications click **Select contact point**. +1. From the drop-down menu, select the previously created contact point. +1. **Click Save rule and exit**. diff --git a/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/configure-teams.md b/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/configure-teams.md new file mode 100644 index 00000000000..54272489097 --- /dev/null +++ b/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/configure-teams.md @@ -0,0 +1,59 @@ +--- +canonical: https://grafana.com/docs/grafana/latest/alerting/configure-notifications/manage-contact-points/integrations/configure-teams/ +description: Configure Microsoft Teams integration to receive notifications when your alerts are firing +keywords: + - grafana + - alerting + - Microsoft Teams + - integration +labels: + products: + - cloud + - enterprise + - oss +menuTitle: Microsoft Teams +title: Configure Microsoft Teams for Alerting +weight: 300 +--- + +# Configure Microsoft Teams for Alerting + +Use the Grafana Alerting - Microsoft Teams integration to receive notifications in your team’s channel when your alerts are firing. + +## Before you begin + +To set up Microsoft Teams for integration with Grafana Alerting, you need to create an incoming Webhook. This allows Grafana to send alert notifications to Microsoft Teams channels. + +### Create an incoming Webhook in Microsoft Teams + +1. To add an incoming Webhook to a Teams channel, follow the steps in the [Create an Incoming Webhook guide](https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook?tabs=newteams%2Cdotnet#create-an-incoming-webhook). + + Note: The steps to create incoming Webhooks may vary depending on the version of Microsoft Teams you are using. You can switch between the "New Teams" and "Classic Teams" tabs to view the relevant instructions for your version. + +1. Copy the Webhook URL. + +## Procedure + +To create your MS Teams integration in Grafana Alerting, complete the following steps. + +1. Navigate to **Alerts & IRM** -> **Alerting** -> **Contact points**. +1. Click **+ Add contact point**. +1. Enter a contact point name. +1. From the Integration list, select **Microsoft Teams**. +1. In the **URL** field, copy in your Webhook URL. +1. Click **Test** to check that your integration works. + A test alert notification should be sent to the MS Team channel. +1. Click **Save** contact point. + +## Next steps + +The Microsoft Teams contact point is ready to receive alert notifications. + +To add this contact point to your alert, complete the following steps. + +1. In Grafana, navigate to **Alerting** > **Alert rules**. +1. Edit or create a new alert rule. +1. Scroll down to the **Configure labels and notifications** section. +1. Under Notifications click **Select contact point**. +1. From the drop-down menu, select the previously created contact point. +1. **Click Save rule and exit**. diff --git a/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/configure-telegram.md b/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/configure-telegram.md index 4b95b3c52ac..ca798085037 100644 --- a/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/configure-telegram.md +++ b/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/configure-telegram.md @@ -88,13 +88,13 @@ To create your Telegram integration in Grafana Alerting, complete the following ## Next steps -To add the contact point and integration you created to your default notification policy, complete the following steps. +The Telegram contact point is ready to receive alert notifications. -1. Navigate to **Alerts & IRM** -> **Alerting** -> **Notification policies**. -1. In the **Default policy**, click the ellipsis icon (…) and then **Edit**. -1. Change the default policy to the contact point you created. -1. Click **Update default policy**. +To add this contact point to your alert, complete the following steps. -{{}} -If you have more than one contact point, add a new child notification policy rather than edit the default one, so you can route specific alerts to Telegram. -{{}} +1. In Grafana, navigate to **Alerting** > **Alert rules**. +1. Edit or create a new alert rule. +1. Scroll down to the **Configure labels and notifications** section. +1. Under Notifications click **Select contact point**. +1. From the drop-down menu, select the previously created contact point. +1. **Click Save rule and exit**. diff --git a/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/pager-duty.md b/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/pager-duty.md index 40259557fb4..8c002ad1c89 100644 --- a/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/pager-duty.md +++ b/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/pager-duty.md @@ -63,11 +63,13 @@ To create your PagerDuty integration in Grafana Alerting, complete the following ## Next steps -To add the contact point and integration you created to your default notification policy, complete the following steps. +The PagerDuty contact point is ready to receive alert notifications. -1. Navigate to **Alerts & IRM** -> **Alerting** -> **Notification policies**. -1. In the Default policy, click the ellipsis icon (…) and then **Edit**. -1. Change the default policy to the contact point you created. -1. Click **Update default policy**. +To add this contact point to your alert, complete the following steps. -{{< admonition type="note" >}} If you have more than one contact point, add a new notification policy rather than edit the default one, so you can route specific alerts to PagerDuty. {{< /admonition >}} +1. In Grafana, navigate to **Alerting** > **Alert rules**. +1. Edit or create a new alert rule. +1. Scroll down to the **Configure labels and notifications** section. +1. Under Notifications click **Select contact point**. +1. From the drop-down menu, select the previously created contact point. +1. **Click Save rule and exit**. diff --git a/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/webhook-notifier.md b/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/webhook-notifier.md index 13d072a0279..ebb5d97f55f 100644 --- a/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/webhook-notifier.md +++ b/docs/sources/alerting/configure-notifications/manage-contact-points/integrations/webhook-notifier.md @@ -144,7 +144,7 @@ Alert rules are not coupled to dashboards anymore therefore the fields related t ## Procedure -To create your webhook integration in Grafana Alerting, complete the following steps: +To create your Webhook integration in Grafana Alerting, complete the following steps. 1. Navigate to **Alerts & IRM** -> **Alerting** -> **Contact points**. 1. Click **+ Add contact point**. @@ -156,13 +156,13 @@ To create your webhook integration in Grafana Alerting, complete the following s ## Next steps -To add the contact point and integration you created to your default notification policy, complete the following steps. +The Webhook contact point is ready to receive alert notifications. -1. Navigate to **Alerts & IRM** -> **Alerting** -> **Notification policies**. -1. In the **Default policy**, click the ellipsis icon (…) and then **Edit**. -1. Change the default policy to the contact point you created. -1. Click **Update default policy**. +To add this contact point to your alert, complete the following steps. -{{< admonition type="note" >}} -If you have more than one contact point, add a new notification policy rather than edit the default one, so you can route specific alerts to your webhook. -{{< /admonition >}} +1. In Grafana, navigate to **Alerting** > **Alert rules**. +1. Edit or create a new alert rule. +1. Scroll down to the **Configure labels and notifications** section. +1. Under Notifications, click **Select contact point**. +1. From the drop-down menu, select the previously created contact point. +1. **Click Save rule and exit**. diff --git a/docs/sources/alerting/configure-notifications/template-notifications/images-in-notifications.md b/docs/sources/alerting/configure-notifications/template-notifications/images-in-notifications.md index 3f0a8d7b33b..42c5459825f 100644 --- a/docs/sources/alerting/configure-notifications/template-notifications/images-in-notifications.md +++ b/docs/sources/alerting/configure-notifications/template-notifications/images-in-notifications.md @@ -33,7 +33,7 @@ When an alert is fired or resolved Grafana takes a screenshot of the panel assoc Grafana takes at most two screenshots for each alert: once when the alert fires and again when the alert is resolved. Screenshots are not re-taken over the lifetime of the alert, instead you should open the panel in Grafana to follow the data in real time. In addition, depending on how alerts are grouped in your notification policies, Grafana might send a notification with many screenshots of the same panel. This happens because Grafana does not know how your alerts are grouped at the time a screenshot is taken, and so acts conservatively by taking a screenshot for every alert. -Once a screenshot has been taken Grafana can either upload it to a cloud storage service such as Amazon S3, Azure Blob Storage or Google Cloud Storage; upload the screenshot to it's internal web server; or upload it to the service that is receiving the notification, such as Slack. Which option you should choose depends on how your Grafana is managed and which integrations you use. More information on this can be found in Requirements. +After a screenshot has been taken Grafana can either upload it to a cloud storage service such as Amazon S3, Azure Blob Storage or Google Cloud Storage; upload the screenshot to it's internal web server; or upload it to the service that is receiving the notification, such as Slack. Which option you should choose depends on how your Grafana is managed and which integrations you use. More information on this can be found in Requirements. Refer to the table at the end of this page for a list of contact points and their support for images in notifications. @@ -41,19 +41,19 @@ Refer to the table at the end of this page for a list of contact points and thei 1. To use images in notifications, Grafana must be set up to use image rendering. You can either install the image rendering plugin or run it as a remote rendering service. -2. When a screenshot is taken it is saved to the [data][paths] folder, even if Grafana is configured to upload screenshots to a cloud storage service. Grafana must have write-access to this folder otherwise screenshots cannot be saved to disk and an error will be logged for each failed screenshot attempt. +2. When a screenshot is taken, it is saved to the [data][paths] folder, even if Grafana is configured to upload screenshots to a cloud storage service. Grafana must have write-access to this folder otherwise screenshots cannot be saved to disk and an error is logged for each failed screenshot attempt. -3. You should use a cloud storage service unless sending alerts to Discord, Email, Pushover, Slack or Telegram. These integrations support either embedding screenshots in the email or attaching screenshots to the notification, while other integrations must link screenshots uploaded to a cloud storage bucket. If a cloud storage service has been configured then integrations that support both will link screenshots from the cloud storage bucket instead of embedding or attaching screenshots to the notification. +3. You should use a cloud storage service unless sending alerts to Discord, email, Pushover, Slack or Telegram. These integrations support either embedding screenshots in the email or attaching screenshots to the notification, while other integrations must link screenshots uploaded to a cloud storage bucket. If a cloud storage service has been configured then integrations that support both link screenshots from the cloud storage bucket instead of embedding or attaching screenshots to the notification. -4. If uploading screenshots to a cloud storage service such as Amazon S3, Azure Blob Storage or Google Cloud Storage; and accessing screenshots in the bucket requires authentication, logging into a VPN or corporate network; then image previews might not work in all instant messaging and communication platforms as some services rewrite URLs to use their CDN. If this happens we recommend using [integrations which support uploading images](#supported-contact-points) or [disabling images in notifications](#configuration) altogether. +4. If uploading screenshots to a cloud storage service such as Amazon S3, Azure Blob Storage or Google Cloud Storage; and accessing screenshots in the bucket requires authentication, logging into a VPN or corporate network; then image previews might not work in all instant messaging and communication platforms as some services rewrite URLs to use their CDN. If this happens, we recommend using [integrations which support uploading images](#supported-contact-points) or [disabling images in notifications](#configuration) altogether. 5. When uploading screenshots to a cloud storage service Grafana uses a random 20 character (30 characters for Azure Blob Storage) filename for each image. This makes URLs hard to guess but not impossible. 6. Grafana does not delete screenshots from cloud storage. We recommend configuring a retention policy with your cloud storage service to delete screenshots older than 1 month. -7. If Grafana is configured to upload screenshots to its internal web server, and accessing Grafana requires logging into a VPN or corporate network; image previews might not work in all instant messaging and communication platforms as some services rewrite URLs to use their CDN. If this happens we recommend using [integrations which support uploading images](#supported-contact-points) or [disabling images in notifications](#configuration) altogether. +7. If Grafana is configured to upload screenshots to its internal web server, and accessing Grafana requires logging into a VPN or corporate network; image previews might not work in all instant messaging and communication platforms as some services rewrite URLs to use their CDN. If this happens, we recommend using [integrations which support uploading images](#supported-contact-points) or [disabling images in notifications](#configuration) altogether. -8. Grafana does not delete screenshots uploaded to its internal web server. To delete screenshots from `static_root_path/images/attachments` after a certain amount of time we recommend setting up a CRON job. +8. Grafana does not delete screenshots uploaded to its internal web server. To delete screenshots from `static_root_path/images/attachments` after a certain amount of time, we recommend setting up a CRON job. ## Configuration @@ -72,14 +72,14 @@ If screenshots should be uploaded to cloud storage then `upload_external_image_s # Uploads screenshots to the local Grafana server or remote storage such as Azure, S3 and GCS. Please # see [external_image_storage] for further configuration options. If this option is false, screenshots - # will be persisted to disk for up to temp_data_lifetime. + # are persisted to disk for up to temp_data_lifetime. upload_external_image_storage = false Restart Grafana for the changes to take effect. ## Advanced configuration -We recommended that `max_concurrent_screenshots` is less than or equal to `concurrent_render_request_limit`. The default value for both `max_concurrent_screenshots` and `concurrent_render_request_limit` is `5`: +We recommend that `max_concurrent_screenshots` is less than or equal to `concurrent_render_request_limit`. The default value for both `max_concurrent_screenshots` and `concurrent_render_request_limit` is `5`: # The maximum number of screenshots that can be taken at the same time. This option is different from # concurrent_render_request_limit as max_concurrent_screenshots sets the number of concurrent screenshots @@ -124,9 +124,9 @@ If Grafana has been set up to send images in notifications, however notification 1. Check that images in notifications has been set up as per the instructions. 2. Enable debug logging in Grafana and look for logs with the logger `ngalert.image`. -3. If the alert is not associated with a dashboard there will be logs for `Cannot take screenshot for alert rule as it is not associated with a dashboard`. -4. If the alert is associated with a dashboard, but no panel in the dashboard, there will be logs for `Cannot take screenshot for alert rule as it is not associated with a panel`. -5. If images cannot be taken because of mis-configuration or an issue with image rendering there will be logs for `Failed to take an image` including the Dashboard UID, Panel ID, and the error message. +3. If the alert is not associated with a dashboard there are logs for `Cannot take screenshot for alert rule as it is not associated with a dashboard`. +4. If the alert is associated with a dashboard, but no panel in the dashboard, there are logs for `Cannot take screenshot for alert rule as it is not associated with a panel`. +5. If images cannot be taken because of mis-configuration or an issue with image rendering there are logs for `Failed to take an image` including the Dashboard UID, Panel ID, and the error message. 6. Check that the contact point supports images in notifications and whether it supports uploading images to the receiving service or referencing images that have been uploaded to a cloud storage service. ## Metrics diff --git a/docs/sources/alerting/configure-notifications/template-notifications/using-go-templating-language.md b/docs/sources/alerting/configure-notifications/template-notifications/using-go-templating-language.md index e92fd2c4cb6..5999a20001e 100644 --- a/docs/sources/alerting/configure-notifications/template-notifications/using-go-templating-language.md +++ b/docs/sources/alerting/configure-notifications/template-notifications/using-go-templating-language.md @@ -256,7 +256,7 @@ You can use indentation, both tabs and spaces, and line breaks, to make template {{ end }} ``` -However, indentation in the template will also be present in the text. Next we will see how to remove it. +However, indentation in the template is also present in the text. Next, we look at how to remove it. ## Remove spaces and line breaks diff --git a/docs/sources/alerting/monitor/_index.md b/docs/sources/alerting/monitor/_index.md index 104d4e03046..1f807e13c52 100644 --- a/docs/sources/alerting/monitor/_index.md +++ b/docs/sources/alerting/monitor/_index.md @@ -68,19 +68,19 @@ This metric is a gauge that shows you the number of alert rules scheduled. An al #### grafana_alerting_schedule_periodic_duration_seconds_bucket -This metric is a histogram that shows you the time it takes to process an individual tick in the scheduler that evaluates alert rules. If the scheduler takes longer than 10 seconds to process a tick then pending evaluations will start to accumulate such that alert rules might later than expected. +This metric is a histogram that shows you the time it takes to process an individual tick in the scheduler that evaluates alert rules. If the scheduler takes longer than 10 seconds to process a tick then pending evaluations start to accumulate such that alert rules might later than expected. #### grafana_alerting_schedule_query_alert_rules_duration_seconds_bucket -This metric is a histogram that shows you how long it takes the scheduler to fetch the latest rules from the database. If this metric is elevated then so will `schedule_periodic_duration_seconds`. +This metric is a histogram that shows you how long it takes the scheduler to fetch the latest rules from the database. If this metric is elevated, `schedule_periodic_duration_seconds` is also evaluated. #### grafana_alerting_scheduler_behind_seconds -This metric is a gauge that shows you the number of seconds that the scheduler is behind where it should be. This number will increase if `schedule_periodic_duration_seconds` is longer than 10 seconds, and decrease when it is less than 10 seconds. The smallest possible value of this metric is 0. +This metric is a gauge that shows you the number of seconds that the scheduler is behind where it should be. This number increases if `schedule_periodic_duration_seconds` is longer than 10 seconds, and decrease when it is less than 10 seconds. The smallest possible value of this metric is 0. #### grafana_alerting_notification_latency_seconds_bucket -This metric is a histogram that shows you the number of seconds taken to send notifications for firing and resolved alerts. This metric will let you observe slow or over-utilized integrations, such as an SMTP server that is being given emails faster than it can send them. +This metric is a histogram that shows you the number of seconds taken to send notifications for firing and resolved alerts. This metric lets you observe slow or over-utilized integrations, such as an SMTP server that is being given emails faster than it can send them. ## Metrics for Mimir-managed alerts @@ -121,7 +121,7 @@ This metric is a counter that shows you the number of active, suppressed, and un #### alertmanager_alerts_invalid_total -This metric is a counter that shows you the number of invalid alerts that were sent to Alertmanager. This counter should not exceed 0, and so in most cases you will want to create an alert that fires if whenever this metric increases. +This metric is a counter that shows you the number of invalid alerts that were sent to Alertmanager. This counter should not exceed 0, and so in most cases, create an alert that fires if whenever this metric increases. #### alertmanager_notifications_total @@ -129,7 +129,7 @@ This metric is a counter that shows you how many notifications have been sent by #### alertmanager_notifications_failed_total -This metric is a counter that shows you how many notifications have failed in total. This metric also uses a label "integration" to show the number of failed notifications by integration, such as failed emails. In most cases you will want to use the `rate` function to understand how often notifications are failing to be sent. +This metric is a counter that shows you how many notifications have failed in total. This metric also uses a label "integration" to show the number of failed notifications by integration, such as failed emails. In most cases, use the `rate` function to understand how often notifications are failing to be sent. #### alertmanager_notification_latency_seconds_bucket @@ -157,4 +157,4 @@ This metric is a gauge. It has a constant value `1`, and contains a label called #### alertmanager_cluster_reconnections_failed_total -This metric is a counter that shows you the number of failed peer connection attempts. In most cases you will want to use the `rate` function to understand how often reconnections fail as this may be indicative of an issue or instability in your network. +This metric is a counter that shows you the number of failed peer connection attempts. In most cases you should use the `rate` function to understand how often reconnections fail as this may be indicative of an issue or instability in your network. diff --git a/docs/sources/dashboards/create-manage-playlists/index.md b/docs/sources/dashboards/create-manage-playlists/index.md index 20acca7382c..0b916eeb488 100644 --- a/docs/sources/dashboards/create-manage-playlists/index.md +++ b/docs/sources/dashboards/create-manage-playlists/index.md @@ -28,34 +28,41 @@ You can access the Playlist feature from Grafana's side menu, in the Dashboards ## Access, share, and control a playlist -Use the information in this section to access existing playlists. Start and control the display of a playlist using one of the five available modes. +Use the information in this section to access playlists. Start and control the display of a playlist using one of the six available modes. ### Access a playlist -1. Click **Dashboards** in the left-side menu. -1. Click **Playlists** to see a list of existing playlists. +1. Click **Dashboards** in the main menu. +1. Click **Playlists** to see a list of playlists. ### Start a playlist -You can start a playlist in five different view modes. View modes determine how the menus and navigation bar appear on the dashboards. +You can start a playlist in six different view modes. View modes determine how the menus and navigation bar appear on the dashboards as well as how panels are sized. -By default, each dashboard is displayed for the amount of time entered in the Interval field, which you set when you create or edit a playlist. After you start a playlist, you can control it with the navbar at the top of the page. +1. Click **Dashboards** in the main menu. +1. Click **Playlists**. +1. Find the desired playlist and click **Start playlist**. +1. In the dialog box that opens, select one of the [six playlist modes](#playlist-modes) available. +1. Disable any dashboard controls that you don't want displayed while the list plays; these controls are enabled and visible by default. Select from: + + - **Time and refresh** + - **Variables** + - **Dashboard links** -1. Click **Dashboards** in the left-side menu. -1. Click **Playlists** to see a list of existing playlists. -1. Find the playlist you want to start, then click **Start playlist**. -1. In the modal that opens, select one of the five playlist modes available, based on the information in the table below. 1. Click **Start \**. -The playlist displays each dashboard for the time specified in the **Interval** field, set when creating or editing a playlist. Once a playlist starts, you can [control](#control-a-playlist) it using the navbar at the top of your screen. +The playlist displays each dashboard for the time specified in the **Interval** field, set when creating or editing a playlist. After a playlist starts, you can [control](#control-a-playlist) it using the navbar at the top of your screen. -| Mode | Description | -| --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Normal mode |
  • The side menu remains visible.
  • The navbar, row, and panel controls appear at the top of the screen.
| -| TV mode |
  • The side menu and dashboard submenu (including variable drop-downs and dashboard links) are hidden or removed.
  • The navbar, row, and panel controls appear at the top of the screen.
  • Enabled automatically after one minute of user inactivity.
  • Enable it manually using the `d v` sequence shortcut, or by appending the parameter `?inactive` to the dashboard URL.
  • Disable it with any mouse movement or keyboard action.
| -| TV mode (with auto fit panels) |
  • The side menu and dashboard submenu (including variable drop-downs and dashboard links) are hidden or removed.
  • The navbar, row and panel controls appear at the top of the screen.
  • Dashboard panels automatically adjust to optimize space on screen.
    | -| Kiosk mode |
    • The side menu, navbar, ro and panel controls are completely hidden/removed from view.
    • You can enable it manually using the `d v` sequence shortcut after the playlist has started.
    • You can disable it manually with the same shortcut.
    | -| Kiosk mode (with auto fit panels) |
    • The side menu, navbar, row, and panel controls are completely hidden/removed from view.
    • Dashboard panels automatically adjust to optimize space on screen.
    | +### Playlist modes + +| Mode | Description | +| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| Normal mode |
    • The side menu remains visible.
    • The navbar and dashboard controls appear at the top of the screen.
    | +| Normal mode (with auto fit panels) |
    • The side menu remains visible.
    • The navbar and dashboard controls appear at the top of the screen.
    • Dashboard panels automatically adjust to optimize space on screen.
    | +| TV mode |
    • The side menu is hidden or removed.
    • The navbar and dashboard controls appear at the top of the screen.
    • Enabled automatically after one minute of user inactivity.
    • Enable it manually using the `d v` sequence shortcut, or by appending the parameter `?inactive` to the dashboard URL.
    • Disable it with any mouse movement or keyboard action.
    | +| TV mode (with auto fit panels) |
    • The side menu is hidden or removed.
    • The navbar and dashboard controls appear at the top of the screen.
    • Dashboard panels automatically adjust to optimize space on screen.
      | +| Kiosk mode |
      • The side menu is hidden or removed.
      • The navbar and dashboard controls appear at the top of the screen.
      • You can disable or enable it manually using the `d v` sequence shortcut after the playlist has started.
      | +| Kiosk mode (with auto fit panels) |
      • The side menu is hidden or removed.
      • The navbar and dashboard controls appear at the top of the screen.
      • You can disable or enable it manually using the `d v` sequence shortcut after the playlist has started.
      • Dashboard panels automatically adjust to optimize space on screen.
      | ### Control a playlist @@ -72,79 +79,50 @@ You can control a playlist in **Normal** or **TV** mode after it's started, usin ## Create a playlist -You can create a playlist to present dashboards in a sequence, with a set order and time interval between dashboards. +You can create a playlist to present dashboards in a sequence, with a set order and time interval between dashboards. Be sure that all the dashboards you want to appear in your playlist are added before you create the playlist. + +1. Click **Dashboards** in the main menu. +1. Click **Playlists**. +1. Click **New playlist**. +1. In the **Name** field, enter a descriptive name. +1. In the **Interval** field, enter the time interval each dashboard is displayed before moving on to the next dashboard. +1. In the **Add dashboards** section, add dashboards to the playlist using the **Add by title** and **Add by tag** drop-down options. + + Added dashboards are displayed in a list in the **Dashboards** section of the page, in the order you added them. This is also the play order of the dashboards. -1. Click **Dashboards** in the left-side menu. -1. Click **Playlists** to see a list of existing playlists. -1. Click **New playlist**. The New playlist page opens. -1. In the **Name** text box, enter a descriptive name. -1. In the **Interval** text box, enter a time interval. Grafana displays a particular dashboard for the interval of time specified here before moving on to the next dashboard. -1. In Dashboards, add existing dashboards to the playlist using **Add by title** and **Add by tag** drop-down options. The dashboards you add are listed in a sequential order. -1. If needed: - - Search for a dashboard by its name, a regular expression, or a tag. - - Filter your results by starred status or tags. -1. If needed, rearrange the order of the dashboard you have added using the up and down arrow icon. -1. Optionally, remove a dashboard from the playlist by clicking the x icon beside dashboard. 1. Click **Save**. -## Save a playlist +## Edit a playlist -You can save a playlist and add it to your **Playlists** page, where you can start it. Be sure that all the dashboards you want to appear in your playlist are added when creating or editing the playlist before saving it. +You can edit a playlist including adding, removing, and rearranging the order of dashboards. + +1. Click **Dashboards** in the main menu. +1. Click **Playlists**. +1. Find the playlist you want to update and click **Edit playlist**. Do one or more of the following: + + - Edit - Update the name and time interval. + - Add dashboards - Search for dashboards by title or tag to add them to the playlist. + - Rearrange dashboards - Click and drag the dashboards into your desired order. + - Remove dashboards - Click the **X** next to the name of the dashboard you want to remove from the playlist. -1. Click **Dashboards** in the left-side menu. -1. Click **Playlists** to see a list of existing playlists. -1. Click on the playlist. -1. Edit the playlist. -1. Ensure that your playlist has a **Name**, **Interval**, and at least one **Dashboard** added to it. 1. Click **Save**. -## Edit or delete a playlist - -You can edit a playlist by updating its name, interval time, and by adding, removing, and rearranging the order of dashboards. On the rare occasion when you no longer need a playlist, you can delete it. - -### Edit a playlist - -1. Click **Dashboards** in the left-side menu. -1. Click **Playlists** to see a list of existing playlists. -1. Find the playlist you want to update and click **Edit playlist**. -1. Update the name and time interval, then add or remove dashboards from the playlist using instructions in [Create a playlist](#create-a-playlist). -1. Click **Save** to save your changes. - -### Delete a playlist - -1. Click **Dashboards** in the left-side menu. -1. Click **Playlists** to see a list of existing playlists. -1. Find the playlist you want to remove. -1. Click **Delete playlist**. - -### Rearrange dashboard order - -1. Click **Dashboards** in the left-side menu. -1. Click **Playlists** to see a list of existing playlists. -1. Find the playlist you want to update and click **Edit playlist**. -1. Click and drag the dashboards into your desired order. -1. Click **Save** to save your changes. - -### Remove a dashboard - -1. Click **Dashboards** in the left-side menu. -1. Click **Playlists** to see a list of existing playlists. -1. Find the playlist you want to update and click **Edit playlist**. -1. Click **\[x\]** on the name of the dashboard you want to remove from the playlist. -1. Click **Save** to save your changes. - ## Share a playlist in a view mode You can share a playlist by copying the link address on the view mode you prefer, and pasting the URL to your destination. -1. Click **Dashboards** in the left-side menu. -1. Click **Playlists** to see a list of existing playlists. +1. Click **Dashboards** in the main menu. +1. Click **Playlists**. 1. Click the share icon of the playlist you want to share. 1. Select the view mode you prefer. -1. Click **Copy** next to the Link URL to copy it to your clipboard. - - For example, the URL for the first playlist on the Grafana Play site in Kiosk mode will look like this: - - [https://play.grafana.org/playlists/play/1?kiosk](https://play.grafana.org/playlists/play/1?kiosk). - +1. Click **Copy** next to the **Link URL** to copy it to your clipboard. 1. Paste the URL to your destination. + +## Delete a playlist + +When you no longer need a playlist, follow these steps to delete it: + +1. Click **Dashboards** in the main menu. +1. Click **Playlists**. +1. Find the playlist you want to remove. +1. Click **Delete playlist**. diff --git a/docs/sources/panels-visualizations/visualizations/table/index.md b/docs/sources/panels-visualizations/visualizations/table/index.md index 4b337fd5134..3bdacc05ec8 100644 --- a/docs/sources/panels-visualizations/visualizations/table/index.md +++ b/docs/sources/panels-visualizations/visualizations/table/index.md @@ -49,6 +49,11 @@ refs: destination: /docs/grafana//setup-grafana/configure-grafana/#configuration-file-location - pattern: /docs/grafana-cloud/ destination: /docs/grafana//setup-grafana/configure-grafana/#configuration-file-location + field-override: + - pattern: /docs/grafana/ + destination: /docs/grafana//panels-visualizations/configure-overrides/ + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana-cloud/visualizations/panels-visualizations/configure-overrides/ --- # Table @@ -87,13 +92,13 @@ If you are using a table created before Grafana 7.0, then you need to migrate to Show or hide column names imported from your data source. -## Column width +### Column width By default, Grafana automatically calculates the column width based on the table size and the minimum column width. This field option can override the setting and define the width for all columns in pixels. For example, if you enter `100` in the field, then when you click outside the field, all the columns will be set to 100 pixels wide. -## Minimum column width +### Minimum column width By default, the minimum width of the table column is 150 pixels. This field option can override that default and will define the new minimum column width for the table in pixels. @@ -101,7 +106,7 @@ For example, if you enter `75` in the field, then when you click outside the fie For small-screen devices, such as smartphones or tablets, reduce the default `150` pixel value to`50` to allow table-based panels to render correctly in dashboards. -## Column alignment +### Column alignment Choose how Grafana should align cell contents: @@ -110,7 +115,17 @@ Choose how Grafana should align cell contents: - Center - Right -## Cell type +### Column filter + +You can temporarily change how column data is displayed. For example, you can order values from highest to lowest or hide specific values. For more information, refer to [Filter table columns](#filter-table-columns). + +### Pagination + +Use this option to enable or disable pagination. It is a front-end option that does not affect queries. When enabled, the page size automatically adjusts to the height of the table. + +## Cell options + +### Cell type By default, Grafana automatically chooses display settings. You can override the settings by choosing one of the following options to set the default for all fields. Additional configuration is available for some cell types. @@ -118,21 +133,17 @@ By default, Grafana automatically chooses display settings. You can override the If you set these in the Field tab, then the type will apply to all fields, including the time field. Many options will work best if you set them in the Override tab so that they can be restricted to one or more fields. {{% /admonition %}} -### Auto +#### Auto The **Auto** cell type automatically displays values, with sensible defaults applied. -Toggle the **Wrap text** switch to wrap text in the cell with the longest content or the matched field, if you've set a field override. - -### Color text +#### Color text If thresholds are set, then the field text is displayed in the appropriate threshold color. {{< figure src="/static/img/docs/tables/color-text.png" max-width="500px" caption="Color text" class="docs-image--no-shadow" >}} -Toggle the **Wrap text** switch to wrap text in the cell with the longest content or the matched field, if you've set a field override. - -### Color background (gradient or solid) +#### Color background (gradient or solid) If thresholds are set, then the field background is displayed in the appropriate threshold color. @@ -142,31 +153,29 @@ Toggle the **Apply to entire row** switch, to apply the background color that's {{< figure src="/static/img/docs/tables/colored-rows.png" max-width="500px" alt="Colored row background" class="docs-image--no-shadow" >}} -Toggle the **Wrap text** switch to wrap text in the cell with the longest content or the matched, if field you've set a field override. - -### Gauge +#### Gauge Cells can be displayed as a graphical gauge, with several different presentation types. -#### Basic +##### Basic The basic mode will show a simple gauge with the threshold levels defining the color of gauge. {{< figure src="/static/img/docs/tables/basic-gauge.png" max-width="500px" caption="Gradient gauge" class="docs-image--no-shadow" >}} -#### Gradient +##### Gradient The threshold levels define a gradient. {{< figure src="/static/img/docs/tables/gradient-gauge.png" max-width="500px" caption="Gradient gauge" class="docs-image--no-shadow" >}} -#### LCD +##### LCD The gauge is split up in small cells that are lit or unlit. {{< figure src="/static/img/docs/tables/lcd-gauge.png" max-width="500px" caption="LCD gauge" class="docs-image--no-shadow" >}} -#### Label Options +##### Label Options Additionally, labels displayed alongside of the gauges can be set to be colored by value, match the theme text color, or be hidden. @@ -182,17 +191,17 @@ Additionally, labels displayed alongside of the gauges can be set to be colored {{< figure src="/static/img/docs/tables/hidden-mode.png" max-width="500px" caption="Hide Label" class="docs-image--no-shadow" >}} -### Data links +#### Data links If you've configured data links, when the cell type is **Auto** mode, the cell text becomes clickable. If you change the cell type to **Data links**, the cell text reflects the titles of the configured data links. To control the application of data link text more granularly use a **Cell option > Cell type > Data links** field override. -### JSON view +#### JSON view Shows value formatted as code. If a value is an object the JSON view allowing browsing the JSON object will appear on hover. {{< figure src="/static/img/docs/tables/json-view.png" max-width="500px" caption="JSON view" class="docs-image--no-shadow" >}} -### Image +#### Image > Only available in Grafana 7.3+ @@ -200,7 +209,7 @@ If you have a field value that is an image URL or a base64 encoded image you can {{< figure src="/static/img/docs/v73/table_hover.gif" max-width="900px" caption="Table hover" >}} -### Sparkline +#### Sparkline Shows values rendered as a sparkline. You can show sparklines using the [Time series to table transformation](ref:time-series-to-table-transformation) on data with multiple time series to process it into a format the table can show. @@ -208,7 +217,15 @@ Shows values rendered as a sparkline. You can show sparklines using the [Time se You can be customize sparklines with many of the same options as the [Time series panel](ref:time-series-panel) including line width, fill opacity, and more. You can also change the color of the sparkline by updating the [color scheme](ref:color-scheme) in the _Standard options_ section of the panel configuration. -## Cell value inspect +### Wrap text + +{{< admonition type="note" >}} +Text wrapping is in [public preview](https://grafana.com/docs/release-life-cycle/#public-preview), however, it’s available to use by default. We’d love hear from you about how this new feature is working. To provide feedback, you can open an issue in the [Grafana GitHub repository](https://github.com/grafana/grafana). +{{< /admonition >}} + +Toggle the **Wrap text** switch to wrap text in the cell with the longest content in your table. To wrap the text in a specific column only, use the Wrap Text option in a [field override](ref:field-override). + +### Cell value inspect Enables value inspection from table cell. The raw value is presented in a modal window. @@ -216,19 +233,7 @@ Enables value inspection from table cell. The raw value is presented in a modal Cell value inspection is only available when cell display mode is set to Auto, Color text, Color background or JSON View. {{% /admonition %}} -## Column filter - -You can temporarily change how column data is displayed. For example, you can order values from highest to lowest or hide specific values. For more information, refer to [Filter table columns](#filter-table-columns). - -## Pagination - -Use this option to enable or disable pagination. It is a front-end option that does not affect queries. When enabled, the page size automatically adjusts to the height of the table. - -## Filter table columns - -If you turn on the **Column filter**, then you can filter table options. - -### Turn on column filtering +## Turn on column filtering 1. In Grafana, navigate to the dashboard with the table with the columns that you want to filter. 1. On the table panel you want to filter, open the panel editor. diff --git a/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md b/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md index 5a8951814e4..cb89be7135e 100644 --- a/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md +++ b/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md @@ -184,13 +184,14 @@ Experimental features might be changed or removed without prior notice. | `newDashboardSharingComponent` | Enables the new sharing drawer design | | `alertingListViewV2` | Enables the new alert list view design | | `notificationBanner` | Enables the notification banner UI and API | -| `dashboardRestore` | Enables deleted dashboard restore feature | +| `dashboardRestore` | Enables deleted dashboard restore feature (backend only) | | `alertingCentralAlertHistory` | Enables the new central alert history. | | `azureMonitorPrometheusExemplars` | Allows configuration of Azure Monitor as a data source that can provide Prometheus exemplars | | `pinNavItems` | Enables pinning of nav items | | `failWrongDSUID` | Throws an error if a datasource has an invalid UIDs | | `databaseReadReplica` | Use a read replica for some database queries. | | `alertingApiServer` | Register Alerting APIs with the K8s API server | +| `dashboardRestoreUI` | Enables the frontend to be able to restore a recently deleted dashboard | ## Development feature toggles diff --git a/docs/sources/upgrade-guide/upgrade-v11.1/index.md b/docs/sources/upgrade-guide/upgrade-v11.1/index.md new file mode 100644 index 00000000000..4e7178ee2b8 --- /dev/null +++ b/docs/sources/upgrade-guide/upgrade-v11.1/index.md @@ -0,0 +1,22 @@ +--- +description: Guide for upgrading to Grafana v11.1 +keywords: + - grafana + - configuration + - documentation + - upgrade + - '11.1' +title: Upgrade to Grafana v11.1 +menuTitle: Upgrade to v11.1 +weight: 1100 +--- + +# Upgrade to Grafana v11.1 + +{{< docs/shared lookup="upgrade/intro.md" source="grafana" version="" >}} + +{{< docs/shared lookup="back-up/back-up-grafana.md" source="grafana" version="" leveloffset="+1" >}} + +{{< docs/shared lookup="upgrade/upgrade-common-tasks.md" source="grafana" version="" >}} + +## Technical notes diff --git a/docs/sources/whatsnew/_index.md b/docs/sources/whatsnew/_index.md index d7211700cdf..0058e464ba9 100644 --- a/docs/sources/whatsnew/_index.md +++ b/docs/sources/whatsnew/_index.md @@ -76,6 +76,7 @@ For a complete list of every change, with links to pull requests and related iss ## Grafana 11 +- [What's new in 11.1](https://grafana.com/docs/grafana//whatsnew/whats-new-in-v11-1/) - [What's new in 11.0](https://grafana.com/docs/grafana//whatsnew/whats-new-in-v11-0/) ## Grafana 10 diff --git a/docs/sources/whatsnew/whats-new-in-v11-1.md b/docs/sources/whatsnew/whats-new-in-v11-1.md new file mode 100644 index 00000000000..914523a7f78 --- /dev/null +++ b/docs/sources/whatsnew/whats-new-in-v11-1.md @@ -0,0 +1,193 @@ +--- +description: Feature and improvement highlights for Grafana v11.1 +keywords: + - grafana + - new + - documentation + - '11.1' + - release notes +labels: +products: + - cloud + - enterprise + - oss +title: What's new in Grafana v11.1 +weight: -43 +--- + + + + +# What’s new in Grafana v11.1 + +Welcome to Grafana 11.1! This release contains some minor improvements following on the big announcements in Grafana 11.0. We've adding cell text wrapping to table visualizations, a much-requested feature. We've also redesigned the Alerting settings page and made it possible to manage access to Silences using role-based access control (RBAC). A number of accessibility improvements are included in this release, making Grafana easier to use for everyone. And lastly, the XY chart is now generally available. + +{{< youtube id="gjQX9-7Hsfs" >}} + +For even more detail about all the changes in this release, refer to the [changelog](https://github.com/grafana/grafana/blob/main/CHANGELOG.md). For the specific steps we recommend when you upgrade to v11.1, check out our [Upgrade Guide](https://grafana.com/docs/grafana//upgrade-guide/upgrade-v11.1/). + +## Dashboards and visualizations + +### Visualization ease of use improvements + + + +We’ve made a number of small improvements to the data visualization experience in Grafana. + +#### Table cell text wrapping + +_Available in public preview in all editions of Grafana_ + +A longstanding feature request for the table visualization is to allow wrapping of text within cells. In Grafana 11.1 we've added this capability! By default, the column with the longest text is selected for wrapping. You can also configure wrapping manually using field overrides. + +Learn more about the table panel in our [table panel documentation](https://grafana.com/docs/grafana//panels-visualizations/visualizations/table/). + +{{< youtube id="wBLxYp2BLAU" >}} + +{{< admonition type="note" >}} +Text wrapping is in [public preview](https://grafana.com/docs/release-life-cycle/#public-preview), however, it’s available to use by default. We’d love hear from you about how this new feature is working. To provide feedback, you can open an issue in the [Grafana GitHub repository](https://github.com/grafana/grafana). +{{< /admonition >}} + +#### Stat visualization percent change color mode options + +_Generally available in all editions of Grafana_ + +Sometimes less is more! The **Standard** behavior for percent change in the [stat visualization](https://grafana.com/docs/grafana//panels-visualizations/visualizations/stat/#show-percent-change) is to color positive percent changes green and negative percent changes red. Depending on your use case however, you may want to customize how percent change color is set. We've added the options to have percent change color mode **Inverted** (with positive red and negative green) or match the **Same as value**. + +{{< youtube id="LrkR6_hcqPc" >}} + +### XY chart is GA + + + +_Generally available in all editions of Grafana_ + +We’re promoting XY chart out of public preview and into general availability. + +XY charts provide a way to visualize arbitrary x and y values in a graph so that you can easily show the relationship between two variables. XY charts are typically used to create scatter plots. You can also use them to create bubble charts where field values determine the size of each bubble: + +![An xy chart showing height weight distribution](/media/docs/grafana/panels-visualizations/screenshot-xy-charts-v11.0.png) + +Over the past several months we’ve introduced multiple enhancements to the visualizations like auto mode, which now handles most scenarios that previously required manual configuration. Additionally, we've added better control over point styling and further improved performance. We’re excited to include XY chart as a first class citizen in the core Grafana visualization library. To learn more about the panel, refer to [the documentation](https://grafana.com/docs/grafana//panels-visualizations/visualizations/xy-chart/). + +To use the new XY chart visualization, you must first enable the `autoMigrateXYChartPanel` [feature toggle](https://grafana.com/docs/grafana//setup-grafana/configure-grafana/feature-toggles/). + +{{< youtube id="3d3Lx-Jz_kM" >}} + +## Alerting + +### Re-designed settings page for Alerting + + + +_Generally available in all editions of Grafana_ + +The new settings page provides you with a holistic view of where Grafana-managed alert instances are forwarded. + +- Manage which Alertmanagers receive alert instances from Grafana-managed rules without navigating and editing data sources. +- Manage version snapshots for the built-in Alertmanager, which allows administrators to roll back unintentional changes or mistakes in the Alertmanager configuration. +- There is also a visual diff that compares the historical snapshot with the latest configuration to see which changes were made. + +{{< figure src="/media/docs/alerting/alert-settings.png" alt="Alert settings page" >}} + +Learn more in the [Alertmanager configuration documentation](https://grafana.com/docs/grafana//alerting/set-up/configure-alertmanager/). + +### Alerting template selector + + + +_Generally available in all editions of Grafana_ + +Enables you to easily choose which templates you want to use in your alert notification messages by adding a template selector in the Contact Points form. + +Select from existing templates or enter a custom one for your specific needs. You can switch between the two tabs to access the list of available templates and copy them across to the customized version. + +Learn more in the [documentation](https://grafana.com/docs/grafana//alerting/configure-notifications/manage-contact-points/). + +### Add OAuth2 to HTTP settings for vanilla Alertmanager / Mimir + + + +_Generally available in all editions of Grafana_ + +Configure OAuth2 authentication for any Alertmanager or Mimir receiver (called Contact Points in Grafana) through the user interface. Learn more about alerting contact points in [supported contact point integrations](https://grafana.com/docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/manage-contact-points/#list-of-supported-integrations) and find the reference for Oauth2 fields in the [Prometheus Alertmanager docs for Oauth2](https://prometheus.io/docs/alerting/latest/configuration/#oauth2). + +Note that OAuth2 is not yet implemented for the Grafana built-in Alertmanager. + +### Improved paused alert visibility + + + +_Generally available in all editions of Grafana_ + +Pause and resume alert rule evaluation directly from the Alert rules list and details view. This helps Improve visibility of when alert rules have been paused by displaying “Paused” as the alert rule state. + +Learn more in the [alert rules documentation](https://grafana.com/docs/grafana//alerting/manage-notifications/view-alert-rules/). + +### Removes requirement of datasources:query permission for reading rules + + + +_Generally available in Grafana Enterprise and Cloud_ + +Fetching a rule group no longer requires the **datasources:query** permission for every data source used by the rules within that group. Now, the only requirements are **alert.rules:read** and **folders:read** for the folder the group is contained in. + +Note: **datasources:query** is still required to preview an alert rule, regardless of alert rules and folders permissions. + +Learn more in the [RBAC configuration documentation](https://grafana.com/docs/grafana-cloud/alerting-and-irm/alerting/set-up/configure-rbac/). + +### Rule-specific silences with permissions + + + +_Generally available in all editions of Grafana_ + +More easily create silences directly from the Alert rule list view or detail page. + +These rule-specific silences are guaranteed to only apply to a single rule and permissions to read, create, update or delete are tied to a user’s permissions for that rule. + +### Rule-specific silences with RBAC + + + +_Generally available in Grafana Enterprise and Cloud_ + +Manage silences through Role-Based Access Control (RBAC). In addition to the Grafana open source functionality in **Rule-specific silences with permissions**, you can choose who can create, edit, and read silences using the following permissions: + +- Users with the **alert.silences:create permission**, scoped within a folder, are able to create silences for rules contained within that folder and its subfolders +- Users with the **alert.silences:read permission**, scoped within a folder, are able to read silences for rules contained within that folder and its subfolders, and general silences +- Users with the **alert.silences:write permission**, scoped within a folder, are able to expire and recreate silences for rules contained within that folder and its subfolders + +Learn more about [managing access using roles](https://grafana.com/docs/grafana-cloud/alerting-and-irm/alerting/set-up/configure-rbac/access-roles/). + +### Support for AWS SNS integration in Grafana-managed alerts + + + +_Generally available in all editions of Grafana_ + +Send alerts notifications to AWS simple notifications service. + +## Recent accessibility improvements + + + +_Generally available in all editions of Grafana_ + +### GeoMap keyboard support + +The GeoMap panel can now be used with a keyboard! Focus the map area, move around with the arrows keys and zoom in and out using + and -. + +### Panel shortcut keyboard support + +We have [panel shortcuts](https://grafana.com/docs/grafana//dashboards/use-dashboards/#keyboard-shortcuts), which previously only worked on whichever panel you hovered over. It now also takes into account the keyboard focus. + +{{< youtube id="Tc0pTXtCsKQ" >}} + +### Heading improvements + +The majority of screen reader users [find things on a web page using headings](https://webaim.org/projects/screenreadersurvey10/#finding). Recently, we have added missing headings and corrected heading levels in some places, most notably panel titles. + +### Reduced motion support + +Users who are affected by a lot of animations on a web site have the possibility to configure [reduced motion settings](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion). Grafana now supports this, either by making animations simpler or removing them altogether. We have [implemented a rule](https://github.com/grafana/grafana/tree/main/packages/grafana-eslint-rules#no-unreduced-motion), which prohibits unhandled transitions and animations, ensuring that we can continuously support reduced motion. diff --git a/e2e/scenes/various-suite/keybinds.spec.ts b/e2e/scenes/various-suite/keybinds.spec.ts index 02a45a6f42e..88e256b5576 100644 --- a/e2e/scenes/various-suite/keybinds.spec.ts +++ b/e2e/scenes/various-suite/keybinds.spec.ts @@ -52,16 +52,20 @@ describe.skip('Keyboard shortcuts', () => { zone: 'Browser', }); e2e.components.RefreshPicker.runButtonV2().should('have.text', 'Run query'); + let expectedRange = `Time range selected: 2024-06-05 10:05:00 to 2024-06-05 10:06:00`; + e2e.components.TimePicker.openButton().should('have.attr', 'aria-label', expectedRange); cy.log('Trying one shift-left'); cy.get('body').type('t{leftarrow}'); e2e.components.RefreshPicker.runButtonV2().should('have.text', 'Run query'); - let expectedRange = `Time range selected: 2024-06-05 10:04:00 to 2024-06-05 10:05:00`; // 1 min back + expectedRange = `Time range selected: 2024-06-05 10:04:00 to 2024-06-05 10:05:00`; // 1 min back e2e.components.TimePicker.openButton().should('have.attr', 'aria-label', expectedRange); cy.log('Trying two shift-lefts'); cy.get('body').type('t{leftarrow}'); e2e.components.RefreshPicker.runButtonV2().should('have.text', 'Run query'); + expectedRange = `Time range selected: 2024-06-05 10:03:00 to 2024-06-05 10:04:00`; // 1 min back + e2e.components.TimePicker.openButton().should('have.attr', 'aria-label', expectedRange); cy.get('body').type('t{leftarrow}'); e2e.components.RefreshPicker.runButtonV2().should('have.text', 'Run query'); expectedRange = `Time range selected: 2024-06-05 10:02:00 to 2024-06-05 10:03:00`; // 2 mins back @@ -70,11 +74,15 @@ describe.skip('Keyboard shortcuts', () => { cy.log('Trying two shift-lefts and a shift-right'); cy.get('body').type('t{leftarrow}'); e2e.components.RefreshPicker.runButtonV2().should('have.text', 'Run query'); + expectedRange = `Time range selected: 2024-06-05 10:01:00 to 2024-06-05 10:02:00`; // 1 min back + e2e.components.TimePicker.openButton().should('have.attr', 'aria-label', expectedRange); cy.get('body').type('t{leftarrow}'); e2e.components.RefreshPicker.runButtonV2().should('have.text', 'Run query'); + expectedRange = `Time range selected: 2024-06-05 10:00:00 to 2024-06-05 10:01:00`; // 2 mins back + e2e.components.TimePicker.openButton().should('have.attr', 'aria-label', expectedRange); cy.get('body').type('t{rightarrow}'); e2e.components.RefreshPicker.runButtonV2().should('have.text', 'Run query'); - expectedRange = `Time range selected: 2024-06-05 10:01:00 to 2024-06-05 10:02:00`; // 2 mins back, 1 min forward (1 min back total) + expectedRange = `Time range selected: 2024-06-05 10:01:00 to 2024-06-05 10:02:00`; // 1 min forward (1 min back total) e2e.components.TimePicker.openButton().should('have.attr', 'aria-label', expectedRange); }); }); diff --git a/e2e/various-suite/keybinds.spec.ts b/e2e/various-suite/keybinds.spec.ts index 07635c4df74..37f3c8da9c0 100644 --- a/e2e/various-suite/keybinds.spec.ts +++ b/e2e/various-suite/keybinds.spec.ts @@ -65,6 +65,8 @@ describe('Keyboard shortcuts', () => { cy.log('Trying two shift-lefts'); cy.get('body').type('t{leftarrow}'); e2e.components.RefreshPicker.runButtonV2().should('have.text', 'Run query'); + expectedRange = `Time range selected: 2024-06-05 10:03:00 to 2024-06-05 10:04:00`; // 1 min back + e2e.components.TimePicker.openButton().should('have.attr', 'aria-label', expectedRange); cy.get('body').type('t{leftarrow}'); e2e.components.RefreshPicker.runButtonV2().should('have.text', 'Run query'); expectedRange = `Time range selected: 2024-06-05 10:02:00 to 2024-06-05 10:03:00`; // 2 mins back @@ -73,11 +75,15 @@ describe('Keyboard shortcuts', () => { cy.log('Trying two shift-lefts and a shift-right'); cy.get('body').type('t{leftarrow}'); e2e.components.RefreshPicker.runButtonV2().should('have.text', 'Run query'); + expectedRange = `Time range selected: 2024-06-05 10:01:00 to 2024-06-05 10:02:00`; // 1 min back + e2e.components.TimePicker.openButton().should('have.attr', 'aria-label', expectedRange); cy.get('body').type('t{leftarrow}'); e2e.components.RefreshPicker.runButtonV2().should('have.text', 'Run query'); + expectedRange = `Time range selected: 2024-06-05 10:00:00 to 2024-06-05 10:01:00`; // 2 mins back + e2e.components.TimePicker.openButton().should('have.attr', 'aria-label', expectedRange); cy.get('body').type('t{rightarrow}'); e2e.components.RefreshPicker.runButtonV2().should('have.text', 'Run query'); - expectedRange = `Time range selected: 2024-06-05 10:01:00 to 2024-06-05 10:02:00`; // 2 mins back, 1 min forward (1 min back total) + expectedRange = `Time range selected: 2024-06-05 10:01:00 to 2024-06-05 10:02:00`; // 1 min forward (1 min back total) e2e.components.TimePicker.openButton().should('have.attr', 'aria-label', expectedRange); }); }); diff --git a/go.mod b/go.mod index 28ff3ec4cb6..a0e6b937d7b 100644 --- a/go.mod +++ b/go.mod @@ -30,6 +30,7 @@ require ( github.com/Masterminds/semver v1.5.0 // @grafana/grafana-backend-group github.com/Masterminds/semver/v3 v3.2.0 // @grafana/grafana-release-guild github.com/Masterminds/sprig/v3 v3.2.3 // @grafana/grafana-backend-group + github.com/Masterminds/squirrel v1.5.4 // @grafana/identity-access-team github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // @grafana/plugins-platform-backend github.com/VividCortex/mysqlerr v0.0.0-20170204212430-6c6b55f8796f // @grafana/grafana-backend-group github.com/alicebob/miniredis/v2 v2.30.1 // @grafana/alerting-backend @@ -93,11 +94,11 @@ require ( github.com/grafana/grafana-plugin-sdk-go v0.235.0 // @grafana/plugins-platform-backend github.com/grafana/grafana/pkg/apimachinery v0.0.0-20240613084659-7e9e5f534676 // @grafana/grafana-app-platform-squad github.com/grafana/grafana/pkg/apiserver v0.0.0-20240226124929-648abdbd0ea4 // @grafana/grafana-app-platform-squad - github.com/grafana/grafana/pkg/storage/unified/resource v0.0.0-20240620184539-d988f5c3b064 // @grafana/grafana-search-and-storage // This needs to be here for other projects that import grafana/grafana // For local development grafana/grafana will always use the local files // Check go.work file for details github.com/grafana/grafana/pkg/promlib v0.0.6 // @grafana/observability-metrics + github.com/grafana/grafana/pkg/storage/unified/resource v0.0.0-20240624122844-a89deaeb7365 // @grafana/grafana-search-and-storage github.com/grafana/otel-profiling-go v0.5.1 // @grafana/grafana-backend-group github.com/grafana/pyroscope-go/godeltaprof v0.1.7 // @grafana/observability-traces-and-profiling github.com/grafana/pyroscope/api v0.3.0 // @grafana/observability-traces-and-profiling @@ -130,6 +131,7 @@ require ( github.com/modern-go/reflect2 v1.0.2 // @grafana/alerting-backend github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // @grafana/alerting-backend github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // @grafana/grafana-operator-experience-squad + github.com/oklog/ulid/v2 v2.1.0 // @grafana/identity-access-team github.com/olekukonko/tablewriter v0.0.5 // @grafana/grafana-backend-group github.com/openfga/api/proto v0.0.0-20240529184453-5b0b4941f3e0 // @grafana/identity-access-team github.com/openfga/openfga v1.5.4 // @grafana/identity-access-team @@ -436,9 +438,11 @@ require ( ) require ( - github.com/Masterminds/squirrel v1.5.4 // indirect + github.com/antlr4-go/antlr/v4 v4.13.0 // indirect github.com/envoyproxy/protoc-gen-validate v1.0.4 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect + github.com/hashicorp/go-cleanhttp v0.5.2 // indirect + github.com/hashicorp/go-retryablehttp v0.7.5 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect @@ -451,7 +455,7 @@ require ( github.com/mfridman/interpolate v0.0.2 // indirect github.com/natefinch/wrap v0.2.0 // indirect github.com/ncruces/go-strftime v0.1.9 // indirect - github.com/oklog/ulid/v2 v2.1.0 // indirect + github.com/openfga/language/pkg/go v0.0.0-20240409225820-a53ea2892d6d // indirect github.com/pelletier/go-toml/v2 v2.1.1 // indirect github.com/pressly/goose/v3 v3.20.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect diff --git a/go.sum b/go.sum index bf38bb7794b..d6616ff8998 100644 --- a/go.sum +++ b/go.sum @@ -2334,7 +2334,8 @@ github.com/grafana/grafana/pkg/apiserver v0.0.0-20240226124929-648abdbd0ea4 h1:t github.com/grafana/grafana/pkg/apiserver v0.0.0-20240226124929-648abdbd0ea4/go.mod h1:vpYI6DHvFO595rpQGooUjcyicjt9rOevldDdW79peV0= github.com/grafana/grafana/pkg/promlib v0.0.6 h1:FuRyHMIgVVXkLuJnCflNfk3gqJflmyiI+/ZuJ9MoAfY= github.com/grafana/grafana/pkg/promlib v0.0.6/go.mod h1:shFkrG1fQ/PPNRGhxAPNMLp0SAeG/jhqaLoG6n2191M= -github.com/grafana/grafana/pkg/storage/unified/resource v0.0.0-20240620184539-d988f5c3b064 h1:iuVV3yc8tg2mmKZw5x1zFvkFJ38FCr2qfgfAPACMMbo= +github.com/grafana/grafana/pkg/storage/unified/resource v0.0.0-20240624122844-a89deaeb7365 h1:XRHqYGxjN2+/4QHPoOtr7kYTL9p2P5UxTXfnbiaO/NI= +github.com/grafana/grafana/pkg/storage/unified/resource v0.0.0-20240624122844-a89deaeb7365/go.mod h1:X4dwV2eQI8z8G2aHXvhZZXu/y/rb3psQXuaZa66WZfA= github.com/grafana/grafana/pkg/util/xorm v0.0.1 h1:72QZjxWIWpSeOF8ob4aMV058kfgZyeetkAB8dmeti2o= github.com/grafana/grafana/pkg/util/xorm v0.0.1/go.mod h1:eNfbB9f2jM8o9RfwqwjY8SYm5tvowJ8Ly+iE4P9rXII= github.com/grafana/otel-profiling-go v0.5.1 h1:stVPKAFZSa7eGiqbYuG25VcqYksR6iWvF3YH66t4qL8= diff --git a/go.work.sum b/go.work.sum index 67777871a32..cfc2c70830a 100644 --- a/go.work.sum +++ b/go.work.sum @@ -479,7 +479,6 @@ github.com/alecthomas/kingpin/v2 v2.4.0 h1:f48lwail6p8zpO1bC4TxtqACaGqHYA22qkHjH github.com/alecthomas/kong v0.2.11 h1:RKeJXXWfg9N47RYfMm0+igkxBCTF4bzbneAxaqid0c4= github.com/alecthomas/kong v0.2.11/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE= github.com/alecthomas/participle/v2 v2.1.0 h1:z7dElHRrOEEq45F2TG5cbQihMtNTv8vwldytDj7Wrz4= -github.com/alecthomas/participle/v2 v2.1.0/go.mod h1:Y1+hAs8DHPmc3YUFzqllV+eSQ9ljPTk0ZkPMtEdAx2c= github.com/alecthomas/repr v0.2.0 h1:HAzS41CIzNW5syS8Mf9UwXhNH1J9aix/BvDRf1Ml2Yk= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM= github.com/alexflint/go-arg v1.4.2/go.mod h1:9iRbDxne7LcR/GSvEr7ma++GLpdIU1zrghf2y2768kM= @@ -886,7 +885,6 @@ github.com/gobwas/pool v0.2.1 h1:xfeeEhW7pwmX8nuLVlqbzVc7udMDrwetjEv+TZIz1og= github.com/gobwas/ws v1.2.1 h1:F2aeBZrm2NDsc7vbovKrWSogd4wvfAxg0FQ89/iqOTk= github.com/gobwas/ws v1.3.0/go.mod h1:hRKAFb8wOxFROYNsT1bqfWnhX+b5MFeJM9r2ZSwg/KY= github.com/goccy/go-yaml v1.11.0 h1:n7Z+zx8S9f9KgzG6KtQKf+kwqXZlLNR2F6018Dgau54= -github.com/goccy/go-yaml v1.11.0/go.mod h1:H+mJrWtjPTJAHvRbV09MCK9xYwODM+wRTVFFTWckfng= github.com/gocql/gocql v0.0.0-20190301043612-f6df8288f9b4 h1:vF83LI8tAakwEwvWZtrIEx7pOySacl2TOxx6eXk4ePo= github.com/godbus/dbus v0.0.0-20151105175453-c7fdd8b5cd55/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= github.com/godbus/dbus v0.0.0-20180201030542-885f9cc04c9c/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= @@ -957,6 +955,7 @@ github.com/grafana/grafana-plugin-sdk-go v0.231.1-0.20240523124942-62dae9836284/ github.com/grafana/grafana-plugin-sdk-go v0.234.0/go.mod h1:FlXjmBESxaD6Hoi8ojWLkH007nyjtJM3XC8SpwzF/YE= github.com/grafana/grafana/pkg/apimachinery v0.0.0-20240613114114-5e2f08de316d/go.mod h1:adT8O7k6ZSzUKjAC4WS6VfWlCE4G1VavPwSXVhvScCs= github.com/grafana/grafana/pkg/promlib v0.0.3/go.mod h1:3El4NlsfALz8QQCbEGHGFvJUG+538QLMuALRhZ3pcoo= +github.com/grafana/grafana/pkg/storage/unified/resource v0.0.0-20240620152449-c88de7f4d073/go.mod h1:zOInHv2y6bsgm9bIMsCVDaz1XylqIVX9r4amH4iuWPE= github.com/grafana/grafana/pkg/storage/unified/resource v0.0.0-20240620184539-d988f5c3b064/go.mod h1:zOInHv2y6bsgm9bIMsCVDaz1XylqIVX9r4amH4iuWPE= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= diff --git a/packages/grafana-data/src/context/plugins/DataSourcePluginContextProvider.tsx b/packages/grafana-data/src/context/plugins/DataSourcePluginContextProvider.tsx index ec61e62713e..8747615a7cf 100644 --- a/packages/grafana-data/src/context/plugins/DataSourcePluginContextProvider.tsx +++ b/packages/grafana-data/src/context/plugins/DataSourcePluginContextProvider.tsx @@ -1,4 +1,4 @@ -import React, { PropsWithChildren, ReactElement, useMemo } from 'react'; +import { PropsWithChildren, ReactElement, useMemo } from 'react'; import { DataSourceInstanceSettings } from '../../types'; diff --git a/packages/grafana-data/src/context/plugins/PluginContextProvider.tsx b/packages/grafana-data/src/context/plugins/PluginContextProvider.tsx index 282db933825..f60381c5aaa 100644 --- a/packages/grafana-data/src/context/plugins/PluginContextProvider.tsx +++ b/packages/grafana-data/src/context/plugins/PluginContextProvider.tsx @@ -1,4 +1,4 @@ -import React, { PropsWithChildren, ReactElement } from 'react'; +import { PropsWithChildren, ReactElement } from 'react'; import { PluginMeta } from '../../types/plugin'; diff --git a/packages/grafana-data/src/panel/PanelPlugin.test.tsx b/packages/grafana-data/src/panel/PanelPlugin.test.tsx index e4451b73244..35ef52186ab 100644 --- a/packages/grafana-data/src/panel/PanelPlugin.test.tsx +++ b/packages/grafana-data/src/panel/PanelPlugin.test.tsx @@ -1,5 +1,3 @@ -import React from 'react'; - import { PanelOptionsEditorBuilder } from '..'; import { identityOverrideProcessor, diff --git a/packages/grafana-data/src/themes/context.tsx b/packages/grafana-data/src/themes/context.tsx index dc87729e9fb..e3536450c27 100644 --- a/packages/grafana-data/src/themes/context.tsx +++ b/packages/grafana-data/src/themes/context.tsx @@ -1,8 +1,8 @@ -import React from 'react'; +import { createContext } from 'react'; import { createTheme } from './createTheme'; /** @public */ -export const ThemeContext = React.createContext(createTheme()); +export const ThemeContext = createContext(createTheme()); ThemeContext.displayName = 'ThemeContext'; diff --git a/packages/grafana-data/src/transformations/standardTransformersRegistry.ts b/packages/grafana-data/src/transformations/standardTransformersRegistry.ts index 3abc4de896b..e04950873be 100644 --- a/packages/grafana-data/src/transformations/standardTransformersRegistry.ts +++ b/packages/grafana-data/src/transformations/standardTransformersRegistry.ts @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { DataFrame, DataTransformerInfo } from '../types'; import { Registry, RegistryItem } from '../utils/Registry'; diff --git a/packages/grafana-data/src/types/featureToggles.gen.ts b/packages/grafana-data/src/types/featureToggles.gen.ts index a486b944f46..c7604419577 100644 --- a/packages/grafana-data/src/types/featureToggles.gen.ts +++ b/packages/grafana-data/src/types/featureToggles.gen.ts @@ -198,4 +198,5 @@ export interface FeatureToggles { zanzana?: boolean; passScopeToDashboardApi?: boolean; alertingApiServer?: boolean; + dashboardRestoreUI?: boolean; } diff --git a/packages/grafana-data/src/types/pluginExtensions.ts b/packages/grafana-data/src/types/pluginExtensions.ts index d0c78553630..00594fad001 100644 --- a/packages/grafana-data/src/types/pluginExtensions.ts +++ b/packages/grafana-data/src/types/pluginExtensions.ts @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { DataQuery, DataSourceJsonData } from '@grafana/schema'; diff --git a/packages/grafana-data/src/utils/LocalStorageValueProvider.tsx b/packages/grafana-data/src/utils/LocalStorageValueProvider.tsx index f8491c8dece..fb6d8137315 100644 --- a/packages/grafana-data/src/utils/LocalStorageValueProvider.tsx +++ b/packages/grafana-data/src/utils/LocalStorageValueProvider.tsx @@ -1,4 +1,5 @@ -import React, { useEffect, useState } from 'react'; +import { useEffect, useState } from 'react'; +import * as React from 'react'; import { store } from './store'; diff --git a/packages/grafana-data/tsconfig.json b/packages/grafana-data/tsconfig.json index fcc5100b8f8..d6da863dda3 100644 --- a/packages/grafana-data/tsconfig.json +++ b/packages/grafana-data/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "jsx": "react-jsx", "declarationDir": "./compiled", "emitDeclarationOnly": true, "isolatedModules": true, diff --git a/packages/grafana-flamegraph/src/FlameGraph/FlameGraph.test.tsx b/packages/grafana-flamegraph/src/FlameGraph/FlameGraph.test.tsx index 3fb3f0585f5..64dc10da72e 100644 --- a/packages/grafana-flamegraph/src/FlameGraph/FlameGraph.test.tsx +++ b/packages/grafana-flamegraph/src/FlameGraph/FlameGraph.test.tsx @@ -1,5 +1,5 @@ import { fireEvent, render, screen } from '@testing-library/react'; -import React from 'react'; +import * as React from 'react'; import { createDataFrame } from '@grafana/data'; diff --git a/packages/grafana-flamegraph/src/FlameGraph/FlameGraph.tsx b/packages/grafana-flamegraph/src/FlameGraph/FlameGraph.tsx index c05f2227c2f..ffd8c88d4f9 100644 --- a/packages/grafana-flamegraph/src/FlameGraph/FlameGraph.tsx +++ b/packages/grafana-flamegraph/src/FlameGraph/FlameGraph.tsx @@ -17,7 +17,8 @@ // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF // THIS SOFTWARE. import { css, cx } from '@emotion/css'; -import React, { useEffect, useState } from 'react'; +import { useEffect, useState } from 'react'; +import * as React from 'react'; import { Icon } from '@grafana/ui'; diff --git a/packages/grafana-flamegraph/src/FlameGraph/FlameGraphCanvas.tsx b/packages/grafana-flamegraph/src/FlameGraph/FlameGraphCanvas.tsx index df4131317ab..aae1d69276e 100644 --- a/packages/grafana-flamegraph/src/FlameGraph/FlameGraphCanvas.tsx +++ b/packages/grafana-flamegraph/src/FlameGraph/FlameGraphCanvas.tsx @@ -1,5 +1,6 @@ import { css } from '@emotion/css'; -import React, { MouseEvent as ReactMouseEvent, useCallback, useEffect, useRef, useState } from 'react'; +import { MouseEvent as ReactMouseEvent, useCallback, useEffect, useRef, useState } from 'react'; +import * as React from 'react'; import { useMeasure } from 'react-use'; import { PIXELS_PER_LEVEL } from '../constants'; diff --git a/packages/grafana-flamegraph/src/FlameGraph/FlameGraphContextMenu.tsx b/packages/grafana-flamegraph/src/FlameGraph/FlameGraphContextMenu.tsx index c84d4810f42..a4570305a34 100644 --- a/packages/grafana-flamegraph/src/FlameGraph/FlameGraphContextMenu.tsx +++ b/packages/grafana-flamegraph/src/FlameGraph/FlameGraphContextMenu.tsx @@ -1,5 +1,3 @@ -import React from 'react'; - import { DataFrame } from '@grafana/data'; import { MenuItem, MenuGroup, ContextMenu, IconName } from '@grafana/ui'; diff --git a/packages/grafana-flamegraph/src/FlameGraph/FlameGraphMetadata.test.tsx b/packages/grafana-flamegraph/src/FlameGraph/FlameGraphMetadata.test.tsx index 5779255ce9c..379224d4761 100644 --- a/packages/grafana-flamegraph/src/FlameGraph/FlameGraphMetadata.test.tsx +++ b/packages/grafana-flamegraph/src/FlameGraph/FlameGraphMetadata.test.tsx @@ -1,6 +1,6 @@ import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; +import * as React from 'react'; import FlameGraphMetadata from './FlameGraphMetadata'; import { textToDataContainer } from './testHelpers'; diff --git a/packages/grafana-flamegraph/src/FlameGraph/FlameGraphMetadata.tsx b/packages/grafana-flamegraph/src/FlameGraph/FlameGraphMetadata.tsx index a24b96f7f19..488b48965b3 100644 --- a/packages/grafana-flamegraph/src/FlameGraph/FlameGraphMetadata.tsx +++ b/packages/grafana-flamegraph/src/FlameGraph/FlameGraphMetadata.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { ReactNode } from 'react'; +import { memo, ReactNode } from 'react'; import { getValueFormat, GrafanaTheme2 } from '@grafana/data'; import { Icon, IconButton, useStyles2 } from '@grafana/ui'; @@ -17,7 +17,7 @@ type Props = { sandwichedLabel?: string; }; -const FlameGraphMetadata = React.memo( +const FlameGraphMetadata = memo( ({ data, focusedItem, totalTicks, sandwichedLabel, onFocusPillClick, onSandwichPillClick }: Props) => { const styles = useStyles2(getStyles); const parts: ReactNode[] = []; diff --git a/packages/grafana-flamegraph/src/FlameGraph/FlameGraphTooltip.tsx b/packages/grafana-flamegraph/src/FlameGraph/FlameGraphTooltip.tsx index 62f4a53343a..b9dca5a3a94 100644 --- a/packages/grafana-flamegraph/src/FlameGraph/FlameGraphTooltip.tsx +++ b/packages/grafana-flamegraph/src/FlameGraph/FlameGraphTooltip.tsx @@ -1,5 +1,4 @@ import { css } from '@emotion/css'; -import React from 'react'; import { DisplayValue, getValueFormat, GrafanaTheme2 } from '@grafana/data'; import { InteractiveTable, Portal, useStyles2, VizTooltipContainer } from '@grafana/ui'; diff --git a/packages/grafana-flamegraph/src/FlameGraphContainer.test.tsx b/packages/grafana-flamegraph/src/FlameGraphContainer.test.tsx index 12e1423f448..00d9e019e71 100644 --- a/packages/grafana-flamegraph/src/FlameGraphContainer.test.tsx +++ b/packages/grafana-flamegraph/src/FlameGraphContainer.test.tsx @@ -1,6 +1,6 @@ import { render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React, { useCallback } from 'react'; +import { useRef, useCallback } from 'react'; import { createDataFrame, createTheme } from '@grafana/data'; @@ -10,7 +10,7 @@ import { MIN_WIDTH_TO_SHOW_BOTH_TOPTABLE_AND_FLAMEGRAPH } from './constants'; jest.mock('react-use', () => ({ useMeasure: () => { - const ref = React.useRef(); + const ref = useRef(); return [ref, { width: 1600 }]; }, })); diff --git a/packages/grafana-flamegraph/src/FlameGraphContainer.tsx b/packages/grafana-flamegraph/src/FlameGraphContainer.tsx index e42fab741e4..d1ff3652e45 100644 --- a/packages/grafana-flamegraph/src/FlameGraphContainer.tsx +++ b/packages/grafana-flamegraph/src/FlameGraphContainer.tsx @@ -1,6 +1,7 @@ import { css } from '@emotion/css'; import uFuzzy from '@leeoniya/ufuzzy'; -import React, { useCallback, useEffect, useMemo, useState } from 'react'; +import { useCallback, useEffect, useMemo, useState } from 'react'; +import * as React from 'react'; import { useMeasure } from 'react-use'; import { DataFrame, GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-flamegraph/src/FlameGraphHeader.test.tsx b/packages/grafana-flamegraph/src/FlameGraphHeader.test.tsx index 24da2445064..546450dad2b 100644 --- a/packages/grafana-flamegraph/src/FlameGraphHeader.test.tsx +++ b/packages/grafana-flamegraph/src/FlameGraphHeader.test.tsx @@ -1,7 +1,7 @@ import '@testing-library/jest-dom'; import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; +import * as React from 'react'; import { CollapsedMap } from './FlameGraph/dataTransform'; import FlameGraphHeader from './FlameGraphHeader'; diff --git a/packages/grafana-flamegraph/src/FlameGraphHeader.tsx b/packages/grafana-flamegraph/src/FlameGraphHeader.tsx index a5f4f4c084b..8024dd68d8c 100644 --- a/packages/grafana-flamegraph/src/FlameGraphHeader.tsx +++ b/packages/grafana-flamegraph/src/FlameGraphHeader.tsx @@ -1,5 +1,6 @@ import { css, cx } from '@emotion/css'; -import React, { useEffect, useState } from 'react'; +import { useEffect, useState } from 'react'; +import * as React from 'react'; import useDebounce from 'react-use/lib/useDebounce'; import usePrevious from 'react-use/lib/usePrevious'; diff --git a/packages/grafana-flamegraph/src/TopTable/FlameGraphTopTableContainer.test.tsx b/packages/grafana-flamegraph/src/TopTable/FlameGraphTopTableContainer.test.tsx index 03d4ddb153b..0396e536535 100644 --- a/packages/grafana-flamegraph/src/TopTable/FlameGraphTopTableContainer.test.tsx +++ b/packages/grafana-flamegraph/src/TopTable/FlameGraphTopTableContainer.test.tsx @@ -1,6 +1,5 @@ import { render, screen } from '@testing-library/react'; import userEvents from '@testing-library/user-event'; -import React from 'react'; import { createDataFrame } from '@grafana/data'; diff --git a/packages/grafana-flamegraph/src/TopTable/FlameGraphTopTableContainer.tsx b/packages/grafana-flamegraph/src/TopTable/FlameGraphTopTableContainer.tsx index 491230334f1..1ee3f172fa4 100644 --- a/packages/grafana-flamegraph/src/TopTable/FlameGraphTopTableContainer.tsx +++ b/packages/grafana-flamegraph/src/TopTable/FlameGraphTopTableContainer.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { useMemo, useState } from 'react'; +import { memo, useMemo, useState } from 'react'; import AutoSizer from 'react-virtualized-auto-sizer'; import { @@ -41,7 +41,7 @@ type Props = { colorScheme: ColorScheme | ColorSchemeDiff; }; -const FlameGraphTopTableContainer = React.memo( +const FlameGraphTopTableContainer = memo( ({ data, onSymbolClick, diff --git a/packages/grafana-flamegraph/tsconfig.json b/packages/grafana-flamegraph/tsconfig.json index 03aa83f469f..0092e86ac62 100644 --- a/packages/grafana-flamegraph/tsconfig.json +++ b/packages/grafana-flamegraph/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "jsx": "react-jsx", "baseUrl": "./", "declarationDir": "./compiled", "emitDeclarationOnly": true, diff --git a/packages/grafana-icons/src/IconBase.tsx b/packages/grafana-icons/src/IconBase.tsx index 5c3983f0442..51b2d432d6c 100644 --- a/packages/grafana-icons/src/IconBase.tsx +++ b/packages/grafana-icons/src/IconBase.tsx @@ -1,4 +1,4 @@ -import React, { SVGProps } from 'react'; +import { SVGProps } from 'react'; export type IconSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | 'xxxl'; diff --git a/packages/grafana-icons/templates/icon.cjs b/packages/grafana-icons/templates/icon.cjs index ec784905a7b..5fd12b10508 100644 --- a/packages/grafana-icons/templates/icon.cjs +++ b/packages/grafana-icons/templates/icon.cjs @@ -26,7 +26,7 @@ const comments = ` // Run "yarn generate" to update. `; const imports = ` -import React, { memo } from 'react'; +import { memo } from 'react'; import { IconBase, IconProps } from '../IconBase'; `; diff --git a/packages/grafana-icons/tsconfig.json b/packages/grafana-icons/tsconfig.json index 06210e1a227..bf218cdd730 100644 --- a/packages/grafana-icons/tsconfig.json +++ b/packages/grafana-icons/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "jsx": "react-jsx", "baseUrl": "./", "declarationDir": "./compiled", "emitDeclarationOnly": true, @@ -9,5 +10,5 @@ }, "exclude": ["dist/**/*"], "extends": "@grafana/tsconfig", - "include": ["src/**/*.ts"] + "include": ["src/**/*.tsx"] } diff --git a/packages/grafana-o11y-ds-frontend/src/IntervalInput/IntervalInput.test.tsx b/packages/grafana-o11y-ds-frontend/src/IntervalInput/IntervalInput.test.tsx index ed3464bfd6d..e5d45c8449c 100644 --- a/packages/grafana-o11y-ds-frontend/src/IntervalInput/IntervalInput.test.tsx +++ b/packages/grafana-o11y-ds-frontend/src/IntervalInput/IntervalInput.test.tsx @@ -1,6 +1,6 @@ import { render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React, { useState } from 'react'; +import { useState } from 'react'; import { invalidTimeShiftError } from '../TraceToLogs/TraceToLogsSettings'; diff --git a/packages/grafana-o11y-ds-frontend/src/IntervalInput/IntervalInput.tsx b/packages/grafana-o11y-ds-frontend/src/IntervalInput/IntervalInput.tsx index 692845a3cdd..2b29cbea1de 100644 --- a/packages/grafana-o11y-ds-frontend/src/IntervalInput/IntervalInput.tsx +++ b/packages/grafana-o11y-ds-frontend/src/IntervalInput/IntervalInput.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import { useState } from 'react'; import { useDebounce } from 'react-use'; import { InlineField, Input } from '@grafana/ui'; diff --git a/packages/grafana-o11y-ds-frontend/src/NodeGraph/NodeGraphSettings.tsx b/packages/grafana-o11y-ds-frontend/src/NodeGraph/NodeGraphSettings.tsx index 6544b333869..8b6f3c5f4b6 100644 --- a/packages/grafana-o11y-ds-frontend/src/NodeGraph/NodeGraphSettings.tsx +++ b/packages/grafana-o11y-ds-frontend/src/NodeGraph/NodeGraphSettings.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React from 'react'; +import * as React from 'react'; import { DataSourceJsonData, diff --git a/packages/grafana-o11y-ds-frontend/src/SpanBar/SpanBarSettings.tsx b/packages/grafana-o11y-ds-frontend/src/SpanBar/SpanBarSettings.tsx index 81780446edd..a612dee380d 100644 --- a/packages/grafana-o11y-ds-frontend/src/SpanBar/SpanBarSettings.tsx +++ b/packages/grafana-o11y-ds-frontend/src/SpanBar/SpanBarSettings.tsx @@ -1,5 +1,4 @@ import { css } from '@emotion/css'; -import React from 'react'; import { DataSourceJsonData, diff --git a/packages/grafana-o11y-ds-frontend/src/TemporaryAlert.test.tsx b/packages/grafana-o11y-ds-frontend/src/TemporaryAlert.test.tsx index c8ae7b1c1a4..62446153546 100644 --- a/packages/grafana-o11y-ds-frontend/src/TemporaryAlert.test.tsx +++ b/packages/grafana-o11y-ds-frontend/src/TemporaryAlert.test.tsx @@ -1,5 +1,4 @@ import { act, render, screen } from '@testing-library/react'; -import React from 'react'; import { TemporaryAlert } from './TemporaryAlert'; diff --git a/packages/grafana-o11y-ds-frontend/src/TemporaryAlert.tsx b/packages/grafana-o11y-ds-frontend/src/TemporaryAlert.tsx index 8a7003a576c..a63acc9a2a8 100644 --- a/packages/grafana-o11y-ds-frontend/src/TemporaryAlert.tsx +++ b/packages/grafana-o11y-ds-frontend/src/TemporaryAlert.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { useEffect, useState } from 'react'; +import { useEffect, useState } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { Alert, AlertVariant, useTheme2 } from '@grafana/ui'; diff --git a/packages/grafana-o11y-ds-frontend/src/TraceToLogs/TagMappingInput.tsx b/packages/grafana-o11y-ds-frontend/src/TraceToLogs/TagMappingInput.tsx index d263682a92f..355f8085a37 100644 --- a/packages/grafana-o11y-ds-frontend/src/TraceToLogs/TagMappingInput.tsx +++ b/packages/grafana-o11y-ds-frontend/src/TraceToLogs/TagMappingInput.tsx @@ -1,5 +1,4 @@ import { css, cx } from '@emotion/css'; -import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { InlineLabel, SegmentInput, ToolbarButton, useStyles2 } from '@grafana/ui'; diff --git a/packages/grafana-o11y-ds-frontend/src/TraceToLogs/TraceToLogsSettings.test.tsx b/packages/grafana-o11y-ds-frontend/src/TraceToLogs/TraceToLogsSettings.test.tsx index d3b5fb8254d..3297f2571bf 100644 --- a/packages/grafana-o11y-ds-frontend/src/TraceToLogs/TraceToLogsSettings.test.tsx +++ b/packages/grafana-o11y-ds-frontend/src/TraceToLogs/TraceToLogsSettings.test.tsx @@ -1,6 +1,5 @@ import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { DataSourceInstanceSettings, DataSourceSettings } from '@grafana/data'; import { DataSourceSrv, setDataSourceSrv } from '@grafana/runtime'; diff --git a/packages/grafana-o11y-ds-frontend/src/TraceToLogs/TraceToLogsSettings.tsx b/packages/grafana-o11y-ds-frontend/src/TraceToLogs/TraceToLogsSettings.tsx index bc290883d65..9af49fd9ae5 100644 --- a/packages/grafana-o11y-ds-frontend/src/TraceToLogs/TraceToLogsSettings.tsx +++ b/packages/grafana-o11y-ds-frontend/src/TraceToLogs/TraceToLogsSettings.tsx @@ -1,5 +1,6 @@ import { css } from '@emotion/css'; -import React, { useCallback, useMemo } from 'react'; +import { useCallback, useMemo } from 'react'; +import * as React from 'react'; import { DataSourceJsonData, DataSourceInstanceSettings, DataSourcePluginOptionsEditorProps } from '@grafana/data'; import { ConfigDescriptionLink, ConfigSection } from '@grafana/experimental'; diff --git a/packages/grafana-o11y-ds-frontend/src/TraceToMetrics/TraceToMetricsSettings.tsx b/packages/grafana-o11y-ds-frontend/src/TraceToMetrics/TraceToMetricsSettings.tsx index 90249d4dd3f..26359c41cba 100644 --- a/packages/grafana-o11y-ds-frontend/src/TraceToMetrics/TraceToMetricsSettings.tsx +++ b/packages/grafana-o11y-ds-frontend/src/TraceToMetrics/TraceToMetricsSettings.tsx @@ -1,5 +1,4 @@ import { css } from '@emotion/css'; -import React from 'react'; import { DataSourceInstanceSettings, diff --git a/packages/grafana-o11y-ds-frontend/src/TraceToProfiles/TraceToProfilesSettings.test.tsx b/packages/grafana-o11y-ds-frontend/src/TraceToProfiles/TraceToProfilesSettings.test.tsx index 0cf648def33..2956ae12393 100644 --- a/packages/grafana-o11y-ds-frontend/src/TraceToProfiles/TraceToProfilesSettings.test.tsx +++ b/packages/grafana-o11y-ds-frontend/src/TraceToProfiles/TraceToProfilesSettings.test.tsx @@ -1,5 +1,4 @@ import { render, screen, waitFor } from '@testing-library/react'; -import React from 'react'; import { DataSourceInstanceSettings, DataSourceSettings } from '@grafana/data'; import { DataSourceSrv, setDataSourceSrv } from '@grafana/runtime'; diff --git a/packages/grafana-o11y-ds-frontend/src/TraceToProfiles/TraceToProfilesSettings.tsx b/packages/grafana-o11y-ds-frontend/src/TraceToProfiles/TraceToProfilesSettings.tsx index ebabc60dd01..ef51352916b 100644 --- a/packages/grafana-o11y-ds-frontend/src/TraceToProfiles/TraceToProfilesSettings.tsx +++ b/packages/grafana-o11y-ds-frontend/src/TraceToProfiles/TraceToProfilesSettings.tsx @@ -1,5 +1,6 @@ import { css } from '@emotion/css'; -import React, { useEffect, useMemo, useState } from 'react'; +import { useEffect, useMemo, useState } from 'react'; +import * as React from 'react'; import { useAsync } from 'react-use'; import { diff --git a/packages/grafana-o11y-ds-frontend/src/pyroscope/ProfileTypesCascader.tsx b/packages/grafana-o11y-ds-frontend/src/pyroscope/ProfileTypesCascader.tsx index da34d4c1919..b95b24abae7 100644 --- a/packages/grafana-o11y-ds-frontend/src/pyroscope/ProfileTypesCascader.tsx +++ b/packages/grafana-o11y-ds-frontend/src/pyroscope/ProfileTypesCascader.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useMemo, useState } from 'react'; +import { useEffect, useMemo, useState } from 'react'; import { Cascader, CascaderOption } from '@grafana/ui'; diff --git a/packages/grafana-o11y-ds-frontend/tsconfig.json b/packages/grafana-o11y-ds-frontend/tsconfig.json index 03aa83f469f..0092e86ac62 100644 --- a/packages/grafana-o11y-ds-frontend/tsconfig.json +++ b/packages/grafana-o11y-ds-frontend/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "jsx": "react-jsx", "baseUrl": "./", "declarationDir": "./compiled", "emitDeclarationOnly": true, diff --git a/packages/grafana-plugin-configs/tsconfig.json b/packages/grafana-plugin-configs/tsconfig.json index 5fa5336e958..81e50af6c47 100644 --- a/packages/grafana-plugin-configs/tsconfig.json +++ b/packages/grafana-plugin-configs/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "jsx": "react-jsx", "alwaysStrict": true, "declaration": false, "resolveJsonModule": true diff --git a/packages/grafana-plugin-configs/webpack.config.ts b/packages/grafana-plugin-configs/webpack.config.ts index 0f851707350..e3b5bd097bb 100644 --- a/packages/grafana-plugin-configs/webpack.config.ts +++ b/packages/grafana-plugin-configs/webpack.config.ts @@ -100,6 +100,11 @@ const config = async (env: Record): Promise => { decorators: false, dynamicImport: true, }, + transform: { + react: { + runtime: 'automatic', + }, + }, }, }, }, diff --git a/packages/grafana-prometheus/src/components/AnnotationQueryEditor.tsx b/packages/grafana-prometheus/src/components/AnnotationQueryEditor.tsx index 2c22905e99e..04a50e72f10 100644 --- a/packages/grafana-prometheus/src/components/AnnotationQueryEditor.tsx +++ b/packages/grafana-prometheus/src/components/AnnotationQueryEditor.tsx @@ -1,6 +1,4 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/components/AnnotationQueryEditor.tsx -import React from 'react'; - import { AnnotationQuery } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; import { EditorField, EditorRow, EditorRows, EditorSwitch } from '@grafana/experimental'; diff --git a/packages/grafana-prometheus/src/components/PromCheatSheet.tsx b/packages/grafana-prometheus/src/components/PromCheatSheet.tsx index 4e452244cce..eafa5a3b61a 100644 --- a/packages/grafana-prometheus/src/components/PromCheatSheet.tsx +++ b/packages/grafana-prometheus/src/components/PromCheatSheet.tsx @@ -1,6 +1,5 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/components/PromCheatSheet.tsx import { css } from '@emotion/css'; -import React from 'react'; import { GrafanaTheme2, QueryEditorHelpProps } from '@grafana/data'; import { useStyles2 } from '@grafana/ui'; diff --git a/packages/grafana-prometheus/src/components/PromExemplarField.tsx b/packages/grafana-prometheus/src/components/PromExemplarField.tsx index 2431d37cf63..2e1f0272965 100644 --- a/packages/grafana-prometheus/src/components/PromExemplarField.tsx +++ b/packages/grafana-prometheus/src/components/PromExemplarField.tsx @@ -1,6 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/components/PromExemplarField.tsx import { css, cx } from '@emotion/css'; -import React, { useEffect, useState } from 'react'; +import { useEffect, useState } from 'react'; import { usePrevious } from 'react-use'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-prometheus/src/components/PromExploreExtraField.test.tsx b/packages/grafana-prometheus/src/components/PromExploreExtraField.test.tsx index 75cc778f7f0..b02e9b7f0e3 100644 --- a/packages/grafana-prometheus/src/components/PromExploreExtraField.test.tsx +++ b/packages/grafana-prometheus/src/components/PromExploreExtraField.test.tsx @@ -1,6 +1,5 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/components/PromExploreExtraField.test.tsx import { render, screen } from '@testing-library/react'; -import React from 'react'; import { PrometheusDatasource } from '../datasource'; import { PromQuery } from '../types'; diff --git a/packages/grafana-prometheus/src/components/PromExploreExtraField.tsx b/packages/grafana-prometheus/src/components/PromExploreExtraField.tsx index bbff06629c5..02ef6d4d461 100644 --- a/packages/grafana-prometheus/src/components/PromExploreExtraField.tsx +++ b/packages/grafana-prometheus/src/components/PromExploreExtraField.tsx @@ -1,7 +1,8 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/components/PromExploreExtraField.tsx import { css, cx } from '@emotion/css'; import { isEqual } from 'lodash'; -import React, { memo, useCallback } from 'react'; +import { memo, useCallback } from 'react'; +import * as React from 'react'; import { usePrevious } from 'react-use'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-prometheus/src/components/PromQueryEditorByApp.test.tsx b/packages/grafana-prometheus/src/components/PromQueryEditorByApp.test.tsx index 6626eaccbab..798bf833421 100644 --- a/packages/grafana-prometheus/src/components/PromQueryEditorByApp.test.tsx +++ b/packages/grafana-prometheus/src/components/PromQueryEditorByApp.test.tsx @@ -1,7 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/components/PromQueryEditorByApp.test.tsx import { render, screen } from '@testing-library/react'; import { noop } from 'lodash'; -import React from 'react'; import { CoreApp } from '@grafana/data'; diff --git a/packages/grafana-prometheus/src/components/PromQueryEditorByApp.tsx b/packages/grafana-prometheus/src/components/PromQueryEditorByApp.tsx index 82b095322bf..471f8dd4eb3 100644 --- a/packages/grafana-prometheus/src/components/PromQueryEditorByApp.tsx +++ b/packages/grafana-prometheus/src/components/PromQueryEditorByApp.tsx @@ -1,5 +1,5 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/components/PromQueryEditorByApp.tsx -import React, { memo } from 'react'; +import { memo } from 'react'; import { CoreApp } from '@grafana/data'; diff --git a/packages/grafana-prometheus/src/components/PromQueryEditorForAlerting.tsx b/packages/grafana-prometheus/src/components/PromQueryEditorForAlerting.tsx index 5f5f2da7bfc..df7f0b9b946 100644 --- a/packages/grafana-prometheus/src/components/PromQueryEditorForAlerting.tsx +++ b/packages/grafana-prometheus/src/components/PromQueryEditorForAlerting.tsx @@ -1,6 +1,4 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/components/PromQueryEditorForAlerting.tsx -import React from 'react'; - import { PromQueryField } from './PromQueryField'; import { PromQueryEditorProps } from './types'; diff --git a/packages/grafana-prometheus/src/components/PromQueryField.test.tsx b/packages/grafana-prometheus/src/components/PromQueryField.test.tsx index 46c56efc381..36ffb5556e6 100644 --- a/packages/grafana-prometheus/src/components/PromQueryField.test.tsx +++ b/packages/grafana-prometheus/src/components/PromQueryField.test.tsx @@ -2,7 +2,6 @@ import { getByTestId, render, screen, waitFor } from '@testing-library/react'; // @ts-ignore import userEvent from '@testing-library/user-event'; -import React from 'react'; import { CoreApp, DataFrame, LoadingState, PanelData } from '@grafana/data'; diff --git a/packages/grafana-prometheus/src/components/PromQueryField.tsx b/packages/grafana-prometheus/src/components/PromQueryField.tsx index e4a83498aad..de9ec25c83d 100644 --- a/packages/grafana-prometheus/src/components/PromQueryField.tsx +++ b/packages/grafana-prometheus/src/components/PromQueryField.tsx @@ -1,6 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/components/PromQueryField.tsx import { css, cx } from '@emotion/css'; -import React, { ReactNode } from 'react'; +import { PureComponent, ReactNode } from 'react'; import { isDataFrame, QueryEditorProps, QueryHint, TimeRange, toLegacyResponseData } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; @@ -49,7 +49,7 @@ interface PromQueryFieldState { hint: QueryHint | null; } -class PromQueryFieldClass extends React.PureComponent { +class PromQueryFieldClass extends PureComponent { declare languageProviderInitializationPromise: CancelablePromise; constructor(props: PromQueryFieldProps) { diff --git a/packages/grafana-prometheus/src/components/PrometheusMetricsBrowser.test.tsx b/packages/grafana-prometheus/src/components/PrometheusMetricsBrowser.test.tsx index 393a15b3d00..58efb0e28f0 100644 --- a/packages/grafana-prometheus/src/components/PrometheusMetricsBrowser.test.tsx +++ b/packages/grafana-prometheus/src/components/PrometheusMetricsBrowser.test.tsx @@ -1,7 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/components/PrometheusMetricsBrowser.test.tsx import { render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { createTheme } from '@grafana/data'; diff --git a/packages/grafana-prometheus/src/components/PrometheusMetricsBrowser.tsx b/packages/grafana-prometheus/src/components/PrometheusMetricsBrowser.tsx index 6d19dfbbe86..924e1067544 100644 --- a/packages/grafana-prometheus/src/components/PrometheusMetricsBrowser.tsx +++ b/packages/grafana-prometheus/src/components/PrometheusMetricsBrowser.tsx @@ -1,6 +1,7 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/components/PrometheusMetricsBrowser.tsx import { css, cx } from '@emotion/css'; -import React, { ChangeEvent } from 'react'; +import { ChangeEvent } from 'react'; +import * as React from 'react'; import { FixedSizeList } from 'react-window'; import { GrafanaTheme2, TimeRange } from '@grafana/data'; @@ -8,7 +9,7 @@ import { selectors } from '@grafana/e2e-selectors'; import { BrowserLabel as PromLabel, Button, - HorizontalGroup, + Stack, Input, Label, LoadingPlaceholder, @@ -488,7 +489,7 @@ export class UnthemedPrometheusMetricsBrowser extends React.Component - +
      @@ -631,7 +632,7 @@ export class UnthemedPrometheusMetricsBrowser extends React.Component
      -
      +
      @@ -639,7 +640,7 @@ export class UnthemedPrometheusMetricsBrowser extends React.Component {validationStatus &&
      {validationStatus}
      } - +
      - + ); diff --git a/packages/grafana-prometheus/src/components/VariableQueryEditor.test.tsx b/packages/grafana-prometheus/src/components/VariableQueryEditor.test.tsx index 70fc36a5173..749416c5e14 100644 --- a/packages/grafana-prometheus/src/components/VariableQueryEditor.test.tsx +++ b/packages/grafana-prometheus/src/components/VariableQueryEditor.test.tsx @@ -1,7 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/components/VariableQueryEditor.test.tsx import { render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { dateTime, TimeRange } from '@grafana/data'; diff --git a/packages/grafana-prometheus/src/components/VariableQueryEditor.tsx b/packages/grafana-prometheus/src/components/VariableQueryEditor.tsx index b89590eabcd..ad6a2c5386b 100644 --- a/packages/grafana-prometheus/src/components/VariableQueryEditor.tsx +++ b/packages/grafana-prometheus/src/components/VariableQueryEditor.tsx @@ -1,5 +1,5 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/components/VariableQueryEditor.tsx -import React, { FormEvent, useCallback, useEffect, useState } from 'react'; +import { FormEvent, useCallback, useEffect, useState } from 'react'; import { QueryEditorProps, SelectableValue } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; diff --git a/packages/grafana-prometheus/src/components/monaco-query-field/MonacoQueryField.tsx b/packages/grafana-prometheus/src/components/monaco-query-field/MonacoQueryField.tsx index 123b668edcc..5115c6880d1 100644 --- a/packages/grafana-prometheus/src/components/monaco-query-field/MonacoQueryField.tsx +++ b/packages/grafana-prometheus/src/components/monaco-query-field/MonacoQueryField.tsx @@ -3,7 +3,7 @@ import { css } from '@emotion/css'; import { parser } from '@prometheus-io/lezer-promql'; import { debounce } from 'lodash'; import { promLanguageDefinition } from 'monaco-promql'; -import React, { useEffect, useRef } from 'react'; +import { useEffect, useRef } from 'react'; import { useLatest } from 'react-use'; import { v4 as uuidv4 } from 'uuid'; diff --git a/packages/grafana-prometheus/src/components/monaco-query-field/MonacoQueryFieldLazy.tsx b/packages/grafana-prometheus/src/components/monaco-query-field/MonacoQueryFieldLazy.tsx index ea2fb3576e9..53aad0b3047 100644 --- a/packages/grafana-prometheus/src/components/monaco-query-field/MonacoQueryFieldLazy.tsx +++ b/packages/grafana-prometheus/src/components/monaco-query-field/MonacoQueryFieldLazy.tsx @@ -1,5 +1,5 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/components/monaco-query-field/MonacoQueryFieldLazy.tsx -import React, { Suspense } from 'react'; +import { Suspense } from 'react'; import MonacoQueryField from './MonacoQueryField'; import { Props } from './MonacoQueryFieldProps'; diff --git a/packages/grafana-prometheus/src/components/monaco-query-field/MonacoQueryFieldWrapper.tsx b/packages/grafana-prometheus/src/components/monaco-query-field/MonacoQueryFieldWrapper.tsx index 2fafe41a1cc..c95e8341b92 100644 --- a/packages/grafana-prometheus/src/components/monaco-query-field/MonacoQueryFieldWrapper.tsx +++ b/packages/grafana-prometheus/src/components/monaco-query-field/MonacoQueryFieldWrapper.tsx @@ -1,5 +1,5 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/components/monaco-query-field/MonacoQueryFieldWrapper.tsx -import React, { useRef } from 'react'; +import { useRef } from 'react'; import { MonacoQueryFieldLazy } from './MonacoQueryFieldLazy'; import { Props as MonacoProps } from './MonacoQueryFieldProps'; diff --git a/packages/grafana-prometheus/src/configuration/AlertingSettingsOverhaul.tsx b/packages/grafana-prometheus/src/configuration/AlertingSettingsOverhaul.tsx index 4cd5a13b85a..feea1322c69 100644 --- a/packages/grafana-prometheus/src/configuration/AlertingSettingsOverhaul.tsx +++ b/packages/grafana-prometheus/src/configuration/AlertingSettingsOverhaul.tsx @@ -1,6 +1,5 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/configuration/AlertingSettingsOverhaul.tsx import { cx } from '@emotion/css'; -import React from 'react'; import { DataSourceJsonData, DataSourcePluginOptionsEditorProps } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; diff --git a/packages/grafana-prometheus/src/configuration/ConfigEditor.test.tsx b/packages/grafana-prometheus/src/configuration/ConfigEditor.test.tsx index 12878c69435..ed3c92afe4e 100644 --- a/packages/grafana-prometheus/src/configuration/ConfigEditor.test.tsx +++ b/packages/grafana-prometheus/src/configuration/ConfigEditor.test.tsx @@ -1,6 +1,4 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/configuration/ConfigEditor.test.tsx -import React from 'react'; - import { FieldValidationMessage } from '@grafana/ui'; import { validateInput } from './ConfigEditor'; diff --git a/packages/grafana-prometheus/src/configuration/ConfigEditor.tsx b/packages/grafana-prometheus/src/configuration/ConfigEditor.tsx index b5818b34b12..534db5f1e2d 100644 --- a/packages/grafana-prometheus/src/configuration/ConfigEditor.tsx +++ b/packages/grafana-prometheus/src/configuration/ConfigEditor.tsx @@ -1,6 +1,5 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/configuration/ConfigEditor.tsx import { css } from '@emotion/css'; -import React from 'react'; import { DataSourcePluginOptionsEditorProps, GrafanaTheme2 } from '@grafana/data'; import { ConfigSection, DataSourceDescription, AdvancedHttpSettings } from '@grafana/experimental'; diff --git a/packages/grafana-prometheus/src/configuration/DataSourceHttpSettingsOverhaul.tsx b/packages/grafana-prometheus/src/configuration/DataSourceHttpSettingsOverhaul.tsx index 035e513c6a3..04c77dfe854 100644 --- a/packages/grafana-prometheus/src/configuration/DataSourceHttpSettingsOverhaul.tsx +++ b/packages/grafana-prometheus/src/configuration/DataSourceHttpSettingsOverhaul.tsx @@ -1,6 +1,4 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/configuration/DataSourceHttpSettingsOverhaul.tsx -import React from 'react'; - import { DataSourceSettings } from '@grafana/data'; import { Auth, AuthMethod, ConnectionSettings, convertLegacyAuthProps } from '@grafana/experimental'; import { SecureSocksProxySettings, useTheme2 } from '@grafana/ui'; diff --git a/packages/grafana-prometheus/src/configuration/ExemplarSetting.tsx b/packages/grafana-prometheus/src/configuration/ExemplarSetting.tsx index cc2f94b1251..1323077dd6f 100644 --- a/packages/grafana-prometheus/src/configuration/ExemplarSetting.tsx +++ b/packages/grafana-prometheus/src/configuration/ExemplarSetting.tsx @@ -1,5 +1,5 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/configuration/ExemplarSetting.tsx -import React, { useState } from 'react'; +import { useState } from 'react'; import { DataSourceInstanceSettings } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; diff --git a/packages/grafana-prometheus/src/configuration/ExemplarsSettings.tsx b/packages/grafana-prometheus/src/configuration/ExemplarsSettings.tsx index b0868370695..dc82d80984f 100644 --- a/packages/grafana-prometheus/src/configuration/ExemplarsSettings.tsx +++ b/packages/grafana-prometheus/src/configuration/ExemplarsSettings.tsx @@ -1,6 +1,5 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/configuration/ExemplarsSettings.tsx import { css } from '@emotion/css'; -import React from 'react'; import { selectors } from '@grafana/e2e-selectors'; import { ConfigSubSection } from '@grafana/experimental'; diff --git a/packages/grafana-prometheus/src/configuration/PromSettings.test.tsx b/packages/grafana-prometheus/src/configuration/PromSettings.test.tsx index 2deae5f94dd..8d90f39084f 100644 --- a/packages/grafana-prometheus/src/configuration/PromSettings.test.tsx +++ b/packages/grafana-prometheus/src/configuration/PromSettings.test.tsx @@ -1,6 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/configuration/PromSettings.test.tsx import { render, screen, fireEvent } from '@testing-library/react'; -import React, { SyntheticEvent } from 'react'; +import { SyntheticEvent } from 'react'; import { SelectableValue } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; diff --git a/packages/grafana-prometheus/src/configuration/PromSettings.tsx b/packages/grafana-prometheus/src/configuration/PromSettings.tsx index 5e41aaac5e9..c08273b4ff7 100644 --- a/packages/grafana-prometheus/src/configuration/PromSettings.tsx +++ b/packages/grafana-prometheus/src/configuration/PromSettings.tsx @@ -1,5 +1,5 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/configuration/PromSettings.tsx -import React, { SyntheticEvent, useState } from 'react'; +import { SyntheticEvent, useState } from 'react'; import { DataSourcePluginOptionsEditorProps, diff --git a/packages/grafana-prometheus/src/gcopypaste/app/core/components/LocalStorageValueProvider/LocalStorageValueProvider.tsx b/packages/grafana-prometheus/src/gcopypaste/app/core/components/LocalStorageValueProvider/LocalStorageValueProvider.tsx index c71e11ec749..903a6b94b53 100644 --- a/packages/grafana-prometheus/src/gcopypaste/app/core/components/LocalStorageValueProvider/LocalStorageValueProvider.tsx +++ b/packages/grafana-prometheus/src/gcopypaste/app/core/components/LocalStorageValueProvider/LocalStorageValueProvider.tsx @@ -1,5 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/core/components/LocalStorageValueProvider/LocalStorageValueProvider.tsx -import React, { useEffect, useState } from 'react'; +import { useEffect, useState } from 'react'; +import * as React from 'react'; import store from '../../store'; diff --git a/packages/grafana-prometheus/src/gcopypaste/packages/grafana-ui/src/components/Select/SelectBase.tsx b/packages/grafana-prometheus/src/gcopypaste/packages/grafana-ui/src/components/Select/SelectBase.tsx index 06ae7ee04fb..8ee9578e5c2 100644 --- a/packages/grafana-prometheus/src/gcopypaste/packages/grafana-ui/src/components/Select/SelectBase.tsx +++ b/packages/grafana-prometheus/src/gcopypaste/packages/grafana-ui/src/components/Select/SelectBase.tsx @@ -1,7 +1,8 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/packages/grafana-ui/src/components/Select/SelectBase.tsx import { cx } from '@emotion/css'; import { max } from 'lodash'; -import React, { RefCallback } from 'react'; +import { RefCallback } from 'react'; +import * as React from 'react'; import { MenuListProps } from 'react-select'; import { FixedSizeList as List } from 'react-window'; diff --git a/packages/grafana-prometheus/src/querybuilder/QueryPattern.tsx b/packages/grafana-prometheus/src/querybuilder/QueryPattern.tsx index 5f4507f1cd4..e1381b2d554 100644 --- a/packages/grafana-prometheus/src/querybuilder/QueryPattern.tsx +++ b/packages/grafana-prometheus/src/querybuilder/QueryPattern.tsx @@ -1,6 +1,5 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/QueryPattern.tsx import { css } from '@emotion/css'; -import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { Button, Card, useStyles2 } from '@grafana/ui'; diff --git a/packages/grafana-prometheus/src/querybuilder/QueryPatternsModal.test.tsx b/packages/grafana-prometheus/src/querybuilder/QueryPatternsModal.test.tsx index 8cc19b9cbe9..1e3a8dec1fc 100644 --- a/packages/grafana-prometheus/src/querybuilder/QueryPatternsModal.test.tsx +++ b/packages/grafana-prometheus/src/querybuilder/QueryPatternsModal.test.tsx @@ -1,7 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/QueryPatternsModal.test.tsx import { render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { promQueryModeller } from './PromQueryModeller'; import { QueryPatternsModal } from './QueryPatternsModal'; diff --git a/packages/grafana-prometheus/src/querybuilder/QueryPatternsModal.tsx b/packages/grafana-prometheus/src/querybuilder/QueryPatternsModal.tsx index ce54fb149df..1fb721fdfad 100644 --- a/packages/grafana-prometheus/src/querybuilder/QueryPatternsModal.tsx +++ b/packages/grafana-prometheus/src/querybuilder/QueryPatternsModal.tsx @@ -1,7 +1,7 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/QueryPatternsModal.tsx import { css } from '@emotion/css'; import { capitalize } from 'lodash'; -import React, { useMemo, useState } from 'react'; +import { useMemo, useState } from 'react'; import { CoreApp, DataQuery, GrafanaTheme2 } from '@grafana/data'; import { reportInteraction } from '@grafana/runtime'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/LabelFilterItem.tsx b/packages/grafana-prometheus/src/querybuilder/components/LabelFilterItem.tsx index b5ef8a62848..cd8bcb54cb4 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/LabelFilterItem.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/LabelFilterItem.tsx @@ -1,6 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/LabelFilterItem.tsx import debounce from 'debounce-promise'; -import React, { useState } from 'react'; +import { useState } from 'react'; import { SelectableValue, toOption } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/LabelFilters.test.tsx b/packages/grafana-prometheus/src/querybuilder/components/LabelFilters.test.tsx index b94a1b04b0a..55151ae2800 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/LabelFilters.test.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/LabelFilters.test.tsx @@ -1,7 +1,7 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/LabelFilters.test.tsx import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React, { ComponentProps } from 'react'; +import { ComponentProps } from 'react'; import { selectOptionInTest } from '../../gcopypaste/test/helpers/selectOptionInTest'; import { getLabelSelects } from '../testUtils'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/LabelFilters.tsx b/packages/grafana-prometheus/src/querybuilder/components/LabelFilters.tsx index 1bb5e393593..45b0b9866eb 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/LabelFilters.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/LabelFilters.tsx @@ -1,7 +1,7 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/LabelFilters.tsx import { css, cx } from '@emotion/css'; import { isEqual } from 'lodash'; -import React, { useEffect, useState } from 'react'; +import { useEffect, useState } from 'react'; import { SelectableValue } from '@grafana/data'; import { EditorField, EditorFieldGroup, EditorList } from '@grafana/experimental'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/LabelParamEditor.tsx b/packages/grafana-prometheus/src/querybuilder/components/LabelParamEditor.tsx index 0c1c4a8e35c..e1049d18752 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/LabelParamEditor.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/LabelParamEditor.tsx @@ -1,5 +1,5 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/LabelParamEditor.tsx -import React, { useState } from 'react'; +import { useState } from 'react'; import { DataSourceApi, SelectableValue, toOption } from '@grafana/data'; import { Select } from '@grafana/ui'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/MetricSelect.test.tsx b/packages/grafana-prometheus/src/querybuilder/components/MetricSelect.test.tsx index d21e7ce27f1..e6e9c5e9946 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/MetricSelect.test.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/MetricSelect.test.tsx @@ -1,7 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/MetricSelect.test.tsx import { render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { DataSourceInstanceSettings, MetricFindValue } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/MetricSelect.tsx b/packages/grafana-prometheus/src/querybuilder/components/MetricSelect.tsx index 244c935c06d..95301e8075f 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/MetricSelect.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/MetricSelect.tsx @@ -1,7 +1,8 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/MetricSelect.tsx import { css } from '@emotion/css'; import debounce from 'debounce-promise'; -import React, { RefCallback, useCallback, useState } from 'react'; +import { RefCallback, useCallback, useState } from 'react'; +import * as React from 'react'; import Highlighter from 'react-highlight-words'; import { GrafanaTheme2, SelectableValue, toOption } from '@grafana/data'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/MetricsLabelsSection.tsx b/packages/grafana-prometheus/src/querybuilder/components/MetricsLabelsSection.tsx index 6d25c74377d..ce91d04bbdb 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/MetricsLabelsSection.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/MetricsLabelsSection.tsx @@ -1,5 +1,5 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/MetricsLabelsSection.tsx -import React, { useCallback } from 'react'; +import { useCallback } from 'react'; import { SelectableValue } from '@grafana/data'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/NestedQuery.tsx b/packages/grafana-prometheus/src/querybuilder/components/NestedQuery.tsx index efdffc73023..6c27f0fa1e3 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/NestedQuery.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/NestedQuery.tsx @@ -1,6 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/NestedQuery.tsx import { css } from '@emotion/css'; -import React from 'react'; +import { memo } from 'react'; import { GrafanaTheme2, toOption } from '@grafana/data'; import { EditorRows, FlexItem } from '@grafana/experimental'; @@ -22,7 +22,7 @@ export interface NestedQueryProps { showExplain: boolean; } -export const NestedQuery = React.memo((props) => { +export const NestedQuery = memo((props) => { const { nestedQuery, index, datasource, onChange, onRemove, onRunQuery, showExplain } = props; const styles = useStyles2(getStyles); diff --git a/packages/grafana-prometheus/src/querybuilder/components/NestedQueryList.tsx b/packages/grafana-prometheus/src/querybuilder/components/NestedQueryList.tsx index 7d36bec9919..f0aca4ae1fd 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/NestedQueryList.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/NestedQueryList.tsx @@ -1,6 +1,4 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/NestedQueryList.tsx -import React from 'react'; - import { Stack } from '@grafana/ui'; import { PrometheusDatasource } from '../../datasource'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilder.test.tsx b/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilder.test.tsx index d5da0babb73..db74ff98655 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilder.test.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilder.test.tsx @@ -1,7 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/PromQueryBuilder.test.tsx import { getByText, render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { DataSourceInstanceSettings, diff --git a/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilder.tsx b/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilder.tsx index f2c1abb531d..a1d450b2452 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilder.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilder.tsx @@ -1,6 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/PromQueryBuilder.tsx import { css } from '@emotion/css'; -import React, { useEffect, useState } from 'react'; +import { memo, useEffect, useState } from 'react'; import { DataSourceApi, PanelData } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; @@ -37,7 +37,7 @@ export interface PromQueryBuilderProps { showExplain: boolean; } -export const PromQueryBuilder = React.memo((props) => { +export const PromQueryBuilder = memo((props) => { const { datasource, query, onChange, onRunQuery, data, showExplain } = props; const [highlightedOp, setHighlightedOp] = useState(); const [showDrawer, setShowDrawer] = useState(false); diff --git a/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilderContainer.test.tsx b/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilderContainer.test.tsx index 34012591019..efe436a4f2c 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilderContainer.test.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilderContainer.test.tsx @@ -1,7 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/PromQueryBuilderContainer.test.tsx import { render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { DataSourceInstanceSettings, DataSourcePluginMeta } from '@grafana/data'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilderContainer.tsx b/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilderContainer.tsx index a960fc3a58e..2b1c05e52a0 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilderContainer.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilderContainer.tsx @@ -1,6 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/PromQueryBuilderContainer.tsx import { createSlice, PayloadAction } from '@reduxjs/toolkit'; -import React, { useEffect, useReducer } from 'react'; +import { useEffect, useReducer } from 'react'; import { PanelData } from '@grafana/data'; import { config } from '@grafana/runtime'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilderExplained.tsx b/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilderExplained.tsx index c3de6c3808e..4fa9503c34e 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilderExplained.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilderExplained.tsx @@ -1,5 +1,5 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/PromQueryBuilderExplained.tsx -import React from 'react'; +import { memo } from 'react'; import { Stack } from '@grafana/ui'; @@ -17,7 +17,7 @@ export interface PromQueryBuilderExplainedProps { query: string; } -export const PromQueryBuilderExplained = React.memo(({ query }) => { +export const PromQueryBuilderExplained = memo(({ query }) => { const visQuery = buildVisualQueryFromString(query || '').query; const lang = { grammar: promqlGrammar, name: 'promql' }; diff --git a/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilderOptions.test.tsx b/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilderOptions.test.tsx index 9b9531a28ed..b6654dadafb 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilderOptions.test.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilderOptions.test.tsx @@ -1,7 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/PromQueryBuilderOptions.test.tsx import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { CoreApp } from '@grafana/data'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilderOptions.tsx b/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilderOptions.tsx index 7a554d9be45..60c73709c68 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilderOptions.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilderOptions.tsx @@ -1,5 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/PromQueryBuilderOptions.tsx -import React, { SyntheticEvent } from 'react'; +import { SyntheticEvent } from 'react'; +import * as React from 'react'; import { CoreApp, SelectableValue } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/PromQueryCodeEditor.test.tsx b/packages/grafana-prometheus/src/querybuilder/components/PromQueryCodeEditor.test.tsx index c907e604576..5aa9ba645dc 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/PromQueryCodeEditor.test.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/PromQueryCodeEditor.test.tsx @@ -1,6 +1,5 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/PromQueryCodeEditor.test.tsx import { render, screen } from '@testing-library/react'; -import React from 'react'; import { DataSourceInstanceSettings, DataSourcePluginMeta } from '@grafana/data'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/PromQueryCodeEditor.tsx b/packages/grafana-prometheus/src/querybuilder/components/PromQueryCodeEditor.tsx index a972a2e435c..0942b93ff88 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/PromQueryCodeEditor.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/PromQueryCodeEditor.tsx @@ -1,6 +1,5 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/PromQueryCodeEditor.tsx import { css } from '@emotion/css'; -import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/PromQueryCodeEditorAutocompleteInfo.test.tsx b/packages/grafana-prometheus/src/querybuilder/components/PromQueryCodeEditorAutocompleteInfo.test.tsx index 2cc33275317..42ae5cb2284 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/PromQueryCodeEditorAutocompleteInfo.test.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/PromQueryCodeEditorAutocompleteInfo.test.tsx @@ -1,6 +1,5 @@ import { render, screen, fireEvent, createEvent } from '@testing-library/react'; import { cloneDeep, defaultsDeep } from 'lodash'; -import React from 'react'; import { PluginMeta, PluginType } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/PromQueryCodeEditorAutocompleteInfo.tsx b/packages/grafana-prometheus/src/querybuilder/components/PromQueryCodeEditorAutocompleteInfo.tsx index d64c77c946e..fb0707a3dfa 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/PromQueryCodeEditorAutocompleteInfo.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/PromQueryCodeEditorAutocompleteInfo.tsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect, useCallback } from 'react'; +import { useState, useEffect, useCallback } from 'react'; import { selectors } from '@grafana/e2e-selectors'; import { config } from '@grafana/runtime'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/PromQueryEditorSelector.test.tsx b/packages/grafana-prometheus/src/querybuilder/components/PromQueryEditorSelector.test.tsx index e3f15b0e66b..dcba07eb367 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/PromQueryEditorSelector.test.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/PromQueryEditorSelector.test.tsx @@ -2,7 +2,6 @@ import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { cloneDeep, defaultsDeep } from 'lodash'; -import React from 'react'; import { CoreApp, PluginMeta, PluginType } from '@grafana/data'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/PromQueryEditorSelector.tsx b/packages/grafana-prometheus/src/querybuilder/components/PromQueryEditorSelector.tsx index 30c5502bacb..cfb5d06a951 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/PromQueryEditorSelector.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/PromQueryEditorSelector.tsx @@ -1,6 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/PromQueryEditorSelector.tsx import { isEqual, map } from 'lodash'; -import React, { SyntheticEvent, useCallback, useEffect, useState } from 'react'; +import { memo, SyntheticEvent, useCallback, useEffect, useState } from 'react'; import { CoreApp, LoadingState, SelectableValue } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; @@ -37,7 +37,7 @@ export const INTERVAL_FACTOR_OPTIONS: Array> = map([1, 2 type Props = PromQueryEditorProps; -export const PromQueryEditorSelector = React.memo((props) => { +export const PromQueryEditorSelector = memo((props) => { const { onChange, onRunQuery, diff --git a/packages/grafana-prometheus/src/querybuilder/components/PromQueryLegendEditor.tsx b/packages/grafana-prometheus/src/querybuilder/components/PromQueryLegendEditor.tsx index 5be07dee6be..e06af3c98c2 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/PromQueryLegendEditor.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/PromQueryLegendEditor.tsx @@ -1,5 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/PromQueryLegendEditor.tsx -import React, { useRef } from 'react'; +import { useRef } from 'react'; +import * as React from 'react'; import { SelectableValue } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/QueryPreview.tsx b/packages/grafana-prometheus/src/querybuilder/components/QueryPreview.tsx index 2bd0e252672..0f974b7df42 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/QueryPreview.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/QueryPreview.tsx @@ -1,6 +1,4 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/QueryPreview.tsx -import React from 'react'; - import { EditorFieldGroup, EditorRow } from '@grafana/experimental'; import promqlGrammar from '../../promql'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/metrics-modal/AdditionalSettings.tsx b/packages/grafana-prometheus/src/querybuilder/components/metrics-modal/AdditionalSettings.tsx index f9af4e62125..65949f65e3f 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/metrics-modal/AdditionalSettings.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/metrics-modal/AdditionalSettings.tsx @@ -1,6 +1,5 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/metrics-modal/AdditionalSettings.tsx import { css } from '@emotion/css'; -import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { Icon, Switch, Tooltip, useTheme2 } from '@grafana/ui'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/metrics-modal/FeedbackLink.tsx b/packages/grafana-prometheus/src/querybuilder/components/metrics-modal/FeedbackLink.tsx index 954efbd61e1..7e64ad06673 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/metrics-modal/FeedbackLink.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/metrics-modal/FeedbackLink.tsx @@ -1,6 +1,5 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/metrics-modal/FeedbackLink.tsx import { css } from '@emotion/css'; -import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { Icon, useStyles2, Stack } from '@grafana/ui'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/metrics-modal/MetricsModal.test.tsx b/packages/grafana-prometheus/src/querybuilder/components/metrics-modal/MetricsModal.test.tsx index d314a7b6d70..5f9928fa450 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/metrics-modal/MetricsModal.test.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/metrics-modal/MetricsModal.test.tsx @@ -1,7 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/metrics-modal/MetricsModal.test.tsx import { render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { DataSourceInstanceSettings, DataSourcePluginMeta } from '@grafana/data'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/metrics-modal/MetricsModal.tsx b/packages/grafana-prometheus/src/querybuilder/components/metrics-modal/MetricsModal.tsx index 4d6aab8dc0d..ae7eae785b6 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/metrics-modal/MetricsModal.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/metrics-modal/MetricsModal.tsx @@ -2,7 +2,7 @@ import { cx } from '@emotion/css'; import { PayloadAction, createSlice } from '@reduxjs/toolkit'; import debounce from 'debounce-promise'; -import React, { useCallback, useEffect, useMemo, useReducer } from 'react'; +import { useCallback, useEffect, useMemo, useReducer } from 'react'; import { SelectableValue } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/metrics-modal/ResultsTable.tsx b/packages/grafana-prometheus/src/querybuilder/components/metrics-modal/ResultsTable.tsx index a9529e01a14..54c2c9ecc18 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/metrics-modal/ResultsTable.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/metrics-modal/ResultsTable.tsx @@ -1,6 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/metrics-modal/ResultsTable.tsx import { css } from '@emotion/css'; -import React, { ReactElement } from 'react'; +import { ReactElement } from 'react'; import Highlighter from 'react-highlight-words'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/promQail/PromQail.test.tsx b/packages/grafana-prometheus/src/querybuilder/components/promQail/PromQail.test.tsx index 0874258cc87..2f95975f5c4 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/promQail/PromQail.test.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/promQail/PromQail.test.tsx @@ -1,7 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/promQail/PromQail.test.tsx import { render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { DataSourceInstanceSettings, DataSourcePluginMeta } from '@grafana/data'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/promQail/PromQail.tsx b/packages/grafana-prometheus/src/querybuilder/components/promQail/PromQail.tsx index 638d3f53b93..7c9304f8fc7 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/promQail/PromQail.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/promQail/PromQail.tsx @@ -1,7 +1,7 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/promQail/PromQail.tsx import { css, cx } from '@emotion/css'; import { PayloadAction, createSlice } from '@reduxjs/toolkit'; -import React, { useEffect, useReducer, useRef, useState } from 'react'; +import { useEffect, useReducer, useRef, useState } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { reportInteraction } from '@grafana/runtime'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/promQail/QueryAssistantButton.test.tsx b/packages/grafana-prometheus/src/querybuilder/components/promQail/QueryAssistantButton.test.tsx index 3bfabc4bf60..8d1bf6971d4 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/promQail/QueryAssistantButton.test.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/promQail/QueryAssistantButton.test.tsx @@ -1,7 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/promQail/QueryAssistantButton.test.tsx import { fireEvent, render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { QueryAssistantButton } from './QueryAssistantButton'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/promQail/QueryAssistantButton.tsx b/packages/grafana-prometheus/src/querybuilder/components/promQail/QueryAssistantButton.tsx index 577d330691e..2324f60e402 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/promQail/QueryAssistantButton.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/promQail/QueryAssistantButton.tsx @@ -1,6 +1,4 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/promQail/QueryAssistantButton.tsx -import React from 'react'; - import { selectors } from '@grafana/e2e-selectors'; import { reportInteraction } from '@grafana/runtime'; import { Button, Tooltip, useTheme2 } from '@grafana/ui'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/promQail/QuerySuggestionContainer.tsx b/packages/grafana-prometheus/src/querybuilder/components/promQail/QuerySuggestionContainer.tsx index 469811e72e2..ac51393edac 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/promQail/QuerySuggestionContainer.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/promQail/QuerySuggestionContainer.tsx @@ -1,6 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/promQail/QuerySuggestionContainer.tsx import { cx } from '@emotion/css'; -import React, { useState } from 'react'; +import { useState } from 'react'; import { Button, useTheme2 } from '@grafana/ui'; diff --git a/packages/grafana-prometheus/src/querybuilder/components/promQail/QuerySuggestionItem.tsx b/packages/grafana-prometheus/src/querybuilder/components/promQail/QuerySuggestionItem.tsx index ab776ca515c..a173c8c4efb 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/promQail/QuerySuggestionItem.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/promQail/QuerySuggestionItem.tsx @@ -1,6 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/promQail/QuerySuggestionItem.tsx import { cx } from '@emotion/css'; -import React, { FormEvent, useState } from 'react'; +import { FormEvent, useState } from 'react'; import { SelectableValue } from '@grafana/data'; import { reportInteraction } from '@grafana/runtime'; diff --git a/packages/grafana-prometheus/src/querybuilder/parsing.test.ts b/packages/grafana-prometheus/src/querybuilder/parsing.test.ts index 3bbb8d32aeb..a41be98ada3 100644 --- a/packages/grafana-prometheus/src/querybuilder/parsing.test.ts +++ b/packages/grafana-prometheus/src/querybuilder/parsing.test.ts @@ -746,6 +746,43 @@ describe('buildVisualQueryFromString', () => { }, }); }); + + it('strips enclosing quotes', () => { + expect(buildVisualQueryFromString("counters_logins{app='frontend', host=`localhost`}")).toEqual( + noErrors({ + metric: 'counters_logins', + labels: [ + { + op: '=', + value: 'frontend', + label: 'app', + }, + { + op: '=', + value: 'localhost', + label: 'host', + }, + ], + operations: [], + }) + ); + }); + + it('leaves escaped quotes inside string', () => { + expect(buildVisualQueryFromString('counters_logins{app="fron\\"\\"tend"}')).toEqual( + noErrors({ + metric: 'counters_logins', + labels: [ + { + op: '=', + value: 'fron\\"\\"tend', + label: 'app', + }, + ], + operations: [], + }) + ); + }); }); function noErrors(query: PromVisualQuery) { diff --git a/packages/grafana-prometheus/src/querybuilder/parsing.ts b/packages/grafana-prometheus/src/querybuilder/parsing.ts index 01fd244012e..95a12032051 100644 --- a/packages/grafana-prometheus/src/querybuilder/parsing.ts +++ b/packages/grafana-prometheus/src/querybuilder/parsing.ts @@ -205,7 +205,7 @@ function isIntervalVariableError(node: SyntaxNode) { function getLabel(expr: string, node: SyntaxNode): QueryBuilderLabelFilter { const label = getString(expr, node.getChild(LabelName)); const op = getString(expr, node.getChild(MatchOp)); - const value = getString(expr, node.getChild(StringLiteral)).replace(/"/g, ''); + const value = getString(expr, node.getChild(StringLiteral)).replace(/^["'`]|["'`]$/g, ''); return { label, op, diff --git a/packages/grafana-prometheus/src/querybuilder/shared/OperationEditor.tsx b/packages/grafana-prometheus/src/querybuilder/shared/OperationEditor.tsx index a2d23aacdc9..3a6c8780f69 100644 --- a/packages/grafana-prometheus/src/querybuilder/shared/OperationEditor.tsx +++ b/packages/grafana-prometheus/src/querybuilder/shared/OperationEditor.tsx @@ -1,6 +1,7 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/shared/OperationEditor.tsx import { css, cx } from '@emotion/css'; -import React, { useEffect, useId, useState } from 'react'; +import { useEffect, useId, useState } from 'react'; +import * as React from 'react'; import { Draggable } from 'react-beautiful-dnd'; import { DataSourceApi, GrafanaTheme2, TimeRange } from '@grafana/data'; diff --git a/packages/grafana-prometheus/src/querybuilder/shared/OperationExplainedBox.tsx b/packages/grafana-prometheus/src/querybuilder/shared/OperationExplainedBox.tsx index d5e5f753997..4546f3cd427 100644 --- a/packages/grafana-prometheus/src/querybuilder/shared/OperationExplainedBox.tsx +++ b/packages/grafana-prometheus/src/querybuilder/shared/OperationExplainedBox.tsx @@ -1,6 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/shared/OperationExplainedBox.tsx import { css } from '@emotion/css'; -import React from 'react'; +import * as React from 'react'; import { GrafanaTheme2, renderMarkdown } from '@grafana/data'; import { useStyles2 } from '@grafana/ui'; diff --git a/packages/grafana-prometheus/src/querybuilder/shared/OperationHeader.tsx b/packages/grafana-prometheus/src/querybuilder/shared/OperationHeader.tsx index 757befe40ec..421c01e41c1 100644 --- a/packages/grafana-prometheus/src/querybuilder/shared/OperationHeader.tsx +++ b/packages/grafana-prometheus/src/querybuilder/shared/OperationHeader.tsx @@ -1,6 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/shared/OperationHeader.tsx import { css } from '@emotion/css'; -import React, { useState } from 'react'; +import { memo, useState } from 'react'; import { DraggableProvided } from 'react-beautiful-dnd'; import { GrafanaTheme2, SelectableValue } from '@grafana/data'; @@ -25,7 +25,7 @@ interface State { alternatives?: Array>; } -export const OperationHeader = React.memo( +export const OperationHeader = memo( ({ operation, def, index, onChange, onRemove, queryModeller, dragHandleProps }) => { const styles = useStyles2(getStyles); const [state, setState] = useState({}); diff --git a/packages/grafana-prometheus/src/querybuilder/shared/OperationInfoButton.tsx b/packages/grafana-prometheus/src/querybuilder/shared/OperationInfoButton.tsx index c5149c16ef9..d95e308d817 100644 --- a/packages/grafana-prometheus/src/querybuilder/shared/OperationInfoButton.tsx +++ b/packages/grafana-prometheus/src/querybuilder/shared/OperationInfoButton.tsx @@ -10,7 +10,7 @@ import { useFloating, useInteractions, } from '@floating-ui/react'; -import React, { useState } from 'react'; +import { memo, useState } from 'react'; import { GrafanaTheme2, renderMarkdown } from '@grafana/data'; import { FlexItem } from '@grafana/experimental'; @@ -23,7 +23,7 @@ export interface Props { def: QueryBuilderOperationDef; } -export const OperationInfoButton = React.memo(({ def, operation }) => { +export const OperationInfoButton = memo(({ def, operation }) => { const styles = useStyles2(getStyles); const [show, setShow] = useState(false); diff --git a/packages/grafana-prometheus/src/querybuilder/shared/OperationList.test.tsx b/packages/grafana-prometheus/src/querybuilder/shared/OperationList.test.tsx index 298901d39fe..871d8621e59 100644 --- a/packages/grafana-prometheus/src/querybuilder/shared/OperationList.test.tsx +++ b/packages/grafana-prometheus/src/querybuilder/shared/OperationList.test.tsx @@ -1,7 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/shared/OperationList.test.tsx import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { DataSourceApi, DataSourceInstanceSettings } from '@grafana/data'; diff --git a/packages/grafana-prometheus/src/querybuilder/shared/OperationList.tsx b/packages/grafana-prometheus/src/querybuilder/shared/OperationList.tsx index 875eb166730..d3091559642 100644 --- a/packages/grafana-prometheus/src/querybuilder/shared/OperationList.tsx +++ b/packages/grafana-prometheus/src/querybuilder/shared/OperationList.tsx @@ -1,6 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/shared/OperationList.tsx import { css } from '@emotion/css'; -import React, { useState } from 'react'; +import { useState } from 'react'; import { DragDropContext, Droppable, DropResult } from 'react-beautiful-dnd'; import { useMountedState, usePrevious } from 'react-use'; diff --git a/packages/grafana-prometheus/src/querybuilder/shared/OperationListExplained.tsx b/packages/grafana-prometheus/src/querybuilder/shared/OperationListExplained.tsx index bde7203584c..580109a0999 100644 --- a/packages/grafana-prometheus/src/querybuilder/shared/OperationListExplained.tsx +++ b/packages/grafana-prometheus/src/querybuilder/shared/OperationListExplained.tsx @@ -1,6 +1,5 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/shared/OperationListExplained.tsx import { Grammar } from 'prismjs'; -import React from 'react'; import { OperationExplainedBox } from './OperationExplainedBox'; import { RawQuery } from './RawQuery'; diff --git a/packages/grafana-prometheus/src/querybuilder/shared/OperationParamEditor.tsx b/packages/grafana-prometheus/src/querybuilder/shared/OperationParamEditor.tsx index d4f8694c4a6..6a1d6717879 100644 --- a/packages/grafana-prometheus/src/querybuilder/shared/OperationParamEditor.tsx +++ b/packages/grafana-prometheus/src/querybuilder/shared/OperationParamEditor.tsx @@ -1,6 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/shared/OperationParamEditor.tsx import { css } from '@emotion/css'; -import React, { ComponentType } from 'react'; +import { ComponentType } from 'react'; import { GrafanaTheme2, SelectableValue, toOption } from '@grafana/data'; import { AutoSizeInput, Button, Checkbox, Select, useStyles2, Stack } from '@grafana/ui'; diff --git a/packages/grafana-prometheus/src/querybuilder/shared/OperationsEditorRow.tsx b/packages/grafana-prometheus/src/querybuilder/shared/OperationsEditorRow.tsx index 696d034b5a9..891f85e0414 100644 --- a/packages/grafana-prometheus/src/querybuilder/shared/OperationsEditorRow.tsx +++ b/packages/grafana-prometheus/src/querybuilder/shared/OperationsEditorRow.tsx @@ -1,6 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/shared/OperationsEditorRow.tsx import { css } from '@emotion/css'; -import React from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { useStyles2, Stack } from '@grafana/ui'; diff --git a/packages/grafana-prometheus/src/querybuilder/shared/QueryBuilderHints.tsx b/packages/grafana-prometheus/src/querybuilder/shared/QueryBuilderHints.tsx index 2024bff7753..df2c9fa048d 100644 --- a/packages/grafana-prometheus/src/querybuilder/shared/QueryBuilderHints.tsx +++ b/packages/grafana-prometheus/src/querybuilder/shared/QueryBuilderHints.tsx @@ -1,6 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/shared/QueryBuilderHints.tsx import { css } from '@emotion/css'; -import React, { useEffect, useState } from 'react'; +import { useEffect, useState } from 'react'; import { GrafanaTheme2, PanelData, QueryHint } from '@grafana/data'; import { reportInteraction } from '@grafana/runtime'; diff --git a/packages/grafana-prometheus/src/querybuilder/shared/QueryEditorModeToggle.tsx b/packages/grafana-prometheus/src/querybuilder/shared/QueryEditorModeToggle.tsx index f5541dde1c8..0b0951cac5a 100644 --- a/packages/grafana-prometheus/src/querybuilder/shared/QueryEditorModeToggle.tsx +++ b/packages/grafana-prometheus/src/querybuilder/shared/QueryEditorModeToggle.tsx @@ -1,6 +1,4 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/shared/QueryEditorModeToggle.tsx -import React from 'react'; - import { RadioButtonGroup } from '@grafana/ui'; import { QueryEditorMode } from './types'; diff --git a/packages/grafana-prometheus/src/querybuilder/shared/QueryHeaderSwitch.tsx b/packages/grafana-prometheus/src/querybuilder/shared/QueryHeaderSwitch.tsx index f92f2accd44..a5b484dd01e 100644 --- a/packages/grafana-prometheus/src/querybuilder/shared/QueryHeaderSwitch.tsx +++ b/packages/grafana-prometheus/src/querybuilder/shared/QueryHeaderSwitch.tsx @@ -1,7 +1,7 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/shared/QueryHeaderSwitch.tsx import { css } from '@emotion/css'; import { uniqueId } from 'lodash'; -import React, { HTMLProps, useRef } from 'react'; +import { HTMLProps, useRef } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { Switch, useStyles2, Stack } from '@grafana/ui'; diff --git a/packages/grafana-prometheus/src/querybuilder/shared/QueryOptionGroup.tsx b/packages/grafana-prometheus/src/querybuilder/shared/QueryOptionGroup.tsx index 7d8df70545b..066e0f805ed 100644 --- a/packages/grafana-prometheus/src/querybuilder/shared/QueryOptionGroup.tsx +++ b/packages/grafana-prometheus/src/querybuilder/shared/QueryOptionGroup.tsx @@ -1,6 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/shared/QueryOptionGroup.tsx import { css } from '@emotion/css'; -import React from 'react'; +import * as React from 'react'; import { useToggle } from 'react-use'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-prometheus/src/querybuilder/shared/RawQuery.tsx b/packages/grafana-prometheus/src/querybuilder/shared/RawQuery.tsx index da7ec8c0f79..ddaffbc3b87 100644 --- a/packages/grafana-prometheus/src/querybuilder/shared/RawQuery.tsx +++ b/packages/grafana-prometheus/src/querybuilder/shared/RawQuery.tsx @@ -1,7 +1,6 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/shared/RawQuery.tsx import { css, cx } from '@emotion/css'; import Prism, { Grammar } from 'prismjs'; -import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { useTheme2 } from '@grafana/ui'; diff --git a/packages/grafana-prometheus/tsconfig.json b/packages/grafana-prometheus/tsconfig.json index 16a6f15ea71..403dfb14d23 100644 --- a/packages/grafana-prometheus/tsconfig.json +++ b/packages/grafana-prometheus/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "jsx": "react-jsx", "alwaysStrict": true, "declarationDir": "./compiled", "emitDeclarationOnly": true, diff --git a/packages/grafana-runtime/src/analytics/plugins/usePluginInteractionReporter.test.tsx b/packages/grafana-runtime/src/analytics/plugins/usePluginInteractionReporter.test.tsx index 40c2a65bdc9..0a3c7669489 100644 --- a/packages/grafana-runtime/src/analytics/plugins/usePluginInteractionReporter.test.tsx +++ b/packages/grafana-runtime/src/analytics/plugins/usePluginInteractionReporter.test.tsx @@ -1,5 +1,5 @@ import { renderHook } from '@testing-library/react'; -import React from 'react'; +import * as React from 'react'; import { DataSourceInstanceSettings, diff --git a/packages/grafana-runtime/src/components/DataSourcePicker.test.tsx b/packages/grafana-runtime/src/components/DataSourcePicker.test.tsx index bdd44487e7b..6480a2644dc 100644 --- a/packages/grafana-runtime/src/components/DataSourcePicker.test.tsx +++ b/packages/grafana-runtime/src/components/DataSourcePicker.test.tsx @@ -1,6 +1,5 @@ import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { DataSourcePicker } from './DataSourcePicker'; diff --git a/packages/grafana-runtime/src/components/DataSourcePicker.tsx b/packages/grafana-runtime/src/components/DataSourcePicker.tsx index 442bb2ad45d..337366827bc 100644 --- a/packages/grafana-runtime/src/components/DataSourcePicker.tsx +++ b/packages/grafana-runtime/src/components/DataSourcePicker.tsx @@ -1,5 +1,5 @@ // Libraries -import React, { PureComponent } from 'react'; +import { PureComponent } from 'react'; // Components import { diff --git a/packages/grafana-runtime/src/components/EmbeddedDashboard.tsx b/packages/grafana-runtime/src/components/EmbeddedDashboard.tsx index 92a78e5d4ea..e78d3ae7a8b 100644 --- a/packages/grafana-runtime/src/components/EmbeddedDashboard.tsx +++ b/packages/grafana-runtime/src/components/EmbeddedDashboard.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; export interface EmbeddedDashboardProps { uid?: string; diff --git a/packages/grafana-runtime/src/components/PanelDataErrorView.tsx b/packages/grafana-runtime/src/components/PanelDataErrorView.tsx index 05902a3348a..53a716a4d8f 100644 --- a/packages/grafana-runtime/src/components/PanelDataErrorView.tsx +++ b/packages/grafana-runtime/src/components/PanelDataErrorView.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { FieldConfigSource, PanelData, VisualizationSuggestion } from '@grafana/data'; diff --git a/packages/grafana-runtime/src/components/PanelRenderer.tsx b/packages/grafana-runtime/src/components/PanelRenderer.tsx index 027db5d8ad3..b015377068f 100644 --- a/packages/grafana-runtime/src/components/PanelRenderer.tsx +++ b/packages/grafana-runtime/src/components/PanelRenderer.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { AbsoluteTimeRange, FieldConfigSource, PanelData } from '@grafana/data'; diff --git a/packages/grafana-runtime/src/components/PluginPage.tsx b/packages/grafana-runtime/src/components/PluginPage.tsx index de886f12e8e..b14db4abefa 100644 --- a/packages/grafana-runtime/src/components/PluginPage.tsx +++ b/packages/grafana-runtime/src/components/PluginPage.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { NavModelItem, PageLayoutType } from '@grafana/data'; diff --git a/packages/grafana-runtime/tsconfig.json b/packages/grafana-runtime/tsconfig.json index f157cf99c3f..8dc5fe6ffb8 100644 --- a/packages/grafana-runtime/tsconfig.json +++ b/packages/grafana-runtime/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "jsx": "react-jsx", "baseUrl": "./", "declarationDir": "./compiled", "emitDeclarationOnly": true, diff --git a/packages/grafana-schema/tsconfig.json b/packages/grafana-schema/tsconfig.json index 99cbc657b72..a7e415a1cea 100644 --- a/packages/grafana-schema/tsconfig.json +++ b/packages/grafana-schema/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "jsx": "react-jsx", "declarationDir": "./dist/esm", "emitDeclarationOnly": true, "isolatedModules": true, diff --git a/packages/grafana-sql/src/components/ConfirmModal.tsx b/packages/grafana-sql/src/components/ConfirmModal.tsx index 0bf1e1b67d5..52090012b79 100644 --- a/packages/grafana-sql/src/components/ConfirmModal.tsx +++ b/packages/grafana-sql/src/components/ConfirmModal.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { useRef, useEffect } from 'react'; +import { useRef, useEffect } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { Button, Icon, Modal, useStyles2 } from '@grafana/ui'; diff --git a/packages/grafana-sql/src/components/DatasetSelector.tsx b/packages/grafana-sql/src/components/DatasetSelector.tsx index bed91f5f5ca..2e0cf47f014 100644 --- a/packages/grafana-sql/src/components/DatasetSelector.tsx +++ b/packages/grafana-sql/src/components/DatasetSelector.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from 'react'; +import { useEffect } from 'react'; import { useAsync } from 'react-use'; import { SelectableValue } from '@grafana/data'; diff --git a/packages/grafana-sql/src/components/ErrorBoundary.tsx b/packages/grafana-sql/src/components/ErrorBoundary.tsx index 4102bfbf932..d46ad205602 100644 --- a/packages/grafana-sql/src/components/ErrorBoundary.tsx +++ b/packages/grafana-sql/src/components/ErrorBoundary.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; type Props = { fallBackComponent?: React.ReactNode; diff --git a/packages/grafana-sql/src/components/QueryEditor.tsx b/packages/grafana-sql/src/components/QueryEditor.tsx index cfefaf37935..3adffb79efb 100644 --- a/packages/grafana-sql/src/components/QueryEditor.tsx +++ b/packages/grafana-sql/src/components/QueryEditor.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useEffect, useState } from 'react'; +import { useCallback, useEffect, useState } from 'react'; import { useAsync } from 'react-use'; import { QueryEditorProps } from '@grafana/data'; diff --git a/packages/grafana-sql/src/components/QueryHeader.tsx b/packages/grafana-sql/src/components/QueryHeader.tsx index c52fdaafaf8..f1bede6cb4f 100644 --- a/packages/grafana-sql/src/components/QueryHeader.tsx +++ b/packages/grafana-sql/src/components/QueryHeader.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useId, useState } from 'react'; +import { useCallback, useId, useState } from 'react'; import { useCopyToClipboard } from 'react-use'; import { SelectableValue } from '@grafana/data'; diff --git a/packages/grafana-sql/src/components/SqlComponents.test.tsx b/packages/grafana-sql/src/components/SqlComponents.test.tsx index 9cfd8b59565..efe5bd85bd7 100644 --- a/packages/grafana-sql/src/components/SqlComponents.test.tsx +++ b/packages/grafana-sql/src/components/SqlComponents.test.tsx @@ -1,5 +1,4 @@ import { render, waitFor } from '@testing-library/react'; -import React from 'react'; import { config } from '@grafana/runtime'; diff --git a/packages/grafana-sql/src/components/TableSelector.tsx b/packages/grafana-sql/src/components/TableSelector.tsx index d1dff4d0b78..9801f98d12c 100644 --- a/packages/grafana-sql/src/components/TableSelector.tsx +++ b/packages/grafana-sql/src/components/TableSelector.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { useAsync } from 'react-use'; import { SelectableValue, toOption } from '@grafana/data'; diff --git a/packages/grafana-sql/src/components/configuration/ConnectionLimits.tsx b/packages/grafana-sql/src/components/configuration/ConnectionLimits.tsx index 667bc7fe5cb..17218d5188a 100644 --- a/packages/grafana-sql/src/components/configuration/ConnectionLimits.tsx +++ b/packages/grafana-sql/src/components/configuration/ConnectionLimits.tsx @@ -1,5 +1,3 @@ -import React from 'react'; - import { DataSourceSettings } from '@grafana/data'; import { ConfigSubSection, Stack } from '@grafana/experimental'; import { config } from '@grafana/runtime'; diff --git a/packages/grafana-sql/src/components/configuration/Divider.tsx b/packages/grafana-sql/src/components/configuration/Divider.tsx index c6582eb725f..6eff752c64c 100644 --- a/packages/grafana-sql/src/components/configuration/Divider.tsx +++ b/packages/grafana-sql/src/components/configuration/Divider.tsx @@ -1,5 +1,4 @@ import { css } from '@emotion/css'; -import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { useStyles2 } from '@grafana/ui'; diff --git a/packages/grafana-sql/src/components/configuration/NumberInput.tsx b/packages/grafana-sql/src/components/configuration/NumberInput.tsx index 875dc921116..e71ce679311 100644 --- a/packages/grafana-sql/src/components/configuration/NumberInput.tsx +++ b/packages/grafana-sql/src/components/configuration/NumberInput.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import { useState } from 'react'; import { Input } from '@grafana/ui/src/components/Input/Input'; @@ -10,7 +10,7 @@ type NumberInputProps = { }; export function NumberInput({ value, defaultValue, onChange, width }: NumberInputProps) { - const [isEmpty, setIsEmpty] = React.useState(false); + const [isEmpty, setIsEmpty] = useState(false); return ( { +export const EllipsisAnimated = memo(() => { const styles = useStyles2(getStyles); return (
      diff --git a/packages/grafana-ui/src/components/Badge/Badge.story.tsx b/packages/grafana-ui/src/components/Badge/Badge.story.tsx index 247f7774790..442daa3a379 100644 --- a/packages/grafana-ui/src/components/Badge/Badge.story.tsx +++ b/packages/grafana-ui/src/components/Badge/Badge.story.tsx @@ -1,5 +1,4 @@ import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { Badge } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/Badge/Badge.tsx b/packages/grafana-ui/src/components/Badge/Badge.tsx index 969c6ebfb10..9238c8a648c 100644 --- a/packages/grafana-ui/src/components/Badge/Badge.tsx +++ b/packages/grafana-ui/src/components/Badge/Badge.tsx @@ -1,5 +1,6 @@ import { css, cx } from '@emotion/css'; -import React, { HTMLAttributes } from 'react'; +import { HTMLAttributes } from 'react'; +import * as React from 'react'; import Skeleton from 'react-loading-skeleton'; import tinycolor from 'tinycolor2'; diff --git a/packages/grafana-ui/src/components/BarGauge/BarGauge.story.tsx b/packages/grafana-ui/src/components/BarGauge/BarGauge.story.tsx index 8905e958f1e..be5fe58381f 100644 --- a/packages/grafana-ui/src/components/BarGauge/BarGauge.story.tsx +++ b/packages/grafana-ui/src/components/BarGauge/BarGauge.story.tsx @@ -1,5 +1,4 @@ import { StoryFn, Meta } from '@storybook/react'; -import React from 'react'; import { VizOrientation, ThresholdsMode, Field, FieldType, getDisplayProcessor } from '@grafana/data'; import { BarGauge, BarGaugeDisplayMode } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/BarGauge/BarGauge.test.tsx b/packages/grafana-ui/src/components/BarGauge/BarGauge.test.tsx index 3982a31931b..c8b76542ba5 100644 --- a/packages/grafana-ui/src/components/BarGauge/BarGauge.test.tsx +++ b/packages/grafana-ui/src/components/BarGauge/BarGauge.test.tsx @@ -1,5 +1,4 @@ import { render } from '@testing-library/react'; -import React from 'react'; import { DisplayValue, diff --git a/packages/grafana-ui/src/components/BarGauge/BarGauge.tsx b/packages/grafana-ui/src/components/BarGauge/BarGauge.tsx index db2ff91f09b..2624bc9f794 100644 --- a/packages/grafana-ui/src/components/BarGauge/BarGauge.tsx +++ b/packages/grafana-ui/src/components/BarGauge/BarGauge.tsx @@ -1,6 +1,7 @@ // Library import { cx } from '@emotion/css'; -import React, { CSSProperties, PureComponent, ReactNode } from 'react'; +import { CSSProperties, PureComponent, ReactNode } from 'react'; +import * as React from 'react'; import tinycolor from 'tinycolor2'; import { diff --git a/packages/grafana-ui/src/components/BigValue/BigValue.story.tsx b/packages/grafana-ui/src/components/BigValue/BigValue.story.tsx index 58005a08989..a7a4ea9d6e1 100644 --- a/packages/grafana-ui/src/components/BigValue/BigValue.story.tsx +++ b/packages/grafana-ui/src/components/BigValue/BigValue.story.tsx @@ -1,5 +1,4 @@ import { StoryFn, Meta } from '@storybook/react'; -import React from 'react'; import { FieldSparkline, FieldType } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/BigValue/BigValue.test.tsx b/packages/grafana-ui/src/components/BigValue/BigValue.test.tsx index a5e6fa46e1e..ff682372578 100644 --- a/packages/grafana-ui/src/components/BigValue/BigValue.test.tsx +++ b/packages/grafana-ui/src/components/BigValue/BigValue.test.tsx @@ -1,5 +1,4 @@ import { render, screen } from '@testing-library/react'; -import React from 'react'; import { createTheme } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/BigValue/BigValue.tsx b/packages/grafana-ui/src/components/BigValue/BigValue.tsx index 0b89924d885..220799ee37f 100644 --- a/packages/grafana-ui/src/components/BigValue/BigValue.tsx +++ b/packages/grafana-ui/src/components/BigValue/BigValue.tsx @@ -1,5 +1,6 @@ import { cx } from '@emotion/css'; -import React, { PureComponent } from 'react'; +import { PureComponent } from 'react'; +import * as React from 'react'; import { DisplayValue, DisplayValueAlignmentFactors, FieldSparkline } from '@grafana/data'; import { PercentChangeColorMode, VizTextDisplayOptions } from '@grafana/schema'; diff --git a/packages/grafana-ui/src/components/BigValue/BigValueLayout.tsx b/packages/grafana-ui/src/components/BigValue/BigValueLayout.tsx index 5535847e978..23b32b90ad1 100644 --- a/packages/grafana-ui/src/components/BigValue/BigValueLayout.tsx +++ b/packages/grafana-ui/src/components/BigValue/BigValueLayout.tsx @@ -1,4 +1,5 @@ -import React, { CSSProperties } from 'react'; +import { CSSProperties } from 'react'; +import * as React from 'react'; import tinycolor from 'tinycolor2'; import { formattedValueToString, DisplayValue, FieldConfig, FieldType, ThemeVisualizationColors } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/BigValue/PercentChange.tsx b/packages/grafana-ui/src/components/BigValue/PercentChange.tsx index b492dfb6398..222cccf13b6 100644 --- a/packages/grafana-ui/src/components/BigValue/PercentChange.tsx +++ b/packages/grafana-ui/src/components/BigValue/PercentChange.tsx @@ -1,5 +1,3 @@ -import React from 'react'; - import { Icon } from '../Icon/Icon'; import { PercentChangeStyles } from './BigValueLayout'; diff --git a/packages/grafana-ui/src/components/BrowserLabel/Label.tsx b/packages/grafana-ui/src/components/BrowserLabel/Label.tsx index 69d09b4aafd..9ce9289575e 100644 --- a/packages/grafana-ui/src/components/BrowserLabel/Label.tsx +++ b/packages/grafana-ui/src/components/BrowserLabel/Label.tsx @@ -1,5 +1,6 @@ import { cx, css } from '@emotion/css'; -import React, { forwardRef, HTMLAttributes, useCallback } from 'react'; +import { forwardRef, HTMLAttributes, useCallback } from 'react'; +import * as React from 'react'; import Highlighter from 'react-highlight-words'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Button/Button.story.tsx b/packages/grafana-ui/src/components/Button/Button.story.tsx index d1372d63dc5..706215637af 100644 --- a/packages/grafana-ui/src/components/Button/Button.story.tsx +++ b/packages/grafana-ui/src/components/Button/Button.story.tsx @@ -1,6 +1,5 @@ import { action } from '@storybook/addon-actions'; import { StoryFn } from '@storybook/react'; -import React from 'react'; import { ComponentSize } from '../../types'; import { Card } from '../Card/Card'; diff --git a/packages/grafana-ui/src/components/Button/Button.tsx b/packages/grafana-ui/src/components/Button/Button.tsx index 991bf3ad454..3f8e1b6f642 100644 --- a/packages/grafana-ui/src/components/Button/Button.tsx +++ b/packages/grafana-ui/src/components/Button/Button.tsx @@ -1,5 +1,6 @@ import { css, cx } from '@emotion/css'; -import React, { AnchorHTMLAttributes, ButtonHTMLAttributes } from 'react'; +import { AnchorHTMLAttributes, ButtonHTMLAttributes } from 'react'; +import * as React from 'react'; import { GrafanaTheme2, ThemeRichColor } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Button/ButtonGroup.tsx b/packages/grafana-ui/src/components/Button/ButtonGroup.tsx index 49340d5f933..f7cdb009fe7 100644 --- a/packages/grafana-ui/src/components/Button/ButtonGroup.tsx +++ b/packages/grafana-ui/src/components/Button/ButtonGroup.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React, { forwardRef, HTMLAttributes } from 'react'; +import { forwardRef, HTMLAttributes } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Button/FullWidthButtonContainer.tsx b/packages/grafana-ui/src/components/Button/FullWidthButtonContainer.tsx index 9c3fcfa7ca7..1e4ee66c10d 100644 --- a/packages/grafana-ui/src/components/Button/FullWidthButtonContainer.tsx +++ b/packages/grafana-ui/src/components/Button/FullWidthButtonContainer.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React from 'react'; +import * as React from 'react'; import { useStyles2 } from '../../themes'; diff --git a/packages/grafana-ui/src/components/ButtonCascader/ButtonCascader.story.tsx b/packages/grafana-ui/src/components/ButtonCascader/ButtonCascader.story.tsx index 4a80c5a4390..7ae5ad2bae8 100644 --- a/packages/grafana-ui/src/components/ButtonCascader/ButtonCascader.story.tsx +++ b/packages/grafana-ui/src/components/ButtonCascader/ButtonCascader.story.tsx @@ -1,5 +1,4 @@ import { StoryFn, Meta } from '@storybook/react'; -import React from 'react'; import { ButtonCascader } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/ButtonCascader/ButtonCascader.tsx b/packages/grafana-ui/src/components/ButtonCascader/ButtonCascader.tsx index 947f921a460..cc09b8d840a 100644 --- a/packages/grafana-ui/src/components/ButtonCascader/ButtonCascader.tsx +++ b/packages/grafana-ui/src/components/ButtonCascader/ButtonCascader.tsx @@ -1,6 +1,6 @@ import { css, cx } from '@emotion/css'; import RCCascader, { BaseOptionType } from 'rc-cascader'; -import React from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/CallToActionCard/CallToActionCard.internal.story.tsx b/packages/grafana-ui/src/components/CallToActionCard/CallToActionCard.internal.story.tsx index 6272ef29152..5d42373e1cc 100644 --- a/packages/grafana-ui/src/components/CallToActionCard/CallToActionCard.internal.story.tsx +++ b/packages/grafana-ui/src/components/CallToActionCard/CallToActionCard.internal.story.tsx @@ -1,6 +1,5 @@ import { action } from '@storybook/addon-actions'; import { StoryFn, Meta } from '@storybook/react'; -import React from 'react'; import { Button } from '../Button/Button'; diff --git a/packages/grafana-ui/src/components/CallToActionCard/CallToActionCard.test.tsx b/packages/grafana-ui/src/components/CallToActionCard/CallToActionCard.test.tsx index 70828c81a6e..2e2391da18a 100644 --- a/packages/grafana-ui/src/components/CallToActionCard/CallToActionCard.test.tsx +++ b/packages/grafana-ui/src/components/CallToActionCard/CallToActionCard.test.tsx @@ -1,5 +1,4 @@ import { render, screen } from '@testing-library/react'; -import React from 'react'; import { CallToActionCard } from './CallToActionCard'; diff --git a/packages/grafana-ui/src/components/CallToActionCard/CallToActionCard.tsx b/packages/grafana-ui/src/components/CallToActionCard/CallToActionCard.tsx index e0be02a5e67..e71c688f3e7 100644 --- a/packages/grafana-ui/src/components/CallToActionCard/CallToActionCard.tsx +++ b/packages/grafana-ui/src/components/CallToActionCard/CallToActionCard.tsx @@ -1,5 +1,4 @@ import { css, cx } from '@emotion/css'; -import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Card/Card.story.tsx b/packages/grafana-ui/src/components/Card/Card.story.tsx index c53e01798b0..fb040abb520 100644 --- a/packages/grafana-ui/src/components/Card/Card.story.tsx +++ b/packages/grafana-ui/src/components/Card/Card.story.tsx @@ -1,5 +1,4 @@ import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { Button } from '../Button'; import { IconButton } from '../IconButton/IconButton'; diff --git a/packages/grafana-ui/src/components/Card/Card.test.tsx b/packages/grafana-ui/src/components/Card/Card.test.tsx index ec7c673faa0..86e81c784aa 100644 --- a/packages/grafana-ui/src/components/Card/Card.test.tsx +++ b/packages/grafana-ui/src/components/Card/Card.test.tsx @@ -1,5 +1,4 @@ import { render, screen, fireEvent } from '@testing-library/react'; -import React from 'react'; import { Button } from '../Button'; import { IconButton } from '../IconButton/IconButton'; diff --git a/packages/grafana-ui/src/components/Card/Card.tsx b/packages/grafana-ui/src/components/Card/Card.tsx index 08f363dda25..2b433485a1d 100644 --- a/packages/grafana-ui/src/components/Card/Card.tsx +++ b/packages/grafana-ui/src/components/Card/Card.tsx @@ -1,5 +1,6 @@ import { css, cx } from '@emotion/css'; -import React, { memo, cloneElement, FC, useMemo, useContext, ReactNode } from 'react'; +import { memo, cloneElement, FC, useMemo, useContext, ReactNode } from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Card/CardContainer.tsx b/packages/grafana-ui/src/components/Card/CardContainer.tsx index 15ba01c9651..2d461dabf6f 100644 --- a/packages/grafana-ui/src/components/Card/CardContainer.tsx +++ b/packages/grafana-ui/src/components/Card/CardContainer.tsx @@ -1,5 +1,6 @@ import { css, cx } from '@emotion/css'; -import React, { HTMLAttributes } from 'react'; +import { HTMLAttributes } from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Cascader/Cascader.story.tsx b/packages/grafana-ui/src/components/Cascader/Cascader.story.tsx index 9abfda616a3..9135ec928ae 100644 --- a/packages/grafana-ui/src/components/Cascader/Cascader.story.tsx +++ b/packages/grafana-ui/src/components/Cascader/Cascader.story.tsx @@ -1,5 +1,5 @@ import { StoryFn, Meta } from '@storybook/react'; -import React from 'react'; +import { useState } from 'react'; import { Cascader } from '@grafana/ui'; @@ -87,7 +87,7 @@ WithDisplayAllSelectedLevels.args = { }; export const WithOptionsStateUpdate = () => { - const [updatedOptions, setOptions] = React.useState([ + const [updatedOptions, setOptions] = useState([ { label: 'Initial state option', value: 'initial', diff --git a/packages/grafana-ui/src/components/Cascader/Cascader.test.tsx b/packages/grafana-ui/src/components/Cascader/Cascader.test.tsx index e33b21bab0c..231bd8e6ff8 100644 --- a/packages/grafana-ui/src/components/Cascader/Cascader.test.tsx +++ b/packages/grafana-ui/src/components/Cascader/Cascader.test.tsx @@ -1,6 +1,6 @@ import { act, render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; +import { useState } from 'react'; import { Field } from '../Forms/Field'; @@ -32,7 +32,7 @@ const options = [ ]; const CascaderWithOptionsStateUpdate = (props: Omit) => { - const [updatedOptions, setOptions] = React.useState([ + const [updatedOptions, setOptions] = useState([ { label: 'Initial state option', value: 'initial', diff --git a/packages/grafana-ui/src/components/Cascader/Cascader.tsx b/packages/grafana-ui/src/components/Cascader/Cascader.tsx index 8d3622e6d5e..f3b2114b613 100644 --- a/packages/grafana-ui/src/components/Cascader/Cascader.tsx +++ b/packages/grafana-ui/src/components/Cascader/Cascader.tsx @@ -1,7 +1,8 @@ import { css } from '@emotion/css'; import memoize from 'micro-memoize'; import RCCascader from 'rc-cascader'; -import React, { PureComponent } from 'react'; +import { PureComponent } from 'react'; +import * as React from 'react'; import { SelectableValue } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/ClickOutsideWrapper/ClickOutsideWrapper.story.tsx b/packages/grafana-ui/src/components/ClickOutsideWrapper/ClickOutsideWrapper.story.tsx index ec5273dae33..c2fc4d41a24 100644 --- a/packages/grafana-ui/src/components/ClickOutsideWrapper/ClickOutsideWrapper.story.tsx +++ b/packages/grafana-ui/src/components/ClickOutsideWrapper/ClickOutsideWrapper.story.tsx @@ -1,6 +1,5 @@ import { action } from '@storybook/addon-actions'; import { Meta } from '@storybook/react'; -import React from 'react'; import { ClickOutsideWrapper } from './ClickOutsideWrapper'; import mdx from './ClickOutsideWrapper.mdx'; diff --git a/packages/grafana-ui/src/components/ClickOutsideWrapper/ClickOutsideWrapper.tsx b/packages/grafana-ui/src/components/ClickOutsideWrapper/ClickOutsideWrapper.tsx index 2effdc87463..015aada0881 100644 --- a/packages/grafana-ui/src/components/ClickOutsideWrapper/ClickOutsideWrapper.tsx +++ b/packages/grafana-ui/src/components/ClickOutsideWrapper/ClickOutsideWrapper.tsx @@ -1,4 +1,5 @@ -import React, { PureComponent, createRef } from 'react'; +import { PureComponent, createRef } from 'react'; +import * as React from 'react'; export interface Props { /** diff --git a/packages/grafana-ui/src/components/ClipboardButton/ClipboardButton.internal.story.tsx b/packages/grafana-ui/src/components/ClipboardButton/ClipboardButton.internal.story.tsx index 2f9fa9cc0e6..5089786ae97 100644 --- a/packages/grafana-ui/src/components/ClipboardButton/ClipboardButton.internal.story.tsx +++ b/packages/grafana-ui/src/components/ClipboardButton/ClipboardButton.internal.story.tsx @@ -1,5 +1,4 @@ import { StoryFn, Meta } from '@storybook/react'; -import React from 'react'; import { Field } from '../Forms/Field'; import { Input } from '../Input/Input'; diff --git a/packages/grafana-ui/src/components/ClipboardButton/ClipboardButton.tsx b/packages/grafana-ui/src/components/ClipboardButton/ClipboardButton.tsx index 4151461307e..8f56a9a36a0 100644 --- a/packages/grafana-ui/src/components/ClipboardButton/ClipboardButton.tsx +++ b/packages/grafana-ui/src/components/ClipboardButton/ClipboardButton.tsx @@ -1,5 +1,6 @@ import { css, cx } from '@emotion/css'; -import React, { useCallback, useRef, useState, useEffect } from 'react'; +import { useCallback, useRef, useState, useEffect } from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Collapse/CollapsableSection.story.tsx b/packages/grafana-ui/src/components/Collapse/CollapsableSection.story.tsx index f545207945a..4053b6d1e24 100644 --- a/packages/grafana-ui/src/components/Collapse/CollapsableSection.story.tsx +++ b/packages/grafana-ui/src/components/Collapse/CollapsableSection.story.tsx @@ -1,7 +1,6 @@ import { action } from '@storybook/addon-actions'; import { useArgs } from '@storybook/preview-api'; import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { CollapsableSection, Props } from './CollapsableSection'; import mdx from './CollapsableSection.mdx'; diff --git a/packages/grafana-ui/src/components/Collapse/CollapsableSection.tsx b/packages/grafana-ui/src/components/Collapse/CollapsableSection.tsx index 8c166852039..34e0f95db20 100644 --- a/packages/grafana-ui/src/components/Collapse/CollapsableSection.tsx +++ b/packages/grafana-ui/src/components/Collapse/CollapsableSection.tsx @@ -1,6 +1,7 @@ import { css, cx } from '@emotion/css'; import { uniqueId } from 'lodash'; -import React, { ReactNode, useRef, useState } from 'react'; +import { ReactNode, useRef, useState } from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Collapse/Collapse.story.tsx b/packages/grafana-ui/src/components/Collapse/Collapse.story.tsx index d3f74c3cb15..002a6f00093 100644 --- a/packages/grafana-ui/src/components/Collapse/Collapse.story.tsx +++ b/packages/grafana-ui/src/components/Collapse/Collapse.story.tsx @@ -1,7 +1,6 @@ import { action } from '@storybook/addon-actions'; import { useArgs } from '@storybook/preview-api'; import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { Collapse, ControlledCollapse } from './Collapse'; import mdx from './Collapse.mdx'; diff --git a/packages/grafana-ui/src/components/Collapse/Collapse.tsx b/packages/grafana-ui/src/components/Collapse/Collapse.tsx index d934ee52285..97e0389aa8a 100644 --- a/packages/grafana-ui/src/components/Collapse/Collapse.tsx +++ b/packages/grafana-ui/src/components/Collapse/Collapse.tsx @@ -1,5 +1,6 @@ import { css, cx } from '@emotion/css'; -import React, { useState } from 'react'; +import { useState } from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/ColorPicker/ColorInput.tsx b/packages/grafana-ui/src/components/ColorPicker/ColorInput.tsx index d8891939c66..1e55e1ac481 100644 --- a/packages/grafana-ui/src/components/ColorPicker/ColorInput.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/ColorInput.tsx @@ -1,6 +1,7 @@ import { cx, css } from '@emotion/css'; import { debounce } from 'lodash'; -import React, { forwardRef, useState, useEffect, useMemo } from 'react'; +import { forwardRef, useState, useEffect, useMemo } from 'react'; +import * as React from 'react'; import tinycolor from 'tinycolor2'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/ColorPicker/ColorPicker.story.tsx b/packages/grafana-ui/src/components/ColorPicker/ColorPicker.story.tsx index 1d7cc0439c1..b239587710e 100644 --- a/packages/grafana-ui/src/components/ColorPicker/ColorPicker.story.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/ColorPicker.story.tsx @@ -1,7 +1,6 @@ import { action } from '@storybook/addon-actions'; import { useArgs } from '@storybook/preview-api'; import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { SeriesColorPicker, ColorPicker, clearButtonStyles, useStyles2, ColorPickerInput } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/ColorPicker/ColorPicker.test.tsx b/packages/grafana-ui/src/components/ColorPicker/ColorPicker.test.tsx index d3cf04a4b71..68cf98b1c2c 100644 --- a/packages/grafana-ui/src/components/ColorPicker/ColorPicker.test.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/ColorPicker.test.tsx @@ -1,6 +1,5 @@ import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import renderer from 'react-test-renderer'; import { ColorPicker } from './ColorPicker'; diff --git a/packages/grafana-ui/src/components/ColorPicker/ColorPicker.tsx b/packages/grafana-ui/src/components/ColorPicker/ColorPicker.tsx index 57fc7cfe6ce..0f2221e497e 100644 --- a/packages/grafana-ui/src/components/ColorPicker/ColorPicker.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/ColorPicker.tsx @@ -1,5 +1,6 @@ import { css } from '@emotion/css'; -import React, { Component, createRef } from 'react'; +import { Component, createRef } from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/ColorPicker/ColorPickerInput.test.tsx b/packages/grafana-ui/src/components/ColorPicker/ColorPickerInput.test.tsx index 86f2b00a5e2..8b81be33bf0 100644 --- a/packages/grafana-ui/src/components/ColorPicker/ColorPickerInput.test.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/ColorPickerInput.test.tsx @@ -1,6 +1,5 @@ import { render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { ColorPickerInput } from './ColorPickerInput'; diff --git a/packages/grafana-ui/src/components/ColorPicker/ColorPickerInput.tsx b/packages/grafana-ui/src/components/ColorPicker/ColorPickerInput.tsx index dc1d83d67a0..add799af11c 100644 --- a/packages/grafana-ui/src/components/ColorPicker/ColorPickerInput.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/ColorPickerInput.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React, { useState, forwardRef } from 'react'; +import { useState, forwardRef } from 'react'; import { RgbaStringColorPicker } from 'react-colorful'; import { useThrottleFn } from 'react-use'; diff --git a/packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.story.tsx b/packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.story.tsx index 2a2b6fbba99..80974cf1b57 100644 --- a/packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.story.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.story.tsx @@ -1,5 +1,5 @@ import { Meta } from '@storybook/react'; -import React from 'react'; +import { useState } from 'react'; import { useTheme2 } from '../../themes'; @@ -32,7 +32,7 @@ export const Basic = () => { export const SeriesColorPickerPopoverExample = () => { const theme = useTheme2(); - const [yAxis, setYAxis] = React.useState(0); + const [yAxis, setYAxis] = useState(0); return (
      diff --git a/packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.test.tsx b/packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.test.tsx index 2be5a39d981..71379860992 100644 --- a/packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.test.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.test.tsx @@ -1,6 +1,5 @@ import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { createTheme } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.tsx b/packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.tsx index e6037228b56..a21122c5a08 100644 --- a/packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.tsx @@ -1,6 +1,7 @@ import { css } from '@emotion/css'; import { FocusScope } from '@react-aria/focus'; -import React, { Component } from 'react'; +import { Component } from 'react'; +import * as React from 'react'; import { GrafanaTheme2, colorManipulator } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/ColorPicker/ColorSwatch.tsx b/packages/grafana-ui/src/components/ColorPicker/ColorSwatch.tsx index 97cdabdc1c1..01a96edb421 100644 --- a/packages/grafana-ui/src/components/ColorPicker/ColorSwatch.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/ColorSwatch.tsx @@ -1,6 +1,6 @@ import { css } from '@emotion/css'; import { useFocusRing } from '@react-aria/focus'; -import React from 'react'; +import * as React from 'react'; import tinycolor from 'tinycolor2'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/ColorPicker/NamedColorsGroup.tsx b/packages/grafana-ui/src/components/ColorPicker/NamedColorsGroup.tsx index 5ea91f413ae..47500ac910d 100644 --- a/packages/grafana-ui/src/components/ColorPicker/NamedColorsGroup.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/NamedColorsGroup.tsx @@ -1,7 +1,6 @@ import { css } from '@emotion/css'; import { Property } from 'csstype'; import { upperFirst } from 'lodash'; -import React from 'react'; import { GrafanaTheme2, ThemeVizHue } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/ColorPicker/NamedColorsPalette.test.tsx b/packages/grafana-ui/src/components/ColorPicker/NamedColorsPalette.test.tsx index 51809087d90..d9b645dba2b 100644 --- a/packages/grafana-ui/src/components/ColorPicker/NamedColorsPalette.test.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/NamedColorsPalette.test.tsx @@ -1,5 +1,4 @@ import { screen, render } from '@testing-library/react'; -import React from 'react'; import { createTheme } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/ColorPicker/NamedColorsPalette.tsx b/packages/grafana-ui/src/components/ColorPicker/NamedColorsPalette.tsx index fa7c9ab02f3..521500db77d 100644 --- a/packages/grafana-ui/src/components/ColorPicker/NamedColorsPalette.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/NamedColorsPalette.tsx @@ -1,5 +1,4 @@ import { css } from '@emotion/css'; -import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/ColorPicker/Palettes.story.tsx b/packages/grafana-ui/src/components/ColorPicker/Palettes.story.tsx index 50a076c9513..06042a9a30d 100644 --- a/packages/grafana-ui/src/components/ColorPicker/Palettes.story.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/Palettes.story.tsx @@ -1,7 +1,7 @@ import { action } from '@storybook/addon-actions'; import { useArgs } from '@storybook/preview-api'; import { Meta, StoryFn } from '@storybook/react'; -import React, { useState } from 'react'; +import { useState } from 'react'; import mdx from './ColorPicker.mdx'; import { NamedColorsPalette } from './NamedColorsPalette'; diff --git a/packages/grafana-ui/src/components/ColorPicker/SeriesColorPickerPopover.tsx b/packages/grafana-ui/src/components/ColorPicker/SeriesColorPickerPopover.tsx index 90f5e80f605..542d8a67d26 100644 --- a/packages/grafana-ui/src/components/ColorPicker/SeriesColorPickerPopover.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/SeriesColorPickerPopover.tsx @@ -1,5 +1,3 @@ -import React from 'react'; - import { withTheme2 } from '../../themes'; import { InlineField } from '../Forms/InlineField'; import { InlineSwitch } from '../Switch/Switch'; diff --git a/packages/grafana-ui/src/components/ColorPicker/SpectrumPalette.tsx b/packages/grafana-ui/src/components/ColorPicker/SpectrumPalette.tsx index 825b59dbd1c..589b90375d5 100644 --- a/packages/grafana-ui/src/components/ColorPicker/SpectrumPalette.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/SpectrumPalette.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { useMemo, useState } from 'react'; +import { useMemo, useState } from 'react'; import { RgbaStringColorPicker } from 'react-colorful'; import { useThrottleFn } from 'react-use'; import tinycolor from 'tinycolor2'; diff --git a/packages/grafana-ui/src/components/Combobox/Combobox.internal.story.tsx b/packages/grafana-ui/src/components/Combobox/Combobox.internal.story.tsx index cf373415761..120e333e76d 100644 --- a/packages/grafana-ui/src/components/Combobox/Combobox.internal.story.tsx +++ b/packages/grafana-ui/src/components/Combobox/Combobox.internal.story.tsx @@ -1,7 +1,7 @@ import { action } from '@storybook/addon-actions'; import { Meta, StoryFn, StoryObj } from '@storybook/react'; import { Chance } from 'chance'; -import React, { ComponentProps, useMemo, useState } from 'react'; +import { ComponentProps, useMemo, useState } from 'react'; import { Combobox, Option, Value } from './Combobox'; diff --git a/packages/grafana-ui/src/components/Combobox/Combobox.tsx b/packages/grafana-ui/src/components/Combobox/Combobox.tsx index 17e782a4b36..af247f7bae1 100644 --- a/packages/grafana-ui/src/components/Combobox/Combobox.tsx +++ b/packages/grafana-ui/src/components/Combobox/Combobox.tsx @@ -1,7 +1,7 @@ import { css } from '@emotion/css'; import { useVirtualizer } from '@tanstack/react-virtual'; import { useCombobox } from 'downshift'; -import React, { useMemo, useRef, useState } from 'react'; +import { useMemo, useRef, useState } from 'react'; import { useStyles2 } from '../../themes'; import { Icon } from '../Icon/Icon'; diff --git a/packages/grafana-ui/src/components/ConfirmButton/ConfirmButton.story.tsx b/packages/grafana-ui/src/components/ConfirmButton/ConfirmButton.story.tsx index bf28ecc1be4..e8b577fe32b 100644 --- a/packages/grafana-ui/src/components/ConfirmButton/ConfirmButton.story.tsx +++ b/packages/grafana-ui/src/components/ConfirmButton/ConfirmButton.story.tsx @@ -1,6 +1,5 @@ import { action } from '@storybook/addon-actions'; import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { ConfirmButton } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/ConfirmButton/ConfirmButton.test.tsx b/packages/grafana-ui/src/components/ConfirmButton/ConfirmButton.test.tsx index 223ec38b780..98b0707a9c7 100644 --- a/packages/grafana-ui/src/components/ConfirmButton/ConfirmButton.test.tsx +++ b/packages/grafana-ui/src/components/ConfirmButton/ConfirmButton.test.tsx @@ -1,6 +1,5 @@ import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { ConfirmButton } from './ConfirmButton'; diff --git a/packages/grafana-ui/src/components/ConfirmButton/ConfirmButton.tsx b/packages/grafana-ui/src/components/ConfirmButton/ConfirmButton.tsx index d8c539fc43c..d045576bf1f 100644 --- a/packages/grafana-ui/src/components/ConfirmButton/ConfirmButton.tsx +++ b/packages/grafana-ui/src/components/ConfirmButton/ConfirmButton.tsx @@ -1,5 +1,6 @@ import { cx, css } from '@emotion/css'; -import React, { ReactElement, useEffect, useRef, useState } from 'react'; +import { ReactElement, useEffect, useRef, useState } from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/ConfirmButton/DeleteButton.tsx b/packages/grafana-ui/src/components/ConfirmButton/DeleteButton.tsx index d09ecaa46e2..81ca3c12a1c 100644 --- a/packages/grafana-ui/src/components/ConfirmButton/DeleteButton.tsx +++ b/packages/grafana-ui/src/components/ConfirmButton/DeleteButton.tsx @@ -1,5 +1,3 @@ -import React from 'react'; - import { ComponentSize } from '../../types/size'; import { Button } from '../Button'; diff --git a/packages/grafana-ui/src/components/ConfirmModal/ConfirmContent.tsx b/packages/grafana-ui/src/components/ConfirmModal/ConfirmContent.tsx index 016df971c2b..b63f2ffe7ad 100644 --- a/packages/grafana-ui/src/components/ConfirmModal/ConfirmContent.tsx +++ b/packages/grafana-ui/src/components/ConfirmModal/ConfirmContent.tsx @@ -1,5 +1,6 @@ import { css } from '@emotion/css'; -import React, { useEffect, useRef, useState } from 'react'; +import { useEffect, useRef, useState } from 'react'; +import * as React from 'react'; import { useForm } from 'react-hook-form'; import { GrafanaTheme2 } from '@grafana/data'; @@ -7,8 +8,8 @@ import { selectors } from '@grafana/e2e-selectors'; import { useStyles2 } from '../../themes'; import { Button, ButtonVariant } from '../Button'; +import { Field } from '../Forms/Field'; import { Input } from '../Input/Input'; -import { Box } from '../Layout/Box/Box'; import { Stack } from '../Layout/Stack/Stack'; import { JustifyContent } from '../Layout/types'; import { ResponsiveProp } from '../Layout/utils/responsiveness'; @@ -40,6 +41,8 @@ export interface ConfirmContentProps { onDismiss(): void; /** Alternative action callback */ onAlternative?(): void; + /** Disable the confirm button and the confirm text input if needed */ + disabled?: boolean; } export const ConfirmContent = ({ @@ -55,13 +58,14 @@ export const ConfirmContent = ({ alternativeButtonLabel, description, justifyButtons = 'flex-end', + disabled, }: ConfirmContentProps) => { - const [disabled, setDisabled] = useState(Boolean(confirmPromptText)); + const [isDisabled, setIsDisabled] = useState(disabled); const styles = useStyles2(getStyles); const buttonRef = useRef(null); const onConfirmationTextChange = (event: React.FormEvent) => { - setDisabled(confirmPromptText?.toLowerCase().localeCompare(event.currentTarget.value.toLowerCase()) !== 0); + setIsDisabled(confirmPromptText?.toLowerCase().localeCompare(event.currentTarget.value.toLowerCase()) !== 0); }; useEffect(() => { @@ -69,15 +73,15 @@ export const ConfirmContent = ({ }, []); useEffect(() => { - setDisabled(Boolean(confirmPromptText)); - }, [confirmPromptText]); + setIsDisabled(disabled ? true : Boolean(confirmPromptText)); + }, [confirmPromptText, disabled]); const onConfirmClick = async () => { - setDisabled(true); + setIsDisabled(true); try { await onConfirm(); } finally { - setDisabled(false); + setIsDisabled(false); } }; @@ -91,9 +95,9 @@ export const ConfirmContent = ({ {confirmPromptText ? (
      - + - +
      ) : null} @@ -106,7 +110,7 @@ export const ConfirmContent = ({
      {showHistory && ( @@ -178,7 +181,7 @@ const NarrowScreenForm = (props: FormProps) => { }; const FullScreenForm = (props: FormProps) => { - const { onChange, value, timeZone, fiscalYearStartMonth, isReversed, historyOptions, onError } = props; + const { onChange, value, timeZone, fiscalYearStartMonth, isReversed, historyOptions, onError, weekStart } = props; const styles = useStyles2(getFullScreenStyles, props.hideQuickRanges); const onChangeTimeOption = (timeOption: TimeOption) => { return onChange(mapOptionToTimeRange(timeOption, timeZone)); @@ -200,6 +203,7 @@ const FullScreenForm = (props: FormProps) => { isFullscreen={true} isReversed={isReversed} onError={onError} + weekStart={weekStart} />
      {props.showHistory && ( diff --git a/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimePickerFooter.tsx b/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimePickerFooter.tsx index 34f24ae49dc..28b328ed5c3 100644 --- a/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimePickerFooter.tsx +++ b/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimePickerFooter.tsx @@ -1,6 +1,7 @@ import { css, cx } from '@emotion/css'; import { isString } from 'lodash'; -import React, { useCallback, useId, useState } from 'react'; +import { useCallback, useId, useState } from 'react'; +import * as React from 'react'; import { getTimeZoneInfo, GrafanaTheme2, TimeZone } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; diff --git a/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimePickerTitle.tsx b/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimePickerTitle.tsx index 1df35b9a364..e65201002bb 100644 --- a/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimePickerTitle.tsx +++ b/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimePickerTitle.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { memo, PropsWithChildren } from 'react'; +import { memo, PropsWithChildren } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimeRangeContent.test.tsx b/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimeRangeContent.test.tsx index 40a1964b224..d6a7aa1c35e 100644 --- a/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimeRangeContent.test.tsx +++ b/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimeRangeContent.test.tsx @@ -1,6 +1,5 @@ import { fireEvent, render, RenderResult } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { dateTimeParse, TimeRange } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; diff --git a/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimeRangeContent.tsx b/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimeRangeContent.tsx index d5a53aa10f3..87f5572c586 100644 --- a/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimeRangeContent.tsx +++ b/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimeRangeContent.tsx @@ -1,5 +1,6 @@ import { css } from '@emotion/css'; -import React, { FormEvent, useCallback, useEffect, useId, useState } from 'react'; +import { FormEvent, useCallback, useEffect, useId, useState } from 'react'; +import * as React from 'react'; import { DateTime, @@ -21,6 +22,7 @@ import { Field } from '../../Forms/Field'; import { Icon } from '../../Icon/Icon'; import { Input } from '../../Input/Input'; import { Tooltip } from '../../Tooltip/Tooltip'; +import { WeekStart } from '../WeekStartPicker'; import { isValid } from '../utils'; import TimePickerCalendar from './TimePickerCalendar'; @@ -34,6 +36,7 @@ interface Props { roundup?: boolean; isReversed?: boolean; onError?: (error?: string) => void; + weekStart?: WeekStart; } interface InputState { @@ -56,6 +59,7 @@ export const TimeRangeContent = (props: Props) => { isReversed, fiscalYearStartMonth, onError, + weekStart, } = props; const [fromValue, toValue] = valueToState(value.raw.from, value.raw.to, timeZone); const style = useStyles2(getStyles); @@ -223,6 +227,7 @@ export const TimeRangeContent = (props: Props) => { onChange={onChange} timeZone={timeZone} isReversed={isReversed} + weekStart={weekStart} /> ); diff --git a/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimeRangeLabel.tsx b/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimeRangeLabel.tsx index d3c7d5cc2f4..4cd7392aa37 100644 --- a/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimeRangeLabel.tsx +++ b/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimeRangeLabel.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { memo } from 'react'; +import { memo } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimeRangeList.tsx b/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimeRangeList.tsx index 76676a5bba6..cfc070c51c7 100644 --- a/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimeRangeList.tsx +++ b/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimeRangeList.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { ReactNode } from 'react'; +import { useRef, ReactNode } from 'react'; import { TimeOption } from '@grafana/data'; @@ -45,7 +45,7 @@ export const TimeRangeList = (props: Props) => { const Options = ({ options, value, onChange, title }: Props) => { const styles = useStyles2(getOptionsStyles); - const localRef = React.useRef(null); + const localRef = useRef(null); const [handleKeys] = useListFocus({ localRef, options }); return ( diff --git a/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimeRangeOption.tsx b/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimeRangeOption.tsx index 4df76628dcb..a85a11f948a 100644 --- a/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimeRangeOption.tsx +++ b/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimeRangeOption.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React, { memo } from 'react'; +import { memo } from 'react'; import { v4 as uuidv4 } from 'uuid'; import { GrafanaTheme2, TimeOption } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/hooks.test.tsx b/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/hooks.test.tsx index 9da5a28e468..38fe7529625 100644 --- a/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/hooks.test.tsx +++ b/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/hooks.test.tsx @@ -1,5 +1,5 @@ import { act, fireEvent, render, renderHook, screen } from '@testing-library/react'; -import React, { createRef, KeyboardEvent, RefObject } from 'react'; +import { createRef, KeyboardEvent, RefObject } from 'react'; import { useListFocus } from './hooks'; diff --git a/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker.story.tsx b/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker.story.tsx index 28e2458d888..a609ee8daa8 100644 --- a/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker.story.tsx +++ b/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker.story.tsx @@ -1,7 +1,6 @@ import { action } from '@storybook/addon-actions'; import { useArgs } from '@storybook/preview-api'; import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { TimeZonePicker } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker.tsx b/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker.tsx index 03cd1495315..7e0f1495e0b 100644 --- a/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker.tsx +++ b/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker.tsx @@ -1,5 +1,5 @@ import { toLower, isEmpty, isString } from 'lodash'; -import React, { useMemo, useCallback } from 'react'; +import { useMemo, useCallback } from 'react'; import { SelectableValue, diff --git a/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneDescription.tsx b/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneDescription.tsx index beee071996b..12594c31b65 100644 --- a/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneDescription.tsx +++ b/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneDescription.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { useMemo } from 'react'; +import { useMemo } from 'react'; import { GrafanaTheme2, TimeZoneInfo } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneGroup.tsx b/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneGroup.tsx index 407dc82d65d..c5e2c0bba14 100644 --- a/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneGroup.tsx +++ b/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneGroup.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneOffset.tsx b/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneOffset.tsx index e9e269d2c15..03c1d50b816 100644 --- a/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneOffset.tsx +++ b/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneOffset.tsx @@ -1,6 +1,5 @@ import { css, cx } from '@emotion/css'; import { isString } from 'lodash'; -import React from 'react'; import { GrafanaTheme2, TimeZone, dateTimeFormat } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneOption.tsx b/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneOption.tsx index 090f04b01de..3ce0a3cd17a 100644 --- a/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneOption.tsx +++ b/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneOption.tsx @@ -1,6 +1,7 @@ import { css, cx } from '@emotion/css'; import { isString } from 'lodash'; -import React, { PropsWithChildren, RefCallback } from 'react'; +import { PropsWithChildren, RefCallback } from 'react'; +import * as React from 'react'; import { GrafanaTheme2, SelectableValue, getTimeZoneInfo } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; diff --git a/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneTitle.tsx b/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneTitle.tsx index 6d1239bdd4d..25d25e28f75 100644 --- a/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneTitle.tsx +++ b/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneTitle.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { ReactNode } from 'react'; +import { ReactNode } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/DateTimePickers/WeekStartPicker.story.tsx b/packages/grafana-ui/src/components/DateTimePickers/WeekStartPicker.story.tsx index b5c902d92a2..9054e9b53fd 100644 --- a/packages/grafana-ui/src/components/DateTimePickers/WeekStartPicker.story.tsx +++ b/packages/grafana-ui/src/components/DateTimePickers/WeekStartPicker.story.tsx @@ -1,7 +1,6 @@ import { action } from '@storybook/addon-actions'; import { useArgs } from '@storybook/preview-api'; import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { WeekStartPicker } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/DateTimePickers/WeekStartPicker.tsx b/packages/grafana-ui/src/components/DateTimePickers/WeekStartPicker.tsx index 59dd368280a..e5f3b6397a3 100644 --- a/packages/grafana-ui/src/components/DateTimePickers/WeekStartPicker.tsx +++ b/packages/grafana-ui/src/components/DateTimePickers/WeekStartPicker.tsx @@ -1,4 +1,4 @@ -import React, { useCallback } from 'react'; +import { useCallback } from 'react'; import { SelectableValue } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; @@ -15,7 +15,8 @@ export interface Props { inputId?: string; } -const weekStarts: Array> = [ +export type WeekStart = 'saturday' | 'sunday' | 'monday'; +const weekStarts: Array> = [ { value: '', label: 'Default' }, { value: 'saturday', label: 'Saturday' }, { value: 'sunday', label: 'Sunday' }, diff --git a/packages/grafana-ui/src/components/Divider/Divider.story.tsx b/packages/grafana-ui/src/components/Divider/Divider.story.tsx index e48091dabca..f7757d80d4f 100644 --- a/packages/grafana-ui/src/components/Divider/Divider.story.tsx +++ b/packages/grafana-ui/src/components/Divider/Divider.story.tsx @@ -1,5 +1,4 @@ import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { Divider } from './Divider'; import mdx from './Divider.mdx'; diff --git a/packages/grafana-ui/src/components/Divider/Divider.tsx b/packages/grafana-ui/src/components/Divider/Divider.tsx index ad0da71d3de..0ffd0c032cf 100644 --- a/packages/grafana-ui/src/components/Divider/Divider.tsx +++ b/packages/grafana-ui/src/components/Divider/Divider.tsx @@ -1,5 +1,4 @@ import { css } from '@emotion/css'; -import React from 'react'; import { GrafanaTheme2, ThemeSpacingTokens } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Drawer/Drawer.story.tsx b/packages/grafana-ui/src/components/Drawer/Drawer.story.tsx index 06e4c96f94d..9c99056f00b 100644 --- a/packages/grafana-ui/src/components/Drawer/Drawer.story.tsx +++ b/packages/grafana-ui/src/components/Drawer/Drawer.story.tsx @@ -1,5 +1,5 @@ import { Meta, StoryFn } from '@storybook/react'; -import React, { useState } from 'react'; +import { useState } from 'react'; import { Button, Drawer, Tab, TabsBar } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/Drawer/Drawer.tsx b/packages/grafana-ui/src/components/Drawer/Drawer.tsx index 3d600cd1f19..f3b17f2511f 100644 --- a/packages/grafana-ui/src/components/Drawer/Drawer.tsx +++ b/packages/grafana-ui/src/components/Drawer/Drawer.tsx @@ -3,7 +3,8 @@ import { useDialog } from '@react-aria/dialog'; import { FocusScope } from '@react-aria/focus'; import { useOverlay } from '@react-aria/overlays'; import RcDrawer from 'rc-drawer'; -import React, { ReactNode, useCallback, useEffect, useState } from 'react'; +import { ReactNode, useCallback, useEffect, useState } from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; diff --git a/packages/grafana-ui/src/components/Dropdown/ButtonSelect.internal.story.tsx b/packages/grafana-ui/src/components/Dropdown/ButtonSelect.internal.story.tsx index f21e6bfccb2..edc03ecf4a4 100644 --- a/packages/grafana-ui/src/components/Dropdown/ButtonSelect.internal.story.tsx +++ b/packages/grafana-ui/src/components/Dropdown/ButtonSelect.internal.story.tsx @@ -1,7 +1,6 @@ import { action } from '@storybook/addon-actions'; import { useArgs } from '@storybook/preview-api'; import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { ButtonSelect } from './ButtonSelect'; diff --git a/packages/grafana-ui/src/components/Dropdown/ButtonSelect.test.tsx b/packages/grafana-ui/src/components/Dropdown/ButtonSelect.test.tsx index f1c5c63a055..3cdc4ad1544 100644 --- a/packages/grafana-ui/src/components/Dropdown/ButtonSelect.test.tsx +++ b/packages/grafana-ui/src/components/Dropdown/ButtonSelect.test.tsx @@ -1,6 +1,5 @@ import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { SelectableValue } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Dropdown/ButtonSelect.tsx b/packages/grafana-ui/src/components/Dropdown/ButtonSelect.tsx index 2fb0bb2f98b..719a32bcb38 100644 --- a/packages/grafana-ui/src/components/Dropdown/ButtonSelect.tsx +++ b/packages/grafana-ui/src/components/Dropdown/ButtonSelect.tsx @@ -10,7 +10,7 @@ import { useInteractions, } from '@floating-ui/react'; import { FocusScope } from '@react-aria/focus'; -import React, { HTMLAttributes, useState } from 'react'; +import { memo, HTMLAttributes, useState } from 'react'; import { GrafanaTheme2, SelectableValue } from '@grafana/data'; @@ -118,7 +118,7 @@ ButtonSelectComponent.displayName = 'ButtonSelect'; // needed to properly forward the generic type through React.memo // see https://github.com/DefinitelyTyped/DefinitelyTyped/issues/37087#issuecomment-656596623 // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -export const ButtonSelect = React.memo(ButtonSelectComponent) as typeof ButtonSelectComponent; +export const ButtonSelect = memo(ButtonSelectComponent) as typeof ButtonSelectComponent; const getStyles = (theme: GrafanaTheme2) => { return { diff --git a/packages/grafana-ui/src/components/Dropdown/Dropdown.story.tsx b/packages/grafana-ui/src/components/Dropdown/Dropdown.story.tsx index fbcef7c6c8d..40253bb2157 100644 --- a/packages/grafana-ui/src/components/Dropdown/Dropdown.story.tsx +++ b/packages/grafana-ui/src/components/Dropdown/Dropdown.story.tsx @@ -1,5 +1,4 @@ import { Meta } from '@storybook/react'; -import React from 'react'; import { StoryExample } from '../../utils/storybook/StoryExample'; import { Button } from '../Button'; diff --git a/packages/grafana-ui/src/components/Dropdown/Dropdown.test.tsx b/packages/grafana-ui/src/components/Dropdown/Dropdown.test.tsx index 94ef9b20e72..a4a0151eafc 100644 --- a/packages/grafana-ui/src/components/Dropdown/Dropdown.test.tsx +++ b/packages/grafana-ui/src/components/Dropdown/Dropdown.test.tsx @@ -1,6 +1,5 @@ import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { Button } from '../Button'; import { Menu } from '../Menu/Menu'; diff --git a/packages/grafana-ui/src/components/Dropdown/Dropdown.tsx b/packages/grafana-ui/src/components/Dropdown/Dropdown.tsx index 568933aeb21..1cd35603df6 100644 --- a/packages/grafana-ui/src/components/Dropdown/Dropdown.tsx +++ b/packages/grafana-ui/src/components/Dropdown/Dropdown.tsx @@ -10,7 +10,8 @@ import { useFloating, useInteractions, } from '@floating-ui/react'; -import React, { useCallback, useRef, useState } from 'react'; +import { useCallback, useRef, useState } from 'react'; +import * as React from 'react'; import { CSSTransition } from 'react-transition-group'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/EmptySearchResult/EmptySearchResult.story.tsx b/packages/grafana-ui/src/components/EmptySearchResult/EmptySearchResult.story.tsx index 108592394b5..c44444597e0 100644 --- a/packages/grafana-ui/src/components/EmptySearchResult/EmptySearchResult.story.tsx +++ b/packages/grafana-ui/src/components/EmptySearchResult/EmptySearchResult.story.tsx @@ -1,5 +1,4 @@ import { Meta } from '@storybook/react'; -import React from 'react'; import { EmptySearchResult } from './EmptySearchResult'; import mdx from './EmptySearchResult.mdx'; diff --git a/packages/grafana-ui/src/components/EmptySearchResult/EmptySearchResult.tsx b/packages/grafana-ui/src/components/EmptySearchResult/EmptySearchResult.tsx index 7f8fb1f67ea..e46007e0017 100644 --- a/packages/grafana-ui/src/components/EmptySearchResult/EmptySearchResult.tsx +++ b/packages/grafana-ui/src/components/EmptySearchResult/EmptySearchResult.tsx @@ -1,5 +1,4 @@ import { css } from '@emotion/css'; -import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/EmptyState/EmptyState.story.tsx b/packages/grafana-ui/src/components/EmptyState/EmptyState.story.tsx index 9e81d2e234e..d7d3b790c1b 100644 --- a/packages/grafana-ui/src/components/EmptyState/EmptyState.story.tsx +++ b/packages/grafana-ui/src/components/EmptyState/EmptyState.story.tsx @@ -1,5 +1,4 @@ import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { Button } from '../Button'; diff --git a/packages/grafana-ui/src/components/EmptyState/EmptyState.tsx b/packages/grafana-ui/src/components/EmptyState/EmptyState.tsx index 338f6771a06..6e92a5d5ce7 100644 --- a/packages/grafana-ui/src/components/EmptyState/EmptyState.tsx +++ b/packages/grafana-ui/src/components/EmptyState/EmptyState.tsx @@ -1,5 +1,6 @@ import { css } from '@emotion/css'; -import React, { AriaRole, ReactNode } from 'react'; +import { AriaRole, ReactNode } from 'react'; +import * as React from 'react'; import SVG from 'react-inlinesvg'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/EmptyState/GrotCTA/GrotCTA.tsx b/packages/grafana-ui/src/components/EmptyState/GrotCTA/GrotCTA.tsx index ce7d363fb6f..9350e1dfc18 100644 --- a/packages/grafana-ui/src/components/EmptyState/GrotCTA/GrotCTA.tsx +++ b/packages/grafana-ui/src/components/EmptyState/GrotCTA/GrotCTA.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { SVGProps } from 'react'; +import { SVGProps } from 'react'; import SVG from 'react-inlinesvg'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/EmptyState/GrotNotFound/GrotNotFound.tsx b/packages/grafana-ui/src/components/EmptyState/GrotNotFound/GrotNotFound.tsx index 4a288f886d1..8df37510eaa 100644 --- a/packages/grafana-ui/src/components/EmptyState/GrotNotFound/GrotNotFound.tsx +++ b/packages/grafana-ui/src/components/EmptyState/GrotNotFound/GrotNotFound.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { SVGProps, useEffect, useRef } from 'react'; +import { SVGProps, useEffect, useRef } from 'react'; import SVG from 'react-inlinesvg'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/ErrorBoundary/ErrorBoundary.story.tsx b/packages/grafana-ui/src/components/ErrorBoundary/ErrorBoundary.story.tsx index 8b20cffae36..c659719a893 100644 --- a/packages/grafana-ui/src/components/ErrorBoundary/ErrorBoundary.story.tsx +++ b/packages/grafana-ui/src/components/ErrorBoundary/ErrorBoundary.story.tsx @@ -1,5 +1,5 @@ import { Meta } from '@storybook/react'; -import React, { useState } from 'react'; +import { useState } from 'react'; import { Alert } from '../Alert/Alert'; import { Button } from '../Button'; diff --git a/packages/grafana-ui/src/components/ErrorBoundary/ErrorBoundary.test.tsx b/packages/grafana-ui/src/components/ErrorBoundary/ErrorBoundary.test.tsx index d2af63af611..d14867aef54 100644 --- a/packages/grafana-ui/src/components/ErrorBoundary/ErrorBoundary.test.tsx +++ b/packages/grafana-ui/src/components/ErrorBoundary/ErrorBoundary.test.tsx @@ -1,5 +1,5 @@ import { render, screen } from '@testing-library/react'; -import React, { FC } from 'react'; +import { FC } from 'react'; import { faro } from '@grafana/faro-web-sdk'; diff --git a/packages/grafana-ui/src/components/ErrorBoundary/ErrorBoundary.tsx b/packages/grafana-ui/src/components/ErrorBoundary/ErrorBoundary.tsx index 4c5760a377e..312d6e76029 100644 --- a/packages/grafana-ui/src/components/ErrorBoundary/ErrorBoundary.tsx +++ b/packages/grafana-ui/src/components/ErrorBoundary/ErrorBoundary.tsx @@ -1,4 +1,4 @@ -import React, { PureComponent, ReactNode, ComponentType, ErrorInfo } from 'react'; +import { PureComponent, ReactNode, ComponentType, ErrorInfo } from 'react'; import { faro } from '@grafana/faro-web-sdk'; diff --git a/packages/grafana-ui/src/components/ErrorBoundary/ErrorWithStack.tsx b/packages/grafana-ui/src/components/ErrorBoundary/ErrorWithStack.tsx index f5d2395e834..40594795c97 100644 --- a/packages/grafana-ui/src/components/ErrorBoundary/ErrorWithStack.tsx +++ b/packages/grafana-ui/src/components/ErrorBoundary/ErrorWithStack.tsx @@ -1,5 +1,4 @@ import { css } from '@emotion/css'; -import React from 'react'; import { useStyles2 } from '../../themes'; diff --git a/packages/grafana-ui/src/components/FeatureBadge/FeatureBadge.story.tsx b/packages/grafana-ui/src/components/FeatureBadge/FeatureBadge.story.tsx index 273ea948dd8..bac8577fbf4 100644 --- a/packages/grafana-ui/src/components/FeatureBadge/FeatureBadge.story.tsx +++ b/packages/grafana-ui/src/components/FeatureBadge/FeatureBadge.story.tsx @@ -1,5 +1,4 @@ import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { FeatureState } from '@grafana/data'; import { FeatureBadge } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/FeatureBadge/FeatureBadge.tsx b/packages/grafana-ui/src/components/FeatureBadge/FeatureBadge.tsx index f4e99ee5c94..87f79ff05bc 100644 --- a/packages/grafana-ui/src/components/FeatureBadge/FeatureBadge.tsx +++ b/packages/grafana-ui/src/components/FeatureBadge/FeatureBadge.tsx @@ -1,5 +1,3 @@ -import React from 'react'; - import { FeatureState } from '@grafana/data'; import { Badge, BadgeProps } from '../Badge/Badge'; diff --git a/packages/grafana-ui/src/components/FileDropzone/FileDropzone.story.tsx b/packages/grafana-ui/src/components/FileDropzone/FileDropzone.story.tsx index 644155da2a8..c3cb4d216cb 100644 --- a/packages/grafana-ui/src/components/FileDropzone/FileDropzone.story.tsx +++ b/packages/grafana-ui/src/components/FileDropzone/FileDropzone.story.tsx @@ -1,5 +1,4 @@ import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { FileDropzone } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/FileDropzone/FileDropzone.test.tsx b/packages/grafana-ui/src/components/FileDropzone/FileDropzone.test.tsx index c115abbf6c6..23d965f6f10 100644 --- a/packages/grafana-ui/src/components/FileDropzone/FileDropzone.test.tsx +++ b/packages/grafana-ui/src/components/FileDropzone/FileDropzone.test.tsx @@ -1,5 +1,4 @@ import { fireEvent, render, screen } from '@testing-library/react'; -import React from 'react'; import { FileDropzone } from './FileDropzone'; import { REMOVE_FILE } from './FileListItem'; diff --git a/packages/grafana-ui/src/components/FileDropzone/FileDropzone.tsx b/packages/grafana-ui/src/components/FileDropzone/FileDropzone.tsx index ce4746c24ba..fe9ae54045a 100644 --- a/packages/grafana-ui/src/components/FileDropzone/FileDropzone.tsx +++ b/packages/grafana-ui/src/components/FileDropzone/FileDropzone.tsx @@ -1,6 +1,6 @@ import { css, cx } from '@emotion/css'; import { isString, uniqueId } from 'lodash'; -import React, { ReactNode, useCallback, useState } from 'react'; +import { ReactNode, useCallback, useState } from 'react'; import { Accept, DropEvent, DropzoneOptions, FileError, FileRejection, useDropzone, ErrorCode } from 'react-dropzone'; import { formattedValueToString, getValueFormat, GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/FileDropzone/FileListItem.story.tsx b/packages/grafana-ui/src/components/FileDropzone/FileListItem.story.tsx index 88640fca2ce..3e10caf11f4 100644 --- a/packages/grafana-ui/src/components/FileDropzone/FileListItem.story.tsx +++ b/packages/grafana-ui/src/components/FileDropzone/FileListItem.story.tsx @@ -1,5 +1,4 @@ import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { FileListItem as FileListItemComponent, FileListItemProps } from './FileListItem'; import mdx from './FileListItem.mdx'; diff --git a/packages/grafana-ui/src/components/FileDropzone/FileListItem.test.tsx b/packages/grafana-ui/src/components/FileDropzone/FileListItem.test.tsx index 021a4c1ac48..587756b25b9 100644 --- a/packages/grafana-ui/src/components/FileDropzone/FileListItem.test.tsx +++ b/packages/grafana-ui/src/components/FileDropzone/FileListItem.test.tsx @@ -1,5 +1,4 @@ import { fireEvent, render, screen } from '@testing-library/react'; -import React from 'react'; import { FileListItem, REMOVE_FILE } from './FileListItem'; diff --git a/packages/grafana-ui/src/components/FileDropzone/FileListItem.tsx b/packages/grafana-ui/src/components/FileDropzone/FileListItem.tsx index 36477c6fbfa..977debdfb46 100644 --- a/packages/grafana-ui/src/components/FileDropzone/FileListItem.tsx +++ b/packages/grafana-ui/src/components/FileDropzone/FileListItem.tsx @@ -1,5 +1,4 @@ import { css } from '@emotion/css'; -import React from 'react'; import { formattedValueToString, getValueFormat, GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/FileUpload/FileUpload.story.tsx b/packages/grafana-ui/src/components/FileUpload/FileUpload.story.tsx index 40a8ad73b07..ac49c175392 100644 --- a/packages/grafana-ui/src/components/FileUpload/FileUpload.story.tsx +++ b/packages/grafana-ui/src/components/FileUpload/FileUpload.story.tsx @@ -1,5 +1,4 @@ import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { FileUpload } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/FileUpload/FileUpload.test.tsx b/packages/grafana-ui/src/components/FileUpload/FileUpload.test.tsx index 833734fad02..8b76e4ab435 100644 --- a/packages/grafana-ui/src/components/FileUpload/FileUpload.test.tsx +++ b/packages/grafana-ui/src/components/FileUpload/FileUpload.test.tsx @@ -1,6 +1,5 @@ import { render, waitFor, fireEvent, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { selectors } from '@grafana/e2e-selectors'; diff --git a/packages/grafana-ui/src/components/FileUpload/FileUpload.tsx b/packages/grafana-ui/src/components/FileUpload/FileUpload.tsx index c4d7baf95a5..23db2b8c134 100644 --- a/packages/grafana-ui/src/components/FileUpload/FileUpload.tsx +++ b/packages/grafana-ui/src/components/FileUpload/FileUpload.tsx @@ -1,5 +1,6 @@ import { css, cx } from '@emotion/css'; -import React, { FormEvent, useCallback, useState } from 'react'; +import { FormEvent, useCallback, useState } from 'react'; +import * as React from 'react'; import { v4 as uuidv4 } from 'uuid'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/FilterInput/FilterInput.tsx b/packages/grafana-ui/src/components/FilterInput/FilterInput.tsx index 403df7146c6..d026b88b466 100644 --- a/packages/grafana-ui/src/components/FilterInput/FilterInput.tsx +++ b/packages/grafana-ui/src/components/FilterInput/FilterInput.tsx @@ -1,4 +1,4 @@ -import React, { HTMLProps } from 'react'; +import { forwardRef, useRef, HTMLProps } from 'react'; import { escapeStringForRegex, unEscapeStringFromRegex } from '@grafana/data'; @@ -14,9 +14,9 @@ export interface Props extends Omit, 'onChange'> { escapeRegex?: boolean; } -export const FilterInput = React.forwardRef( +export const FilterInput = forwardRef( ({ value, width, onChange, escapeRegex = true, ...restProps }, ref) => { - const innerRef = React.useRef(null); + const innerRef = useRef(null); const combinedRef = useCombinedRefs(ref, innerRef); const suffix = diff --git a/packages/grafana-ui/src/components/FilterPill/FilterPill.story.tsx b/packages/grafana-ui/src/components/FilterPill/FilterPill.story.tsx index 40590ae4011..bbc85b2c90c 100644 --- a/packages/grafana-ui/src/components/FilterPill/FilterPill.story.tsx +++ b/packages/grafana-ui/src/components/FilterPill/FilterPill.story.tsx @@ -1,5 +1,5 @@ import { Meta, StoryFn } from '@storybook/react'; -import React, { useState } from 'react'; +import { useState } from 'react'; import { getAvailableIcons } from '../../types'; import { Stack } from '../Layout/Stack/Stack'; diff --git a/packages/grafana-ui/src/components/FilterPill/FilterPill.tsx b/packages/grafana-ui/src/components/FilterPill/FilterPill.tsx index 1612747b533..653a9688939 100644 --- a/packages/grafana-ui/src/components/FilterPill/FilterPill.tsx +++ b/packages/grafana-ui/src/components/FilterPill/FilterPill.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/FormField/FormField.internal.story.tsx b/packages/grafana-ui/src/components/FormField/FormField.internal.story.tsx index df7bd6c1bfb..efddb8d7f3c 100644 --- a/packages/grafana-ui/src/components/FormField/FormField.internal.story.tsx +++ b/packages/grafana-ui/src/components/FormField/FormField.internal.story.tsx @@ -1,5 +1,4 @@ import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { FormField } from './FormField'; diff --git a/packages/grafana-ui/src/components/FormField/FormField.test.tsx b/packages/grafana-ui/src/components/FormField/FormField.test.tsx index c64baf0c568..598dcd8a8be 100644 --- a/packages/grafana-ui/src/components/FormField/FormField.test.tsx +++ b/packages/grafana-ui/src/components/FormField/FormField.test.tsx @@ -1,6 +1,5 @@ import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { FormField, Props } from './FormField'; diff --git a/packages/grafana-ui/src/components/FormField/FormField.tsx b/packages/grafana-ui/src/components/FormField/FormField.tsx index a872ff27461..4de155dcfb2 100644 --- a/packages/grafana-ui/src/components/FormField/FormField.tsx +++ b/packages/grafana-ui/src/components/FormField/FormField.tsx @@ -1,5 +1,6 @@ import { css, cx } from '@emotion/css'; -import React, { InputHTMLAttributes } from 'react'; +import { InputHTMLAttributes } from 'react'; +import * as React from 'react'; import { InlineFormLabel } from '../FormLabel/FormLabel'; import { Field } from '../Forms/Field'; diff --git a/packages/grafana-ui/src/components/FormLabel/FormLabel.tsx b/packages/grafana-ui/src/components/FormLabel/FormLabel.tsx index bd5e24fdc6c..654521ba606 100644 --- a/packages/grafana-ui/src/components/FormLabel/FormLabel.tsx +++ b/packages/grafana-ui/src/components/FormLabel/FormLabel.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import React, { ReactNode } from 'react'; +import { ReactNode } from 'react'; import { Icon } from '../Icon/Icon'; import { Tooltip, PopoverContent } from '../Tooltip'; diff --git a/packages/grafana-ui/src/components/FormattedValueDisplay/FormattedValueDisplay.story.tsx b/packages/grafana-ui/src/components/FormattedValueDisplay/FormattedValueDisplay.story.tsx index 60f322cc4da..3358a90f179 100644 --- a/packages/grafana-ui/src/components/FormattedValueDisplay/FormattedValueDisplay.story.tsx +++ b/packages/grafana-ui/src/components/FormattedValueDisplay/FormattedValueDisplay.story.tsx @@ -1,5 +1,4 @@ import { Meta } from '@storybook/react'; -import React from 'react'; import { FormattedValueDisplay } from './FormattedValueDisplay'; import mdx from './FormattedValueDisplay.mdx'; diff --git a/packages/grafana-ui/src/components/FormattedValueDisplay/FormattedValueDisplay.tsx b/packages/grafana-ui/src/components/FormattedValueDisplay/FormattedValueDisplay.tsx index effd3060c02..603dbe0b499 100644 --- a/packages/grafana-ui/src/components/FormattedValueDisplay/FormattedValueDisplay.tsx +++ b/packages/grafana-ui/src/components/FormattedValueDisplay/FormattedValueDisplay.tsx @@ -1,4 +1,4 @@ -import React, { CSSProperties, HTMLProps } from 'react'; +import { CSSProperties, HTMLProps } from 'react'; import { FormattedValue } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Forms/Checkbox.story.tsx b/packages/grafana-ui/src/components/Forms/Checkbox.story.tsx index 6ce2c1907bf..8cdf3daa56d 100644 --- a/packages/grafana-ui/src/components/Forms/Checkbox.story.tsx +++ b/packages/grafana-ui/src/components/Forms/Checkbox.story.tsx @@ -1,5 +1,6 @@ import { Meta, StoryFn } from '@storybook/react'; -import React, { useState, useCallback } from 'react'; +import { useState, useCallback } from 'react'; +import * as React from 'react'; import { Stack } from '../Layout/Stack/Stack'; diff --git a/packages/grafana-ui/src/components/Forms/Checkbox.tsx b/packages/grafana-ui/src/components/Forms/Checkbox.tsx index 74716ec57d5..f5250844fff 100644 --- a/packages/grafana-ui/src/components/Forms/Checkbox.tsx +++ b/packages/grafana-ui/src/components/Forms/Checkbox.tsx @@ -1,5 +1,6 @@ import { css, cx } from '@emotion/css'; -import React, { HTMLProps, useCallback } from 'react'; +import { HTMLProps, useCallback } from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Forms/Field.story.tsx b/packages/grafana-ui/src/components/Forms/Field.story.tsx index 974035e0f18..3d38e8af6e4 100644 --- a/packages/grafana-ui/src/components/Forms/Field.story.tsx +++ b/packages/grafana-ui/src/components/Forms/Field.story.tsx @@ -1,5 +1,6 @@ import { Meta, StoryFn } from '@storybook/react'; -import React, { useState, useCallback } from 'react'; +import { useState, useCallback } from 'react'; +import * as React from 'react'; import { Input, Switch } from '..'; diff --git a/packages/grafana-ui/src/components/Forms/Field.test.tsx b/packages/grafana-ui/src/components/Forms/Field.test.tsx index 861b23fe78c..768bc3095cf 100644 --- a/packages/grafana-ui/src/components/Forms/Field.test.tsx +++ b/packages/grafana-ui/src/components/Forms/Field.test.tsx @@ -1,5 +1,4 @@ import { render, screen } from '@testing-library/react'; -import React from 'react'; import { Input } from '../Input/Input'; import { Select } from '../Select/Select'; diff --git a/packages/grafana-ui/src/components/Forms/Field.tsx b/packages/grafana-ui/src/components/Forms/Field.tsx index 9b6e6ef5a7c..10db5c83bfc 100644 --- a/packages/grafana-ui/src/components/Forms/Field.tsx +++ b/packages/grafana-ui/src/components/Forms/Field.tsx @@ -1,5 +1,6 @@ import { css, cx } from '@emotion/css'; -import React, { HTMLAttributes } from 'react'; +import { HTMLAttributes } from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Forms/FieldArray.story.tsx b/packages/grafana-ui/src/components/Forms/FieldArray.story.tsx index e1bf660d902..3bec83bf20e 100644 --- a/packages/grafana-ui/src/components/Forms/FieldArray.story.tsx +++ b/packages/grafana-ui/src/components/Forms/FieldArray.story.tsx @@ -1,5 +1,4 @@ import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { FieldValues } from 'react-hook-form'; import { Form, Input, Button, HorizontalGroup } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/Forms/FieldSet.story.tsx b/packages/grafana-ui/src/components/Forms/FieldSet.story.tsx index 716b4206d3c..8d2e5de1344 100644 --- a/packages/grafana-ui/src/components/Forms/FieldSet.story.tsx +++ b/packages/grafana-ui/src/components/Forms/FieldSet.story.tsx @@ -1,5 +1,4 @@ import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { Input, Form, FieldSet, Field } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/Forms/FieldSet.tsx b/packages/grafana-ui/src/components/Forms/FieldSet.tsx index 3d3c0986092..1823d5d456e 100644 --- a/packages/grafana-ui/src/components/Forms/FieldSet.tsx +++ b/packages/grafana-ui/src/components/Forms/FieldSet.tsx @@ -1,5 +1,6 @@ import { css, cx } from '@emotion/css'; -import React, { HTMLProps } from 'react'; +import { HTMLProps } from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Forms/FieldValidationMessage.story.tsx b/packages/grafana-ui/src/components/Forms/FieldValidationMessage.story.tsx index 5d5d5e23004..56010bedf03 100644 --- a/packages/grafana-ui/src/components/Forms/FieldValidationMessage.story.tsx +++ b/packages/grafana-ui/src/components/Forms/FieldValidationMessage.story.tsx @@ -1,5 +1,4 @@ import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { FieldValidationMessage } from './FieldValidationMessage'; import mdx from './FieldValidationMessage.mdx'; diff --git a/packages/grafana-ui/src/components/Forms/FieldValidationMessage.tsx b/packages/grafana-ui/src/components/Forms/FieldValidationMessage.tsx index 8d8dc832b66..14f9c235c89 100644 --- a/packages/grafana-ui/src/components/Forms/FieldValidationMessage.tsx +++ b/packages/grafana-ui/src/components/Forms/FieldValidationMessage.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Forms/Form.story.tsx b/packages/grafana-ui/src/components/Forms/Form.story.tsx index 3d2972a9d6a..b7322cbbc77 100644 --- a/packages/grafana-ui/src/components/Forms/Form.story.tsx +++ b/packages/grafana-ui/src/components/Forms/Form.story.tsx @@ -1,5 +1,4 @@ import { StoryFn } from '@storybook/react'; -import React from 'react'; import { ValidateResult } from 'react-hook-form'; import { diff --git a/packages/grafana-ui/src/components/Forms/Form.tsx b/packages/grafana-ui/src/components/Forms/Form.tsx index 065dab5c794..a56393f95c7 100644 --- a/packages/grafana-ui/src/components/Forms/Form.tsx +++ b/packages/grafana-ui/src/components/Forms/Form.tsx @@ -1,5 +1,6 @@ import { css } from '@emotion/css'; -import React, { HTMLProps, useEffect } from 'react'; +import { HTMLProps, useEffect } from 'react'; +import * as React from 'react'; import { useForm, Mode, DefaultValues, SubmitHandler, FieldValues } from 'react-hook-form'; import { FormAPI } from '../../types'; diff --git a/packages/grafana-ui/src/components/Forms/InlineField.story.tsx b/packages/grafana-ui/src/components/Forms/InlineField.story.tsx index bc86285a18e..384e5aa98de 100644 --- a/packages/grafana-ui/src/components/Forms/InlineField.story.tsx +++ b/packages/grafana-ui/src/components/Forms/InlineField.story.tsx @@ -1,6 +1,5 @@ import { action } from '@storybook/addon-actions'; import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { Input } from '../Input/Input'; import { Select } from '../Select/Select'; diff --git a/packages/grafana-ui/src/components/Forms/InlineField.test.tsx b/packages/grafana-ui/src/components/Forms/InlineField.test.tsx index 8b86dd9fec5..657c11875c6 100644 --- a/packages/grafana-ui/src/components/Forms/InlineField.test.tsx +++ b/packages/grafana-ui/src/components/Forms/InlineField.test.tsx @@ -1,5 +1,4 @@ import { render, screen } from '@testing-library/react'; -import React from 'react'; import { Input } from '../Input/Input'; import { Select } from '../Select/Select'; diff --git a/packages/grafana-ui/src/components/Forms/InlineField.tsx b/packages/grafana-ui/src/components/Forms/InlineField.tsx index 37f2551c9b7..8750e300122 100644 --- a/packages/grafana-ui/src/components/Forms/InlineField.tsx +++ b/packages/grafana-ui/src/components/Forms/InlineField.tsx @@ -1,5 +1,5 @@ import { cx, css } from '@emotion/css'; -import React from 'react'; +import { cloneElement } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; @@ -70,7 +70,7 @@ export const InlineField = ({
      {labelElement}
      - {React.cloneElement(children, { invalid, disabled, loading })} + {cloneElement(children, { invalid, disabled, loading })} {invalid && error && (
      {error} diff --git a/packages/grafana-ui/src/components/Forms/InlineFieldRow.story.tsx b/packages/grafana-ui/src/components/Forms/InlineFieldRow.story.tsx index 2173c5dace6..b9a74b6f345 100644 --- a/packages/grafana-ui/src/components/Forms/InlineFieldRow.story.tsx +++ b/packages/grafana-ui/src/components/Forms/InlineFieldRow.story.tsx @@ -1,5 +1,4 @@ import { Meta } from '@storybook/react'; -import React from 'react'; import { Input } from '../Input/Input'; diff --git a/packages/grafana-ui/src/components/Forms/InlineFieldRow.tsx b/packages/grafana-ui/src/components/Forms/InlineFieldRow.tsx index d7eb138b640..f77222a04d3 100644 --- a/packages/grafana-ui/src/components/Forms/InlineFieldRow.tsx +++ b/packages/grafana-ui/src/components/Forms/InlineFieldRow.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React, { HTMLProps, ReactNode } from 'react'; +import { HTMLProps, ReactNode } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Forms/InlineLabel.story.tsx b/packages/grafana-ui/src/components/Forms/InlineLabel.story.tsx index a68c3049914..1aac70c7134 100644 --- a/packages/grafana-ui/src/components/Forms/InlineLabel.story.tsx +++ b/packages/grafana-ui/src/components/Forms/InlineLabel.story.tsx @@ -1,5 +1,4 @@ import { Meta } from '@storybook/react'; -import React from 'react'; import { InlineLabel, Props } from './InlineLabel'; import mdx from './InlineLabel.mdx'; diff --git a/packages/grafana-ui/src/components/Forms/InlineLabel.tsx b/packages/grafana-ui/src/components/Forms/InlineLabel.tsx index b433dc5a46d..d930f89247b 100644 --- a/packages/grafana-ui/src/components/Forms/InlineLabel.tsx +++ b/packages/grafana-ui/src/components/Forms/InlineLabel.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Forms/InlineSegmentGroup.tsx b/packages/grafana-ui/src/components/Forms/InlineSegmentGroup.tsx index 8d94fd87856..2dee14a5c9c 100644 --- a/packages/grafana-ui/src/components/Forms/InlineSegmentGroup.tsx +++ b/packages/grafana-ui/src/components/Forms/InlineSegmentGroup.tsx @@ -1,5 +1,5 @@ import { cx, css } from '@emotion/css'; -import React from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Forms/Label.story.tsx b/packages/grafana-ui/src/components/Forms/Label.story.tsx index d2039480e71..7923bd27af6 100644 --- a/packages/grafana-ui/src/components/Forms/Label.story.tsx +++ b/packages/grafana-ui/src/components/Forms/Label.story.tsx @@ -1,5 +1,4 @@ import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { Label } from './Label'; import mdx from './Label.mdx'; diff --git a/packages/grafana-ui/src/components/Forms/Label.tsx b/packages/grafana-ui/src/components/Forms/Label.tsx index 6abadee2fd9..ddc9df7902a 100644 --- a/packages/grafana-ui/src/components/Forms/Label.tsx +++ b/packages/grafana-ui/src/components/Forms/Label.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Forms/Legacy/Input/Input.internal.story.tsx b/packages/grafana-ui/src/components/Forms/Legacy/Input/Input.internal.story.tsx index 4d389079c38..a9975be2e6f 100644 --- a/packages/grafana-ui/src/components/Forms/Legacy/Input/Input.internal.story.tsx +++ b/packages/grafana-ui/src/components/Forms/Legacy/Input/Input.internal.story.tsx @@ -1,6 +1,6 @@ import { Meta, StoryFn } from '@storybook/react'; import { zip, fromPairs } from 'lodash'; -import React, { useState } from 'react'; +import { useState } from 'react'; import { EventsWithValidation } from '../../../../utils'; diff --git a/packages/grafana-ui/src/components/Forms/Legacy/Input/Input.test.tsx b/packages/grafana-ui/src/components/Forms/Legacy/Input/Input.test.tsx index acf7cd850a5..dbd4ca81323 100644 --- a/packages/grafana-ui/src/components/Forms/Legacy/Input/Input.test.tsx +++ b/packages/grafana-ui/src/components/Forms/Legacy/Input/Input.test.tsx @@ -1,6 +1,5 @@ import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { ValidationEvents } from '../../../../types'; import { EventsWithValidation } from '../../../../utils'; diff --git a/packages/grafana-ui/src/components/Forms/Legacy/Input/Input.tsx b/packages/grafana-ui/src/components/Forms/Legacy/Input/Input.tsx index 4561ae71c84..40090eee8a5 100644 --- a/packages/grafana-ui/src/components/Forms/Legacy/Input/Input.tsx +++ b/packages/grafana-ui/src/components/Forms/Legacy/Input/Input.tsx @@ -1,5 +1,6 @@ import classNames from 'classnames'; -import React, { PureComponent, ChangeEvent } from 'react'; +import { PureComponent, ChangeEvent } from 'react'; +import * as React from 'react'; import { ValidationEvents, ValidationRule } from '../../../../types'; import { validate, EventsWithValidation, hasValidationEvent } from '../../../../utils'; diff --git a/packages/grafana-ui/src/components/Forms/Legacy/Select/IndicatorsContainer.tsx b/packages/grafana-ui/src/components/Forms/Legacy/Select/IndicatorsContainer.tsx index 0ec07bebd8d..3297dab37dc 100644 --- a/packages/grafana-ui/src/components/Forms/Legacy/Select/IndicatorsContainer.tsx +++ b/packages/grafana-ui/src/components/Forms/Legacy/Select/IndicatorsContainer.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { components, IndicatorsContainerProps } from 'react-select'; import { Icon } from '../../../Icon/Icon'; diff --git a/packages/grafana-ui/src/components/Forms/Legacy/Select/NoOptionsMessage.tsx b/packages/grafana-ui/src/components/Forms/Legacy/Select/NoOptionsMessage.tsx index 88693083998..4b50a802abb 100644 --- a/packages/grafana-ui/src/components/Forms/Legacy/Select/NoOptionsMessage.tsx +++ b/packages/grafana-ui/src/components/Forms/Legacy/Select/NoOptionsMessage.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { components, NoticeProps, GroupBase } from 'react-select'; import { SelectableValue } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Forms/Legacy/Select/Select.internal.story.tsx b/packages/grafana-ui/src/components/Forms/Legacy/Select/Select.internal.story.tsx index 96cd2f7f275..5e156ab8f9c 100644 --- a/packages/grafana-ui/src/components/Forms/Legacy/Select/Select.internal.story.tsx +++ b/packages/grafana-ui/src/components/Forms/Legacy/Select/Select.internal.story.tsx @@ -1,7 +1,7 @@ import { action } from '@storybook/addon-actions'; import { useArgs } from '@storybook/preview-api'; import { Meta, StoryFn } from '@storybook/react'; -import React, { useCallback } from 'react'; +import { useCallback } from 'react'; import { SelectableValue } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Forms/Legacy/Select/Select.tsx b/packages/grafana-ui/src/components/Forms/Legacy/Select/Select.tsx index 19fe15a32d3..f449c7cee47 100644 --- a/packages/grafana-ui/src/components/Forms/Legacy/Select/Select.tsx +++ b/packages/grafana-ui/src/components/Forms/Legacy/Select/Select.tsx @@ -1,6 +1,7 @@ // Libraries import classNames from 'classnames'; -import React, { PureComponent } from 'react'; +import { PureComponent } from 'react'; +import * as React from 'react'; import { default as ReactSelect, components, MenuListProps } from 'react-select'; import { default as ReactAsyncSelect } from 'react-select/async'; import Creatable from 'react-select/creatable'; diff --git a/packages/grafana-ui/src/components/Forms/Legacy/Select/SelectOption.test.tsx b/packages/grafana-ui/src/components/Forms/Legacy/Select/SelectOption.test.tsx index 1d3078e0a78..d0a2ffafa24 100644 --- a/packages/grafana-ui/src/components/Forms/Legacy/Select/SelectOption.test.tsx +++ b/packages/grafana-ui/src/components/Forms/Legacy/Select/SelectOption.test.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { OptionProps } from 'react-select'; import renderer from 'react-test-renderer'; diff --git a/packages/grafana-ui/src/components/Forms/Legacy/Select/SelectOption.tsx b/packages/grafana-ui/src/components/Forms/Legacy/Select/SelectOption.tsx index c618e71605e..164df8d7dd6 100644 --- a/packages/grafana-ui/src/components/Forms/Legacy/Select/SelectOption.tsx +++ b/packages/grafana-ui/src/components/Forms/Legacy/Select/SelectOption.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { components, OptionProps } from 'react-select'; import { Icon } from '../../../Icon/Icon'; diff --git a/packages/grafana-ui/src/components/Forms/Legacy/Select/SelectOptionGroup.tsx b/packages/grafana-ui/src/components/Forms/Legacy/Select/SelectOptionGroup.tsx index 1948a4d486b..ad478885975 100644 --- a/packages/grafana-ui/src/components/Forms/Legacy/Select/SelectOptionGroup.tsx +++ b/packages/grafana-ui/src/components/Forms/Legacy/Select/SelectOptionGroup.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { PureComponent } from 'react'; +import { PureComponent } from 'react'; import { GroupProps } from 'react-select'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Forms/Legacy/Switch/Switch.internal.story.tsx b/packages/grafana-ui/src/components/Forms/Legacy/Switch/Switch.internal.story.tsx index b95dcbe1f6d..a5578b4116a 100644 --- a/packages/grafana-ui/src/components/Forms/Legacy/Switch/Switch.internal.story.tsx +++ b/packages/grafana-ui/src/components/Forms/Legacy/Switch/Switch.internal.story.tsx @@ -1,5 +1,5 @@ import { Meta, StoryFn } from '@storybook/react'; -import React, { useState } from 'react'; +import { useState } from 'react'; import { Switch } from './Switch'; diff --git a/packages/grafana-ui/src/components/Forms/Legacy/Switch/Switch.tsx b/packages/grafana-ui/src/components/Forms/Legacy/Switch/Switch.tsx index c3476f1a560..dc9532511a0 100644 --- a/packages/grafana-ui/src/components/Forms/Legacy/Switch/Switch.tsx +++ b/packages/grafana-ui/src/components/Forms/Legacy/Switch/Switch.tsx @@ -1,7 +1,8 @@ import { css, cx } from '@emotion/css'; import { Placement } from '@popperjs/core'; import { uniqueId } from 'lodash'; -import React, { PureComponent } from 'react'; +import { PureComponent } from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Forms/Legend.story.tsx b/packages/grafana-ui/src/components/Forms/Legend.story.tsx index fbbebf27f6d..ec0b38c1968 100644 --- a/packages/grafana-ui/src/components/Forms/Legend.story.tsx +++ b/packages/grafana-ui/src/components/Forms/Legend.story.tsx @@ -1,5 +1,4 @@ import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { Legend } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/Forms/Legend.tsx b/packages/grafana-ui/src/components/Forms/Legend.tsx index 019e7a9a768..fd799dcda94 100644 --- a/packages/grafana-ui/src/components/Forms/Legend.tsx +++ b/packages/grafana-ui/src/components/Forms/Legend.tsx @@ -1,5 +1,6 @@ import { css, cx } from '@emotion/css'; -import React, { ReactNode } from 'react'; +import { ReactNode } from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Forms/RadioButtonGroup/RadioButton.tsx b/packages/grafana-ui/src/components/Forms/RadioButtonGroup/RadioButton.tsx index b3318923934..898247dff7d 100644 --- a/packages/grafana-ui/src/components/Forms/RadioButtonGroup/RadioButton.tsx +++ b/packages/grafana-ui/src/components/Forms/RadioButtonGroup/RadioButton.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { StringSelector, selectors } from '@grafana/e2e-selectors'; diff --git a/packages/grafana-ui/src/components/Forms/RadioButtonGroup/RadioButtonGroup.story.tsx b/packages/grafana-ui/src/components/Forms/RadioButtonGroup/RadioButtonGroup.story.tsx index ed40caa0b01..f75f45c3c0b 100644 --- a/packages/grafana-ui/src/components/Forms/RadioButtonGroup/RadioButtonGroup.story.tsx +++ b/packages/grafana-ui/src/components/Forms/RadioButtonGroup/RadioButtonGroup.story.tsx @@ -1,5 +1,5 @@ import { Meta, StoryFn } from '@storybook/react'; -import React, { useState } from 'react'; +import { useState } from 'react'; import { RadioButtonGroup } from './RadioButtonGroup'; import mdx from './RadioButtonGroup.mdx'; diff --git a/packages/grafana-ui/src/components/Forms/RadioButtonGroup/RadioButtonGroup.tsx b/packages/grafana-ui/src/components/Forms/RadioButtonGroup/RadioButtonGroup.tsx index 1ac45002e6a..1fc51fb350c 100644 --- a/packages/grafana-ui/src/components/Forms/RadioButtonGroup/RadioButtonGroup.tsx +++ b/packages/grafana-ui/src/components/Forms/RadioButtonGroup/RadioButtonGroup.tsx @@ -1,6 +1,6 @@ import { css, cx } from '@emotion/css'; import { uniqueId } from 'lodash'; -import React, { useCallback, useEffect, useRef } from 'react'; +import { useCallback, useEffect, useRef } from 'react'; import { GrafanaTheme2, SelectableValue, toIconName } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Forms/RadioButtonList/RadioButtonDot.tsx b/packages/grafana-ui/src/components/Forms/RadioButtonList/RadioButtonDot.tsx index 148e14e3ec7..23616fa1f5a 100644 --- a/packages/grafana-ui/src/components/Forms/RadioButtonList/RadioButtonDot.tsx +++ b/packages/grafana-ui/src/components/Forms/RadioButtonList/RadioButtonDot.tsx @@ -1,11 +1,12 @@ import { css } from '@emotion/css'; -import React from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { useStyles2 } from '../../../themes'; -export interface RadioButtonDotProps { +export interface RadioButtonDotProps + extends Omit, 'label' | 'value' | 'onChange' | 'type'> { id: string; name: string; checked?: boolean; @@ -25,12 +26,14 @@ export const RadioButtonDot = ({ disabled, description, onChange, + ...props }: RadioButtonDotProps) => { const styles = useStyles2(getStyles); return (
      - {React.Children.toArray(children).filter(Boolean)} + {Children.toArray(children).filter(Boolean)} ); diff --git a/packages/grafana-ui/src/components/Pagination/Pagination.story.tsx b/packages/grafana-ui/src/components/Pagination/Pagination.story.tsx index 4164c069807..f3f1aca724a 100644 --- a/packages/grafana-ui/src/components/Pagination/Pagination.story.tsx +++ b/packages/grafana-ui/src/components/Pagination/Pagination.story.tsx @@ -1,5 +1,5 @@ import { Meta, StoryFn } from '@storybook/react'; -import React, { useState } from 'react'; +import { useState } from 'react'; import { Pagination } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/Pagination/Pagination.test.tsx b/packages/grafana-ui/src/components/Pagination/Pagination.test.tsx index 68a85e6746c..2e9fe1a44e5 100644 --- a/packages/grafana-ui/src/components/Pagination/Pagination.test.tsx +++ b/packages/grafana-ui/src/components/Pagination/Pagination.test.tsx @@ -1,5 +1,4 @@ import { render, screen } from '@testing-library/react'; -import React from 'react'; import { Pagination } from './Pagination'; diff --git a/packages/grafana-ui/src/components/Pagination/Pagination.tsx b/packages/grafana-ui/src/components/Pagination/Pagination.tsx index bdfa1ec7cf8..5917185f2bb 100644 --- a/packages/grafana-ui/src/components/Pagination/Pagination.tsx +++ b/packages/grafana-ui/src/components/Pagination/Pagination.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React, { useMemo } from 'react'; +import { useMemo } from 'react'; import { useStyles2 } from '../../themes'; import { Button, ButtonVariant } from '../Button'; diff --git a/packages/grafana-ui/src/components/PanelChrome/HoverWidget.tsx b/packages/grafana-ui/src/components/PanelChrome/HoverWidget.tsx index b0fda6d1013..fa767de0d53 100644 --- a/packages/grafana-ui/src/components/PanelChrome/HoverWidget.tsx +++ b/packages/grafana-ui/src/components/PanelChrome/HoverWidget.tsx @@ -1,5 +1,6 @@ import { css, cx } from '@emotion/css'; -import React, { ReactElement, useCallback, useRef } from 'react'; +import { ReactElement, useCallback, useRef } from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { selectors as e2eSelectors } from '@grafana/e2e-selectors'; diff --git a/packages/grafana-ui/src/components/PanelChrome/LoadingIndicator.tsx b/packages/grafana-ui/src/components/PanelChrome/LoadingIndicator.tsx index 27db3b16f79..dc1357c521d 100644 --- a/packages/grafana-ui/src/components/PanelChrome/LoadingIndicator.tsx +++ b/packages/grafana-ui/src/components/PanelChrome/LoadingIndicator.tsx @@ -1,5 +1,4 @@ import { css, cx, keyframes } from '@emotion/css'; -import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; diff --git a/packages/grafana-ui/src/components/PanelChrome/PanelChrome.story.tsx b/packages/grafana-ui/src/components/PanelChrome/PanelChrome.story.tsx index 9367b187d16..584bc082c4b 100644 --- a/packages/grafana-ui/src/components/PanelChrome/PanelChrome.story.tsx +++ b/packages/grafana-ui/src/components/PanelChrome/PanelChrome.story.tsx @@ -1,7 +1,7 @@ import { action } from '@storybook/addon-actions'; import { Meta, StoryFn } from '@storybook/react'; import { merge } from 'lodash'; -import React, { CSSProperties, useState, ReactNode } from 'react'; +import { CSSProperties, useState, ReactNode } from 'react'; import { useInterval, useToggle } from 'react-use'; import { LoadingState } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/PanelChrome/PanelChrome.test.tsx b/packages/grafana-ui/src/components/PanelChrome/PanelChrome.test.tsx index a048c384a25..d9acab30c2d 100644 --- a/packages/grafana-ui/src/components/PanelChrome/PanelChrome.test.tsx +++ b/packages/grafana-ui/src/components/PanelChrome/PanelChrome.test.tsx @@ -1,5 +1,4 @@ import { screen, render, fireEvent } from '@testing-library/react'; -import React from 'react'; import { useToggle } from 'react-use'; import { LoadingState } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/PanelChrome/PanelChrome.tsx b/packages/grafana-ui/src/components/PanelChrome/PanelChrome.tsx index e6f36c80491..4928c84fd3f 100644 --- a/packages/grafana-ui/src/components/PanelChrome/PanelChrome.tsx +++ b/packages/grafana-ui/src/components/PanelChrome/PanelChrome.tsx @@ -1,5 +1,6 @@ import { css, cx } from '@emotion/css'; -import React, { CSSProperties, ReactElement, ReactNode, useId } from 'react'; +import { CSSProperties, ReactElement, ReactNode, useId } from 'react'; +import * as React from 'react'; import { useMeasure, useToggle } from 'react-use'; import { GrafanaTheme2, LoadingState } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/PanelChrome/PanelContext.ts b/packages/grafana-ui/src/components/PanelChrome/PanelContext.ts index 17dd87270a2..b05e3e9d211 100644 --- a/packages/grafana-ui/src/components/PanelChrome/PanelContext.ts +++ b/packages/grafana-ui/src/components/PanelChrome/PanelContext.ts @@ -1,4 +1,4 @@ -import React from 'react'; +import { createContext, useContext } from 'react'; import { EventBusSrv, @@ -99,7 +99,7 @@ export interface PanelContext { dataLinkPostProcessor?: DataLinkPostProcessor; } -export const PanelContextRoot = React.createContext({ +export const PanelContextRoot = createContext({ eventsScope: 'global', eventBus: new EventBusSrv(), }); @@ -112,4 +112,4 @@ export const PanelContextProvider = PanelContextRoot.Provider; /** * @alpha */ -export const usePanelContext = () => React.useContext(PanelContextRoot); +export const usePanelContext = () => useContext(PanelContextRoot); diff --git a/packages/grafana-ui/src/components/PanelChrome/PanelDescription.tsx b/packages/grafana-ui/src/components/PanelChrome/PanelDescription.tsx index 0f7909cada4..b9e74f5c39d 100644 --- a/packages/grafana-ui/src/components/PanelChrome/PanelDescription.tsx +++ b/packages/grafana-ui/src/components/PanelChrome/PanelDescription.tsx @@ -1,5 +1,4 @@ import { css, cx } from '@emotion/css'; -import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/PanelChrome/PanelMenu.tsx b/packages/grafana-ui/src/components/PanelChrome/PanelMenu.tsx index 595bda416e0..d11fd2d4243 100644 --- a/packages/grafana-ui/src/components/PanelChrome/PanelMenu.tsx +++ b/packages/grafana-ui/src/components/PanelChrome/PanelMenu.tsx @@ -1,5 +1,5 @@ import { cx } from '@emotion/css'; -import React, { ReactElement, useCallback } from 'react'; +import { ReactElement, useCallback } from 'react'; import { selectors } from '@grafana/e2e-selectors'; diff --git a/packages/grafana-ui/src/components/PanelChrome/PanelStatus.tsx b/packages/grafana-ui/src/components/PanelChrome/PanelStatus.tsx index 9b92be7a9b3..9667163d12a 100644 --- a/packages/grafana-ui/src/components/PanelChrome/PanelStatus.tsx +++ b/packages/grafana-ui/src/components/PanelChrome/PanelStatus.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; diff --git a/packages/grafana-ui/src/components/PanelChrome/TitleItem.tsx b/packages/grafana-ui/src/components/PanelChrome/TitleItem.tsx index b3a87fb4919..a4922f2331b 100644 --- a/packages/grafana-ui/src/components/PanelChrome/TitleItem.tsx +++ b/packages/grafana-ui/src/components/PanelChrome/TitleItem.tsx @@ -1,5 +1,6 @@ import { cx, css } from '@emotion/css'; -import React, { forwardRef } from 'react'; +import { forwardRef } from 'react'; +import * as React from 'react'; import { GrafanaTheme2, LinkModel, LinkTarget } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/PanelChrome/index.ts b/packages/grafana-ui/src/components/PanelChrome/index.ts index 92cdb6bd5a7..73a11ed6ac7 100644 --- a/packages/grafana-ui/src/components/PanelChrome/index.ts +++ b/packages/grafana-ui/src/components/PanelChrome/index.ts @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { LoadingIndicator } from './LoadingIndicator'; import { PanelChrome as PanelChromeComponent, PanelChromeProps } from './PanelChrome'; diff --git a/packages/grafana-ui/src/components/PanelContainer/PanelContainer.story.tsx b/packages/grafana-ui/src/components/PanelContainer/PanelContainer.story.tsx index ed26a020a71..cafb8150597 100644 --- a/packages/grafana-ui/src/components/PanelContainer/PanelContainer.story.tsx +++ b/packages/grafana-ui/src/components/PanelContainer/PanelContainer.story.tsx @@ -1,5 +1,4 @@ import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { PanelContainer } from './PanelContainer'; import mdx from './PanelContainer.mdx'; diff --git a/packages/grafana-ui/src/components/PanelContainer/PanelContainer.tsx b/packages/grafana-ui/src/components/PanelContainer/PanelContainer.tsx index fc7b8b5ff8c..e84e295f654 100644 --- a/packages/grafana-ui/src/components/PanelContainer/PanelContainer.tsx +++ b/packages/grafana-ui/src/components/PanelContainer/PanelContainer.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React, { DetailedHTMLProps, HTMLAttributes } from 'react'; +import { DetailedHTMLProps, HTMLAttributes } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/PluginSignatureBadge/PluginSignatureBadge.story.tsx b/packages/grafana-ui/src/components/PluginSignatureBadge/PluginSignatureBadge.story.tsx index 075c5b1ff86..ed7925c8ee6 100644 --- a/packages/grafana-ui/src/components/PluginSignatureBadge/PluginSignatureBadge.story.tsx +++ b/packages/grafana-ui/src/components/PluginSignatureBadge/PluginSignatureBadge.story.tsx @@ -1,5 +1,4 @@ import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { PluginSignatureStatus } from '@grafana/data'; import { PluginSignatureBadge } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/PluginSignatureBadge/PluginSignatureBadge.tsx b/packages/grafana-ui/src/components/PluginSignatureBadge/PluginSignatureBadge.tsx index 7cb452c3340..af8720cca61 100644 --- a/packages/grafana-ui/src/components/PluginSignatureBadge/PluginSignatureBadge.tsx +++ b/packages/grafana-ui/src/components/PluginSignatureBadge/PluginSignatureBadge.tsx @@ -1,4 +1,4 @@ -import React, { HTMLAttributes } from 'react'; +import { HTMLAttributes } from 'react'; import { PluginSignatureStatus } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Portal/Portal.tsx b/packages/grafana-ui/src/components/Portal/Portal.tsx index 0e00c7b2025..867ee890821 100644 --- a/packages/grafana-ui/src/components/Portal/Portal.tsx +++ b/packages/grafana-ui/src/components/Portal/Portal.tsx @@ -1,4 +1,5 @@ -import React, { PropsWithChildren, useLayoutEffect, useRef } from 'react'; +import { PropsWithChildren, useLayoutEffect, useRef } from 'react'; +import * as React from 'react'; import ReactDOM from 'react-dom'; import { useTheme2 } from '../../themes'; diff --git a/packages/grafana-ui/src/components/QueryField/QueryField.story.tsx b/packages/grafana-ui/src/components/QueryField/QueryField.story.tsx index 79923177a2a..bd9d92659e8 100644 --- a/packages/grafana-ui/src/components/QueryField/QueryField.story.tsx +++ b/packages/grafana-ui/src/components/QueryField/QueryField.story.tsx @@ -1,5 +1,4 @@ import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { TypeaheadInput } from '../../types'; diff --git a/packages/grafana-ui/src/components/QueryField/QueryField.test.tsx b/packages/grafana-ui/src/components/QueryField/QueryField.test.tsx index bf11342d2ff..391d257b137 100644 --- a/packages/grafana-ui/src/components/QueryField/QueryField.test.tsx +++ b/packages/grafana-ui/src/components/QueryField/QueryField.test.tsx @@ -1,5 +1,4 @@ import { render, screen } from '@testing-library/react'; -import React from 'react'; import { createTheme } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/QueryField/QueryField.tsx b/packages/grafana-ui/src/components/QueryField/QueryField.tsx index d42fa8ab3b8..1c79e62239e 100644 --- a/packages/grafana-ui/src/components/QueryField/QueryField.tsx +++ b/packages/grafana-ui/src/components/QueryField/QueryField.tsx @@ -1,7 +1,8 @@ import { css, cx } from '@emotion/css'; import classnames from 'classnames'; import { debounce } from 'lodash'; -import React, { PureComponent } from 'react'; +import { PureComponent } from 'react'; +import * as React from 'react'; import { Value } from 'slate'; import Plain from 'slate-plain-serializer'; import { Editor, EventHook, Plugin } from 'slate-react'; diff --git a/packages/grafana-ui/src/components/RefreshPicker/RefreshPicker.story.tsx b/packages/grafana-ui/src/components/RefreshPicker/RefreshPicker.story.tsx index 6dae97df6c8..bdd3926d041 100644 --- a/packages/grafana-ui/src/components/RefreshPicker/RefreshPicker.story.tsx +++ b/packages/grafana-ui/src/components/RefreshPicker/RefreshPicker.story.tsx @@ -1,7 +1,6 @@ import { action } from '@storybook/addon-actions'; import { useArgs } from '@storybook/preview-api'; import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { RefreshPicker } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/RefreshPicker/RefreshPicker.tsx b/packages/grafana-ui/src/components/RefreshPicker/RefreshPicker.tsx index de754714c6e..d207288ba89 100644 --- a/packages/grafana-ui/src/components/RefreshPicker/RefreshPicker.tsx +++ b/packages/grafana-ui/src/components/RefreshPicker/RefreshPicker.tsx @@ -1,5 +1,5 @@ import { formatDuration } from 'date-fns'; -import React, { PureComponent } from 'react'; +import { PureComponent } from 'react'; import { SelectableValue, parseDuration } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; diff --git a/packages/grafana-ui/src/components/RenderUserContentAsHTML/RenderUserContentAsHTML.story.tsx b/packages/grafana-ui/src/components/RenderUserContentAsHTML/RenderUserContentAsHTML.story.tsx index 2c5ad838dbc..3cc29fa45e6 100644 --- a/packages/grafana-ui/src/components/RenderUserContentAsHTML/RenderUserContentAsHTML.story.tsx +++ b/packages/grafana-ui/src/components/RenderUserContentAsHTML/RenderUserContentAsHTML.story.tsx @@ -1,5 +1,4 @@ import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { RenderUserContentAsHTML } from './RenderUserContentAsHTML'; import mdx from './RenderUserContentAsHTML.mdx'; diff --git a/packages/grafana-ui/src/components/RenderUserContentAsHTML/RenderUserContentAsHTML.test.tsx b/packages/grafana-ui/src/components/RenderUserContentAsHTML/RenderUserContentAsHTML.test.tsx index 7962ed9fd8c..3f4712e95ff 100644 --- a/packages/grafana-ui/src/components/RenderUserContentAsHTML/RenderUserContentAsHTML.test.tsx +++ b/packages/grafana-ui/src/components/RenderUserContentAsHTML/RenderUserContentAsHTML.test.tsx @@ -1,5 +1,4 @@ import { render, screen } from '@testing-library/react'; -import React from 'react'; import { RenderUserContentAsHTML } from './RenderUserContentAsHTML'; diff --git a/packages/grafana-ui/src/components/RenderUserContentAsHTML/RenderUserContentAsHTML.tsx b/packages/grafana-ui/src/components/RenderUserContentAsHTML/RenderUserContentAsHTML.tsx index 2d4e3e87b99..d5ec22c2440 100644 --- a/packages/grafana-ui/src/components/RenderUserContentAsHTML/RenderUserContentAsHTML.tsx +++ b/packages/grafana-ui/src/components/RenderUserContentAsHTML/RenderUserContentAsHTML.tsx @@ -1,4 +1,5 @@ -import React, { HTMLAttributes, PropsWithChildren } from 'react'; +import { HTMLAttributes, PropsWithChildren } from 'react'; +import * as React from 'react'; import { textUtil } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/SecretFormField/SecretFormField.internal.story.tsx b/packages/grafana-ui/src/components/SecretFormField/SecretFormField.internal.story.tsx index faad4feb28a..8c5b7943625 100644 --- a/packages/grafana-ui/src/components/SecretFormField/SecretFormField.internal.story.tsx +++ b/packages/grafana-ui/src/components/SecretFormField/SecretFormField.internal.story.tsx @@ -1,7 +1,6 @@ import { action } from '@storybook/addon-actions'; import { useArgs } from '@storybook/preview-api'; import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { SecretFormField } from './SecretFormField'; diff --git a/packages/grafana-ui/src/components/SecretFormField/SecretFormField.tsx b/packages/grafana-ui/src/components/SecretFormField/SecretFormField.tsx index 94e4ee9808f..297df8b49f3 100644 --- a/packages/grafana-ui/src/components/SecretFormField/SecretFormField.tsx +++ b/packages/grafana-ui/src/components/SecretFormField/SecretFormField.tsx @@ -1,6 +1,7 @@ import { css, cx } from '@emotion/css'; import { omit } from 'lodash'; -import React, { InputHTMLAttributes } from 'react'; +import { InputHTMLAttributes } from 'react'; +import * as React from 'react'; import { Button } from '../Button/Button'; import { FormField } from '../FormField/FormField'; diff --git a/packages/grafana-ui/src/components/SecretInput/SecretInput.story.tsx b/packages/grafana-ui/src/components/SecretInput/SecretInput.story.tsx index d83b007a1f8..bc02d0f7204 100644 --- a/packages/grafana-ui/src/components/SecretInput/SecretInput.story.tsx +++ b/packages/grafana-ui/src/components/SecretInput/SecretInput.story.tsx @@ -1,5 +1,5 @@ import { StoryFn, Meta } from '@storybook/react'; -import React, { useState, ChangeEvent } from 'react'; +import { useState, ChangeEvent } from 'react'; import { SecretInput } from './SecretInput'; import mdx from './SecretInput.mdx'; diff --git a/packages/grafana-ui/src/components/SecretInput/SecretInput.test.tsx b/packages/grafana-ui/src/components/SecretInput/SecretInput.test.tsx index 284b30fbf35..aeb9adf4cef 100644 --- a/packages/grafana-ui/src/components/SecretInput/SecretInput.test.tsx +++ b/packages/grafana-ui/src/components/SecretInput/SecretInput.test.tsx @@ -1,6 +1,5 @@ import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { SecretInput, RESET_BUTTON_TEXT, CONFIGURED_TEXT } from './SecretInput'; diff --git a/packages/grafana-ui/src/components/SecretTextArea/SecretTextArea.story.tsx b/packages/grafana-ui/src/components/SecretTextArea/SecretTextArea.story.tsx index f48f09c3f2f..4e71c1fd66a 100644 --- a/packages/grafana-ui/src/components/SecretTextArea/SecretTextArea.story.tsx +++ b/packages/grafana-ui/src/components/SecretTextArea/SecretTextArea.story.tsx @@ -1,5 +1,5 @@ import { StoryFn, Meta } from '@storybook/react'; -import React, { useState, ChangeEvent } from 'react'; +import { useState, ChangeEvent } from 'react'; import { SecretTextArea } from './SecretTextArea'; diff --git a/packages/grafana-ui/src/components/SecretTextArea/SecretTextArea.test.tsx b/packages/grafana-ui/src/components/SecretTextArea/SecretTextArea.test.tsx index 7290dcf6454..f2543a5002c 100644 --- a/packages/grafana-ui/src/components/SecretTextArea/SecretTextArea.test.tsx +++ b/packages/grafana-ui/src/components/SecretTextArea/SecretTextArea.test.tsx @@ -1,6 +1,5 @@ import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { SecretTextArea, RESET_BUTTON_TEXT, CONFIGURED_TEXT } from './SecretTextArea'; diff --git a/packages/grafana-ui/src/components/Segment/Segment.story.tsx b/packages/grafana-ui/src/components/Segment/Segment.story.tsx index 771fc011ba7..fbe8a4eb3a0 100644 --- a/packages/grafana-ui/src/components/Segment/Segment.story.tsx +++ b/packages/grafana-ui/src/components/Segment/Segment.story.tsx @@ -1,6 +1,7 @@ import { action } from '@storybook/addon-actions'; import { Meta, StoryFn } from '@storybook/react'; -import React, { useState } from 'react'; +import { useState } from 'react'; +import * as React from 'react'; import { SelectableValue } from '@grafana/data'; import { Segment, Icon, SegmentSection } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/Segment/Segment.tsx b/packages/grafana-ui/src/components/Segment/Segment.tsx index cb74127cdca..36ae2552a8d 100644 --- a/packages/grafana-ui/src/components/Segment/Segment.tsx +++ b/packages/grafana-ui/src/components/Segment/Segment.tsx @@ -1,6 +1,7 @@ import { cx } from '@emotion/css'; import { isObject } from 'lodash'; -import React, { HTMLProps } from 'react'; +import { HTMLProps } from 'react'; +import * as React from 'react'; import { SelectableValue } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Segment/SegmentAsync.story.tsx b/packages/grafana-ui/src/components/Segment/SegmentAsync.story.tsx index edf49d25647..9aaaf008867 100644 --- a/packages/grafana-ui/src/components/Segment/SegmentAsync.story.tsx +++ b/packages/grafana-ui/src/components/Segment/SegmentAsync.story.tsx @@ -1,6 +1,7 @@ import { action } from '@storybook/addon-actions'; import { Meta, StoryFn } from '@storybook/react'; -import React, { useState } from 'react'; +import { useState } from 'react'; +import * as React from 'react'; import { AsyncState } from 'react-use/lib/useAsync'; import { SelectableValue } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Segment/SegmentAsync.tsx b/packages/grafana-ui/src/components/Segment/SegmentAsync.tsx index 29408d1b319..b0f9907554b 100644 --- a/packages/grafana-ui/src/components/Segment/SegmentAsync.tsx +++ b/packages/grafana-ui/src/components/Segment/SegmentAsync.tsx @@ -1,6 +1,7 @@ import { cx } from '@emotion/css'; import { isObject } from 'lodash'; -import React, { HTMLProps } from 'react'; +import { HTMLProps } from 'react'; +import * as React from 'react'; import { useAsyncFn } from 'react-use'; import { AsyncState } from 'react-use/lib/useAsync'; diff --git a/packages/grafana-ui/src/components/Segment/SegmentInput.story.tsx b/packages/grafana-ui/src/components/Segment/SegmentInput.story.tsx index 85e9122ef4f..64a3a9c8fee 100644 --- a/packages/grafana-ui/src/components/Segment/SegmentInput.story.tsx +++ b/packages/grafana-ui/src/components/Segment/SegmentInput.story.tsx @@ -1,6 +1,7 @@ import { action } from '@storybook/addon-actions'; import { Meta, StoryFn } from '@storybook/react'; -import React, { useState } from 'react'; +import { useState } from 'react'; +import * as React from 'react'; import { SegmentInput, Icon, SegmentSection } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/Segment/SegmentInput.tsx b/packages/grafana-ui/src/components/Segment/SegmentInput.tsx index 49bfe8454e4..24ab7e8af1e 100644 --- a/packages/grafana-ui/src/components/Segment/SegmentInput.tsx +++ b/packages/grafana-ui/src/components/Segment/SegmentInput.tsx @@ -1,5 +1,6 @@ import { cx, css } from '@emotion/css'; -import React, { HTMLProps, useRef, useState } from 'react'; +import { HTMLProps, useRef, useState } from 'react'; +import * as React from 'react'; import useClickAway from 'react-use/lib/useClickAway'; import { useStyles2 } from '../../themes'; diff --git a/packages/grafana-ui/src/components/Segment/SegmentSection.tsx b/packages/grafana-ui/src/components/Segment/SegmentSection.tsx index e2e2353182f..bdd03681d73 100644 --- a/packages/grafana-ui/src/components/Segment/SegmentSection.tsx +++ b/packages/grafana-ui/src/components/Segment/SegmentSection.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Segment/SegmentSelect.tsx b/packages/grafana-ui/src/components/Segment/SegmentSelect.tsx index e3755c4435a..42efd93063d 100644 --- a/packages/grafana-ui/src/components/Segment/SegmentSelect.tsx +++ b/packages/grafana-ui/src/components/Segment/SegmentSelect.tsx @@ -1,4 +1,5 @@ -import React, { HTMLProps, useRef } from 'react'; +import { HTMLProps, useRef } from 'react'; +import * as React from 'react'; import { SelectableValue } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Segment/useExpandableLabel.tsx b/packages/grafana-ui/src/components/Segment/useExpandableLabel.tsx index 5e1d8bf215e..bc80d49f457 100644 --- a/packages/grafana-ui/src/components/Segment/useExpandableLabel.tsx +++ b/packages/grafana-ui/src/components/Segment/useExpandableLabel.tsx @@ -1,4 +1,5 @@ -import React, { useState, useRef, ReactElement } from 'react'; +import { useState, useRef, ReactElement } from 'react'; +import * as React from 'react'; import { useStyles2 } from '../../themes'; import { clearButtonStyles } from '../Button'; diff --git a/packages/grafana-ui/src/components/Select/CustomInput.tsx b/packages/grafana-ui/src/components/Select/CustomInput.tsx index 5531b314ec2..d87cb5372df 100644 --- a/packages/grafana-ui/src/components/Select/CustomInput.tsx +++ b/packages/grafana-ui/src/components/Select/CustomInput.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { components, InputProps } from 'react-select'; /** diff --git a/packages/grafana-ui/src/components/Select/DropdownIndicator.tsx b/packages/grafana-ui/src/components/Select/DropdownIndicator.tsx index 5e56ce531d6..ed0f4213544 100644 --- a/packages/grafana-ui/src/components/Select/DropdownIndicator.tsx +++ b/packages/grafana-ui/src/components/Select/DropdownIndicator.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { DropdownIndicatorProps } from 'react-select'; import { Icon } from '../Icon/Icon'; diff --git a/packages/grafana-ui/src/components/Select/IndicatorsContainer.tsx b/packages/grafana-ui/src/components/Select/IndicatorsContainer.tsx index 9ed79985614..36891e7678b 100644 --- a/packages/grafana-ui/src/components/Select/IndicatorsContainer.tsx +++ b/packages/grafana-ui/src/components/Select/IndicatorsContainer.tsx @@ -1,10 +1,10 @@ import { cx, css } from '@emotion/css'; -import React from 'react'; +import { forwardRef } from 'react'; import { useTheme2 } from '../../themes/ThemeContext'; import { getInputStyles } from '../Input/Input'; -export const IndicatorsContainer = React.forwardRef((props, ref) => { +export const IndicatorsContainer = forwardRef((props, ref) => { const { children } = props; const theme = useTheme2(); const styles = getInputStyles({ theme, invalid: false }); diff --git a/packages/grafana-ui/src/components/Select/InputControl.tsx b/packages/grafana-ui/src/components/Select/InputControl.tsx index c4a3e4b90f2..4635b6a27dc 100644 --- a/packages/grafana-ui/src/components/Select/InputControl.tsx +++ b/packages/grafana-ui/src/components/Select/InputControl.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React from 'react'; +import { forwardRef } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; @@ -16,7 +16,7 @@ interface InputControlProps { innerProps: JSX.IntrinsicElements['div']; } -export const InputControl = React.forwardRef>( +export const InputControl = forwardRef>( function InputControl({ focused, invalid, disabled, children, innerProps, prefix, ...otherProps }, ref) { const styles = useStyles2(getInputControlStyles, invalid, !!prefix); diff --git a/packages/grafana-ui/src/components/Select/MultiValue.tsx b/packages/grafana-ui/src/components/Select/MultiValue.tsx index cc05170f756..c92a788ba5d 100644 --- a/packages/grafana-ui/src/components/Select/MultiValue.tsx +++ b/packages/grafana-ui/src/components/Select/MultiValue.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { useTheme2 } from '../../themes'; import { IconButton, Props as IconButtonProps } from '../IconButton/IconButton'; diff --git a/packages/grafana-ui/src/components/Select/Select.mdx b/packages/grafana-ui/src/components/Select/Select.mdx index 5af27ea2344..29d4c320a99 100644 --- a/packages/grafana-ui/src/components/Select/Select.mdx +++ b/packages/grafana-ui/src/components/Select/Select.mdx @@ -65,7 +65,7 @@ const SelectComponent = () => { If you want to reset the selected value from outside the component, e.g. if there are two Select components that should be in sync, you can set the dependent Select value to `null` in the `onChange` handler of the first Select component. ```tsx -import React, { useState } from 'react'; +import { useState } from 'react'; import { Select } from '@grafana/ui'; const SelectComponent = () => { diff --git a/packages/grafana-ui/src/components/Select/Select.story.tsx b/packages/grafana-ui/src/components/Select/Select.story.tsx index 20d3d29e416..c56102ca64e 100644 --- a/packages/grafana-ui/src/components/Select/Select.story.tsx +++ b/packages/grafana-ui/src/components/Select/Select.story.tsx @@ -2,7 +2,7 @@ import { auto } from '@popperjs/core'; import { action } from '@storybook/addon-actions'; import { Meta, StoryFn } from '@storybook/react'; import Chance from 'chance'; -import React, { useState } from 'react'; +import { useState } from 'react'; import { SelectableValue, toIconName } from '@grafana/data'; import { Icon, Select, AsyncSelect, MultiSelect, AsyncMultiSelect } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/Select/Select.tsx b/packages/grafana-ui/src/components/Select/Select.tsx index d118d9ada33..5a24d2d97c0 100644 --- a/packages/grafana-ui/src/components/Select/Select.tsx +++ b/packages/grafana-ui/src/components/Select/Select.tsx @@ -1,5 +1,3 @@ -import React from 'react'; - import { SelectableValue } from '@grafana/data'; import { SelectBase } from './SelectBase'; diff --git a/packages/grafana-ui/src/components/Select/SelectBase.test.tsx b/packages/grafana-ui/src/components/Select/SelectBase.test.tsx index d36fc8de979..895e0d055b1 100644 --- a/packages/grafana-ui/src/components/Select/SelectBase.test.tsx +++ b/packages/grafana-ui/src/components/Select/SelectBase.test.tsx @@ -1,6 +1,6 @@ import { render, screen, fireEvent, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React, { useState } from 'react'; +import { useState } from 'react'; import { select } from 'react-select-event'; import { SelectableValue } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Select/SelectBase.tsx b/packages/grafana-ui/src/components/Select/SelectBase.tsx index 34eccfc4aa5..a37634653d6 100644 --- a/packages/grafana-ui/src/components/Select/SelectBase.tsx +++ b/packages/grafana-ui/src/components/Select/SelectBase.tsx @@ -1,5 +1,6 @@ import { t } from 'i18next'; -import React, { ComponentProps, useCallback, useEffect, useRef, useState } from 'react'; +import { ComponentProps, useCallback, useEffect, useRef, useState } from 'react'; +import * as React from 'react'; import { default as ReactSelect, IndicatorsContainerProps, diff --git a/packages/grafana-ui/src/components/Select/SelectContainer.tsx b/packages/grafana-ui/src/components/Select/SelectContainer.tsx index 8e6f4ff895d..cdac2582193 100644 --- a/packages/grafana-ui/src/components/Select/SelectContainer.tsx +++ b/packages/grafana-ui/src/components/Select/SelectContainer.tsx @@ -1,5 +1,4 @@ import { css, cx } from '@emotion/css'; -import React from 'react'; import { components, ContainerProps as BaseContainerProps, GroupBase } from 'react-select'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Select/SelectMenu.tsx b/packages/grafana-ui/src/components/Select/SelectMenu.tsx index a0dc9336d09..c8a6aff1712 100644 --- a/packages/grafana-ui/src/components/Select/SelectMenu.tsx +++ b/packages/grafana-ui/src/components/Select/SelectMenu.tsx @@ -1,6 +1,7 @@ import { cx } from '@emotion/css'; import { max } from 'lodash'; -import React, { RefCallback, useEffect, useMemo, useRef } from 'react'; +import { RefCallback, useEffect, useMemo, useRef } from 'react'; +import * as React from 'react'; import { MenuListProps } from 'react-select'; import { FixedSizeList as List } from 'react-window'; diff --git a/packages/grafana-ui/src/components/Select/SelectOptionGroup.tsx b/packages/grafana-ui/src/components/Select/SelectOptionGroup.tsx index 940d0088fb8..def8c1cd414 100644 --- a/packages/grafana-ui/src/components/Select/SelectOptionGroup.tsx +++ b/packages/grafana-ui/src/components/Select/SelectOptionGroup.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { GroupProps } from 'react-select'; import { useStyles2 } from '../../themes/ThemeContext'; diff --git a/packages/grafana-ui/src/components/Select/SelectOptionGroupHeader.tsx b/packages/grafana-ui/src/components/Select/SelectOptionGroupHeader.tsx index bdcc4ec0139..c88ee5b7eb1 100644 --- a/packages/grafana-ui/src/components/Select/SelectOptionGroupHeader.tsx +++ b/packages/grafana-ui/src/components/Select/SelectOptionGroupHeader.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { GroupHeadingProps } from 'react-select'; import { useStyles2 } from '../../themes/ThemeContext'; diff --git a/packages/grafana-ui/src/components/Select/SelectPerf.internal.story.tsx b/packages/grafana-ui/src/components/Select/SelectPerf.internal.story.tsx index 93f20cdfe1c..d147b90a2b5 100644 --- a/packages/grafana-ui/src/components/Select/SelectPerf.internal.story.tsx +++ b/packages/grafana-ui/src/components/Select/SelectPerf.internal.story.tsx @@ -1,5 +1,5 @@ import { Meta } from '@storybook/react'; -import React, { useMemo } from 'react'; +import { useMemo } from 'react'; import ReactSelect, { createFilter } from 'react-select'; import { SelectableValue } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Select/SingleValue.tsx b/packages/grafana-ui/src/components/Select/SingleValue.tsx index 849c232e1e9..98e5dde07d6 100644 --- a/packages/grafana-ui/src/components/Select/SingleValue.tsx +++ b/packages/grafana-ui/src/components/Select/SingleValue.tsx @@ -1,5 +1,4 @@ import { css, cx } from '@emotion/css'; -import React from 'react'; import { components, GroupBase, SingleValueProps } from 'react-select'; import { GrafanaTheme2, SelectableValue, toIconName } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Select/ValueContainer.tsx b/packages/grafana-ui/src/components/Select/ValueContainer.tsx index 5ad36ce8f92..303217009ec 100644 --- a/packages/grafana-ui/src/components/Select/ValueContainer.tsx +++ b/packages/grafana-ui/src/components/Select/ValueContainer.tsx @@ -1,5 +1,5 @@ import { cx } from '@emotion/css'; -import React, { Component, ReactNode } from 'react'; +import { Component, ReactNode } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Select/types.ts b/packages/grafana-ui/src/components/Select/types.ts index 9ab7b930664..ae97e63adfd 100644 --- a/packages/grafana-ui/src/components/Select/types.ts +++ b/packages/grafana-ui/src/components/Select/types.ts @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { ActionMeta as SelectActionMeta, CommonProps as ReactSelectCommonProps, diff --git a/packages/grafana-ui/src/components/Slider/HandleTooltip.tsx b/packages/grafana-ui/src/components/Slider/HandleTooltip.tsx index 50845a0608d..9bdcc4d6952 100644 --- a/packages/grafana-ui/src/components/Slider/HandleTooltip.tsx +++ b/packages/grafana-ui/src/components/Slider/HandleTooltip.tsx @@ -1,6 +1,7 @@ import { css } from '@emotion/css'; import Tooltip, { TooltipRef } from 'rc-tooltip'; -import React, { useEffect, useRef } from 'react'; +import { useEffect, useRef } from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Slider/RangeSlider.story.tsx b/packages/grafana-ui/src/components/Slider/RangeSlider.story.tsx index f72558db309..0dc85ec4d05 100644 --- a/packages/grafana-ui/src/components/Slider/RangeSlider.story.tsx +++ b/packages/grafana-ui/src/components/Slider/RangeSlider.story.tsx @@ -1,5 +1,4 @@ import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { RangeSlider } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/Slider/RangeSlider.test.tsx b/packages/grafana-ui/src/components/Slider/RangeSlider.test.tsx index 081921efa8e..25c89e2dd4c 100644 --- a/packages/grafana-ui/src/components/Slider/RangeSlider.test.tsx +++ b/packages/grafana-ui/src/components/Slider/RangeSlider.test.tsx @@ -1,5 +1,4 @@ import { render } from '@testing-library/react'; -import React from 'react'; import { RangeSlider } from './RangeSlider'; import { RangeSliderProps } from './types'; diff --git a/packages/grafana-ui/src/components/Slider/RangeSlider.tsx b/packages/grafana-ui/src/components/Slider/RangeSlider.tsx index a95ca126ffb..34b9d403085 100644 --- a/packages/grafana-ui/src/components/Slider/RangeSlider.tsx +++ b/packages/grafana-ui/src/components/Slider/RangeSlider.tsx @@ -1,7 +1,7 @@ import { cx } from '@emotion/css'; import { Global } from '@emotion/react'; import Slider, { SliderProps } from 'rc-slider'; -import React, { useCallback } from 'react'; +import { useCallback } from 'react'; import { useStyles2 } from '../../themes/ThemeContext'; diff --git a/packages/grafana-ui/src/components/Slider/Slider.story.tsx b/packages/grafana-ui/src/components/Slider/Slider.story.tsx index 3c6910e546b..7e87faf6212 100644 --- a/packages/grafana-ui/src/components/Slider/Slider.story.tsx +++ b/packages/grafana-ui/src/components/Slider/Slider.story.tsx @@ -1,5 +1,4 @@ import { StoryFn, Meta } from '@storybook/react'; -import React from 'react'; import { Slider } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/Slider/Slider.test.tsx b/packages/grafana-ui/src/components/Slider/Slider.test.tsx index 97e0ed4fe2c..2723a180b3c 100644 --- a/packages/grafana-ui/src/components/Slider/Slider.test.tsx +++ b/packages/grafana-ui/src/components/Slider/Slider.test.tsx @@ -1,6 +1,5 @@ import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { Slider } from './Slider'; import { SliderProps } from './types'; diff --git a/packages/grafana-ui/src/components/Slider/Slider.tsx b/packages/grafana-ui/src/components/Slider/Slider.tsx index 4a52fb1ca33..5da049a3d0c 100644 --- a/packages/grafana-ui/src/components/Slider/Slider.tsx +++ b/packages/grafana-ui/src/components/Slider/Slider.tsx @@ -1,7 +1,7 @@ import { cx } from '@emotion/css'; import { Global } from '@emotion/react'; import SliderComponent from 'rc-slider'; -import React, { useState, useCallback, ChangeEvent, FocusEvent } from 'react'; +import { useState, useCallback, ChangeEvent, FocusEvent } from 'react'; import { useStyles2 } from '../../themes/ThemeContext'; import { Input } from '../Input/Input'; diff --git a/packages/grafana-ui/src/components/Sparkline/Sparkline.tsx b/packages/grafana-ui/src/components/Sparkline/Sparkline.tsx index 245baabee7c..1ecba02b578 100644 --- a/packages/grafana-ui/src/components/Sparkline/Sparkline.tsx +++ b/packages/grafana-ui/src/components/Sparkline/Sparkline.tsx @@ -1,5 +1,5 @@ import { isEqual } from 'lodash'; -import React, { PureComponent } from 'react'; +import { PureComponent } from 'react'; import { AlignedData, Range } from 'uplot'; import { diff --git a/packages/grafana-ui/src/components/Spinner/Spinner.story.tsx b/packages/grafana-ui/src/components/Spinner/Spinner.story.tsx index a2f0e76b988..f9531f3e48b 100644 --- a/packages/grafana-ui/src/components/Spinner/Spinner.story.tsx +++ b/packages/grafana-ui/src/components/Spinner/Spinner.story.tsx @@ -1,5 +1,4 @@ import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { Spinner } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/Spinner/Spinner.tsx b/packages/grafana-ui/src/components/Spinner/Spinner.tsx index 013f7332a2a..079aa3997d5 100644 --- a/packages/grafana-ui/src/components/Spinner/Spinner.tsx +++ b/packages/grafana-ui/src/components/Spinner/Spinner.tsx @@ -1,5 +1,5 @@ import { cx, css } from '@emotion/css'; -import React from 'react'; +import * as React from 'react'; import SVG from 'react-inlinesvg'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Splitter/useSplitter.story.tsx b/packages/grafana-ui/src/components/Splitter/useSplitter.story.tsx index ca929b79efc..9445b5ed53e 100644 --- a/packages/grafana-ui/src/components/Splitter/useSplitter.story.tsx +++ b/packages/grafana-ui/src/components/Splitter/useSplitter.story.tsx @@ -1,5 +1,4 @@ import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { Box } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/Splitter/useSplitter.ts b/packages/grafana-ui/src/components/Splitter/useSplitter.ts index 5f3b0b8e4a8..0ba04256876 100644 --- a/packages/grafana-ui/src/components/Splitter/useSplitter.ts +++ b/packages/grafana-ui/src/components/Splitter/useSplitter.ts @@ -1,6 +1,7 @@ import { css } from '@emotion/css'; import { clamp, throttle } from 'lodash'; -import React, { useCallback, useId, useLayoutEffect, useRef } from 'react'; +import { useCallback, useId, useLayoutEffect, useRef } from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/StatsPicker/StatsPicker.story.tsx b/packages/grafana-ui/src/components/StatsPicker/StatsPicker.story.tsx index 149afab4640..48317679183 100644 --- a/packages/grafana-ui/src/components/StatsPicker/StatsPicker.story.tsx +++ b/packages/grafana-ui/src/components/StatsPicker/StatsPicker.story.tsx @@ -1,6 +1,6 @@ import { action } from '@storybook/addon-actions'; import { Meta, StoryFn } from '@storybook/react'; -import React, { PureComponent } from 'react'; +import { PureComponent } from 'react'; import { StatsPicker } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/StatsPicker/StatsPicker.tsx b/packages/grafana-ui/src/components/StatsPicker/StatsPicker.tsx index 895f849104f..009ae565dfe 100644 --- a/packages/grafana-ui/src/components/StatsPicker/StatsPicker.tsx +++ b/packages/grafana-ui/src/components/StatsPicker/StatsPicker.tsx @@ -1,5 +1,5 @@ import { difference } from 'lodash'; -import React, { PureComponent } from 'react'; +import { PureComponent } from 'react'; import { fieldReducers, SelectableValue, FieldReducerInfo } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Switch/Switch.story.tsx b/packages/grafana-ui/src/components/Switch/Switch.story.tsx index 12bbef7d675..3243e072f76 100644 --- a/packages/grafana-ui/src/components/Switch/Switch.story.tsx +++ b/packages/grafana-ui/src/components/Switch/Switch.story.tsx @@ -1,5 +1,6 @@ import { Meta, StoryFn } from '@storybook/react'; -import React, { useState, useCallback } from 'react'; +import { useState, useCallback } from 'react'; +import * as React from 'react'; import { InlineField, Switch, InlineSwitch } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/Switch/Switch.tsx b/packages/grafana-ui/src/components/Switch/Switch.tsx index bee3ea4949f..53414c56aa6 100644 --- a/packages/grafana-ui/src/components/Switch/Switch.tsx +++ b/packages/grafana-ui/src/components/Switch/Switch.tsx @@ -1,6 +1,6 @@ import { css, cx } from '@emotion/css'; import { uniqueId } from 'lodash'; -import React, { HTMLProps, useRef } from 'react'; +import { forwardRef, HTMLProps, useRef } from 'react'; import { GrafanaTheme2, deprecationWarning } from '@grafana/data'; @@ -14,7 +14,7 @@ export interface Props extends Omit, 'value'> { invalid?: boolean; } -export const Switch = React.forwardRef( +export const Switch = forwardRef( ({ value, checked, onChange, id, label, disabled, invalid = false, ...inputProps }, ref) => { if (checked) { deprecationWarning('Switch', 'checked prop', 'value'); @@ -53,7 +53,7 @@ export interface InlineSwitchProps extends Props { transparent?: boolean; } -export const InlineSwitch = React.forwardRef( +export const InlineSwitch = forwardRef( ({ transparent, className, showLabel, label, value, id, invalid, ...props }, ref) => { const styles = useStyles2(getSwitchStyles, transparent); diff --git a/packages/grafana-ui/src/components/TabbedContainer/TabbedContainer.tsx b/packages/grafana-ui/src/components/TabbedContainer/TabbedContainer.tsx index 59e635a3c28..3feff5be763 100644 --- a/packages/grafana-ui/src/components/TabbedContainer/TabbedContainer.tsx +++ b/packages/grafana-ui/src/components/TabbedContainer/TabbedContainer.tsx @@ -1,5 +1,6 @@ import { css } from '@emotion/css'; -import React, { useState } from 'react'; +import { useState } from 'react'; +import * as React from 'react'; import { SelectableValue, GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Table/BarGaugeCell.tsx b/packages/grafana-ui/src/components/Table/BarGaugeCell.tsx index 4580c37ae6b..9bc9e199afb 100644 --- a/packages/grafana-ui/src/components/Table/BarGaugeCell.tsx +++ b/packages/grafana-ui/src/components/Table/BarGaugeCell.tsx @@ -1,5 +1,4 @@ import { isFunction } from 'lodash'; -import React from 'react'; import { ThresholdsConfig, ThresholdsMode, VizOrientation, getFieldConfigWithMinMax } from '@grafana/data'; import { BarGaugeDisplayMode, BarGaugeValueMode, TableCellDisplayMode } from '@grafana/schema'; diff --git a/packages/grafana-ui/src/components/Table/CellActions.tsx b/packages/grafana-ui/src/components/Table/CellActions.tsx index c7455711747..e5908664428 100644 --- a/packages/grafana-ui/src/components/Table/CellActions.tsx +++ b/packages/grafana-ui/src/components/Table/CellActions.tsx @@ -1,4 +1,5 @@ -import React, { useCallback, useState } from 'react'; +import { useCallback, useState } from 'react'; +import * as React from 'react'; import { IconSize } from '../../types/icon'; import { IconButton } from '../IconButton/IconButton'; diff --git a/packages/grafana-ui/src/components/Table/DataLinksCell.tsx b/packages/grafana-ui/src/components/Table/DataLinksCell.tsx index 45d8d3eb093..9a6383039e1 100644 --- a/packages/grafana-ui/src/components/Table/DataLinksCell.tsx +++ b/packages/grafana-ui/src/components/Table/DataLinksCell.tsx @@ -1,5 +1,3 @@ -import React from 'react'; - import { getCellLinks } from '../../utils'; import { TableCellProps } from './types'; diff --git a/packages/grafana-ui/src/components/Table/DefaultCell.tsx b/packages/grafana-ui/src/components/Table/DefaultCell.tsx index 0a910f07eda..37e115e2259 100644 --- a/packages/grafana-ui/src/components/Table/DefaultCell.tsx +++ b/packages/grafana-ui/src/components/Table/DefaultCell.tsx @@ -1,5 +1,6 @@ import { cx } from '@emotion/css'; -import React, { ReactElement, useState } from 'react'; +import { ReactElement, useState } from 'react'; +import * as React from 'react'; import { DisplayValue, formattedValueToString } from '@grafana/data'; import { TableCellDisplayMode } from '@grafana/schema'; diff --git a/packages/grafana-ui/src/components/Table/ExpandedRow.tsx b/packages/grafana-ui/src/components/Table/ExpandedRow.tsx index 113c31aaa40..a7e8f56f767 100644 --- a/packages/grafana-ui/src/components/Table/ExpandedRow.tsx +++ b/packages/grafana-ui/src/components/Table/ExpandedRow.tsx @@ -1,5 +1,6 @@ import { css } from '@emotion/css'; -import React, { CSSProperties } from 'react'; +import { CSSProperties } from 'react'; +import * as React from 'react'; import { DataFrame, Field, GrafanaTheme2 } from '@grafana/data'; import { TableCellHeight } from '@grafana/schema'; diff --git a/packages/grafana-ui/src/components/Table/Filter.tsx b/packages/grafana-ui/src/components/Table/Filter.tsx index dd5b4ca8ba6..572fa6f5347 100644 --- a/packages/grafana-ui/src/components/Table/Filter.tsx +++ b/packages/grafana-ui/src/components/Table/Filter.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React, { useCallback, useMemo, useRef, useState } from 'react'; +import { useCallback, useMemo, useRef, useState } from 'react'; import { Field, GrafanaTheme2, SelectableValue } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Table/FilterList.tsx b/packages/grafana-ui/src/components/Table/FilterList.tsx index 1ea721809d5..e4ca6d19df8 100644 --- a/packages/grafana-ui/src/components/Table/FilterList.tsx +++ b/packages/grafana-ui/src/components/Table/FilterList.tsx @@ -1,5 +1,6 @@ import { css, cx } from '@emotion/css'; -import React, { useCallback, useMemo } from 'react'; +import { useCallback, useMemo } from 'react'; +import * as React from 'react'; import { FixedSizeList as List } from 'react-window'; import { GrafanaTheme2, formattedValueToString, getValueFormat, SelectableValue } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Table/FilterPopup.tsx b/packages/grafana-ui/src/components/Table/FilterPopup.tsx index a8f6b675a35..9b3071d549a 100644 --- a/packages/grafana-ui/src/components/Table/FilterPopup.tsx +++ b/packages/grafana-ui/src/components/Table/FilterPopup.tsx @@ -1,5 +1,6 @@ import { css, cx } from '@emotion/css'; -import React, { useCallback, useMemo, useState } from 'react'; +import { useCallback, useMemo, useState } from 'react'; +import * as React from 'react'; import { Field, GrafanaTheme2, SelectableValue } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Table/FooterCell.tsx b/packages/grafana-ui/src/components/Table/FooterCell.tsx index 992ecae9b5a..72393d91140 100644 --- a/packages/grafana-ui/src/components/Table/FooterCell.tsx +++ b/packages/grafana-ui/src/components/Table/FooterCell.tsx @@ -1,5 +1,4 @@ import { css } from '@emotion/css'; -import React from 'react'; import { KeyValue } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Table/FooterRow.tsx b/packages/grafana-ui/src/components/Table/FooterRow.tsx index 83c8c0e6cd5..10321992b45 100644 --- a/packages/grafana-ui/src/components/Table/FooterRow.tsx +++ b/packages/grafana-ui/src/components/Table/FooterRow.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { ColumnInstance, HeaderGroup } from 'react-table'; import { fieldReducers, ReducerID } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Table/GeoCell.tsx b/packages/grafana-ui/src/components/Table/GeoCell.tsx index 1ac13627427..d5e156f8b70 100644 --- a/packages/grafana-ui/src/components/Table/GeoCell.tsx +++ b/packages/grafana-ui/src/components/Table/GeoCell.tsx @@ -1,6 +1,5 @@ import WKT from 'ol/format/WKT'; import { Geometry } from 'ol/geom'; -import React from 'react'; import { TableCellProps } from './types'; diff --git a/packages/grafana-ui/src/components/Table/HeaderRow.tsx b/packages/grafana-ui/src/components/Table/HeaderRow.tsx index 2bd1ef04801..6f3fc92fcaa 100644 --- a/packages/grafana-ui/src/components/Table/HeaderRow.tsx +++ b/packages/grafana-ui/src/components/Table/HeaderRow.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { HeaderGroup, Column } from 'react-table'; import { Field } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Table/ImageCell.tsx b/packages/grafana-ui/src/components/Table/ImageCell.tsx index 6732bb6c54f..3f507aff232 100644 --- a/packages/grafana-ui/src/components/Table/ImageCell.tsx +++ b/packages/grafana-ui/src/components/Table/ImageCell.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { getCellLinks } from '../../utils'; import { DataLinksContextMenu } from '../DataLinks/DataLinksContextMenu'; diff --git a/packages/grafana-ui/src/components/Table/JSONViewCell.tsx b/packages/grafana-ui/src/components/Table/JSONViewCell.tsx index d7840fb339d..ba5691b2c7e 100644 --- a/packages/grafana-ui/src/components/Table/JSONViewCell.tsx +++ b/packages/grafana-ui/src/components/Table/JSONViewCell.tsx @@ -1,6 +1,5 @@ import { css, cx } from '@emotion/css'; import { isString } from 'lodash'; -import React from 'react'; import { useStyles2 } from '../../themes'; import { getCellLinks } from '../../utils'; diff --git a/packages/grafana-ui/src/components/Table/RowExpander.tsx b/packages/grafana-ui/src/components/Table/RowExpander.tsx index 17366aed255..ca678472cab 100644 --- a/packages/grafana-ui/src/components/Table/RowExpander.tsx +++ b/packages/grafana-ui/src/components/Table/RowExpander.tsx @@ -1,5 +1,3 @@ -import React from 'react'; - import { Icon } from '../Icon/Icon'; import { TableStyles } from './styles'; diff --git a/packages/grafana-ui/src/components/Table/RowsList.tsx b/packages/grafana-ui/src/components/Table/RowsList.tsx index aa061dd1bc1..29ee0701a7a 100644 --- a/packages/grafana-ui/src/components/Table/RowsList.tsx +++ b/packages/grafana-ui/src/components/Table/RowsList.tsx @@ -1,5 +1,6 @@ import { css, cx } from '@emotion/css'; -import React, { CSSProperties, UIEventHandler, useCallback, useEffect, useMemo, useState } from 'react'; +import { CSSProperties, UIEventHandler, useCallback, useEffect, useMemo, useState } from 'react'; +import * as React from 'react'; import { Cell, Row, TableState, HeaderGroup } from 'react-table'; import { VariableSizeList } from 'react-window'; import { Subscription, debounceTime } from 'rxjs'; diff --git a/packages/grafana-ui/src/components/Table/SparklineCell.tsx b/packages/grafana-ui/src/components/Table/SparklineCell.tsx index bfb1b8e5eb0..3c047c0fdf0 100644 --- a/packages/grafana-ui/src/components/Table/SparklineCell.tsx +++ b/packages/grafana-ui/src/components/Table/SparklineCell.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { FieldType, diff --git a/packages/grafana-ui/src/components/Table/Table.story.tsx b/packages/grafana-ui/src/components/Table/Table.story.tsx index 596e5baa134..4fa86ae69a4 100644 --- a/packages/grafana-ui/src/components/Table/Table.story.tsx +++ b/packages/grafana-ui/src/components/Table/Table.story.tsx @@ -1,6 +1,5 @@ import { Meta, StoryFn } from '@storybook/react'; import { merge } from 'lodash'; -import React from 'react'; import { DataFrame, diff --git a/packages/grafana-ui/src/components/Table/Table.test.tsx b/packages/grafana-ui/src/components/Table/Table.test.tsx index 0910e889cca..c59b8dbb798 100644 --- a/packages/grafana-ui/src/components/Table/Table.test.tsx +++ b/packages/grafana-ui/src/components/Table/Table.test.tsx @@ -1,6 +1,5 @@ import { render, screen, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import React from 'react'; import { applyFieldOverrides, createTheme, DataFrame, FieldType, toDataFrame } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Table/Table.tsx b/packages/grafana-ui/src/components/Table/Table.tsx index 43acfb25fdb..3beb04bda7c 100644 --- a/packages/grafana-ui/src/components/Table/Table.tsx +++ b/packages/grafana-ui/src/components/Table/Table.tsx @@ -1,4 +1,4 @@ -import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'; +import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { useAbsoluteLayout, useExpanded, diff --git a/packages/grafana-ui/src/components/Table/TableCell.tsx b/packages/grafana-ui/src/components/Table/TableCell.tsx index 4c4b4a0e501..56649902761 100644 --- a/packages/grafana-ui/src/components/Table/TableCell.tsx +++ b/packages/grafana-ui/src/components/Table/TableCell.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { Cell } from 'react-table'; import { TimeRange, DataFrame } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Table/TableCellInspector.tsx b/packages/grafana-ui/src/components/Table/TableCellInspector.tsx index cca2b8a7385..7cc49f706b6 100644 --- a/packages/grafana-ui/src/components/Table/TableCellInspector.tsx +++ b/packages/grafana-ui/src/components/Table/TableCellInspector.tsx @@ -1,5 +1,4 @@ import { isString } from 'lodash'; -import React from 'react'; import { ClipboardButton } from '../ClipboardButton/ClipboardButton'; import { Drawer } from '../Drawer/Drawer'; diff --git a/packages/grafana-ui/src/components/Table/hooks.ts b/packages/grafana-ui/src/components/Table/hooks.ts index f6060fd15c5..bb9b6b13d0c 100644 --- a/packages/grafana-ui/src/components/Table/hooks.ts +++ b/packages/grafana-ui/src/components/Table/hooks.ts @@ -1,4 +1,5 @@ -import React, { useEffect } from 'react'; +import { useEffect } from 'react'; +import * as React from 'react'; import { VariableSizeList } from 'react-window'; import { DataFrame } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/TableInputCSV/TableInputCSV.internal.story.tsx b/packages/grafana-ui/src/components/TableInputCSV/TableInputCSV.internal.story.tsx index f2fe55ed5d6..ccac99b8644 100644 --- a/packages/grafana-ui/src/components/TableInputCSV/TableInputCSV.internal.story.tsx +++ b/packages/grafana-ui/src/components/TableInputCSV/TableInputCSV.internal.story.tsx @@ -1,6 +1,5 @@ import { action } from '@storybook/addon-actions'; import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { DataFrame } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/TableInputCSV/TableInputCSV.test.tsx b/packages/grafana-ui/src/components/TableInputCSV/TableInputCSV.test.tsx index 246352eff1b..4bbc69352c3 100644 --- a/packages/grafana-ui/src/components/TableInputCSV/TableInputCSV.test.tsx +++ b/packages/grafana-ui/src/components/TableInputCSV/TableInputCSV.test.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import renderer from 'react-test-renderer'; import { DataFrame } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/TableInputCSV/TableInputCSV.tsx b/packages/grafana-ui/src/components/TableInputCSV/TableInputCSV.tsx index 2486ff9cc71..8070fd613b4 100644 --- a/packages/grafana-ui/src/components/TableInputCSV/TableInputCSV.tsx +++ b/packages/grafana-ui/src/components/TableInputCSV/TableInputCSV.tsx @@ -1,6 +1,7 @@ import { css } from '@emotion/css'; import { debounce } from 'lodash'; -import React, { PureComponent } from 'react'; +import { PureComponent } from 'react'; +import * as React from 'react'; import { DataFrame, CSVConfig, readCSV, GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Tabs/Counter.tsx b/packages/grafana-ui/src/components/Tabs/Counter.tsx index 8a8c507bff2..c224e3d129d 100644 --- a/packages/grafana-ui/src/components/Tabs/Counter.tsx +++ b/packages/grafana-ui/src/components/Tabs/Counter.tsx @@ -1,5 +1,4 @@ import { css } from '@emotion/css'; -import React from 'react'; import { GrafanaTheme2, locale } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Tabs/Tab.tsx b/packages/grafana-ui/src/components/Tabs/Tab.tsx index 109637fedcd..02980a66860 100644 --- a/packages/grafana-ui/src/components/Tabs/Tab.tsx +++ b/packages/grafana-ui/src/components/Tabs/Tab.tsx @@ -1,5 +1,6 @@ import { css, cx } from '@emotion/css'; -import React, { HTMLProps } from 'react'; +import { HTMLProps } from 'react'; +import * as React from 'react'; import { GrafanaTheme2, NavModelItem } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; diff --git a/packages/grafana-ui/src/components/Tabs/TabContent.tsx b/packages/grafana-ui/src/components/Tabs/TabContent.tsx index 76c7b88f182..e7259f7e823 100644 --- a/packages/grafana-ui/src/components/Tabs/TabContent.tsx +++ b/packages/grafana-ui/src/components/Tabs/TabContent.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React, { HTMLAttributes, ReactNode } from 'react'; +import { HTMLAttributes, ReactNode } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Tabs/Tabs.story.tsx b/packages/grafana-ui/src/components/Tabs/Tabs.story.tsx index b3c51675d0b..e78bff5ae9c 100644 --- a/packages/grafana-ui/src/components/Tabs/Tabs.story.tsx +++ b/packages/grafana-ui/src/components/Tabs/Tabs.story.tsx @@ -1,5 +1,5 @@ import { Meta, StoryFn } from '@storybook/react'; -import React, { useState } from 'react'; +import { useState } from 'react'; import { TabsBar, Tab, TabContent, Counter as TabCounter } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/Tabs/TabsBar.tsx b/packages/grafana-ui/src/components/Tabs/TabsBar.tsx index d886e924647..99d2e8c3b18 100644 --- a/packages/grafana-ui/src/components/Tabs/TabsBar.tsx +++ b/packages/grafana-ui/src/components/Tabs/TabsBar.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React, { ReactNode } from 'react'; +import { forwardRef, ReactNode } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; @@ -13,7 +13,7 @@ export interface Props { hideBorder?: boolean; } -export const TabsBar = React.forwardRef(({ children, className, hideBorder = false }, ref) => { +export const TabsBar = forwardRef(({ children, className, hideBorder = false }, ref) => { const styles = useStyles2(getStyles); return ( diff --git a/packages/grafana-ui/src/components/Tabs/VerticalTab.tsx b/packages/grafana-ui/src/components/Tabs/VerticalTab.tsx index 06e00a1042e..eb235089dfa 100644 --- a/packages/grafana-ui/src/components/Tabs/VerticalTab.tsx +++ b/packages/grafana-ui/src/components/Tabs/VerticalTab.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React from 'react'; +import { forwardRef } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; @@ -10,7 +10,7 @@ import { Icon } from '../Icon/Icon'; import { Counter } from './Counter'; import { TabProps } from './Tab'; -export const VerticalTab = React.forwardRef( +export const VerticalTab = forwardRef( ({ label, active, icon, counter, className, suffix: Suffix, onChangeTab, href, ...otherProps }, ref) => { const tabsStyles = useStyles2(getTabStyles); const content = () => ( diff --git a/packages/grafana-ui/src/components/Tags/Tag.story.tsx b/packages/grafana-ui/src/components/Tags/Tag.story.tsx index 47d74a6b831..3610fa381fe 100644 --- a/packages/grafana-ui/src/components/Tags/Tag.story.tsx +++ b/packages/grafana-ui/src/components/Tags/Tag.story.tsx @@ -1,6 +1,5 @@ import { action } from '@storybook/addon-actions'; import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { Tag } from './Tag'; import mdx from './Tag.mdx'; diff --git a/packages/grafana-ui/src/components/Tags/Tag.tsx b/packages/grafana-ui/src/components/Tags/Tag.tsx index 81a857ee4ff..a5e9c4912e3 100644 --- a/packages/grafana-ui/src/components/Tags/Tag.tsx +++ b/packages/grafana-ui/src/components/Tags/Tag.tsx @@ -1,5 +1,6 @@ import { cx, css } from '@emotion/css'; -import React, { forwardRef, HTMLAttributes } from 'react'; +import { forwardRef, HTMLAttributes } from 'react'; +import * as React from 'react'; import Skeleton from 'react-loading-skeleton'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Tags/TagList.story.tsx b/packages/grafana-ui/src/components/Tags/TagList.story.tsx index 6178d8a6bbd..56acb2e3f39 100644 --- a/packages/grafana-ui/src/components/Tags/TagList.story.tsx +++ b/packages/grafana-ui/src/components/Tags/TagList.story.tsx @@ -1,6 +1,5 @@ import { action } from '@storybook/addon-actions'; import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { TagList } from './TagList'; import mdx from './TagList.mdx'; diff --git a/packages/grafana-ui/src/components/Tags/TagList.tsx b/packages/grafana-ui/src/components/Tags/TagList.tsx index fefd90c4b4c..df317ca12f3 100644 --- a/packages/grafana-ui/src/components/Tags/TagList.tsx +++ b/packages/grafana-ui/src/components/Tags/TagList.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React, { forwardRef, memo } from 'react'; +import { forwardRef, memo } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/TagsInput/TagItem.tsx b/packages/grafana-ui/src/components/TagsInput/TagItem.tsx index c74f573ded1..1e7019c456f 100644 --- a/packages/grafana-ui/src/components/TagsInput/TagItem.tsx +++ b/packages/grafana-ui/src/components/TagsInput/TagItem.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { useMemo } from 'react'; +import { useMemo } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/TagsInput/TagsInput.story.tsx b/packages/grafana-ui/src/components/TagsInput/TagsInput.story.tsx index b0d830469bd..295357be5e3 100644 --- a/packages/grafana-ui/src/components/TagsInput/TagsInput.story.tsx +++ b/packages/grafana-ui/src/components/TagsInput/TagsInput.story.tsx @@ -1,5 +1,5 @@ import { Meta, StoryFn } from '@storybook/react'; -import React, { useState } from 'react'; +import { useState } from 'react'; import { StoryExample } from '../../utils/storybook/StoryExample'; diff --git a/packages/grafana-ui/src/components/TagsInput/TagsInput.test.tsx b/packages/grafana-ui/src/components/TagsInput/TagsInput.test.tsx index 950f111a24f..5ea09e6f8da 100644 --- a/packages/grafana-ui/src/components/TagsInput/TagsInput.test.tsx +++ b/packages/grafana-ui/src/components/TagsInput/TagsInput.test.tsx @@ -1,5 +1,4 @@ import { render, fireEvent, screen } from '@testing-library/react'; -import React from 'react'; import { TagsInput } from './TagsInput'; diff --git a/packages/grafana-ui/src/components/TagsInput/TagsInput.tsx b/packages/grafana-ui/src/components/TagsInput/TagsInput.tsx index be1c1b0e2ad..38bec70cf1c 100644 --- a/packages/grafana-ui/src/components/TagsInput/TagsInput.tsx +++ b/packages/grafana-ui/src/components/TagsInput/TagsInput.tsx @@ -1,5 +1,6 @@ import { css, cx } from '@emotion/css'; -import React, { useCallback, useState } from 'react'; +import { useCallback, useState } from 'react'; +import * as React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Text/Text.story.tsx b/packages/grafana-ui/src/components/Text/Text.story.tsx index 1d14299d916..07071f64b02 100644 --- a/packages/grafana-ui/src/components/Text/Text.story.tsx +++ b/packages/grafana-ui/src/components/Text/Text.story.tsx @@ -1,5 +1,4 @@ import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { StoryExample } from '../../utils/storybook/StoryExample'; import { Stack } from '../Layout/Stack/Stack'; diff --git a/packages/grafana-ui/src/components/Text/Text.test.tsx b/packages/grafana-ui/src/components/Text/Text.test.tsx index f05d37d06a6..bd0965c27cb 100644 --- a/packages/grafana-ui/src/components/Text/Text.test.tsx +++ b/packages/grafana-ui/src/components/Text/Text.test.tsx @@ -1,5 +1,4 @@ import { render, screen } from '@testing-library/react'; -import React from 'react'; import { createTheme, ThemeTypographyVariantTypes } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Text/Text.tsx b/packages/grafana-ui/src/components/Text/Text.tsx index 0ffa52e7e88..2978f6448da 100644 --- a/packages/grafana-ui/src/components/Text/Text.tsx +++ b/packages/grafana-ui/src/components/Text/Text.tsx @@ -1,5 +1,6 @@ import { css } from '@emotion/css'; -import React, { createElement, CSSProperties } from 'react'; +import { createElement, CSSProperties } from 'react'; +import * as React from 'react'; import { GrafanaTheme2, ThemeTypographyVariantTypes } from '@grafana/data'; diff --git a/packages/grafana-ui/src/components/Text/TruncatedText.tsx b/packages/grafana-ui/src/components/Text/TruncatedText.tsx index e74cbd36bb7..349c111eb0c 100644 --- a/packages/grafana-ui/src/components/Text/TruncatedText.tsx +++ b/packages/grafana-ui/src/components/Text/TruncatedText.tsx @@ -1,4 +1,5 @@ -import React, { useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react'; +import { useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react'; +import * as React from 'react'; import ReactDOMServer from 'react-dom/server'; import { Tooltip } from '../Tooltip/Tooltip'; diff --git a/packages/grafana-ui/src/components/Text/Typography.internal.story.tsx b/packages/grafana-ui/src/components/Text/Typography.internal.story.tsx index d7014936a02..d9c347a4bf7 100644 --- a/packages/grafana-ui/src/components/Text/Typography.internal.story.tsx +++ b/packages/grafana-ui/src/components/Text/Typography.internal.story.tsx @@ -1,5 +1,6 @@ import { Meta, StoryFn } from '@storybook/react'; -import React, { useState } from 'react'; +import { useState } from 'react'; +import * as React from 'react'; import { Divider } from '../Divider/Divider'; import { Field } from '../Forms/Field'; diff --git a/packages/grafana-ui/src/components/TextArea/TextArea.story.tsx b/packages/grafana-ui/src/components/TextArea/TextArea.story.tsx index 9cf01ad61b2..cec604d0cf2 100644 --- a/packages/grafana-ui/src/components/TextArea/TextArea.story.tsx +++ b/packages/grafana-ui/src/components/TextArea/TextArea.story.tsx @@ -1,5 +1,4 @@ import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { TextArea } from '@grafana/ui'; diff --git a/packages/grafana-ui/src/components/TextArea/TextArea.tsx b/packages/grafana-ui/src/components/TextArea/TextArea.tsx index 5f438b9982c..b7002bc5742 100644 --- a/packages/grafana-ui/src/components/TextArea/TextArea.tsx +++ b/packages/grafana-ui/src/components/TextArea/TextArea.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React, { HTMLProps } from 'react'; +import { forwardRef, HTMLProps } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; @@ -11,7 +11,7 @@ export interface Props extends Omit, 'size'> { invalid?: boolean; } -export const TextArea = React.forwardRef(({ invalid, className, ...props }, ref) => { +export const TextArea = forwardRef(({ invalid, className, ...props }, ref) => { const styles = useStyles2(getTextAreaStyle, invalid); return