Skip to content

Commit

Permalink
v4.0.40-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
jemu75 committed Apr 25, 2024
1 parent 2427573 commit 5b7ad22
Show file tree
Hide file tree
Showing 14 changed files with 62 additions and 60 deletions.
5 changes: 5 additions & 0 deletions public/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# v4.0.40-beta (25.04.2024)
## Core
- loading of standard templates optimised
## Panel
- bug fix in case of maximize panels
# v4.0.39-beta (24.04.2024)
## Panel Status
- truncate long titles
Expand Down
15 changes: 0 additions & 15 deletions public/templates/templates.json

This file was deleted.

2 changes: 2 additions & 0 deletions src/components/PanelCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,14 @@
if(init) {
opts.activeLevels = levelsActive(item.panel.main)
if(/=maximized$/.test(fhem.app.currentView)) opts.expanded = true
} else {
if(opts.expandable) opts.expanded = !opts.expanded
if(opts.maximizable) {
if(opts.expanded) {
router.push({ name: 'devices', params: { view: 'panel=' + item.panel.name + '=maximized' }, query: router.currentRoute.value.query })
} else {
fhem.app.currentView = fhem.app.currentView.replace(/=maximized$/, '')
router.back()
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/SettingsPropsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@
:disabled="templates.length === 0"
density="compact"
variant="outlined"
class="pt-3">
class="pt-3"
@update:model-value="fhem.loadTemplates()">
</v-autocomplete>

<SettingsPropsDevices v-if="def.type === 'devices'"
Expand Down
51 changes: 35 additions & 16 deletions src/stores/fhem.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,21 @@ export const useFhemStore = defineStore('fhem', () => {
panelList: [],
navigation: [],
threads: [],
distTemplates: [],
distTemplates: [
'blind',
'chart',
'contact',
'dimmer',
'light',
'lightscene',
'motiondetector',
'proplanta',
'smokedetector',
'sonosplayer',
'switch',
'temperatur',
'thermostat'
],
noConfig: null,
configLoaded: false,
isReady: false,
Expand Down Expand Up @@ -392,23 +406,28 @@ export const useFhemStore = defineStore('fhem', () => {
return true
}

//coreFunction load default all Templates
async function loadDefaultTemplates() {
let distTemplate
//coreFunction load default Templates if needed
async function loadTemplates() {
let templateList = [],
distTemplate,
threadId = thread()

app.distTemplates = await getJsonFile('./templates/templates.json')
app.distTemplates.sort((a, b) => (a > b) ? 1 : (b > a) ? -1 : 0)

for(const template of app.distTemplates) {
if(app.config.templates.map((e) => e.name).indexOf(template) === -1) {
distTemplate = await getJsonFile('./templates/' + template + '.json')
if(distTemplate) {
distTemplate.dist = true
app.config.templates.push(distTemplate)
}
for(const panel of app.config.panels) {
if(panel.template && app.config.templates.map((e) => e.name).indexOf(panel.template) === -1) {
if(app.distTemplates.indexOf(panel.template) !== -1 && templateList.indexOf(panel.template) === -1) templateList.push(panel.template)
}
}

for(const template of templateList) {
distTemplate = await getJsonFile('./templates/' + template + '.json')
if(distTemplate) {
distTemplate.dist = true
app.config.templates.push(distTemplate)
}
}

thread(threadId)

return true
}

Expand Down Expand Up @@ -974,7 +993,7 @@ export const useFhemStore = defineStore('fhem', () => {
if(res && connect) res = await getToken()
if(res && connect) res = openEventWatcher()
if(res) res = await loadConfig()
if(res) res = await loadDefaultTemplates()
if(res) res = await loadTemplates()
if(res) res = createPanelList()
if(res) res = await initialLoad()
if(res) res = createNavigation()
Expand Down Expand Up @@ -1015,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 }
return { app, getEl, handleDefs, getIcon, replacer, createSession, request, thread, stringToJson, log, help, changeDarkMode, appUpdate, loadTemplates }
})
5 changes: 5 additions & 0 deletions www/fhemapp4/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# v4.0.40-beta (25.04.2024)
## Core
- loading of standard templates optimised
## Panel
- bug fix in case of maximize panels
# v4.0.39-beta (24.04.2024)
## Panel Status
- truncate long titles
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 5b7ad22

Please sign in to comment.