Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add show hidden option to outputs panel #1209

Open
wants to merge 33 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0e374f2
add show hidden option to outputs panel
TomW1605 Oct 18, 2023
182fa42
fix formatting
TomW1605 Oct 18, 2023
4da0ce1
Merge branch 'develop' into develop
TomW1605 Nov 26, 2024
fa59f8e
fix warnings from build action
TomW1605 Nov 26, 2024
bc35ee1
Merge branch 'develop' into develop
TomW1605 Nov 27, 2024
c382a3c
Merge branch 'develop' into develop
pedrolamas Nov 27, 2024
468e572
Merge branch 'develop' into develop
TomW1605 Dec 4, 2024
79109b8
Merge branch 'develop' into develop
pedrolamas Dec 7, 2024
6508c6a
Merge branch 'develop' into develop
TomW1605 Dec 12, 2024
851028f
Merge branch 'develop' into develop
TomW1605 Dec 13, 2024
edd431a
Merge branch 'develop' into develop
TomW1605 Dec 16, 2024
fb30fe8
Merge branch 'develop' into develop
TomW1605 Dec 18, 2024
d1fa6fb
Merge branch 'develop' into develop
TomW1605 Dec 18, 2024
c448b0b
Merge branch 'develop' into develop
TomW1605 Dec 21, 2024
487360c
simplify layout
TomW1605 Dec 21, 2024
cdf65fd
simplify if
TomW1605 Dec 21, 2024
3205f8c
rename setting to showHiddenOutputs
TomW1605 Dec 21, 2024
c17febe
Merge branch 'develop' into develop
TomW1605 Dec 22, 2024
d5fcd50
Merge branch 'develop' into develop
pedrolamas Dec 26, 2024
3eda87f
Merge branch 'develop' into develop
TomW1605 Dec 27, 2024
0b9d8fd
Merge branch 'develop' into develop
pedrolamas Dec 28, 2024
c1084b1
fix output card not showing
TomW1605 Dec 29, 2024
af7fa84
Merge branch 'develop' into develop
TomW1605 Dec 29, 2024
bb88a4e
Merge branch 'develop' into develop
TomW1605 Dec 31, 2024
446970f
Merge branch 'develop' into develop
TomW1605 Jan 2, 2025
d25f257
Merge branch 'develop' into develop
TomW1605 Jan 2, 2025
34fd9ac
Merge branch 'develop' into develop
TomW1605 Jan 8, 2025
9484389
Merge branch 'develop' into develop
TomW1605 Jan 12, 2025
5c42f3c
Merge branch 'develop' into develop
TomW1605 Jan 15, 2025
c7b4ff7
Merge branch 'develop' into develop
TomW1605 Jan 22, 2025
a9af8a9
Merge branch 'develop' into develop
TomW1605 Jan 27, 2025
81d904e
Merge remote-tracking branch 'upstream/develop' into develop
TomW1605 Feb 19, 2025
b0cf956
Merge branch 'develop' into develop
TomW1605 Feb 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/settings/GeneralSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ export default class GeneralSettings extends Mixins(StateMixin) {
]
: []

const pins: OutputPin[] = this.$store.getters['printer/getPins']
const pins: OutputPin[] = this.$store.getters['printer/getPins']()
const pinEntries = pins.length
? [
{ header: 'Klipper' },
Expand Down
10 changes: 7 additions & 3 deletions src/components/widgets/outputs/Outputs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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<Fan | Led | OutputPin> = [
...this.$store.getters['printer/getAllFans'],
...this.$store.getters['printer/getPins'],
...this.$store.getters['printer/getAllLeds']
...this.$store.getters['printer/getAllFans'](this.showHidden),
...this.$store.getters['printer/getPins'](this.showHidden),
...this.$store.getters['printer/getAllLeds'](this.showHidden)
]
let col1: Array<Fan | Led | OutputPin> = []
let col2: Array<Fan | Led | OutputPin> = []
Expand Down
45 changes: 45 additions & 0 deletions src/components/widgets/outputs/OutputsCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,40 @@
layout-path="dashboard.outputs-card"
menu-breakpoint="lg"
>
<template #menu>
<v-menu
bottom
left
offset-y
transition="slide-y-transition"
:close-on-content-click="false"
>
<template #activator="{ on, attrs }">
<v-btn
icon
v-bind="attrs"
v-on="on"
>
<v-icon dense>
$cog
</v-icon>
</v-btn>
</template>

<v-list dense>
<v-list-item @click="showHidden = !showHidden">
<v-list-item-action class="my-0">
<v-checkbox :input-value="showHidden" />
</v-list-item-action>
<v-list-item-content>
<v-list-item-title>
Show Hidden
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strings like this need to be localizable, so it should move to "en.yaml" and consumed with $t(app....) so it can be translated

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, forgot to do that. will fix it this weekend

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets also make this "Show hidden outputs" to make it more descriptive and distinct from any other.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, got the other things done. where do you recomend putting this in the translation files?

</v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list>
</v-menu>
</template>
<outputs />
</collapsable-card>
</template>
Expand All @@ -20,5 +54,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
})
}
}
</script>
3 changes: 2 additions & 1 deletion src/store/config/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ export const defaultState = (): ConfigState => {
printEtaCalculation: ['file'],
enableDiagnostics: false,
thumbnailSize: 32,
colorPickerValueRange: 'absolute'
colorPickerValueRange: 'absolute',
showHiddenOutputs: false
},
theme: {
isDark: true,
Expand Down
1 change: 1 addition & 0 deletions src/store/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export interface GeneralConfig {
enableDiagnostics: boolean;
thumbnailSize: number;
colorPickerValueRange: ColorPickerValueRange;
showHiddenOutputs: boolean;
}

export type ToolheadControlStyle = 'cross' | 'bars' | 'circle'
Expand Down
26 changes: 13 additions & 13 deletions src/store/printer/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -550,71 +550,71 @@ export const getters: GetterTree<PrinterState, RootState> = {
return []
},

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: OutputPin[] = getters.getPins()

return pins.find(pin => pin.name === name)
},

/**
* Return available fans and output pins
*/
getOutputs: (state, getters) => (filter?: string[]): Array<Fan | Led | OutputPin> => {
getOutputs: (state, getters) => (filter?: string[], showHidden = false): Array<Fan | Led | OutputPin> => {
// Fans..
const fans = [
'temperature_fan',
Expand Down Expand Up @@ -688,7 +688,7 @@ export const getters: GetterTree<PrinterState, RootState> = {

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.
Expand Down
6 changes: 3 additions & 3 deletions src/views/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ export default class Dashboard extends Mixins(StateMixin) {

get hasOutputs () {
return (
this.$store.getters['printer/getAllFans'].length > 0 ||
this.$store.getters['printer/getPins'].length > 0 ||
this.$store.getters['printer/getAllLeds'].length > 0
this.$store.getters['printer/getAllFans']().length > 0 ||
this.$store.getters['printer/getPins']().length > 0 ||
this.$store.getters['printer/getAllLeds']().length > 0
)
}

Expand Down