diff --git a/src/components/settings/GeneralSettings.vue b/src/components/settings/GeneralSettings.vue index 01e77d013e..82841e1c05 100644 --- a/src/components/settings/GeneralSettings.vue +++ b/src/components/settings/GeneralSettings.vue @@ -444,7 +444,7 @@ export default class GeneralSettings extends Mixins(StateMixin, BrowserMixin) { ] : [] - const pins: OutputPin[] = this.$typedGetters['printer/getPins'] + const pins: OutputPin[] = this.$typedGetters['printer/getPins']() const pinEntries = pins.length ? [ { header: 'Klipper' }, diff --git a/src/components/widgets/outputs/Outputs.vue b/src/components/widgets/outputs/Outputs.vue index 2ff0198fad..c79d9475e6 100644 --- a/src/components/widgets/outputs/Outputs.vue +++ b/src/components/widgets/outputs/Outputs.vue @@ -55,11 +55,15 @@ import type { Fan, Led, OutputPin } from '@/store/printer/types' } }) export default class Outputs extends Mixins(StateMixin) { + get showHidden () { + return this.$store.state.config.uiSettings.general.showHiddenOutputs + } + get all () { const items: Array = [ - ...this.$typedGetters['printer/getAllFans'], - ...this.$typedGetters['printer/getPins'], - ...this.$typedGetters['printer/getAllLeds'] + ...this.$typedGetters['printer/getAllFans'](this.showHidden), + ...this.$typedGetters['printer/getPins'](this.showHidden), + ...this.$typedGetters['printer/getAllLeds'](this.showHidden) ] let col1: Array = [] let col2: Array = [] diff --git a/src/components/widgets/outputs/OutputsCard.vue b/src/components/widgets/outputs/OutputsCard.vue index c7ae70a71e..2fc96ceba9 100644 --- a/src/components/widgets/outputs/OutputsCard.vue +++ b/src/components/widgets/outputs/OutputsCard.vue @@ -6,6 +6,43 @@ layout-path="dashboard.outputs-card" menu-breakpoint="lg" > + @@ -20,5 +57,16 @@ import Outputs from '@/components/widgets/outputs/Outputs.vue' } }) export default class OutputsCard extends Vue { + get showHidden () { + return this.$store.state.config.uiSettings.general.showHiddenOutputs + } + + set showHidden (value: boolean) { + this.$store.dispatch('config/saveByPath', { + path: 'uiSettings.general.showHiddenOutputs', + value, + server: true + }) + } } diff --git a/src/locales/en.yaml b/src/locales/en.yaml index 835d270ecb..4e4e4428d8 100644 --- a/src/locales/en.yaml +++ b/src/locales/en.yaml @@ -675,6 +675,7 @@ app: show_chart: Show chart show_code_lens: Show CodeLens show_gas_resistance: Show gas resistance + show_hidden: Show hidden show_legend: Show legend show_logo_on_background: Show logo on background show_rate_of_change: Show temperature rate of change diff --git a/src/store/config/state.ts b/src/store/config/state.ts index d938bfc6e4..f15e8987b7 100644 --- a/src/store/config/state.ts +++ b/src/store/config/state.ts @@ -68,7 +68,8 @@ export const defaultState = (): ConfigState => { printProgressCalculation: ['file'], printEtaCalculation: ['file'], enableDiagnostics: false, - colorPickerValueRange: 'absolute' + colorPickerValueRange: 'absolute', + showHiddenOutputs: false }, theme: { isDark: true, diff --git a/src/store/config/types.ts b/src/store/config/types.ts index bb00b8dddf..9e5be26b55 100644 --- a/src/store/config/types.ts +++ b/src/store/config/types.ts @@ -131,6 +131,7 @@ export interface GeneralConfig { printEtaCalculation: PrintEtaCalculation[]; enableDiagnostics: boolean; colorPickerValueRange: ColorPickerValueRange; + showHiddenOutputs: boolean; } export type ToolheadControlStyle = 'cross' | 'bars' | 'circle' diff --git a/src/store/printer/getters.ts b/src/store/printer/getters.ts index e0898048c6..05940092fb 100644 --- a/src/store/printer/getters.ts +++ b/src/store/printer/getters.ts @@ -601,63 +601,64 @@ export const getters = { .sort((a, b) => a.name.localeCompare(b.name)) }, - getAllLeds: (_, getters) => { + getAllLeds: (_, getters) => (showHidden = false) => { return getters.getOutputs([ 'led', 'neopixel', 'dotstar', 'pca9533', 'pca9632' - ]) + ], showHidden) }, - getAllFans: (_, getters) => { + getAllFans: (_, getters) => (showHidden = false) => { return getters.getOutputs([ 'temperature_fan', 'controller_fan', 'heater_fan', 'fan_generic', 'fan' - ]) + ], showHidden) }, /** * Return toolhead fans */ - getToolHeadFans: (_, getters) => { + getToolHeadFans: (_, getters) => (showHidden = false) => { return getters.getOutputs([ // 'temperature_fan', // 'controller_fan', 'heater_fan', // 'fan_generic', 'fan' - ]) + ], showHidden) }, - getOtherFans: (_, getters) => { + getOtherFans: (_, getters) => (showHidden = false) => { return getters.getOutputs([ 'temperature_fan', 'controller_fan', // 'heater_fan', 'fan_generic' // 'fan' - ]) + ], showHidden) }, /** * Return output pins */ - getPins: (_, getters) => { + getPins: (_, getters) => (showHidden = false) => { const outputs = getters.getOutputs([ 'output_pin', 'pwm_tool', 'pwm_cycle_time' - ]) + ], showHidden) return outputs.sort((output: OutputPin) => output.pwm ? 1 : -1) }, getPinByName: (state, getters) => (name: string) => { const pins: OutputPin[] = getters.getPins + // const pins = getters.getPins() as OutputPin[] return pins.find(pin => pin.name === name) }, @@ -665,7 +666,7 @@ export const getters = { /** * Return available fans and output pins */ - getOutputs: (state, getters) => (filter?: string[]): Array => { + getOutputs: (state, getters) => (filter?: string[], showHidden = false): Array => { // Fans.. const fans = [ 'temperature_fan', @@ -741,7 +742,7 @@ export const getters = { if ( supportedTypes.includes(type) && - (!filterByPrefix.includes(type) || !name.startsWith('_')) + (showHidden || !filterByPrefix.includes(type) || !name.startsWith('_')) ) { const prettyName = name === 'fan' ? 'Part Fan' // If we know its the part fan. diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue index 1fd4bb22c0..10614e161c 100644 --- a/src/views/Dashboard.vue +++ b/src/views/Dashboard.vue @@ -157,9 +157,9 @@ export default class Dashboard extends Mixins(StateMixin) { get hasOutputs (): boolean { return ( - this.$typedGetters['printer/getAllFans'].length > 0 || - this.$typedGetters['printer/getPins'].length > 0 || - this.$typedGetters['printer/getAllLeds'].length > 0 + this.$typedGetters['printer/getAllFans']().length > 0 || + this.$typedGetters['printer/getPins']().length > 0 || + this.$typedGetters['printer/getAllLeds']().length > 0 ) }