Skip to content

Commit

Permalink
fix many problems; download gcode files
Browse files Browse the repository at this point in the history
  • Loading branch information
meteyou committed Mar 7, 2020
1 parent e7a5e34 commit 21b56a9
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 23 deletions.
Binary file modified public/favicon.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>kwc</title>
<title>KlipperWebControl</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css">
</head>
Expand Down
10 changes: 6 additions & 4 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
elevate-on-scroll>
<v-app-bar-nav-icon @click.stop="drawer = !drawer"></v-app-bar-nav-icon>
<v-spacer></v-spacer>
<v-btn color="green" v-if="!isConnected" :loading="loadingEmergencyStop" @click="emergencyStop"><v-icon class="mr-2">mdi-refresh-circle</v-icon> reconnect</v-btn>
<!--<v-btn color="green" v-if="!isConnected" :loading="loadingEmergencyStop" @click="emergencyStop"><v-icon class="mr-2">mdi-refresh-circle</v-icon> reconnect</v-btn>-->
<v-btn color="error" v-if="isConnected" :loading="loadingEmergencyStop" @click="emergencyStop">Emergency Stop</v-btn>
</v-app-bar>

Expand Down Expand Up @@ -124,7 +124,10 @@ export default {
text-align: center;
border-bottom: 1px solid #ffffff40;
margin-bottom: 1em;
padding: .75em 0 .25em 0;
padding: .75em 0 .75em 0;
display: flex;
align-items: center;
justify-content: center;
}
#nav-header img {
Expand All @@ -133,9 +136,8 @@ export default {
}
#nav-header .v-toolbar__title {
display: inline-block;
line-height: 40px;
font-size: 24px;
vertical-align: middle;
}
.v-navigation-drawer__content {
Expand Down
4 changes: 2 additions & 2 deletions src/components/panels/StatusPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<v-list-item-subtitle>{{ toolhead !== null && 'status' in toolhead ? toolhead.status : "" }}</v-list-item-subtitle>
</v-list-item-content>
<v-btn class="orange" v-if="toolhead && toolhead.status === 'Printing'" @click="btnPauseJob" :loading="btnStatusPause">pause job</v-btn>
<v-btn class="orange" v-if="(toolhead && toolhead.status === 'Ready') && is_paused" :loading="btnStatusResume" @click="btnResumeJob">resume job</v-btn>
<v-btn class="red ml-2" v-if="(toolhead && toolhead.status === 'Ready') && is_paused" :loading="btnStatusCancel" @click="btnCancelJob">cancel job</v-btn>
<v-btn class="red" v-if="(toolhead && toolhead.status === 'Ready') && is_paused" :loading="btnStatusCancel" @click="btnCancelJob">cancel job</v-btn>
<v-btn class="orange ml-2" v-if="(toolhead && toolhead.status === 'Ready') && is_paused" :loading="btnStatusResume" @click="btnResumeJob">resume job</v-btn>
</v-list-item>
<v-divider class="my-2" ></v-divider>
<v-card-text class="px-0 pt-0 pb-2 content">
Expand Down
11 changes: 7 additions & 4 deletions src/components/panels/TempchartPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
<v-list-item-avatar color="grey"><v-icon dark>fa-thermometer-three-quarters</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">Temperature Chart</v-list-item-title>
<v-list-item-subtitle>buxdehude</v-list-item-subtitle>
<v-list-item-subtitle>{{ heatersCount }} heaters</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
<v-divider class="my-2"></v-divider>
<v-card-text class="px-0 pt-0 pb-2 content">
<v-card-text class="pt-0 pb-2 content">
<line-chart :chart-data="chartdata" v-if="loaded"></line-chart>
</v-card-text>
</v-card>
</template>

<script>
import LineChart from '../../charts/LineChart.js'
import { mapState } from 'vuex'
import {mapGetters, mapState} from 'vuex'
export default {
components: {
Expand All @@ -35,7 +35,10 @@
...mapState({
labels: state => state.temperaturChart.labels,
datasets: state => state.temperaturChart.datasets,
})
}),
...mapGetters([
'heatersCount'
])
},
methods: {
fillData () {
Expand Down
12 changes: 6 additions & 6 deletions src/components/panels/ToolsPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
<v-divider class="my-2"></v-divider>
<v-card-text class="px-0 pt-0 pb-2 content">
<v-row class="pl-3 pr-3">
<v-col class="text-center"><b>Heater</b></v-col>
<v-col class="text-center"><b>Current</b></v-col>
<v-col class="text-center"><b>Target</b></v-col>
<v-col class="text-center py-0"><b>Heater</b></v-col>
<v-col class="text-center py-0"><b>Current</b></v-col>
<v-col class="text-center py-0"><b>Target</b></v-col>
</v-row>
<div v-for="(heater, index) in heaters" v-bind:key="index" >
<v-divider class="my-2"></v-divider>
<v-row class="pl-3 pr-3 heater-row">
<v-col class="text-center">
<v-col class="text-center py-0">
<b>{{ heater.name }}</b><br />
<small>{{ heater.target > 0 ? "active" : "off" }}</small>
</v-col>
<v-col class="text-center vertical_align_center"><span>{{ heater.temperature.toFixed(1) }}°C</span></v-col>
<v-col class="text-center vertical_align_center">
<v-col class="text-center py-0 vertical_align_center"><span>{{ heater.temperature.toFixed(1) }}°C</span></v-col>
<v-col class="text-center py-0 vertical_align_center">
<toolInput :name="heater.name" :target="heater.target" ></toolInput>
</v-col>
</v-row>
Expand Down
31 changes: 27 additions & 4 deletions src/pages/Files.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
<style>
.v-data-table .v-data-table-header__icon {
margin-left: 7px;
}
.v-data-table th:last-child .v-data-table-header__icon {
float: right;
}
.v-data-table .file-list-cursor:hover {
cursor: pointer;
}
</style>

<template>
<div>
<v-card>
Expand All @@ -22,7 +36,7 @@
</template>

<template #item="{ item }">
<tr @contextmenu="showContextMenu($event, item)" @click="dialog.show = true, dialog.filename = item.filename">
<tr @contextmenu="showContextMenu($event, item)" @click="dialog.show = true, dialog.filename = item.filename" class="file-list-cursor">
<td class=" ">
{{ item.filename }}
</td>
Expand All @@ -38,9 +52,9 @@
</v-card>
<v-menu v-model="contextMenu.shown" :position-x="contextMenu.x" :position-y="contextMenu.y" absolute offset-y>
<v-list>
<!--<v-list-item>
<v-list-item @click="downloadFile">
<v-icon class="mr-1">mdi-cloud-download</v-icon> Download
</v-list-item>-->
</v-list-item>
<v-list-item @click="removeFile">
<v-icon class="mr-1">mdi-delete</v-icon> Delete
</v-list-item>
Expand Down Expand Up @@ -86,7 +100,7 @@
{
text: 'last modified',
value: 'modified',
align: 'end',
align: 'end'
},
],
options: {
Expand All @@ -99,6 +113,7 @@
y: 0,
item: {}
},
hostname: hostname,
}
},
computed: {
Expand Down Expand Up @@ -168,6 +183,14 @@
this.contextMenu.shown = true
});
},
downloadFile() {
let link = document.createElement("a");
link.download = name;
link.href = 'http://' + hostname + '/printer/files/' + this.contextMenu.item.filename;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
},
removeFile() {
axios.delete(
'http://'+hostname+'/printer/files/'+this.contextMenu.item.filename
Expand Down
3 changes: 1 addition & 2 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,7 @@ export default new Vuex.Store({
commit('sendGcode', data);
},

switchToDashboard(state) {
window.console.log(state);
switchToDashboard() {
router.push("/");
}
}
Expand Down

0 comments on commit 21b56a9

Please sign in to comment.