greghesp / ha-bambulab

A Home Assistant Integration for Bambu Lab Printers
698 stars 59 forks source link

[Bug] File name overflows in dashboard if too long #473

Closed moebis closed 4 months ago

moebis commented 4 months ago

Describe the bug

As the title says, picture is a thousand words:

Screenshot 2024-02-24 at 12 45 12 PM

To Reproduce

Print a file with a long enough filename to overflow.

Expected Behaviour

ellipsis ... to truncate

What device are you using?

X1C

Diagnostic Output

Not nessesary

Log Extracts

No response

Other Information

No response

AdrianGarside commented 4 months ago

This is a home assistant bug so you'll need to log a bug on the home assistant github. This integration has no involvement in what's rendered in the dashboard - it just provides the data.

moebis commented 4 months ago

@AdrianGarside ...nope, this is a bug with your code. Everything else respects the truncation in Home Assistant. Its just your add on that has this issue out of dozens that I run:

image
moebis commented 4 months ago

even continuous names with underscores

image
AdrianGarside commented 4 months ago

Those aren't the same thing. The strings being truncated there are the sensor names not the sensor content. And home assistant is the one doing that. There is literally not a single line of code in the integration that has any direct control over the home assistant UX. All it does is provide data.

AdrianGarside commented 4 months ago

Here is an example of a sensor name from this integration being truncated exactly as in you two screen snips above: image

moebis commented 4 months ago

It's because you're not using a property name, just a cloud icon and then the 1st element is the filename, try adding "File:" in the 1st column, and move the filename to the 2nd. If you see how you have "X1C Print..." and then the 3rd element "Smooth PEI" it's fine. I think this is the reason the text-overflow and white-space properties are being ignored from the base CSS.

Screenshot 2024-02-24 at 2 20 52 PM
moebis commented 4 months ago

That's also why there is a blank space in front of "Optimized...." you just skipped a css block.

AdrianGarside commented 4 months ago

Again, the integration has literally zero lines of code to control the UX. There Is no CSS in the integration.

The reason you aren't seeing the sensor name in your example is because home assistant has truncated it down to non-existant. The integration has zero involvement or control over that.

AdrianGarside commented 4 months ago

This is what it looks like when it's almost entirely truncated the sensor name to nothing: image

Your example is just so extreme home assistant clipped the sensor name down to nothing - only the small gap between the zero sized sensor field and the text remains on the left of the text.

AdrianGarside commented 4 months ago

Your top sensor example is HA handling something it can line wrap (has spaces in the string) differently. This integration can provide a string - it doesn't have any control over columns in the UX.