Skip to content

[BUGFIX] Prometheus: Fix notch in Prometheus Datasource Select#73

Merged
andreasgerstmayr merged 3 commits intoperses:mainfrom
andreasgerstmayr:prometheus-datasource-select-fix-notch
Mar 19, 2025
Merged

[BUGFIX] Prometheus: Fix notch in Prometheus Datasource Select#73
andreasgerstmayr merged 3 commits intoperses:mainfrom
andreasgerstmayr:prometheus-datasource-select-fix-notch

Conversation

@andreasgerstmayr
Copy link
Contributor

@andreasgerstmayr andreasgerstmayr commented Mar 10, 2025

The MUI <FormControl> usually detects if the <Select> child component is filled, and shrinks and adds a notch to the Select to place the label. However, this only works if the child component is a MUI component: https://github.com/mui/material-ui/blob/4c3f5179a9edd778a1cc0e8457034e5109d66f7f/packages/mui-material/src/FormControl/FormControl.js#L149-L164

In our case, the child is a <DatasourceSelect>, and this algorithm doesn't work, it doesn't add the notch and doesn't shrink the label, i.e. the label now overlaps the selected value:
Bildschirmfoto vom 2025-03-10 14-26-03

This can be fixed by explicitly setting shrink on the <InputLabel> and notched on the <Select>:
Bildschirmfoto vom 2025-03-10 14-26-36

Requires perses/perses#2731 to be merged first.

Signed-off-by: Andreas Gerstmayr <agerstmayr@redhat.com>
@Nexucis
Copy link
Member

Nexucis commented Mar 10, 2025

I guess the same fix should be done for Tempo :)

Signed-off-by: Andreas Gerstmayr <agerstmayr@redhat.com>
@andreasgerstmayr
Copy link
Contributor Author

I guess the same fix should be done for Tempo :)

I thought initially I create a separate PR for Tempo, but the change is small enough, so I added it here now :)

@Nexucis
Copy link
Member

Nexucis commented Mar 10, 2025

With the Perses release, you should be good here to update.

Copy link
Member

@Nexucis Nexucis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice fix !

As a side note, I don't know if someone noticed, but there is a lot of warning in the build:

File: /home/runner/work/plugins/plugins/node_modules/@perses-dev/components/dist/Legend/Legend.js:1:1
  ⚠ No required version specified and unable to automatically determine one. Unable to find required version for "immer" in description file/s
  │ /home/runner/work/plugins/plugins/package.json
  │ /home/runner/work/plugins/plugins/node_modules/@perses-dev/components/package.json
  │ It need to be in dependencies, devDependencies or peerDependencies. file: shared module immer
 @ ../node_modules/@perses-dev/components/dist/Legend/index.js
 @ ../node_modules/@perses-dev/components/dist/index.js
 @ consume shared module (default) @perses-dev/components@^0.51.0-beta.0 (strict) (fallback: /home/runner/work/plugins/plugins/node_modules/@perses-dev/components/dist/index.js)
 @ ./src/BarChartOptionsEditorSettings.tsx
 @ ./src/BarChart.ts
 @ container entry
File: /home/runner/work/plugins/plugins/node_modules/@perses-dev/components/dist/ThresholdsEditor/ThresholdsEditor.js:1:1
  ⚠ No required version specified and unable to automatically determine one. Unable to find required version for "immer" in description file/s
  │ /home/runner/work/plugins/plugins/node_modules/@perses-dev/components/package.json
  │ /home/runner/work/plugins/plugins/package.json
  │ It need to be in dependencies, devDependencies or peerDependencies. file: shared module immer
 @ ../node_modules/@perses-dev/components/dist/ThresholdsEditor/index.js
 @ ../node_modules/@perses-dev/components/dist/index.js
 @ consume shared module (default) @perses-dev/components@^0.51.0-beta.0 (strict) (fallback: /home/runner/work/plugins/plugins/node_modules/@perses-dev/components/dist/index.js)
 @ ./src/BarChartOptionsEditorSettings.tsx
 @ ./src/BarChart.ts
 @ container entry
File: /home/runner/work/plugins/plugins/node_modules/@perses-dev/plugin-system/dist/remote/PluginRuntime.js:1:1
  ⚠ No required version specified and unable to automatically determine one. Unable to find required version for "@emotion/styled" in description file/s
  │ /home/runner/work/plugins/plugins/node_modules/@perses-dev/plugin-system/package.json
  │ /home/runner/work/plugins/plugins/package.json
  │ It need to be in dependencies, devDependencies or peerDependencies. file: shared module @emotion/styled
 @ ../node_modules/@perses-dev/plugin-system/dist/remote/remotePluginLoader.js
 @ ../node_modules/@perses-dev/plugin-system/dist/remote/index.js
 @ ../node_modules/@perses-dev/plugin-system/dist/index.js
 @ consume shared module (default) @perses-dev/plugin-system@^0.51.0-beta.0 (strict) (fallback: /home/runner/work/plugins/plugins/node_modules/@perses-dev/plugin-system/dist/index.js)
 @ ./src/BarChartOptionsEditorSettings.tsx
 @ ./src/BarChart.ts
 @ container entry
File: /home/runner/work/plugins/plugins/node_modules/@perses-dev/plugin-system/dist/remote/PluginRuntime.js:1:1
  ⚠ No required version specified and unable to automatically determine one. Unable to find required version for "lodash" in description file/s
  │ /home/runner/work/plugins/plugins/node_modules/@perses-dev/plugin-system/package.json
  │ /home/runner/work/plugins/plugins/package.json
  │ It need to be in dependencies, devDependencies or peerDependencies. file: shared module lodash
 @ ../node_modules/@perses-dev/plugin-system/dist/remote/remotePluginLoader.js
 @ ../node_modules/@perses-dev/plugin-system/dist/remote/index.js
 @ ../node_modules/@perses-dev/plugin-system/dist/index.js
 @ consume shared module (default) @perses-dev/plugin-system@^0.51.0-beta.0 (strict) (fallback: /home/runner/work/plugins/plugins/node_modules/@perses-dev/plugin-system/dist/index.js)
 @ ./src/BarChartOptionsEditorSettings.tsx
 @ ./src/BarChart.ts
 @ container entry
File: /home/runner/work/plugins/plugins/node_modules/@perses-dev/plugin-system/dist/remote/PluginRuntime.js:1:1
  ⚠ No required version specified and unable to automatically determine one. Unable to find required version for "date-fns-tz" in description file/s
  │ /home/runner/work/plugins/plugins/package.json
  │ /home/runner/work/plugins/plugins/node_modules/@perses-dev/plugin-system/package.json
  │ It need to be in dependencies, devDependencies or peerDependencies. file: shared module date-fns-tz
 @ ../node_modules/@perses-dev/plugin-system/dist/remote/remotePluginLoader.js
 @ ../node_modules/@perses-dev/plugin-system/dist/remote/index.js
 @ ../node_modules/@perses-dev/plugin-system/dist/index.js
 @ consume shared module (default) @perses-dev/plugin-system@^0.51.0-beta.0 (strict) (fallback: /home/runner/work/plugins/plugins/node_modules/@perses-dev/plugin-system/dist/index.js)
 @ ./src/BarChartOptionsEditorSettings.tsx
 @ ./src/BarChart.ts
 @ container entry
File: /home/runner/work/plugins/plugins/node_modules/@perses-dev/plugin-system/dist/remote/PluginRuntime.js:1:1
  ⚠ No required version specified and unable to automatically determine one. Unable to find required version for "echarts" in description file/s
  │ /home/runner/work/plugins/plugins/package.json
  │ /home/runner/work/plugins/plugins/node_modules/@perses-dev/plugin-system/package.json
  │ It need to be in dependencies, devDependencies or peerDependencies. file: shared module echarts
 @ ../node_modules/@perses-dev/plugin-system/dist/remote/remotePluginLoader.js
 @ ../node_modules/@perses-dev/plugin-system/dist/remote/index.js
 @ ../node_modules/@perses-dev/plugin-system/dist/index.js
 @ consume shared module (default) @perses-dev/plugin-system@^0.51.0-beta.0 (strict) (fallback: /home/runner/work/plugins/plugins/node_modules/@perses-dev/plugin-system/dist/index.js)
 @ ./src/BarChartOptionsEditorSettings.tsx
 @ ./src/BarChart.ts
 @ container entry

@andreasgerstmayr
Copy link
Contributor Author

I've created #92 for the module federation warnings.

@andreasgerstmayr andreasgerstmayr merged commit 1660509 into perses:main Mar 19, 2025
5 checks passed
coleenquadros pushed a commit to coleenquadros/plugins that referenced this pull request Jul 9, 2025
Add dashboard for Kube Controller Manager
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants