Skip to content

Commit

Permalink
fix: only display section options which exists
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Dej <[email protected]>
  • Loading branch information
meteyou committed Dec 16, 2023
1 parent af5a3e1 commit a9bade9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
5 changes: 5 additions & 0 deletions src/components/mixins/extruder.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import Vue from 'vue'
import { Component } from 'vue-property-decorator'
import { PrinterStateExtruder } from '@/store/printer/types'
@Component
export default class ExtruderMixin extends Vue {
get extruders(): PrinterStateExtruder[] {
return this.$store.getters['printer/getExtruders']
}

get activeExtruder(): string {
return this.$store.state.printer.toolhead?.extruder
}
Expand Down
7 changes: 4 additions & 3 deletions src/components/panels/Extruder/ExtruderPanelSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</v-btn>
</template>
<v-list>
<v-list-item class="minHeight36">
<v-list-item v-if="toolchangeMacros.length" class="minHeight36">
<v-checkbox
v-model="showTools"
class="mt-0"
Expand All @@ -27,7 +27,7 @@
hide-details
:label="$t('Panels.ExtruderControlPanel.PressureAdvance')" />
</v-list-item>
<v-list-item class="minHeight36">
<v-list-item v-if="existsFirmwareRetraction" class="minHeight36">
<v-checkbox
v-model="showFirmwareRetraction"
class="mt-0"
Expand All @@ -50,8 +50,9 @@ import Component from 'vue-class-component'
import { Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { mdiCog } from '@mdi/js'
import ControlMixin from '@/components/mixins/control'
@Component
export default class ExtruderPanelSettings extends Mixins(BaseMixin) {
export default class ExtruderPanelSettings extends Mixins(BaseMixin, ControlMixin) {
mdiCog = mdiCog
get showTools(): boolean {
Expand Down
8 changes: 2 additions & 6 deletions src/components/panels/ExtruderControlPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<extruder-panel-settings />
</template>
<!-- TOOL SELECTOR BUTTONS -->
<extruder-control-panel-tools v-if="showTools" />
<extruder-control-panel-tools v-if="showTools && toolchangeMacros.length" />
<!-- EXTRUSION FACTOR SLIDER -->
<template v-if="showExtrusionFactor">
<v-divider v-if="showTools" />
Expand All @@ -108,7 +108,7 @@
<script lang="ts">
import { mdiPrinter3dNozzle, mdiDotsVertical } from '@mdi/js'
import { Component, Mixins } from 'vue-property-decorator'
import { PrinterStateExtruder, PrinterStateMacro } from '@/store/printer/types'
import { PrinterStateMacro } from '@/store/printer/types'
import BaseMixin from '@/components/mixins/base'
import ControlMixin from '@/components/mixins/control'
import Panel from '@/components/ui/Panel.vue'
Expand Down Expand Up @@ -183,10 +183,6 @@ export default class ExtruderControlPanel extends Mixins(BaseMixin, ControlMixin
return this.loadFilamentMacro !== undefined || this.unloadFilamentMacro !== undefined
}
get extruders(): PrinterStateExtruder[] {
return this.$store.getters['printer/getExtruders']
}
get showTools(): boolean {
if (this.toolchangeMacros.length < 1) return false
Expand Down

0 comments on commit a9bade9

Please sign in to comment.