diff --git a/docs/media/quickstart.webm b/docs/media/quickstart.webm deleted file mode 100644 index 243be85..0000000 Binary files a/docs/media/quickstart.webm and /dev/null differ diff --git a/public/CHANGELOG.md b/public/CHANGELOG.md index 9d1da6a..00c79b9 100644 --- a/public/CHANGELOG.md +++ b/public/CHANGELOG.md @@ -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 diff --git a/src/components/PanelCard.vue b/src/components/PanelCard.vue index ea66743..dc57ac0 100644 --- a/src/components/PanelCard.vue +++ b/src/components/PanelCard.vue @@ -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'],['', '', '']) @@ -170,8 +174,33 @@ diff --git a/src/components/PanelMainBtn.vue b/src/components/PanelMainBtn.vue index 816025d..b29321c 100644 --- a/src/components/PanelMainBtn.vue +++ b/src/components/PanelMainBtn.vue @@ -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) { diff --git a/src/components/PanelMainMenu.vue b/src/components/PanelMainMenu.vue index c8262d8..918fa5d 100644 --- a/src/components/PanelMainMenu.vue +++ b/src/components/PanelMainMenu.vue @@ -31,6 +31,8 @@ divider, re + menuItems.value = [] + for(const def of defs) { vals = /^get/.test(def.name) ? await doCmd(def.name) : def.name diff --git a/src/components/SettingsProps.vue b/src/components/SettingsProps.vue index 81ae4bf..a274d78 100644 --- a/src/components/SettingsProps.vue +++ b/src/components/SettingsProps.vue @@ -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) { @@ -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 }) } @@ -302,8 +312,6 @@ function copyBtn() { toClipboard(settings.value.jsonDef) } - - getFhemDevices()