rework PullRequest #16 according to maintainers recomendations

- Provide values {}-property
- change wording action_needed -> awaiting_interaction
- use more compact syntax for iconColor
This commit is contained in:
Ranlvor 2018-01-20 00:02:57 +01:00
parent 760e337878
commit 45219bd98a
Signed by untrusted user who does not match committer: Ranlvor
GPG key ID: 5E12D04750EF6F8E

View file

@ -122,6 +122,7 @@ const config : Config = {
state: "/service/ultimaker/state", state: "/service/ultimaker/state",
command: "", command: "",
defaultValue: "unavailable", defaultValue: "unavailable",
values: {},
parseState: msg => { parseState: msg => {
switch (msg.toString()) { switch (msg.toString()) {
case "unreachable": case "unreachable":
@ -133,7 +134,7 @@ const config : Config = {
case "resuming": case "resuming":
case "wait_cleanup": case "wait_cleanup":
case "maintenance": case "maintenance":
return "action_needed" return "awaiting_interaction"
case "pre_print": case "pre_print":
case "post_print": case "post_print":
@ -425,19 +426,14 @@ const config : Config = {
name: "Ultimaker 3", name: "Ultimaker 3",
position: [754, 560], position: [754, 560],
icon: "printer-3d", icon: "printer-3d",
iconColor: ({printer_3d_status}) => { iconColor: ({printer_3d_status}) =>
if(printer_3d_status == "action_needed") { ({
return "#b3b300"; awaiting_interaction: "#b3b300",
} else if(printer_3d_status == "printing") { printing: "#00ff00",
return "#00ff00"; idle: "#000000",
} else if(printer_3d_status == "idle") { unavailable: "#888888",
return "#000000"; error: "#ff0000"
} else if(printer_3d_status == "unavailable") { })[printer_3d_status],
return "#888888";
} else {
return "#ff0000";
}
},
ui: [ ui: [
{ {
type: "link", type: "link",