-
Notifications
You must be signed in to change notification settings - Fork 21
/
IntegrationTest.vue
145 lines (143 loc) · 4.04 KB
/
IntegrationTest.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<template>
<q-page class="flex flex-center">
<integration
style="width: 100%; height: 100vh;"
ref="randomName"
host="http://mqttboard.flespi.io/#/integration"
name="randomName"
@ready="readyHandler"
@updateSettings="update"
/>
</q-page>
</template>
<script>
// let config = {
// settings: {
// username: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
// },
// useLS: false,
// entities: [
// {
// type: 'subscriber',
// rendered: true,
// settings: {
// topic: 'a/b',
// mode: 0,
// options: {
// qos: 0,
// nl: false,
// rap: false,
// rh: 0,
// properties: {
// subscriptionIdentifier: undefined,
// userProperties: undefined
// }
// }
// }
// },
// {
// type: 'subscriber',
// rendered: true,
// settings: {
// topic: 'a/c',
// mode: 0,
// options: {
// qos: 0,
// nl: false,
// rap: false,
// rh: 0,
// properties: {
// subscriptionIdentifier: 3,
// userProperties: undefined
// }
// }
// }
// }
// ],
// whiteLabel: 'MQTT',
// secure: undefined,
// clientsCloseable: false,
// color: undefined,
// accentColor: undefined,
// configuredClients: [
// {
// status: false,
// config: {
// clientId: 'mqtt-board-50dd48be',
// wsOptions: { objectMode: false, perMessageDeflate: true },
// host: 'wss://mqtt.flespi.io',
// keepalive: 420,
// protocolVersion: 5,
// resubscribe: false,
// clean: true,
// username: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
// password: '',
// properties: { requestResponseInformation: false, requestProblemInformation: false }
// },
// publishers: [],
// subscribers: [
// { topic: 'a/b', mode: 0, treeField: '', highlight: true, options: { qos: 0, nl: false, rap: false, rh: 0, properties: {} }, unsubscribeProperties: {} },
// { topic: 'a/c', mode: 0, treeField: '', highlight: true, options: { qos: 0, nl: false, rap: false, rh: 0, properties: { subscriptionIdentifier: 3 } }, unsubscribeProperties: {} }
// ],
// entities: [{ type: 'logs', rendered: true }, { type: 'subscriber', rendered: true, index: 0, id: '29a45a15' }, { type: 'subscriber', rendered: true, index: 1, id: '29a77ca2' }],
// subscribersStatuses: [false, false],
// subscribersConnectivityStatuses: [false, false]
// }
// ]
// }
import Integration from '../src/components/Integration'
export default {
name: 'PageIndex',
data () {
return {
config: {
settings: undefined,
useLS: undefined,
entities: undefined,
whiteLabel: 'MQTT',
secure: undefined,
clientsCloseable: undefined,
color: undefined,
accentColor: undefined,
configuredClients: undefined
}
}
},
components: { Integration },
methods: {
readyHandler () {
this.$refs.randomName.setSettings(this.config)
this.$refs.randomName.setActive(0)
this.$refs.randomName.addPublisher({
topic: 'topic/to/publish',
payload: 'test',
options: {
qos: 1,
retain: false,
dup: false,
properties: {
payloadFormatIndicator: undefined,
messageExpiryInterval: 2323,
topicAlias: undefined,
responseTopic: undefined,
correlationData: undefined,
userProperties: undefined,
contentType: undefined
}
}
})
this.$refs.randomName.addSubscriber({
topic: 'topic/to/subscribe',
mode: 1,
treeField: '',
highlight: true,
options: { qos: 1, nl: false, rap: false, rh: 0, properties: {} },
unsubscribeProperties: {}
})
},
update (config) {
this.config = { ...this.config, ...config }
}
}
}
</script>