Skip to content

Commit

Permalink
feat: gcode-files & jobqueue on dashboard (#726)
Browse files Browse the repository at this point in the history
  • Loading branch information
meteyou authored May 11, 2022
1 parent 2cf1a13 commit 64eed0b
Show file tree
Hide file tree
Showing 23 changed files with 1,731 additions and 748 deletions.
15 changes: 9 additions & 6 deletions src/components/TheEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@
<panel
card-class="editor-dialog"
:icon="isWriteable ? mdiFileDocumentEditOutline : mdiFileDocumentOutline"
:title="
(filepath ? filepath.slice(1) + '/' : '') +
filename +
' ' +
(isWriteable ? changedOutput : '(' + $t('Editor.FileReadOnly') + ')')
">
:title="title">
<template #buttons>
<v-btn
v-if="restartServiceName === 'klipper'"
Expand Down Expand Up @@ -255,6 +250,14 @@ export default class TheEditor extends Mixins(BaseMixin) {
return this.$store.state.gui.editor.escToClose ?? false
}
get title() {
const title = `${this.filepath}/${this.filename}`
if (!this.isWriteable) return `${title} (${this.$t('Editor.FileReadOnly')})`
return `${title} ${this.changedOutput}`
}
cancelDownload() {
this.$store.dispatch('editor/cancelLoad')
}
Expand Down
80 changes: 80 additions & 0 deletions src/components/dialogs/StartPrintDialog.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<template>
<v-dialog v-model="bool" :max-width="dialogWidth">
<v-card>
<v-img v-if="file.big_thumbnail" contain :src="file.big_thumbnail"></v-img>
<v-card-title class="headline">{{ $t('Dialogs.StartPrint.Headline') }}</v-card-title>
<v-card-text class="pb-0">
{{ $t('Dialogs.StartPrint.DoYouWantToStartFilename', { filename: file.filename }) }}
</v-card-text>
<template v-if="moonrakerComponents.includes('timelapse')">
<v-divider class="mt-3 mb-2"></v-divider>
<v-card-text class="pb-0">
<settings-row :title="$t('Dialogs.StartPrint.Timelapse')">
<v-switch v-model="timelapseEnabled" hide-details class="mt-0"></v-switch>
</settings-row>
</v-card-text>
<v-divider class="mt-2 mb-0"></v-divider>
</template>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="" text @click="closeDialog">{{ $t('Dialogs.StartPrint.Cancel') }}</v-btn>
<v-btn
color="primary"
text
:disabled="printerIsPrinting || !klipperReadyForGui"
@click="startPrint(file.filename)">
{{ $t('Dialogs.StartPrint.Print') }}
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>

<script lang="ts">
import { Component, Mixins, Prop } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { FileStateGcodefile } from '@/store/files/types'
import SettingsRow from '@/components/settings/SettingsRow.vue'
@Component({
components: {
SettingsRow,
},
})
export default class StartPrintDialog extends Mixins(BaseMixin) {
@Prop({ required: true, default: false })
declare readonly bool: boolean
@Prop({ required: true, default: '' })
declare readonly currentPath: string
@Prop({ required: true })
declare file: FileStateGcodefile
get timelapseEnabled() {
return this.$store.state.server.timelapse?.settings?.enabled ?? false
}
set timelapseEnabled(newVal) {
this.$socket.emit(
'machine.timelapse.post_settings',
{ enabled: newVal },
{ action: 'server/timelapse/initSettings' }
)
}
get dialogWidth() {
return this.file.big_thumbnail_width ?? 400
}
startPrint(filename = '') {
filename = (this.currentPath + '/' + filename).substring(1)
this.closeDialog()
this.$socket.emit('printer.print.start', { filename: filename }, { action: 'switchToDashboard' })
}
closeDialog() {
this.$emit('closeDialog')
}
}
</script>
Loading

0 comments on commit 64eed0b

Please sign in to comment.