feature: rework the StatusPanel.vue

feature: add Sys Commands to the topbar

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej committed 2020-10-24 23:14:34 +02:00
1 parent 27308e44ab
commit f35cf70301
3 files changed
+89 -36

No files matched your search

+50 -1
View File
@@ -1,5 +1,9 @@
<style>
@import './assets/styles/fonts.css';
.button-min-width-auto {
min-width: auto !important;
}
</style>
<template>
@@ -52,7 +56,38 @@
<v-app-bar-nav-icon @click.stop="drawer = !drawer"></v-app-bar-nav-icon>
<v-spacer></v-spacer>
<v-btn color="primary" class="mr-5" v-if="isConnected && save_config_pending" :loading="loadingConfigChanged" @click="clickSaveConfig">SAVE CONFIG</v-btn>
<v-btn color="error" v-if="isConnected" :loading="loadingEmergencyStop" @click="clickEmergencyStop">Emergency Stop</v-btn>
<v-btn color="error" class="button-min-width-auto px-3" v-if="isConnected" :loading="loadingEmergencyStop" @click="clickEmergencyStop"><v-icon class="mr-sm-2">mdi-alert-circle-outline</v-icon><span class="d-none d-sm-flex">Emergency Stop</span></v-btn>
<v-menu
bottom
left
:offset-y="true"
>
<template v-slot:activator="{ on, attrs }">
<v-btn
dark
icon
v-bind="attrs"
v-on="on"
>
<v-icon>mdi-dots-vertical</v-icon>
</v-btn>
</template>
<v-list dense>
<v-list-item link @click="doRestart()">
<v-list-item-title><v-icon class="mr-3">mdi-sync</v-icon>Restart</v-list-item-title>
</v-list-item>
<v-list-item link @click="doFirmwareRestart()">
<v-list-item-title><v-icon class="mr-3">mdi-sync</v-icon>FW Restart</v-list-item-title>
</v-list-item>
<v-list-item link @click="doHostReboot()">
<v-list-item-title><v-icon class="mr-3">mdi-power</v-icon>Reboot Host</v-list-item-title>
</v-list-item>
<v-list-item link @click="doHostShutdown()">
<v-list-item-title><v-icon class="mr-3">mdi-power</v-icon>Shutdown Host</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</v-app-bar>
<v-main id="content">
@@ -141,6 +176,20 @@ export default {
this.$store.commit('setLoading', { name: 'btnSaveConfig' });
this.$socket.sendObj('printer.gcode.script', { script: "SAVE_CONFIG" });
},
doRestart: function() {
this.$store.commit('addGcodeResponse', "RESTART");
this.$socket.sendObj('printer.gcode.script', { script: "RESTART" });
},
doFirmwareRestart: function() {
this.$store.commit('addGcodeResponse', "FIRMWARE_RESTART");
this.$socket.sendObj('printer.gcode.script', { script: "FIRMWARE_RESTART" });
},
doHostReboot: function() {
this.$socket.sendObj('machine.reboot', { });
},
doHostShutdown: function() {
this.$socket.sendObj('machine.shutdown', { });
},
drawFavicon(val) {
let favicon16 = document.querySelector("link[rel*='icon'][sizes='16x16']");
let favicon32 = document.querySelector("link[rel*='icon'][sizes='32x32']");
+32 -35
View File
@@ -11,22 +11,38 @@
<template>
<v-card>
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>mdi-information-variant</v-icon></v-list-item-avatar>
<v-progress-circular
:rotate="-90"
:size="50"
:width="7"
:value="printProgress * 100"
color="red"
class="mr-5 mt-2"
v-if="['printing', 'paused', 'error'].includes(printer_state)"
>
</v-progress-circular>
<v-list-item-avatar color="grey" v-if="!['printing', 'paused', 'error'].includes(printer_state)"><v-icon dark>mdi-information-variant</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">Status</v-list-item-title>
<v-list-item-subtitle class="mr-3">{{ printer_state !== "" ? printer_state.charAt(0).toUpperCase() + printer_state.slice(1) : "Unknown" }}{{ ['printing', 'paused', 'complete', 'error'].includes(printer_state) ? " - "+current_file : "" }}</v-list-item-subtitle>
<v-list-item-title class="headline">{{ ['printing', 'paused', 'error'].includes(printer_state) ? Math.round(printProgress * 100)+"% - " : "" }}{{ display_message ? display_message : (printer_state !== "" ? printer_state.charAt(0).toUpperCase() + printer_state.slice(1) : "Unknown") }}</v-list-item-title>
<v-list-item-subtitle class="mr-3" v-if="['printing', 'paused', 'complete', 'error'].includes(printer_state)">{{ "File: "+current_file }}</v-list-item-subtitle>
</v-list-item-content>
<v-btn class="orange" v-if="printer_state === 'printing'" @click="btnPauseJob" :loading="loadingStatusPause">pause job</v-btn>
<v-btn class="red" v-if="(printer_state === 'paused')" :loading="loadingStatusCancel" @click="btnCancelJob">cancel job</v-btn>
<v-btn class="orange ml-2" v-if="(printer_state === 'paused')" :loading="loadingStatusResume" @click="btnResumeJob">resume job</v-btn>
<v-btn class="orange ml-2" v-if="(printer_state === 'error')" :loading="loadingStatusClear" @click="btnClearJob">clear job</v-btn>
<v-btn class="primary ml-2" v-if="(printer_state === 'complete')" :loading="loadingStatusReprint" @click="btnReprintJob">reprint job</v-btn>
<v-btn-toggle
color="primary"
dense
multiple
>
<v-btn class="button-min-width-auto orange px-2" v-if="printer_state === 'printing'" @click="btnPauseJob" :loading="loadingStatusPause" title="Pause print"><v-icon>mdi-pause</v-icon></v-btn>
<v-btn class="button-min-width-auto red" v-if="(printer_state === 'paused')" :loading="loadingStatusCancel" @click="btnCancelJob" title="Cancel print"><v-icon>mdi-stop</v-icon></v-btn>
<v-btn class="button-min-width-auto orange" v-if="(printer_state === 'paused')" :loading="loadingStatusResume" @click="btnResumeJob" title="Resume job"><v-icon>mdi-play</v-icon></v-btn>
<v-btn class="button-min-width-auto orange" v-if="(printer_state === 'error')" :loading="loadingStatusClear" @click="btnClearJob" title="Clear job"><v-icon>mdi-close</v-icon></v-btn>
<v-btn class="button-min-width-auto primary" v-if="(printer_state === 'complete')" :loading="loadingStatusReprint" @click="btnReprintJob" title="Reprint job"><v-icon>mdi-autorenew</v-icon></v-btn>
</v-btn-toggle>
</v-list-item>
<v-divider class="my-2" ></v-divider>
<v-card-text class="px-0 pt-0 pb-2 content">
<v-row>
<v-col
class="col-12 pv-0 col-sm-4 pr-sm-0"
class="col-12 col-sm-4 pl-sm-5 pr-sm-2"
v-if="
['printing', 'paused', 'complete'].includes(printer_state) &&
current_file_metadata &&
@@ -45,18 +61,11 @@
current_file_metadata &&
current_file_metadata.thumbnails &&
current_file_metadata.thumbnails.length &&
current_file_metadata.thumbnails.find(element => element.width === 400)) ? 'col-12 pv-0 col-sm-8 pl-sm-0' : 'col-12 pv-0'
current_file_metadata.thumbnails.find(element => element.width === 400)) ? 'col-12 py-0 col-sm-8 pl-sm-0' : 'col-12 py-0'
">
<v-layout wrap class=" text-center" v-if="display_message">
<v-flex col tag="strong" class="category-header">Message</v-flex>
<v-flex grow class="equal-width text-left vertical_align_center">
<v-flex tag="span">{{ display_message }}</v-flex>
</v-flex>
</v-layout>
<v-divider class="my-2" v-if="display_message" ></v-divider>
<v-layout wrap class=" text-center">
<v-flex col tag="strong" class="category-header">
Position
<v-flex col tag="strong" class="category-header col-auto">
<v-icon>mdi-axis-arrow</v-icon>
</v-flex>
<v-flex grow class="equal-width">
<v-layout column>
@@ -79,8 +88,8 @@
</v-layout>
<v-divider class="my-2" v-if="['printing', 'paused', 'complete', 'error'].includes(printer_state)"></v-divider>
<v-layout wrap class=" text-center" v-if="['printing', 'paused', 'complete', 'error'].includes(printer_state)">
<v-flex col tag="strong" class="category-header">
Print Status
<v-flex col tag="strong" class="category-header col-auto">
<v-icon>mdi-poll</v-icon>
</v-flex>
<v-flex grow class="equal-width">
<v-layout column>
@@ -103,8 +112,8 @@
</v-layout>
<v-divider class="my-2" v-if="['printing', 'paused', 'error'].includes(printer_state)"></v-divider>
<v-layout wrap class=" text-center" v-if="['printing', 'paused', 'error'].includes(printer_state)">
<v-flex col tag="strong" class="category-header py-0">
Estimations<br />based on
<v-flex col tag="strong" class="category-header col-auto">
<v-icon>mdi-clock-outline</v-icon>
</v-flex>
<v-flex grow class="equal-width">
<v-layout column>
@@ -125,18 +134,6 @@
</v-layout>
</v-flex>
</v-layout>
<v-layout wrap class=" text-center" v-if="['printing', 'paused', 'error'].includes(printer_state)">
<v-layout column class="mt-2" >
<v-progress-linear
:value="printProgress * 100"
height="25"
>
<template>
<strong>{{ Math.ceil(printProgress * 100) }}%</strong>
</template>
</v-progress-linear>
</v-layout>
</v-layout>
</v-col>
</v-row>
</v-card-text>
+7
View File
@@ -20,6 +20,13 @@ Vue.use(Vuetify,{
});
export default new Vuetify({
theme: {
themes: {
dark: {
red: '#f7240a'
}
}
},
icons: {
iconfont: 'mdi',
},