Skip to content

Commit

Permalink
feat: configuration file editing
Browse files Browse the repository at this point in the history
  • Loading branch information
cadriel committed Oct 9, 2020
1 parent 87fcb9a commit 03106d8
Show file tree
Hide file tree
Showing 32 changed files with 1,013 additions and 356 deletions.
57 changes: 57 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
"core-js": "^3.6.5",
"dayjs": "^1.8.36",
"lodash-es": "^4.17.15",
"prismjs": "^1.21.0",
"vue": "^2.6.11",
"vue-chartjs": "^3.5.1",
"vue-class-component": "^7.2.3",
"vue-plotly": "^1.1.0",
"vue-prism-editor": "^1.2.2",
"vue-property-decorator": "^8.4.2",
"vue-router": "^3.2.0",
"vuetify": "^2.2.11",
Expand All @@ -40,6 +42,7 @@
"@types/lodash-es": "^4.17.3",
"@types/mocha": "^5.2.4",
"@types/plotly.js": "^1.50.21",
"@types/prismjs": "^1.16.1",
"@typescript-eslint/eslint-plugin": "^2.33.0",
"@typescript-eslint/parser": "^2.33.0",
"@vue/cli-plugin-babel": "~4.5.0",
Expand Down Expand Up @@ -70,7 +73,7 @@
"vuetify-loader": "^1.3.0",
"vuex-class": "^0.3.2"
},
"_id": "fluidd@0.0.1",
"_id": "fluidd@0.0.3",
"bugs": {
"url": "https://github.com/cadriel/fluidd/issues"
},
Expand Down
23 changes: 12 additions & 11 deletions src/components/AppBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@
<!-- <v-app-bar-nav-icon @click.stop="drawer = !drawer"></v-app-bar-nav-icon> -->
<!-- <img src="./assets/logo.svg" class="logo" /> -->
<v-icon large color="#1970b5">mdi-printer-3d-nozzle</v-icon>
<v-toolbar-title class="title text-h4">
<v-toolbar-title class="title text-h4 mr-5">
Fluidd
</v-toolbar-title>
<v-spacer />
<v-btn color="secondary" class="mr-2" to="/"><v-icon small class="mr-2">mdi-home</v-icon> Dashboard</v-btn>
<v-btn color="secondary" class="mr-2" to="/configuration"><v-icon small class="mr-2">mdi-tune</v-icon> Configuration</v-btn>
<v-btn color="secondary" class="mr-2" to="/settings"><v-icon small class="mr-2">mdi-cog</v-icon> Settings</v-btn>
<v-spacer />
<v-tooltip bottom v-if="printerConnected && klippyConnected">
<template v-slot:activator="{ on, attrs }">
<v-btn @click="emergencyStop()" v-bind="attrs" v-on="on" icon color="error"><v-icon>mdi-car-brake-alert</v-icon></v-btn>
</template>
Emergency Stop
</v-tooltip>
<v-toolbar-items>
<v-btn text to="/"><v-icon small class="mr-2">mdi-home</v-icon> Dashboard</v-btn>
<v-btn text to="/configuration"><v-icon small class="mr-2">mdi-tune</v-icon> Configuration</v-btn>
<v-btn text to="/settings"><v-icon small class="mr-2">mdi-cog</v-icon> Settings</v-btn>
<v-tooltip bottom v-if="printerConnected && klippyConnected">
<template v-slot:activator="{ on, attrs }">
<v-btn text color="error" @click="emergencyStop()" v-bind="attrs" v-on="on"><v-icon>mdi-car-brake-alert</v-icon></v-btn>
</template>
Emergency Stop
</v-tooltip>
</v-toolbar-items>
<!-- <v-btn icon color="white" class="mr-2" to="/settings"><v-icon small>mdi-cog</v-icon></v-btn> -->
</v-app-bar>
</template>
Expand Down
2 changes: 1 addition & 1 deletion src/components/cards/StatusCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<v-card class="mb-4">
<v-card-title >
<v-icon large left>mdi-printer-3d</v-icon>
<span class="title font-weight-light text-h5">
<span class="font-weight-light">
{{ printerState }}
<span class="font-weight-light text-subtitle-2 ml-4">{{ printerMessage }}</span>
</span>
Expand Down
2 changes: 1 addition & 1 deletion src/components/cards/TemperatureCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<v-card class="mb-4">
<v-card-title >
<v-icon large left>mdi-fire</v-icon>
<span class="title font-weight-light text-h5">Temperatures</span>
<span class="font-weight-light">Temperatures</span>
</v-card-title>

<temperature-targets-widget></temperature-targets-widget>
Expand Down
3 changes: 0 additions & 3 deletions src/components/cards/TerminalCard.vue

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/cards/ToolheadCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<v-card class="mb-4">
<v-card-title >
<v-icon large left>mdi-printer-3d-nozzle-outline</v-icon>
<span class="title font-weight-light text-h5">Toolhead</span>
<span class="font-weight-light">Toolhead</span>
<v-spacer />
<v-btn
v-if="!printerPrinting"
Expand Down
18 changes: 8 additions & 10 deletions src/components/cards/ToolsCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,28 @@
<v-tab-item :key="0">
<v-card-title>
<v-icon large left>mdi-file-code</v-icon>
<span class="title font-weight-light text-h5">Macros</span>
<span class="font-weight-light">Macros</span>
</v-card-title>
<macros-widget></macros-widget>
</v-tab-item>
<v-tab-item :key="1">
<v-card-title >
<v-icon large left>mdi-tools</v-icon>
<span class="title font-weight-light text-h5">Sys Commands</span>
<span class="font-weight-light">Sys Commands</span>
</v-card-title>
<system-commands-widget></system-commands-widget>
</v-tab-item>
<v-tab-item :key="2">
<v-card-title >
<v-icon large left>mdi-file-multiple-outline</v-icon>
<span class="title font-weight-light text-h5">Jobs</span>
</v-card-title>
<v-card-text>
<file-system-widget root="gcodes" :show-meta-data="false"></file-system-widget>
</v-card-text>
<file-system-widget
root="gcodes"
accept=".gcode"
:show-meta-data="false"
></file-system-widget>
</v-tab-item>
<v-tab-item :key="3">
<v-card-title >
<v-icon large left>mdi-console</v-icon>
<span class="title font-weight-light text-h5">Console</span>
<span class="font-weight-light">Console</span>
</v-card-title>
<console-widget></console-widget>
</v-tab-item>
Expand Down
113 changes: 113 additions & 0 deletions src/components/dialogs/dialogFileEditor.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<template>
<v-dialog
@input="emitChange(value)"
:value="value"
:loading="loading"
hide-overlay
fullscreen
transition="dialog-bottom-transition"
content-class="config-editor-overlay"
>
<v-card d-flex color="secondary darken-1">
<v-toolbar
dark
dense
color="secondary"
>
<v-btn
icon
dark
@click="emitClose()"
>
<v-icon>mdi-close</v-icon>
</v-btn>
<v-toolbar-title>{{ filename }}</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn
v-if="!readonly && unsavedChanges"
dark
color="error"
@click="emitSave(newContents, filename, path)">
Save
</v-btn>
</v-toolbar>
<v-card-text>
<file-editor-widget
v-model="newContents"
:fileExtension="fileExtension"
:readonly="readonly">
</file-editor-widget>
</v-card-text>
</v-card>
</v-dialog>
</template>

<script lang="ts">
import { Component, Mixins, Prop, Watch } from 'vue-property-decorator'
import UtilsMixin from '@/mixins/utils'
import FileEditorWidget from '@/components/widgets/configuration/FileEditorWidget.vue'
@Component({
components: {
FileEditorWidget
}
})
export default class DialogFileEditor extends Mixins(UtilsMixin) {
@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
@Prop({ type: Boolean, default: false })
public loading!: boolean
@Prop({ type: Boolean, default: false })
public readonly!: boolean
newContents = ''
@Watch('contents')
onValueChange (val: string) {
this.newContents = val
}
mounted () {
this.newContents = this.contents
}
get unsavedChanges () {
return (this.newContents !== this.contents)
}
get fileExtension () {
return this.filename.split('.').pop()
}
emitClose () {
this.$emit('input', false)
}
emitSave (contents?: string, filename?: string, path?: string) {
this.$emit('save', contents, filename, path)
}
}
</script>

<style lang="scss" scoped>
.config-editor-overlay div.v-card {
position: relative;
header {
position: sticky;
top: 0;
width: 100%;
z-index: 1;
}
}
</style>
Loading

0 comments on commit 03106d8

Please sign in to comment.