You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
173 lines
8.4 KiB
HTML
173 lines
8.4 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<title>DWD Module Configuration</title>
|
|
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
|
|
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@4.x/css/materialdesignicons.min.css" rel="stylesheet">
|
|
<link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
|
|
</head>
|
|
|
|
<body>
|
|
<div id="app">
|
|
<v-app>
|
|
<v-app-bar app>
|
|
<v-toolbar-title>
|
|
DWD Module Configuration
|
|
</v-toolbar-title>
|
|
</v-app-bar>
|
|
<v-content>
|
|
<v-form>
|
|
<v-tabs v-model="configTab" next-icon="mdi-arrow-right-bold-box-outline" prev-icon="mdi-arrow-left-bold-box-outline" show-arrows>
|
|
<v-tabs-slider></v-tabs-slider>
|
|
<v-tab key="regions">Regions</v-tab>
|
|
<v-tab key="notificationConfig">Notification Configuration</v-tab>
|
|
</v-tabs>
|
|
<v-tabs-items v-model="configTab">
|
|
<v-tab-item key="regions">
|
|
<v-container>
|
|
<v-row>
|
|
<v-col cols="12" sm="12" md="12">
|
|
<v-checkbox label="Support Menus" v-model="configData.menuSupport"></v-checkbox>
|
|
</v-col>
|
|
</v-row>
|
|
<p>Regions:</p>
|
|
<v-row>
|
|
<v-btn color="success" @click="addRegionCMD()">Add</v-btn>
|
|
</v-row>
|
|
<v-row v-for="(region, index) in configData.regions" :key="region._id" style="border-bottom: 2px solid black;">
|
|
<pre>Index: {{ index }}</pre>
|
|
<v-col cols="12" sm="12" md="12">
|
|
<v-checkbox label="Active" v-model="region.active"></v-checkbox>
|
|
<v-btn color="error" @click="configData.regions.splice(index, 1)" icon><v-icon>mdi-delete</v-icon></v-btn>
|
|
</v-col>
|
|
<v-col cols="6" sm="6" md="4">
|
|
<v-text-field v-model="region.name" label="Name"></v-text-field>
|
|
</v-col>
|
|
<v-col cols="6" sm="6" md="4">
|
|
<v-text-field v-model="region.dwdID" label="DWD ID"></v-text-field>
|
|
</v-col>
|
|
</v-row>
|
|
<v-row>
|
|
<v-btn color="success" @click="storeConfig()">Store & Restart</v-btn>
|
|
</v-row>
|
|
</v-container>
|
|
</v-tab-item>
|
|
<v-tab-item key="notificationConfig">
|
|
<v-container>
|
|
<b>Routing Paramters:</b>
|
|
<v-row>
|
|
<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-col cols="12" sm="12" md="6">
|
|
<v-select :items="pagerTypes" v-model="configData.pager.params.type" item-text="k" item-value="v" label="Delivery Type"></v-select>
|
|
</v-col>
|
|
</v-row>
|
|
<v-row>
|
|
<v-col cols="12" sm="12" md="6">
|
|
<v-select :items="deviceType" v-model="configData.pager.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()">Add</v-btn>
|
|
<v-row v-for="(connector, index) in configData.pager.params.routing.connectors" :key="index">
|
|
<v-col cols="6" sm="4" md="4">
|
|
<v-text-field v-model="connector[0]" label="Connector Name"></v-text-field>
|
|
</v-col>
|
|
<v-col cols="6" sm="4" md="4">
|
|
<v-text-field v-model="connector[1]" label="Connector Param"></v-text-field>
|
|
</v-col>
|
|
<v-col cols="6" sm="4" md="4">
|
|
<v-btn color="error" @click="configData.pager.params.routing.connectors.splice(index, 1)" icon><v-icon>mdi-delete</v-icon></v-btn>
|
|
</v-col>
|
|
</v-row>
|
|
<v-row>
|
|
<v-btn color="success" @click="storeConfig()">Store & Restart</v-btn>
|
|
</v-row>
|
|
</v-container>
|
|
</v-tab-item>
|
|
</v-tabs-items>
|
|
</v-form>
|
|
</v-content>
|
|
</v-app>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/vue-resource@1.5.1"></script>
|
|
<script>
|
|
new Vue({
|
|
el: '#app',
|
|
vuetify: new Vuetify(),
|
|
http: { root: '/' },
|
|
data() {
|
|
return {
|
|
configTab: null,
|
|
pagerTypes: [
|
|
{k: 'Simple', v: 'simple'},
|
|
{k: 'Duplex', v: 'duplex'},
|
|
],
|
|
deviceType: [
|
|
{k: 'Generic', v: 'generic'},
|
|
{k: 'Birdy Slim (IoT)', v: 'birdyslim'},
|
|
],
|
|
configData: {
|
|
"pager": {
|
|
"url": "",
|
|
"params": {
|
|
"type": "",
|
|
"routing": {
|
|
"device": "",
|
|
"connectors": []
|
|
}
|
|
}
|
|
},
|
|
"menuSupport": false,
|
|
"regions": []
|
|
},
|
|
}
|
|
},
|
|
created() {
|
|
this.loadConfig()
|
|
},
|
|
methods: {
|
|
loadConfig() {
|
|
this.$http.get('/config').then(response => {
|
|
const newConfig = response.body
|
|
newConfig.regions = newConfig.regions.map((x) => {
|
|
x._id = btoa(JSON.stringify(x))
|
|
return x
|
|
})
|
|
this.configData = newConfig
|
|
}, response => {
|
|
})
|
|
},
|
|
storeConfig() {
|
|
const storeConfig = JSON.parse(JSON.stringify(this.configData))
|
|
this.$http.post('/config', storeConfig).then(response => {
|
|
})
|
|
.then(this.$http.post('/restart'))
|
|
.then(() => {
|
|
document.body.style = 'display:none'
|
|
setTimeout(() => window.location.reload(), 1e3)
|
|
})
|
|
},
|
|
addDeliveryTarget() {
|
|
this.configData.pager.params.routing.connectors.push(["connectorName","connectorParam"])
|
|
},
|
|
addRegionCMD() {
|
|
this.configData.regions.push({
|
|
name: "",
|
|
active: true,
|
|
dwdID: "",
|
|
})
|
|
},
|
|
}
|
|
})
|
|
</script>
|
|
</body>
|
|
|
|
</html>
|