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_serial.onkeypress = in_serial.onblur = printer_update;
monitor_start(rec);
$('bbl_name').innerText = name;
}
function printer_render(rec) {
$('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() {
h.bind(select, Object.keys(printers).map(name => {
return h.option({
_: name,
value: name,
onclick() { printer_select(name) }
})
return h.option({ _: name, value: name })
}));
}
@ -174,21 +199,34 @@ self.kiri.load(api => {
}), { before: true });
let modal = h.bind($('mod-help'), h.div({
id: "mod-bambu",
class: "mdialog fcol gap3"
class: "mdialog fcol gap4"
}, [
h.button('bambu printer manager'),
h.div({ class: "frow gap3" }, [
h.div({ class: "t-body t-inset fcol gap3 pad4" }, [
h.select({ id: "bbl_sel", style: "height: 100%", size: 5 }, []),
h.div({ class: "grid gap3", style: "grid-template-columns: 1fr 1fr" }, [
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",
@ -196,22 +234,55 @@ self.kiri.load(api => {
})
])
]),
h.div({ class: "set-sep "}),
h.div({ class: "frow gap3" }, [
h.div({ class: "grow fcol gap3" }, [
h.div({ class: "t-body t-inset frow gap4 pad4 a-center" }, [
h.label('host'),
h.input({ id: "bbl_host", size: 15, class: "t-left" }),
h.label('code'),
h.input({ id: "bbl_code", size: 10, class: "t-left" }),
h.label('serial'),
h.input({ id: "bbl_serial", size: 20, class: "t-left" })
h.label({ class: "set-header dev-sel" }, [
h.a({ _: 'printer', id: "bbl_name" })
]),
h.label('host'),
h.input({ id: "bbl_host", size: 15, class: "t-left mono" }),
h.label('code'),
h.input({ id: "bbl_code", size: 10, class: "t-left mono" }),
h.label('serial'),
h.input({ id: "bbl_serial", size: 20, class: "t-left mono" }),
h.button({ id: "bbl_hide", _: '<i class="fa-solid fa-eye"></i>', onclick(ev) {
if (ev.target.hide === true) {
ev.target.hide = false;
$('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.div({ class: "t-body t-inset frow gap4 pad4 grow" }, [
h.textarea({
id: "bbl_rec",
style: "width: 100%; resize: none",
rows: 30, cols: 65
style: "width: 100%; resize: none; box-sizing: border-box",
rows: 15, cols: 65
})
])
]),
h.div({ class: "t-body t-inset fcol gap3 pad4" }, [
h.div({ class: "set-header" }, [ h.a('files') ]),
h.select({ id: "bbl_sel", style: "height: 100%", size: 5 }, []),
h.button({ _: "refresh", onclick() {
console.log('file list refresh');
}})
])
])
]), { before: true });

View file

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

View file

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