Skip to content

Commit

Permalink
feat: add option to click on the spool or name to open change spool d…
Browse files Browse the repository at this point in the history
…ialog

Signed-off-by: Stefan Dej <[email protected]>
  • Loading branch information
meteyou committed Oct 1, 2023
1 parent c478235 commit fc0af95
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/components/panels/Spoolman/SpoolmanPanelActiveSpool.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<v-list-item-content :class="listItemContentClass">
<div :class="overlineClass">#{{ id }} | {{ vendor }}</div>
<v-list-item-title :class="listItemTitleClass">
{{ name }}
<span class="cursor-pointer" @click="clickSpool">{{ name }}</span>
</v-list-item-title>
<v-list-item-subtitle>{{ subtitle }}</v-list-item-subtitle>
</v-list-item-content>

<v-list-item-avatar tile :size="avatarSize">
<spool-icon :color="color" />
<spool-icon :color="color" @click-spool="clickSpool" />
</v-list-item-avatar>
</v-list-item>
</template>
Expand Down Expand Up @@ -115,6 +115,10 @@ export default class SpoolmanPanelActiveSpool extends Mixins(BaseMixin) {
get subtitle() {
return [this.materialOutput, this.weightOutput, this.lengthOutput].filter((v) => v !== null).join(' | ')
}
clickSpool() {
this.$emit('change-spool')
}
}
</script>

Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/SpoolmanPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
</v-col>
</v-row>
</v-card-text>
<spoolman-panel-active-spool v-else />
<spoolman-panel-active-spool v-else @change-spool="showChangeSpoolDialog = true" />
</panel>
<spoolman-change-spool-dialog :show-dialog="showChangeSpoolDialog" @close="showChangeSpoolDialog = false" />
<spoolman-eject-spool-dialog :show-dialog="showEjectSpoolDialog" @close="showEjectSpoolDialog = false" />
Expand Down
12 changes: 9 additions & 3 deletions src/components/ui/SpoolIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
x="0px"
y="0px"
viewBox="0 0 487.04 487.04"
xml:space="preserve">
xml:space="preserve"
class="cursor-pointer"
@click="clickSpool">
<g>
<circle :style="styleCircle1" cx="243.52" cy="243.52" r="232.97" />
<circle :style="styleCircle2" cx="243.52" cy="243.52" r="112.5" />
Expand All @@ -20,9 +22,9 @@
<script lang="ts">
import Component from 'vue-class-component'
import { Mixins, Prop } from 'vue-property-decorator'
import BaseMixin from '../mixins/base'
import BaseMixin from '@/components/mixins/base'
@Component
@Component({})
export default class SpoolIcon extends Mixins(BaseMixin) {
@Prop({ required: false, default: '#ff0' })
declare readonly color: string
Expand All @@ -38,5 +40,9 @@ export default class SpoolIcon extends Mixins(BaseMixin) {
get styleCircle3() {
return { fill: '#343434' }
}
clickSpool() {
this.$emit('click-spool')
}
}
</script>

0 comments on commit fc0af95

Please sign in to comment.