diff --git a/src/components/widgets/toolhead/ToolChangeCommands.vue b/src/components/widgets/toolhead/ToolChangeCommands.vue index 6f91daab52..8e46016121 100644 --- a/src/components/widgets/toolhead/ToolChangeCommands.vue +++ b/src/components/widgets/toolhead/ToolChangeCommands.vue @@ -48,7 +48,7 @@ - - - $error - - - $warning - - - $alertCircle - - - - - - - {{ macro.name.toUpperCase() }}: {{ macro.message.message }} - - - - - - $close - - - - +
+ {{ macro.name.toUpperCase() }} {{ macro.alert.text }} +
+
@@ -164,15 +122,15 @@ export default class ToolChangeCommands extends Mixins(ToolheadMixin, StateMixin return false } - messageAction (macro: ToolChangeCommand) { - if (macro.message?.action) { - this.messageCancel(macro) - this.sendGcode(macro.message?.action) + alertAction (macro: ToolChangeCommand) { + this.alertCancel(macro) + if (macro.alert?.action) { + this.sendGcode(macro.alert?.action) } } - messageCancel (macro: ToolChangeCommand) { - this.sendGcode(`SET_GCODE_VARIABLE MACRO=${macro.name} VARIABLE=message VALUE="''"`) + alertCancel (macro: ToolChangeCommand) { + this.sendGcode(`SET_GCODE_VARIABLE MACRO=${macro.name} VARIABLE=alert VALUE="''"`) } } @@ -198,7 +156,4 @@ export default class ToolChangeCommands extends Mixins(ToolheadMixin, StateMixin } } - .v-list-item>>> .v-list-item__content { - padding: 0 !important; - } diff --git a/src/mixins/toolhead.ts b/src/mixins/toolhead.ts index 336bfa767f..6255ccd4da 100644 --- a/src/mixins/toolhead.ts +++ b/src/mixins/toolhead.ts @@ -13,12 +13,12 @@ export type ToolChangeCommand = { remap?: number, join?: number, runout_sensor?: string - message?: ToolChangeMessage + alert?: ToolHeadAlert } -export type ToolChangeMessage = { +export type ToolHeadAlert = { type: string, - message: string, + text: string, action: string, } @@ -256,6 +256,15 @@ export default class ToolheadMixin extends Vue { return false } + get hasToolheadAlerts (): boolean { + for (const txMacro of this.toolChangeCommands) { + if (txMacro.alert && txMacro.alert.toString().length > 0) { + return true + } + } + return false + } + get toolChangeCommands (): ToolChangeCommand[] { const availableCommands = this.$store.getters['printer/getAvailableCommands'] as GcodeCommands @@ -268,14 +277,14 @@ export default class ToolheadMixin extends Vue { : this.$t('app.tool.tooltip.select_tool', { tool: command.substring(1) }) const macro = this.$store.getters['macros/getMacroByName'](command.toLowerCase()) - const message: ToolChangeMessage = { type: '', message: '', action: '' } - if (macro?.variables?.message) { + const alert: ToolHeadAlert = { type: '', text: '', action: '' } + if (macro?.variables?.alert) { try { - const split = macro?.variables?.message.split('|') - message.type = split[0] - message.message = split[1] - message.action = split[2] - console.error(macro?.variables?.message) + const split = macro?.variables?.alert.split('|') + alert.type = split[0] + alert.text = split[1] + alert.action = split[2] + console.error(macro?.variables?.alert) } catch { console.error('error') } @@ -291,7 +300,7 @@ export default class ToolheadMixin extends Vue { remap: macro?.variables?.remap, join: macro?.variables?.join, runout_sensor: macro?.variables?.runout_sensor, - message: message ?? undefined + alert: alert ?? undefined } satisfies ToolChangeCommand }) .sort((a, b) => {