UNPKG

@kuriousdesign/machine-sdk

Version:

Shared data types and helpers for machine-related repositories

43 lines (42 loc) 2.17 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.deviceStateToColorMap = deviceStateToColorMap; exports.partStateToColorMap = partStateToColorMap; const Colors_1 = require("../enums/Colors"); const States_1 = require("../enums/States"); function deviceStateToColorMap(state) { const colorMap = { [States_1.DeviceState.Killed]: Colors_1.Color.Black, [States_1.DeviceState.Inactive]: Colors_1.Color.Inactive, [States_1.DeviceState.Resetting]: Colors_1.Color.Resetting, [States_1.DeviceState.Idle]: Colors_1.Color.Idle, [States_1.DeviceState.Running]: Colors_1.Color.Running, [States_1.DeviceState.Stopping]: Colors_1.Color.Processing, [States_1.DeviceState.Done]: Colors_1.Color.Done, [States_1.DeviceState.Aborting]: Colors_1.Color.Error, [States_1.DeviceState.Manual]: Colors_1.Color.Manual, [States_1.DeviceState.Paused]: Colors_1.Color.Processing, [States_1.DeviceState.Faulted]: Colors_1.Color.Error, }; return colorMap[state]; } function partStateToColorMap(state) { const colorMap = { [States_1.PartState.Empty]: Colors_1.Color.Empty, [States_1.PartState.Raw]: Colors_1.Color.Raw, [States_1.PartState.DeburrBottomStarted]: Colors_1.Color.Processing, [States_1.PartState.DeburrBottomFinished]: Colors_1.Color.DeburrBottomFinished, [States_1.PartState.DeburrTopStarted]: Colors_1.Color.Processing, [States_1.PartState.Deburred]: Colors_1.Color.Deburred, [States_1.PartState.MachiningStarted]: Colors_1.Color.Processing, [States_1.PartState.Machined]: Colors_1.Color.Machined, [States_1.PartState.WashStarted]: Colors_1.Color.Processing, [States_1.PartState.Washed]: Colors_1.Color.Processing, [States_1.PartState.DryStarted]: Colors_1.Color.Processing, [States_1.PartState.Dryed]: Colors_1.Color.Dryed, [States_1.PartState.Finished]: Colors_1.Color.Finished, [States_1.PartState.Scrapped]: Colors_1.Color.Scrapped, [States_1.PartState.Error]: Colors_1.Color.Error, }; return colorMap[state]; }