Skip to content

Commit

Permalink
fix eslint errors
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Wunschel <4302898+wuschi@users.noreply.github.com>
  • Loading branch information
wuschi authored and florian-h05 committed Aug 12, 2024
1 parent 9965172 commit c3f33aa
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const ModelCardParameters = () => [
]

export const OhLocationCardParameters = () => new WidgetDefinition('oh-location-card', 'Location Card', 'A card showing model items in a certain location')
.paramGroup(ModelCardParameterGroup(), [pi('item', 'Item', 'Location to display')].concat(ModelCardParameters()))
.paramGroup(ModelCardParameterGroup(), [pi('item', 'Item', 'Location to display')].concat(ModelCardParameters()))
.paramGroup(pg('glance', 'Card at-a-glance badges'), [
pb('disableBadges', 'Disable badges', 'Do not examine items to display badges - can help with performance if you don\'t need them.'),
pt('badges', 'Enabled badges', 'Select the badges you wish to show in the header of the card. Display all if none are selected.')
Expand Down Expand Up @@ -185,33 +185,33 @@ export const OhPropertyCardParameters = () => new WidgetDefinition('oh-property-
.paramGroup(ModelCardParameterGroup(), [
pt('item', 'Item', 'Property to display')
.o([
{value: "Property", label: "Property"},
{value: "CO", label: "CO"},
{value: "CO2", label: "CO2"},
{value: "ColorTemperature", label: "Color Temperature"},
{value: "Current", label: "Current"},
{value: "Duration", label: "Duration"},
{value: "Energy", label: "Energy"},
{value: "Frequency", label: "Frequency"},
{value: "Gas", label: "Gas"},
{value: "Humidity", label: "Humidity"},
{value: "Level", label: "Level"},
{value: "Light", label: "Light"},
{value: "Noise", label: "Noise"},
{value: "Oil", label: "Oil"},
{value: "Opening", label: "Opening"},
{value: "Power", label: "Power"},
{value: "Presence", label: "Presence"},
{value: "Pressure", label: "Pressure"},
{value: "Rain", label: "Rain"},
{value: "Smoke", label: "Smoke"},
{value: "SoundVolume", label: "Sound Volume"},
{value: "Temperature", label: "Temperature"},
{value: "Timestamp", label: "Timestamp"},
{value: "Ultraviolet", label: "Ultraviolet"},
{value: "Vibration", label: "Vibration"},
{value: "Voltage", label: "Voltage"},
{value: "Water", label: "Water"},
{value: "Wind", label: "Wind"},
{ value: 'Property', label: 'Property' },
{ value: 'CO', label: 'CO' },
{ value: 'CO2', label: 'CO2' },
{ value: 'ColorTemperature', label: 'Color Temperature' },
{ value: 'Current', label: 'Current' },
{ value: 'Duration', label: 'Duration' },
{ value: 'Energy', label: 'Energy' },
{ value: 'Frequency', label: 'Frequency' },
{ value: 'Gas', label: 'Gas' },
{ value: 'Humidity', label: 'Humidity' },
{ value: 'Level', label: 'Level' },
{ value: 'Light', label: 'Light' },
{ value: 'Noise', label: 'Noise' },
{ value: 'Oil', label: 'Oil' },
{ value: 'Opening', label: 'Opening' },
{ value: 'Power', label: 'Power' },
{ value: 'Presence', label: 'Presence' },
{ value: 'Pressure', label: 'Pressure' },
{ value: 'Rain', label: 'Rain' },
{ value: 'Smoke', label: 'Smoke' },
{ value: 'SoundVolume', label: 'Sound Volume' },
{ value: 'Temperature', label: 'Temperature' },
{ value: 'Timestamp', label: 'Timestamp' },
{ value: 'Ultraviolet', label: 'Ultraviolet' },
{ value: 'Vibration', label: 'Vibration' },
{ value: 'Voltage', label: 'Voltage' },
{ value: 'Water', label: 'Water' },
{ value: 'Wind', label: 'Wind' }
])
].concat(ModelCardParameters()))
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<model-tab type="equipment" :page="context" />
<model-tab type="equipment" :page="context" />
</template>

<script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<model-tab type="locations" :page="context" />
<model-tab type="locations" :page="context" />
</template>

<script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<model-tab type="properties" :page="context" />
<model-tab type="properties" :page="context" />
</template>

<script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/* Add any new widget to this file - the name of the export should be "OhSomething" */

export { default as OhEquipmentCard} from './oh-equipment-card.vue'
export { default as OhEquipmentCard } from './oh-equipment-card.vue'
export { default as OhLabelCard } from './oh-label-card.vue'
export { default as OhToggleCard } from './oh-toggle-card.vue'
export { default as OhRollershutterCard } from './oh-rollershutter-card.vue'
export { default as OhColorpickerCard } from './oh-colorpicker-card.vue'
export { default as OhGaugeCard } from './oh-gauge-card.vue'
export { default as OhKnobCard } from './oh-knob-card.vue'
export { default as OhLocationCard} from './oh-location-card.vue'
export { default as OhPropertyCard} from './oh-property-card.vue'
export { default as OhLocationCard } from './oh-location-card.vue'
export { default as OhPropertyCard } from './oh-property-card.vue'
export { default as OhSliderCard } from './oh-slider-card.vue'
export { default as OhImageCard } from './oh-image-card.vue'
export { default as OhVideoCard } from './oh-video-card.vue'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<equipment-card :element="element" :context="context" :tab-context="config" />
<equipment-card :element="element" :context="context" :tab-context="config" />
</template>

<script>
Expand All @@ -12,11 +12,10 @@ export default {
mixins: [mixin],
computed: {
element () {
return this.$store.getters.semanticModelElement(this.config.item, 'equipment')
||{defaultTitle: 'Equipment Card', item: {equipment: [], metadata: {semantics: {value: ""}}}, equipment: [], properties: []}
return this.$store.getters.semanticModelElement(this.config.item, 'equipment') ||
{ defaultTitle: 'Equipment Card', item: { equipment: [], metadata: { semantics: { value: '' } } }, equipment: [], properties: [] }
}
},
widget: OhEquipmentCardParameters
}
</script>

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<location-card :element="element" :context="context" :tab-context="config" :parent-location="parentLocationName" />
<location-card :element="element" :context="context" :tab-context="config" :parent-location="parentLocationName" />
</template>

<script>
Expand All @@ -12,14 +12,13 @@ export default {
mixins: [mixin],
computed: {
element () {
return this.$store.getters.semanticModelElement(this.config.item, 'location')
||{defaultTitle: 'Location Card', item: {equipment: [], metadata: {semantics: {value: ""}}}, equipment: [], properties: []}
return this.$store.getters.semanticModelElement(this.config.item, 'location') ||
{ defaultTitle: 'Location Card', item: { equipment: [], metadata: { semantics: { value: '' } } }, equipment: [], properties: [] }
},
parentLocationName () {
return this.element && this.element.parent ? this.element.parent.label || this.element.parent.name : ''
},
}
},
widget: OhLocationCardParameters
}
</script>

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<property-card :element="element" :context="context" :tab-context="config" />
<property-card :element="element" :context="context" :tab-context="config" />
</template>

<script>
Expand All @@ -12,11 +12,10 @@ export default {
mixins: [mixin],
computed: {
element () {
return this.$store.getters.semanticModelElement(this.config.item, 'property')
||{defaultTitle: 'Property Card', item: {equipment: [], metadata: {semantics: {value: ""}}}, equipment: [], properties: [], points: []}
return this.$store.getters.semanticModelElement(this.config.item, 'property') ||
{ defaultTitle: 'Property Card', item: { equipment: [], metadata: { semantics: { value: '' } } }, equipment: [], properties: [], points: [] }
}
},
widget: OhPropertyCardParameters
}
</script>

12 changes: 6 additions & 6 deletions bundles/org.openhab.ui/web/src/js/store/modules/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ function buildPathInModel (item, items, filteredItems) {
parent = (items.find((i) => i.name === item.metadata.semantics.config.isPartOf))
}
if (parent && parent.semanticLoopDetector) {
throw `A a loop has been detected in the semantic model: ${parent.name} is both descendant and parent of ${item.name}`
throw new Error(`A a loop has been detected in the semantic model: ${parent.name} is both descendant and parent of ${item.name}`)
}
item.parent = parent?{ name: parent.name, label: parent.label, metadata: parent.metadata }:null
item.parent = parent ? { name: parent.name, label: parent.label, metadata: parent.metadata } : null

item.semanticLoopDetector = true
item.modelPath = parent ? [...(buildPathInModel(parent, items, filteredItems)), item.parent] : []
Expand Down Expand Up @@ -103,8 +103,8 @@ function sortModel (item) {
}

const state = {
semanticModel : null,
error : null
semanticModel: null,
error: null
}

const getters = {
Expand All @@ -115,15 +115,15 @@ const getters = {
if (state.semanticModel == null) {
return null
}
return state.semanticModel[type === 'location'?'locations':type === 'equipment'?'equipment':'properties']?.find(e => e.key === key)
return state.semanticModel[type === 'location' ? 'locations' : type === 'equipment' ? 'equipment' : 'properties']?.find(e => e.key === key)
}
}

const mutations = {
setSemanticModel (state, model) {
state.semanticModel = model
},
setError(state, error) {
setError (state, error) {
state.error = error
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ export default {
methods: {
cardGroups (type, page) {
return cardGroups(this.model, type, page)
},
}
}
}
2 changes: 1 addition & 1 deletion bundles/org.openhab.ui/web/src/pages/home/model-tab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default {
PropertyCard
},
computed: mapState({
groups(state) {
groups (state) {
return cardGroups(state.model.semanticModel, this.type, this.page)
}
}),
Expand Down
10 changes: 5 additions & 5 deletions bundles/org.openhab.ui/web/src/pages/page/page-view.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default {
'oh-chart-page': () => import(/* webpackChunkName: "chart-page" */ '@/components/widgets/chart/oh-chart-page.vue'),
'oh-locations-tab': () => import('@/components/tabs/locations-tab.vue'),
'oh-equipment-tab': () => import('@/components/tabs/equipment-tab.vue'),
'oh-properties-tab': () => import('@/components/tabs/properties-tab.vue'),
'oh-properties-tab': () => import('@/components/tabs/properties-tab.vue')
},
props: ['uid', 'initialTab', 'deep', 'defineVars'],
data () {
Expand Down Expand Up @@ -149,7 +149,7 @@ export default {
this.$store.dispatch('sendCommand', { itemName, command })
},
tabContext (tab) {
const page = tab.config.page?this.$store.getters.page(tab.config.page.replace('page:', '')):tab.component
const page = tab.config.page ? this.$store.getters.page(tab.config.page.replace('page:', '')) : tab.component
const context = {
component: page,
tab: tab,
Expand All @@ -159,11 +159,11 @@ export default {
}
// mock some slots so that it works with current homeecard-grouping implementation
if (tab.component === 'oh-locations-tab') {
context.slots = {locations: [tab]}
context.slots = { locations: [tab] }
} else if (tab.component === 'oh-equipment-tab') {
context.slots = {equipment: [tab]}
context.slots = { equipment: [tab] }
} else if (tab.component === 'oh-properties-tab') {
context.slots = {properties: [tab]}
context.slots = { properties: [tab] }
}
return context
},
Expand Down

0 comments on commit c3f33aa

Please sign in to comment.