Skip to content

Commit

Permalink
fix: Klippy error card is no longer delayed before being hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
cadriel committed Jan 15, 2021
1 parent 1ac6d37 commit 9b7aba9
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 35 deletions.
36 changes: 32 additions & 4 deletions src/components/cards/KlippyDisconnectedCard.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<collapsable-card
v-if="printerWarnings.length || !klippyConnected"
:title="'Klippy: ' + klippyState"
v-if="(printerWarnings && printerWarnings.length) || !klippyConnected"
:title="`Klippy: ${klippyState}`"
:collapsable="false"
icon="$alert">
<v-card-text>
Expand All @@ -23,12 +23,12 @@
<v-alert text dense type="error" v-if="klippyStateMessage !== 'Printer is ready'">
<span v-html=klippyStateMessage></span>
</v-alert>
<v-alert text dense icon="$alert" type="warning" v-if="socketReady && printerWarnings.length && klippyStateMessage === 'Printer is ready'">

<v-alert text dense icon="$alert" type="warning" v-if="socketReady && printerWarnings.length && klippyConnected">
<div class="mb-2">
{{ appName }} warnings found
</div>

<!-- <div class="client-warning mb-2" v-for="(warning, index) in clientWarnings" :key="index" v-html="warning.message"></div> -->
<div class="client-warning" v-for="(warning, index) in printerWarnings" :key="index" v-html="warning.message"></div>
</v-alert>
</v-col>
Expand Down Expand Up @@ -76,5 +76,33 @@ export default class KlippyDisconnectedCard extends Mixins(UtilsMixin) {
SocketActions.printerFirmwareRestart()
this.$emit('click')
}
// Return a list of warnings we deem necessary for
// correct usage of the web client.
get printerWarnings () {
const config = this.$store.state.socket.printer.configfile.config
const docsUrl = Globals.DOCS_REQUIRED_CONFIGURATION
const warnings = []
if (config && !config.virtual_sdcard) {
warnings.push({ message: '[virtual_sdcard] not found in printer configuration.' })
}
if (config && !config.pause_resume) {
warnings.push({ message: '[pause_resume] not found in printer configuration.' })
}
if (config && !config.display_status) {
warnings.push({ message: '[display_status] not found in printer configuration.' })
}
if (config && ('gcode_macro CANCEL_PRINT' in config === false)) {
warnings.push({ message: 'CANCEL_PRINT macro not found in configuration.' })
}
if (warnings.length > 0) {
warnings.push({ message: `Fluidd setup requirements can be found <a target="_blank" href="${docsUrl}">here.</a>` })
}
return warnings
}
}
</script>
28 changes: 0 additions & 28 deletions src/mixins/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,34 +70,6 @@ export default class UtilsMixin extends Vue {
return false
}

// Return a list of warnings we deem necessary for
// correct usage of the web client.
get printerWarnings () {
const config = this.$store.state.socket.printer.configfile.config
const docsUrl = Globals.DOCS_REQUIRED_CONFIGURATION
const warnings = []
if (config && !config.virtual_sdcard) {
warnings.push({ message: '[virtual_sdcard] not found in printer configuration.' })
}

if (config && !config.pause_resume) {
warnings.push({ message: '[pause_resume] not found in printer configuration.' })
}

if (config && !config.display_status) {
warnings.push({ message: '[display_status] not found in printer configuration.' })
}

if (config && ('gcode_macro CANCEL_PRINT' in config === false)) {
warnings.push({ message: 'CANCEL_PRINT macro not found in configuration.' })
}

if (warnings.length > 0) {
warnings.push({ message: `Fluidd setup requirements can be found <a target="_blank" href="${docsUrl}">here.</a>` })
}
return warnings
}

get xyHomed (): boolean {
return this.$store.getters['socket/getHomedAxes']('xy')
}
Expand Down
6 changes: 5 additions & 1 deletion src/store/socket/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ export const defaultState = (): SocketState => {
max_accel: 0,
max_velocity: 0,
square_corner_velocity: 5
}
},
virtual_sdcard: {},
pause_resume: {},
display_status: {},
'gcode_macro CANCEL_PRINT': {}
}
},
objects: [],
Expand Down
2 changes: 1 addition & 1 deletion src/store/socket/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const mutations: MutationTree<SocketState> = {
}
},
onPrinterInfo (state, payload) {
state.printer.info = payload
Vue.set(state.printer, 'info', payload)
},
onPlugins (state, payload) {
Vue.set(
Expand Down
2 changes: 1 addition & 1 deletion src/views/Configuration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<klippy-disconnected-card></klippy-disconnected-card>
<bed-mesh-card v-if="supportsBedMesh && klippyConnected"></bed-mesh-card>
<v-row>
<v-col cols="12" sm="6" v-if="!printerWarnings.length && klippyConnected">
<v-col cols="12" sm="6" v-if="klippyConnected">
<logs-card></logs-card>
<!-- <bed-adjust-card></bed-adjust-card> -->
</v-col>
Expand Down
3 changes: 3 additions & 0 deletions todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
- print instances having data bleed? [github issue]
- ability to reprint after cancel
- copying text from console puts seperate outputs in reverse order [github issue]
- loading heaters, fans or pins means these are constantly updated - due to temps changing
often. Need a more elegant way to load just the names of these items without parts of the
reactive data that is changed so often

## Filesystem Improvements

Expand Down

0 comments on commit 9b7aba9

Please sign in to comment.