Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
weblate committed Nov 10, 2024
2 parents 34722bc + c7d75c6 commit e83e378
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 45 deletions.
70 changes: 34 additions & 36 deletions src/components/panels/Temperature/TemperaturePanelList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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() {
Expand All @@ -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)
}
Expand All @@ -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
}
Expand All @@ -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 ?? {}
}
Expand All @@ -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>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,29 @@
</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>
</div>
</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"
Expand All @@ -40,24 +40,35 @@
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'
@Component
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() {
Expand Down

0 comments on commit e83e378

Please sign in to comment.