Skip to content

Commit

Permalink
beginning of daily graph page
Browse files Browse the repository at this point in the history
  • Loading branch information
Lutz Bender committed Feb 16, 2022
1 parent 4c0a544 commit 5667ab3
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/components/OpenwbPageNavbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,33 @@
Status
</router-link>
</li>
<li class="nav-item dropdown">
<a
class="nav-link dropdown-toggle"
href="#"
role="button"
data-toggle="dropdown"
aria-expanded="false"
>
Auswertungen
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<router-link
to="/Logging/ChargeLog"
class="dropdown-item"
active-class="active disabled"
>
Ladeprotokoll
</router-link>
<router-link
to="/Logging/DailyGraph"
class="dropdown-item"
active-class="active disabled"
>
Tagesauswertung
</router-link>
</div>
</li>
<li v-if="nodeEnv !== 'production'" class="nav-item dropdown">
<a
class="nav-link dropdown-toggle"
Expand Down
12 changes: 12 additions & 0 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,18 @@ const routes = [
"../views/ChargeLog.vue"
),
},
{
path: "/Logging/DailyGraph",
name: "DailyGraph",
meta: {
heading: "Tagesauswertung",
},
component: () =>
import(
/* webpackChunkName: "DailyGraph" */
"../views/DailyGraph.vue"
),
},
];
/* examples for development only start here */
if (process.env.NODE_ENV !== "production") {
Expand Down
104 changes: 104 additions & 0 deletions src/views/DailyGraph.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<template>
<div class="dailyGraph">
<form name="dailyGraphForm">
<openwb-base-card title="Filter">
<openwb-base-text-input
title="Datum"
subtype="date"
min="2018-01-01"
max="2022-12-31"
v-model="dailyGraphDate"
/>
<template #footer>
<div class="row justify-content-center">
<openwb-base-click-button
class="col-4 btn-success"
@click="requestDailyGraph()"
>
Daten anfordern
</openwb-base-click-button>
</div>
</template>
</openwb-base-card>
<openwb-base-card title="Tages-Diagramm"></openwb-base-card>
<openwb-base-alert subtype="info">
Graph Dataset:<br />
<pre>{{ dailyGraphDataset }}</pre>
</openwb-base-alert>
</form>
</div>
</template>

<script>
import ComponentStateMixin from "@/components/mixins/ComponentState.vue";
export default {
name: "DailyGraph",
mixins: [ComponentStateMixin],
emits: ["sendCommand"],
data() {
return {
mqttTopicsToSubscribe: [
"openWB/general/extern",
"openWB/log/daily/#",
],
dailyGraphRequestData: {
day: "01",
month: "01",
year: "2022",
},
};
},
computed: {
dailyGraphDate: {
get() {
return (
this.dailyGraphRequestData.year +
"-" +
this.dailyGraphRequestData.month +
"-" +
this.dailyGraphRequestData.day
);
},
set(newValue) {
let splitDate = newValue.split("-");
this.dailyGraphRequestData.year = splitDate[0];
this.dailyGraphRequestData.month = splitDate[1];
this.dailyGraphRequestData.day = splitDate[2];
},
},
commandData: {
get() {
return {
day:
this.dailyGraphRequestData.year +
this.dailyGraphRequestData.month +
this.dailyGraphRequestData.day,
};
},
},
dailyGraphDataset: {
get() {
return this.$store.state.mqtt[
"openWB/log/daily/" + this.commandData.day
];
},
},
},
methods: {
requestDailyGraph() {
let myForm = document.forms["dailyGraphForm"];
if (!myForm.reportValidity()) {
console.log("form invalid");
return;
} else {
console.log(this.dailyGraphRequestData);
this.$emit("sendCommand", {
command: "getDailyLog",
data: this.commandData,
});
}
},
},
};
</script>

0 comments on commit 5667ab3

Please sign in to comment.