From f47f7e470459086dd57f1cd5e067858e663163b2 Mon Sep 17 00:00:00 2001 From: cheetah Date: Thu, 1 Dec 2022 14:51:01 +0100 Subject: [PATCH] fixed some minor fuckups --- config.json | 25 ----------------------- html/index.html | 53 ++++++++++--------------------------------------- index.js | 2 +- 3 files changed, 12 insertions(+), 68 deletions(-) diff --git a/config.json b/config.json index ee33a09..4ebca7d 100644 --- a/config.json +++ b/config.json @@ -3,30 +3,5 @@ "url": "http://127.0.0.1:3000/api/message/advanced" }, "alarms": [ - { - "name": "Normal", - "params": { - "type": "duplex", - "routing": { - "device": "birdyslim", - "connectors": [ - [ - "dummy", - "1234567" - ] - ] - } - }, - "weekDay": { - "0": false, - "2": false, - "6": true - }, - "alarmSchedulingMode": "weekly", - "alarmTime": "23:50", - "payload": "Probealarm jeden sonntag 2350", - "firstOccWeekday": 0, - "specificWeekday": "27" - } ] } \ No newline at end of file diff --git a/html/index.html b/html/index.html index f6727a9..332803c 100644 --- a/html/index.html +++ b/html/index.html @@ -120,28 +120,6 @@ return { EXPERTMODE: false, configTab: null, - pagerTypes: [ - { k: 'Simple', v: 'simple' }, - { k: 'Duplex', v: 'duplex' }, - ], - deviceType: [ - { k: 'Generic', v: 'generic' }, - { k: 'Birdy Slim (IoT)', v: 'birdyslim' }, - ], - connectorTypes: [ - { k: 'Dummy', v: 'dummy' }, - { k: 'POCSAG GW', v: 'pocsag' }, - { k: 'DAPNET', v: 'dapnet' }, - - { k: 'e*Cityruf inetgw', v: 'ecityruf' }, - { k: 'e*Cityruf Puppeteer', v: 'em-p-cityruf' }, - { k: 'e*Cityruf alertManager', v: 'em-a-cityruf' }, - - { k: 'e*2wayS Puppeteer', v: 'em-p-twoways' }, - { k: 'e*2wayS alertManager', v: 'em-a-twoways' }, - - { k: 'LoRaWAN TTNv3', v: 'lorawan' }, - ], alarmSchedulingMode: [ { k: 'Weekly', v: 'weekly' }, { k: 'Monthly at first occurance of a specific weekday', v: 'monthlyFirstOccWeekday' }, @@ -192,31 +170,22 @@ delete a._id return a }) - this.$http.post('/config', storeConfig).then(response => { + this.$http.post('/config', storeConfig) + .then(response => {}) + .then(this.$http.post('/restart')) + .then(() => { + document.body.style = 'display:none' + setTimeout(() => window.location.reload(), 1e3) }) - .then(this.$http.post('/restart')) - .then(() => { - document.body.style = 'display:none' - setTimeout(() => window.location.reload(), 1e3) - }) - }, - addDeliveryTarget(index) { - this.configData.alarms[index].params.routing.connectors.push(["connectorName", "connectorParam"]) }, addAlarm() { this.configData.alarms.push({ name: "Testalarm", - params: { - "type": "simple", - "routing": { - "device": "generic", - "connectors": [] - }, - }, - "alarmSchedulingMode": "weekly", - "alarmTime": "13:37", - "payload": "Probealarm jeden Tag 1337", - "weekDay": { + preset: null, + alarmSchedulingMode: "weekly", + alarmTime: "13:37", + payload: "Probealarm jeden Tag 1337", + weekDay: { "0": true, "1": true, "2": true, diff --git a/index.js b/index.js index 5e8ad71..62bea5a 100644 --- a/index.js +++ b/index.js @@ -57,7 +57,7 @@ async function minuteCheck() { break; } if (alarmTrigger === true) { - await axios.post(config.pager.url, Object.assign( !!alarm.preset + await axios.post(new URL(config.pager.url).origin + '/api/message/' + (!!alarm.preset ? 'preset' : 'advanced'), Object.assign( !!alarm.preset ? { ...alarm.params } // backward compatibility : { preset: alarm.preset } , { payload: alarm.payload }))