Skip to content

Commit

Permalink
feat: allow file / folder moves
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Bassett <[email protected]>
  • Loading branch information
cadriel committed Mar 16, 2021
1 parent 1dd531d commit aa08241
Show file tree
Hide file tree
Showing 24 changed files with 1,108 additions and 958 deletions.
7 changes: 4 additions & 3 deletions src/components/cards/KlippyCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<script lang="ts">
import { Component, Mixins } from 'vue-property-decorator'
import StateMixin from '@/mixins/state'
import FilesMixin from '@/mixins/files'
import ServicesMixin from '@/mixins/services'
import WarningsWidget from '@/components/widgets/WarningsWidget.vue'
Expand All @@ -35,17 +36,17 @@ import WarningsWidget from '@/components/widgets/WarningsWidget.vue'
WarningsWidget
}
})
export default class KlippyCard extends Mixins(StateMixin, ServicesMixin) {
export default class KlippyCard extends Mixins(StateMixin, ServicesMixin, FilesMixin) {
get klipperConnected () {
return this.$store.getters['server/getInfo'].klippy_connected
}
getKlippyLog () {
this.download('klippy.log', '')
this.downloadFile('klippy.log', '')
}
getMoonrakerLog () {
this.download('moonraker.log', '')
this.downloadFile('moonraker.log', '')
}
reload () {
Expand Down
8 changes: 4 additions & 4 deletions src/components/cards/configuration/LogsCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@

<script lang="ts">
import { Component, Mixins } from 'vue-property-decorator'
import StateMixin from '@/mixins/state'
import FilesMixin from '@/mixins/files'
@Component({})
export default class LogsCard extends Mixins(StateMixin) {
export default class LogsCard extends Mixins(FilesMixin) {
getKlippyLog () {
this.download('klippy.log', '')
this.downloadFile('klippy.log', '')
}
getMoonrakerLog () {
this.download('moonraker.log', '')
this.downloadFile('moonraker.log', '')
}
}
</script>
6 changes: 1 addition & 5 deletions src/components/cards/dashboard/JobsCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,9 @@

<file-system
v-if="gCodeRootReady"
root="gcodes"
accept=".gcode,.g,.gc,.gco,.ufp,.nc"
roots="gcodes"
dense
:height="400"
:show-title="false"
:show-meta-data="false"
:upload-and-print="true"
></file-system>
</collapsable-card>
</template>
Expand Down
39 changes: 4 additions & 35 deletions src/components/cards/dashboard/StatusCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,31 +82,7 @@
<v-icon small class="ml-1">$chevronDown</v-icon>
</btn>
</template>
<v-list
dense
color="tertiary"
>
<v-list-item
two-line
v-for="job in history"
:key="job.id"
>
<v-list-item-content>
<v-list-item-title>
<img
v-if="job.metadata.thumbnails && job.metadata.thumbnails.length"
class="mr-1 file-icon-thumb"
:src="getThumb(job.metadata.thumbnails).data"
:width="16"
/>
{{ job.filename }}
</v-list-item-title>
<v-list-item-subtitle>
last printed: {{ $filters.formatFileDateTime(job.start_time, 'll') }} - duration: {{ $filters.formatCounterTime(job.print_duration) }} - end state: {{ job.status }}
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
</v-list>
<reprint-list></reprint-list>
</v-menu>
</template>

Expand All @@ -126,6 +102,7 @@
<script lang="ts">
import { Component, Mixins } from 'vue-property-decorator'
import PrintStatusWidget from '@/components/widgets/PrintStatusWidget.vue'
import ReprintList from '@/components/widgets/history/ReprintList.vue'
import StateMixin from '@/mixins/state'
import FilesMixin from '@/mixins/files'
import { SocketActions } from '@/socketActions'
Expand All @@ -135,7 +112,8 @@ import DialogConfirm from '@/components/dialogs/dialogConfirm.vue'
@Component({
components: {
PrintStatusWidget,
DialogConfirm
DialogConfirm,
ReprintList
}
})
export default class StatusCard extends Mixins(StateMixin, FilesMixin) {
Expand All @@ -145,15 +123,6 @@ export default class StatusCard extends Mixins(StateMixin, FilesMixin) {
open: false
}
get history () {
// this should allow you to;
// if no history plugin, or no history.. reprint the last file if loaded
// via print_stats.filename or;
// if history plugin, with history.. reprint last file AND
// expand to a list of previous prints.
return this.$store.getters['history/getHistory'](3)
}
get hidePrinterMenu () {
// return (!this.printerPrinting && !this.printerPaused && !this.filename)
// console.log('printing?', this.printerPrinting)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
>
<v-card d-flex color="black">
<v-toolbar
dark
dense
color="secondary"
>
Expand All @@ -23,33 +22,37 @@
</btn>
<v-toolbar-title>{{ filename }}</v-toolbar-title>
<v-spacer></v-spacer>
<btn
v-if="!readonly && unsavedChanges"
:elevation="2"
dark
color="warning"
class="ml-2"
@click="emitSave(false, false, newContents, filename, path)">
Save
</btn>
<btn
v-if="!readonly && unsavedChanges"
:elevation="2"
dark
color="warning"
class="ml-2"
@click="emitSave(true, false, newContents, filename, path)">
Save &amp; Close
</btn>
<btn
v-if="!readonly && unsavedChanges && !printerPrinting"
:elevation="2"
dark
color="error"
class="ml-2"
@click="emitSave(true, true, newContents, filename, path)">
Save &amp; Restart
</btn>
<v-toolbar-items>
<btn
color="secondary"
v-if="!readonly && !printerPrinting"
:href="$globals.DOCS_KLIPPER_CONFIG_REF"
target="_blank">
<v-icon small left>$help</v-icon>
Config Reference
</btn>
<btn
color="secondary"
v-if="!readonly && !printerPrinting"
@click="emitSave(newContents, true)">
<v-icon small left>$restart</v-icon>
Save &amp; Restart
</btn>
<btn
color="secondary"
v-if="!readonly"
@click="emitSave(newContents, false)">
<v-icon small left>$save</v-icon>
Save
</btn>
<btn
color="secondary"
v-if="!readonly && !printerPrinting"
@click="emitClose()">
<v-icon small left>$close</v-icon>
Close
</btn>
</v-toolbar-items>
</v-toolbar>
<v-card-text>
<file-editor-widget
Expand All @@ -65,23 +68,20 @@
<script lang="ts">
import { Component, Mixins, Prop, Watch } from 'vue-property-decorator'
import StateMixin from '@/mixins/state'
import FileEditorWidget from '@/components/widgets/filesystem/FileEditorWidget.vue'
import FileEditorWidget from '@/components/widgets/FileEditorWidget.vue'
@Component({
components: {
FileEditorWidget
}
})
export default class DialogFileEditor extends Mixins(StateMixin) {
export default class FileEditorDialog extends Mixins(StateMixin) {
@Prop({ type: Boolean, required: true })
public value!: boolean
@Prop({ type: String, required: true })
public filename!: string;
@Prop({ type: String, required: true })
public path!: string;
@Prop({ type: String, required: true })
public contents!: string
Expand Down Expand Up @@ -114,9 +114,9 @@ export default class DialogFileEditor extends Mixins(StateMixin) {
this.$emit('input', false)
}
emitSave (close: boolean, restart: boolean, contents?: string, filename?: string, path?: string) {
this.$emit('save', restart, contents, filename, path)
if (close) this.$emit('input', false)
emitSave (contents: string, restart: boolean) {
this.$emit('save', contents, restart)
if (restart) this.$emit('input', false)
}
}
</script>
Expand Down
75 changes: 75 additions & 0 deletions src/components/dialogs/FileNameDialog.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<template>
<v-dialog
:value="value"
@input="$emit('input', value)"
:max-width="320"
persistent
>
<v-form
class="mt-3"
ref="addInstanceForm"
v-model="valid"
@submit.prevent="handleSave"
>
<v-card color="secondary">
<v-card-title>
<span class="headline">{{ title }}</span>
</v-card-title>
<v-card-text>

<v-text-field
autofocus
outlined
v-model="newName"
:label="label"
:rules="rules"
required>
</v-text-field>

</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<btn color="warning" text @click="$emit('input', false)">Cancel</btn>
<btn color="primary" type="submit">Save</btn>
</v-card-actions>
</v-card>
</v-form>
</v-dialog>
</template>

<script lang="ts">
import { Component, Mixins, Prop } from 'vue-property-decorator'
import StateMixin from '@/mixins/state'
@Component({})
export default class FileNameDialog extends Mixins(StateMixin) {
@Prop({ type: Boolean, required: true })
value!: boolean
@Prop({ type: String, required: true })
title!: string
@Prop({ type: String, required: true })
label!: string
@Prop({ type: Array, required: false })
rules!: []
@Prop({ type: String, required: true })
name!: string
newName = ''
valid = false
mounted () {
this.newName = this.name
}
handleSave () {
if (this.valid) {
this.$emit('save', this.newName)
this.$emit('input', false)
}
}
}
</script>
File renamed without changes.
Loading

0 comments on commit aa08241

Please sign in to comment.