Skip to content

Commit

Permalink
v4.0.11-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
jemu75 committed Jan 14, 2024
1 parent 68f9286 commit 160ba61
Show file tree
Hide file tree
Showing 22 changed files with 350 additions and 194 deletions.
50 changes: 29 additions & 21 deletions public/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,43 @@
# v4.0.11-beta (13.01.2024)
## Panel
- Bugfix switching Levels
# v4.0.10-beta (06.01.2024)
## Component Chart

- Initial Development
# v4.0.9-beta (02.01.2024)
## Component Slider - vertical

## Component Slider
- option Vertical
# v4.0.8-beta (01.01.2024)
## coreFunction - distributed Templates

## coreFunction
- distributed Templates
# v4.0.7-beta (31.12.2023)
## Panel - bugfixing

## Panel
- bugfixing
# v4.0.6-beta (29.12.2023)
## Panel - adding Property maximizable

## Panel
- adding Property maximizable
# v4.0.5-beta (29.12.2023)
## Component Slider - bugfixing
## Component Image - adding Property height

## Component Slider
- bugfixing
## Component Image
- adding Property height
# v4.0.4-beta (28.12.2023)
## coreFunction - bugfixing

## coreFunction
- bugfixing
# v4.0.3-beta (27.12.2023)
## coreFunction - bugfixing

## coreFunction
- bugfixing
# v4.0.2-beta (26.12.2023)
## sort Option for Navigation Settings
## 1st reconnect without warning
## Template Setting show JSON-Data

## Navigation Setting
- sort Option
## core
-1st reconnect without warning
## Template Setting
- show JSON-Data
# v4.0.1-beta (18.12.2023)
## initial development

- fhem Core
- UI
# v4.0.0-beta (17.12.2023)
## initial development
- fhem Core
49 changes: 14 additions & 35 deletions src/components/PanelCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,46 +56,23 @@
return res
})
const levelClick = ref(false)
function levelSwitch(init) {
let idx = -1
function clickReset() {
levelClick.value = false
}
if(expand.value.expandable || (!expand.value.expandable && expand.value.expanded)) {
if(!init) {
if(expand.value.maximizable) fhem.app.panelMaximized = expanded.value ? false : item.panel
expanded.value = !expanded.value
}
function levelSwitch() {
if(expand.value.expandable) {
if(expand.value.maximizable) {
if(!expanded.value) {
fhem.app.panelMaximized = item.panel
} else {
fhem.app.panelMaximized = false
}
}
expanded.value = !expanded.value
levels.value = expanded.value ? levelsActive.value : [levelsActive.value[0]]
} else {
levelClick.value = true
idx = levelsActive.value.indexOf(levels.value ? levels.value[0] : null)
levels.value = (idx === -1 || idx === levelsActive.value.length - 1) ? [levelsActive.value[0]] : [levelsActive.value[idx + 1]]
}
}
const levels = computed(() => {
let res = [],
idx = -1
if(expand.value.expandable || (!expand.value.expandable && expand.value.expanded)) {
res = expanded.value ? levelsActive.value : [levelsActive.value[0]]
} else {
if(levelClick.value) {
idx = levelsActive.value.indexOf(levels.value ? levels.value[0] : null)
res = (idx === -1 || idx === levelsActive.value.length - 1) ? [levelsActive.value[0]] : [levelsActive.value[idx + 1]]
clickReset()
} else {
res = [levelsActive.value[0]]
}
}
return res
})
const levels = ref([])
function getInfo(pos) {
let res = fhem.handleDefs(item.panel.info[pos], ['text', 'icon', 'color'],['', '', ''])
Expand All @@ -119,6 +96,8 @@
const infoMid2 = computed(() => getInfo('mid2'))
const infoRight1 = computed(() => getInfo('right1'))
const infoRight2 = computed(() => getInfo('right2'))
levelSwitch(true)
</script>

<template>
Expand Down Expand Up @@ -151,7 +130,7 @@
</v-col>
<v-spacer></v-spacer>
<v-col v-if="expandIcon" cols="1" class="text-right">
<v-btn :icon="expandIcon" size="small" variant="plain" density="compact" @click="levelSwitch"></v-btn>
<v-btn :icon="expandIcon" size="small" variant="plain" density="compact" @click="levelSwitch(false)"></v-btn>
</v-col>
</v-row>
</v-card-title>
Expand Down
2 changes: 1 addition & 1 deletion src/components/PanelMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<v-sheet :height="getHeight(lvl, 'level')"></v-sheet>
<template v-for="position of ['left1', 'left2', 'mid', 'right1', 'right2']" :key="position">
<v-col v-if="lvl.level[position]" :cols="getCols(lvl, position)" :class="getClass(lvl.level[position])">
<component :is="getComponent(lvl.level[position])" :el="lvl[position]" :iconmap="iconmap" :devices="devices"></component>
<component :is="getComponent(lvl.level[position])" :el="lvl[position]" :iconmap="iconmap" :devices="devices" :height="getHeight(lvl, 'level')"></component>
</v-col>
<v-divider v-if="showDivider(lvl, position)" vertical></v-divider>
</template>
Expand Down
3 changes: 2 additions & 1 deletion src/components/PanelMainBtn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
const props = defineProps({
el: Object,
iconmap: Array,
devices: Array
devices: Array,
height: String
})
const fhem = useFhemStore()
Expand Down
152 changes: 152 additions & 0 deletions src/components/PanelMainChart copy 3.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
<script setup>
import { ref, computed, onMounted } from 'vue'
import { useFhemStore } from '@/stores/fhem'
import VChart from 'vue-echarts'
const props = defineProps({
el: Object,
iconmap: Array,
devices: Array,
height: String
})
const fhem = useFhemStore()
const option = ref({
tooltip: {
trigger: 'axis'
},
xAxis: { type: 'time' },
yAxis: [
{ type: 'value', axisLabel: { formatter: '{value} Liter'} },
{ type: 'value', axisLabel: { formatter: '{value} irgendwas'} }
],
legend: {
data: ['Liter', 'irgendwas']
},
series: [
{
name: 'Liter',
data: [],
type: 'line',
smooth: true,
yAxisIndex: 0,
tooltip: {
valueFormatter: function (value) {
return value + ' Liter'
}
}
},
{
name: 'irgendwas',
data: [['2023-12-27T17:22:34', 12]],
type: 'line',
yAxisIndex: 1,
tooltip: {
valueFormatter: function (value) {
return value + ' ml'
}
}
}
]
})
const seriesDefs = computed(() => {
let res = fhem.handleDefs(
props.el.serie,
['log', 'from', 'to', 'column', 'filter', 'format', 'name', 'type', 'calc'],
[null, -6, 0, 4, null, null, '', 'line', 'raw'], true),
defPart
for(const [ idx, def ] of Object.entries(props.el.serie)) {
defPart = def.split(':')[7]
if(defPart) res[idx].format = defPart
if(!res[idx].format) res[idx].format = '%n()'
}
return res
})
const chartStyle = computed(() => {
let res = 'height: ' + props.height
if(fhem.app.panelMaximized) res = 'height: 80vh'
return res
})
function getDate(diff) {
return ( d => new Date(d.setDate(d.getDate() + (Number(diff) || 0))).toISOString() )(new Date).split('T')[0]
}
function getDevice(device) {
let defParts = []
for(const device of props.devices) {
defParts = device.split(':')
if(RegExp(defParts[0]).test(device)) return defParts[1]
}
return device
}
function handleLogData(data) {
let rows = data.split('\n'),
ts,
value,
res = []
if(rows.length > 0) {
for(const row of rows) {
ts = new Date(row.split(' ')[0].replace('_','T'))
value = parseFloat(row.split(' ')[1])
res.push([ts, value])
}
}
return res
}
function loadChartData() {
readLogData(seriesDefs.value)
.then((res) => {
if(res.length > 0) {
for(const data of res) {
option.value.series[0].data = handleLogData(data.data, data.calc)
}
}
})
}
async function readLogData(series) {
let res = [],
cmd,
logData
for(const [idx, serie] of Object.entries(series)) {
if(serie.log) {
cmd = 'get ' + getDevice(serie.log) + ' - - '
cmd += getDate(serie.from) + ' '
cmd += getDate(serie.to) + ' '
cmd += serie.column + ':' + serie.filter + ':0:int'
logData = fhem.request('text', cmd)
if(logData) {
res.push({ id: idx, data: await logData, name: serie.name, format: serie.format, type: serie.type, calc: serie.calc })
}
}
}
return res
}
onMounted(() => {
loadChartData()
})
</script>

<template>
<v-chart :style="chartStyle" :option="option" :init-options="{ locale: 'DE' }" autoresize />
</template>
Loading

0 comments on commit 160ba61

Please sign in to comment.