plc_control/web/feeder/js/roles.js

30 lines
1.0 KiB
JavaScript

export const SIGNAL_ROLE_OPTIONS = [
{ value: "", label: "Unset" },
{ value: "rem", label: "REM Remote Enable" },
{ value: "run", label: "RUN Running" },
{ value: "flt", label: "FLT Fault" },
{ value: "ii", label: "II Current" },
{ value: "start_cmd", label: "Start Command" },
{ value: "stop_cmd", label: "Stop Command" },
];
export const EQUIPMENT_KIND_OPTIONS = [
{ value: "", label: "Unset" },
{ value: "coal_feeder", label: "Coal Feeder" },
{ value: "distributor", label: "Distributor" },
];
export function renderRoleOptions(selected = "") {
return SIGNAL_ROLE_OPTIONS.map((item) => {
const isSelected = item.value === selected ? "selected" : "";
return `<option value="${item.value}" ${isSelected}>${item.label}</option>`;
}).join("");
}
export function renderEquipmentKindOptions(selected = "") {
return EQUIPMENT_KIND_OPTIONS.map((item) => {
const isSelected = item.value === selected ? "selected" : "";
return `<option value="${item.value}" ${isSelected}>${item.label}</option>`;
}).join("");
}