feat: add ui block while brewing
- fix case value show invalid after come back from brewing finish (topping not save) - add update machine status Signed-off-by: pakintada@gmail.com <Pakin>
This commit is contained in:
parent
4cb98f8672
commit
e25881d016
16 changed files with 371 additions and 17 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import { updateMachineStatus } from '../stores/machineInfoStore';
|
||||
import { addNotification } from '../stores/noti';
|
||||
|
||||
type AdbPayload = { type: string; payload: any };
|
||||
|
|
@ -36,6 +37,7 @@ async function handleAdbPayload(raw_payload: string) {
|
|||
console.log('current state', curr, 'next state', next);
|
||||
|
||||
addNotification('INFO:Machine Status Updated, ' + next);
|
||||
updateMachineStatus(next);
|
||||
}
|
||||
break;
|
||||
case 'error':
|
||||
|
|
|
|||
|
|
@ -1,4 +1,19 @@
|
|||
import type { MachineInfo } from '$lib/models/machineInfo.model';
|
||||
import { writable } from 'svelte/store';
|
||||
import { get, writable } from 'svelte/store';
|
||||
|
||||
export const machineInfoStore = writable<MachineInfo | undefined>();
|
||||
const machineInfoStore = writable<MachineInfo | undefined>();
|
||||
|
||||
function updateMachineStatus(new_status: string) {
|
||||
let current = get(machineInfoStore);
|
||||
if (current) {
|
||||
current.status = new_status;
|
||||
|
||||
machineInfoStore.set(current);
|
||||
}
|
||||
}
|
||||
|
||||
function getMachineStatus() {
|
||||
return get(machineInfoStore)?.status;
|
||||
}
|
||||
|
||||
export { machineInfoStore, updateMachineStatus, getMachineStatus };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue