Skip to content

Commit

Permalink
Fixed some client side problems
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Apr 24, 2019
1 parent d1df6d2 commit fe5327e
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 9 deletions.
14 changes: 8 additions & 6 deletions src/components/MqttClients.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
<td>{{ props.item.reconnectPeriod }}</td>
<td>{{ props.item.auth ? 'Required' : 'Not Required' }}</td>
<td>{{ props.item.clean ? 'Yes' : 'No' }}</td>
<td>{{ getMaps(props.item) }}</td>
<td>{{ getMaps(props.item.mapsGet) }}</td>
<td>{{ getMaps(props.item.mapsSet) }}</td>
<td class="justify-center layout px-0">
<v-btn icon class="mx-0" @click="editItem(props.item)">
<v-icon color="teal">edit</v-icon>
Expand Down Expand Up @@ -116,7 +117,8 @@ export default {
{ text: "Reconnect (ms)", value: "reconnectPeriod" },
{ text: "Auth", value: "auth" },
{ text: "Clean", value: "clean" },
{ text: "Maps", value: "maps" },
{ text: "Maps GET", value: "mapsGet" },
{ text: "Maps SET", value: "mapsSet" },
{ text: "Actions", sortable: false }
],
fab: false,
Expand All @@ -126,16 +128,16 @@ export default {
showSnackbar(text) {
this.$emit("showSnackbar", text);
},
getMaps(item){
getMaps(itemMaps){
var result = ""
if(!item.maps){
if(!itemMaps){
result = "Not defined"
}
else{
var maps = this.maps
item.maps.forEach((id, i) => {
itemMaps.forEach((id, i) => {
var t = maps.find(e => e._id == id);
result += (t ? t.name : id) + (i == item.maps.length - 1 ? '' : ', ');
result += (t ? t.name : id) + (i == itemMaps.length - 1 ? '' : ', ');
});
}
return result;
Expand Down
31 changes: 29 additions & 2 deletions src/components/dialogs/Mqtt_Client.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@
</v-flex>
<v-flex xs12>
<v-combobox
v-model="editedValue.maps"
v-model="editedValue.mapsGet"
:items="maps"
label="Maps"
label="Maps Get"
multiple
item-text="name"
item-value="_id"
Expand All @@ -117,6 +117,33 @@
</template>
</v-combobox>
</v-flex>
<v-flex xs12>
<v-combobox
v-model="editedValue.mapsSet"
:items="maps"
label="Maps Set"
multiple
item-text="name"
item-value="_id"
chips
hint="Select the maps to use for outgoing packets, if multiple maps of same client match the first one matched is used"
persistent-hint
:return-object="false"
>
<template v-slot:selection="data">
<v-chip
:key="JSON.stringify(data.item)"
:selected="data.selected"
:disabled="data.disabled"
class="v-chip--select-multi"
close
@input="data.parent.selectItem(data.item)"
>
{{ getItem(data) }}
</v-chip>
</template>
</v-combobox>
</v-flex>
</v-layout>
</v-form>
</v-container>
Expand Down
14 changes: 13 additions & 1 deletion src/components/dialogs/Value.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,18 @@
></v-autocomplete>
</v-flex>

<v-flex xs12>
<v-flex xs12 sm7>
<v-select
v-model="editedValue.mode"
label="Mode"
hint="Specify if the broker need to subscribe (SET) or publish (GET) on this topic"
persistent-hint
required
:items="optionsMode"
></v-select>
</v-flex>

<v-flex xs12 sm5>
<v-switch
v-model="editedValue.customTopic"
persistent-hint
Expand Down Expand Up @@ -120,6 +131,7 @@ export default {
return {
valid: true,
defaultOptions: { qos: -1, retain: 0, payload: 0, from: "", to: ""},
optionsMode: ["GET", "SET"],
optionsRetain: [
{ text: "Keep original", value: 0 },
{ text: "False", value: 1 },
Expand Down

0 comments on commit fe5327e

Please sign in to comment.