Skip to content

Commit

Permalink
Merge pull request #92 from jemu75/dev-v4
Browse files Browse the repository at this point in the history
v4.1.1
  • Loading branch information
jemu75 authored Apr 29, 2024
2 parents cca6dea + 6b69fc1 commit 086eadf
Show file tree
Hide file tree
Showing 17 changed files with 139 additions and 86 deletions.
Binary file removed docs/media/quickstart.webm
Binary file not shown.
7 changes: 7 additions & 0 deletions public/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# v4.1.1 (29.04.2024)
## Panel Button
- bugfix if fhem command will be send
## Panel Menu
- bugfix double load menu items
## Panel
- add options menu for loglevel 7
# v4.1.0 (28.04.2024)
## App
- merge Beta Version to Stable Version
Expand Down
33 changes: 31 additions & 2 deletions src/components/PanelCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@
router.push({ name: 'settings', params: { tab: tab, item: val }, query: router.currentRoute.value.query })
}
function openFhemDevice(device) {
window.open(fhem.createURL('?detail=' + device), '_self')
}
function getInfo(pos) {
let res = fhem.handleDefs(item.panel.info[pos], ['text', 'icon', 'color'],['', '', ''])
Expand Down Expand Up @@ -170,8 +174,33 @@
<template v-slot:append>
<div v-if="fhem.app.settings.loglevel > 6">
{{ sortby.sortby }}
<v-btn v-if="getTemplate(panel.name)" icon="mdi-application-edit-outline" size="small" variant="plain" @click="editItem(getTemplate(panel.name), 'templates')"></v-btn>
<v-btn icon="mdi-pencil" size="small" variant="plain" @click="editItem(panel.name, 'panels')"></v-btn>
<v-menu>
<template v-slot:activator="{ props }">
<v-btn icon="mdi-dots-vertical" density="compact" v-bind="props"></v-btn>
</template>

<v-list density="compact">
<v-list-item v-if="getTemplate(panel.name)"
key="template"
title="Template"
prepend-icon="mdi-application-edit-outline"
@click="editItem(getTemplate(panel.name), 'templates')">
</v-list-item>
<v-list-item
key="panel"
title="Panel"
prepend-icon="mdi-pencil"
@click="editItem(panel.name, 'panels')">
</v-list-item>
<v-divider></v-divider>
<v-list-item v-for="device of panel.panel.devices"
:key="device.split(':')[0]"
:title="device.split(':')[1]"
prepend-icon="mdi-link"
@click="openFhemDevice(device.split(':')[1])">
</v-list-item>
</v-list>
</v-menu>
</div>
<v-btn v-if="levelOpts.icon" :icon="levelOpts.icon" size="small" variant="plain" density="compact" @click="levelClick()"></v-btn>
</template>
Expand Down
28 changes: 14 additions & 14 deletions src/components/PanelMainBtn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@
}
function doCmd(obj) {
let defParts = [],
cmd = obj.cmd,
rp
if(obj.type === 'cmd') {
for(const device of props.devices) {
defParts = device.split(':')
rp = RegExp(defParts[0], 'g')
if(rp.test(cmd)) cmd = cmd.replace(rp, defParts[1])
}
let cmdList
if(obj.cmd) {
if(obj.type === 'cmd') {
cmdList = obj.cmd.split(';')
for(const [idx, cmd] of Object.entries(cmdList)) {
cmdList[idx] = cmd
for(const device of props.devices) cmdList[idx] = cmdList[idx].replace(device.split(':')[0], device.split(':')[1])
}
fhem.request('text', cmd)
fhem.request('text', cmdList.join(';'))
}
if(obj.type === 'route') router.push({ name: 'devices', params: { view: obj.cmd }, query: router.currentRoute.value.query })
if(obj.type === 'url') window.open(obj.cmd, '_self')
}
if(obj.type === 'route') router.push({ name: 'devices', params: { view: obj.cmd }, query: router.currentRoute.value.query })
if(obj.type === 'url') window.open(obj.cmd, '_self')
}
function btnClick(evt) {
Expand Down
2 changes: 2 additions & 0 deletions src/components/PanelMainMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
divider,
re
menuItems.value = []
for(const def of defs) {
vals = /^get/.test(def.name) ? await doCmd(def.name) : def.name
Expand Down
52 changes: 30 additions & 22 deletions src/components/SettingsProps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,31 +158,41 @@
jsonError: null
})
watch(router.currentRoute, (val) => {
function editItem(val) {
let idx
if(val.params.item) {
idx = fhem.app.config[props.type].map((e) => e.name).indexOf(val.params.item)
if(idx !== -1) {
item.value = fhem.app.config[props.type][idx]
settings.value.itemIdx = idx
getReadings()
idx = fhem.app.config[props.type].map((e) => e.name).indexOf(val)
if(idx !== -1) {
item.value = fhem.app.config[props.type][idx]
settings.value.itemIdx = idx
settings.value.extended = items.value[items.value.map((e) => e.idx).indexOf(idx)].advanced !== '-' ? true : false
getReadings()
if(typeof item.value === 'object') {
settings.value.jsonDef = JSON.stringify(item.value, null, '\t')
settings.value.jsonError = null
}
settings.value.extended = items.value[items.value.map((e) => e.idx).indexOf(idx)].advanced !== '-' ? true : false
return
if(typeof item.value === 'object') {
settings.value.jsonDef = JSON.stringify(item.value, null, '\t')
settings.value.jsonError = null
}
}
return
}
item.value = null
settings.value.panel = null
}
watch(router.currentRoute, (val) => {
if(val.params.item) editItem(val.params.item)
})
watch(() => fhem.app.isReady, (val) => {
if(val) {
if(router.currentRoute.value.params.item) editItem(router.currentRoute.value.params.item)
getFhemDevices()
}
}, { immediate: true })
function updatePanel(panel) {
Expand Down Expand Up @@ -269,11 +279,11 @@
fhem.app.config[props.type].push(props.type === 'panels' ? newPanel : newTemplate)
editItem(settings.value.newItem)
gotoItem(settings.value.newItem)
settings.value.newItem = ''
}
function editItem(val) {
function gotoItem(val) {
router.push({ name: 'settings', params: { tab: props.type, item: val }, query: router.currentRoute.value.query })
}
Expand Down Expand Up @@ -302,8 +312,6 @@
function copyBtn() {
toClipboard(settings.value.jsonDef)
}
getFhemDevices()
</script>

<template>
Expand Down Expand Up @@ -366,7 +374,7 @@
variant="plain"
density="compact"
class="mr-3"
@click="editItem(item.name)">
@click="gotoItem(item.name)">
</v-btn>
<v-btn
icon="mdi-delete"
Expand All @@ -382,7 +390,7 @@
<v-row>
<v-col>
<v-row class="align-center">
<v-btn variant="plain" icon="mdi-arrow-up-left" @click="editItem()"></v-btn>
<v-btn variant="plain" icon="mdi-arrow-up-left" @click="gotoItem()"></v-btn>

<v-col cols="10" md="">
<v-autocomplete v-if="!settings.rawMode"
Expand Down
2 changes: 1 addition & 1 deletion src/stores/fhem.js
Original file line number Diff line number Diff line change
Expand Up @@ -1034,5 +1034,5 @@ export const useFhemStore = defineStore('fhem', () => {
//FHEMApp entryPoint
router.isReady().then(init())

return { app, getEl, handleDefs, getIcon, replacer, createSession, request, thread, stringToJson, log, help, changeDarkMode, appUpdate, loadTemplates }
return { app, getEl, handleDefs, getIcon, replacer, createSession, request, thread, stringToJson, log, help, changeDarkMode, appUpdate, loadTemplates, createURL }
})
7 changes: 7 additions & 0 deletions www/fhemapp4/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# v4.1.1 (29.04.2024)
## Panel Button
- bugfix if fhem command will be send
## Panel Menu
- bugfix double load menu items
## Panel
- add options menu for loglevel 7
# v4.1.0 (28.04.2024)
## App
- merge Beta Version to Stable Version
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 086eadf

Please sign in to comment.