stub in bambu management channel into ui and add storage in device definition
This commit is contained in:
parent
cd7a8f9e56
commit
a3bc6ceb67
4 changed files with 27 additions and 3 deletions
|
|
@ -7,17 +7,33 @@ self.kiri.load(api => {
|
|||
}
|
||||
|
||||
const { kiri, moto } = self;
|
||||
const { ui } = kiri;
|
||||
const { webui } = moto;
|
||||
const { ui } = api;
|
||||
const { local } = data;
|
||||
const defhost = ";; DEFINE BAMBU-HOST ";
|
||||
const defams = ";; DEFINE BAMBU-AMS ";
|
||||
|
||||
let init = false;
|
||||
let bound, device;
|
||||
let host, password, serial, amsmap;
|
||||
|
||||
api.event.on("init-done", function() {
|
||||
if (init) return;
|
||||
init = true;
|
||||
let btn = webui.button({ _: 'Manage', id: "bblman", onclick() { console.log('manage')} });
|
||||
bound = webui.bind($('device-save'), btn, { before: true });
|
||||
});
|
||||
|
||||
api.event.on("device.selected", devsel => {
|
||||
device = devsel;
|
||||
if (!bound) {
|
||||
return;
|
||||
}
|
||||
if (device.extras?.bbl) {
|
||||
bound.bblman.classList.remove('hide');
|
||||
} else {
|
||||
bound.bblman.classList.add('hide');
|
||||
}
|
||||
});
|
||||
|
||||
function sendok(params = {}) {
|
||||
|
|
|
|||
|
|
@ -383,7 +383,9 @@
|
|||
"bedBelt": false,
|
||||
"fwRetract": false,
|
||||
"filamentSource": "direct",
|
||||
"extras": {},
|
||||
"extras": {
|
||||
"bbl": {}
|
||||
},
|
||||
"imageURL": "",
|
||||
"deviceZMax": 0,
|
||||
"gcodeTime": 1,
|
||||
|
|
|
|||
|
|
@ -274,6 +274,7 @@ gapp.register("kiri.devices", (root, exports) => {
|
|||
}
|
||||
|
||||
uc.refresh(1);
|
||||
api.event.emit('device.selected', dev);
|
||||
} catch (e) {
|
||||
console.log({error:e, device:code, devicename});
|
||||
api.show.alert(`invalid or deprecated device: "${devicename}"`, 10);
|
||||
|
|
|
|||
|
|
@ -76,7 +76,12 @@ let h = exports({
|
|||
bind: (el, data, opt = {}) => {
|
||||
let ctx = [];
|
||||
let html = build(data, ctx).join('');
|
||||
if (opt.append) {
|
||||
if (opt.after || opt.before) {
|
||||
let tmpl = document.createElement('template');
|
||||
tmpl.innerHTML = html;
|
||||
opt.before && el.before(tmpl.content);
|
||||
opt.after && el.after(tmpl.content);
|
||||
} else if (opt.append) {
|
||||
el.innerHTML += html;
|
||||
} else {
|
||||
el.innerHTML = html;
|
||||
|
|
|
|||
Loading…
Reference in a new issue