Skip to content

Commit c8b5a99

Browse files
authored
Colors theme fixes (#2696)
* modify powergraph look * fix chargepoint display in powergraph * hide battery widget when not configured
1 parent 20d3363 commit c8b5a99

4 files changed

Lines changed: 17 additions & 7 deletions

File tree

packages/modules/web_themes/colors/source/src/components/powerGraph/processLiveGraphData.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ function extractValues(data: RawGraphDataItem): GraphDataItem {
7979
: 1
8080
const car1id = 'ev' + car1 + '-soc'
8181
const car2id = 'ev' + car2 + '-soc'
82+
const re_cp = /cp(\d+)-power/
8283
const values: GraphDataItem = {}
8384
values.date = +data.timestamp * 1000
8485
if (+data.grid > 0) {
@@ -124,10 +125,18 @@ function extractValues(data: RawGraphDataItem): GraphDataItem {
124125

125126
values.charging = +data['charging-all']
126127
// charge points - we only show a maximum of 10 chargepoints in the graph
127-
for (let i = 0; i < 10; i++) {
128+
/* for (let i = 0; i < 10; i++) {
128129
const idx = 'cp' + i
129130
values[idx] = +(data[idx + '-power'] ?? 0)
130-
}
131+
} */
132+
Object.keys(data)
133+
.filter(key => re_cp.test(key))
134+
.forEach((key) => {
135+
const found = key.match(re_cp)
136+
if (found && found[1]) {
137+
values['cp' + found[1]] = +(data[key] ?? 0)
138+
}
139+
})
131140
values.selfUsage = values.pv - values.evuOut
132141
if (values.selfUsage < 0) {
133142
values.selfUsage = 0

packages/modules/web_themes/colors/source/src/components/powerMeter/PMArc.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const props = defineProps<{
5656
categoriesToShow: PowerItemType[]
5757
}>()
5858
59-
const cornerRadius = 20
59+
const cornerRadius = 10
6060
const circleGapSize = Math.PI / 40
6161
const arcCount = computed(() => props.plotdata.length - 1)
6262
const pieGenerator = computed(() =>
@@ -75,7 +75,7 @@ const pieGenerator = computed(() =>
7575
const path = computed(() =>
7676
arc<PieArcDatum<PowerItem>>()
7777
//.innerRadius((props.radius / 6) * 5)
78-
.innerRadius(props.radius * 0.88)
78+
.innerRadius(props.radius * 0.87)
7979
.outerRadius(props.radius)
8080
.cornerRadius(cornerRadius),
8181
)

packages/modules/web_themes/colors/source/src/views/ColorsTheme.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Hagen */
8181
<span class="d-none d-md-inline ms-2">Fahrzeuge</span>
8282
</a>
8383
<a
84-
v-if="globalData.isBatteryConfigured"
84+
v-if="globalData.isBatteryConfigured && batteries.size > 0"
8585
class="nav-link"
8686
data-bs-toggle="tab"
8787
data-bs-target="#batterylist"
@@ -251,6 +251,7 @@ import { ref, computed, onMounted } from 'vue'
251251
import { globalData } from '../assets/js/model'
252252
import { shDevices } from '@/components/smartHome/model'
253253
import { initConfig } from '@/assets/js/themeConfig'
254+
import { batteries } from '@/components/batteryList/model'
254255
import PowerMeter from '@/components/powerMeter/PowerMeter.vue'
255256
import PowerGraph from '@/components/powerGraph/PowerGraph.vue'
256257
import EnergyMeter from '@/components/energyMeter/EnergyMeter.vue'

packages/modules/web_themes/colors/source/vite.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { fileURLToPath, URL } from 'url'
2-
import { defineConfig, splitVendorChunkPlugin } from 'vite'
2+
import { defineConfig } from 'vite'
33
import vue from '@vitejs/plugin-vue'
44
import { NodeGlobalsPolyfillPlugin } from "@esbuild-plugins/node-globals-polyfill";
55
import { NodeModulesPolyfillPlugin } from "@esbuild-plugins/node-modules-polyfill";
@@ -14,7 +14,7 @@ export default defineConfig({
1414
}
1515
}
1616
}),
17-
splitVendorChunkPlugin(),
17+
1818
],
1919
resolve: {
2020
alias: {

0 commit comments

Comments
 (0)