reflow bambu manager, start to add tracked record values

This commit is contained in:
Stewart Allen 2025-01-28 16:37:44 -05:00
commit f700b5e91f
3 changed files with 120 additions and 37 deletions

View file

@ -131,19 +131,44 @@ self.kiri.load(api => {
in_code.onkeypress = in_code.onblur = printer_update; in_code.onkeypress = in_code.onblur = printer_update;
in_serial.onkeypress = in_serial.onblur = printer_update; in_serial.onkeypress = in_serial.onblur = printer_update;
monitor_start(rec); monitor_start(rec);
$('bbl_name').innerText = name;
} }
function printer_render(rec) { function printer_render(rec) {
$('bbl_rec').value = JSON.stringify(deepSortObject(rec), undefined, 2); $('bbl_rec').value = JSON.stringify(deepSortObject(rec), undefined, 2);
let { info, print } = rec;
let {
ams_status,
bet_target_temper,
bed_temper,
big_fan1_speed,
big_fan2_speed,
chamber_temper,
cooling_fan_speed,
gcode_file,
heatbreak_fan_speed,
layer_num,
mc_percent,
mc_remaining_time,
nozzle_diameter,
nozzle_target_temper,
nozzle_temper,
print_error,
print_type,
sdcard,
total_layer_num,
upload
} = print || {};
if (nozzle_diameter) {
$('bbl_noz').value = nozzle_diameter;
$('bbl_noz_temp').value = nozzle_temper;
$('bbl_noz_target').value = nozzle_target_temper;
}
} }
function render_list() { function render_list() {
h.bind(select, Object.keys(printers).map(name => { h.bind(select, Object.keys(printers).map(name => {
return h.option({ return h.option({ _: name, value: name })
_: name,
value: name,
onclick() { printer_select(name) }
})
})); }));
} }
@ -174,44 +199,90 @@ self.kiri.load(api => {
}), { before: true }); }), { before: true });
let modal = h.bind($('mod-help'), h.div({ let modal = h.bind($('mod-help'), h.div({
id: "mod-bambu", id: "mod-bambu",
class: "mdialog fcol gap3" class: "mdialog fcol gap4"
}, [ }, [
h.button('bambu printer manager'), h.div({ class: "f-row a-center gap4" }, [
h.label({ class: "set-header dev-sel" }, [ h.a('bambu manager') ]),
h.select({ id: "bbl_sel", class: "dev-list" }, []),
h.button({
_: 'monitor',
title: "monitor printer",
class: "grid",
onclick() {
printer_select(select.value)
}
}),
h.div({ class: "grow gap3 j-end" }, [
h.button({
_: 'new',
title: "add printer",
class: "grid",
onclick: printer_add
}),
h.button({
_: 'rename',
title: "rename printer",
class: "grid",
onclick: printer_add
}),
h.button({
_: 'delete',
id: 'bbl_pdel',
title: "remove printer",
class: "grid",
onclick: printer_del
})
])
]),
h.div({ class: "set-sep "}),
h.div({ class: "frow gap3" }, [ h.div({ class: "frow gap3" }, [
h.div({ class: "t-body t-inset fcol gap3 pad4" }, [ h.div({ class: "grow fcol gap3" }, [
h.select({ id: "bbl_sel", style: "height: 100%", size: 5 }, []), h.div({ class: "t-body t-inset frow gap4 pad4 a-center" }, [
h.div({ class: "grid gap3", style: "grid-template-columns: 1fr 1fr" }, [ h.label({ class: "set-header dev-sel" }, [
h.button({ h.a({ _: 'printer', id: "bbl_name" })
_: '+', ]),
title: "add printer", h.label('host'),
class: "grid", h.input({ id: "bbl_host", size: 15, class: "t-left mono" }),
onclick: printer_add h.label('code'),
}), h.input({ id: "bbl_code", size: 10, class: "t-left mono" }),
h.button({ h.label('serial'),
_: '-', h.input({ id: "bbl_serial", size: 20, class: "t-left mono" }),
id: 'bbl_pdel', h.button({ id: "bbl_hide", _: '<i class="fa-solid fa-eye"></i>', onclick(ev) {
title: "remove printer", if (ev.target.hide === true) {
class: "grid", ev.target.hide = false;
onclick: printer_del $('bbl_code').type = 'text';
$('bbl_serial').type = 'text';
$('bbl_hide').innerHTML = '<i class="fa-solid fa-eye"></i>';
} else {
ev.target.hide = true;
$('bbl_code').type = 'password';
$('bbl_serial').type = 'password';
$('bbl_hide').innerHTML = '<i class="fa-solid fa-eye-slash"></i>';
}
}})
]),
h.div({ class: "t-body t-inset fcol gap4 pad3 grow" }, [
h.div({ class: "frow gap4 pad4" }, [
h.label('nozzle'),
h.input({ id: "bbl_noz", size: 5, class: "t-left mono" }),
h.label('temp'),
h.input({ id: "bbl_noz_temp", size: 8, class: "t-left mono" }),
h.label('target'),
h.input({ id: "bbl_noz_target", size: 8, class: "t-left mono" }),
]),
h.textarea({
id: "bbl_rec",
style: "width: 100%; resize: none; box-sizing: border-box",
rows: 15, cols: 65
}) })
]) ])
]), ]),
h.div({ class: "grow fcol gap3" }, [ h.div({ class: "t-body t-inset fcol gap3 pad4" }, [
h.div({ class: "t-body t-inset frow gap4 pad4 a-center" }, [ h.div({ class: "set-header" }, [ h.a('files') ]),
h.label('host'), h.select({ id: "bbl_sel", style: "height: 100%", size: 5 }, []),
h.input({ id: "bbl_host", size: 15, class: "t-left" }), h.button({ _: "refresh", onclick() {
h.label('code'), console.log('file list refresh');
h.input({ id: "bbl_code", size: 10, class: "t-left" }), }})
h.label('serial'),
h.input({ id: "bbl_serial", size: 20, class: "t-left" })
]),
h.div({ class: "t-body t-inset frow gap4 pad4 grow" }, [
h.textarea({
id: "bbl_rec",
style: "width: 100%; resize: none",
rows: 30, cols: 65
})
])
]) ])
]) ])
]), { before: true }); ]), { before: true });

View file

@ -230,7 +230,7 @@ module.exports = async (server) => {
} }
}); });
// request system info // request system info
mqtt.send({ false && mqtt.send({
info: { info: {
command: "get_version" command: "get_version"
} }

View file

@ -622,6 +622,9 @@ button:hover {
.noshow { .noshow {
display: none; display: none;
} }
.mono {
font-family: monospace;
}
.gap1 { .gap1 {
gap: 1px; gap: 1px;
} }
@ -646,6 +649,9 @@ button:hover {
.pad4 { .pad4 {
padding: 4px !important; padding: 4px !important;
} }
.h100 {
height: 100%;
}
.grid { .grid {
display: grid; display: grid;
} }
@ -688,13 +694,19 @@ button:hover {
.j-end { .j-end {
justify-content: flex-end; justify-content: flex-end;
} }
.j-stretch {
justify-items: stretch;
}
.as-stretch {
align-self: stretch;
}
.space-around { .space-around {
justify-content: space-around; justify-content: space-around;
} }
.space-between { .space-between {
justify-content: space-between; justify-content: space-between;
} }
.center { .center, .t-center {
text-align: center; text-align: center;
} }
.t-left { .t-left {
@ -952,7 +964,7 @@ button:hover {
#panel-left, #panel-right, #modal { #panel-left, #panel-right, #modal {
pointer-events: visible; pointer-events: visible;
} }
#panel-left label, #panel-left svg { #panel-left label, #panel-left svg, button svg {
pointer-events: none; pointer-events: none;
} }
#ws-widgets button { #ws-widgets button {
@ -2176,10 +2188,10 @@ button:hover {
.settings .set-header a { .settings .set-header a {
font-size: smaller; font-size: smaller;
} }
#dev-sel { #dev-sel, .dev-sel {
margin-bottom: 0; margin-bottom: 0 !important;
} }
#dev-list { #dev-list, .dev-list {
align-self: stretch; align-self: stretch;
padding: 0 5px 0 5px; padding: 0 5px 0 5px;
} }