Skip to content

Commit

Permalink
vedirect vue code follows master
Browse files Browse the repository at this point in the history
  • Loading branch information
helgeerbe committed Nov 3, 2022
1 parent b3295f5 commit 407e0ee
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 115 deletions.
24 changes: 0 additions & 24 deletions webapp/src/types/LiveDataStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,4 @@ export interface Total {
export interface LiveData {
inverters: Inverter[],
total: Total,
}

// Ve.Direct
export interface Vedirect {
SER: string,
PID: string,
FW: string,
age_critical: boolean,
data_age: 0,
LOAD: ValueObject,
CS: ValueObject,
MPPT: ValueObject,
OR: ValueObject,
ERR: ValueObject,
HSDS: ValueObject,
V: ValueObject,
I: ValueObject,
VPV: ValueObject,
PPV: ValueObject,
H19: ValueObject,
H20: ValueObject,
H21: ValueObject,
H22: ValueObject,
H23: ValueObject,
}
5 changes: 5 additions & 0 deletions webapp/src/types/VedirectConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface VedirectConfig {
vedirect_enabled: boolean,
vedirect_pollinterval: number,
vedirect_updatesonly: boolean
}
25 changes: 25 additions & 0 deletions webapp/src/types/VedirectLiveDataStatus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { ValueObject } from '@/types/LiveDataStatus';

// Ve.Direct
export interface Vedirect {
SER: string,
PID: string,
FW: string,
age_critical: boolean,
data_age: 0,
LOAD: ValueObject,
CS: ValueObject,
MPPT: ValueObject,
OR: ValueObject,
ERR: ValueObject,
HSDS: ValueObject,
V: ValueObject,
I: ValueObject,
VPV: ValueObject,
PPV: ValueObject,
H19: ValueObject,
H20: ValueObject,
H21: ValueObject,
H22: ValueObject,
H23: ValueObject,
}
4 changes: 4 additions & 0 deletions webapp/src/types/VedirectStatus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface VedirectStatus {
vedirect_enabled: boolean,
vedirect_updatesonly: boolean
}
83 changes: 37 additions & 46 deletions webapp/src/views/VedirectAdminView.vue
Original file line number Diff line number Diff line change
@@ -1,76 +1,67 @@
<template>
<div class="container-xxl" role="main">
<div class="page-header">
<h1>Ve.direct Settings</h1>
</div>
<BasePage :title="'Ve.direct Settings'" :isLoading="dataLoading">
<BootstrapAlert v-model="showAlert" dismissible :variant="alertType">
{{ alertMessage }}
</BootstrapAlert>

<div class="text-center" v-if="dataLoading">
<div class="spinner-border" role="status">
<span class="visually-hidden">Loading...</span>
</div>
</div>
<template v-if="!dataLoading">
<form @submit="saveVedirectConfig">
<div class="card">
<div class="card-header bg-primary">Ve.direct Configuration</div>
<div class="card-body">
<div class="row mb-3">
<label class="col-sm-2 form-check-label" for="inputVedirect">Enable Ve.direct</label>
<div class="col-sm-10">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="inputVedirect"
v-model="vedirectConfigList.vedirect_enabled" />
</div>
<form @submit="saveVedirectConfig">
<div class="card">
<div class="card-header text-bg-primary">Ve.direct Configuration</div>
<div class="card-body">
<div class="row mb-3">
<label class="col-sm-2 form-check-label" for="inputVedirect">Enable Ve.direct</label>
<div class="col-sm-10">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="inputVedirect"
v-model="vedirectConfigList.vedirect_enabled" />
</div>
</div>
<div class="row mb-3" v-show="vedirectConfigList.vedirect_enabled">
<label for="inputPollInterval" class="col-sm-2 col-form-label">Poll Interval:</label>
<div class="col-sm-10">
<div class="input-group">
<input type="number" class="form-control" id="inputPollInterval" min="1" max="86400"
placeholder="Poll Interval in Seconds" v-model="vedirectConfigList.vedirect_pollinterval"
aria-describedby="pollIntervalDescription" />
<span class="input-group-text" id="pollIntervalDescription">seconds</span>
</div>
</div>

<div class="row mb-3" v-show="vedirectConfigList.vedirect_enabled">
<label for="inputPollInterval" class="col-sm-2 col-form-label">Poll Interval:</label>
<div class="col-sm-10">
<div class="input-group">
<input type="number" class="form-control" id="inputPollInterval" min="1" max="86400"
placeholder="Poll Interval in Seconds" v-model="vedirectConfigList.vedirect_pollinterval"
aria-describedby="pollIntervalDescription" />
<span class="input-group-text" id="pollIntervalDescription">seconds</span>
</div>
</div>
<div class="row mb-3" v-show="vedirectConfigList.vedirect_enabled">
<label class="col-sm-2 form-check-label" for="inputTls">Send only updates</label>
<div class="col-sm-10">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="inputTls"
v-model="vedirectConfigList.vedirect_updatesonly" />
</div>
</div>

<div class="row mb-3" v-show="vedirectConfigList.vedirect_enabled">
<label class="col-sm-2 form-check-label" for="inputUpdates">Send only updates</label>
<div class="col-sm-10">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="inputUpdates"
v-model="vedirectConfigList.vedirect_updatesonly" />
</div>
</div>
</div>
</div>
</div>

<button type="submit" class="btn btn-primary mb-3">Save</button>
</form>
</template>
</div>
<button type="submit" class="btn btn-primary mb-3">Save</button>
</form>
</BasePage>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import BasePage from '@/components/BasePage.vue';
import BootstrapAlert from "@/components/BootstrapAlert.vue";
import type { VedirectConfig } from "@/types/VedirectConfig";
export default defineComponent({
components: {
BasePage,
BootstrapAlert,
},
data() {
return {
dataLoading: true,
vedirectConfigList: {
vedirect_enabled: false,
vedirect_pollinterval: 0,
vedirect_updatesonly: true,
},
vedirectConfigList: {} as VedirectConfig,
alertMessage: "",
alertType: "info",
showAlert: false,
Expand Down
72 changes: 31 additions & 41 deletions webapp/src/views/VedirectInfoView.vue
Original file line number Diff line number Diff line change
@@ -1,62 +1,52 @@
<template>
<div class="container-xxl" role="main">
<div class="page-header">
<h1>Ve.direct Info</h1>
</div>

<div class="text-center" v-if="dataLoading">
<div class="spinner-border" role="status">
<span class="visually-hidden">Loading...</span>
</div>
</div>

<template v-if="!dataLoading">
<div class="card">
<div class="card-header bg-primary">Configuration Summary</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-hover table-condensed">
<tbody>
<tr>
<th>Status</th>
<td class="badge" :class="{
'bg-danger': !vedirectDataList.vedirect_enabled,
'bg-success': vedirectDataList.vedirect_enabled,
}">
<span v-if="vedirectDataList.vedirect_enabled">enabled</span>
<span v-else>disabled</span>
</td>
</tr>
<tr v-show="vedirectDataList.vedirect_enabled">
<BasePage :title="'Ve.direct Info'" :isLoading="dataLoading">
<div class="card">
<div class="card-header text-bg-primary">Configuration Summary</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-hover table-condensed">
<tbody>
<tr>
<th>Status</th>
<td class="badge" :class="{
'text-bg-danger': !vedirectDataList.vedirect_enabled,
'text-bg-success': vedirectDataList.vedirect_enabled,
}">
<span v-if="vedirectDataList.vedirect_enabled">enabled</span>
<span v-else>disabled</span>
</td>
</tr>
<tr v-show="vedirectDataList.vedirect_enabled">
<th>Updates Only</th>
<td class="badge" :class="{
'bg-danger': !vedirectDataList.vedirect_updatesonly,
'bg-success': vedirectDataList.vedirect_updatesonly,
'text-bg-danger': !vedirectDataList.vedirect_updatesonly,
'text-bg-success': vedirectDataList.vedirect_updatesonly,
}">
<span v-if="vedirectDataList.vedirect_updatesonly">enabled</span>
<span v-else>disabled</span>
</td>
</tr>
</tbody>
</table>
</div>
</tr>
</tbody>
</table>
</div>
</div>
</template>
</div>
</div>
</BasePage>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import BasePage from '@/components/BasePage.vue';
import type { VedirectStatus } from "@/types/VedirectStatus";
export default defineComponent({
components: {
BasePage,
},
data() {
return {
dataLoading: true,
vedirectDataList: {
vedirect_enabled: false,
vedirect_updatesonly: true,
},
vedirectDataList: {} as VedirectStatus,
};
},
created() {
Expand Down
8 changes: 4 additions & 4 deletions webapp/src/views/VedirectView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center"
:class="{
'bg-danger': vedirectData.age_critical,
'bg-primary': !vedirectData.age_critical,
'text-bg-danger': vedirectData.age_critical,
'text-bg-primary': !vedirectData.age_critical,
}">
<div class="p-1 flex-grow-1">
<div class="d-flex flex-wrap">
Expand All @@ -33,7 +33,7 @@
</div>
</div>
<div class="card-body">
<div class="row">
<div class="row flex-row-reverse flex-wrap-reverse align-items-end g-3">
<div class="col order-0">
<div class="card" :class="{ 'border-info': true }">
<div class="card-header bg-info">Device Info</div>
Expand Down Expand Up @@ -176,7 +176,7 @@

<script lang="ts">
import { defineComponent } from 'vue';
import type { Vedirect } from '@/types/LiveDataStatus';
import type { Vedirect } from '@/types/VedirectLiveDataStatus';
export default defineComponent({
components: {
Expand Down
Binary file modified webapp_dist/js/app.js.gz
Binary file not shown.

0 comments on commit 407e0ee

Please sign in to comment.