Skip to content

Commit

Permalink
v4.0.31-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
jemu75 committed Mar 24, 2024
1 parent f1ec7d1 commit 9e9deee
Show file tree
Hide file tree
Showing 18 changed files with 532 additions and 116 deletions.
6 changes: 6 additions & 0 deletions public/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v4.0.31-beta (24.03.2024)
## App
- bugfix for mobile Header
## Settings
- bugfix panel/template edit level items
- Wizard for element definitions
# v4.0.30-beta (20.03.2024)
## Core
- bugfix for euro-sign inside from definitions
Expand Down
28 changes: 26 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup>
import { ref } from 'vue'
import { ref, computed } from 'vue'
import { useFhemStore } from '@/stores/fhem'
import { useDisplay } from 'vuetify'
import router from '@/router'
Expand All @@ -11,6 +11,30 @@
const { mobile } = useDisplay()
const drawer = ref(true)
const mobileTitle = computed(() => {
let navPath = [],
navIdx,
res
navPath.push(...fhem.app.navigation)
if(fhem.app.currentView) {
for(const navNode of fhem.app.currentView.split('->')) {
navIdx = navPath.map((e) => e.name).indexOf(navNode)
if(navIdx !== -1) {
res = fhem.replacer(navPath[navIdx].title, '')
if(navPath[navIdx].group && navPath[navIdx].group.length > 0) {
navPath = navPath[navIdx].group
}
} else {
res = navNode
}
}
}
return res
})
function showInternals() {
router.push({ name: 'internals', query: router.currentRoute.value.query })
}
Expand Down Expand Up @@ -64,7 +88,7 @@
</template>

<div v-if="!mobile && fhem.app.header.showDate" class="text-h5">{{ $d(fhem.app.header.time, fhem.app.header.dateFormat) }}</div>
<div v-if="mobile && fhem.app.header.showTitle" class="text-h5">{{ fhem.app.header.title }}</div>
<div v-if="mobile && fhem.app.header.showTitle" class="text-h5">{{ mobileTitle }}</div>

<template v-slot:append>
<v-btn v-if="fhem.app.settings.loglevel > 6" icon="mdi-information" @click="showInternals()"></v-btn>
Expand Down
2 changes: 0 additions & 2 deletions src/components/AppNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
}
const loadView = (idx) => {
fhem.app.header.title = fhem.replacer(props.items[idx].title, '')
router.push({ name: 'devices', params: { view: getPath(props.items[idx].name) }, query: router.currentRoute.value.query })
}
</script>
Expand Down
54 changes: 49 additions & 5 deletions src/components/SettingsProps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
rawMode: false,
section: 'panel',
panel: null,
devices: {},
preview: 'panel',
jsonDef: null,
jsonError: null
Expand All @@ -165,6 +166,34 @@
return idx !== -1 ? fhem.app.panelList[idx] : null
}
async function getReadings(devices) {
let devParts,
res,
readings = [],
result = {}
if(devices.length > 0) {
for(const device of devices) {
devParts = device.split(':')
if(devParts[1]) {
res = await fhem.request('json', 'jsonList2 ' + devParts[1])
if(res && res.Results.length > 0) {
readings = []
for(const parts of ['Internals', 'Readings', 'Attributes']) {
for(const el of Object.keys(res.Results[0][parts])) readings.push(parts[0].toLowerCase() + '-' + el)
}
result[devParts[0]] = readings
}
}
}
}
return result
}
function addItem() {
let newPanel = {
name: settings.value.newItem,
Expand All @@ -190,10 +219,23 @@
editItem(fhem.app.config[props.type].length - 1)
}
function editItem(idx) {
async function editItem(idx) {
let panelIdx,
devices = []
item.value = fhem.app.config[props.type][idx]
settings.value.itemIdx = idx
if(props.type === 'panels') {
if(item.value.panel.devices && item.value.panel.devices.length > 0) devices.push(...item.value.panel.devices)
} else {
panelIdx = fhem.app.config.panels.map((e) => e.template).indexOf(item.value.name)
if(panelIdx !== -1 && fhem.app.config.panels[panelIdx].panel.devices) devices.push(...fhem.app.config.panels[panelIdx].panel.devices)
}
settings.value.devices = await getReadings(devices)
settings.value.extended = items.value[items.value.map((e) => e.idx).indexOf(idx)].advanced !== '-' ? true : false
if(typeof item.value === 'object') {
Expand Down Expand Up @@ -305,7 +347,7 @@
<v-row>
<v-col>
<v-row class="align-center">
<v-btn variant="plain" icon="mdi-arrow-up-left" @click="item = null"></v-btn>
<v-btn variant="plain" icon="mdi-arrow-up-left" @click="item = null; settings.panel = null"></v-btn>

<v-col cols="10" md="">
<v-autocomplete v-if="!settings.rawMode"
Expand Down Expand Up @@ -353,14 +395,16 @@
v-if="settings.section !== 'main'"
:type="type"
:typeIdx="settings.itemIdx"
:section="settings.section"
:section="settings.section"
:devices="settings.devices"
:extended="settings.extended">
</SettingsPropsList>
<SettingsPropsMain
v-if="settings.section === 'main'"
:type="type"
:typeIdx="settings.itemIdx"
:section="settings.section" >
:section="settings.section"
:devices="settings.devices">
</SettingsPropsMain>
</v-col>
</v-row>
Expand Down Expand Up @@ -409,5 +453,5 @@
</v-col>
</v-row>
</v-list-item>
</v-list>
</v-list>
</template>
Loading

0 comments on commit 9e9deee

Please sign in to comment.