webapp: select first inverter when loaded
This commit is contained in:
parent
670c2d6762
commit
b4aad4b3c7
@ -71,6 +71,7 @@
|
||||
|
||||
<script>
|
||||
import InverterChannelInfo from "@/components/partials/InverterChannelInfo";
|
||||
import bootstrap from "bootstrap/dist/js/bootstrap.js";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@ -82,6 +83,7 @@ export default {
|
||||
heartInterval: null,
|
||||
waitForData: true,
|
||||
inverterData: [],
|
||||
isFirstFetchAfterConnect: true,
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@ -90,6 +92,20 @@ export default {
|
||||
unmounted() {
|
||||
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: {
|
||||
initSocket() {
|
||||
console.log("Starting connection to WebSocket Server");
|
||||
@ -134,6 +150,7 @@ export default {
|
||||
closeSocket() {
|
||||
this.socket.close();
|
||||
this.heartInterval && clearTimeout(this.heartInterval);
|
||||
this.isFirstFetchAfterConnect = true;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user