diff --git a/issue-reports/prep-api-data.js b/issue-reports/prep-api-data.js new file mode 100644 index 0000000..0a5bf89 --- /dev/null +++ b/issue-reports/prep-api-data.js @@ -0,0 +1,32 @@ +const needsReponseLabel = flow.get("needsReponseLabel", "diskCon") +const typeBugLabel = flow.get("typeBugLabel", "diskCon") +const typeEnhancementLabel = flow.get("typeEnhancementLabel", "diskCon") +const typeAdjustmentLabel = flow.get("typeAdjustmentLabel", "diskCon") +const title = msg.text +const type = msg.type + +let labels = [needsReponseLabel] +let formatType = {} + +if (type === 'Bug Report') { + labels.push(typeBugLabel) + formatType = "[Bug]" +} else if (type === 'New Idea') { + labels.push(typeEnhancementLabel) + formatType = "[Feature Request]" +} else if (type === 'Adjustment') { + labels.push(typeAdjustmentLabel) + formatType = "[Adjustment Request]" +} + +let newTitle = `${formatType}: ${title}` + +msg.payload = { + "title": newTitle, + "body": "This issue was submitted by the automated form on the main Home Assistant dashboard", + "assignees":["tm24fan8"], + "labels": labels +} + +node.status({fill:'green',shape:'dot',text:'API data prepped'}) +return msg \ No newline at end of file diff --git a/issue-reports/processing.js b/issue-reports/processing.js new file mode 100644 index 0000000..89eaf8d --- /dev/null +++ b/issue-reports/processing.js @@ -0,0 +1,21 @@ +const states = global.get('homeassistant.homeAssistant.states') +const text = states['input_text.report_system'].state +const type = states['input_select.report_type'].state +const resetText = 'Type your report here' +const resetType = 'Bug Report' + +msg.text = text +msg.type = type + +msg.reset_text = resetText +msg.reset_type = resetType + +if (type === "New Idea") { + node.status({fill:"green",shape:"dot",text:"New Idea"}) +} else if (type === "Bug Report") { + node.status({fill:"green",shape:"dot",text:"Bug Report"}) +} else if (type === "Adjustment") { + node.status({fill:"green",shape:"dot",text:"Adjustment"}) +} + +return msg \ No newline at end of file diff --git a/issue-reports/processing_start.js b/issue-reports/processing_start.js new file mode 100644 index 0000000..5d8e0da --- /dev/null +++ b/issue-reports/processing_start.js @@ -0,0 +1,9 @@ +const needsReponseLabel = 213 +const typeBugLabel = 196 +const typeEnhancementLabel = 198 +const typeAdjustmentLabel = 208 + +flow.set("needsReponseLabel", needsReponseLabel, "diskCon") +flow.set("typeBugLabel", typeBugLabel, "diskCon") +flow.set("typeEnhancementLabel", typeEnhancementLabel, "diskCon") +flow.set("typeAdjustmentLabel", typeAdjustmentLabel, "diskCon") \ No newline at end of file