diff --git a/src/components/panels/Temperature/TemperaturePanelList.vue b/src/components/panels/Temperature/TemperaturePanelList.vue index c149fd388..ba13c35f3 100644 --- a/src/components/panels/Temperature/TemperaturePanelList.vue +++ b/src/components/panels/Temperature/TemperaturePanelList.vue @@ -27,7 +27,9 @@ :object-name="objectName" :is-responsive-mobile="el.is.mobile ?? false" /> { - 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] + } } diff --git a/src/components/panels/Temperature/TemperaturePanelListItemEdit.vue b/src/components/panels/Temperature/TemperaturePanelListItemEdit.vue index 9ac501c7a..87f07c5bf 100644 --- a/src/components/panels/Temperature/TemperaturePanelListItemEdit.vue +++ b/src/components/panels/Temperature/TemperaturePanelListItemEdit.vue @@ -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') } diff --git a/src/components/panels/Temperature/TemperaturePanelListItemNevermore.vue b/src/components/panels/Temperature/TemperaturePanelListItemNevermore.vue index 54679d6ec..003ac67fd 100644 --- a/src/components/panels/Temperature/TemperaturePanelListItemNevermore.vue +++ b/src/components/panels/Temperature/TemperaturePanelListItemNevermore.vue @@ -6,19 +6,19 @@ - Nevermore + {{ formatName }}
{{ rpm }} RPM @@ -26,9 +26,9 @@