Skip to content

Commit

Permalink
fix: disable dashboard controls if Klipper is not ready (#811)
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Lamas <[email protected]>
  • Loading branch information
pedrolamas authored Aug 4, 2022
1 parent 041dc0f commit 7028b15
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/components/ui/AppMacroBtn.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<app-btn
v-if="paramList.length === 0 || !enableParams"
:disabled="macro.disabledWhilePrinting && printerPrinting"
:disabled="(macro.disabledWhilePrinting && printerPrinting) || !klippyReady"
:style="borderStyle"
@click="$emit('click', macro.name)"
>
Expand All @@ -12,7 +12,7 @@
:elevation="6"
>
<app-btn
:disabled="macro.disabledWhilePrinting && printerPrinting"
:disabled="(macro.disabledWhilePrinting && printerPrinting) || !klippyReady"
:style="borderStyle"
@click="$emit('click', macro.name)"
>
Expand All @@ -30,6 +30,7 @@
v-bind="attrs"
:min-width="24"
class="px-0"
:disabled="(macro.disabledWhilePrinting && printerPrinting) || !klippyReady"
v-on="on"
>
<v-icon
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/AppNamedInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
align-self="center"
cols="5"
class="text-body-1 py-0"
:class="{ 'disabled--text': disabled }"
:class="{ 'text--disabled': disabled }"
>
{{ label }}
</v-col>
Expand Down
6 changes: 4 additions & 2 deletions src/components/ui/AppSlider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
sm="5"
align-self="center"
class="text-body-1 py-0"
v-html="label"
/>
:class="{ 'text--disabled': disabled }"
>
{{ label }}
</v-col>

<!-- Current value -->
<v-col
Expand Down
1 change: 1 addition & 0 deletions src/components/ui/AppSwitch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
>
<div
class="text-body-1"
:class="{ 'text--disabled': disabled }"
>
{{ label }}
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/components/widgets/console/Console.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<console-command
v-if="!readonly && flipLayout"
v-model="consoleCommand"
:disabled="!klippyReady"
@send="sendCommand"
/>
<v-card
Expand Down Expand Up @@ -43,6 +44,7 @@
<console-command
v-if="!readonly && !flipLayout"
v-model="consoleCommand"
:disabled="!klippyReady"
@send="sendCommand"
/>
</div>
Expand Down
9 changes: 8 additions & 1 deletion src/components/widgets/console/ConsoleCommand.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
:rows="1"
:value="newValue"
:items="history"
:disabled="disabled"
auto-grow
clearable
outlined
Expand All @@ -22,7 +23,10 @@
/>
</v-col>
<v-col cols="auto">
<app-btn @click="emitSend(newValue)">
<app-btn
:disabled="disabled"
@click="emitSend(newValue)"
>
{{ $t('app.general.btn.send') }}
</app-btn>
</v-col>
Expand All @@ -46,6 +50,9 @@ export default class ConsoleCommand extends Vue {
@Ref('input')
readonly input!: VInput
@Prop({ type: Boolean, default: false })
public disabled!: boolean
@Watch('value')
onValueChange (val: string) {
if (val) {
Expand Down
3 changes: 2 additions & 1 deletion src/components/widgets/outputs/OutputFan.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
/>

<v-layout
v-if="!fan.controllable"
v-else
align-center
justify-space-between
:class="{ 'text--disabled': !klippyReady }"
>
<div class="text-body-1">
{{ fan.prettyName }}
Expand Down
5 changes: 4 additions & 1 deletion src/components/widgets/toolhead/ZHeightAdjust.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
{{ value }}
</app-btn>
</v-btn-toggle>
<div class="mt-1">
<div
class="mt-1"
:class="{ 'text--disabled': !klippyReady }"
>
<span class="secondary--text">{{ $t('app.general.label.z_offset') }}&nbsp;</span>
<span>{{ ZHomingOrigin }}mm</span>
</div>
Expand Down

0 comments on commit 7028b15

Please sign in to comment.