Skip to content

Commit

Permalink
feat: allow input values for sliders
Browse files Browse the repository at this point in the history
  • Loading branch information
cadriel committed Jan 14, 2021
1 parent 5a2d4df commit 7a1c63d
Show file tree
Hide file tree
Showing 10 changed files with 115 additions and 50 deletions.
46 changes: 46 additions & 0 deletions src/components/cards/dashboard/OutputsCard.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<template>
<collapsable-card
title="Fans / Outputs"
icon="$printer3dNozzle"
:draggable="true"
:inLayout="inLayout"
:enabled="enabled"
menu-breakpoint="lg"
@enabled="$emit('enabled', $event)">

<v-card-text>
<v-row justify="space-between">
<v-col cols="6">
<fans-widget></fans-widget>
</v-col>

<v-col cols="6">
<output-pins-widget></output-pins-widget>
</v-col>
</v-row>
</v-card-text>

</collapsable-card>
</template>

<script lang="ts">
import { Component, Mixins, Prop } from 'vue-property-decorator'
import UtilsMixin from '@/mixins/utils'
import FansWidget from '@/components/widgets/FansWidget.vue'
import OutputPinsWidget from '@/components/widgets/OutputPinsWidget.vue'
@Component({
components: {
FansWidget,
OutputPinsWidget
}
})
export default class OutputsCard extends Mixins(UtilsMixin) {
@Prop({ type: Boolean, default: true })
enabled!: boolean
get inLayout (): boolean {
return (this.$store.state.config.layoutMode)
}
}
</script>
14 changes: 11 additions & 3 deletions src/components/inputs/InputTemperature.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<v-text-field
solo
outlined
single-line
dense
hide-details="auto"
:height="36"
:value="value"
:loading="loading"
:rules="[rules.max, rules.min]"
Expand Down Expand Up @@ -80,5 +80,13 @@ export default class InputTemperature extends Mixins(UtilsMixin) {
}
</script>

<style lang="scss">
<style scoped lang="scss">
::v-deep input {
// text-align: right;
padding: 0;
}
::v-deep .v-input__slot {
min-height: 36px !important;
}
</style>
5 changes: 3 additions & 2 deletions src/components/inputs/inputConsoleCommand.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
:items="history"
class="ma-4"
clearable
solo
outlined
single-line
dense
hide-details
placeholder="type 'help' for available commands"
Expand All @@ -32,7 +33,7 @@ export default class InputConsoleCommand extends Vue {
@Watch('value')
onValueChange (val: string) {
if (val) {
this.newValue = val.toUpperCase()
this.newValue = val
const input = this.$refs.input as HTMLElement
input.focus()
} else {
Expand Down
18 changes: 14 additions & 4 deletions src/components/widgets/ExtruderMovesWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,23 @@
v-model="extrudeLength"
:disabled="!klippyConnected"
@focus="$event.target.select()"
solo
outlined
dense
hide-details
single-line
label="Extrude Length"
type="number"
suffix="mm"
class="mb-1">
class="mb-2">
</v-text-field>
<v-text-field
v-model="extrudeSpeed"
:disabled="!klippyConnected"
@focus="$event.target.select()"
solo
outlined
dense
hide-details
single-line
label="Extrude Speed"
suffix="mm/s"
class="">
Expand Down Expand Up @@ -88,5 +90,13 @@ export default class ToolheadMovesWidget extends Mixins(UtilsMixin) {
}
</script>

<style type="scss" scoped>
<style scoped lang="scss">
::v-deep input {
// text-align: right;
padding: 0;
}
::v-deep .v-input__slot {
min-height: 36px !important;
}
</style>
8 changes: 5 additions & 3 deletions src/components/widgets/FansWidget.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<template>
<!-- Fans -->
<v-row no-gutters class="mb-4">
<div>
<v-row>
<v-col class="">
<div v-for="(fan, i) in fans" :key="i">
<input-slider
:label="fan.prettyName"
value-suffix="%"
:label="fan.prettyName"
:value="fan.speed * 100"
:rules="rules"
:disabled="!klippyConnected"
Expand All @@ -16,6 +17,7 @@
</div>
</v-col>
</v-row>
</div>
</template>

<script lang="ts">
Expand All @@ -32,7 +34,7 @@ import { Fan } from '@/store/socket/types'
})
export default class FansWidget extends Mixins(UtilsMixin) {
get fans () {
return this.$store.getters['socket/getFans']()
return this.$store.getters['socket/getToolHeadFans']
}
get partFanSpeed () {
Expand Down
53 changes: 27 additions & 26 deletions src/components/widgets/SpeedAndFlowAdjustWidget.vue
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
<template>
<div>
<!-- Speed and Flow Adjust -->
<input-slider
label="Speed"
value-suffix="%"
:value="speed"
:disabled="!klippyConnected"
:loading="hasWait(waits.onSetSpeed)"
:min="0"
:max="200"
@input="setSpeed($event, waits.onSetSpeed)">
</input-slider>

<v-divider class="my-2"></v-divider>

<input-slider
label="Flow"
value-suffix="%"
:value="flow"
:disabled="!klippyConnected"
:loading="hasWait(waits.onSetFlow)"
:min="0"
:max="200"
@input="setFlow($event, waits.onSetFlow)">
</input-slider>
</div>
<v-row>
<v-col cols="12" sm="6">
<!-- Speed and Flow Adjust -->
<input-slider
label="Speed"
value-suffix="%"
:value="speed"
:disabled="!klippyConnected"
:loading="hasWait(waits.onSetSpeed)"
:min="0"
:max="200"
@input="setSpeed($event, waits.onSetSpeed)">
</input-slider>
</v-col>
<v-col cols="12" sm="6">
<input-slider
label="Flow"
value-suffix="%"
:value="flow"
:disabled="!klippyConnected"
:loading="hasWait(waits.onSetFlow)"
:min="0"
:max="200"
@input="setFlow($event, waits.onSetFlow)">
</input-slider>
</v-col>
</v-row>
</template>

<script lang="ts">
Expand Down
2 changes: 1 addition & 1 deletion src/components/widgets/TemperatureTargetsWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export default class TemperatureTargetsWidget extends Mixins(UtilsMixin) {
}
get fans () {
return this.$store.getters['socket/getFans']()
return this.$store.getters['socket/getFans']
}
get sensors () {
Expand Down
14 changes: 4 additions & 10 deletions src/components/widgets/ToolheadWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,8 @@
</v-col>
</v-row>

<v-row>
<v-col cols="12" sm="6">
<!-- Part cooling -->
<fans-widget></fans-widget>
</v-col>
<v-col cols="12" sm="6">
<!-- Speed and Flow Adjustments -->
<speed-and-flow-adjust-widget></speed-and-flow-adjust-widget>
</v-col>
</v-row>
<!-- Speed and Flow Adjustments -->
<speed-and-flow-adjust-widget></speed-and-flow-adjust-widget>
</v-card-text>
</template>

Expand All @@ -35,6 +27,7 @@ import ToolheadPositionWidget from '@/components/widgets/ToolheadPositionWidget.
import ZHeightAdjustWidget from '@/components/widgets/ZHeightAdjustWidget.vue'
import SpeedAndFlowAdjustWidget from '@/components/widgets/SpeedAndFlowAdjustWidget.vue'
import FansWidget from '@/components/widgets/FansWidget.vue'
// import OutputPinsWidget from '@/components/widgets/OutputPinsWidget.vue'
@Component({
components: {
Expand All @@ -44,6 +37,7 @@ import FansWidget from '@/components/widgets/FansWidget.vue'
ZHeightAdjustWidget,
SpeedAndFlowAdjustWidget,
FansWidget
// OutputPinsWidget
}
})
export default class ToolheadWidget extends Mixins(UtilsMixin) {}
Expand Down
1 change: 1 addition & 0 deletions src/store/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const defaultState = (): ConfigState => {
cardLayout: {
dashboard1: [
{ name: 'toolhead-card', enabled: true },
{ name: 'outputs-card', enabled: true },
{ name: 'camera-card', enabled: true },
{ name: 'printer-limits-card', enabled: true }
],
Expand Down
4 changes: 3 additions & 1 deletion src/views/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import TemperatureGraphCard from '@/components/cards/dashboard/TemperatureGraphC
import CameraCard from '@/components/cards/dashboard/CameraCard.vue'
import MacrosCard from '@/components/cards/dashboard/MacrosCard.vue'
import ConsoleCard from '@/components/cards/dashboard/ConsoleCard.vue'
import OutputsCard from '@/components/cards/dashboard/OutputsCard.vue'
import PrinterLimitsCard from '@/components/cards/dashboard/PrinterLimitsCard.vue'
import KlippyDisconnectedCard from '@/components/cards/KlippyDisconnectedCard.vue'
import UtilsMixin from '@/mixins/utils'
Expand All @@ -62,7 +63,8 @@ import { cloneDeep } from 'lodash-es'
CameraCard,
PrinterLimitsCard,
KlippyDisconnectedCard,
ConsoleCard
ConsoleCard,
OutputsCard
}
})
export default class Dashboard extends Mixins(UtilsMixin) {
Expand Down

0 comments on commit 7a1c63d

Please sign in to comment.