alerts: per-support-team webhook; printedparts routes low-stock to a chosen team
Support teams gain a webhookurl (migration 7d29 + API + settings-page field), so a team is a notification target. send_webhook(url=) lets a caller override the site default with a team's webhook. Printedparts gains a 'alert support team' setting (printedparts_alert_supportteamid) + selector on its settings page; low-stock alerts post to that team's webhook, falling back to the site alert_webhook_url. Email leg unchanged. Same pattern extends to other alerting plugins (printers low-toner next).
This commit is contained in:
@@ -63,6 +63,10 @@
|
||||
<label for="teamurl">Team URL</label>
|
||||
<input id="teamurl" v-model="teamForm.teamurl" type="text" class="form-control" placeholder="ServiceNow group link" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="webhookurl">Alert Webhook URL</label>
|
||||
<input id="webhookurl" v-model="teamForm.webhookurl" type="text" class="form-control" placeholder="Microsoft Teams webhook for this team's alerts" />
|
||||
</div>
|
||||
<div v-if="teamError" class="error-message">{{ teamError }}</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
@@ -202,7 +206,7 @@ function contactEmail(contact) {
|
||||
const showTeamModal = ref(false)
|
||||
const editingTeam = ref(null)
|
||||
const teamError = ref('')
|
||||
const teamForm = ref({ teamname: '', teamurl: '' })
|
||||
const teamForm = ref({ teamname: '', teamurl: '', webhookurl: '' })
|
||||
|
||||
const showContactModal = ref(false)
|
||||
const editingContact = ref(null)
|
||||
@@ -238,8 +242,8 @@ function openContactsModal(team) {
|
||||
function openTeamModal(team = null) {
|
||||
editingTeam.value = team
|
||||
teamForm.value = team
|
||||
? { teamname: team.teamname || '', teamurl: team.teamurl || '' }
|
||||
: { teamname: '', teamurl: '' }
|
||||
? { teamname: team.teamname || '', teamurl: team.teamurl || '', webhookurl: team.webhookurl || '' }
|
||||
: { teamname: '', teamurl: '', webhookurl: '' }
|
||||
teamError.value = ''
|
||||
showTeamModal.value = true
|
||||
}
|
||||
@@ -250,7 +254,8 @@ async function saveTeam() {
|
||||
try {
|
||||
const payload = {
|
||||
teamname: teamForm.value.teamname,
|
||||
teamurl: teamForm.value.teamurl || null
|
||||
teamurl: teamForm.value.teamurl || null,
|
||||
webhookurl: teamForm.value.webhookurl || null
|
||||
}
|
||||
if (editingTeam.value) {
|
||||
await supportteamsApi.update(editingTeam.value.supportteamid, payload)
|
||||
|
||||
Reference in New Issue
Block a user