Commit 390d81d5 authored by vertighel's avatar vertighel
Browse files

Minor fixes in UI

parent 82789878
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ filter_name = {
    5: "SDSS y",
    6: "FREE",
    7: "SDSS u",
    15: "Filter_error",
    15: "Filter_moving",
    None: none_val,
}

+1 −1
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@
            {{ w.widget_standard({
                "label": "Petals",
                "info": "telescope-cover",
                "map": "bool_yesno",
                "map": "bool_openclosed",
                "buttons": [
                    {"label": "Open",  "endpoint": "/telescope/cover/movement", "val": true,  "method": "POST"},
                    {"label": "Close", "endpoint": "/telescope/cover/movement", "val": false, "method": "POST"}
+26 −0
Original line number Diff line number Diff line
@@ -269,6 +269,32 @@ document.addEventListener('DOMContentLoaded', () => {
        el.addEventListener('change', () => localStorage.setItem(key, el.value));
    });

    // -----------------------------------------------------------------------
    // Bias frames take no exposure — lock Exptime to 0 while "Bias" is
    // selected. Wired after the localStorage restore above so a persisted
    // "Bias" selection is honoured immediately on load, not just on the
    // next manual change.
    // -----------------------------------------------------------------------
    function wireImagetypeBias(station) {
        const mode        = MODES[station];
        const form        = document.getElementById(`form-${mode.panel}`);
        const imagetypeEl = form?.querySelector('[name="imagetype"]');
        const exptimeEl   = document.querySelector(`[name="exptime"][form="form-${mode.panel}"]`);
        if (!imagetypeEl || !exptimeEl) return;

        const applyBias = () => {
            const isBias = imagetypeEl.value === 'Bias';
            exptimeEl.disabled = isBias;
            if (isBias) exptimeEl.value = '0';
        };
        imagetypeEl.addEventListener('change', applyBias);
        applyBias();
    }

    for (const station of Object.keys(MODES)) {
        wireImagetypeBias(station);
    }

    // -----------------------------------------------------------------------
    // Init
    // -----------------------------------------------------------------------
+2 −1
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ export function resolveValue(data, statusKey) {
const noctuaMaps = {
    bool_yesno: (v) => v === true  ? "Yes"    : v === false ? "No"     : null,
    bool_onoff: (v) => v === true  ? "On"     : v === false ? "Off"    : null,
    bool_openclosed: (v) => v === true ? "opened" : v === false ? "closed" : null,

    open_state: (v) => ({ 0: "Open", 1: "Closed", 2: "Opening", 3: "Closing", 4: "Error" })[v] ?? null,

@@ -109,7 +110,7 @@ const noctuaMaps = {

    filter_name: (v) => ({
        0: "Undef.", 1: "SDSS g", 2: "SDSS r", 3: "SDSS i",
        4: "SDSS z", 5: "SDSS y", 6: "FREE",   7: "SDSS u", 15: "Filter_error"
        4: "SDSS z", 5: "SDSS y", 6: "FREE",   7: "SDSS u", 15: "Filter_moving"
    })[v] ?? null,
};