-
-
Notifications
You must be signed in to change notification settings - Fork 434
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into pedrolamas/client-linear-move-macro
- Loading branch information
Showing
18 changed files
with
404 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,211 @@ | ||
<template> | ||
<collapsable-card | ||
:title="$t('app.general.title.beacon')" | ||
icon="$beacon" | ||
:draggable="!fullscreen" | ||
:collapsable="!fullscreen" | ||
layout-path="dashboard.beacon-card" | ||
> | ||
<template #menu> | ||
<app-btn | ||
v-if="!fullscreen" | ||
color="" | ||
fab | ||
x-small | ||
text | ||
class="ms-1 my-1" | ||
@click="$filters.routeTo({ name: 'tune' })" | ||
> | ||
<v-icon>$fullScreen</v-icon> | ||
</app-btn> | ||
</template> | ||
|
||
<template v-if="beaconModels.length > 0"> | ||
<v-simple-table> | ||
<thead> | ||
<tr> | ||
<th>{{ $t('app.general.label.name') }}</th> | ||
<th> </th> | ||
<th> </th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr | ||
v-for="item in beaconModels" | ||
:key="item.name" | ||
> | ||
<td class=""> | ||
{{ item.name }} | ||
</td> | ||
<td> | ||
<v-chip | ||
v-if="item.active" | ||
small | ||
block | ||
> | ||
{{ $t('app.beacon.label.active') }} | ||
</v-chip> | ||
</td> | ||
<td | ||
class="text-right" | ||
nowrap | ||
> | ||
<v-tooltip | ||
v-if="!item.active" | ||
bottom | ||
> | ||
<template #activator="{ on, attrs }"> | ||
<app-btn | ||
v-bind="attrs" | ||
x-small | ||
color="" | ||
fab | ||
text | ||
@click="loadModel(item.name)" | ||
v-on="on" | ||
> | ||
<v-icon>$open</v-icon> | ||
</app-btn> | ||
</template> | ||
<span>{{ $t('app.beacon.tooltip.load') }}</span> | ||
</v-tooltip> | ||
|
||
<v-tooltip bottom> | ||
<template #activator="{ on, attrs }"> | ||
<app-btn | ||
v-bind="attrs" | ||
color="" | ||
class="ml-2" | ||
fab | ||
text | ||
x-small | ||
@click="removeModel(item.name)" | ||
v-on="on" | ||
> | ||
<v-icon color=""> | ||
$close | ||
</v-icon> | ||
</app-btn> | ||
</template> | ||
<span>{{ $t('app.beacon.tooltip.delete') }}</span> | ||
</v-tooltip> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</v-simple-table> | ||
</template> | ||
|
||
<v-divider /> | ||
|
||
<v-card-text> | ||
<div | ||
v-if="beaconModels.length === 0" | ||
class="mb-4" | ||
> | ||
No existing beacon models found | ||
</div> | ||
<v-row> | ||
<v-col cols="6"> | ||
<app-btn | ||
block | ||
small | ||
color="primary" | ||
@click="handleOpenSaveDialog" | ||
> | ||
{{ $t('app.general.btn.save_as') }} | ||
</app-btn> | ||
</v-col> | ||
<v-col cols="6"> | ||
<app-btn | ||
small | ||
block | ||
class="mb-2" | ||
:loading="hasWait($waits.onBeaconCalibrate)" | ||
:disabled="printerBusy || !xyHomed" | ||
@click="calibrate" | ||
> | ||
{{ $t('app.general.btn.calibrate') }} | ||
</app-btn> | ||
</v-col> | ||
</v-row> | ||
|
||
<!-- <div>{{ beacon }}</div> --> | ||
</v-card-text> | ||
|
||
<save-model-dialog | ||
v-if="saveDialogState.open" | ||
v-model="saveDialogState.open" | ||
:existing-name="saveDialogState.existingName" | ||
@save="handlModelSave" | ||
/> | ||
</collapsable-card> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { Component, Mixins, Prop } from 'vue-property-decorator' | ||
import SaveModelDialog from './SaveModelDialog.vue' | ||
import StateMixin from '@/mixins/state' | ||
import ToolheadMixin from '@/mixins/toolhead' | ||
import type { BeaconModel, BeaconState } from '@/store/printer/types' | ||
@Component({ | ||
components: { | ||
SaveModelDialog | ||
} | ||
}) | ||
export default class BeaconCard extends Mixins(StateMixin, ToolheadMixin) { | ||
saveDialogState = { | ||
open: false, | ||
existingName: 'default' | ||
} | ||
@Prop({ type: Boolean }) | ||
readonly fullscreen?: boolean | ||
get beacon (): BeaconState { | ||
return this.$store.state.printer.printer.beacon | ||
} | ||
get beaconModels (): BeaconModel[] { | ||
return this.$store.getters['printer/getBeaconModels'] | ||
} | ||
async loadModel (name: string) { | ||
const result = ( | ||
!this.printerPrinting || | ||
await this.$confirm( | ||
this.$tc('app.general.simple_form.msg.confirm_change_beacon_model'), | ||
{ title: this.$tc('app.general.label.confirm'), color: 'card-heading', icon: '$error' } | ||
) | ||
) | ||
if (result) { | ||
this.sendGcode(`BEACON_MODEL_SELECT NAME="${name}"`) | ||
} | ||
} | ||
removeModel (name: string) { | ||
this.sendGcode(`BEACON_MODEL_REMOVE NAME="${name}"`) | ||
} | ||
calibrate () { | ||
this.sendGcode('BEACON_CALIBRATE', this.$waits.onBeaconCalibrate) | ||
} | ||
handleOpenSaveDialog () { | ||
this.saveDialogState = { | ||
open: true, | ||
existingName: this.beacon.model ?? '' | ||
} | ||
} | ||
handlModelSave (config: { name: string; removeDefault: boolean }) { | ||
if (config.name !== this.beacon.model) { | ||
this.sendGcode(`BEACON_MODEL_SAVE NAME="${config.name}"`) | ||
} | ||
if (config.removeDefault) { | ||
this.sendGcode(`BEACON_MODEL_REMOVE NAME="${this.beacon.model}"`) | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<template> | ||
<app-dialog | ||
v-model="open" | ||
:title="$t('app.general.label.save_as')" | ||
max-width="450" | ||
@save="handleSubmit()" | ||
> | ||
<v-card-text> | ||
<v-text-field | ||
v-model="name" | ||
autofocus | ||
filled | ||
required | ||
class="mb-4" | ||
:rules="[ | ||
$rules.required | ||
]" | ||
hide-details="auto" | ||
:label="$t('app.beacon.label.model_name')" | ||
/> | ||
|
||
<v-checkbox | ||
v-model="removeDefault" | ||
:label="$t('app.beacon.label.remove_model', { name: existingName })" | ||
hide-details="auto" | ||
class="mb-4" | ||
:disabled="name === existingName" | ||
/> | ||
|
||
<span> | ||
{{ $t('app.beacon.msg.hint', { name: existingName }) }} | ||
</span> | ||
</v-card-text> | ||
</app-dialog> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { Component, Mixins, Prop, VModel } from 'vue-property-decorator' | ||
import StateMixin from '@/mixins/state' | ||
import ToolheadMixin from '@/mixins/toolhead' | ||
@Component({}) | ||
export default class SaveModelDialog extends Mixins(StateMixin, ToolheadMixin) { | ||
@VModel({ type: Boolean }) | ||
open?: boolean | ||
@Prop({ type: String }) | ||
readonly existingName!: string | ||
mounted () { | ||
this.name = 'default' | ||
this.removeDefault = false | ||
} | ||
name = 'default' | ||
removeDefault = false | ||
handleSubmit () { | ||
this.$emit('save', { name: this.name, removeDefault: this.removeDefault }) | ||
this.open = false | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.