|
|
|
@ -15,6 +15,7 @@
|
|
|
|
|
<v-app-bar app>
|
|
|
|
|
<v-toolbar-title>Telegram Bot Configuration</v-toolbar-title>
|
|
|
|
|
<v-spacer></v-spacer>
|
|
|
|
|
<v-btn color="success" @click="storeConfig()">Store & Restart</v-btn>
|
|
|
|
|
<v-checkbox label="Expert Mode" v-model="EXPERTMODE"></v-checkbox>
|
|
|
|
|
</v-app-bar>
|
|
|
|
|
<v-content>
|
|
|
|
@ -34,7 +35,7 @@
|
|
|
|
|
</v-row>
|
|
|
|
|
<p>Targets:</p>
|
|
|
|
|
<v-row>
|
|
|
|
|
<v-btn color="success" @click="addRegionCMD()">Add</v-btn>
|
|
|
|
|
<v-btn color="success" @click="addDeliveryMode()">Add</v-btn>
|
|
|
|
|
</v-row>
|
|
|
|
|
<v-row v-for="(deliveryMode, index) in configData.deliveryModes" :key="deliveryMode._id" style="border-bottom: 2px solid black;">
|
|
|
|
|
<pre>Index: {{ index }}</pre>
|
|
|
|
@ -43,35 +44,18 @@
|
|
|
|
|
</v-col>
|
|
|
|
|
<v-col cols="6" sm="6" md="4">
|
|
|
|
|
<v-text-field v-model="deliveryMode.name" label="Name"></v-text-field>
|
|
|
|
|
<v-autocomplete
|
|
|
|
|
v-model="deliveryMode.preset"
|
|
|
|
|
:items="presetSearchItems"
|
|
|
|
|
:loading="!presetSearchItems.length > 0"
|
|
|
|
|
color="white"
|
|
|
|
|
hide-no-data
|
|
|
|
|
dense
|
|
|
|
|
label="Profile"
|
|
|
|
|
placeholder="Start typing to Search"
|
|
|
|
|
prepend-icon="mdi-database-search"
|
|
|
|
|
></v-autocomplete>
|
|
|
|
|
</v-col>
|
|
|
|
|
<v-col>
|
|
|
|
|
<v-col cols="12" sm="12" md="6">
|
|
|
|
|
<v-select :items="pagerTypes" v-model="deliveryMode.params.type" item-text="k" item-value="v" label="Delivery Type"></v-select>
|
|
|
|
|
</v-col>
|
|
|
|
|
<v-row>
|
|
|
|
|
<v-col cols="12" sm="12" md="6">
|
|
|
|
|
<v-select :items="deviceType" v-model="deliveryMode.params.routing.device" item-text="k" item-value="v" label="Device"></v-select>
|
|
|
|
|
</v-col>
|
|
|
|
|
</v-row>
|
|
|
|
|
<b>Delivery Targets:</b>
|
|
|
|
|
<v-btn color="success" @click="addDeliveryTarget(index)">Add</v-btn>
|
|
|
|
|
<v-row v-for="(connector, index) in deliveryMode.params.routing.connectors" :key="index">
|
|
|
|
|
<v-col cols="6" sm="4" md="4">
|
|
|
|
|
<v-select :items="connectorTypes" v-model="connector[0]" item-text="k" item-value="v" label="Gateway"></v-select>
|
|
|
|
|
</v-col>
|
|
|
|
|
<v-col cols="6" sm="4" md="4">
|
|
|
|
|
<v-text-field v-model="connector[1]" label="Call ID"></v-text-field>
|
|
|
|
|
</v-col>
|
|
|
|
|
<v-col cols="6" sm="4" md="4">
|
|
|
|
|
<v-btn color="error" @click="deliveryMode.params.routing.connectors.splice(index, 1)" icon><v-icon>mdi-delete</v-icon></v-btn>
|
|
|
|
|
</v-col>
|
|
|
|
|
</v-row>
|
|
|
|
|
</v-col>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</v-row>
|
|
|
|
|
<v-row>
|
|
|
|
|
<v-btn color="success" @click="storeConfig()">Store & Restart</v-btn>
|
|
|
|
|
</v-row>
|
|
|
|
|
</v-container>
|
|
|
|
|
</v-tab-item>
|
|
|
|
@ -82,10 +66,6 @@
|
|
|
|
|
<v-col cols="12" sm="12" md="6">
|
|
|
|
|
<v-text-field label="Daemon Endpoint URL" v-model="configData.pager.url"></v-text-field>
|
|
|
|
|
</v-col>
|
|
|
|
|
|
|
|
|
|
<v-row>
|
|
|
|
|
<v-btn color="success" @click="storeConfig()">Store & Restart</v-btn>
|
|
|
|
|
</v-row>
|
|
|
|
|
</v-container>
|
|
|
|
|
</v-tab-item>
|
|
|
|
|
</v-tabs-items>
|
|
|
|
@ -106,42 +86,32 @@
|
|
|
|
|
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'},
|
|
|
|
|
],
|
|
|
|
|
configData: {
|
|
|
|
|
"bottoken": "",
|
|
|
|
|
"bottoken": "",
|
|
|
|
|
"pager": {
|
|
|
|
|
"url": "",
|
|
|
|
|
},
|
|
|
|
|
"menuSupport": false,
|
|
|
|
|
"deliveryModes": []
|
|
|
|
|
},
|
|
|
|
|
presetSearchItems: [],
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.loadPresets()
|
|
|
|
|
this.loadConfig()
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
loadPresets() {
|
|
|
|
|
this.$http.get('/api/deliveryPresets')
|
|
|
|
|
.then(response => {
|
|
|
|
|
this.presetSearchItems = response.body.map(x => { return {
|
|
|
|
|
text: x.name,
|
|
|
|
|
value: x.key,
|
|
|
|
|
}})
|
|
|
|
|
}, response => {
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
loadConfig() {
|
|
|
|
|
this.$http.get('/config').then(response => {
|
|
|
|
|
const newConfig = response.body
|
|
|
|
@ -155,6 +125,10 @@
|
|
|
|
|
},
|
|
|
|
|
storeConfig() {
|
|
|
|
|
const storeConfig = JSON.parse(JSON.stringify(this.configData))
|
|
|
|
|
storeConfig.deliveryModes = storeConfig.deliveryModes.map((x) => {
|
|
|
|
|
delete x._id
|
|
|
|
|
return x
|
|
|
|
|
})
|
|
|
|
|
this.$http.post('/config', storeConfig).then(response => {
|
|
|
|
|
})
|
|
|
|
|
.then(this.$http.post('/restart'))
|
|
|
|
@ -163,19 +137,10 @@
|
|
|
|
|
setTimeout(() => window.location.reload(), 1e3)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
addDeliveryTarget(index) {
|
|
|
|
|
this.configData.deliveryModes[ index ].params.routing.connectors.push(["connectorName","connectorParam"])
|
|
|
|
|
},
|
|
|
|
|
addRegionCMD() {
|
|
|
|
|
addDeliveryMode() {
|
|
|
|
|
this.configData.deliveryModes.push({
|
|
|
|
|
name: "",
|
|
|
|
|
params: {
|
|
|
|
|
"type": "simple",
|
|
|
|
|
"routing": {
|
|
|
|
|
"device": "generic",
|
|
|
|
|
"connectors": []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
preset: null
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|