balena-io / balena-sdk

The SDK to make balena powered JavaScript applications.
https://www.balena.io/
Apache License 2.0
145 stars 46 forks source link

getDashboardUrl() should not return a URL for a dashboard that does not exist #1011

Open pdcastro opened 3 years ago

pdcastro commented 3 years ago

Expected Behavior

application.getDashboardUrl() and device.getDashboardUrl should return undefined if a dashboard does not exist in the environment, for example in openBalena.

Actual Behavior

As reported in balena-io/balena-cli/issues/2055 :

$ balena device 59d7700
== WINTER TREE
ID:                 4
DEVICE TYPE:        raspberrypi3
STATUS:             offline
IS ONLINE:          false
IP ADDRESS:         192.168.43.247
APPLICATION NAME:   my-app
UUID:               59d7700755ec5de06783eda8034c9d3d
SUPERVISOR VERSION: 7.25.3
OS VERSION:         Resin OS 2.22.1+rev1
DASHBOARD URL:      https://dashboard.openbalena-test.balena-dev.com/devices/59d7700755ec5de06783eda8034c9d3d/summary

The dashboard URL shown above is not valid, because openBalena does not have a dashboard.

A proposed solution is mentioned in issue balena-io/open-balena-api/issues/487

References

thgreasi commented 3 years ago

I can't think of a way to do this currently. Maybe if the API exposed the set of supported features, we could reason about this properly.

Update: Oh, just like how you describe it in the openBalena issue See: https://github.com/balena-io/open-balena-api/issues/487