refactor: add farm printer selection and menu to new top and sidebar, added icons to version-tooltip

Signed-off-by: steadyjaw <martin.keilaus@gmail.com>
This commit is contained in:
steadyjaw committed 2021-11-09 20:12:15 +01:00
1 parent 413e6429fa
commit 46bb749374
4 files changed
+214 -7

No files matched your search

+113
View File
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="100%"
height="100%"
viewBox="0 0 768 624"
version="1.1"
xml:space="preserve"
style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;"
id="svg40"
sodipodi:docname="klipper.svg"
inkscape:version="0.92.4 (unknown)"
inkscape:export-filename="/home/kevin/src/reprap/firmware/klipper/logs/logo-20190416/klipper6.svg.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"><metadata
id="metadata46"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
id="defs44">
</defs><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1030"
id="namedview42"
showgrid="false"
inkscape:zoom="0.95"
inkscape:cx="327.89418"
inkscape:cy="289.76441"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg40"
showguides="false"
showborder="false"><inkscape:grid
type="xygrid"
id="grid905" /></sodipodi:namedview>
<path
style="fill:#3c4b5a"
d="m 30,34 v 140 l 260,255 115,-5 h 80 L 730,174 V 34 H 720 L 385,374 40,34 Z"
id="path2"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccccc" /><path
style="fill:#3c4b5a;stroke-width:1.03280997"
d="m 140,418 -58,57 1,25 v 19 l 57,57 h 27 v -1 L 91,496.5 167,419 v -1 z"
id="path8"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccccc" /><g
transform="translate(-1.08348e-4,0.048)"
id="g17">
<path
d="m 83.041215,464.92108 h 0.001 l -0.04211,27.03092 h 11 l 73.000005,-74 v 14.301 l -63,64.199 63,65.5 v 14 l -73.000002,-75 h -13 c -2,0 -4,-2 -4,-4 h -2 v -33 h 2 c 0,-1 1,-2 3.00004,-2 1.99996,0 2.99996,1 2.99996,2 z"
style="fill:#b12f35"
id="path15"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccccccccccccc" />
</g><g
id="path839"
transform="matrix(1.03281,0,0,1.0326797,24.31099,-21.921569)">
<rect
x="21"
y="426"
width="30.015202"
height="153"
style="fill:#3c4b5a;fill-rule:nonzero"
id="rect12" />
</g><rect
x="247"
y="469"
width="24"
height="107"
style="fill:#3c4b5a;stroke-width:1.19609642"
id="rect23" /><path
d="m 371.98888,521.45953 c 0,-10.8903 -2.45322,-19.36013 -7.36207,-25.4107 -4.90765,-6.05057 -12.80741,-9.07465 -23.69929,-9.07465 -2.28639,0 -4.6724,0.10081 -7.16044,0.30241 -2.48802,0.20161 -4.94125,0.63842 -7.36207,1.31044 v 60.29926 c 2.15197,1.47844 5.00967,2.85727 8.57188,4.13411 3.56342,1.27684 7.36208,1.91526 11.39597,1.91526 8.87554,0 15.36385,-3.02409 19.46496,-9.07465 4.10111,-6.05057 6.15106,-14.18439 6.15106,-24.40148 z M 397,521.05632 c 0,8.06663 -1.04178,15.46123 -3.12654,22.18261 -2.08476,6.72259 -5.07568,12.50434 -8.97515,17.34409 -3.89947,4.83973 -8.77472,8.60423 -14.62333,11.29351 -5.8498,2.68927 -12.47254,4.0333 -19.86702,4.0333 -4.97606,0 -9.54765,-0.60481 -13.71597,-1.81445 -4.16832,-1.21082 -7.59731,-2.55487 -10.28698,-4.03451 V 611 H 302 V 471.64736 c 4.97486,-1.34524 11.09352,-2.62207 18.35477,-3.83171 C 327.61602,466.60482 335.28055,466 343.34834,466 c 8.33664,0 15.79953,1.27684 22.38866,3.83171 6.58794,2.55487 12.20251,6.21857 16.84131,10.9911 4.6388,4.77253 8.20221,10.5543 10.69024,17.34408 2.48684,6.78859 3.73145,14.4184 3.73145,22.88943 z"
style="fill:#3c4b5a;fill-rule:nonzero;stroke-width:1.20011997"
id="path25"
inkscape:connector-curvature="0" /><path
d="m 492.9892,521.45953 c 0,-10.8903 -2.4544,-19.36013 -7.36198,-25.4107 -4.90759,-6.05057 -12.80725,-9.07465 -23.699,-9.07465 -2.28636,0 -4.67354,0.10081 -7.16034,0.30241 -2.488,0.20161 -4.94119,0.63842 -7.36197,1.31044 v 60.29926 c 2.15074,1.47844 5.00839,2.85727 8.57176,4.13411 3.56337,1.27684 7.36198,1.91526 11.39582,1.91526 8.87423,0 15.36246,-3.02409 19.46352,-9.07465 4.10106,-6.05057 6.15219,-14.18439 6.15219,-24.40148 z M 518,521.05632 c 0,8.06663 -1.04297,15.46123 -3.1265,22.18261 -2.08474,6.72259 -5.07681,12.50434 -8.97624,17.34409 -3.89942,4.83973 -8.77341,8.60423 -14.62314,11.29351 -5.84854,2.68927 -12.47119,4.0333 -19.86677,4.0333 -4.9748,0 -9.54633,-0.60481 -13.7146,-1.81445 -4.16827,-1.21082 -7.59722,-2.55487 -10.28684,-4.03451 V 611 H 423 V 471.64736 c 4.97599,-1.34524 11.09337,-2.62207 18.35454,-3.83171 C 448.61569,466.60482 456.28012,466 464.34782,466 c 8.33773,0 15.80052,1.27684 22.38838,3.83171 6.58905,2.55487 12.20235,6.21857 16.84229,10.9911 4.63875,4.77253 8.20211,10.5543 10.69012,17.34408 2.48679,6.78859 3.73139,14.4184 3.73139,22.88943 z"
style="fill:#3c4b5a;fill-rule:nonzero;stroke-width:1.20011246"
id="path27"
inkscape:connector-curvature="0" /><path
d="m 537,521.00591 c 0,-9.30123 1.37492,-17.45591 4.12595,-24.46521 2.74984,-7.00931 6.40632,-12.83838 10.96942,-17.48839 4.56191,-4.65121 9.79451,-8.15587 15.699,-10.51396 5.90328,-2.3593 11.94191,-3.53835 18.11469,-3.53835 14.49054,0 25.79531,4.51527 33.91308,13.5458 8.11897,9.03174 12.17786,22.51016 12.17786,40.43768 0,1.34749 -0.0335,2.8646 -0.1006,4.54896 -0.0671,1.68555 -0.16768,3.20147 -0.30182,4.55015 h -69.43942 c 0.67068,8.49155 3.65646,15.06171 8.95733,19.71294 5.29967,4.65001 12.98149,6.97562 23.04547,6.97562 5.9033,0 11.30477,-0.5402 16.20202,-1.61818 4.89726,-1.07799 8.75493,-2.22335 11.57304,-3.43729 l 3.22052,20.01612 c -1.34138,0.67495 -3.18699,1.38237 -5.53561,2.12349 -2.34742,0.74112 -5.03139,1.41485 -8.05071,2.02242 -3.01811,0.60637 -6.27217,1.11168 -9.76096,1.51592 -3.4888,0.40425 -7.04467,0.60637 -10.66761,0.60637 -9.25915,0 -17.30985,-1.38116 -24.15211,-4.14471 -6.84346,-2.76354 -12.47968,-6.60507 -16.90744,-11.52457 -4.42778,-4.91951 -7.71537,-10.7161 -9.86278,-17.38854 C 538.0731,536.27095 537,528.95845 537,521.00591 Z m 70.64548,-10.91821 c 0,-3.36991 -0.46948,-6.57138 -1.40846,-9.60442 -0.93897,-3.03303 -2.31508,-5.66063 -4.12595,-7.88517 -1.81207,-2.22335 -4.02535,-3.97627 -6.64226,-5.25638 -2.61689,-1.28131 -5.73561,-1.92137 -9.35855,-1.92137 -3.75708,0 -7.04466,0.70743 -9.86278,2.1235 -2.8181,1.41484 -5.19906,3.26883 -7.14527,5.55956 -1.94501,2.29192 -3.45526,4.92071 -4.52837,7.88516 -1.0731,2.96567 -1.81206,5.99871 -2.21447,9.09912 z"
style="fill:#3c4b5a;fill-rule:nonzero;stroke-width:1.20038378"
id="path29"
inkscape:connector-curvature="0" /><path
d="m 717.7869,492.26931 c -2.00567,-0.67394 -4.78138,-1.38159 -8.32593,-2.12292 -3.54453,-0.74135 -7.65736,-1.11202 -12.33845,-1.11202 -2.67542,0 -5.51799,0.26957 -8.52649,0.80874 -3.0097,0.53915 -5.11684,1.01091 -6.32025,1.41528 V 576 H 658 V 475.28104 c 4.68109,-1.75347 10.53216,-3.40464 17.55439,-4.95472 C 682.57663,468.77504 690.36771,468 698.92762,468 c 1.60574,0 3.47769,0.10109 5.61827,0.30328 2.13938,0.20218 4.27996,0.47176 6.42053,0.80873 2.13939,0.33697 4.2131,0.74255 6.21878,1.21431 2.00687,0.47176 3.6114,0.90983 4.8148,1.3142 z"
style="fill:#3c4b5a;fill-rule:nonzero;stroke-width:1.19865453"
id="path31"
inkscape:connector-curvature="0" /><path
sodipodi:nodetypes="cccccccccccccc"
d="M 259,424 H 360 V 359 L 30,34 H 90 L 385,324 670,34 h 60 L 410,359 v 84.99783 C 410,449 405,454 400,454 H 259 c -12,0 -14,-10 -14,-15 0,-5 2,-15 14,-15 z"
style="fill:#b12f35"
id="path35"
inkscape:connector-curvature="0" />
<rect
id="rect12-6"
style="clip-rule:evenodd;fill:#3c4b5a;fill-rule:nonzero;stroke-width:1.03280997;stroke-linejoin:round;stroke-miterlimit:1.41420996"
height="158"
width="24"
y="418"
x="191" /></svg>

After

Width:  |  Height:  |  Size: 8.0 KiB

+24 -2
View File
@@ -24,7 +24,7 @@
<template>
<v-navigation-drawer v-model="naviDrawer" :src="sidebarBackground" :mini-variant="!boolWideNavDrawer" :key="boolWideNavDrawer ? 'wide' : 'mini'" width="200px" app>
<v-list-item class="pa-0 justify-center no-text-decoration no-background small-list-item" style="height:48px;" router to="/" :ripple="false">
<v-list-item class="pa-0 justify-center no-text-decoration no-background small-list-item" router to="/" :ripple="false">
<v-list-item-content tile>
<template v-if="sidebarLogo">
<img :src="sidebarLogo" style="height: 32px;" class="mr-3 nav-logo" alt="Logo" />
@@ -37,6 +37,21 @@
<v-divider></v-divider>
<v-list class="pr-0 pt-0 ml-0">
<v-list-item-group active-class="active-nav-item">
<template v-if="countPrinters">
<v-list-item
router to="/allPrinters"
class="small-list-item mt-1"
>
<v-list-item-icon>
<v-icon>mdi-view-dashboard-outline</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title tile>{{ $t("App.Printers")}}</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-divider class="my-1"></v-divider>
</template>
<div v-for="(category, index) in naviPoints" :key="index">
<v-list-item
router :to="category.path"
@@ -74,7 +89,10 @@
<template v-slot:activator="{ on, attrs }">
<v-icon v-bind="attrs" @mouseenter="on.mouseenter" @mouseleave="on.mouseleave">mdi-help-circle-outline</v-icon>
</template>
<span class="dark"><!-- Logos hier mit rein, damit man erkennt welche version für was steht :) -->v{{ mainsailVersion }}<br />{{ klipperVersion }}</span>
<span class="dark d-inline-block">
<img height="12" src="/img/logo.svg"> v{{ mainsailVersion }}<br />
<img height="12" src="/img/klipper.svg" style="transform: rotate(90deg);"> {{ klipperVersion }}
</span>
</v-tooltip>
</v-list-item-icon>
@@ -180,6 +198,10 @@ export default class TheSidebarAlt extends Mixins(BaseMixin) {
return this.$store.getters['server/updateManager/isUpdateAvailable']
}
get countPrinters() {
return this.$store.getters['farm/countPrinters']
}
showInNavi(route: AppRoute): boolean {
if (['shutdown', 'error', 'disconnected'].includes(this.klippy_state) && !route.alwaysShow) return false
+11 -5
View File
@@ -8,8 +8,8 @@
<div>
<v-app-bar app elevate-on-scroll height="48px">
<v-app-bar-nav-icon @click.stop="naviDrawer = !naviDrawer"></v-app-bar-nav-icon>
<v-app-bar-title v-if="!isBigDrawer" class="text-no-wrap">{{ printerName }}</v-app-bar-title>
<!-- printer Farm Button goes here -->
<v-toolbar-title class="text-no-wrap mr-2">{{ printerName }}</v-toolbar-title>
<printer-selector v-if="countPrinters"></printer-selector>
<v-spacer></v-spacer>
<the-throttled-states></the-throttled-states>
<input type="file" ref="fileUploadAndStart" :accept="validGcodeExtensions.join(', ')" style="display: none" @change="uploadAndStart" />
@@ -98,6 +98,7 @@ import TheTopCornerMenu from '@/components/TheTopCornerMenu.vue'
import TheSettingsMenu from '@/components/TheSettingsMenu.vue'
import TheThrottledStates from '@/components/TheThrottledStates.vue'
import Panel from '@/components/ui/Panel.vue'
import PrinterSelector from '@/components/ui/PrinterSelector.vue'
type uploadSnackbar = {
status: boolean
@@ -117,7 +118,8 @@ type uploadSnackbar = {
Panel,
TheThrottledStates,
TheSettingsMenu,
TheTopCornerMenu
TheTopCornerMenu,
PrinterSelector
}
})
export default class TheTopbar extends Mixins(BaseMixin) {
@@ -169,8 +171,12 @@ export default class TheTopbar extends Mixins(BaseMixin) {
return this.$store.state.printer.hostname
}
get isBigDrawer():boolean {
return false
get boolWideNavDrawer() {
return this.$store.state.gui.dashboard.boolWideNavDrawer ?? false
}
get countPrinters() {
return this.$store.getters['farm/countPrinters']
}
btnEmergencyStop() {
+66
View File
@@ -0,0 +1,66 @@
<style scoped>
</style>
<template>
<v-menu bottom :offset-x="true">
<template v-slot:activator="{ on, attrs }">
<v-icon class="nav-arrow right" v-bind="attrs" v-on="on" >mdi-chevron-down</v-icon>
</template>
<v-list dense>
<v-list-item two-line v-for="printer in printers" v-bind:key="printer._namespace" @click="changePrinter(printer)" :disabled="!printer.socket.isConnected" link>
<v-list-item-content>
<v-list-item-title>{{ getPrinterName(printer._namespace) }}</v-list-item-title>
<v-list-item-subtitle>{{ getPrinterDescription(printer)}}</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
</v-list>
</v-menu>
</template>
<script lang="ts">
import {Component, Mixins} from 'vue-property-decorator'
import BaseMixin from '../mixins/base'
import router from '@/plugins/router'
import {FarmPrinterState} from '@/store/farm/printer/types'
@Component
export default class PrinterSelector extends Mixins(BaseMixin) {
get displayMenuPoint() {
return (this.remoteMode && this.countPrinters > 1) || (!this.remoteMode && this.countPrinters)
}
get printers() {
return this.$store.getters['farm/getPrinters']
}
get countPrinters() {
return this.$store.getters['farm/countPrinters']
}
get currentPage() {
return this.$route.fullPath
}
switchToPrinters() {
router.push('/allPrinters')
}
getPrinterName(namespace: string) {
return this.$store.getters['farm/'+namespace+'/getPrinterName']
}
getPrinterDescription(printer: FarmPrinterState) {
return this.$store.getters['farm/'+printer._namespace+'/getStatus']
}
changePrinter(printer: FarmPrinterState) {
if (printer.socket.isConnected) {
this.$store.dispatch('changePrinter', { printer: printer._namespace })
}
}
}
</script>