webapp: select first inverter when loaded
This commit is contained in:
parent
670c2d6762
commit
b4aad4b3c7
@ -71,6 +71,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import InverterChannelInfo from "@/components/partials/InverterChannelInfo";
|
import InverterChannelInfo from "@/components/partials/InverterChannelInfo";
|
||||||
|
import bootstrap from "bootstrap/dist/js/bootstrap.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -82,6 +83,7 @@ export default {
|
|||||||
heartInterval: null,
|
heartInterval: null,
|
||||||
waitForData: true,
|
waitForData: true,
|
||||||
inverterData: [],
|
inverterData: [],
|
||||||
|
isFirstFetchAfterConnect: true,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -90,6 +92,20 @@ export default {
|
|||||||
unmounted() {
|
unmounted() {
|
||||||
this.closeSocket();
|
this.closeSocket();
|
||||||
},
|
},
|
||||||
|
updated() {
|
||||||
|
// Select first tab
|
||||||
|
if (this.isFirstFetchAfterConnect) {
|
||||||
|
this.isFirstFetchAfterConnect = false;
|
||||||
|
|
||||||
|
var firstTabEl = this.$el.querySelector(
|
||||||
|
"#v-pills-tab:first-child button"
|
||||||
|
);
|
||||||
|
if (firstTabEl != null) {
|
||||||
|
var firstTab = new bootstrap.Tab(firstTabEl);
|
||||||
|
firstTab.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initSocket() {
|
initSocket() {
|
||||||
console.log("Starting connection to WebSocket Server");
|
console.log("Starting connection to WebSocket Server");
|
||||||
@ -126,7 +142,7 @@ export default {
|
|||||||
// Connection status
|
// Connection status
|
||||||
this.socket.send("ping");
|
this.socket.send("ping");
|
||||||
} else {
|
} else {
|
||||||
this.initSocket(); // Breakpoint reconnection 5 Time
|
this.initSocket(); // Breakpoint reconnection 5 Time
|
||||||
}
|
}
|
||||||
}, 59 * 1000);
|
}, 59 * 1000);
|
||||||
},
|
},
|
||||||
@ -134,6 +150,7 @@ export default {
|
|||||||
closeSocket() {
|
closeSocket() {
|
||||||
this.socket.close();
|
this.socket.close();
|
||||||
this.heartInterval && clearTimeout(this.heartInterval);
|
this.heartInterval && clearTimeout(this.heartInterval);
|
||||||
|
this.isFirstFetchAfterConnect = true;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user