feat: multiple nevermore support (#1939)
Co-authored-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
parent
fbeecb0169
commit
c7d75c6e7a
@ -27,7 +27,9 @@
|
|||||||
:object-name="objectName"
|
:object-name="objectName"
|
||||||
:is-responsive-mobile="el.is.mobile ?? false" />
|
:is-responsive-mobile="el.is.mobile ?? false" />
|
||||||
<temperature-panel-list-item-nevermore
|
<temperature-panel-list-item-nevermore
|
||||||
v-if="existsNevermoreFilter"
|
v-for="objectName in nevermoreObjects"
|
||||||
|
:key="objectName"
|
||||||
|
:object-name="objectName"
|
||||||
:is-responsive-mobile="el.is.mobile ?? false" />
|
:is-responsive-mobile="el.is.mobile ?? false" />
|
||||||
<temperature-panel-list-item
|
<temperature-panel-list-item
|
||||||
v-for="objectName in temperature_sensors"
|
v-for="objectName in temperature_sensors"
|
||||||
@ -62,15 +64,7 @@ export default class TemperaturePanelList extends Mixins(BaseMixin) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get filteredHeaters() {
|
get filteredHeaters() {
|
||||||
return this.available_heaters
|
return this.filterNamesAndSort(this.available_heaters)
|
||||||
.filter((fullName: string) => {
|
|
||||||
const splits = fullName.split(' ')
|
|
||||||
let name = splits[0]
|
|
||||||
if (splits.length > 1) name = splits[1]
|
|
||||||
|
|
||||||
return !name.startsWith('_')
|
|
||||||
})
|
|
||||||
.sort(this.sortObjectName)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get available_sensors() {
|
get available_sensors() {
|
||||||
@ -81,6 +75,10 @@ export default class TemperaturePanelList extends Mixins(BaseMixin) {
|
|||||||
return this.$store.state.printer?.heaters?.available_monitors ?? []
|
return this.$store.state.printer?.heaters?.available_monitors ?? []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get available_nevermores() {
|
||||||
|
return Object.keys(this.$store.state.printer).filter((name) => name.startsWith('nevermore'))
|
||||||
|
}
|
||||||
|
|
||||||
get monitors() {
|
get monitors() {
|
||||||
return this.available_monitors.sort(this.sortObjectName)
|
return this.available_monitors.sort(this.sortObjectName)
|
||||||
}
|
}
|
||||||
@ -91,10 +89,6 @@ export default class TemperaturePanelList extends Mixins(BaseMixin) {
|
|||||||
.sort(this.sortObjectName)
|
.sort(this.sortObjectName)
|
||||||
}
|
}
|
||||||
|
|
||||||
get existsNevermoreFilter() {
|
|
||||||
return 'nevermore' in this.$store.state.printer
|
|
||||||
}
|
|
||||||
|
|
||||||
get hideMcuHostSensors(): boolean {
|
get hideMcuHostSensors(): boolean {
|
||||||
return this.$store.state.gui.view.tempchart.hideMcuHostSensors ?? false
|
return this.$store.state.gui.view.tempchart.hideMcuHostSensors ?? false
|
||||||
}
|
}
|
||||||
@ -104,27 +98,25 @@ export default class TemperaturePanelList extends Mixins(BaseMixin) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get temperature_sensors() {
|
get temperature_sensors() {
|
||||||
return this.available_sensors
|
return this.filterNamesAndSort(this.available_sensors).filter((fullName: string) => {
|
||||||
.filter((fullName: string) => {
|
|
||||||
if (this.available_heaters.includes(fullName)) return false
|
if (this.available_heaters.includes(fullName)) return false
|
||||||
if (this.temperature_fans.includes(fullName)) return false
|
if (this.temperature_fans.includes(fullName)) return false
|
||||||
|
|
||||||
// hide MCU & Host sensors, if the function is enabled
|
// hide MCU & Host sensors, if the function is enabled
|
||||||
if (this.hideMcuHostSensors && this.checkMcuHostSensor(fullName)) return false
|
if (this.hideMcuHostSensors && this.checkMcuHostSensor(fullName)) return false
|
||||||
|
|
||||||
const splits = fullName.split(' ')
|
return true
|
||||||
let name = splits[0]
|
|
||||||
if (splits.length > 1) name = splits[1]
|
|
||||||
|
|
||||||
return !name.startsWith('_')
|
|
||||||
})
|
})
|
||||||
.sort(this.sortObjectName)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get heaterObjects() {
|
get heaterObjects() {
|
||||||
return [...this.filteredHeaters, ...this.temperature_fans]
|
return [...this.filteredHeaters, ...this.temperature_fans]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get nevermoreObjects() {
|
||||||
|
return this.filterNamesAndSort(this.available_nevermores)
|
||||||
|
}
|
||||||
|
|
||||||
get settings() {
|
get settings() {
|
||||||
return this.$store.state.printer?.configfile?.settings ?? {}
|
return this.$store.state.printer?.configfile?.settings ?? {}
|
||||||
}
|
}
|
||||||
@ -136,22 +128,28 @@ export default class TemperaturePanelList extends Mixins(BaseMixin) {
|
|||||||
return ['temperature_mcu', 'temperature_host'].includes(sensor_type)
|
return ['temperature_mcu', 'temperature_host'].includes(sensor_type)
|
||||||
}
|
}
|
||||||
|
|
||||||
sortObjectName(a: string, b: string) {
|
filterNamesAndSort(fullNames: string[]) {
|
||||||
const splitsA = a.split(' ')
|
return fullNames.filter(this.isVisibleName).sort(this.sortObjectName)
|
||||||
let nameA = splitsA[0]
|
}
|
||||||
if (splitsA.length > 1) nameA = splitsA[1]
|
|
||||||
nameA = nameA.toUpperCase()
|
|
||||||
|
|
||||||
const splitsB = b.split(' ')
|
isVisibleName(fullName: string) {
|
||||||
let nameB = splitsB[0]
|
return !this.shortName(fullName).startsWith('_')
|
||||||
if (splitsB.length > 1) nameB = splitsB[1]
|
}
|
||||||
nameB = nameB.toUpperCase()
|
|
||||||
|
sortObjectName(a: string, b: string) {
|
||||||
|
const nameA = this.shortName(a).toUpperCase()
|
||||||
|
const nameB = this.shortName(b).toUpperCase()
|
||||||
|
|
||||||
if (nameA < nameB) return -1
|
if (nameA < nameB) return -1
|
||||||
if (nameA > nameB) return 1
|
if (nameA > nameB) return 1
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shortName(fullName: string) {
|
||||||
|
const splits = fullName.split(' ')
|
||||||
|
return splits.length == 1 ? splits[0] : splits[1]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ export default class TemperaturePanelListItemEdit extends Mixins(BaseMixin) {
|
|||||||
|
|
||||||
get additionalValues() {
|
get additionalValues() {
|
||||||
if (this.objectName === 'z_thermal_adjust') return ['current_z_adjust']
|
if (this.objectName === 'z_thermal_adjust') return ['current_z_adjust']
|
||||||
if (this.objectName === 'nevermore') return ['temperature', 'pressure', 'humidity', 'rpm']
|
if (this.objectName.startsWith('nevermore')) return ['temperature', 'pressure', 'humidity', 'rpm']
|
||||||
|
|
||||||
return Object.keys(this.printerObjectAdditionalSensor).filter((key) => key !== 'temperature')
|
return Object.keys(this.printerObjectAdditionalSensor).filter((key) => key !== 'temperature')
|
||||||
}
|
}
|
||||||
|
@ -6,19 +6,19 @@
|
|||||||
</v-icon>
|
</v-icon>
|
||||||
</td>
|
</td>
|
||||||
<td class="name">
|
<td class="name">
|
||||||
<span class="cursor-pointer" @click="showEditDialog = true">Nevermore</span>
|
<span class="cursor-pointer" @click="showEditDialog = true">{{ formatName }}</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="text-no-wrap text-center" colspan="3">
|
<td class="text-no-wrap text-center" colspan="3">
|
||||||
<temperature-panel-list-item-nevermore-value
|
<temperature-panel-list-item-nevermore-value
|
||||||
:printer-object="printerObject"
|
:printer-object="printerObject"
|
||||||
|
:object-name="objectName"
|
||||||
:small="false"
|
:small="false"
|
||||||
object-name="nevermore"
|
|
||||||
key-name="gas" />
|
key-name="gas" />
|
||||||
<temperature-panel-list-item-nevermore-value
|
<temperature-panel-list-item-nevermore-value
|
||||||
v-for="keyName in nevermoreValues"
|
v-for="keyName in nevermoreValues"
|
||||||
:key="keyName"
|
:key="keyName"
|
||||||
:printer-object="printerObject"
|
:printer-object="printerObject"
|
||||||
object-name="nevermore"
|
:object-name="objectName"
|
||||||
:key-name="keyName" />
|
:key-name="keyName" />
|
||||||
<div v-if="rpm !== null">
|
<div v-if="rpm !== null">
|
||||||
<small :class="rpmClass">{{ rpm }} RPM</small>
|
<small :class="rpmClass">{{ rpm }} RPM</small>
|
||||||
@ -26,9 +26,9 @@
|
|||||||
</td>
|
</td>
|
||||||
<temperature-panel-list-item-edit
|
<temperature-panel-list-item-edit
|
||||||
:bool-show="showEditDialog"
|
:bool-show="showEditDialog"
|
||||||
object-name="nevermore"
|
:object-name="objectName"
|
||||||
name="nevermore"
|
:name="name"
|
||||||
format-name="Nevermore"
|
:format-name="formatName"
|
||||||
additional-sensor-name="nevermore"
|
additional-sensor-name="nevermore"
|
||||||
:icon="mdiFan"
|
:icon="mdiFan"
|
||||||
:color="color"
|
:color="color"
|
||||||
@ -40,6 +40,7 @@
|
|||||||
import Component from 'vue-class-component'
|
import Component from 'vue-class-component'
|
||||||
import { Mixins, Prop } from 'vue-property-decorator'
|
import { Mixins, Prop } from 'vue-property-decorator'
|
||||||
import BaseMixin from '@/components/mixins/base'
|
import BaseMixin from '@/components/mixins/base'
|
||||||
|
import { convertName } from '@/plugins/helpers'
|
||||||
import { mdiFan } from '@mdi/js'
|
import { mdiFan } from '@mdi/js'
|
||||||
import { opacityHeaterActive, opacityHeaterInactive } from '@/store/variables'
|
import { opacityHeaterActive, opacityHeaterInactive } from '@/store/variables'
|
||||||
|
|
||||||
@ -47,17 +48,27 @@ import { opacityHeaterActive, opacityHeaterInactive } from '@/store/variables'
|
|||||||
export default class TemperaturePanelListItemNevermore extends Mixins(BaseMixin) {
|
export default class TemperaturePanelListItemNevermore extends Mixins(BaseMixin) {
|
||||||
mdiFan = mdiFan
|
mdiFan = mdiFan
|
||||||
|
|
||||||
|
@Prop({ type: String, required: true }) readonly objectName!: string
|
||||||
@Prop({ type: Boolean, required: true }) readonly isResponsiveMobile!: boolean
|
@Prop({ type: Boolean, required: true }) readonly isResponsiveMobile!: boolean
|
||||||
|
|
||||||
showEditDialog = false
|
showEditDialog = false
|
||||||
nevermoreValues = ['temperature', 'pressure', 'humidity']
|
nevermoreValues = ['temperature', 'pressure', 'humidity']
|
||||||
|
|
||||||
get printerObject() {
|
get printerObject() {
|
||||||
return this.$store.state.printer.nevermore ?? {}
|
return this.$store.state.printer[this.objectName] ?? {}
|
||||||
|
}
|
||||||
|
|
||||||
|
get name() {
|
||||||
|
const splits = this.objectName.split(' ')
|
||||||
|
return splits.length === 1 ? splits[0] : splits[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
get formatName() {
|
||||||
|
return convertName(this.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
get color() {
|
get color() {
|
||||||
return this.$store.state.gui?.view?.tempchart?.datasetSettings?.nevermore?.color ?? '#ffffff'
|
return this.$store.state.gui?.view?.tempchart?.datasetSettings?.[this.objectName]?.color ?? '#ffffff'
|
||||||
}
|
}
|
||||||
|
|
||||||
get iconColor() {
|
get iconColor() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user