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