Commit 6262671c authored by vertighel's avatar vertighel
Browse files

fix: telemetry display — error badge collision, w-100 layout, bool pills



- status-stream/view: fix telescope-error showing "OK" instead of integer;
  error badge branch now requires resolved.subProperty === 'error', so
  endpoints named "error" are not mistaken for badge keys
- ui-core: remove w-100 from pill mode; badges auto-size in both inline
  and block-in-span contexts
- control_panel.html: add data-display="plain" to mount_pointing aside vars
- mode_panels.html: camera-snapshot-state → pill+camera_state map;
  filter/temperature → plain with round_1 transform
- init.html: boolean info_list items get display=pill + map=bool_yesno
  (dome slaved/movement, rotator-movement, stage-movement, camera fan);
  dome azimuth gets round_1 transform

Co-Authored-By: default avatarClaude Sonnet 4.6 <noreply@anthropic.com>
parent 9d758b32
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@
            "info_list": [
              {"label": null},
              {"label": "rot",    "status": "telescope-rotator",          "transform": "round_1"},
              {"label": "moving", "status": "telescope-rotator-movement"},
              {"label": "moving", "status": "telescope-rotator-movement", "display": "pill", "map": "bool_yesno"},
            ]
            }) }}
        </section>
@@ -112,9 +112,9 @@
                    {"label": "Sync", "endpoint": "/dome/position/sync",             "method": "PUT"}
                ],
                "info_list": [
                    {"label": "slaved", "status": "dome-position-slaved"},
                    {"label": "az",     "status": "dome-position-azimuth"},
                    {"label": "moving",     "status": "dome-position-movement"},
                    {"label": "slaved", "status": "dome-position-slaved",   "display": "pill", "map": "bool_yesno"},
                    {"label": "az",     "status": "dome-position-azimuth",  "transform": "round_1"},
                    {"label": "moving", "status": "dome-position-movement", "display": "pill", "map": "bool_yesno"},
                ]
            }) }}

@@ -172,8 +172,8 @@
                ],
                "info_list": [
                    {"label": null},
                    {"label": "moving", "status": "stage-movement"},
                    {"label": "pos",  "status": "stage-position", "transform":"round_1"}
                    {"label": "moving", "status": "stage-movement",  "display": "pill", "map": "bool_yesno"},
                    {"label": "pos",    "status": "stage-position",  "transform": "round_1"},
                ],
            }) }}
        </section>
@@ -207,7 +207,7 @@
                "unit": "°C",
                "buttons": [{"label": "Set", "endpoint": "/camera/cooler/temperature/setpoint", "method": "PUT"}],
                "info_list": [
                    {"label": "fan", "status": "camera-settings-fan"},
                    {"label": "fan", "status": "camera-settings-fan",         "display": "pill", "map": "bool_yesno"},
                    {"label": "set", "status": "camera-settings-setpoint",    "transform": "round_1"},
                    {"label": "T",   "status": "camera-settings-temperature", "transform": "round_1"}
                ]
+6 −6
Original line number Diff line number Diff line
@@ -42,15 +42,15 @@
    </fieldset>

    <aside class="row">
      <small class="col-4 mt-1 text-success">ra: <var data-status="telescope-coordinates-radec-0">N/A</var></small>
      <small class="col-4 mt-1 text-success">dec: <var data-status="telescope-coordinates-radec-1">N/A</var></small>
      <small class="col-4 mt-1 text-success">ha: <var data-status="telescope-coordinates-ha">N/A</var></small>
      <small class="col-4 mt-1 text-success">ra: <var data-status="telescope-coordinates-radec-0" data-display="plain">N/A</var></small>
      <small class="col-4 mt-1 text-success">dec: <var data-status="telescope-coordinates-radec-1" data-display="plain">N/A</var></small>
      <small class="col-4 mt-1 text-success">ha: <var data-status="telescope-coordinates-ha" data-display="plain">N/A</var></small>
    </aside>

    <aside class="row">
      <small class="col-4 mt-1 text-success">alt: <var data-status="telescope-coordinates-altaz-0" data-transform="round_3">N/A</var></small>
      <small class="col-4 mt-1 text-success">az: <var data-status="telescope-coordinates-altaz-1" data-transform="round_3">N/A</var></small>
      <small class="col-4 mt-1 text-success">lst: <var data-status="telescope-coordinates-lst">N/A</var></small>
      <small class="col-4 mt-1 text-success">alt: <var data-status="telescope-coordinates-altaz-0" data-display="plain" data-transform="round_3">N/A</var></small>
      <small class="col-4 mt-1 text-success">az: <var data-status="telescope-coordinates-altaz-1" data-display="plain" data-transform="round_3">N/A</var></small>
      <small class="col-4 mt-1 text-success">lst: <var data-status="telescope-coordinates-lst" data-display="plain">N/A</var></small>
    </aside>

  </div>
+5 −5
Original line number Diff line number Diff line
@@ -92,9 +92,9 @@
</form>

<aside class="row g-1 mt-2 small font-monospace">
  <small class="col-4 text-success">state: <var data-status="camera-snapshot-state">N/A</var></small>
  <small class="col-4 text-success">filter: <var data-status="camera-filter">N/A</var></small>
  <small class="col-4 text-success">T: <var data-status="camera-settings-temperature">N/A</var>°C</small>
  <small class="col-4 text-success">state: <var data-status="camera-snapshot-state" data-display="pill" data-map="camera_state">N/A</var></small>
  <small class="col-4 text-success">filter: <var data-status="camera-filter" data-display="plain">N/A</var></small>
  <small class="col-4 text-success">T: <var data-status="camera-settings-temperature" data-display="plain" data-transform="round_1">N/A</var>°C</small>
</aside>

{% endmacro %}
@@ -157,8 +157,8 @@
</form>

<aside class="row g-1 mt-2 small font-monospace">
  <small class="col-6 text-success">state: <var data-status="camera2-snapshot-state"></var></small>
  <small class="col-6 text-success">T: <var data-status="camera2-settings-temperature"></var>°C</small>
  <small class="col-6 text-success">state: <var data-status="camera2-snapshot-state" data-display="pill" data-map="camera_state"></var></small>
  <small class="col-6 text-success">T: <var data-status="camera2-settings-temperature" data-display="plain" data-transform="round_1"></var>°C</small>
</aside>
{% endmacro %}

+3 −2
Original line number Diff line number Diff line
@@ -28,8 +28,9 @@ document.addEventListener('DOMContentLoaded', () => {

            const { endpointData } = resolved;

            // Error badge: keyed as "<subsystem>-<endpoint>-error"
            if (statusKey.endsWith('-error')) {
            // Error badge: only when "error" is the sub-property, not the endpoint itself
            // (prevents telescope-error endpoint from matching this branch)
            if (statusKey.endsWith('-error') && resolved.subProperty === 'error') {
                const errors = endpointData.error;
                const hasErrors = errors && (Array.isArray(errors) ? errors.length > 0 : String(errors).trim() !== '');
                const displayValue = hasErrors ? 'ERR' : 'OK';
+6 −10
Original line number Diff line number Diff line
@@ -113,13 +113,13 @@ document.addEventListener('DOMContentLoaded', () => {
        elements.forEach(el => {
            const statusKey = el.dataset.status;

            // Error badge
            if (statusKey.endsWith('-error')) {
                const parts = statusKey.split('-');
                const endpointData = data[parts[1]];
                if (endpointData === undefined) return;
            const resolved = resolveValue(data, statusKey);
            if (!resolved) return;
            if (resolved.parsed.subsystem !== subsystem) return;

                const errors = endpointData.error;
            // Error badge: only when "error" is the sub-property, not the endpoint itself
            if (statusKey.endsWith('-error') && resolved.subProperty === 'error') {
                const errors = resolved.endpointData.error;
                const hasErrors = errors && errors.length > 0;
                const displayValue = hasErrors ? 'ERR' : 'OK';

@@ -139,10 +139,6 @@ document.addEventListener('DOMContentLoaded', () => {
                return;
            }

            const resolved = resolveValue(data, statusKey);
            if (!resolved) return;
            if (resolved.parsed.subsystem !== subsystem) return;

            let finalValue = resolved.value;

            // Apply map (data-map) then transform (data-transform)
Loading