GladysAssistant / Gladys

A privacy-first, open-source home assistant
https://gladysassistant.com
Apache License 2.0
2.55k stars 278 forks source link

Add binary chart #2094

Open Terdious opened 2 months ago

Terdious commented 2 months ago

Pull Request check-list

To ensure your Pull Request can be accepted as fast as possible, make sure to review and check all of these items:

NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open.

Description of change

Taken from the original PR: #Binary graph #1948 Thanks to @callemand for all the work done

relativeci[bot] commented 2 months ago

#2661 Bundle Size — 10.19MiB (+0.13%).

a27ae0b(current) vs e83d529 master#2649(baseline)

[!WARNING] Bundle contains 3 duplicate packages – View duplicate packages

Bundle metrics  Change 3 changes Regression 1 regression
                 Current
#2661
     Baseline
#2649
Regression  Initial JS 5.5MiB(+0.25%) 5.49MiB
No change  Initial CSS 303.12KiB 303.12KiB
No change  Cache Invalidation 53.79% 53.79%
No change  Chunks 51 51
No change  Assets 171 171
Change  Modules 1491(+0.07%) 1490
No change  Duplicate Modules 21 21
Change  Duplicate Code 0.81%(-1.22%) 0.82%
No change  Packages 124 124
No change  Duplicate Packages 3 3

Bundle size by type  Change 1 change Regression 1 regression
|            |       Current
[#2661](https://app.relative-ci.com/projects/PUROh8FAVkDKmpUrqr4u/jobs/2661-Gkg2qw5tUH5m8P1gQVsn?utm_source=github&utm_medium=pr-report "View bundle analysis report") |      Baseline
[#2649](https://app.relative-ci.com/projects/PUROh8FAVkDKmpUrqr4u/jobs/2649-7NuzpnuSq3dwLB70Mkt3?utm_source=github&utm_medium=pr-report "View baseline bundle analysis report") | |:--|--:|--:| | Regression  [JS](https://app.relative-ci.com/projects/PUROh8FAVkDKmpUrqr4u/jobs/2661-Gkg2qw5tUH5m8P1gQVsn/assets?ba=%7B%22filters%22%3A%22ft.CSS-0_ft.JS-1_ft.IMG-0_ft.MEDIA-0_ft.FONT-0_ft.HTML-0_ft.OTHER-0%22%7D "View JS assets") | `7.28MiB` (`+0.19%`) | `7.27MiB` | | No change  [IMG](https://app.relative-ci.com/projects/PUROh8FAVkDKmpUrqr4u/jobs/2661-Gkg2qw5tUH5m8P1gQVsn/assets?ba=%7B%22filters%22%3A%22ft.CSS-0_ft.JS-0_ft.IMG-1_ft.MEDIA-0_ft.FONT-0_ft.HTML-0_ft.OTHER-0%22%7D "View IMG assets") | `2.48MiB` | `2.48MiB` | | No change  [CSS](https://app.relative-ci.com/projects/PUROh8FAVkDKmpUrqr4u/jobs/2661-Gkg2qw5tUH5m8P1gQVsn/assets?ba=%7B%22filters%22%3A%22ft.CSS-1_ft.JS-0_ft.IMG-0_ft.MEDIA-0_ft.FONT-0_ft.HTML-0_ft.OTHER-0%22%7D "View CSS assets") | `319.91KiB` | `319.91KiB` | | No change  [Fonts](https://app.relative-ci.com/projects/PUROh8FAVkDKmpUrqr4u/jobs/2661-Gkg2qw5tUH5m8P1gQVsn/assets?ba=%7B%22filters%22%3A%22ft.CSS-0_ft.JS-0_ft.IMG-0_ft.MEDIA-0_ft.FONT-1_ft.HTML-0_ft.OTHER-0%22%7D "View Fonts assets") | `93.55KiB` | `93.55KiB` | | No change  [Other](https://app.relative-ci.com/projects/PUROh8FAVkDKmpUrqr4u/jobs/2661-Gkg2qw5tUH5m8P1gQVsn/assets?ba=%7B%22filters%22%3A%22ft.CSS-0_ft.JS-0_ft.IMG-0_ft.MEDIA-0_ft.FONT-0_ft.HTML-0_ft.OTHER-1%22%7D "View Other assets") | `17.62KiB` | `17.62KiB` | | No change  [HTML](https://app.relative-ci.com/projects/PUROh8FAVkDKmpUrqr4u/jobs/2661-Gkg2qw5tUH5m8P1gQVsn/assets?ba=%7B%22filters%22%3A%22ft.CSS-0_ft.JS-0_ft.IMG-0_ft.MEDIA-0_ft.FONT-0_ft.HTML-1_ft.OTHER-0%22%7D "View HTML assets") | `13.58KiB` | `13.58KiB` |

Bundle analysis reportBranch Terdious:add-binary-chartProject dashboard

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 98.41%. Comparing base (e83d529) to head (a27ae0b). Report is 3 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2094 +/- ## ======================================= Coverage 98.41% 98.41% ======================================= Files 865 865 Lines 14169 14169 ======================================= Hits 13945 13945 Misses 224 224 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Terdious commented 2 months ago
  • Text is inside the "bar" :

I'm sorry but I tried to reproduce and despite zooming in / out changing resolution, etc. I never managed to get your result. On the other hand, before my previous modification I had the same problem, but I corrected it before your review

  • I get a freeze when saving the dashboard with a binary chart on a power plug

I added a console.log(deviceFeature); because I can't seem to reproduce. I tested all types of binary, tasmota and mqtt (including a power plug). And I have no problems with the units (everything is 'null'). Could you send me the logs?

  • If I select a binary device, then unselect it, then select a non-binary device, I get a weird state where the chart type is unknown

Corrected

  • When I'm using Gladys in English, the text inside the popup is in french

Corrected

  • On mobile, the popup is outside of the screen

Corrected. Display top left box

Pierre-Gilles commented 2 months ago

@Terdious Thanks for the fixes!

Here is the payload that causes the freeze:

{"id":"e499dd5e-6482-4cbd-a73e-159d53c9b402","name":"Graph","selector":"graph","type":"main","visibility":"private","user_id":"275faa00-8a9c-4747-8fbe-417ddb966b16","created_at":"2024-06-10T08:20:20.784Z","updated_at":"2024-06-17T11:30:17.089Z","boxes":[[{"type":"chart","device_features":["mqtt-priseonoff"],"units":[null],"title":"Binaire","chart_type":"","interval":"last-day","display_axes":true}],[],[]]}

The response is 422 :

{
    "status": 422,
    "code": "UNPROCESSABLE_ENTITY",
    "properties": [
        {
            "message": "\"[0][0].chart_type\" is not allowed to be empty",
            "attribute": "boxes",
            "value": [
                [
                    {
                        "type": "chart",
                        "device_features": [
                            "mqtt-priseonoff"
                        ],
                        "units": [
                            null
                        ],
                        "title": "Binaire",
                        "chart_type": "",
                        "interval": "last-day",
                        "display_axes": true
                    }
                ],
                [],
                []
            ],
            "type": "Validation error"
        }
    ]
}

It's just because I didn't select the "chart type" ^^ It's maybe not related to this PR, but I wonder if we could make a fix to avoid freezing in this situation...

I have another feedback, now the date in english is not correct:

Screenshot 2024-06-17 at 13 29 13

stale[bot] commented 1 day ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.