Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b0044f3d2b | ||
|
|
e2e496c31e | ||
|
|
8363932ae9 | ||
|
|
f958027671 | ||
|
|
4b678468ab | ||
|
|
9090c60038 | ||
|
|
35955d4899 | ||
|
|
4a58f0c3e2 | ||
|
|
4003166000 | ||
|
|
9888d796bd | ||
|
|
8a8587786a | ||
|
|
64c6790d3a | ||
|
|
28998090e6 | ||
|
|
87e1ccb384 | ||
|
|
e5469b47ca | ||
|
|
a72af00c0a | ||
|
|
576f3ee4fa | ||
|
|
2ee53b26bb | ||
|
|
414a05bf7b | ||
|
|
bb83dcda11 | ||
|
|
4f34b63fc0 | ||
|
|
ae058ca2d0 | ||
|
|
53e394eddd | ||
|
|
25221ca6cb | ||
|
|
e7999d5577 | ||
|
|
9545fc76bb | ||
|
|
3e0607fc9b | ||
|
|
f6eb37928b | ||
|
|
e16694eae8 | ||
|
|
d786d88348 | ||
|
|
bce06f0e1b | ||
|
|
294f48124f | ||
|
|
cc77c47d54 | ||
|
|
6a0f19926e | ||
|
|
45198d7d93 | ||
|
|
54c78e2735 | ||
|
|
659504f77e | ||
|
|
e81ba35909 | ||
|
|
feb9579ae1 | ||
|
|
35013e755c | ||
|
|
4b5f03b886 | ||
|
|
7dc16da940 | ||
|
|
08bd7440a9 | ||
|
|
2e0ba91e50 | ||
|
|
ca79e3b63e | ||
|
|
9429e11645 | ||
|
|
7b90c32b96 | ||
|
|
f2809d304c | ||
|
|
1d86c22126 | ||
|
|
d767f50bbb | ||
|
|
a6c4dd75f1 | ||
|
|
bd44c5608a | ||
|
|
97012256f6 | ||
|
|
5ee8e69d81 | ||
|
|
d05fa70832 | ||
|
|
edf1507359 | ||
|
|
bb831cd22f | ||
|
|
423d2eaa88 | ||
|
|
92679b001a | ||
|
|
21c01b0de7 | ||
|
|
0ae1b32a56 | ||
|
|
7cda0f7058 | ||
|
|
fe246393ea | ||
|
|
a512743038 | ||
|
|
645084700d | ||
|
|
b784b3f277 | ||
|
|
c5999221bc | ||
|
|
d1cb7f2def | ||
|
|
6927ce6038 | ||
|
|
4579129a4f | ||
|
|
5fd89c2600 | ||
|
|
354f6e9250 | ||
|
|
9e6e8c1290 | ||
|
|
7164dd7c3c | ||
|
|
b38b052004 | ||
|
|
ff366ee966 | ||
|
|
dc1a7dfe03 | ||
|
|
d2d5d3da0c | ||
|
|
03322739d5 | ||
|
|
31b4d4cb3d | ||
|
|
d2d8546bc9 | ||
|
|
93c952cabb | ||
|
|
02f9f9a1d4 | ||
|
|
e3607c8f3d | ||
|
|
2b08e34ba7 | ||
|
|
747722ec2c | ||
|
|
0befcea658 | ||
|
|
ff3cf167ad | ||
|
|
c8cff6d3d8 | ||
|
|
397d9b8a7c | ||
|
|
84f2b6a473 | ||
|
|
b6d20f20ee | ||
|
|
13859d3832 | ||
|
|
b88ebf38c7 | ||
|
|
5831e43fba | ||
|
|
21669f11f7 | ||
|
|
7b20b47d21 | ||
|
|
8d15e59e35 | ||
|
|
8ee93d1c4a | ||
|
|
0b23e512e6 | ||
|
|
7ff060edff | ||
|
|
0bfc856606 | ||
|
|
3c78c5af58 | ||
|
|
efbbbb0142 | ||
|
|
d57f68b511 | ||
|
|
64f473e0c6 | ||
|
|
a2863f2141 | ||
|
|
ef3b179339 | ||
|
|
2bceb2b24f | ||
|
|
aaf934eaae | ||
|
|
e44e3bc540 | ||
|
|
6856c9a99f | ||
|
|
d74e38d0ba | ||
|
|
4ec5ab0f53 | ||
|
|
8226c32bb3 | ||
|
|
99f963df26 | ||
|
|
07072ce2a1 | ||
|
|
983c5c9bda | ||
|
|
a8ea45d53c | ||
|
|
595e5bb4a0 | ||
|
|
2e7290210f | ||
|
|
9152934f9d | ||
|
|
02eab15fe5 | ||
|
|
8d12bac8c8 |
No files matched your search
@@ -6,6 +6,8 @@ Mainsail is a lightweight & responsive web interface for the [Klipper](https://g
|
||||
|
||||
To begin using Mainsail start by [installing](https://meteyou.github.io/mainsail/setup/) it or read the [pages](https://meteyou.github.io/mainsail/) for more informations.
|
||||
|
||||
For support join our discord server -> [https://discord.gg/skWTwTD](https://discord.gg/skWTwTD)
|
||||
|
||||
## Credit, sources and inspiration
|
||||
* [Kevin O'Connor](https://github.com/KevinOConnor) for the awesome 3D printer firmware [Klipper](https://github.com/KevinOConnor/klipper)
|
||||
* [Eric Callahan (arksine)](https://github.com/Arksine) for [Moonraker (Klipper API)](https://github.com/Arksine/moonraker). Without Moonraker, Mainsail would not be possible.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
docs.mainsail.xyz
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
layout: default
|
||||
title: Additional Support
|
||||
nav_order: 5
|
||||
nav_order: 7
|
||||
has_children: true
|
||||
permalink: /additional
|
||||
---
|
||||
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 180 KiB |
|
After Width: | Height: | Size: 43 KiB |
@@ -0,0 +1,16 @@
|
||||
---
|
||||
layout: default
|
||||
title: Custom CSS
|
||||
parent: Customizing
|
||||
nav_order: 99
|
||||
permalink: /customizing/custom-css
|
||||
---
|
||||
|
||||
## Custom-CSS
|
||||
|
||||
The custom.css file allows you to customize the appearance of Mainsail
|
||||
without the need of rebuilding it. All you need to do is to place a file
|
||||
named "custom.css" into the configuration directory ".theme" and define
|
||||
your css rules in there.
|
||||
|
||||

|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
layout: default
|
||||
title: Favicons
|
||||
parent: Customizing
|
||||
nav_order: 3
|
||||
permalink: /customizing/favicons
|
||||
---
|
||||
|
||||
## Custom favicon
|
||||
Upload the images with the name "favicon-16x16.png" and "favicon-32x32.png"
|
||||
to the .theme folder. Allowed extension is only .png. The "favicon-32x32.png"
|
||||
is required. The "favicon-16x16.png" is optional. Maybe a hard refresh is
|
||||
necessary (CTRL+SHIFT+F5 on windows or CMD+SHIFT+R on mac).
|
||||
|
||||

|
||||
@@ -0,0 +1,22 @@
|
||||
---
|
||||
layout: default
|
||||
title: Customizing
|
||||
nav_order: 6
|
||||
has_children: true
|
||||
permalink: /customizing
|
||||
---
|
||||
|
||||
# Customizing
|
||||
|
||||
Feel free to customize Mainsail to your preferences. At the moment there
|
||||
are not many possibilities, but i will expand them continuously. If some features
|
||||
are not yet listed below, please create a FR (feature request) on Github.
|
||||
|
||||
### currently supported functions
|
||||
- [change sidebar logo](sidebar.md)
|
||||
- [change sidebar background](sidebar.md)
|
||||
- [change favicon](favicon.md)
|
||||
- [upload custom.css](custom-css.md)
|
||||
|
||||
### cooming soon
|
||||
- change primary color (all blue buttons atm)
|
||||
@@ -0,0 +1,16 @@
|
||||
---
|
||||
layout: default
|
||||
title: Prepare
|
||||
parent: Customizing
|
||||
nav_order: 1
|
||||
permalink: /customizing/prepare
|
||||
---
|
||||
|
||||
## Prepare theme
|
||||
|
||||
To prepare mainsail to use themes, you only have to create the ".theme" directory. Go into
|
||||
"Settings" > "Machine" and check if you have enabled "Hidden files". Then you can create a
|
||||
directory with the name ".theme". Important is the "." on the beginning. All further customizing
|
||||
files, will be placed in this directory.
|
||||
|
||||

|
||||
@@ -0,0 +1,22 @@
|
||||
---
|
||||
layout: default
|
||||
title: Sidebar
|
||||
parent: Customizing
|
||||
nav_order: 2
|
||||
permalink: /customizing/sidebar
|
||||
---
|
||||
|
||||
## Sidebar customizing
|
||||
|
||||
### Change sidebar logo
|
||||
Upload an image with the name "sidebar-logo" to the .theme folder.
|
||||
Allowed file extensions for the image are: .svg, .jpg, .png and .gif.
|
||||
|
||||

|
||||
|
||||
### Change sidebar background image
|
||||
Upload an image with the name "sidebar-background" to the .theme folder.
|
||||
Allowed file extensions for the image are: .jpg, .png and .gif. The
|
||||
recommended image size is 300x1000px.
|
||||
|
||||

|
||||
@@ -11,5 +11,7 @@ Mainsail is a lightweight & responsive web interface for the Klipper 3D printer
|
||||
|
||||
[Setup Guide](/setup-guide/index.md){: .btn}
|
||||
|
||||
For support join our discord server -> [https://discord.gg/skWTwTD](https://discord.gg/skWTwTD)
|
||||
|
||||
## Screenshots
|
||||

|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
layout: default
|
||||
title: Necessary Configuration
|
||||
nav_order: 4
|
||||
nav_order: 5
|
||||
has_children: false
|
||||
permalink: /necessary-configuration
|
||||
---
|
||||
@@ -13,7 +13,7 @@ Mainsail requires a minimum configuration to function properly. It should give y
|
||||
This allows gcode file uploads.
|
||||
```yaml
|
||||
[virtual_sdcard]
|
||||
path: ~/sdcard
|
||||
path: ~/gcode_files
|
||||
```
|
||||
|
||||
### display_status
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
layout: default
|
||||
title: Remote Mode
|
||||
nav_order: 4
|
||||
has_children: false
|
||||
permalink: /remotemode
|
||||
---
|
||||
|
||||
## Remote Mode
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
---
|
||||
layout: default
|
||||
title: Setup Guide
|
||||
title: Setup Guides
|
||||
nav_order: 2
|
||||
has_children: true
|
||||
permalink: /setup/
|
||||
has_toc: false
|
||||
---
|
||||
This is a guide to setting up Klipper, Moonraker & Mainsail on a Raspberry Pi with Raspberry Pi OS. Other SBCs and/or Linux distributions might work, but may require a customized installation script or configs.
|
||||
# Setup Guides
|
||||
There are different ways to install Mainsail.
|
||||
|
||||
- [MainsailOS (recommend)](mainsail-os.md)
|
||||
- [Kiauh (Klipper Install And Update Helper)](kiauh.md)
|
||||
- [Manual Setup](manual-setup/index.md)
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
layout: default
|
||||
title: Kiauh Guide
|
||||
parent: Setup Guides
|
||||
nav_order: 2
|
||||
has_children: false
|
||||
permalink: /setup/kiauh
|
||||
---
|
||||
# Installing Mainsail with Kiauh
|
||||
|
||||
Kiauh is a tool that helps you install or upgrade Klipper, Moonraker, Mainsail and various
|
||||
other extensions easily and comfortably.
|
||||
|
||||
For more informations and get to the guide click [here](https://github.com/th33xitus/kiauh).
|
||||
@@ -0,0 +1,27 @@
|
||||
---
|
||||
layout: default
|
||||
title: MainsailOS Guide
|
||||
parent: Setup Guides
|
||||
nav_order: 1
|
||||
has_children: false
|
||||
permalink: /setup/mainsail-os
|
||||
---
|
||||
# Installing Mainsail with MainsailOS
|
||||
|
||||
The recommended way to install Mainsail on a Raspberry Pi is to use [MainsailOS](https://github.com/raymondh2/MainsailOS),
|
||||
a pre-packaged disk image. If you are building a custom configuration, you may need to skip
|
||||
these instructions and install Mainsail [manually](manual-setup/index.md).
|
||||
|
||||
1. Download the latest mainsailOS [Release](https://github.com/raymondh2/MainsailOS/releases)
|
||||
2. Unzip the .img file from your download.
|
||||
3. Use [BalenaEtcher](https://www.balena.io/etcher/) to write the .img on to an 8GB, or larger SDcard. *THIS WILL DESTROY ALL DATA ON YOUR CARD*.
|
||||
|
||||
_note: It is a good idea to use a premium SDcard from a reputable manufacturer such as Sandisk, Kingston or Samsung. Low end cards will often fail quickly when used in this application_
|
||||
|
||||
4. If you will be using wifi, edit the file `mainsailos-wpa-supplicant.txt` with your Wifi information. If you are having trouble seeing this file on the sdcard, try removing it and re-inserting it into your card reader.
|
||||
5. Make sure that your MCU(s) is connected to your pi, If you will be using wired networking, also make sure your ethernet cable is connected.
|
||||
5. Insert the SDcard into your Pi, and power on the Pi.
|
||||
6. Find your pi on the network, and ssh into it, (Using PuTTY on Windows or the terminal on MacOS)
|
||||
* If your network supports bonjour, the pi should show up as `mainsailos.local`
|
||||
* If your network automatically assigns DNS hostnames, it may simply show up as `mainsailos`
|
||||
* Failing these two options, you may need to check your router's DHCP server, and find out what IP address as been assigned to the device.
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
layout: default
|
||||
title: Manual Setup Guide
|
||||
parent: Setup Guides
|
||||
nav_order: 3
|
||||
has_children: true
|
||||
permalink: /setup/manual-setup
|
||||
---
|
||||
This is a guide to setting up Klipper, Moonraker & Mainsail on a Raspberry Pi with Raspberry Pi OS. Other SBCs and/or Linux distributions might work, but may require a customized installation script or configs.
|
||||
@@ -1,9 +1,10 @@
|
||||
---
|
||||
layout: default
|
||||
title: Klipper
|
||||
parent: Setup Guide
|
||||
parent: Manual Setup Guide
|
||||
grand_parent: Setup Guides
|
||||
nav_order: 3
|
||||
permalink: /setup/klipper
|
||||
permalink: /setup/manual-setup/klipper
|
||||
---
|
||||
|
||||
## Klipper
|
||||
@@ -38,14 +39,14 @@ You have to create the directories for your klipper configuration and the virtua
|
||||
|
||||
```bash
|
||||
mkdir ~/klipper_config
|
||||
mkdir ~/sdcard
|
||||
mkdir ~/gcode_files
|
||||
```
|
||||
|
||||
Move your printer.cfg to ~/klipper_config and check if the following entries are present in the config.
|
||||
```ini
|
||||
[virtual_sdcard]
|
||||
# for gcode upload
|
||||
path: ~/sdcard
|
||||
path: ~/gcode_files
|
||||
|
||||
[display_status]
|
||||
# for display messages in status panel
|
||||
@@ -55,7 +56,7 @@ path: ~/sdcard
|
||||
# Mainsail needs gcode macros for `PAUSE`, `RESUME` and `CANCEL_PRINT` to make the buttons work.
|
||||
```
|
||||
> ℹ️ **These entries are very important.**
|
||||
For the full functionality of mainsail, you should also define gcode macros for `PAUSE`, `RESUME` and `CANCEL_PRINT`. You'll find further information in [this](../necessary-cfg.md){: target="_blank"} document.
|
||||
For the full functionality of mainsail, you should also define gcode macros for `PAUSE`, `RESUME` and `CANCEL_PRINT`. You'll find further information in [this](../../necessary-cfg.md){: target="_blank"} document.
|
||||
|
||||
After your config is in place, restart klipper with `sudo service klipper restart`. Check the `/tmp/klippy.log` for errors, if Klipper starts correctly you can continue the guide.
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
---
|
||||
layout: default
|
||||
title: Mainsail
|
||||
parent: Setup Guide
|
||||
parent: Manual Setup Guide
|
||||
grand_parent: Setup Guides
|
||||
nav_order: 5
|
||||
permalink: /setup/mainsail
|
||||
permalink: /setup/manual-setup/mainsail
|
||||
---
|
||||
|
||||
|
||||
@@ -31,15 +32,15 @@ Each file can be filled with the following content:
|
||||
# /etc/nginx/conf.d/upstreams.conf
|
||||
|
||||
upstream apiserver {
|
||||
#edit your api port here
|
||||
#if you need to change your api port, edit it here
|
||||
ip_hash;
|
||||
server 127.0.0.1:7125;
|
||||
}
|
||||
|
||||
upstream mjpgstreamer {
|
||||
#edit your webcam port here
|
||||
#if you need to change your webcam port, edit it here
|
||||
ip_hash;
|
||||
server 127.0.0.1:8081;
|
||||
server 127.0.0.1:8080;
|
||||
}
|
||||
```
|
||||
Save the file with `CTRL+O` and close the editor with `CTRL+X`.
|
||||
@@ -85,35 +86,15 @@ server {
|
||||
index index.html;
|
||||
server_name _;
|
||||
|
||||
#max upload size for gcodes
|
||||
client_max_body_size 200M;
|
||||
#disable max upload size
|
||||
client_max_body_size 0;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location /printer {
|
||||
proxy_pass http://apiserver/printer;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Scheme $scheme;
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_pass http://apiserver/api;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Scheme $scheme;
|
||||
}
|
||||
|
||||
location /access {
|
||||
proxy_pass http://apiserver/access;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Scheme $scheme;
|
||||
|
||||
location = /index.html {
|
||||
add_header Cache-Control "no-store, no-cache, must-revalidate";
|
||||
}
|
||||
|
||||
location /websocket {
|
||||
@@ -127,16 +108,8 @@ server {
|
||||
proxy_read_timeout 86400;
|
||||
}
|
||||
|
||||
location /machine {
|
||||
proxy_pass http://apiserver/machine;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Scheme $scheme;
|
||||
}
|
||||
|
||||
location /server {
|
||||
proxy_pass http://apiserver/server;
|
||||
location ~ ^/(printer|api|access|machine|server)/ {
|
||||
proxy_pass http://apiserver$request_uri;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
@@ -159,7 +132,7 @@ sudo ln -s /etc/nginx/sites-available/mainsail /etc/nginx/sites-enabled/
|
||||
sudo service nginx restart
|
||||
```
|
||||
|
||||
Now you can check again the API if it works with the reverse proxy. Open the url http://<printer-ip>/printer/info in your browser. if you see a content like this:
|
||||
Now you can check again the API if it works with the reverse proxy. Open the url http://\<printer-ip\>/printer/info in your browser. if you see a content like this:
|
||||
|
||||
```
|
||||
{"result": {"hostname": "voron250", "error_detected": false, "version": "v0.8.0-479-gd586fb06", "is_ready": true, "message": "Printer is ready", "cpu": "4 core ARMv7 Processor rev 4 (v7l)"}}
|
||||
@@ -182,7 +155,7 @@ Now it should be possible to open the interface: `http://<printer-ip>/`.
|
||||
|
||||
if you want to get the full experience with mainsail and klipper virtual_sdcard print, you should use these macros, or use them as templates for your own.
|
||||
|
||||
[Macro Link](../necessary-cfg.md){: .btn target="_blank"}
|
||||
[Macro Link](../../necessary-cfg.md){: .btn target="_blank"}
|
||||
|
||||
|
||||
### Change the Hostname (optional)
|
||||
@@ -195,7 +168,7 @@ and you can config your hostname:
|
||||
|
||||
`sudo raspi-config`
|
||||
|
||||
in 2 Network Options > N1 Hostname you can edit your hostname of your raspberry pi. After a reboot you can use http://<hostname>.local/ to open the webinterface.
|
||||
in 2 Network Options > N1 Hostname you can edit your hostname of your raspberry pi. After a reboot you can use http://\<hostname\>.local/ to open the webinterface.
|
||||
|
||||
|
||||
---
|
||||
@@ -1,9 +1,10 @@
|
||||
---
|
||||
layout: default
|
||||
title: Moonraker
|
||||
parent: Setup Guide
|
||||
parent: Manual Setup Guide
|
||||
grand_parent: Setup Guides
|
||||
nav_order: 4
|
||||
permalink: /setup/moonraker
|
||||
permalink: /setup/manual-setup/moonraker
|
||||
---
|
||||
## Moonraker
|
||||
Moonraker is a web server that exposes APIs which lets Mainsail interact with Klipper.
|
||||
@@ -21,9 +22,6 @@ cd ~/moonraker/scripts
|
||||
./install-moonraker.sh -c /home/pi/klipper_config/moonraker.conf
|
||||
```
|
||||
|
||||
Once the script is finished, both Moonraker and Klipper should be started.
|
||||
In `/tmp/klippy.log` the following entry should appear: `Moonraker: server connection detected`
|
||||
|
||||
### Configuration
|
||||
> ⚠️ **Please pay attention to the following steps!**
|
||||
Misconfigured trusted_clients are a very common source of failure.
|
||||
@@ -47,6 +45,7 @@ config_path: ~/klipper_config
|
||||
enabled: true
|
||||
trusted_clients:
|
||||
192.168.1.0/24
|
||||
2a02:810d:9340:33f6::/64
|
||||
|
||||
[update_manager]
|
||||
client_repo: meteyou/mainsail
|
||||
@@ -1,9 +1,10 @@
|
||||
---
|
||||
layout: default
|
||||
title: Operating System
|
||||
parent: Setup Guide
|
||||
parent: Manual Setup Guide
|
||||
grand_parent: Setup Guides
|
||||
nav_order: 2
|
||||
permalink: /setup/operating-systen
|
||||
permalink: /setup/manual-setup/operating-systen
|
||||
---
|
||||
## Operation System
|
||||
> ⚠️ **Please don't use an OctoPi image!**
|
||||
@@ -1,43 +1,46 @@
|
||||
{
|
||||
"name": "mainsail",
|
||||
"version": "0.4.0",
|
||||
"version": "1.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build",
|
||||
"lint": "vue-cli-service lint"
|
||||
"build": "vue-cli-service build && npm run build.zip",
|
||||
"lint": "vue-cli-service lint",
|
||||
"build.zip": "cd ./dist && zip -r mainsail.zip ./ && cd .."
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.21.0",
|
||||
"core-js": "^3.7.0",
|
||||
"axios": "^0.21.1",
|
||||
"core-js": "^3.8.2",
|
||||
"object-assign-deep": "^0.4.0",
|
||||
"prismjs": "^1.22.0",
|
||||
"prismjs": "^1.23.0",
|
||||
"vue": "^2.6.12",
|
||||
"vue-context": "^6.0.0",
|
||||
"vue-github-api": "^0.1.7",
|
||||
"vue-headful": "^2.1.0",
|
||||
"vue-plotly": "^1.1.0",
|
||||
"vue-prism-editor": "^1.2.2",
|
||||
"vue-resource": "^1.5.1",
|
||||
"vue-simple-upload": "^0.1.6",
|
||||
"vue-toast-notification": "^0.6.0",
|
||||
"vuetify": "^2.3.18",
|
||||
"vuex": "^3.5.1"
|
||||
"vuetify": "^2.4.2",
|
||||
"vuex": "^3.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@mdi/font": "^5.8.55",
|
||||
"@vue/cli-plugin-babel": "^4.5.9",
|
||||
"@vue/cli-plugin-babel": "^4.5.10",
|
||||
"@vue/cli-plugin-eslint": "^4.5.3",
|
||||
"@vue/cli-plugin-pwa": "^4.5.9",
|
||||
"@vue/cli-service": "^4.5.9",
|
||||
"@vue/cli-plugin-pwa": "^4.5.10",
|
||||
"@vue/cli-service": "^4.5.10",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"css-loader": "^5.0.1",
|
||||
"eslint": "^7.13.0",
|
||||
"eslint-plugin-vue": "^7.1.0",
|
||||
"sass": "^1.29.0",
|
||||
"sass-loader": "^10.1.0",
|
||||
"eslint": "^7.17.0",
|
||||
"eslint-plugin-vue": "^7.4.1",
|
||||
"generate-file-webpack-plugin": "^1.0.1",
|
||||
"sass": "^1.32.4",
|
||||
"sass-loader": "^10.1.1",
|
||||
"sw-precache-webpack-plugin": "^1.0.0",
|
||||
"vue-cli-plugin-route": "0.0.7",
|
||||
"vue-cli-plugin-vuetify": "^2.0.7",
|
||||
"vue-cli-plugin-vuetify": "^2.0.9",
|
||||
"vue-router": "^3.4.9",
|
||||
"vue-template-compiler": "^2.6.12",
|
||||
"vuetify-loader": "^1.6.0"
|
||||
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@@ -25,10 +25,11 @@
|
||||
:src="sidebarBackground"
|
||||
>
|
||||
<div id="nav-header">
|
||||
<img :src="require('./assets/logo.svg')" />
|
||||
<img :src="sidebarLogo" />
|
||||
<v-toolbar-title>{{ printername !== "" ? printername : hostname }}</v-toolbar-title>
|
||||
</div>
|
||||
<ul class="navi" :expand="$vuetify.breakpoint.mdAndUp">
|
||||
<printer-selecter></printer-selecter>
|
||||
<li v-for="(category, index) in routes" :key="index" :prepend-icon="category.icon"
|
||||
:class="[category.path !== '/' && currentPage.includes(category.path) ? 'active' : '', 'nav-item']"
|
||||
:value="true"
|
||||
@@ -44,7 +45,15 @@
|
||||
)
|
||||
">
|
||||
<v-icon>mdi-{{ category.icon }}</v-icon>
|
||||
<span class="nav-title">{{ category.title }}</span>
|
||||
<v-badge
|
||||
dot
|
||||
color="warning"
|
||||
style="top: -9px; left: -16px;"
|
||||
v-if="category.title === 'Settings' && isUpdateAvailable"
|
||||
></v-badge>
|
||||
<span class="nav-title">
|
||||
{{ category.title }}
|
||||
</span>
|
||||
<v-icon class="nav-arrow" v-if="category.children && category.children.length > 0">mdi-chevron-down</v-icon>
|
||||
</router-link>
|
||||
|
||||
@@ -66,14 +75,16 @@
|
||||
<v-app-bar app elevate-on-scroll>
|
||||
<v-app-bar-nav-icon @click.stop="drawer = !drawer"></v-app-bar-nav-icon>
|
||||
<v-spacer></v-spacer>
|
||||
<input type="file" ref="fileUploadAndStart" accept=".gcode, .ufp" style="display: none" @change="uploadAndStart" />
|
||||
<v-btn color="primary" class="mr-5 d-none d-sm-flex" v-if="isConnected && save_config_pending" :disabled="['printing', 'paused'].includes(printer_state)" :loading="loadings.includes['topbarSaveConfig']" @click="clickSaveConfig">SAVE CONFIG</v-btn>
|
||||
<v-btn color="primary" class="mr-5 d-none d-sm-flex" v-if="isConnected && ['standby', 'complete'].includes(printer_state)" :loading="loadings.includes['btnUploadAndStart']" @click="btnUploadAndStart"><v-icon class="mr-2">mdi-file-upload</v-icon>Upload & Print</v-btn>
|
||||
<v-btn color="error" class="button-min-width-auto px-3" v-if="isConnected" :loading="loadings.includes['topbarEmergencyStop']" @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>
|
||||
<top-corner-menu></top-corner-menu>
|
||||
</v-app-bar>
|
||||
|
||||
<v-main id="content">
|
||||
<v-scroll-y-transition>
|
||||
<v-container fluid id="page-container" class="container px-sm-6 px-3 mx-auto">
|
||||
<v-container fluid id="page-container" class="container px-3 px-sm-6 py-sm-6 mx-auto">
|
||||
<keep-alive>
|
||||
<router-view></router-view>
|
||||
</keep-alive>
|
||||
@@ -81,44 +92,75 @@
|
||||
</v-scroll-y-transition>
|
||||
</v-main>
|
||||
|
||||
<v-dialog v-model="overlayDisconnect" persistent width="300">
|
||||
<v-card color="primary" dark >
|
||||
<v-card-text class="pt-2">
|
||||
Connecting...
|
||||
<v-progress-linear indeterminate color="white" class="mb-0 mt-2"></v-progress-linear>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-snackbar
|
||||
:timeout="-1"
|
||||
:value="true"
|
||||
fixed
|
||||
right
|
||||
bottom
|
||||
dark
|
||||
v-model="uploadSnackbar.status"
|
||||
>
|
||||
<strong>Uploading {{ uploadSnackbar.filename }}</strong><br />
|
||||
{{ Math.round(uploadSnackbar.percent) }} % @ {{ formatFilesize(Math.round(uploadSnackbar.speed)) }}/s<br />
|
||||
<v-progress-linear class="mt-2" :value="uploadSnackbar.percent"></v-progress-linear>
|
||||
<template v-slot:action="{ attrs }">
|
||||
<v-btn
|
||||
color="red"
|
||||
text
|
||||
v-bind="attrs"
|
||||
@click="cancelUpload"
|
||||
style="min-width: auto;"
|
||||
>
|
||||
<v-icon class="0">mdi-close</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
</v-snackbar>
|
||||
|
||||
<v-dialog :value="!updateStatus" persistent width="500">
|
||||
<v-card color="primary" dark >
|
||||
<v-card-text class="pt-2">
|
||||
{{ updateMessage}}
|
||||
<v-progress-linear indeterminate color="white" class="mb-0 mt-2"></v-progress-linear>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<select-printer-dialog v-if="remoteMode"></select-printer-dialog>
|
||||
<connecting-dialog v-if="!remoteMode"></connecting-dialog>
|
||||
<update-dialog></update-dialog>
|
||||
</v-app>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import routes from './routes'
|
||||
import { mapState, mapGetters } from 'vuex'
|
||||
import TopCornerMenu from "@/components/TopCornerMenu";
|
||||
import TopCornerMenu from "@/components/TopCornerMenu"
|
||||
import UpdateDialog from "@/components/UpdateDialog"
|
||||
import ConnectingDialog from "@/components/ConnectingDialog";
|
||||
import SelectPrinterDialog from "@/components/SelectPrinterDialog";
|
||||
import PrinterSelecter from "@/components/PrinterSelecter"
|
||||
import axios from "axios";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
source: String,
|
||||
},
|
||||
components: {
|
||||
TopCornerMenu
|
||||
PrinterSelecter,
|
||||
ConnectingDialog,
|
||||
SelectPrinterDialog,
|
||||
UpdateDialog,
|
||||
TopCornerMenu,
|
||||
},
|
||||
data: () => ({
|
||||
overlayDisconnect: true,
|
||||
drawer: null,
|
||||
activeClass: 'active',
|
||||
routes: routes,
|
||||
routes: routes.filter((element) => element.title !== "Printers"),
|
||||
boolNaviHeightmap: false,
|
||||
uploadSnackbar: {
|
||||
status: false,
|
||||
filename: "",
|
||||
percent: 0,
|
||||
speed: 0,
|
||||
total: 0,
|
||||
cancelTokenSource: "",
|
||||
lastProgress: {
|
||||
time: 0,
|
||||
loaded: 0
|
||||
}
|
||||
}
|
||||
}),
|
||||
created () {
|
||||
this.$vuetify.theme.dark = true;
|
||||
@@ -131,6 +173,8 @@ export default {
|
||||
...mapState({
|
||||
isConnected: state => state.socket.isConnected,
|
||||
hostname: state => state.printer.hostname,
|
||||
apiHost: state => state.socket.hostname,
|
||||
apiPort: state => state.socket.port,
|
||||
klippy_state: state => state.server.klippy_state,
|
||||
printer_state: state => state.printer.print_stats.state,
|
||||
loadings: state => state.socket.loadings,
|
||||
@@ -144,19 +188,28 @@ export default {
|
||||
save_config_pending: state => state.printer.configfile.save_config_pending,
|
||||
|
||||
klipperVersion: state => state.printer.software_version,
|
||||
|
||||
updateStatus: state => state.server.updateManager.updateResponse.complete,
|
||||
updateMessage: state => state.server.updateManager.updateResponse.message,
|
||||
remoteMode: state => state.socket.remoteMode,
|
||||
}),
|
||||
...mapGetters([
|
||||
'getTitle',
|
||||
'getVersion',
|
||||
'server/updateManager/isUpdateAvailable',
|
||||
]),
|
||||
print_percent: {
|
||||
get() {
|
||||
return this.$store.getters["printer/getPrintPercent"]
|
||||
}
|
||||
},
|
||||
defaultFavicons: {
|
||||
get() {
|
||||
return this.$store.getters["files/getFavicons"]
|
||||
}
|
||||
},
|
||||
sidebarLogo: {
|
||||
get() {
|
||||
return this.$store.getters["files/getSidebarLogo"]
|
||||
}
|
||||
},
|
||||
sidebarBackground: {
|
||||
get() {
|
||||
return this.$store.getters["files/getSidebarBackground"]
|
||||
@@ -167,6 +220,11 @@ export default {
|
||||
return this.$store.getters["files/getCustomStylesheet"]
|
||||
}
|
||||
},
|
||||
isUpdateAvailable: {
|
||||
get() {
|
||||
return this.$store.getters["server/updateManager/isUpdateAvailable"]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickEmergencyStop: function() {
|
||||
@@ -174,10 +232,90 @@ export default {
|
||||
this.$socket.sendObj('printer.emergency_stop', {}, 'socket/removeLoading',{ name: 'topbarEmergencyStop' });
|
||||
},
|
||||
clickSaveConfig: function() {
|
||||
this.$store.commit('server/addEvent', "SAVE_CONFIG");
|
||||
this.$store.commit('server/addEvent', { message: "SAVE_CONFIG", type: "command" });
|
||||
this.$store.commit('socket/addLoading', { name: 'topbarSaveConfig' });
|
||||
this.$socket.sendObj('printer.gcode.script', { script: "SAVE_CONFIG" }, 'socket/removeLoading', { name: 'topbarSaveConfig' });
|
||||
},
|
||||
btnUploadAndStart: function() {
|
||||
this.$refs.fileUploadAndStart.click()
|
||||
},
|
||||
async uploadAndStart() {
|
||||
if (this.$refs.fileUploadAndStart.files.length) {
|
||||
this.$store.commit('socket/addLoading', { name: 'btnUploadAndStart' })
|
||||
let successFiles = []
|
||||
for (const file of this.$refs.fileUploadAndStart.files) {
|
||||
const result = await this.doUploadAndStart(file)
|
||||
successFiles.push(result)
|
||||
}
|
||||
|
||||
this.$store.commit('socket/removeLoading', { name: 'gcodeUpload' })
|
||||
for(const file of successFiles) {
|
||||
this.$toast.success("Upload of "+file+" successful!")
|
||||
}
|
||||
|
||||
this.$refs.fileUploadAndStart.value = ''
|
||||
this.$router.push("/");
|
||||
}
|
||||
},
|
||||
doUploadAndStart(file) {
|
||||
let toast = this.$toast
|
||||
let formData = new FormData()
|
||||
let filename = file.name.replace(" ", "_")
|
||||
|
||||
this.uploadSnackbar.filename = filename
|
||||
this.uploadSnackbar.status = true
|
||||
this.uploadSnackbar.percent = 0
|
||||
this.uploadSnackbar.speed = 0
|
||||
this.uploadSnackbar.lastProgress.loaded = 0
|
||||
this.uploadSnackbar.lastProgress.time = 0
|
||||
|
||||
formData.append('file', file, filename)
|
||||
formData.append('print', true)
|
||||
|
||||
return new Promise(resolve => {
|
||||
this.uploadSnackbar.cancelTokenSource = axios.CancelToken.source();
|
||||
axios.post('//' + this.apiHost + ':' + this.apiPort + '/server/files/upload',
|
||||
formData, {
|
||||
cancelToken: this.uploadSnackbar.cancelTokenSource.token,
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
onUploadProgress: (progressEvent) => {
|
||||
this.uploadSnackbar.percent = (progressEvent.loaded * 100) / progressEvent.total
|
||||
if (this.uploadSnackbar.lastProgress.time) {
|
||||
const time = progressEvent.timeStamp - this.uploadSnackbar.lastProgress.time
|
||||
const data = progressEvent.loaded - this.uploadSnackbar.lastProgress.loaded
|
||||
|
||||
if (time) this.uploadSnackbar.speed = data / (time / 1000)
|
||||
}
|
||||
|
||||
this.uploadSnackbar.lastProgress.time = progressEvent.timeStamp
|
||||
this.uploadSnackbar.lastProgress.loaded = progressEvent.loaded
|
||||
this.uploadSnackbar.total = progressEvent.total
|
||||
}
|
||||
}
|
||||
).then((result) => {
|
||||
this.uploadSnackbar.status = false
|
||||
resolve(result.data.result)
|
||||
}).catch(() => {
|
||||
this.uploadSnackbar.status = false
|
||||
this.$store.commit('socket/removeLoading', { name: 'btnUploadAndStart' })
|
||||
toast.error("Cannot upload the file!")
|
||||
})
|
||||
})
|
||||
},
|
||||
cancelUpload: function() {
|
||||
this.uploadSnackbar.cancelTokenSource.cancel()
|
||||
this.uploadSnackbar.status = false
|
||||
},
|
||||
formatFilesize(fileSizeInBytes) {
|
||||
let i = -1
|
||||
let byteUnits = [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB']
|
||||
do {
|
||||
fileSizeInBytes = fileSizeInBytes / 1024
|
||||
i++
|
||||
} while (fileSizeInBytes > 1024)
|
||||
|
||||
return Math.max(fileSizeInBytes, 0.1).toFixed(1) + byteUnits[i]
|
||||
},
|
||||
drawFavicon(val) {
|
||||
let favicon16 = document.querySelector("link[rel*='icon'][sizes='16x16']")
|
||||
let favicon32 = document.querySelector("link[rel*='icon'][sizes='32x32']")
|
||||
@@ -192,7 +330,7 @@ export default {
|
||||
let centerX = canvas.width / 2;
|
||||
let centerY = canvas.height / 2;
|
||||
let radius = 32;
|
||||
let percent = val * 100;
|
||||
let percent = (val * 100).toFixed(0);
|
||||
|
||||
/* draw the grey circle */
|
||||
context.beginPath();
|
||||
@@ -223,8 +361,9 @@ export default {
|
||||
favicon16.href = canvas.toDataURL('image/png')
|
||||
favicon32.href = canvas.toDataURL('image/png')
|
||||
} else {
|
||||
favicon16.href = "/img/icons/favicon-16x16.png"
|
||||
favicon32.href = "/img/icons/favicon-32x32.png"
|
||||
const [favicon16Default, favicon32Default] = this.defaultFavicons
|
||||
favicon16.href = favicon16Default
|
||||
favicon32.href = favicon32Default
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -240,9 +379,6 @@ export default {
|
||||
config() {
|
||||
this.boolNaviHeightmap = (typeof(this.config.bed_mesh) !== "undefined");
|
||||
},
|
||||
isConnected(newVal) {
|
||||
this.overlayDisconnect = !newVal;
|
||||
},
|
||||
customStylesheet(newVal) {
|
||||
if (newVal !== null) {
|
||||
let style = document.getElementById("customStylesheet")
|
||||
@@ -259,6 +395,9 @@ export default {
|
||||
let style = document.getElementById("customStylesheet")
|
||||
if (style) style.remove()
|
||||
}
|
||||
},
|
||||
defaultFavicons() {
|
||||
this.drawFavicon(this.print_percent);
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -311,7 +450,7 @@ export default {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
nav ul.navi a.nav-link {
|
||||
nav ul.navi .nav-link {
|
||||
display: block;
|
||||
color: white;
|
||||
border-radius: .5em;
|
||||
@@ -325,25 +464,25 @@ export default {
|
||||
margin: 0.5em 1em;
|
||||
}
|
||||
|
||||
nav ul.navi a.nav-link:hover,
|
||||
nav ul.navi li.active>a.nav-link,
|
||||
nav ul.navi a.nav-link.router-link-active {
|
||||
nav ul.navi .nav-link:hover,
|
||||
nav ul.navi li.active>.nav-link,
|
||||
nav ul.navi .nav-link.router-link-active {
|
||||
background: rgba(255,255,255,.3);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
nav ul.navi li.active>a.nav-link i.nav-arrow ,
|
||||
nav ul.navi a.nav-link.router-link-active i.nav-arrow {
|
||||
nav ul.navi li.active>.nav-link i.nav-arrow ,
|
||||
nav ul.navi .nav-link.router-link-active i.nav-arrow {
|
||||
transform: rotate(0);
|
||||
}
|
||||
|
||||
nav ul.navi a.nav-link>i.v-icon {
|
||||
nav ul.navi .nav-link>i.v-icon {
|
||||
color: white;
|
||||
font-size: 1.7em;
|
||||
margin-right: .5em;
|
||||
}
|
||||
|
||||
nav ul.navi a.nav-link>span.nav-title {
|
||||
nav ul.navi .nav-link>span.nav-title {
|
||||
line-height: 30px;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
@@ -351,12 +490,15 @@ export default {
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
nav ul.navi a.nav-link>i.nav-arrow {
|
||||
nav ul.navi .nav-link>.nav-arrow {
|
||||
float: right;
|
||||
margin-top: 5px;
|
||||
margin-right: 0;
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
nav ul.navi .nav-link>.nav-arrow.right {
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
|
||||
nav ul.navi>li>ul.child {
|
||||
display: none;
|
||||
@@ -370,16 +512,16 @@ export default {
|
||||
display: block;
|
||||
}
|
||||
|
||||
nav ul.navi>li>ul.child a.nav-link {
|
||||
nav ul.navi>li>ul.child .nav-link {
|
||||
padding: 5px 15px 5px 15px;
|
||||
}
|
||||
|
||||
nav ul.navi>li>ul.child a.nav-link:hover,
|
||||
nav ul.navi>li>ul.child a.nav-link.router-link-active {
|
||||
nav ul.navi>li>ul.child .nav-link:hover,
|
||||
nav ul.navi>li>ul.child .nav-link.router-link-active {
|
||||
background: rgba(255,255,255,.2);
|
||||
}
|
||||
|
||||
nav ul.navi>li>ul.child a.nav-link>span.nav-title {
|
||||
nav ul.navi>li>ul.child .nav-link>span.nav-title {
|
||||
text-transform: capitalize;
|
||||
font-weight: 400;
|
||||
font-size: 14px;
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-dialog v-model="showDialog" persistent :width="400">
|
||||
<v-card dark>
|
||||
<v-toolbar flat dense color="primary">
|
||||
<v-toolbar-title>
|
||||
<span class="subheading">
|
||||
<v-icon class="mdi mdi-connection" left></v-icon>Connecting<span v-if="connectingFailed"> failed</span><span v-if="isConnecting"> to {{ parseInt(port) !== 80 ? hostname+":"+port : hostname }}</span>
|
||||
</span>
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
<v-card-text class="pt-5" v-if="isConnecting">
|
||||
<v-progress-linear color="white" indeterminate></v-progress-linear>
|
||||
</v-card-text>
|
||||
<v-card-text class="pt-5" v-if="!isConnecting && connectingFailed">
|
||||
<p>Cannot not connect to {{ parseInt(port) !== 80 ? hostname+":"+port : hostname }}.</p>
|
||||
<div class="text-center">
|
||||
<v-btn @click="reconnect" color="primary">try again</v-btn>
|
||||
</div>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from "vuex";
|
||||
import Vue from "vue";
|
||||
|
||||
export default {
|
||||
data: function() {
|
||||
return {
|
||||
showDialog: true,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
isConnected: state => state.socket.isConnected,
|
||||
isConnecting: state => state.socket.isConnecting,
|
||||
connectingFailed: state => state.socket.connectingFailed,
|
||||
}),
|
||||
protocol: {
|
||||
get() {
|
||||
return this.$store.state.socket.protocol
|
||||
}
|
||||
},
|
||||
hostname: {
|
||||
get() {
|
||||
return this.$store.state.socket.hostname
|
||||
},
|
||||
set(newName) {
|
||||
return this.$store.dispatch('socket/setData', { hostname: newName });
|
||||
}
|
||||
},
|
||||
port: {
|
||||
get() {
|
||||
return this.$store.state.socket.port
|
||||
},
|
||||
set(newName) {
|
||||
return this.$store.dispatch('socket/setData', { port: newName });
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
connect() {
|
||||
window.console.log("save connection")
|
||||
Vue.prototype.$socket.setUrl(this.protocol+"://"+this.hostname+":"+this.port+"/websocket")
|
||||
Vue.prototype.$socket.connect()
|
||||
},
|
||||
reconnect() {
|
||||
this.$store.dispatch('socket/setData', { connectingFailed: false })
|
||||
Vue.prototype.$socket.connect()
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.tmpHostname = this.hostname+":"+this.port
|
||||
},
|
||||
watch: {
|
||||
isConnected(newVal) {
|
||||
this.showDialog = !newVal
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,84 @@
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div v-if="(remoteMode && countPrinters > 1) || (!remoteMode && countPrinters)">
|
||||
<li :class="currentPage === '/allPrinters' ? 'nav-item active' : 'nav-item '">
|
||||
<div
|
||||
class="nav-link "
|
||||
@click.prevent
|
||||
@click="switchToPrinters"
|
||||
role="button"
|
||||
>
|
||||
<v-icon>mdi-view-dashboard-outline</v-icon>
|
||||
<span class="nav-title">Printers</span>
|
||||
|
||||
<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>
|
||||
</div>
|
||||
<v-item-group class="v-btn-toggle mx-4 d-block row" name="printers" v-if="false">
|
||||
<v-btn class="col" color="primary" @click="switchToPrinters">Printers</v-btn>
|
||||
|
||||
</v-item-group>
|
||||
</li>
|
||||
<v-divider class="my-4"></v-divider>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
import router from "@/plugins/router";
|
||||
|
||||
export default {
|
||||
name: "PrinterSelecter.vue",
|
||||
computed: {
|
||||
...mapState({
|
||||
remoteMode: state => state.socket.remoteMode
|
||||
}),
|
||||
countPrinters: {
|
||||
get() {
|
||||
return this.$store.getters["farm/countPrinters"]
|
||||
}
|
||||
},
|
||||
printers: {
|
||||
get() {
|
||||
return this.$store.getters["farm/getPrinters"]
|
||||
}
|
||||
},
|
||||
currentPage: function() {
|
||||
return this.$route.fullPath;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
switchToPrinters() {
|
||||
router.push("/allPrinters");
|
||||
},
|
||||
getPrinterName(namespace) {
|
||||
return this.$store.getters["farm/"+namespace+"/getPrinterName"]
|
||||
},
|
||||
getPrinterDescription(printer) {
|
||||
return this.$store.getters["farm/"+printer._namespace+"/getStatus"]
|
||||
},
|
||||
changePrinter(printer) {
|
||||
if (printer.socket.isConnected) {
|
||||
if (this.remoteMode) this.$store.dispatch('changePrinter', { printer: printer._namespace })
|
||||
else window.location.href = "//"+printer.socket.hostname+(parseInt(printer.socket.webPort) !== 80 ? ':'+printer.socket.webPort : '')
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,283 @@
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-dialog v-model="showDialog" persistent :width="400">
|
||||
<v-card dark>
|
||||
<v-toolbar flat dense color="primary">
|
||||
<v-toolbar-title>
|
||||
<span class="subheading">
|
||||
<v-icon class="mdi mdi-connection" left></v-icon>
|
||||
<span v-if="isConnecting">Connection to {{ parseInt(port) !== 80 ? hostname+':'+port : hostname }}</span>
|
||||
<span v-if="connectingFailed">Connection failed</span>
|
||||
<span v-if="!isConnecting && !connectingFailed && !dialogAddPrinter.bool && !dialogEditPrinter.bool">Select Printer</span>
|
||||
<span v-if="dialogAddPrinter.bool">Add Printer</span>
|
||||
<span v-if="dialogEditPrinter.bool">Edit Printer</span>
|
||||
</span>
|
||||
</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn v-if="!isConnecting && !connectingFailed && !dialogAddPrinter.bool && !dialogEditPrinter.bool && this['farm/countPrinters'] > 0" small class="minwidth-0" @click="checkPrinters"><v-icon small>mdi-sync</v-icon></v-btn>
|
||||
<v-btn small class="minwidth-0" v-if="!isConnecting && !connectingFailed && dialogAddPrinter.bool" @click="dialogAddPrinter.bool = false"><v-icon small>mdi-close-thick</v-icon></v-btn>
|
||||
<v-btn small class="minwidth-0" v-if="!isConnecting && !connectingFailed && dialogEditPrinter.bool" @click="dialogEditPrinter.bool = false"><v-icon small>mdi-close-thick</v-icon></v-btn>
|
||||
</v-toolbar>
|
||||
<v-card-text class="pt-5" v-if="isConnecting">
|
||||
<v-progress-linear color="white" indeterminate></v-progress-linear>
|
||||
</v-card-text>
|
||||
<v-card-text class="pt-5" v-if="!isConnecting && connectingFailed">
|
||||
<p>Cannot not connect to {{ parseInt(port) !== 80 ? hostname+":"+port : hostname }}.</p>
|
||||
<div class="text-center">
|
||||
<v-btn @click="switchToChangePrinter" color="white" outlined class="mr-3">change printer</v-btn>
|
||||
<v-btn @click="reconnect" color="primary">try again</v-btn>
|
||||
</div>
|
||||
</v-card-text>
|
||||
<v-card-text class="pt-3" v-if="!isConnecting && dialogAddPrinter.bool">
|
||||
<v-container class="px-0 py-0">
|
||||
<v-row>
|
||||
<v-col class="col-8">
|
||||
<v-text-field
|
||||
v-model="dialogAddPrinter.hostname"
|
||||
:rules="[
|
||||
v => !!v || 'Hostname is required',
|
||||
v => !v.startsWith('http:') || 'invalid hostname/IP',
|
||||
v => !v.startsWith('https:') || 'invalid hostname/IP',
|
||||
]"
|
||||
label="Hostname/IP"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col class="col-4">
|
||||
<v-text-field
|
||||
v-model="dialogAddPrinter.port"
|
||||
:rules="[v => !!v || 'Port is required']"
|
||||
label="Port"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="text-right">
|
||||
<v-btn
|
||||
color="white"
|
||||
outlined
|
||||
class="middle"
|
||||
@click="addPrinter"
|
||||
>
|
||||
add printer
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
<v-card-text class="pt-3" v-if="!isConnecting && dialogEditPrinter.bool">
|
||||
<v-container class="px-0 py-0">
|
||||
<v-row>
|
||||
<v-col class="col-8">
|
||||
<v-text-field
|
||||
v-model="dialogEditPrinter.hostname"
|
||||
:rules="[
|
||||
v => !!v || 'Hostname is required',
|
||||
v => !v.startsWith('http:') || 'invalid hostname/IP',
|
||||
v => !v.startsWith('https:') || 'invalid hostname/IP',
|
||||
]"
|
||||
label="Hostname/IP"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col class="col-4">
|
||||
<v-text-field
|
||||
v-model="dialogEditPrinter.port"
|
||||
:rules="[v => !!v || 'Port is required']"
|
||||
label="Port"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="">
|
||||
<v-btn
|
||||
color="red"
|
||||
outlined
|
||||
class="middle minwidth-0"
|
||||
@click="delPrinter"
|
||||
>
|
||||
<v-icon small>mdi-delete</v-icon>
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col class="text-right">
|
||||
<v-btn
|
||||
color="white"
|
||||
outlined
|
||||
class="middle"
|
||||
@click="updatePrinter"
|
||||
>
|
||||
update printer
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
<v-card-text class="pt-3" v-if="!isConnecting && !connectingFailed && !dialogAddPrinter.bool && !dialogEditPrinter.bool">
|
||||
<v-container class="px-0 pb-0">
|
||||
<v-row v-for="(printer, index) in this['farm/getPrinters']" v-bind:key="index">
|
||||
<v-col class="rounded transition-swing secondary py-2 px-2 mb-6" style="cursor: pointer;" @click="connect(printer)">
|
||||
<v-row align="center">
|
||||
<v-col class="col-auto pr-0">
|
||||
<v-progress-circular
|
||||
indeterminate
|
||||
color="primary"
|
||||
v-if="printer.socket.isConnecting"
|
||||
></v-progress-circular>
|
||||
<v-icon
|
||||
:color="printer.socket.isConnected ? 'green' : 'red'"
|
||||
v-if="!printer.socket.isConnecting"
|
||||
>mdi-{{ printer.socket.isConnected ? 'checkbox-marked-circle' : 'cancel' }}</v-icon>
|
||||
</v-col>
|
||||
<v-col>{{ printer.socket.hostname }}{{ parseInt(printer.socket.port) !== 80 ? ":"+printer.socket.port : "" }}</v-col>
|
||||
<v-col class="col-auto"><v-btn small class="minwidth-0" v-on:click.stop.prevent="editPrinter(index)"><v-icon small>mdi-pencil</v-icon></v-btn></v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-if="showCorsInfo">
|
||||
<v-col>
|
||||
<p class="text-center" v-if="this['farm/countPrinters'] === 0">Hello and welcome to the remote mode of Mainsail!</p>
|
||||
<p class="text-center">Please remember to add <code>{{ currentUrl }}</code> in moonraker.conf within "cors_domains".</p>
|
||||
<p class="text-center">You can find more details at <a href="https://docs.mainsail.xyz/remotemode" target="_blank">docs.mainsail.xyz/remotemode</a>.</p>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="text-center mt-0">
|
||||
<v-btn @click="dialogAddPrinter.bool = true">add printer</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState, mapGetters, mapActions } from "vuex";
|
||||
import Vue from "vue";
|
||||
|
||||
export default {
|
||||
data: function() {
|
||||
return {
|
||||
showDialog: true,
|
||||
dialogAddPrinter: {
|
||||
bool: false,
|
||||
hostname: "",
|
||||
port: 7125
|
||||
},
|
||||
dialogEditPrinter: {
|
||||
bool: false,
|
||||
index: 0,
|
||||
hostname: "",
|
||||
port: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
isConnected: state => state.socket.isConnected,
|
||||
isConnecting: state => state.socket.isConnecting,
|
||||
connectingFailed: state => state.socket.connectingFailed,
|
||||
remoteMode: state => state.socket.remoteMode,
|
||||
protocol: state => state.socket.protocol,
|
||||
hostname: state => state.socket.hostname,
|
||||
port: state => state.socket.port,
|
||||
}),
|
||||
...mapGetters([
|
||||
"farm/countPrinters",
|
||||
"farm/getPrinters"
|
||||
]),
|
||||
...mapActions({
|
||||
readPrinters: "farm/readStoredPrinters"
|
||||
}),
|
||||
currentUrl: {
|
||||
get() {
|
||||
return "http://"+window.location.hostname+(window.location.port !== 80 && window.location.port !== '' ? ':'+window.location.port : '')
|
||||
}
|
||||
},
|
||||
showCorsInfo: {
|
||||
get() {
|
||||
if (this["farm/countPrinters"]) {
|
||||
for (const [ ,printer] of Object.entries(this["farm/getPrinters"])) {
|
||||
if (!printer.socket.isConnected) return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addPrinter() {
|
||||
this.$store.commit('farm/addPrinter',{
|
||||
hostname: this.dialogAddPrinter.hostname,
|
||||
port: this.dialogAddPrinter.port,
|
||||
protocol: this.protocol
|
||||
})
|
||||
|
||||
this.dialogAddPrinter.hostname = ""
|
||||
this.dialogAddPrinter.bool = false
|
||||
|
||||
this.$store.dispatch("farm/savePrinters")
|
||||
},
|
||||
editPrinter(index) {
|
||||
this.dialogEditPrinter.hostname = this["farm/getPrinters"][index].socket.hostname
|
||||
this.dialogEditPrinter.port = this["farm/getPrinters"][index].socket.port
|
||||
this.dialogEditPrinter.index = index
|
||||
this.dialogEditPrinter.bool = true
|
||||
},
|
||||
updatePrinter() {
|
||||
this.$store.commit("farm/"+this.dialogEditPrinter.index+"/setSocketData", {
|
||||
hostname: this.dialogEditPrinter.hostname,
|
||||
port: this.dialogEditPrinter.port,
|
||||
isConnecting: true,
|
||||
})
|
||||
this.$store.dispatch("farm/"+this.dialogEditPrinter.index+"/reconnect")
|
||||
this.dialogEditPrinter.bool = false
|
||||
|
||||
this.checkPrinters()
|
||||
},
|
||||
delPrinter() {
|
||||
this.$store.commit("farm/removePrinter", { name: this.dialogEditPrinter.index })
|
||||
this.$store.dispatch("farm/savePrinters")
|
||||
this.dialogEditPrinter.bool = false
|
||||
},
|
||||
connect(printer) {
|
||||
this.$store.dispatch('socket/setData', {
|
||||
hostname: printer.socket.hostname,
|
||||
port: printer.socket.port
|
||||
})
|
||||
Vue.prototype.$socket.setUrl(this.protocol+"://"+printer.socket.hostname+":"+printer.socket.port+"/websocket")
|
||||
Vue.prototype.$socket.connect()
|
||||
},
|
||||
reconnect() {
|
||||
this.$store.dispatch('socket/setData', { connectingFailed: false })
|
||||
Vue.prototype.$socket.connect()
|
||||
},
|
||||
switchToChangePrinter() {
|
||||
this.$store.dispatch('socket/setData', { connectingFailed: false })
|
||||
},
|
||||
checkPrinters() {
|
||||
Object.entries(this['farm/getPrinters']).forEach(([key, printer]) => {
|
||||
if (!printer.socket.isConnected && !printer.socket.isConnecting) {
|
||||
this.$store.dispatch('farm/'+key+'/connect')
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch("farm/readStoredPrinters")
|
||||
},
|
||||
watch: {
|
||||
isConnected(newVal) {
|
||||
this.showDialog = !newVal
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -5,7 +5,7 @@
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-menu bottom left :offset-y="true" :close-on-content-click="false">
|
||||
<v-menu bottom left :offset-y="true" :close-on-content-click="false" v-model="showMenu">
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-btn dark icon v-bind="attrs" v-on="on">
|
||||
<v-icon>mdi-dots-vertical</v-icon>
|
||||
@@ -15,25 +15,25 @@
|
||||
<v-list dense>
|
||||
<v-subheader class="" style="height: auto;">Klipper Control</v-subheader>
|
||||
<v-list-item class="minheight30" link @click="doRestart()">
|
||||
<v-list-item-title><v-icon class="mr-2" small>mdi-sync</v-icon>Restart</v-list-item-title>
|
||||
<v-list-item-title><v-icon class="mr-2" small>mdi-restart</v-icon>Restart</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item class="minheight30" link @click="doFirmwareRestart()">
|
||||
<v-list-item-title><v-icon class="mr-2" small>mdi-sync</v-icon>Firmware Restart</v-list-item-title>
|
||||
<v-list-item-title><v-icon class="mr-2" small>mdi-restart</v-icon>Firmware Restart</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-divider class="mt-0"></v-divider>
|
||||
<v-subheader class="pt-2" style="height: auto;">Restart Services</v-subheader>
|
||||
<v-list-item class="minheight30" link @click="doServiceRestartKlipper()">
|
||||
<v-list-item-title><v-icon class="mr-2" small>mdi-sync</v-icon>Klipper</v-list-item-title>
|
||||
<v-list-item-title><v-icon class="mr-2" small>mdi-restart</v-icon>Klipper</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item class="minheight30" link @click="doServiceRestartMoonraker()">
|
||||
<v-list-item-title><v-icon class="mr-2" small>mdi-sync</v-icon>Moonraker</v-list-item-title>
|
||||
<v-list-item-title><v-icon class="mr-2" small>mdi-restart</v-icon>Moonraker</v-list-item-title>
|
||||
</v-list-item>
|
||||
<div v-if="countPowerDevices">
|
||||
<v-divider class="mt-0"></v-divider>
|
||||
<v-subheader class="pt-2" style="height: auto;">Power Devices</v-subheader>
|
||||
<v-list-item v-for="(device, index) in devices" v-bind:key="index" class="minheight30" @click="changeSwitch(device, device.status)" :disabled="(device.status === 'error')">
|
||||
<v-list-item-title>
|
||||
<v-icon class="mr-2">mdi-{{ device.status === 'on' ? 'toggle-switch' : 'toggle-switch-off' }}</v-icon>{{ device.device }}
|
||||
<v-icon class="mr-2" :color="device.status === 'on' ? '' : 'grey darken-2'">mdi-{{ device.status === 'on' ? 'toggle-switch' : 'toggle-switch-off' }}</v-icon>{{ device.device }}
|
||||
</v-list-item-title>
|
||||
</v-list-item>
|
||||
</div>
|
||||
@@ -55,6 +55,11 @@ import Vue from "vue";
|
||||
|
||||
export default {
|
||||
name: "TopCornerMenu.vue",
|
||||
data: function () {
|
||||
return {
|
||||
showMenu: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
devices: (state) => state.server.power.devices,
|
||||
@@ -74,23 +79,29 @@ export default {
|
||||
Vue.prototype.$socket.sendObj(rpc,{ [device.device]: null },"server/power/responseToggle")
|
||||
},
|
||||
doRestart: function() {
|
||||
this.$store.commit('server/addEvent', "RESTART")
|
||||
this.showMenu = false
|
||||
this.$store.commit('server/addEvent', { message: "RESTART", type: 'command' })
|
||||
this.$socket.sendObj('printer.gcode.script', { script: "RESTART" })
|
||||
},
|
||||
doFirmwareRestart: function() {
|
||||
this.$store.commit('server/addEvent', "FIRMWARE_RESTART")
|
||||
this.showMenu = false
|
||||
this.$store.commit('server/addEvent', { message: "FIRMWARE_RESTART", type: 'command' })
|
||||
this.$socket.sendObj('printer.gcode.script', { script: "FIRMWARE_RESTART" })
|
||||
},
|
||||
doServiceRestartKlipper: function() {
|
||||
this.showMenu = false
|
||||
this.$socket.sendObj('machine.services.restart', { service: "klipper" })
|
||||
},
|
||||
doServiceRestartMoonraker: function() {
|
||||
this.showMenu = false
|
||||
this.$socket.sendObj('machine.services.restart', { service: "moonraker" })
|
||||
},
|
||||
doHostReboot: function() {
|
||||
this.showMenu = false
|
||||
this.$socket.sendObj('machine.reboot', { })
|
||||
},
|
||||
doHostShutdown: function() {
|
||||
this.showMenu = false
|
||||
this.$socket.sendObj('machine.shutdown', { })
|
||||
},
|
||||
}
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
<style scoped>
|
||||
.updaterLog {
|
||||
height: 350px;
|
||||
max-height: 350px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.updaterLog .title-cell {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.updaterLog.v-data-table > .v-data-table__wrapper > table > tbody > tr > td {
|
||||
height: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-dialog :value="application !== ''" persistent width="60%" max-width="800">
|
||||
<v-card
|
||||
dark
|
||||
:loading="!complete"
|
||||
>
|
||||
<template slot="progress">
|
||||
<v-progress-linear color="primary" indeterminate></v-progress-linear>
|
||||
</template>
|
||||
<v-toolbar flat dense >
|
||||
<v-toolbar-title>
|
||||
<span class="subheading"><v-icon left>mdi-update</v-icon>Updating {{ application }}{{ complete ? " done!" : "..." }}</span>
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
<v-card-text class="py-6">
|
||||
<v-data-table
|
||||
:headers="headers"
|
||||
:options="options"
|
||||
:items="messages"
|
||||
item-key="date"
|
||||
hide-default-footer
|
||||
hide-default-header
|
||||
disable-pagination
|
||||
class="updaterLog"
|
||||
ref="updaterLog"
|
||||
:custom-sort="customSort"
|
||||
sort-by="date"
|
||||
:sort-desc="true"
|
||||
color="primary"
|
||||
>
|
||||
<template #no-data>
|
||||
<div class="py-2">empty</div>
|
||||
</template>
|
||||
|
||||
<template #item="{ item }">
|
||||
<tr>
|
||||
<td class="log-cell title-cell py-2">
|
||||
{{ formatTime(item.date)}}
|
||||
</td>
|
||||
<td class="log-cell content-cell pl-0 py-2" colspan="2" style="width:100%;">
|
||||
<span v-if="item.message" class="message" v-html="item.message"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
<v-row>
|
||||
<v-col class="text-center pt-5">
|
||||
<v-btn @click="close" :disabled="!complete" color="primary">close</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapState} from "vuex";
|
||||
|
||||
export default {
|
||||
name: "UpdateDialog.vue",
|
||||
data: function() {
|
||||
return {
|
||||
headers: [
|
||||
{
|
||||
text: 'Date',
|
||||
value: 'date',
|
||||
width: '1%',
|
||||
dateType: 'Date',
|
||||
}, {
|
||||
text: 'Message',
|
||||
sortable: false,
|
||||
value: 'message',
|
||||
width: '99%'
|
||||
},
|
||||
],
|
||||
options: {
|
||||
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
application: state => state.server.updateManager.updateResponse.application,
|
||||
complete: state => state.server.updateManager.updateResponse.complete,
|
||||
messages: state => state.server.updateManager.updateResponse.messages,
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
formatTime(date) {
|
||||
let hours = date.getHours();
|
||||
if (hours < 10) hours = "0"+hours.toString();
|
||||
let minutes = date.getMinutes();
|
||||
if (minutes < 10) minutes = "0"+minutes.toString();
|
||||
let seconds = date.getSeconds();
|
||||
if (seconds < 10) seconds = "0"+seconds.toString();
|
||||
|
||||
return hours+":"+minutes+":"+seconds;
|
||||
},
|
||||
customSort: function(items, index, isDesc) {
|
||||
items.sort((a, b) => {
|
||||
if (index[0] === 'date') {
|
||||
if (!isDesc[0]) return new Date(b[index]) - new Date(a[index]);
|
||||
else return new Date(a[index]) - new Date(b[index]);
|
||||
} else {
|
||||
if(typeof a[index] !== 'undefined'){
|
||||
if (!isDesc[0]) return a[index].toLowerCase().localeCompare(b[index].toLowerCase());
|
||||
else return b[index].toLowerCase().localeCompare(a[index].toLowerCase());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return items;
|
||||
},
|
||||
close() {
|
||||
if (this.application !== null && this.complete && ["client", "mainsail"].includes(this.application.toLowerCase())) window.location.reload(true)
|
||||
else {
|
||||
this.$store.commit('server/updateManager/resetUpdateResponse')
|
||||
this.$socket.sendObj('machine.update.status', { refresh: false }, 'server/updateManager/getStatus')
|
||||
}
|
||||
}
|
||||
},
|
||||
updated(){
|
||||
if (this.$refs.updaterLog) this.$refs.updaterLog.$el.scrollTop = this.$refs.updaterLog.$el.scrollHeight
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,8 +1,9 @@
|
||||
<template>
|
||||
<div id="tempchart" style="height: 270px; width: 100%;"></div>
|
||||
<div id="tempchart" style="height: 300px; width: 100%;"></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
import CanvasJS from '@/assets/canvasjs-3.2.3/canvasjs.min'
|
||||
|
||||
export default {
|
||||
@@ -11,10 +12,13 @@ export default {
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
chart : null,
|
||||
tempchartDisplayMinutes: 10,
|
||||
timer: '',
|
||||
timerChart: '',
|
||||
timerDataset: '',
|
||||
chartOptions: {
|
||||
theme: "dark1",
|
||||
zoomEnabled: true,
|
||||
backgroundColor: 'transparent',
|
||||
animationEnabled: true,
|
||||
legend: {
|
||||
@@ -22,8 +26,47 @@ export default {
|
||||
verticalAlign: "top",
|
||||
},
|
||||
toolTip:{
|
||||
content: "{name}: {y}",
|
||||
yValueFormatString: "#,###.00",
|
||||
shared: true,
|
||||
borderColor: "#ffffff30",
|
||||
content: (e) => {
|
||||
let output = ""
|
||||
|
||||
if (e.entries[0].dataPoint.x) {
|
||||
const date = new Date(e.entries[0].dataPoint.x)
|
||||
const hours = "0" + date.getHours();
|
||||
const minutes = "0" + date.getMinutes();
|
||||
const seconds = "0" + date.getSeconds();
|
||||
output += "<strong>"+hours.substr(-2) + ':' + minutes.substr(-2) + ':' + seconds.substr(-2)+"</strong>"
|
||||
}
|
||||
|
||||
const mainEntries = e.entries.filter(dataset => dataset.dataSeries.showInLegend && dataset.dataSeries.visible).sort((a,b) => {
|
||||
if (a.dataSeries.legendText > b.dataSeries.legendText) return 1
|
||||
if (a.dataSeries.legendText < b.dataSeries.legendText) return -1
|
||||
|
||||
return 0
|
||||
})
|
||||
|
||||
if (mainEntries.length) {
|
||||
mainEntries.forEach(dataset => {
|
||||
output += "<br />"
|
||||
output += dataset.dataSeries.legendText+": "+dataset.dataPoint.y.toFixed(1)
|
||||
|
||||
const datasetTarget = e.entries.find(datasetTarget => datasetTarget.dataSeries.name === dataset.dataSeries.name+"_target")
|
||||
if (datasetTarget) {
|
||||
output += " / "+datasetTarget.dataPoint.y.toFixed(1)
|
||||
}
|
||||
|
||||
output += "°C"
|
||||
|
||||
const datasetPower = e.entries.find(datasetPower => datasetPower.dataSeries.name === dataset.dataSeries.name+"_power")
|
||||
if (datasetPower) {
|
||||
output += " at "+datasetPower.dataPoint.y.toFixed(0)+"%"
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
},
|
||||
axisX:{
|
||||
valueFormatString: "HH:mm" ,
|
||||
@@ -40,16 +83,44 @@ export default {
|
||||
minimum: 0,
|
||||
maximum: 300,
|
||||
interval: 50,
|
||||
suffix: '°C'
|
||||
},
|
||||
axisY2: {
|
||||
gridThickness: 0,
|
||||
gridColor: '#ffffff30',
|
||||
minimum: 0,
|
||||
maximum: 100,
|
||||
interval: 25,
|
||||
suffix: '%'
|
||||
},
|
||||
data: [ ]
|
||||
},
|
||||
chart : null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
intervalChartUpdate: state => state.gui.tempchart.intervalChartUpdate,
|
||||
intervalDatasetUpdate: state => state.gui.tempchart.intervalDatasetUpdate,
|
||||
}),
|
||||
datasets: {
|
||||
get () {
|
||||
return this.$store.state.printer.tempHistory.datasets
|
||||
const datasets = this.$store.state.printer.tempHistory.datasets
|
||||
|
||||
return datasets.sort((a,b) => {
|
||||
if ('name' in a && 'name' in b) {
|
||||
if (a.name.endsWith("_target") > b.name.endsWith("_power")) return -1
|
||||
if (a.name.endsWith("_power") < b.name.endsWith("_target")) return 1
|
||||
if (a.name.endsWith("_target") > b.name.endsWith("_target")) return -1
|
||||
if (a.name.endsWith("_target") < b.name.endsWith("_target")) return 1
|
||||
}
|
||||
|
||||
return 0
|
||||
})
|
||||
}
|
||||
},
|
||||
autoscale: {
|
||||
get() {
|
||||
return this.$store.state.gui.tempchart.autoscale
|
||||
}
|
||||
},
|
||||
maxTemp: {
|
||||
@@ -69,8 +140,7 @@ export default {
|
||||
|
||||
},
|
||||
created() {
|
||||
|
||||
this.timer = setInterval(() => {
|
||||
this.timerChart = setInterval(() => {
|
||||
if (
|
||||
document.getElementById("tempchart") &&
|
||||
this.chart &&
|
||||
@@ -79,10 +149,15 @@ export default {
|
||||
this.chartOptions.data = this.datasets
|
||||
this.chartOptions.axisX.minimum = new Date() - 60* this.tempchartDisplayMinutes *1000
|
||||
this.chartOptions.axisX.maximum = new Date()
|
||||
this.chartOptions.axisY.maximum = this.maxTemp
|
||||
this.chartOptions.axisY.maximum = this.autoscale ? null : this.maxTemp
|
||||
//this.chartOptions.axisY.interval = this.autoscale ? 25 : 50
|
||||
this.chart.render()
|
||||
}
|
||||
}, 1000);
|
||||
}, this.intervalChartUpdate)
|
||||
|
||||
this.timerDataset = setInterval(() => {
|
||||
this.$store.dispatch("printer/tempHistory/updateDatasets")
|
||||
}, this.intervalDatasetUpdate)
|
||||
},
|
||||
mounted: function() {
|
||||
this.createChart()
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
|
||||
import panels from './panels'
|
||||
import topCornerMenu from './TopCornerMenu'
|
||||
import updateDialog from './UpdateDialog'
|
||||
import connectingDialog from './ConnectingDialog'
|
||||
import selectPrinterDialog from './SelectPrinterDialog'
|
||||
import printerSelecter from './PrinterSelecter'
|
||||
|
||||
export default {
|
||||
panels,
|
||||
topCornerMenu
|
||||
topCornerMenu,
|
||||
updateDialog,
|
||||
connectingDialog,
|
||||
selectPrinterDialog,
|
||||
printerSelecter,
|
||||
}
|
||||
@@ -11,59 +11,59 @@
|
||||
|
||||
<template>
|
||||
<v-card>
|
||||
<v-row class="" v-if="['standby', 'paused', 'complete', 'error'].includes(printer_state)">
|
||||
<v-col class="col-12 pb-0 text-center">
|
||||
<v-btn small @click="doHome" :loading="loadings.includes('homeAll')" :color="homedAxes.includes('xyz') ? 'primary' : 'warning'"><v-icon class="mr-1">mdi-home</v-icon><span class="d-none d-sm-inline">Home </span>all</v-btn>
|
||||
<v-btn small @click="doQGL" :loading="loadings.includes('qgl')" color="primary" class="ml-2" v-if="'quad_gantry_level' in config">QGL</v-btn>
|
||||
<v-btn small @click="doZtilt" :loading="loadings.includes('zTilt')" color="primary" class="ml-2" v-if="'z_tilt' in config">Z Tilt</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="mt-3" v-if="['standby', 'paused', 'complete', 'error'].includes(printer_state)">
|
||||
<v-col class="col-12 py-0 px-6 text-center">
|
||||
<v-btn-toggle dense no-gutters class="row mx-auto" style="flex-wrap: nowrap;" >
|
||||
<v-btn @click="doSendMove('X-100')" class="btnMinWidthAuto col"><span class="body-2">-100</span></v-btn>
|
||||
<v-btn @click="doSendMove('X-10')" class="btnMinWidthAuto col"><span class="body-2">-10</span></v-btn>
|
||||
<v-btn @click="doSendMove('X-1')" class="btnMinWidthAuto col"><span class="body-2">-1</span></v-btn>
|
||||
<v-btn @click="doHomeX" :color="homedAxes.includes('x') ? 'primary' : 'warning'" :loading="loadings.includes('homeX')" class="font-weight-bold btnHomeAxis">X</v-btn>
|
||||
<v-btn @click="doSendMove('X+1')" class="btnMinWidthAuto col"><span class="body-2">+1</span></v-btn>
|
||||
<v-btn @click="doSendMove('X+10')" class="btnMinWidthAuto col"><span class="body-2">+10</span></v-btn>
|
||||
<v-btn @click="doSendMove('X+100')" class="btnMinWidthAuto col"><span class="body-2">+100</span></v-btn>
|
||||
</v-btn-toggle>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="mt-3" v-if="['standby', 'paused', 'complete', 'error'].includes(printer_state)">
|
||||
<v-col class="col-12 py-0 px-6 text-center">
|
||||
<v-btn-toggle dense no-gutters class="row mx-auto" style="flex-wrap: nowrap;" >
|
||||
<v-btn @click="doSendMove('Y-100')" class="btnMinWidthAuto col"><span class="body-2">-100</span></v-btn>
|
||||
<v-btn @click="doSendMove('Y-10')" class="btnMinWidthAuto col"><span class="body-2">-10</span></v-btn>
|
||||
<v-btn @click="doSendMove('Y-1')" class="btnMinWidthAuto col"><span class="body-2">-1</span></v-btn>
|
||||
<v-btn @click="doHomeY" :color="homedAxes.includes('y') ? 'primary' : 'warning'" :loading="loadings.includes('homeY')" class="font-weight-bold btnHomeAxis">Y</v-btn>
|
||||
<v-btn @click="doSendMove('Y+1')" class="btnMinWidthAuto col"><span class="body-2">+1</span></v-btn>
|
||||
<v-btn @click="doSendMove('Y+10')" class="btnMinWidthAuto col"><span class="body-2">+10</span></v-btn>
|
||||
<v-btn @click="doSendMove('Y+100')" class="btnMinWidthAuto col"><span class="body-2">+100</span></v-btn>
|
||||
</v-btn-toggle>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="mt-3" v-if="['standby', 'paused', 'complete', 'error'].includes(printer_state)">
|
||||
<v-col class="col-12 py-0 px-6 text-center">
|
||||
<v-btn-toggle dense no-gutters class="row mx-auto" style="flex-wrap: nowrap;" >
|
||||
<v-btn @click="doSendMove('Z-25')" dense class="btnMinWidthAuto col"><span class="body-2">-25</span></v-btn>
|
||||
<v-btn @click="doSendMove('Z-1')" dense class="btnMinWidthAuto col"><span class="body-2">-1</span></v-btn>
|
||||
<v-btn @click="doSendMove('Z-0.1')" dense class="btnMinWidthAuto col"><span class="body-2">-0.1</span></v-btn>
|
||||
<v-btn @click="doHomeZ" :color="homedAxes.includes('z') ? 'primary' : 'warning'" :loading="loadings.includes('homeZ')" class="font-weight-bold btnHomeAxis">Z</v-btn>
|
||||
<v-btn @click="doSendMove('Z+0.1')" dense class="btnMinWidthAuto col"><span class="body-2">+0.1</span></v-btn>
|
||||
<v-btn @click="doSendMove('Z+1')" dense class="btnMinWidthAuto col"><span class="body-2">+1</span></v-btn>
|
||||
<v-btn @click="doSendMove('Z+25')" dense class="btnMinWidthAuto col"><span class="body-2">+25</span></v-btn>
|
||||
</v-btn-toggle>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="" v-if="this['printer/getMacros'].length > 0">
|
||||
<v-col class="col-12 px-4 py-2 text-center">
|
||||
<div v-for="(macro, index) in this['printer/getMacros']" v-bind:key="index+99" class="d-inline-block mx-1 my-1">
|
||||
<v-btn small color="primary" class="mx-1 my-1" :loading="loadings.includes('macro_'+macro.name)" @click="doSendMacro(macro.name)">{{ macro.name.replace(/_/g, " ") }}</v-btn>
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-container class="pt-0">
|
||||
<v-row no-gutters class="" v-if="['standby', 'paused', 'complete', 'error'].includes(printer_state)">
|
||||
<v-col class="col-12 mt-3 pb-0 text-center">
|
||||
<v-btn small @click="doHome" :loading="loadings.includes('homeAll')" :color="homedAxes.includes('xyz') ? 'primary' : 'warning'"><v-icon class="mr-1">mdi-home</v-icon><span class="d-none d-sm-inline">Home </span>all</v-btn>
|
||||
<v-btn small @click="doQGL" :loading="loadings.includes('qgl')" color="primary" class="ml-2" v-if="'quad_gantry_level' in config">QGL</v-btn>
|
||||
<v-btn small @click="doZtilt" :loading="loadings.includes('zTilt')" color="primary" class="ml-2" v-if="'z_tilt' in config">Z Tilt</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row no-gutters class="mt-3" v-if="['standby', 'paused', 'complete', 'error'].includes(printer_state)">
|
||||
<v-col class="text-center">
|
||||
<v-btn-toggle dense no-gutters class="row no-gutters mx-auto" style="flex-wrap: nowrap;" >
|
||||
<v-btn @click="doSendMove('X-100')" class="btnMinWidthAuto col"><span class="body-2">-100</span></v-btn>
|
||||
<v-btn @click="doSendMove('X-10')" class="btnMinWidthAuto col"><span class="body-2">-10</span></v-btn>
|
||||
<v-btn @click="doSendMove('X-1')" class="btnMinWidthAuto col"><span class="body-2">-1</span></v-btn>
|
||||
<v-btn @click="doHomeX" :color="homedAxes.includes('x') ? 'primary' : 'warning'" :loading="loadings.includes('homeX')" class="font-weight-bold btnHomeAxis">X</v-btn>
|
||||
<v-btn @click="doSendMove('X+1')" class="btnMinWidthAuto col"><span class="body-2">+1</span></v-btn>
|
||||
<v-btn @click="doSendMove('X+10')" class="btnMinWidthAuto col"><span class="body-2">+10</span></v-btn>
|
||||
<v-btn @click="doSendMove('X+100')" class="btnMinWidthAuto col"><span class="body-2">+100</span></v-btn>
|
||||
</v-btn-toggle>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row no-gutters class="mt-3" v-if="['standby', 'paused', 'complete', 'error'].includes(printer_state)">
|
||||
<v-col class="text-center">
|
||||
<v-btn-toggle dense no-gutters class="row no-gutters mx-auto" style="flex-wrap: nowrap;" >
|
||||
<v-btn @click="doSendMove('Y-100')" class="btnMinWidthAuto col"><span class="body-2">-100</span></v-btn>
|
||||
<v-btn @click="doSendMove('Y-10')" class="btnMinWidthAuto col"><span class="body-2">-10</span></v-btn>
|
||||
<v-btn @click="doSendMove('Y-1')" class="btnMinWidthAuto col"><span class="body-2">-1</span></v-btn>
|
||||
<v-btn @click="doHomeY" :color="homedAxes.includes('y') ? 'primary' : 'warning'" :loading="loadings.includes('homeY')" class="font-weight-bold btnHomeAxis">Y</v-btn>
|
||||
<v-btn @click="doSendMove('Y+1')" class="btnMinWidthAuto col"><span class="body-2">+1</span></v-btn>
|
||||
<v-btn @click="doSendMove('Y+10')" class="btnMinWidthAuto col"><span class="body-2">+10</span></v-btn>
|
||||
<v-btn @click="doSendMove('Y+100')" class="btnMinWidthAuto col"><span class="body-2">+100</span></v-btn>
|
||||
</v-btn-toggle>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row no-gutters class="mt-3" v-if="['standby', 'paused', 'complete', 'error'].includes(printer_state)">
|
||||
<v-col class="text-center">
|
||||
<v-btn-toggle dense no-gutters class="row no-gutters mx-auto" style="flex-wrap: nowrap;" >
|
||||
<v-btn @click="doSendMove('Z-25')" dense class="btnMinWidthAuto col"><span class="body-2">-25</span></v-btn>
|
||||
<v-btn @click="doSendMove('Z-1')" dense class="btnMinWidthAuto col"><span class="body-2">-1</span></v-btn>
|
||||
<v-btn @click="doSendMove('Z-0.1')" dense class="btnMinWidthAuto col"><span class="body-2">-0.1</span></v-btn>
|
||||
<v-btn @click="doHomeZ" :color="homedAxes.includes('z') ? 'primary' : 'warning'" :loading="loadings.includes('homeZ')" class="font-weight-bold btnHomeAxis">Z</v-btn>
|
||||
<v-btn @click="doSendMove('Z+0.1')" dense class="btnMinWidthAuto col"><span class="body-2">+0.1</span></v-btn>
|
||||
<v-btn @click="doSendMove('Z+1')" dense class="btnMinWidthAuto col"><span class="body-2">+1</span></v-btn>
|
||||
<v-btn @click="doSendMove('Z+25')" dense class="btnMinWidthAuto col"><span class="body-2">+25</span></v-btn>
|
||||
</v-btn-toggle>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row no-gutters v-if="this['printer/getMacros'].length > 0">
|
||||
<v-col class="text-center">
|
||||
<v-btn v-for="(macro, index) in this['printer/getMacros']" v-bind:key="index+99" small color="primary" class="mx-1 mt-3" :loading="loadings.includes('macro_'+macro.name)" @click="doSendMacro(macro.name)">{{ macro.name.replace(/_/g, " ") }}</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
@@ -93,32 +93,32 @@
|
||||
},
|
||||
methods: {
|
||||
doHome() {
|
||||
this.$store.commit('server/addEvent', "G28");
|
||||
this.$store.commit('server/addEvent', { message: "G28", type: 'command' });
|
||||
this.$store.commit('socket/addLoading', { name: 'homeAll' });
|
||||
this.$socket.sendObj('printer.gcode.script', { script: "G28" }, "socket/removeLoading", { name: 'homeAll' });
|
||||
},
|
||||
doHomeX() {
|
||||
this.$store.commit('server/addEvent', "G28 X");
|
||||
this.$store.commit('server/addEvent', { message: "G28 X", type: 'command' });
|
||||
this.$store.commit('socket/addLoading', { name: 'homeX' });
|
||||
this.$socket.sendObj('printer.gcode.script', { script: "G28 X" }, "socket/removeLoading", { name: 'homeX' });
|
||||
},
|
||||
doHomeY() {
|
||||
this.$store.commit('server/addEvent', "G28 Y");
|
||||
this.$store.commit('server/addEvent', { message: "G28 Y", type: 'command' });
|
||||
this.$store.commit('socket/addLoading', { name: 'homeY' });
|
||||
this.$socket.sendObj('printer.gcode.script', { script: "G28 Y" }, "socket/removeLoading", { name: 'homeY' });
|
||||
},
|
||||
doHomeZ() {
|
||||
this.$store.commit('server/addEvent', "G28 Z");
|
||||
this.$store.commit('server/addEvent', { message: "G28 Z", type: 'command' });
|
||||
this.$store.commit('socket/addLoading', { name: 'homeZ' });
|
||||
this.$socket.sendObj('printer.gcode.script', { script: "G28 Z" }, "socket/removeLoading", { name: 'homeZ' });
|
||||
},
|
||||
doQGL() {
|
||||
this.$store.commit('server/addEvent', "QUAD_GANTRY_LEVEL");
|
||||
this.$store.commit('server/addEvent', { message: "QUAD_GANTRY_LEVEL", type: 'command' });
|
||||
this.$store.commit('socket/addLoading', { name: 'qgl' });
|
||||
this.$socket.sendObj('printer.gcode.script', { script: "QUAD_GANTRY_LEVEL" }, "socket/removeLoading", { name: 'qgl' });
|
||||
},
|
||||
doZtilt() {
|
||||
this.$store.commit('server/addEvent', "Z_TILT_ADJUST");
|
||||
this.$store.commit('server/addEvent', { message: "Z_TILT_ADJUST", type: 'command' });
|
||||
this.$store.commit('socket/addLoading', { name: 'zTilt' });
|
||||
this.$socket.sendObj('printer.gcode.script', { script: "Z_TILT_ADJUST" }, "socket/removeLoading", { name: 'zTilt' });
|
||||
},
|
||||
@@ -130,11 +130,11 @@
|
||||
this.doSend(gcode);
|
||||
},
|
||||
doSend(gcode) {
|
||||
this.$store.commit('server/addEvent', gcode);
|
||||
this.$store.commit('server/addEvent', { message: gcode, type: 'command' });
|
||||
Vue.prototype.$socket.sendObj('printer.gcode.script', { script: gcode }, "server/getGcodeRespond");
|
||||
},
|
||||
doSendMacro(gcode) {
|
||||
this.$store.commit('server/addEvent', gcode);
|
||||
this.$store.commit('server/addEvent', { message: gcode, type: 'command' });
|
||||
this.$store.commit('socket/addLoading', { name: 'macro_'+gcode });
|
||||
Vue.prototype.$socket.sendObj('printer.gcode.script', { script: gcode }, "socket/removeLoading", { name: 'macro_'+gcode });
|
||||
},
|
||||
|
||||
@@ -4,26 +4,28 @@
|
||||
|
||||
<template>
|
||||
<v-card v-if="(['standby', 'paused', 'complete'].includes(printer_state))">
|
||||
<v-row class="px-3">
|
||||
<v-col class="col-12 col-md-6">
|
||||
<v-label>Feed amount in mm:</v-label>
|
||||
<v-btn-toggle class="mt-2" dense no-gutters style="flex-wrap: nowrap; width: 100%;" >
|
||||
<v-btn v-for="amount in feedAmounts" v-bind:key="amount" @click="setFeedAmount(amount)" dense :class="(amount === feedAmount ? 'v-btn--active' : '') + ' btnMinWidthAuto flex-grow-1 px-0 _btnFeedrate'">{{ amount }}</v-btn>
|
||||
</v-btn-toggle>
|
||||
</v-col>
|
||||
<v-col class="col-12 col-md-6">
|
||||
<v-label>Feedrate in mm/s:</v-label>
|
||||
<v-btn-toggle class="mt-2" dense no-gutters style="flex-wrap: nowrap; width: 100%;" >
|
||||
<v-btn v-for="rate in feedrates" v-bind:key="rate" @click="setFeedrate(rate)" dense :class="(feedrate === rate ? 'v-btn--active' : '') + ' btnMinWidthAuto flex-grow-1 px-0 _btnFeedrate'">{{ rate }}</v-btn>
|
||||
</v-btn-toggle>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="px-3">
|
||||
<v-col class="col-12 text-center">
|
||||
<v-btn small @click="sendRetract()" class="mx-2" :loading="loadings.includes('btnRetract')" :disabled="!this['printer/getExtrudePossible']"><v-icon small class="mr-1">mdi-arrow-up-bold</v-icon> Retract</v-btn>
|
||||
<v-btn small @click="sendDetract()" class="mx-2" :loading="loadings.includes('btnDetract')" :disabled="!this['printer/getExtrudePossible']"><v-icon small class="mr-1">mdi-arrow-down-bold</v-icon> Extrude</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-container>
|
||||
<v-row class="">
|
||||
<v-col class="col col-md-6">
|
||||
<v-label>Feed amount in mm:</v-label>
|
||||
<v-btn-toggle class="mt-2" dense no-gutters style="flex-wrap: nowrap; width: 100%;" >
|
||||
<v-btn v-for="amount in feedAmounts" v-bind:key="amount" @click="setFeedAmount(amount)" dense :class="(amount === feedAmount ? 'v-btn--active' : '') + ' btnMinWidthAuto flex-grow-1 px-0 _btnFeedrate'">{{ amount }}</v-btn>
|
||||
</v-btn-toggle>
|
||||
</v-col>
|
||||
<v-col class="col col-md-6">
|
||||
<v-label>Feedrate in mm/s:</v-label>
|
||||
<v-btn-toggle class="mt-2" dense no-gutters style="flex-wrap: nowrap; width: 100%;" >
|
||||
<v-btn v-for="rate in feedrates" v-bind:key="rate" @click="setFeedrate(rate)" dense :class="(feedrate === rate ? 'v-btn--active' : '') + ' btnMinWidthAuto flex-grow-1 px-0 _btnFeedrate'">{{ rate }}</v-btn>
|
||||
</v-btn-toggle>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="">
|
||||
<v-col class="col text-center">
|
||||
<v-btn small @click="sendRetract()" class="mx-2" :loading="loadings.includes('btnRetract')" :disabled="!this['printer/getExtrudePossible']"><v-icon small class="mr-1">mdi-arrow-up-bold</v-icon> Retract</v-btn>
|
||||
<v-btn small @click="sendDetract()" class="mx-2" :loading="loadings.includes('btnDetract')" :disabled="!this['printer/getExtrudePossible']"><v-icon small class="mr-1">mdi-arrow-down-bold</v-icon> Extrude</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
@@ -63,13 +65,13 @@
|
||||
},
|
||||
sendRetract() {
|
||||
let gcode = "M83\nG1 E-"+this.feedAmount+" F"+(this.feedrate * 60);
|
||||
this.$store.commit('server/addEvent', gcode);
|
||||
this.$store.commit('server/addEvent', { message: gcode, type: 'command' });
|
||||
this.$store.commit('socket/addLoading', { name: 'btnRetract' });
|
||||
Vue.prototype.$socket.sendObj('printer.gcode.script', { script: gcode }, "socket/removeLoading", { name: 'btnRetract' });
|
||||
},
|
||||
sendDetract() {
|
||||
let gcode = "M83\nG1 E"+this.feedAmount+" F"+(this.feedrate * 60);
|
||||
this.$store.commit('server/addEvent', gcode);
|
||||
this.$store.commit('server/addEvent', { message: gcode, type: 'command' });
|
||||
this.$store.commit('socket/addLoading', { name: 'btnDetract' });
|
||||
Vue.prototype.$socket.sendObj('printer.gcode.script', { script: gcode }, "socket/removeLoading", { name: 'btnDetract' });
|
||||
},
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
<style>
|
||||
.v-card.disabledPrinter {
|
||||
opacity: 0.6;
|
||||
filter: grayscale(70%);
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-card
|
||||
:class="(!printer.socket.isConnected && !printer.socket.isConnecting ? 'disabledPrinter' : '')"
|
||||
:loading="printer.socket.isConnecting"
|
||||
@click="clickPrinter"
|
||||
>
|
||||
<v-toolbar flat dense :color="isCurrentPrinter ? 'primary' : ''">
|
||||
<v-toolbar-title>
|
||||
<span class="subheading"><v-icon left>mdi-printer-3d</v-icon>{{ printer_name }}</span>
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
<v-img
|
||||
height="200px"
|
||||
:src="printer_image"
|
||||
class="d-flex align-end"
|
||||
>
|
||||
<v-card-title class="white--text py-2" style="background-color: rgba(0,0,0,0.3); backdrop-filter: blur(3px);">
|
||||
<v-row>
|
||||
<v-col class="col-auto pr-0 d-flex align-center" style="width: 58px">
|
||||
<img class="my-auto" :src="printer_logo" style="width: 100%;" />
|
||||
</v-col>
|
||||
<v-col class="col" style="width: 100px">
|
||||
<h3 class="font-weight-regular">{{ printer_status }}</h3>
|
||||
<span class="subtitle-2 text-truncate px-0 text--disabled d-block" v-if="printer_current_filename !== ''"><v-icon small class="mr-1">mdi-file-outline</v-icon>{{ printer_current_filename }}</span>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-title>
|
||||
</v-img>
|
||||
<v-card-text class="px-0 py-2" v-if="printer_preview.length">
|
||||
<v-container class="py-0">
|
||||
<v-row>
|
||||
<v-col :class="object.name === 'ETA' ? 'col-auto' : 'col' + ' px-2'" v-for="object in printer_preview" v-bind:key="object.name">
|
||||
<strong class="d-block text-center">{{ object.name }}</strong>
|
||||
<span class="d-block text-center">{{ object.value }}</span>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
||||
},
|
||||
props: {
|
||||
printer: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
remoteMode: state => state.socket.remoteMode
|
||||
}),
|
||||
isCurrentPrinter: {
|
||||
get() {
|
||||
return this.$store.getters["farm/"+this.printer._namespace+"/isCurrentPrinter"]
|
||||
}
|
||||
},
|
||||
printer_name: {
|
||||
get() {
|
||||
return this.$store.getters["farm/"+this.printer._namespace+"/getPrinterName"]
|
||||
}
|
||||
},
|
||||
printer_status: {
|
||||
get() {
|
||||
return this.$store.getters["farm/"+this.printer._namespace+"/getStatus"]
|
||||
}
|
||||
},
|
||||
printer_current_filename: {
|
||||
get() {
|
||||
return this.$store.getters["farm/"+this.printer._namespace+"/getCurrentFilename"]
|
||||
}
|
||||
},
|
||||
printer_image: {
|
||||
get() {
|
||||
return this.$store.getters["farm/"+this.printer._namespace+"/getImage"]
|
||||
}
|
||||
},
|
||||
printer_logo: {
|
||||
get() {
|
||||
return this.$store.getters["farm/"+this.printer._namespace+"/getLogo"]
|
||||
}
|
||||
},
|
||||
printer_position: {
|
||||
get() {
|
||||
return this.$store.getters["farm/"+this.printer._namespace+"/getPosition"]
|
||||
}
|
||||
},
|
||||
printer_preview: {
|
||||
get() {
|
||||
return this.$store.getters["farm/"+this.printer._namespace+"/getPrinterPreview"]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickPrinter() {
|
||||
if (this.printer.socket.isConnected) this.changePrinter()
|
||||
else this.reconnectPrinter()
|
||||
},
|
||||
changePrinter() {
|
||||
if (this.remoteMode) this.$store.dispatch('changePrinter', { printer: this.printer._namespace })
|
||||
else window.location.href = "//"+this.printer.socket.hostname+(parseInt(this.printer.socket.webPort) !== 80 ? ':'+this.printer.socket.webPort : '')
|
||||
},
|
||||
reconnectPrinter() {
|
||||
this.$store.dispatch("farm/"+this.printer._namespace+"/reconnect")
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -15,8 +15,8 @@
|
||||
</v-card-text>
|
||||
<v-divider class="my-2" v-if="klippy_connected" ></v-divider>
|
||||
<v-card-text class="px-4 pt-2 pb-4 content text-center text-lg-left" v-if="klippy_connected">
|
||||
<v-btn small @click="doRestart" color="error" class=""><v-icon class="mr-sm-2">mdi-cached</v-icon>Restart</v-btn>
|
||||
<v-btn small @click="doRestartFirmware" class="ml-4" color="error"><v-icon class="mr-sm-2">mdi-cached</v-icon>FIRMWARE Restart</v-btn>
|
||||
<v-btn small @click="doRestart" color="error" class=""><v-icon class="mr-sm-2">mdi-restart</v-icon>Restart</v-btn>
|
||||
<v-btn small @click="doRestartFirmware" class="ml-4" color="error"><v-icon class="mr-sm-2">mdi-restart</v-icon>FIRMWARE Restart</v-btn>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
!boolMacroResume ||
|
||||
!boolMacroCancelPrint
|
||||
">
|
||||
<v-toolbar flat dense>
|
||||
<v-toolbar flat dense color="orange darken-2">
|
||||
<v-toolbar-title>
|
||||
<span class="subheading">
|
||||
<v-icon class="mdi mdi-alert-circle" left></v-icon>Missing configuration
|
||||
@@ -19,13 +19,15 @@
|
||||
<v-card-text class="px-0 pt-0 pb-2 content">
|
||||
<v-layout wrap class=" text-center">
|
||||
<v-flex col class="text-left">
|
||||
<p v-if="!boolVirtualSdcard"><code>virtual_sdcard</code> is not defined in config.</p>
|
||||
<p v-if="!boolPauseResume"><code>pause_resume</code> is not defined in config.</p>
|
||||
<p v-if="!boolDisplayStatus"><code>display_status</code> is not defined in config.</p>
|
||||
<p v-if="!boolMacroPause"><code>gcode_macro PAUSE</code> is not defined in config.</p>
|
||||
<p v-if="!boolMacroResume"><code>gcode_macro RESUME</code> is not defined in config.</p>
|
||||
<p v-if="!boolMacroCancelPrint"><code>gcode_macro CANCEL_PRINT</code> is not defined in config.</p>
|
||||
<p class="mb-0"><a href="https://meteyou.github.io/mainsail/necessary-configuration" target="_blank">Here you will find more information.</a></p>
|
||||
<p v-if="!boolVirtualSdcard" class="orange--text"><code>virtual_sdcard</code> is not defined in config.</p>
|
||||
<p v-if="!boolPauseResume" class="orange--text"><code>pause_resume</code> is not defined in config.</p>
|
||||
<p v-if="!boolDisplayStatus" class="orange--text"><code>display_status</code> is not defined in config.</p>
|
||||
<p v-if="!boolMacroPause" class="orange--text"><code>gcode_macro PAUSE</code> is not defined in config.</p>
|
||||
<p v-if="!boolMacroResume" class="orange--text"><code>gcode_macro RESUME</code> is not defined in config.</p>
|
||||
<p v-if="!boolMacroCancelPrint" class="orange--text"><code>gcode_macro CANCEL_PRINT</code> is not defined in config.</p>
|
||||
<div class="text-center">
|
||||
<v-btn href="https://docs.mainsail.xyz/necessary-configuration" target="_blank" color="white" outlined small><v-icon small class="mr-1">mdi-information</v-icon>more information</v-btn>
|
||||
</div>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<v-spacer></v-spacer>
|
||||
<v-menu :offset-y="true" :close-on-content-click="false" title="Setup Console">
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-btn small class="px-2 minwidth-0" color="lightgray" v-bind="attrs" v-on="on"><v-icon small>mdi-cog</v-icon></v-btn>
|
||||
<v-btn small class="px-2 minwidth-0" color="grey darken-3" v-bind="attrs" v-on="on"><v-icon small>mdi-cog</v-icon></v-btn>
|
||||
</template>
|
||||
<v-list>
|
||||
<v-list-item class="minHeight36">
|
||||
@@ -40,29 +40,31 @@
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</v-toolbar>
|
||||
<v-card-text class="py-0">
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-text-field
|
||||
label="Send code..."
|
||||
ref="gcodeCommandField"
|
||||
solo
|
||||
hide-details
|
||||
autocomplete="off"
|
||||
v-model="gcode"
|
||||
v-on:keyup.enter="doSend"
|
||||
v-on:keyup.up="onKeyUp"
|
||||
v-on:keyup.down="onKeyDown"
|
||||
:items="items"
|
||||
v-on:keydown.tab="getAutocomplete"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col class="col-auto align-content-center">
|
||||
<v-btn color="info" class="gcode-command-btn" @click="doSend" :loading="loadings.includes('sendGcode')" :disabled="loadings.includes('sendGcode')" >
|
||||
<v-icon class="mr-2">mdi-send</v-icon> send
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-card-text>
|
||||
<v-container class="py-0 px-0">
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-text-field
|
||||
label="Send code..."
|
||||
ref="gcodeCommandField"
|
||||
solo
|
||||
hide-details
|
||||
autocomplete="off"
|
||||
v-model="gcode"
|
||||
v-on:keyup.enter="doSend"
|
||||
v-on:keyup.up="onKeyUp"
|
||||
v-on:keyup.down="onKeyDown"
|
||||
:items="items"
|
||||
v-on:keydown.tab="getAutocomplete"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col class="col-auto align-content-center">
|
||||
<v-btn color="info" class="gcode-command-btn" @click="doSend" :loading="loadings.includes('sendGcode')" :disabled="loadings.includes('sendGcode')" >
|
||||
<v-icon class="mr-2">mdi-send</v-icon> send
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
<v-card-text class="px-0 py-0 content">
|
||||
<v-divider></v-divider>
|
||||
@@ -163,7 +165,7 @@ import {mapState} from 'vuex'
|
||||
methods: {
|
||||
doSend() {
|
||||
this.$store.commit('socket/addLoading', { name: 'sendGcode' });
|
||||
this.$store.commit('server/addEvent', this.gcode);
|
||||
this.$store.commit('server/addEvent', { message: this.gcode, type: 'command' });
|
||||
Vue.prototype.$socket.sendObj('printer.gcode.script', { script: this.gcode }, "socket/removeLoading", { name: 'sendGcode' });
|
||||
this.lastCommands.push(this.gcode);
|
||||
this.gcode = "";
|
||||
@@ -198,7 +200,7 @@ import {mapState} from 'vuex'
|
||||
let output = "";
|
||||
commands.forEach(command => output += "<b>"+command.command+":</b> "+command.description+"<br />");
|
||||
|
||||
this.$store.commit('server/addEvent', output);
|
||||
this.$store.commit('server/addEvent', { message: output, type: 'command' });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,15 +27,15 @@
|
||||
<v-divider></v-divider>
|
||||
<tool-slider label="Extrusion factor" :target="extrude_factor" :max="200" :multi="100" :step="1" command="M221" attribute-name="S" ></tool-slider>
|
||||
</v-card>
|
||||
<v-card class="mt-6" v-if="this['printer/getFans'].length">
|
||||
<v-card class="mt-6" v-if="this['printer/getMiscellaneous'].length">
|
||||
<v-toolbar flat dense >
|
||||
<v-toolbar-title>
|
||||
<span class="subheading"><v-icon :class="'mdi mdi-fan '+(this['printer/getPartFanSpeed'] ? 'icon-rotate' : '')" left></v-icon>Fans</span>
|
||||
<span class="subheading"><v-icon left>mdi-dip-switch</v-icon>Miscellaneous</span>
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
<div v-for="(fan, index) of this['printer/getFans']" v-bind:key="index">
|
||||
<div v-for="(object, index) of this['printer/getMiscellaneous']" v-bind:key="index">
|
||||
<v-divider v-if="index"></v-divider>
|
||||
<fan-slider :name="fan.name" :type="fan.type" :target="fan.speed" :controllable="fan.controllable" :multi="100" class="py-0" ></fan-slider>
|
||||
<miscellaneous-slider :name="object.name" :type="object.type" :target="object.power" :controllable="object.controllable" :pwm="object.pwm" :multi="parseInt(object.scale)" ></miscellaneous-slider>
|
||||
</div>
|
||||
</v-card>
|
||||
</div>
|
||||
@@ -43,12 +43,12 @@
|
||||
|
||||
<script>
|
||||
import { mapState, mapGetters } from 'vuex'
|
||||
import FanSlider from '../../inputs/FanSlider'
|
||||
import ToolSlider from '../../inputs/ToolSlider'
|
||||
import MiscellaneousSlider from "@/inputs/MiscellaneousSlider";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
FanSlider,
|
||||
MiscellaneousSlider,
|
||||
ToolSlider
|
||||
},
|
||||
data () {
|
||||
@@ -63,8 +63,7 @@
|
||||
printer_state: state => state.printer.print_stats.state,
|
||||
}),
|
||||
...mapGetters([
|
||||
'printer/getFans',
|
||||
'printer/getPartFanSpeed',
|
||||
'printer/getMiscellaneous',
|
||||
]),
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<template>
|
||||
<v-card
|
||||
class="mb-6">
|
||||
<v-toolbar flat dense color="orange darken-2">
|
||||
<v-toolbar-title>
|
||||
<span class="subheading">
|
||||
<v-icon class="mdi mdi-alert-circle" left></v-icon>Moonraker Failed Plugins
|
||||
</span>
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
<v-card-text class="px-0 pt-0 pb-2 content">
|
||||
<v-layout wrap class=" text-center">
|
||||
<v-flex col class="text-left">
|
||||
<p class="orange--text">An error was detected while loading the moonraker plugins. Please check the logfile and fix the issue.</p>
|
||||
<p class="mb-2 orange--text">Following plugin has an error:</p>
|
||||
<ul class="mt-0 pt-0">
|
||||
<li v-for="plugin in failedPlugins" v-bind:key="plugin" class="orange--text"><code>{{ plugin }}</code></li>
|
||||
</ul>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-card-text class="px-4 pt-2 pb-4 content text-center text-lg-left">
|
||||
<v-btn small :href="'//'+hostname+':'+port+'/server/files/moonraker.log'" color="primary" class=""><v-icon class="mr-2">mdi-download</v-icon>Download Log</v-btn>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex';
|
||||
|
||||
export default {
|
||||
data: () => ({
|
||||
|
||||
}),
|
||||
computed: {
|
||||
...mapState({
|
||||
failedPlugins: state => state.server.failed_plugins,
|
||||
hostname: state => state.socket.hostname,
|
||||
port: state => state.socket.port,
|
||||
}),
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -25,158 +25,186 @@
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
Config Files
|
||||
<v-spacer class="d-none d-sm-block"></v-spacer>
|
||||
<input type="file" ref="fileUpload" style="display: none" @change="uploadFile" />
|
||||
<v-item-group class="v-btn-toggle my-5 my-sm-0 col-12 col-sm-auto px-0 py-0">
|
||||
<v-btn v-if="currentPath !== '' && currentPath !== '/config_examples'" class="flex-grow-1" @click="uploadFileButton" :loading="loadings.includes['configFileUpload']"><v-icon>mdi-file-upload</v-icon></v-btn>
|
||||
<v-btn v-if="currentPath !== '' && currentPath !== '/config_examples'" class="flex-grow-1" @click="createFile"><v-icon>mdi-file-plus</v-icon></v-btn>
|
||||
<v-btn v-if="currentPath !== '' && currentPath !== '/config_examples'" class="flex-grow-1" @click="createFolder"><v-icon>mdi-folder-plus</v-icon></v-btn>
|
||||
<v-btn class="flex-grow-1" @click="refreshFileList"><v-icon>mdi-refresh</v-icon></v-btn>
|
||||
<v-menu :offset-y="true" title="Setup current list">
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-btn class="flex-grow-1" v-bind="attrs" v-on="on"><v-icon class="">mdi-cog</v-icon></v-btn>
|
||||
</template>
|
||||
<v-list>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox class="mt-0" hide-details v-model="showHiddenFiles" label="Hidden files"></v-checkbox>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</v-item-group>
|
||||
</v-card-title>
|
||||
<v-card-subtitle>Current path: {{ this.currentPath === "" ? "/" : this.currentPath }}</v-card-subtitle>
|
||||
<v-data-table
|
||||
:items="files"
|
||||
class="files-table"
|
||||
:headers="headers"
|
||||
:options="options"
|
||||
:page.sync="currentPage"
|
||||
:custom-sort="sortFiles"
|
||||
:sort-by.sync="sortBy"
|
||||
:sort-desc.sync="sortDesc"
|
||||
:items-per-page.sync="countPerPage"
|
||||
:footer-props="{
|
||||
itemsPerPageText: 'Files'
|
||||
}"
|
||||
mobile-breakpoint="0"
|
||||
item-key="name">
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
Config Files
|
||||
<v-spacer class="d-none d-sm-block"></v-spacer>
|
||||
<input type="file" ref="fileUpload" style="display: none" multiple @change="uploadFile" />
|
||||
<v-item-group class="v-btn-toggle my-5 my-sm-0 col-12 col-sm-auto px-0 py-0">
|
||||
<v-btn v-if="currentPath !== '' && currentPath !== '/config_examples'" class="flex-grow-1" @click="uploadFileButton" :loading="loadings.includes['configFileUpload']"><v-icon>mdi-file-upload</v-icon></v-btn>
|
||||
<v-btn v-if="currentPath !== '' && currentPath !== '/config_examples'" class="flex-grow-1" @click="createFile"><v-icon>mdi-file-plus</v-icon></v-btn>
|
||||
<v-btn v-if="currentPath !== '' && currentPath !== '/config_examples'" class="flex-grow-1" @click="createFolder"><v-icon>mdi-folder-plus</v-icon></v-btn>
|
||||
<v-btn class="flex-grow-1" @click="refreshFileList"><v-icon>mdi-refresh</v-icon></v-btn>
|
||||
<v-menu :offset-y="true" title="Setup current list">
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-btn class="flex-grow-1" v-bind="attrs" v-on="on"><v-icon class="">mdi-cog</v-icon></v-btn>
|
||||
</template>
|
||||
<v-list>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox class="mt-0" hide-details v-model="showHiddenFiles" label="Hidden files"></v-checkbox>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</v-item-group>
|
||||
</v-card-title>
|
||||
<v-card-subtitle>Current path: {{ this.currentPath === "" ? "/" : this.currentPath }}</v-card-subtitle>
|
||||
<v-data-table
|
||||
:items="files"
|
||||
class="files-table"
|
||||
:headers="headers"
|
||||
:options="options"
|
||||
:page.sync="currentPage"
|
||||
:custom-sort="sortFiles"
|
||||
:sort-by.sync="sortBy"
|
||||
:sort-desc.sync="sortDesc"
|
||||
:items-per-page.sync="countPerPage"
|
||||
:footer-props="{
|
||||
itemsPerPageText: 'Files'
|
||||
}"
|
||||
mobile-breakpoint="0"
|
||||
item-key="name">
|
||||
|
||||
<template #no-data>
|
||||
<div class="text-center">empty</div>
|
||||
</template>
|
||||
<template #no-data>
|
||||
<div class="text-center">empty</div>
|
||||
</template>
|
||||
|
||||
<template slot="body.prepend" v-if="(currentPath !== '')">
|
||||
<tr
|
||||
class="file-list-cursor"
|
||||
@click="clickRowGoBack">
|
||||
<td class=" "><v-icon>mdi-folder-upload</v-icon></td>
|
||||
<td class=" " colspan="8">..</td>
|
||||
</tr>
|
||||
</template>
|
||||
<template slot="body.prepend" v-if="(currentPath !== '')">
|
||||
<tr
|
||||
class="file-list-cursor"
|
||||
@click="clickRowGoBack">
|
||||
<td class="pr-0 text-center" style="width: 32px;"><v-icon>mdi-folder-upload</v-icon></td>
|
||||
<td class=" " colspan="8">..</td>
|
||||
</tr>
|
||||
</template>
|
||||
|
||||
<template #item="{ item }">
|
||||
<tr
|
||||
@contextmenu="showContextMenu($event, item)"
|
||||
@click="clickRow(item)"
|
||||
class="file-list-cursor"
|
||||
:data-name="item.filename">
|
||||
<td class=" ">
|
||||
<v-icon v-if="item.isDirectory">mdi-folder</v-icon>
|
||||
<v-icon v-if="!item.isDirectory">mdi-file</v-icon>
|
||||
</td>
|
||||
<td class=" ">{{ item.filename }}</td>
|
||||
<td class="text-no-wrap text-right">{{ item.isDirectory ? '--' : formatFilesize(item.size) }}</td>
|
||||
<td class="text-right">{{ formatDate(item.modified) }}</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-card>
|
||||
<v-menu v-model="contextMenu.shown" :position-x="contextMenu.x" :position-y="contextMenu.y" absolute offset-y>
|
||||
<v-list>
|
||||
<v-list-item @click="clickRow(contextMenu.item)" v-if="!contextMenu.item.isDirectory">
|
||||
<v-icon class="mr-1">mdi-file-document-edit-outline</v-icon> Edit file
|
||||
</v-list-item>
|
||||
<v-list-item @click="downloadFile" v-if="!contextMenu.item.isDirectory">
|
||||
<v-icon class="mr-1">mdi-cloud-download</v-icon> Download
|
||||
</v-list-item>
|
||||
<v-list-item @click="renameFile(contextMenu.item)" v-if="!contextMenu.item.isDirectory && currentPath !== '/config_examples'">
|
||||
<v-icon class="mr-1">mdi-rename-box</v-icon> Rename
|
||||
</v-list-item>
|
||||
<v-list-item @click="removeFile" v-if="!contextMenu.item.isDirectory && currentPath !== '/config_examples'">
|
||||
<v-icon class="mr-1">mdi-delete</v-icon> Delete
|
||||
</v-list-item>
|
||||
<v-list-item @click="deleteDirectoryAction" v-if="contextMenu.item.isDirectory && currentPath !== '' && currentPath !== '/config_examples'">
|
||||
<v-icon class="mr-1">mdi-delete</v-icon> Delete
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
<v-dialog v-model="editor.showLoader" hide-overlay persistent width="300" >
|
||||
<v-card color="primary" dark >
|
||||
<v-card-text>
|
||||
Please stand by
|
||||
<v-progress-linear indeterminate color="white" class="mb-0" ></v-progress-linear>
|
||||
</v-card-text>
|
||||
<template #item="{ item }">
|
||||
<tr
|
||||
@contextmenu="showContextMenu($event, item)"
|
||||
@click="clickRow(item)"
|
||||
class="file-list-cursor"
|
||||
:data-name="item.filename">
|
||||
<td class="pr-0 text-center" style="width: 32px;">
|
||||
<v-icon v-if="item.isDirectory">mdi-folder</v-icon>
|
||||
<v-icon v-if="!item.isDirectory">mdi-file</v-icon>
|
||||
</td>
|
||||
<td class=" ">{{ item.filename }}</td>
|
||||
<td class="text-no-wrap text-right">{{ item.isDirectory ? '--' : formatFilesize(item.size) }}</td>
|
||||
<td class="text-right">{{ formatDate(item.modified) }}</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="editor.show" fullscreen hide-overlay transition="dialog-bottom-transition" content-class="config-editor-overlay">
|
||||
<v-card d-flex>
|
||||
<v-toolbar dark color="primary">
|
||||
<v-btn icon dark @click="editor.show = false">
|
||||
<v-icon>mdi-close</v-icon>
|
||||
<v-menu v-model="contextMenu.shown" :position-x="contextMenu.x" :position-y="contextMenu.y" absolute offset-y>
|
||||
<v-list>
|
||||
<v-list-item @click="clickRow(contextMenu.item)" v-if="!contextMenu.item.isDirectory">
|
||||
<v-icon class="mr-1">mdi-file-document-edit-outline</v-icon> Edit file
|
||||
</v-list-item>
|
||||
<v-list-item @click="downloadFile" v-if="!contextMenu.item.isDirectory">
|
||||
<v-icon class="mr-1">mdi-cloud-download</v-icon> Download
|
||||
</v-list-item>
|
||||
<v-list-item @click="renameFile(contextMenu.item)" v-if="!contextMenu.item.isDirectory && currentPath !== '/config_examples'">
|
||||
<v-icon class="mr-1">mdi-rename-box</v-icon> Rename
|
||||
</v-list-item>
|
||||
<v-list-item @click="removeFile" v-if="!contextMenu.item.isDirectory && currentPath !== '/config_examples'">
|
||||
<v-icon class="mr-1">mdi-delete</v-icon> Delete
|
||||
</v-list-item>
|
||||
<v-list-item @click="deleteDirectoryAction" v-if="contextMenu.item.isDirectory && currentPath !== '' && currentPath !== '/config_examples'">
|
||||
<v-icon class="mr-1">mdi-delete</v-icon> Delete
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
<v-dialog v-model="editor.showLoader" hide-overlay persistent width="300" >
|
||||
<v-card color="primary" dark >
|
||||
<v-card-text>
|
||||
Please stand by
|
||||
<v-progress-linear indeterminate color="white" class="mb-0" ></v-progress-linear>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="editor.show" fullscreen hide-overlay transition="dialog-bottom-transition" content-class="config-editor-overlay">
|
||||
<v-card d-flex>
|
||||
<v-toolbar dark color="primary">
|
||||
<v-btn icon dark @click="editor.show = false">
|
||||
<v-icon>mdi-close</v-icon>
|
||||
</v-btn>
|
||||
<v-toolbar-title>{{ editor.item.filename }}</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-toolbar-items>
|
||||
<v-btn dark text href="https://www.klipper3d.org/Config_Reference.html" target="_blank" class="d-none d-md-flex"><v-icon small class="mr-1">mdi-help</v-icon>Config Reference</v-btn>
|
||||
<v-btn dark text @click="saveFile(false)" v-if="currentPath !== '/config_examples'"><v-icon small class="mr-1">mdi-content-save</v-icon><span class="d-none d-sm-inline">Save</span></v-btn>
|
||||
<v-btn dark text @click="saveFile(true)" v-if="currentPath !== '/config_examples' && !['printing', 'paused'].includes(printer_state)" class="d-none d-sm-flex"><v-icon small class="mr-1">mdi-restart</v-icon>Save & restart</v-btn>
|
||||
</v-toolbar-items>
|
||||
</v-toolbar>
|
||||
<prism-editor class="my-editor" v-model="editor.sourcecode" :readonly="editor.readonly" :highlight="highlighter" line-numbers></prism-editor>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogRenameFile.show" max-width="400">
|
||||
<v-card>
|
||||
<v-card-title class="headline">Rename File</v-card-title>
|
||||
<v-card-text>
|
||||
<v-text-field label="Name" required v-model="dialogRenameFile.newName"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="" text @click="dialogRenameFile.show = false">Cancel</v-btn>
|
||||
<v-btn color="primary" text @click="renameFileAction">rename</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogCreateFile.show" max-width="400">
|
||||
<v-card>
|
||||
<v-card-title class="headline">Create File</v-card-title>
|
||||
<v-card-text>
|
||||
<v-text-field label="Name" required v-model="dialogCreateFile.name"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="" text @click="dialogCreateFile.show = false">Cancel</v-btn>
|
||||
<v-btn color="primary" text @click="createFileAction">create</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogCreateFolder.show" max-width="400">
|
||||
<v-card>
|
||||
<v-card-title class="headline">Create Folder</v-card-title>
|
||||
<v-card-text>
|
||||
<v-text-field label="Name" required v-model="dialogCreateFolder.name"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="" text @click="dialogCreateFolder.show = false">Cancel</v-btn>
|
||||
<v-btn color="primary" text @click="createFolderAction">create</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-snackbar
|
||||
:timeout="-1"
|
||||
:value="true"
|
||||
fixed
|
||||
right
|
||||
bottom
|
||||
dark
|
||||
v-model="uploadSnackbar.status"
|
||||
>
|
||||
<span v-if="uploadSnackbar.max > 1" class="mr-1">({{ uploadSnackbar.number }}/{{ uploadSnackbar.max }})</span><strong>Uploading {{ uploadSnackbar.filename }}</strong><br />
|
||||
{{ Math.round(uploadSnackbar.percent) }} % @ {{ formatFilesize(Math.round(uploadSnackbar.speed)) }}/s<br />
|
||||
<v-progress-linear class="mt-2" :value="uploadSnackbar.percent"></v-progress-linear>
|
||||
<template v-slot:action="{ attrs }">
|
||||
<v-btn
|
||||
color="red"
|
||||
text
|
||||
v-bind="attrs"
|
||||
@click="cancelUpload"
|
||||
style="min-width: auto;"
|
||||
>
|
||||
<v-icon class="0">mdi-close</v-icon>
|
||||
</v-btn>
|
||||
<v-toolbar-title>{{ editor.item.filename }}</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-toolbar-items>
|
||||
<v-btn dark text @click="saveFile" v-if="currentPath !== '/config_examples'">Save</v-btn>
|
||||
</v-toolbar-items>
|
||||
</v-toolbar>
|
||||
<prism-editor class="my-editor" v-model="editor.sourcecode" :readonly="editor.readonly" :highlight="highlighter" line-numbers></prism-editor>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogRenameFile.show" max-width="400">
|
||||
<v-card>
|
||||
<v-card-title class="headline">Rename File</v-card-title>
|
||||
<v-card-text>
|
||||
<v-text-field label="Name" required v-model="dialogRenameFile.newName"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="" text @click="dialogRenameFile.show = false">Cancel</v-btn>
|
||||
<v-btn color="primary" text @click="renameFileAction">rename</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogCreateFile.show" max-width="400">
|
||||
<v-card>
|
||||
<v-card-title class="headline">Create File</v-card-title>
|
||||
<v-card-text>
|
||||
<v-text-field label="Name" required v-model="dialogCreateFile.name"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="" text @click="dialogCreateFile.show = false">Cancel</v-btn>
|
||||
<v-btn color="primary" text @click="createFileAction">create</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogCreateFolder.show" max-width="400">
|
||||
<v-card>
|
||||
<v-card-title class="headline">Create Folder</v-card-title>
|
||||
<v-card-text>
|
||||
<v-text-field label="Name" required v-model="dialogCreateFolder.name"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="" text @click="dialogCreateFolder.show = false">Cancel</v-btn>
|
||||
<v-btn color="primary" text @click="createFolderAction">create</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
</v-snackbar>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -243,6 +271,20 @@
|
||||
show: false,
|
||||
name: "",
|
||||
},
|
||||
uploadSnackbar: {
|
||||
status: false,
|
||||
filename: "",
|
||||
percent: 0,
|
||||
speed: 0,
|
||||
total: 0,
|
||||
number: 0,
|
||||
max: 0,
|
||||
cancelTokenSource: "",
|
||||
lastProgress: {
|
||||
time: 0,
|
||||
loaded: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -251,6 +293,7 @@
|
||||
hostname: state => state.socket.hostname,
|
||||
port: state => state.socket.port,
|
||||
loadings: state => state.socket.loadings,
|
||||
printer_state: state => state.printer.print_stats.state,
|
||||
}),
|
||||
countPerPage: {
|
||||
get: function() {
|
||||
@@ -337,7 +380,7 @@
|
||||
|
||||
this.files = findDirectory(this.filetree, dirArray);
|
||||
if (dirArray.length === 1 && this.currentPath === "") {
|
||||
this.files = this.files.filter(element => element.filename !== "gcodes");
|
||||
this.files = this.files.filter(element => !["gcodes", "docs"].includes(element.filename))
|
||||
}
|
||||
|
||||
if (!this.showHiddenFiles) {
|
||||
@@ -367,7 +410,7 @@
|
||||
clickRowGoBack: function() {
|
||||
this.currentPath = this.currentPath.substr(0, this.currentPath.lastIndexOf("/"));
|
||||
},
|
||||
saveFile: function() {
|
||||
saveFile: function(boolRestart = false) {
|
||||
let file = new File([this.editor.sourcecode], this.editor.item.filename);
|
||||
|
||||
let formData = new FormData();
|
||||
@@ -383,6 +426,13 @@
|
||||
this.$toast.success("File '"+this.editor.item.filename+"' successfully saved.");
|
||||
this.editor.show = false;
|
||||
this.editor.sourcecode = "";
|
||||
|
||||
if (boolRestart && this.editor.item.filename === "moonraker.conf") {
|
||||
this.$socket.sendObj('machine.services.restart', { service: "moonraker" })
|
||||
} else if (boolRestart) {
|
||||
this.$store.commit('server/addEvent', { message: "FIRMWARE_RESTART", type: 'command' })
|
||||
this.$socket.sendObj('printer.gcode.script', { script: "FIRMWARE_RESTART" })
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$toast.error("Error save "+this.editor.item.filename);
|
||||
});
|
||||
@@ -401,7 +451,7 @@
|
||||
let filename = (this.currentPath+"/"+this.contextMenu.item.filename);
|
||||
let link = document.createElement("a");
|
||||
link.download = name;
|
||||
link.href = '//' + this.hostname + ':' + this.port + '/server/files/' + filename;
|
||||
link.href = '//' + this.hostname + ':' + this.port + '/server/files' + filename;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
@@ -453,14 +503,7 @@
|
||||
}, 'files/getMove');
|
||||
},
|
||||
removeFile() {
|
||||
let filename = (this.currentPath+"/"+this.contextMenu.item.filename);
|
||||
axios.delete(
|
||||
'//'+ this.hostname + ':' + this.port +'/server/files/'+filename
|
||||
).then((result) => {
|
||||
this.$toast.success(result.data.result+" successfully deleted.");
|
||||
}).catch(() => {
|
||||
this.$toast.error("Error! Cannot delete file.");
|
||||
});
|
||||
this.$socket.sendObj('server.files.delete_file', { path: this.currentPath+"/"+this.contextMenu.item.filename }, 'files/getDeleteFile');
|
||||
},
|
||||
deleteDirectoryAction: function() {
|
||||
this.$socket.sendObj('server.files.delete_directory', { path: this.currentPath+"/"+this.contextMenu.item.filename }, 'files/getDeleteDir');
|
||||
@@ -468,30 +511,75 @@
|
||||
uploadFileButton: function() {
|
||||
this.$refs.fileUpload.click()
|
||||
},
|
||||
uploadFile: function() {
|
||||
async uploadFile() {
|
||||
if (this.$refs.fileUpload.files.length) {
|
||||
this.doUploadFile(this.$refs.fileUpload.files[0]).finally(() => {
|
||||
this.$refs.fileUpload.value = ''
|
||||
})
|
||||
this.$store.commit('socket/addLoading', { name: 'configFileUpload' })
|
||||
let successFiles = []
|
||||
this.uploadSnackbar.number = 0
|
||||
this.uploadSnackbar.max = this.$refs.fileUpload.files.length
|
||||
for (const file of this.$refs.fileUpload.files) {
|
||||
this.uploadSnackbar.number++
|
||||
const result = await this.doUploadFile(file)
|
||||
successFiles.push(result)
|
||||
}
|
||||
|
||||
this.$store.commit('socket/removeLoading', { name: 'configFileUpload' })
|
||||
for(const file of successFiles) {
|
||||
this.$toast.success("Upload of "+file+" successful!")
|
||||
}
|
||||
|
||||
this.$refs.fileUpload.value = ''
|
||||
}
|
||||
},
|
||||
doUploadFile: function(file) {
|
||||
let toast = this.$toast;
|
||||
let formData = new FormData();
|
||||
let filename = file.name.replace(" ", "_");
|
||||
|
||||
this.uploadSnackbar.filename = filename
|
||||
this.uploadSnackbar.status = true
|
||||
this.uploadSnackbar.percent = 0
|
||||
this.uploadSnackbar.speed = 0
|
||||
this.uploadSnackbar.lastProgress.loaded = 0
|
||||
this.uploadSnackbar.lastProgress.time = 0
|
||||
|
||||
formData.append('root', 'config');
|
||||
formData.append('file', file, (this.currentPath+"/"+filename).substring(7));
|
||||
this.$store.commit('socket/addLoading', { name: 'configFileUpload' });
|
||||
|
||||
return axios.post('//' + this.hostname + ':' + this.port + '/server/files/upload',
|
||||
formData, { headers: { 'Content-Type': 'multipart/form-data' } }
|
||||
).then((result) => {
|
||||
this.$store.commit('socket/removeLoading', { name: 'configFileUpload' });
|
||||
toast.success("Upload of "+result.data.result+" successful!");
|
||||
}).catch(() => {
|
||||
this.$store.commit('socket/removeLoading', { name: 'configFileUpload' });
|
||||
toast.error("Cannot upload the file!");
|
||||
});
|
||||
return new Promise(resolve => {
|
||||
this.uploadSnackbar.cancelTokenSource = axios.CancelToken.source();
|
||||
axios.post('//' + this.hostname + ':' + this.port + '/server/files/upload',
|
||||
formData, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
cancelToken: this.uploadSnackbar.cancelTokenSource.token,
|
||||
onUploadProgress: (progressEvent) => {
|
||||
this.uploadSnackbar.percent = (progressEvent.loaded * 100) / progressEvent.total
|
||||
if (this.uploadSnackbar.lastProgress.time) {
|
||||
const time = progressEvent.timeStamp - this.uploadSnackbar.lastProgress.time
|
||||
const data = progressEvent.loaded - this.uploadSnackbar.lastProgress.loaded
|
||||
|
||||
if (time) this.uploadSnackbar.speed = data / (time / 1000)
|
||||
}
|
||||
|
||||
this.uploadSnackbar.lastProgress.time = progressEvent.timeStamp
|
||||
this.uploadSnackbar.lastProgress.loaded = progressEvent.loaded
|
||||
this.uploadSnackbar.total = progressEvent.total
|
||||
}
|
||||
}
|
||||
).then((result) => {
|
||||
this.uploadSnackbar.status = false
|
||||
resolve(result.data.result)
|
||||
}).catch(() => {
|
||||
this.uploadSnackbar.status = false
|
||||
this.$store.commit('socket/removeLoading', { name: 'configFileUpload' });
|
||||
toast.error("Cannot upload the file!");
|
||||
})
|
||||
})
|
||||
},
|
||||
cancelUpload: function() {
|
||||
this.uploadSnackbar.cancelTokenSource.cancel()
|
||||
this.uploadSnackbar.status = false
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
|
||||
@@ -10,26 +10,29 @@
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
<v-card-text class="py-3">
|
||||
<v-row>
|
||||
<v-col class="py-0">
|
||||
<v-switch v-model="hideWaitTemperatures" label="Hide temperatures" hide-details class="mt-1"></v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="py-0">
|
||||
<v-switch v-model="boolCustomFilters" label="Custom filter" hide-details class="mt-1"></v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-if="boolCustomFilters">
|
||||
<v-col class="">
|
||||
<v-textarea
|
||||
outlined
|
||||
label="Rules"
|
||||
v-model="customFilters"
|
||||
hide-details
|
||||
></v-textarea>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-container px-0 py-0>
|
||||
<v-row>
|
||||
<v-col class="py-2">
|
||||
<v-switch v-model="hideWaitTemperatures" label="Hide temperatures" hide-details class="mt-0"></v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="py-2">
|
||||
<v-switch v-model="boolCustomFilters" label="Custom filter" hide-details class="mt-0"></v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-if="boolCustomFilters">
|
||||
<v-col class="py-2">
|
||||
<v-textarea
|
||||
outlined
|
||||
label="Rules"
|
||||
v-model="customFilters"
|
||||
hide-details
|
||||
class="mb-2"
|
||||
></v-textarea>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
<style>
|
||||
.settings_dashboard_switch .v-messages {
|
||||
display: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-card>
|
||||
<v-toolbar flat dense >
|
||||
<v-toolbar-title>
|
||||
<span class="subheading"><v-icon left>mdi-view-dashboard</v-icon>Dashbaord</span>
|
||||
<span class="subheading"><v-icon left>mdi-view-dashboard</v-icon>Dashboard</span>
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
<v-card-text class="py-3">
|
||||
<v-row>
|
||||
<v-col class="py-0">
|
||||
<v-switch v-model="boolShowWebcamOnDashboard" label="Webcam" class="settings_dashboard_switch mt-0"></v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="py-0">
|
||||
<v-switch v-model="boolShowTempchartOnDashboard" label="Tempchart" class="settings_dashboard_switch mt-0"></v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="py-0">
|
||||
<v-switch v-model="boolShowConsoleOnDashboard" label="Console" class="settings_dashboard_switch mt-0"></v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-card-text>
|
||||
<v-container px-0 py-0>
|
||||
<v-row>
|
||||
<v-col class="py-2">
|
||||
<v-switch v-model="boolShowWebcamOnDashboard" label="Webcam" hide-details class="mt-0"></v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="py-2">
|
||||
<v-switch v-model="boolShowTempchartOnDashboard" label="Tempchart" hide-details class="mt-0"></v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="py-2">
|
||||
<v-switch v-model="boolShowConsoleOnDashboard" label="Console" hide-details class="mt-0"></v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
@@ -6,19 +6,19 @@
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
<v-card-text class="pb-0">
|
||||
<div v-for="(status, index) of sortEndstops" v-bind:key="index">
|
||||
<v-row>
|
||||
<v-col class="py-2">
|
||||
<v-container px-0 py-0>
|
||||
<v-row v-for="(status, index) of sortEndstops" v-bind:key="index">
|
||||
<v-col>
|
||||
<label class="mt-1 d-inline-block">Endstop <b>{{ index.toUpperCase() }}</b></label>
|
||||
<v-chip class="float-right" :color="status === 'open' ? 'green' : 'red' " text-color="white">{{ status }}</v-chip>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
<v-row v-if="(Object.keys(endstops).length === 0 && endstops.constructor === Object)" >
|
||||
<v-col class="py-0">
|
||||
<p>Press the sync-button on the right-bottom to load the current endstop status.</p>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-if="(Object.keys(endstops).length === 0 && endstops.constructor === Object)" >
|
||||
<v-col>
|
||||
<p>Press the sync-button on the right-bottom to load the current endstop status.</p>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
|
||||
@@ -11,15 +11,11 @@
|
||||
<span class="subheading"><v-icon left>mdi-cog</v-icon>General</span>
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
<v-card-text class="py-0">
|
||||
<v-row>
|
||||
<v-col class="pt-2 pb-0">
|
||||
<v-text-field
|
||||
v-model="printerName"
|
||||
label="Printer Name"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-card-text class="pt-2 pb-0">
|
||||
<v-text-field
|
||||
v-model="printerName"
|
||||
label="Printer Name"
|
||||
></v-text-field>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
@@ -6,14 +6,16 @@
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
<v-card-text :class="'text-center text-lg-left py-0'">
|
||||
<v-row>
|
||||
<v-col :class="'col-12' +(klippy_state !== 'ready' ? 'col-md-6' : 'col-md-12')+ ''">
|
||||
<v-btn :href="'//'+hostname+':'+port+'/server/files/klippy.log'" block color="primary"><v-icon class="mr-2">mdi-download</v-icon>Klipper</v-btn>
|
||||
</v-col>
|
||||
<v-col :class="'col-12 pt-0 ' +(klippy_state !== 'ready' ? 'col-md-6 mt-md-3 ' : 'col-md-12')+ ''">
|
||||
<v-btn :href="'//'+hostname+':'+port+'/server/files/moonraker.log'" block color="primary"><v-icon class="mr-2">mdi-download</v-icon>Moonraker</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-container pb-0 px-0>
|
||||
<v-row>
|
||||
<v-col :class="'col-12' +(klippy_state !== 'ready' ? 'col-md-6' : 'col-md-12')+ ''">
|
||||
<v-btn :href="'//'+hostname+':'+port+'/server/files/klippy.log'" block color="primary"><v-icon class="mr-2">mdi-download</v-icon>Klipper</v-btn>
|
||||
</v-col>
|
||||
<v-col :class="'col-12 pt-0 ' +(klippy_state !== 'ready' ? 'col-md-6 mt-md-3 ' : 'col-md-12')+ ''">
|
||||
<v-btn :href="'//'+hostname+':'+port+'/server/files/moonraker.log'" block color="primary"><v-icon class="mr-2">mdi-download</v-icon>Moonraker</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
<v-card-text class="py-3">
|
||||
<div v-for="(macro, index) in this['printer/getAllMacros']" v-bind:key="index">
|
||||
<v-row>
|
||||
<v-col class="py-0">
|
||||
<v-container px-0 py-0>
|
||||
<v-row v-for="(macro, index) in this['printer/getAllMacros']" v-bind:key="index">
|
||||
<v-col class="py-2">
|
||||
<settings-macro-switch :name="macro.name"></settings-macro-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
@@ -0,0 +1,320 @@
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<v-card>
|
||||
<v-toolbar flat dense >
|
||||
<v-toolbar-title>
|
||||
<span class="subheading"><v-icon left>mdi-fire</v-icon>Preheat Presets</span>
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
<v-card-text class="py-3">
|
||||
<v-container>
|
||||
<v-row v-for="(preset, index) in this['gui/getPreheatPresets']" v-bind:key="index">
|
||||
<v-col class="rounded transition-swing secondary py-2 px-2 mb-6" style="cursor: pointer;">
|
||||
<v-row align="center">
|
||||
<v-col class="pl-6">
|
||||
<strong>{{ preset.name }}</strong>
|
||||
</v-col>
|
||||
<v-col class="col-6">
|
||||
<div v-for="[key, value] in Object.entries(preset.values)" v-bind:key="key">
|
||||
<span class="text-no-wrap" v-if="value.bool" >{{ convertPresetName(key, value) }}: {{ value.value }}°C</span>
|
||||
</div>
|
||||
</v-col>
|
||||
<v-col class="col-auto text-right"><v-btn small class="minwidth-0 float-right" v-on:click.stop.prevent="editPreset(preset)"><v-icon small>mdi-pencil</v-icon></v-btn></v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="rounded transition-swing secondary py-2 px-2 mb-6" style="cursor: pointer;">
|
||||
<v-row align="center">
|
||||
<v-col class="pl-6">
|
||||
<strong>Cooldown</strong>
|
||||
</v-col>
|
||||
<v-col class="col-auto text-right"><v-btn small class="minwidth-0 float-right" v-on:click.stop.prevent="editCooldown"><v-icon small>mdi-pencil</v-icon></v-btn></v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="text-center mt-0">
|
||||
<v-btn @click="createPreset">add preset</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
<v-dialog v-model="dialog.bool" persistent :width="600">
|
||||
<v-card dark>
|
||||
<v-toolbar flat dense color="primary">
|
||||
<v-toolbar-title>
|
||||
<span class="subheading">
|
||||
<v-icon class="mdi mdi-fire" left></v-icon>
|
||||
{{ dialog.index === null ? "Create" : "Edit" }} Preset
|
||||
</span>
|
||||
</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn small class="minwidth-0" @click="dialog.bool = false"><v-icon small>mdi-close-thick</v-icon></v-btn>
|
||||
</v-toolbar>
|
||||
<v-card-text class="pt-3">
|
||||
<v-container class="pb-0">
|
||||
<v-form
|
||||
v-model="dialog.valid"
|
||||
@submit.prevent="savePreset"
|
||||
>
|
||||
<template v-if="dialog.bool">
|
||||
<v-row>
|
||||
<v-col class="col-6">
|
||||
<v-row>
|
||||
<v-col class="col-12">
|
||||
<v-text-field
|
||||
v-model="dialog.name"
|
||||
label="Name"
|
||||
hide-details="auto"
|
||||
:rules="[rules.required, rules.unique]"
|
||||
dense
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="mt-2 mx-0 mb-2" v-for="(heater) of this['printer/getHeaters']" v-bind:key="heater.name" align="center">
|
||||
<v-checkbox
|
||||
v-model="dialog.values[heater.name].bool"
|
||||
hide-details
|
||||
class="shrink mt-0"
|
||||
></v-checkbox>
|
||||
<v-text-field
|
||||
v-model="dialog.values[heater.name].value"
|
||||
:label="convertName(heater.name)"
|
||||
hide-details="auto"
|
||||
type="number"
|
||||
suffix="°C"
|
||||
></v-text-field>
|
||||
</v-row>
|
||||
<v-row class="mt-2 mx-0 mb-2" v-for="(fan) of this['printer/getTemperatureFans']" v-bind:key="'temperature_fan '+fan.name" align="center">
|
||||
<v-checkbox
|
||||
v-model="dialog.values['temperature_fan '+fan.name].bool"
|
||||
hide-details
|
||||
class="shrink mt-0"
|
||||
></v-checkbox>
|
||||
<v-text-field
|
||||
v-model="dialog.values['temperature_fan '+fan.name].value"
|
||||
:label="convertName(fan.name)"
|
||||
hide-details="auto"
|
||||
type="number"
|
||||
suffix="°C"
|
||||
></v-text-field>
|
||||
</v-row>
|
||||
</v-col>
|
||||
<v-col class="col-6">
|
||||
<v-textarea
|
||||
outlined
|
||||
name="input-7-4"
|
||||
label="Custom G-Code"
|
||||
v-model="dialog.gcode"
|
||||
hide-details="auto"
|
||||
></v-textarea>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="mt-3" v-if="dialog.boolInvalidMin">
|
||||
<v-col class="py-0">
|
||||
<v-alert dense text type="error">You have to set minimum a target temperature or a custom gcode.</v-alert>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="mt-3">
|
||||
<v-col class="text-center">
|
||||
<v-btn
|
||||
color="red"
|
||||
outlined
|
||||
class="float-left minwidth-0"
|
||||
@click="deletePreset"
|
||||
v-if="this.dialog.index !== null"
|
||||
>
|
||||
<v-icon>mdi-delete</v-icon>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
color="white"
|
||||
outlined
|
||||
:class="dialog.index !== null ? 'float-right' : '' "
|
||||
type="submit"
|
||||
>
|
||||
{{ dialog.index === null ? "store" : "update" }} preset
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
</v-form>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="cooldownDialog.bool" persistent :width="300">
|
||||
<v-card dark>
|
||||
<v-toolbar flat dense color="primary">
|
||||
<v-toolbar-title>
|
||||
<span class="subheading">
|
||||
<v-icon class="mdi mdi-fire" left></v-icon> Edit Cooldown
|
||||
</span>
|
||||
</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn small class="minwidth-0" @click="cooldownDialog.bool = false"><v-icon small>mdi-close-thick</v-icon></v-btn>
|
||||
</v-toolbar>
|
||||
<v-card-text class="pt-3">
|
||||
<v-container class="pb-0">
|
||||
<v-form
|
||||
v-model="cooldownDialog.valid"
|
||||
@submit.prevent="saveCooldown"
|
||||
>
|
||||
<v-row>
|
||||
<v-col class="col-12">
|
||||
<v-textarea
|
||||
outlined
|
||||
name="input-7-4"
|
||||
label="Custom G-Code"
|
||||
v-model="cooldownDialog.gcode"
|
||||
:rules="[rules.required]"
|
||||
></v-textarea>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="text-center">
|
||||
<v-btn
|
||||
color="white"
|
||||
outlined
|
||||
type="submit"
|
||||
>
|
||||
update cooldown
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-form>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState, mapGetters } from 'vuex';
|
||||
import {convertName} from "@/plugins/helpers";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
dialog: {
|
||||
bool: false,
|
||||
valid: false,
|
||||
name: "",
|
||||
gcode: "",
|
||||
index: null,
|
||||
boolInvalidMin: false,
|
||||
values: {},
|
||||
},
|
||||
rules: {
|
||||
required: (value) => value !== '' || 'required',
|
||||
unique: (value) => !this.existsPresetName(value) || 'Name already exists',
|
||||
},
|
||||
cooldownDialog: {
|
||||
bool: false,
|
||||
gcode: "",
|
||||
valid: false,
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
orgState: state => state.gui.presets,
|
||||
cooldownGcode: state => state.gui.cooldownGcode,
|
||||
}),
|
||||
...mapGetters([
|
||||
'printer/getHeaters',
|
||||
'printer/getTemperatureFans',
|
||||
'gui/getPreheatPresets',
|
||||
])
|
||||
},
|
||||
mounted() {
|
||||
this.clearDialog()
|
||||
},
|
||||
methods: {
|
||||
convertName: convertName,
|
||||
convertPresetName(name, value) {
|
||||
if (value.type === "temperature_fan") name = name.replace("temperature_fan ", "")
|
||||
|
||||
return this.convertName(name)
|
||||
},
|
||||
existsPresetName(name) {
|
||||
return (this["gui/getPreheatPresets"].findIndex((preset) => preset.name === name && preset.index !== this.dialog.index) >= 0)
|
||||
},
|
||||
createPreset() {
|
||||
this.clearDialog()
|
||||
this.dialog.bool = true
|
||||
},
|
||||
clearDialog() {
|
||||
this.dialog.bool = false
|
||||
this.dialog.index = null
|
||||
this.dialog.name = ""
|
||||
this.dialog.gcode = ""
|
||||
this.dialog.boolInvalidMin = false
|
||||
this.dialog.values = {}
|
||||
|
||||
for(const heater of this["printer/getHeaters"]) {
|
||||
this.dialog.values[heater.name] = {
|
||||
bool: true,
|
||||
value: 0,
|
||||
type: 'heater',
|
||||
}
|
||||
}
|
||||
|
||||
for(const fan of this["printer/getTemperatureFans"]) {
|
||||
this.dialog.values['temperature_fan '+fan.name] = {
|
||||
bool: true,
|
||||
value: 0,
|
||||
type: 'temperature_fan',
|
||||
}
|
||||
}
|
||||
},
|
||||
editPreset(preset) {
|
||||
this.dialog.name = preset.name
|
||||
this.dialog.index = preset.index
|
||||
this.dialog.gcode = preset.gcode
|
||||
this.dialog.values = {...preset.values}
|
||||
this.dialog.bool = true
|
||||
},
|
||||
savePreset() {
|
||||
let setValues = 0
|
||||
for (const key of Object.keys(this.dialog.values)) {
|
||||
if (this.dialog.values[key].bool) setValues++
|
||||
}
|
||||
if (this.dialog.gcode.length) setValues++
|
||||
|
||||
if (setValues === 0) this.dialog.boolInvalidMin = true
|
||||
else if (this.dialog.valid) {
|
||||
for (const key of Object.keys(this.dialog.values)) {
|
||||
this.dialog.values[key].value = parseInt(this.dialog.values[key].value)
|
||||
}
|
||||
|
||||
if (this.dialog.index) {
|
||||
this.$store.dispatch('gui/updatePreset', this.dialog )
|
||||
} else this.$store.dispatch('gui/addPreset', this.dialog )
|
||||
|
||||
this.clearDialog()
|
||||
}
|
||||
},
|
||||
deletePreset() {
|
||||
this.$store.dispatch('gui/deletePreset', this.dialog )
|
||||
this.clearDialog()
|
||||
},
|
||||
editCooldown() {
|
||||
this.cooldownDialog.gcode = this.cooldownGcode
|
||||
this.cooldownDialog.bool = true
|
||||
},
|
||||
saveCooldown() {
|
||||
if (this.cooldownDialog.valid) {
|
||||
this.$store.dispatch("gui/setSettings", {cooldownGcode: this.cooldownDialog.gcode})
|
||||
this.cooldownDialog.bool = false
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,339 @@
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<v-card>
|
||||
<v-toolbar flat dense >
|
||||
<v-toolbar-title>
|
||||
<span class="subheading"><v-icon left>mdi-printer-3d</v-icon>Remote Printers</span>
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
<v-card-text class="py-3">
|
||||
<v-container>
|
||||
<v-row v-for="(printer, index) in this['farm/getPrinters']" v-bind:key="index">
|
||||
<v-col class="rounded transition-swing secondary py-2 px-2 mb-6" style="cursor: pointer;">
|
||||
<v-row align="center">
|
||||
<v-col class="col-auto pr-0">
|
||||
<v-progress-circular
|
||||
indeterminate
|
||||
color="primary"
|
||||
v-if="printer.socket.isConnecting"
|
||||
></v-progress-circular>
|
||||
<v-icon
|
||||
:color="printer.socket.isConnected ? 'green' : 'red'"
|
||||
v-if="!printer.socket.isConnecting"
|
||||
>mdi-{{ printer.socket.isConnected ? 'checkbox-marked-circle' : 'cancel' }}</v-icon>
|
||||
</v-col>
|
||||
<v-col>{{ printer.socket.hostname }}{{ parseInt(printer.socket.port) !== 80 ? ":"+printer.socket.port : "" }}</v-col>
|
||||
<v-col class="col-auto"><v-btn small class="minwidth-0" v-on:click.stop.prevent="editPrinter(index)"><v-icon small>mdi-pencil</v-icon></v-btn></v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="text-center mt-0">
|
||||
<v-btn @click="dialogAddPrinter.bool = true">add printer</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
<v-dialog v-model="dialogAddPrinter.bool" persistent :width="400">
|
||||
<v-card dark>
|
||||
<v-toolbar flat dense color="primary">
|
||||
<v-toolbar-title>
|
||||
<span class="subheading">
|
||||
<v-icon class="mdi mdi-connection" left></v-icon>
|
||||
Add Printer
|
||||
</span>
|
||||
</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn small class="minwidth-0" @click="dialogAddPrinter.bool = false"><v-icon small>mdi-close-thick</v-icon></v-btn>
|
||||
</v-toolbar>
|
||||
<v-card-text class="pt-3" v-if="remoteMode">
|
||||
<v-container class="px-0 py-0">
|
||||
<v-row>
|
||||
<v-col class="col-8">
|
||||
<v-text-field
|
||||
v-model="dialogAddPrinter.hostname"
|
||||
:rules="[
|
||||
v => !!v || 'Hostname is required',
|
||||
v => !v.startsWith('http:') || 'invalid hostname/IP',
|
||||
v => !v.startsWith('https:') || 'invalid hostname/IP',
|
||||
]"
|
||||
label="Hostname/IP"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col class="col-4">
|
||||
<v-text-field
|
||||
v-model="dialogAddPrinter.port"
|
||||
:rules="[v => !!v || 'Port is required']"
|
||||
label="Port"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="text-right">
|
||||
<v-btn
|
||||
color="white"
|
||||
outlined
|
||||
class="middle"
|
||||
@click="addPrinter"
|
||||
>
|
||||
add printer
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
<v-card-text class="pt-3" v-if="!remoteMode">
|
||||
<v-container class="px-0 py-0">
|
||||
<v-row>
|
||||
<v-col class="col-12">
|
||||
<v-text-field
|
||||
v-model="dialogAddPrinter.hostname"
|
||||
:rules="[
|
||||
v => !!v || 'Hostname is required',
|
||||
v => !v.startsWith('http:') || 'invalid hostname/IP',
|
||||
v => !v.startsWith('https:') || 'invalid hostname/IP',
|
||||
]"
|
||||
label="Hostname/IP"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="col-6">
|
||||
<v-text-field
|
||||
v-model="dialogAddPrinter.webPort"
|
||||
:rules="[v => !!v || 'Web-Port is required']"
|
||||
label="Web-Port"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col class="col-6">
|
||||
<v-text-field
|
||||
v-model="dialogAddPrinter.port"
|
||||
:rules="[v => !!v || 'API-Port is required']"
|
||||
label="API-Port"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="text-right">
|
||||
<v-btn
|
||||
color="white"
|
||||
outlined
|
||||
class="middle"
|
||||
@click="addPrinter"
|
||||
>
|
||||
add printer
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogEditPrinter.bool" persistent :width="400">
|
||||
<v-card dark>
|
||||
<v-toolbar flat dense color="primary">
|
||||
<v-toolbar-title>
|
||||
<span class="subheading">
|
||||
<v-icon class="mdi mdi-connection" left></v-icon>
|
||||
Edit Printer
|
||||
</span>
|
||||
</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn small class="minwidth-0" @click="dialogEditPrinter.bool = false"><v-icon small>mdi-close-thick</v-icon></v-btn>
|
||||
</v-toolbar>
|
||||
<v-card-text class="pt-3" v-if="remoteMode">
|
||||
<v-container class="px-0 py-0">
|
||||
<v-row>
|
||||
<v-col class="col-8">
|
||||
<v-text-field
|
||||
v-model="dialogEditPrinter.hostname"
|
||||
:rules="[
|
||||
v => !!v || 'Hostname is required',
|
||||
v => !v.startsWith('http:') || 'invalid hostname/IP',
|
||||
v => !v.startsWith('https:') || 'invalid hostname/IP',
|
||||
]"
|
||||
label="Hostname/IP"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col class="col-4">
|
||||
<v-text-field
|
||||
v-model="dialogEditPrinter.port"
|
||||
:rules="[v => !!v || 'Port is required']"
|
||||
label="Port"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="">
|
||||
<v-btn
|
||||
color="red"
|
||||
outlined
|
||||
class="middle minwidth-0"
|
||||
@click="delPrinter"
|
||||
>
|
||||
<v-icon small>mdi-delete</v-icon>
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col class="text-right">
|
||||
<v-btn
|
||||
color="white"
|
||||
outlined
|
||||
class="middle"
|
||||
@click="updatePrinter"
|
||||
>
|
||||
update printer
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
<v-card-text class="pt-3" v-if="!remoteMode">
|
||||
<v-container class="px-0 py-0">
|
||||
<v-row>
|
||||
<v-col class="col-12">
|
||||
<v-text-field
|
||||
v-model="dialogEditPrinter.hostname"
|
||||
:rules="[
|
||||
v => !!v || 'Hostname is required',
|
||||
v => !v.startsWith('http:') || 'invalid hostname/IP',
|
||||
v => !v.startsWith('https:') || 'invalid hostname/IP',
|
||||
]"
|
||||
label="Hostname/IP"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="col-6">
|
||||
<v-text-field
|
||||
v-model="dialogEditPrinter.webPort"
|
||||
:rules="[v => !!v || 'Web-Port is required']"
|
||||
label="Web-Port"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col class="col-6">
|
||||
<v-text-field
|
||||
v-model="dialogEditPrinter.port"
|
||||
:rules="[v => !!v || 'API-Port is required']"
|
||||
label="API-Port"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="">
|
||||
<v-btn
|
||||
color="red"
|
||||
outlined
|
||||
class="middle minwidth-0"
|
||||
@click="delPrinter"
|
||||
>
|
||||
<v-icon small>mdi-delete</v-icon>
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col class="text-right">
|
||||
<v-btn
|
||||
color="white"
|
||||
outlined
|
||||
class="middle"
|
||||
@click="updatePrinter"
|
||||
>
|
||||
update printer
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState, mapGetters } from 'vuex';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
dialogAddPrinter: {
|
||||
bool: false,
|
||||
hostname: "",
|
||||
port: "7125",
|
||||
webPort: "80"
|
||||
},
|
||||
dialogEditPrinter: {
|
||||
bool: false,
|
||||
hostname: "",
|
||||
port: "",
|
||||
webPort: "80",
|
||||
index: ""
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
remoteMode: state => state.socket.remoteMode,
|
||||
protocol: state => state.socket.protocol,
|
||||
}),
|
||||
...mapGetters([
|
||||
'farm/getPrinters',
|
||||
])
|
||||
},
|
||||
methods: {
|
||||
addPrinter() {
|
||||
this.$store.commit('farm/addPrinter',{
|
||||
hostname: this.dialogAddPrinter.hostname,
|
||||
port: this.dialogAddPrinter.port,
|
||||
webPort: this.dialogAddPrinter.webPort,
|
||||
protocol: this.protocol
|
||||
})
|
||||
|
||||
this.dialogAddPrinter.hostname = ""
|
||||
this.dialogAddPrinter.port = "7125"
|
||||
this.dialogAddPrinter.webPort = "80"
|
||||
this.dialogAddPrinter.bool = false
|
||||
|
||||
this.$store.dispatch("farm/savePrinters")
|
||||
},
|
||||
editPrinter(index) {
|
||||
this.dialogEditPrinter.hostname = this["farm/getPrinters"][index].socket.hostname
|
||||
this.dialogEditPrinter.port = this["farm/getPrinters"][index].socket.port
|
||||
this.dialogEditPrinter.webPort = this["farm/getPrinters"][index].socket.webPort
|
||||
this.dialogEditPrinter.index = index
|
||||
this.dialogEditPrinter.bool = true
|
||||
},
|
||||
updatePrinter() {
|
||||
this.$store.commit("farm/"+this.dialogEditPrinter.index+"/setSocketData", {
|
||||
hostname: this.dialogEditPrinter.hostname,
|
||||
port: this.dialogEditPrinter.port,
|
||||
webPort: this.dialogEditPrinter.webPort,
|
||||
isConnecting: true,
|
||||
})
|
||||
this.$store.dispatch("farm/"+this.dialogEditPrinter.index+"/reconnect")
|
||||
this.dialogEditPrinter.bool = false
|
||||
|
||||
this.$store.dispatch("farm/savePrinters")
|
||||
},
|
||||
delPrinter() {
|
||||
this.$store.commit("farm/removePrinter", { name: this.dialogEditPrinter.index })
|
||||
this.$store.dispatch("farm/savePrinters")
|
||||
this.dialogEditPrinter.bool = false
|
||||
|
||||
this.$store.dispatch("farm/savePrinters")
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -37,7 +37,7 @@
|
||||
methods: {
|
||||
changeSensor(runout) {
|
||||
const gcode = 'SET_FILAMENT_SENSOR SENSOR='+runout.name+' ENABLE='+(runout.enabled ? 1 : 0)
|
||||
this.$store.commit('server/addEvent', gcode)
|
||||
this.$store.commit('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.sendObj('printer.gcode.script', { script: gcode })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,92 +2,66 @@
|
||||
<v-card>
|
||||
<v-toolbar flat dense >
|
||||
<v-toolbar-title>
|
||||
<span class="subheading"><v-icon left>mdi-update</v-icon>Update</span>
|
||||
<span class="subheading"><v-icon left>mdi-update</v-icon>Update Manager</span>
|
||||
</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-tooltip top>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-btn small class="px-2 minwidth-0" color="primary" :loading="loadings.includes('loadingBtnSyncUpdateManager')" @click="btnSync" v-bind="attrs" v-on="on"><v-icon small>mdi-refresh</v-icon></v-btn>
|
||||
<v-btn small class="px-2 minwidth-0" color="primary" :loading="loadings.includes('loadingBtnSyncUpdateManager')" :disabled="['printing', 'paused'].includes(printer_state)" @click="btnSync" v-bind="attrs" v-on="on"><v-icon small>mdi-refresh</v-icon></v-btn>
|
||||
</template>
|
||||
<span>Check for updates</span>
|
||||
</v-tooltip>
|
||||
</v-toolbar>
|
||||
<v-card-text class="px-0 pt-0 pb-0 content">
|
||||
<v-row v-if="'version' in klipper">
|
||||
<v-col class="pl-6 py-2 text-no-wrap">
|
||||
<strong>Klipper</strong><br />
|
||||
{{ klipper.version }}
|
||||
</v-col>
|
||||
<v-col class="pr-6 py-2 text-right">
|
||||
<v-chip
|
||||
small
|
||||
label
|
||||
outlined
|
||||
:color="getColor(klipper)"
|
||||
@click="updateKlipper"
|
||||
:disabled="is_disabled(klipper)"
|
||||
class="minwidth-0 mt-2 px-2 text-uppercase"
|
||||
><v-icon small class="mr-1">mdi-{{ getIcon(klipper) }}</v-icon>{{ getText(klipper) }}</v-chip>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<div v-if="'version' in moonraker">
|
||||
<v-divider class="mt-0 mb-0" ></v-divider>
|
||||
<v-row>
|
||||
<v-col class="pl-6 py-2 text-no-wrap">
|
||||
<strong>Moonraker</strong><br />
|
||||
{{ moonraker.version }}
|
||||
</v-col>
|
||||
<v-col class="pr-6 py-2 text-right">
|
||||
<v-chip
|
||||
small
|
||||
label
|
||||
outlined
|
||||
:color="getColor(moonraker)"
|
||||
@click="updateMoonraker"
|
||||
:disabled="is_disabled(moonraker)"
|
||||
class="minwidth-0 mt-2 px-2 text-uppercase"
|
||||
><v-icon small class="mr-1">mdi-{{ getIcon(moonraker) }}</v-icon>{{ getText(moonraker) }}</v-chip>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
<div v-if="mainsail !== false && 'version' in mainsail">
|
||||
<v-divider class="mt-0 mb-0" ></v-divider>
|
||||
<v-row>
|
||||
<v-col class="pl-6 py-2 text-no-wrap">
|
||||
<strong>Mainsail</strong><br />
|
||||
{{ 'v'+package_version }}
|
||||
<span v-if="!is_disabled(mainsail)"> > {{ mainsail.remote_version.replace('Version ', 'v') }}</span>
|
||||
</v-col>
|
||||
<v-col class="pr-6 py-2 text-right">
|
||||
<v-chip
|
||||
small
|
||||
label
|
||||
outlined
|
||||
:color="getColor(mainsail)"
|
||||
@click="updateMainsail"
|
||||
:disabled="is_disabled(mainsail)"
|
||||
class="minwidth-0 mt-2 px-2 text-uppercase"
|
||||
><v-icon small class="mr-1">mdi-{{ getIcon(mainsail) }}</v-icon>{{ getText(mainsail) }}</v-chip>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
<v-divider class="mt-0 mb-0 border-top-2" ></v-divider>
|
||||
<v-row>
|
||||
<v-col class="pl-6 py-2 text-no-wrap">
|
||||
<strong>System</strong><br />
|
||||
OS-Packages
|
||||
</v-col>
|
||||
<v-col class="pr-6 py-2 text-right">
|
||||
<v-chip
|
||||
small
|
||||
label
|
||||
outlined
|
||||
color="gray"
|
||||
@click="updateSystem"
|
||||
class="minwidth-0 mt-2 px-2 text-uppercase"
|
||||
><v-icon small class="mr-1">mdi-progress-upload</v-icon>upgrade</v-chip>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-card-text class="px-0 py-0">
|
||||
<v-container py-0 px-0>
|
||||
|
||||
<div v-for="(value, key) of updateableSoftwares" v-bind:key="key">
|
||||
<v-divider class="my-0" ></v-divider>
|
||||
<v-row class="py-2">
|
||||
<v-col class="pl-6 text-no-wrap">
|
||||
{{ 'name' in value ? value.name : key }}<br />
|
||||
{{ getVersionOutput(value) }}
|
||||
</v-col>
|
||||
<v-col class="pr-6 text-right">
|
||||
<v-chip
|
||||
small
|
||||
label
|
||||
outlined
|
||||
:color="getBtnColor(value)"
|
||||
@click="updateModule(key)"
|
||||
:disabled="getBtnDisabled(value)"
|
||||
class="minwidth-0 mt-3 px-2 text-uppercase"
|
||||
><v-icon small class="mr-1">mdi-{{ getBtnIcon(value) }}</v-icon>{{ getBtnText(value) }}</v-chip>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
<div v-if="'system' in version_info">
|
||||
<v-divider class="my-0 border-top-2" ></v-divider>
|
||||
<v-row class="pt-2">
|
||||
<v-col class="pl-6 text-no-wrap">
|
||||
<strong>System</strong><br />
|
||||
<v-tooltip top v-if="version_info.system.package_count > 0" :max-width="300">
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<span v-bind="attrs" v-on="on">{{ version_info.system.package_count }} packages can be upgraded</span>
|
||||
</template>
|
||||
<span>{{ version_info.system.package_list.join(', ') }}</span>
|
||||
</v-tooltip>
|
||||
<span v-if="version_info.system.package_count === 0">OS-Packages</span>
|
||||
</v-col>
|
||||
<v-col class="pr-6 text-right">
|
||||
<v-chip
|
||||
small
|
||||
label
|
||||
outlined
|
||||
:color="version_info.system.package_count ? 'primary' : 'green'"
|
||||
:disabled="!(version_info.system.package_count) || printer_state === 'printing'"
|
||||
@click="updateSystem"
|
||||
class="minwidth-0 mt-3 px-2 text-uppercase"
|
||||
><v-icon small class="mr-1">mdi-{{ version_info.system.package_count ? 'progress-upload' : 'check' }}</v-icon>{{ version_info.system.package_count ? 'upgrade' : 'up-to-date' }}</v-chip>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
@@ -107,16 +81,14 @@
|
||||
computed: {
|
||||
...mapState({
|
||||
package_version: state => state.packageVersion,
|
||||
klipper: state => state.server.updateManager.klipper,
|
||||
moonraker: state => state.server.updateManager.moonraker,
|
||||
loadings: state => state.socket.loadings,
|
||||
remoteMode: state => state.socket.remoteMode,
|
||||
printer_state: state => state.printer.print_stats.state,
|
||||
version_info: state => state.server.updateManager.version_info
|
||||
}),
|
||||
mainsail:{
|
||||
updateableSoftwares: {
|
||||
get() {
|
||||
if ('name' in this.$store.state.server.updateManager.client)
|
||||
return this.$store.state.server.updateManager.client
|
||||
|
||||
return false
|
||||
return this.$store.getters["server/updateManager/getUpdateableSoftwares"]
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -125,82 +97,65 @@
|
||||
this.$store.commit('socket/addLoading', { name: 'loadingBtnSyncUpdateManager' });
|
||||
this.$socket.sendObj('machine.update.status', { refresh: true }, 'server/updateManager/getStatus')
|
||||
},
|
||||
getColor(object) {
|
||||
getBtnColor(object) {
|
||||
if (typeof object === 'object' && object !== false) {
|
||||
if ('detached' in object && object.detached) return 'orange'
|
||||
if ('is_dirty' in object && object.is_dirty) return 'orange'
|
||||
if ('is_valid' in object && !object.is_valid) return 'red'
|
||||
if ('is_dirty' in object && object.is_dirty) return 'red'
|
||||
|
||||
if ('current_hash' in object && 'remote_hash' in object && object.current_hash !== object.remote_hash) return 'primary'
|
||||
|
||||
if ('name' in object && object.name === "mainsail") {
|
||||
let remote_version = object.remote_version.split(' ')
|
||||
remote_version = (remote_version.length > 1) ? remote_version[1] : remote_version[0]
|
||||
|
||||
if (this.package_version !== remote_version) return 'primary'
|
||||
}
|
||||
if ('version' in object && 'remote_version' in object && object.version !== object.remote_version) return 'primary'
|
||||
|
||||
return 'green'
|
||||
}
|
||||
|
||||
return 'red'
|
||||
},
|
||||
getText(object) {
|
||||
getBtnText(object) {
|
||||
if (typeof object === 'object' && object !== false) {
|
||||
if ('detached' in object && object.detached) return 'detached'
|
||||
if ('is_valid' in object && !object.is_valid) return 'invalid'
|
||||
if ('is_dirty' in object && object.is_dirty) return 'dirty'
|
||||
|
||||
if ('current_hash' in object && 'remote_hash' in object && object.current_hash !== object.remote_hash) return 'update'
|
||||
|
||||
if ('name' in object && object.name === "mainsail") {
|
||||
let remote_version = object.remote_version.split(' ')
|
||||
remote_version = (remote_version.length > 1) ? remote_version[1] : remote_version[0]
|
||||
|
||||
if (this.package_version !== remote_version) return 'update'
|
||||
}
|
||||
if ('version' in object && 'remote_version' in object && object.version !== object.remote_version) return 'update'
|
||||
|
||||
return 'up-to-date'
|
||||
}
|
||||
|
||||
return 'ERROR'
|
||||
},
|
||||
getIcon(object) {
|
||||
getBtnIcon(object) {
|
||||
if (typeof object === 'object' && object !== false) {
|
||||
if ('detached' in object && object.detached) return 'alert-circle'
|
||||
if ('is_valid' in object && !object.is_valid) return 'alert-circle'
|
||||
if ('is_dirty' in object && object.is_dirty) return 'alert-circle'
|
||||
|
||||
if ('current_hash' in object && 'remote_hash' in object && object.current_hash !== object.remote_hash) return 'progress-upload'
|
||||
|
||||
if ('name' in object && object.name === "mainsail") {
|
||||
let remote_version = object.remote_version.split(' ')
|
||||
remote_version = (remote_version.length > 1) ? remote_version[1] : remote_version[0]
|
||||
|
||||
if (this.package_version !== remote_version) return 'progress-upload'
|
||||
}
|
||||
if ('version' in object && 'remote_version' in object && object.version !== object.remote_version) return 'progress-upload'
|
||||
|
||||
return 'check'
|
||||
}
|
||||
|
||||
return 'ERROR'
|
||||
},
|
||||
is_disabled(object) {
|
||||
if (typeof object === 'object' && object !== false) {
|
||||
if ('current_hash' in object && 'remote_hash' in object && object.current_hash !== object.remote_hash) return false
|
||||
getBtnDisabled(object) {
|
||||
if (['printing', 'paused'].includes(this.printer_state)) return true
|
||||
if ('detached' in object && object.detached) return true
|
||||
|
||||
if ('name' in object && object.name === "mainsail") {
|
||||
if ('v'+this.package_version !== object.remote_version.replace('Version ', 'v')) return false
|
||||
}
|
||||
if (typeof object === 'object' && object !== false) {
|
||||
if ('is_valid' in object && !object.is_valid) return true
|
||||
if ('version' in object && 'remote_version' in object && object.version !== object.remote_version) return false
|
||||
}
|
||||
|
||||
return true
|
||||
},
|
||||
updateKlipper() {
|
||||
this.$socket.sendObj('machine.update.klipper', { })
|
||||
getVersionOutput(object) {
|
||||
const local_version = 'version' in object ? object.version : '?'
|
||||
const remote_version = 'remote_version' in object ? object.remote_version : '?'
|
||||
|
||||
return local_version !== remote_version ? local_version+" > "+remote_version : local_version
|
||||
},
|
||||
updateMoonraker() {
|
||||
this.$socket.sendObj('machine.update.moonraker', { })
|
||||
},
|
||||
updateMainsail() {
|
||||
this.$socket.sendObj('machine.update.client', { })
|
||||
updateModule(key) {
|
||||
if (["klipper", "moonraker"].includes(key)) this.$socket.sendObj('machine.update.'+key, { })
|
||||
else this.$socket.sendObj('machine.update.client', { name: key })
|
||||
},
|
||||
updateSystem() {
|
||||
this.$socket.sendObj('machine.update.system', { })
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<style>
|
||||
.content { overflow: hidden; }
|
||||
|
||||
</style>
|
||||
|
||||
<template>
|
||||
@@ -10,38 +10,40 @@
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col class="py-0">
|
||||
<v-text-field
|
||||
v-model="webcamUrl"
|
||||
hide-details
|
||||
label="Webcam URL"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-if="rotationEnabled">
|
||||
<v-col class="py-0" col-auto>
|
||||
<v-switch v-model="rotate" hide-details label="Rotate"></v-switch>
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-select :items="[{ text: '90 degrees', value: 90 }, { text: '270 degrees', value: 270 }]" v-model="rotateDegrees" hide-details></v-select>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="py-0">
|
||||
<v-switch v-model="flipX" hide-details label="Flip webcam horizontally"></v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="py-0">
|
||||
<v-switch v-model="flipY" hide-details label="Flip webcam vertically"></v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="py-0">
|
||||
<v-switch v-model="boolNavi" hide-details label="Show in navigation"></v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-container px-0 py-0>
|
||||
<v-row>
|
||||
<v-col class="pt-2 mb-1">
|
||||
<v-text-field
|
||||
v-model="webcamUrl"
|
||||
hide-details
|
||||
label="Webcam URL"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-if="rotationEnabled">
|
||||
<v-col class="py-2" col-auto>
|
||||
<v-switch v-model="rotate" hide-details label="Rotate" class="mt-0"></v-switch>
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-select :items="[{ text: '90 degrees', value: 90 }, { text: '270 degrees', value: 270 }]" v-model="rotateDegrees" hide-details></v-select>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="py-2">
|
||||
<v-switch v-model="flipX" hide-details label="Flip webcam horizontally" class="mt-0"></v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="py-2">
|
||||
<v-switch v-model="flipY" hide-details label="Flip webcam vertically" class="mt-0"></v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="py-2">
|
||||
<v-switch v-model="boolNavi" hide-details label="Show in navigation" class="mt-0"></v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
@@ -11,6 +11,8 @@ import ConfigFilesPanel from "./ConfigFilesPanel";
|
||||
import RunoutPanel from "./RunoutPanel";
|
||||
import LogfilesPanel from "./LogfilesPanel";
|
||||
import UpdatePanel from "./UpdatePanel";
|
||||
import RemotePrintersPanel from "./RemotePrintersPanel";
|
||||
import PresetsPanel from "./PresetsPanel";
|
||||
|
||||
Vue.component('settings-general-panel', GeneralPanel);
|
||||
Vue.component('settings-webcam-panel', WebcamPanel);
|
||||
@@ -23,6 +25,8 @@ Vue.component('settings-runout-panel', RunoutPanel);
|
||||
Vue.component('settings-logfiles-panel', LogfilesPanel);
|
||||
Vue.component('settings-config-files-panel', ConfigFilesPanel);
|
||||
Vue.component('settings-update-panel', UpdatePanel);
|
||||
Vue.component('settings-remote-printers-panel', RemotePrintersPanel);
|
||||
Vue.component('settings-presets-panel', PresetsPanel);
|
||||
|
||||
export default {
|
||||
|
||||
|
||||
@@ -22,109 +22,198 @@
|
||||
</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-item-group class="v-btn-toggle" name="controllers">
|
||||
<v-btn small class="px-2 minwidth-0" color="orange" v-if="printer_state === 'printing'" @click="btnPauseJob" :loading="loadings.includes('statusPrintPause')" title="Pause print"><v-icon small>mdi-pause</v-icon></v-btn>
|
||||
<v-btn small class="px-2 minwidth-0" color="red" v-if="(printer_state === 'paused')" :loading="loadings.includes('statusPrintCancel')" @click="btnCancelJob" title="Cancel print"><v-icon small>mdi-stop</v-icon></v-btn>
|
||||
<v-btn small class="px-2 minwidth-0" color="orange" v-if="(printer_state === 'paused')" :loading="loadings.includes('statusPrintResume')" @click="btnResumeJob" title="Resume job"><v-icon small>mdi-play</v-icon></v-btn>
|
||||
<v-btn small class="px-2 minwidth-0" color="orange" v-if="(printer_state === 'error')" :loading="loadings.includes('statusPrintClear')" @click="btnClearJob" title="Clear job"><v-icon small>mdi-close</v-icon></v-btn>
|
||||
<v-btn small class="px-2 minwidth-0" color="primary" v-if="(printer_state === 'complete')" :loading="loadings.includes('statusPrintReprint')" @click="btnReprintJob" title="Reprint job"><v-icon small>mdi-autorenew</v-icon></v-btn>
|
||||
<v-btn small class="px-2 minwidth-0" color="orange" v-if="printer_state === 'printing'" @click="btnPauseJob" :loading="loadings.includes('statusPrintPause')">
|
||||
<v-tooltip top>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-icon v-bind="attrs" v-on="on" small>mdi-pause</v-icon>
|
||||
</template>
|
||||
<span>Pause print</span>
|
||||
</v-tooltip>
|
||||
</v-btn>
|
||||
<v-btn small class="px-2 minwidth-0" color="red" v-if="(printer_state === 'paused')" :loading="loadings.includes('statusPrintCancel')" @click="btnCancelJob">
|
||||
<v-tooltip top>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-icon v-bind="attrs" v-on="on" small>mdi-stop</v-icon>
|
||||
</template>
|
||||
<span>Cancel print</span>
|
||||
</v-tooltip>
|
||||
</v-btn>
|
||||
<v-btn small class="px-2 minwidth-0" color="orange" v-if="(printer_state === 'paused')" :loading="loadings.includes('statusPrintResume')" @click="btnResumeJob">
|
||||
<v-tooltip top>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-icon v-bind="attrs" v-on="on" small>mdi-play</v-icon>
|
||||
</template>
|
||||
<span>Resume print</span>
|
||||
</v-tooltip>
|
||||
</v-btn>
|
||||
<v-btn small class="px-2 minwidth-0" color="primary" v-if="['error', 'complete'].includes(printer_state)" :loading="loadings.includes('statusPrintClear')" @click="btnClearJob">
|
||||
<v-tooltip top>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-icon v-bind="attrs" v-on="on" small>mdi-broom</v-icon>
|
||||
</template>
|
||||
<span>Clear print stats</span>
|
||||
</v-tooltip>
|
||||
</v-btn>
|
||||
<v-btn small class="px-2 minwidth-0" color="primary" v-if="['error', 'complete'].includes(printer_state)" :loading="loadings.includes('statusPrintReprint')" @click="btnReprintJob">
|
||||
<v-tooltip top>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-icon v-bind="attrs" v-on="on" small>mdi-printer</v-icon>
|
||||
</template>
|
||||
<span>Reprint job</span>
|
||||
</v-tooltip>
|
||||
</v-btn>
|
||||
</v-item-group>
|
||||
</v-toolbar>
|
||||
<v-row v-if="current_filename" class="mx-0">
|
||||
<v-col class="col-auto py-3 pr-0">
|
||||
<v-progress-circular
|
||||
:rotate="-90"
|
||||
:size="50"
|
||||
:width="7"
|
||||
:value="printPercent * 100"
|
||||
color="red"
|
||||
>
|
||||
</v-progress-circular>
|
||||
</v-col>
|
||||
<v-col class="col py-3" style="width: 100px;">
|
||||
<h3 class="font-weight-regular">{{ Math.round(printPercent * 100)+"%" }}{{ display_message ? " - "+display_message : "" }}</h3>
|
||||
<span class="subtitle-2 text-truncate d-block px-0 text--disabled"><v-icon small class="mr-1">mdi-file-outline</v-icon>{{ current_filename }}</span>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-divider class="mt-0 mb-0" ></v-divider>
|
||||
<v-card-text class="px-0 pt-0 pb-2 content">
|
||||
<v-container v-if="current_filename ">
|
||||
<v-row>
|
||||
<v-col
|
||||
class="col-12 col-sm-4 pl-sm-3 pt-0 pr-sm-0 pb-0"
|
||||
v-if="
|
||||
['printing', 'paused', 'complete'].includes(printer_state) &&
|
||||
current_file &&
|
||||
current_file.thumbnails &&
|
||||
current_file.thumbnails.length &&
|
||||
current_file.thumbnails.find(element => element.width === 400)
|
||||
">
|
||||
<img
|
||||
class="statusPanel-image-preview"
|
||||
:src="'data:image/gif;base64,'+(current_file.thumbnails ? current_file.thumbnails.find(element => element.width === 400).data : '')"
|
||||
/>
|
||||
<v-col class="col-auto pr-0 py-2">
|
||||
<v-progress-circular
|
||||
:rotate="-90"
|
||||
:size="50"
|
||||
:width="7"
|
||||
:value="Math.round(printPercent * 100)"
|
||||
color="red"
|
||||
>
|
||||
</v-progress-circular>
|
||||
</v-col>
|
||||
<v-col
|
||||
:class="
|
||||
(['printing', 'paused', 'complete'].includes(printer_state) &&
|
||||
current_file &&
|
||||
current_file.thumbnails &&
|
||||
current_file.thumbnails.length &&
|
||||
current_file.thumbnails.find(element => element.width === 400 || element.width === 300)) ? 'col-12 py-0 col-sm-8 pl-sm-0' : 'col-12 py-0'
|
||||
">
|
||||
<v-row class="text-center pt-2" align="center">
|
||||
<v-col class="py-0 flex-grow-0 pl-8 pr-3">
|
||||
<v-icon>mdi-axis-arrow</v-icon>
|
||||
</v-col>
|
||||
<v-col class="equal-width py-0">
|
||||
<v-row><v-col class="px-0 py-0"><strong>X</strong></v-col></v-row>
|
||||
<v-row><v-col class="px-0 py-0">{{ position.length ? position[0].toFixed(2) : "--" }}</v-col></v-row>
|
||||
</v-col>
|
||||
<v-col class="equal-width py-0">
|
||||
<v-row><v-col class="px-0 py-0"><strong>Y</strong></v-col></v-row>
|
||||
<v-row><v-col class="px-0 py-0">{{ position.length ? position[1].toFixed(2) : "--" }}</v-col></v-row>
|
||||
</v-col>
|
||||
<v-col class="equal-width py-0 pr-sm-6">
|
||||
<v-row><v-col class="px-0 py-0"><strong>Z</strong></v-col></v-row>
|
||||
<v-row><v-col class="px-0 py-0">{{ position.length ? position[2].toFixed(2) : "--" }}</v-col></v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-divider class="my-2" v-if="['printing', 'paused', 'complete', 'error'].includes(printer_state)"></v-divider>
|
||||
<v-row class="text-center" align="center" v-if="['printing', 'paused', 'complete', 'error'].includes(printer_state)">
|
||||
<v-col class="py-0 flex-grow-0 pl-8 pr-3">
|
||||
<v-icon>mdi-poll</v-icon>
|
||||
</v-col>
|
||||
<v-col class="equal-width py-0">
|
||||
<v-row><v-col class="px-0 py-0"><strong>Filament</strong></v-col></v-row>
|
||||
<v-row><v-col class="px-0 py-0">{{ filament_used > 1000 ? (filament_used / 1000).toFixed(2)+"m" : filament_used.toFixed(2)+"mm" }}</v-col></v-row>
|
||||
</v-col>
|
||||
<v-col class="equal-width py-0">
|
||||
<v-row><v-col class="px-0 py-0"><strong>Print</strong></v-col></v-row>
|
||||
<v-row><v-col class="px-0 py-0">{{ formatTime(print_time) }}</v-col></v-row>
|
||||
</v-col>
|
||||
<v-col class="equal-width py-0 pr-sm-6">
|
||||
<v-row><v-col class="px-0 py-0"><strong>Total</strong></v-col></v-row>
|
||||
<v-row><v-col class="px-0 py-0">{{ formatTime(print_time_total) }}</v-col></v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-divider class="my-2" v-if="['printing', 'paused', 'error'].includes(printer_state)"></v-divider>
|
||||
<v-row class="text-center" align="center" v-if="['printing', 'paused', 'error'].includes(printer_state)">
|
||||
<v-col class="py-0 flex-grow-0 pl-8 pr-3">
|
||||
<v-icon>mdi-clock-outline</v-icon>
|
||||
</v-col>
|
||||
<v-col class="equal-width py-0">
|
||||
<v-row><v-col class="px-0 py-0"><strong>File</strong></v-col></v-row>
|
||||
<v-row><v-col class="px-0 py-0">{{ print_time > 0 && printPercent > 0 ? formatTime(print_time / printPercent - print_time) : '--' }}</v-col></v-row>
|
||||
</v-col>
|
||||
<v-col class="equal-width py-0">
|
||||
<v-row><v-col class="px-0 py-0"><strong>Filament</strong></v-col></v-row>
|
||||
<v-row><v-col class="px-0 py-0">{{ (filament_used > 0 && 'filament_total' in current_file && current_file.filament_total > filament_used) ? formatTime(print_time / (filament_used / current_file.filament_total) - print_time) : '--' }}</v-col></v-row>
|
||||
</v-col>
|
||||
<v-col class="equal-width py-0 pr-sm-6">
|
||||
<v-row><v-col class="px-0 py-0"><strong>Slicer</strong></v-col></v-row>
|
||||
<v-row><v-col class="px-0 py-0">{{ 'estimated_time' in current_file && current_file.estimated_time > print_time ? formatTime(current_file.estimated_time - print_time) : '--'}}</v-col></v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-col class="col py-2" style="width: 100px;">
|
||||
<h3 class="font-weight-regular">{{ Math.round(printPercent * 100)+"%" }}{{ printer_state !== "error" ? (display_message ? " - "+display_message : "") : print_stats_message }}</h3>
|
||||
<span class="subtitle-2 text-truncate d-block px-0 text--disabled"><v-icon small class="mr-1">mdi-file-outline</v-icon>{{ current_filename }}</span>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
<v-divider v-if="current_filename " class="mt-0 mb-0" ></v-divider>
|
||||
<v-card-text class="px-0 py-0 content">
|
||||
<v-container>
|
||||
<v-row>
|
||||
<v-col
|
||||
class="col-12 col-sm-4 pl-sm-0 pt-0 pr-sm-0 pb-0"
|
||||
v-if="
|
||||
['printing', 'paused', 'complete'].includes(printer_state) &&
|
||||
current_file &&
|
||||
current_file.thumbnails &&
|
||||
current_file.thumbnails.length &&
|
||||
current_file.thumbnails.find(element => element.width === 400)
|
||||
">
|
||||
<img
|
||||
class="statusPanel-image-preview"
|
||||
:src="'data:image/gif;base64,'+(current_file.thumbnails ? current_file.thumbnails.find(element => element.width === 400).data : '')"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col
|
||||
:class="
|
||||
(['printing', 'paused', 'complete'].includes(printer_state) &&
|
||||
current_file &&
|
||||
current_file.thumbnails &&
|
||||
current_file.thumbnails.length &&
|
||||
current_file.thumbnails.find(element => element.width === 400 || element.width === 300)) ? 'col-12 col-sm-8' : 'col-12'
|
||||
">
|
||||
<v-row class="text-center" align="center">
|
||||
<v-col class="flex-grow-0 py-2">
|
||||
<v-icon>mdi-axis-arrow</v-icon>
|
||||
</v-col>
|
||||
<v-col class="equal-width py-2">
|
||||
<v-row><v-col class="px-0 pb-1"><strong>X</strong></v-col></v-row>
|
||||
<v-row><v-col class="px-0 pt-1">{{ position.length ? position[0].toFixed(2) : "--" }}</v-col></v-row>
|
||||
</v-col>
|
||||
<v-col class="equal-width py-2">
|
||||
<v-row><v-col class="px-0 pb-1"><strong>Y</strong></v-col></v-row>
|
||||
<v-row><v-col class="px-0 pt-1">{{ position.length ? position[1].toFixed(2) : "--" }}</v-col></v-row>
|
||||
</v-col>
|
||||
<v-col class="equal-width py-2">
|
||||
<v-row><v-col class="px-0 pb-1"><strong>Z</strong></v-col></v-row>
|
||||
<v-row>
|
||||
<v-col class="px-0 pt-1">
|
||||
|
||||
<v-tooltip top>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<span v-bind="attrs" v-on="on">{{ position.length ? position[2].toFixed(2) : "--" }}</span>
|
||||
</template>
|
||||
<span v-if="gcode_position !== undefined && gcode_position.length >= 3">G-Code: {{ gcode_position[2].toFixed(2) }}mm</span>
|
||||
</v-tooltip>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-if="['printing', 'paused', 'complete', 'error'].includes(printer_state) ">
|
||||
<v-col class="px-0">
|
||||
<v-divider></v-divider>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="text-center" align="center" v-if="['printing', 'paused', 'complete', 'error'].includes(printer_state) ">
|
||||
<v-col class="flex-grow-0 py-2">
|
||||
<v-icon>mdi-poll</v-icon>
|
||||
</v-col>
|
||||
<v-col class="equal-width py-2">
|
||||
<v-row><v-col class="px-0 pb-1"><strong>Filament</strong></v-col></v-row>
|
||||
<v-row>
|
||||
<v-col class="px-0 pt-1">
|
||||
<v-tooltip top>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<span v-bind="attrs" v-on="on" v-if="filament_used >= 1000" class=" text-no-wrap">{{ (filament_used / 1000).toFixed(2) }} m</span>
|
||||
<span v-bind="attrs" v-on="on" v-if="filament_used < 1000" class=" text-no-wrap">{{ filament_used.toFixed(2) }} mm</span>
|
||||
</template>
|
||||
<span v-if="'filament_total' in current_file">{{ (filament_used / 1000).toFixed(2) }} / {{ (current_file.filament_total / 1000).toFixed(2) }}m = {{ ( 100 / current_file.filament_total * filament_used).toFixed(0) }}% </span>
|
||||
</v-tooltip>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
<v-col class="equal-width py-2">
|
||||
<v-row><v-col class="px-0 pb-1"><strong>Print</strong></v-col></v-row>
|
||||
<v-row><v-col class="px-0 pt-1">{{ formatTime(print_time) }}</v-col></v-row>
|
||||
</v-col>
|
||||
<v-col class="equal-width py-2">
|
||||
<v-row><v-col class="px-0 pb-1"><strong>Total</strong></v-col></v-row>
|
||||
<v-row><v-col class="px-0 pt-1">{{ formatTime(print_time_total) }}</v-col></v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-if="['printing', 'paused', 'error'].includes(printer_state) ">
|
||||
<v-col class="px-0">
|
||||
<v-divider></v-divider>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="text-center" align="center" v-if="['printing', 'paused', 'error'].includes(printer_state) && 'filament_total' in current_file ">
|
||||
<v-col class="flex-grow-0 py-2">
|
||||
<v-icon>mdi-printer-3d</v-icon>
|
||||
</v-col>
|
||||
<v-col class="equal-width py-2">
|
||||
<v-row><v-col class="px-0 pb-1"><strong>Speed</strong></v-col></v-row>
|
||||
<v-row><v-col class="px-0 pt-1 text-no-wrap">{{ (requested_speed / 60).toFixed(0) }} mm/s</v-col></v-row>
|
||||
</v-col>
|
||||
<v-col class="equal-width py-2">
|
||||
<v-row><v-col class="px-0 pb-1"><strong>Layer</strong></v-col></v-row>
|
||||
<v-row><v-col class="px-0 pt-1 text-no-wrap">{{ current_layer }} of {{ max_layers }}</v-col></v-row>
|
||||
</v-col>
|
||||
<v-col class="equal-width py-2">
|
||||
<v-row><v-col class="px-0 pb-1"><strong>ETA</strong></v-col></v-row>
|
||||
<v-row><v-col class="px-0 pt-1">{{ eta ? formatDateTime(eta) : '--' }}</v-col></v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-if="['printing', 'paused', 'error'].includes(printer_state) ">
|
||||
<v-col class="px-0">
|
||||
<v-divider></v-divider>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="text-center" align="center" v-if="['printing', 'paused', 'error'].includes(printer_state) ">
|
||||
<v-col class="flex-grow-0 py-2">
|
||||
<v-icon>mdi-clock-outline</v-icon>
|
||||
</v-col>
|
||||
<v-col class="equal-width py-2 ">
|
||||
<v-row><v-col class="px-0 pb-1"><strong>File</strong></v-col></v-row>
|
||||
<v-row><v-col class="px-0 pt-1">{{ estimated_time_file ? formatTime(estimated_time_file) : '--' }}</v-col></v-row>
|
||||
</v-col>
|
||||
<v-col class="equal-width py-2">
|
||||
<v-row><v-col class="px-0 pb-1"><strong>Filament</strong></v-col></v-row>
|
||||
<v-row><v-col class="px-0 pt-1">{{ estimated_time_filament ? formatTime(estimated_time_filament) : '--' }}</v-col></v-row>
|
||||
</v-col>
|
||||
<v-col class="equal-width py-2">
|
||||
<v-row><v-col class="px-0 pb-1"><strong>Slicer</strong></v-col></v-row>
|
||||
<v-row><v-col class="px-0 pt-1">{{ estimated_time_slicer ? formatTime(estimated_time_slicer) : '--' }}</v-col></v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
@@ -142,6 +231,8 @@
|
||||
...mapState({
|
||||
toolhead: state => state.printer.toolhead,
|
||||
position: state => state.printer.toolhead.position,
|
||||
gcode_position: state => state.printer.gcode_move.gcode_position,
|
||||
requested_speed: state => state.printer.gcode_move.speed,
|
||||
|
||||
printProgress: state => state.printer.virtual_sdcard.progress,
|
||||
file_position: state => state.printer.virtual_sdcard.file_position,
|
||||
@@ -152,6 +243,7 @@
|
||||
filament_used: state => state.printer.print_stats.filament_used,
|
||||
current_filename: state => state.printer.print_stats.filename,
|
||||
printer_state: state => state.printer.print_stats.state,
|
||||
print_stats_message: state => state.printer.print_stats.message,
|
||||
|
||||
display_message: state => state.printer.display_status.message,
|
||||
loadings: state => state.socket.loadings,
|
||||
@@ -160,6 +252,90 @@
|
||||
get() {
|
||||
return this.$store.getters["printer/getPrintPercent"];
|
||||
}
|
||||
},
|
||||
max_layers: {
|
||||
get() {
|
||||
if (
|
||||
'first_layer_height' in this.current_file &&
|
||||
'layer_height' in this.current_file &&
|
||||
'object_height' in this.current_file
|
||||
) {
|
||||
const max = Math.ceil((this.current_file.object_height - this.current_file.first_layer_height) / this.current_file.layer_height + 1)
|
||||
return max > 0 ? max : 0
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
},
|
||||
current_layer: {
|
||||
get() {
|
||||
if (
|
||||
this.print_time > 0 &&
|
||||
'first_layer_height' in this.current_file &&
|
||||
'layer_height' in this.current_file &&
|
||||
this.gcode_position !== undefined &&
|
||||
this.gcode_position.length >= 3
|
||||
) {
|
||||
let current_layer = Math.ceil((this.gcode_position[2] - this.current_file.first_layer_height) / this.current_file.layer_height + 1)
|
||||
current_layer = (current_layer <= this.max_layers) ? current_layer : this.max_layers
|
||||
|
||||
return current_layer > 0 ? current_layer : 0
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
},
|
||||
estimated_time_file: {
|
||||
get() {
|
||||
if (this.print_time > 0 && this.printPercent > 0) {
|
||||
return (this.print_time / this.printPercent - this.print_time).toFixed(0)
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
},
|
||||
estimated_time_filament: {
|
||||
get() {
|
||||
if (this.filament_used > 0 && 'filament_total' in this.current_file && this.current_file.filament_total > this.filament_used) {
|
||||
return (this.print_time / (this.filament_used / this.current_file.filament_total) - this.print_time).toFixed(0)
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
},
|
||||
estimated_time_slicer: {
|
||||
get() {
|
||||
if ('estimated_time' in this.current_file && this.current_file.estimated_time > this.print_time) {
|
||||
return (this.current_file.estimated_time - this.print_time).toFixed(0)
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
},
|
||||
eta: {
|
||||
get() {
|
||||
let time = 0
|
||||
let timeCount = 0
|
||||
|
||||
if (this.estimated_time_file > 0) {
|
||||
time += parseInt(this.estimated_time_file)
|
||||
timeCount++
|
||||
}
|
||||
|
||||
if (this.estimated_time_filament > 0) {
|
||||
time += parseInt(this.estimated_time_filament)
|
||||
timeCount++
|
||||
}
|
||||
|
||||
if (this.estimated_time_slicer > 0) {
|
||||
time += parseInt(this.estimated_time_slicer)
|
||||
timeCount++
|
||||
}
|
||||
|
||||
if (time && timeCount) return Date.now() + (time / timeCount) * 1000
|
||||
|
||||
return 0
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -191,6 +367,13 @@
|
||||
|
||||
return h+':'+m+':'+s;
|
||||
},
|
||||
formatDateTime(msec) {
|
||||
const date = new Date(msec)
|
||||
const h = date.getHours() >= 10 ? date.getHours() : "0"+date.getHours()
|
||||
const m = date.getMinutes() >= 10 ? date.getMinutes() : "0"+date.getMinutes()
|
||||
|
||||
return h+":"+m
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -6,88 +6,216 @@
|
||||
.colHeaterIcons {
|
||||
width: 68px;
|
||||
}
|
||||
|
||||
.canvasjs-chart-tooltip>div {
|
||||
border-radius: 10px !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-card>
|
||||
<v-toolbar flat dense>
|
||||
<v-toolbar-title>
|
||||
<span class="subheading"><v-icon left>mdi-thermometer-lines</v-icon>Temperatures</span>
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
<v-card-text class="px-0 py-2 content">
|
||||
<v-row align="center">
|
||||
<v-col class="py-0 font-weight-bold" style="padding-left: 68px;">Name</v-col>
|
||||
<v-col class="py-0 text-center font-weight-bold d-none d-sm-block">State</v-col>
|
||||
<v-col class="py-0 text-center font-weight-bold">Current</v-col>
|
||||
<v-col class="text-center py-0 pr-8 font-weight-bold">Target</v-col>
|
||||
</v-row>
|
||||
<div v-for="(heater, index) in heaters" v-bind:key="index" >
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-row align="center">
|
||||
<v-col class="flex-grow-0 py-0 pl-8 pr-0 colHeaterIcons">
|
||||
<v-icon :color="heater.color">mdi-{{ heater.icon }}</v-icon>
|
||||
</v-col>
|
||||
<v-col class="py-0 font-weight-bold">{{ heater.name }}</v-col>
|
||||
<v-col class="py-0 text-center d-none d-sm-block"><small>{{ heater.target > 0 ? (heater.power !== null ? (heater.power > 0 ? (heater.power * 100).toFixed(0)+'%' : "0%") : "active") : "off" }}</small></v-col>
|
||||
<v-col class="py-0 text-center">{{ heater.temperature ? heater.temperature.toFixed(1) : 0 }}°C</v-col>
|
||||
<v-col class="text-center py-0 pr-8 pr-0 vertical_align_center">
|
||||
<toolInput :name="heater.name" :target="heater.target" :min_temp="heater.min_temp" :max_temp="heater.max_temp" command="SET_HEATER_TEMPERATURE" attribute-name="HEATER" ></toolInput>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
<div v-for="(fan, index) in this['printer/getTemperatureFans']" v-bind:key="index+99" >
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-row align="center">
|
||||
<v-col class="flex-grow-0 py-0 pl-8 pr-0 colHeaterIcons">
|
||||
<v-icon :color="(fan.target ? 'grey lighten-5' : 'grey darken-2')" :class="(fan.speed ? ' icon-rotate' : '')">mdi-fan</v-icon>
|
||||
</v-col>
|
||||
<v-col class="py-0 font-weight-bold">{{ fan.name }}</v-col>
|
||||
<v-col class="py-0 text-center d-none d-sm-block"><small>{{ fan.target > 0 && fan.speed > 0 ? (fan.speed * 100).toFixed(0)+"%" : (fan.target > 0 ? "standby" : "off") }}</small></v-col>
|
||||
<v-col class="py-0 text-center">{{ fan.temperature ? fan.temperature.toFixed(1) : 0}}°C</v-col>
|
||||
<v-col class="text-center py-0 pr-8 pr-0 vertical_align_center">
|
||||
<toolInput :name="fan.name" :target="fan.target" command="SET_TEMPERATURE_FAN_TARGET" attribute-name="temperature_fan" ></toolInput>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
<div v-for="(sensor,index) in this['printer/getTemperatureSensors']" v-bind:key="index+999">
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-row align="center">
|
||||
<v-col class="flex-grow-0 py-0 pl-8 pr-0 colHeaterIcons">
|
||||
<v-icon color="grey darken-2" :title="'min: '+sensor.min_temp+'° / max: '+sensor.max_temp+'°'">{{ sensor.icon }}</v-icon>
|
||||
</v-col>
|
||||
<v-col class="py-0 font-weight-bold">{{ sensor.name }}</v-col>
|
||||
<v-col class="py-0 d-none d-sm-block"><span> </span></v-col>
|
||||
<v-col class="py-0 text-center">
|
||||
<v-tooltip top>
|
||||
<div>
|
||||
<v-card>
|
||||
<v-toolbar flat dense>
|
||||
<v-toolbar-title>
|
||||
<span class="subheading"><v-icon left>mdi-thermometer-lines</v-icon>Temperatures</span>
|
||||
</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-item-group class="v-btn-toggle" name="controllers">
|
||||
<v-menu :offset-y="true" title="Preheat" v-if="this['gui/getPreheatPresets'].length">
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<span
|
||||
style="cursor: default;"
|
||||
class=" px-0"
|
||||
v-bind="attrs"
|
||||
v-on="on"
|
||||
>{{ sensor.temperature ? sensor.temperature.toFixed(1) : 0 }}°C</span>
|
||||
<v-btn small class="px-2 minwidth-0" color="primary" v-bind="attrs" v-on="on" :disabled="['printing', 'paused'].includes(printer_state)">Presets <v-icon small>mdi-menu-down</v-icon></v-btn>
|
||||
</template>
|
||||
<span>min: {{ sensor.measured_min_temp ? sensor.measured_min_temp.toFixed(1) : 0}}°<br />max: {{ sensor.measured_max_temp ? sensor.measured_max_temp.toFixed(1) : 0 }}°</span>
|
||||
</v-tooltip>
|
||||
</v-col>
|
||||
<v-col class="text-center py-0 pr-8 vertical_align_center"><span> </span></v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
<v-divider class="my-2" v-if="boolTempchart"></v-divider>
|
||||
<v-row v-if="boolTempchart">
|
||||
<v-col class="px-8">
|
||||
<temp-chart ></temp-chart>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
<v-list dense class="py-0">
|
||||
<v-list-item v-for="preset of this['gui/getPreheatPresets']" v-bind:key="preset.index" link @click="preheat(preset)">
|
||||
<v-list-item-icon class="mr-0">
|
||||
<v-icon small>mdi-fire</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title v-text="preset.name"></v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
<v-divider></v-divider>
|
||||
<v-list dense class="py-0">
|
||||
<v-list-item link @click="cooldown()">
|
||||
<v-list-item-icon class="mr-0">
|
||||
<v-icon small>mdi-snowflake</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title>Cooldown</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
<v-btn small class="px-2 minwidth-0" color="primary" @click="cooldown()" v-if="this['gui/getPreheatPresets'].length === 0"><v-icon small class="mr-1">mdi-snowflake</v-icon>Cooldown</v-btn>
|
||||
<v-menu :offset-y="true" :close-on-content-click="false" title="Setup Temperatures">
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-btn small class="px-2 minwidth-0" color="grey darken-3" v-bind="attrs" v-on="on"><v-icon small>mdi-cog</v-icon></v-btn>
|
||||
</template>
|
||||
<v-list>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox class="mt-0" v-model="boolTempchart" hide-details label="Show Chart"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox class="mt-0" v-model="autoscaleTempchart" hide-details label="Autoscale Chart"></v-checkbox>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</v-item-group>
|
||||
</v-toolbar>
|
||||
<v-card-text class="px-0 py-2 content">
|
||||
<v-container class="px-0">
|
||||
<v-row align="center">
|
||||
<v-col class="py-2 font-weight-bold" style="padding-left: 68px;">Name</v-col>
|
||||
<v-col class="py-2 text-center font-weight-bold d-none d-sm-block">State</v-col>
|
||||
<v-col class="py-2 text-center font-weight-bold">Current</v-col>
|
||||
<v-col class="py-2 pr-8 text-center font-weight-bold">Target</v-col>
|
||||
</v-row>
|
||||
<div v-for="(heater, index) in heaters" v-bind:key="index" >
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-row align="center">
|
||||
<v-col class="pl-8 pr-0 flex-grow-0 py-2 colHeaterIcons">
|
||||
<v-icon :color="heater.color">mdi-{{ heater.icon }}</v-icon>
|
||||
</v-col>
|
||||
<v-col class="py-2 font-weight-bold"><span style="cursor: pointer;" @click="openHeater(heater)">{{ convertName(heater.name) }}</span></v-col>
|
||||
<v-col class="py-2 text-center d-none d-sm-block"><small>{{ heater.target > 0 ? (heater.power !== null ? (heater.power > 0 ? (heater.power * 100).toFixed(0)+'%' : "0%") : "active") : "off" }}</small></v-col>
|
||||
<v-col class="py-2 text-center">
|
||||
<span class="d-block">{{ heater.temperature ? heater.temperature.toFixed(1) : 0 }}°C</span>
|
||||
<span v-for="(values, key) of heater.additionValues" v-bind:key="key" class="d-block">{{ values.value.toFixed(1) }} {{ values.unit }}</span>
|
||||
</v-col>
|
||||
<v-col class="text-center py-2 pr-8 vertical_align_center">
|
||||
<toolInput :name="heater.name" :target="heater.target" :min_temp="heater.min_temp" :max_temp="heater.max_temp" :items="heater.presets" command="SET_HEATER_TEMPERATURE" attribute-name="HEATER" ></toolInput>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
<div v-for="(fan, index) in temperatureFans" v-bind:key="index+99" >
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-row align="center">
|
||||
<v-col class="flex-grow-0 py-2 pl-8 pr-0 colHeaterIcons">
|
||||
<v-icon :color="(fan.target ? 'grey lighten-5' : 'grey darken-2')" :class="(fan.speed ? ' icon-rotate' : '')">mdi-fan</v-icon>
|
||||
</v-col>
|
||||
<v-col class="py-2 font-weight-bold"><span style="cursor: pointer;" @click="openHeater(fan)">{{ convertName(fan.name) }}</span></v-col>
|
||||
<v-col class="py-2 text-center d-none d-sm-block"><small>{{ fan.target > 0 && fan.speed > 0 ? (fan.speed * 100).toFixed(0)+"%" : (fan.target > 0 ? "standby" : "off") }}</small></v-col>
|
||||
<v-col class="py-2 text-center">
|
||||
<span class="d-block">{{ fan.temperature ? fan.temperature.toFixed(1) : 0}}°C</span>
|
||||
<span v-for="(values, key) of fan.additionValues" v-bind:key="key" class="d-block">{{ values.value.toFixed(1) }} {{ values.unit }}</span>
|
||||
</v-col>
|
||||
<v-col class="text-center py-2 pr-8 pr-0 vertical_align_center">
|
||||
<toolInput :name="fan.name" :target="fan.target" command="SET_TEMPERATURE_FAN_TARGET" attribute-name="temperature_fan" :items="fan.presets" ></toolInput>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
<div v-for="(sensor,index) in temperatureSensors" v-bind:key="index+999">
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-row align="center">
|
||||
<v-col class="flex-grow-0 py-2 pl-8 pr-0 colHeaterIcons">
|
||||
<v-icon color="grey darken-2" :title="'min: '+sensor.min_temp+'° / max: '+sensor.max_temp+'°'">{{ sensor.icon }}</v-icon>
|
||||
</v-col>
|
||||
<v-col class="py-2 font-weight-bold">
|
||||
<span style="cursor: pointer;" @click="openHeater(sensor)">{{ convertName(sensor.name) }}</span>
|
||||
</v-col>
|
||||
<v-col class="py-2 d-none d-sm-block"><span> </span></v-col>
|
||||
<v-col class="py-2 text-center">
|
||||
<v-tooltip top>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<span
|
||||
style="cursor: default;"
|
||||
class="d-block px-0"
|
||||
v-bind="attrs"
|
||||
v-on="on"
|
||||
>{{ sensor.temperature ? sensor.temperature.toFixed(1) : 0 }}°C</span>
|
||||
</template>
|
||||
<span>min: {{ sensor.measured_min_temp ? sensor.measured_min_temp.toFixed(1) : 0}}°<br />max: {{ sensor.measured_max_temp ? sensor.measured_max_temp.toFixed(1) : 0 }}°</span>
|
||||
</v-tooltip>
|
||||
<span v-for="(values, key) of sensor.additionValues" v-bind:key="key" class="d-block">{{ values.value.toFixed(1) }} {{ values.unit }}</span>
|
||||
</v-col>
|
||||
<v-col class="text-center py-2 pr-8 vertical_align_center"><span> </span></v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
<v-divider class="my-2" v-if="boolTempchart"></v-divider>
|
||||
<v-row v-if="boolTempchart">
|
||||
<v-col class="px-8 pt-6">
|
||||
<temp-chart ></temp-chart>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
<v-dialog v-model="editHeater.bool" persistent :width="400">
|
||||
<v-card dark>
|
||||
<v-toolbar flat dense color="primary">
|
||||
<v-toolbar-title>
|
||||
<span class="subheading">
|
||||
<v-icon left>mdi-{{ 'icon' in editHeater.object ? editHeater.object.icon : "info" }}</v-icon>
|
||||
{{ 'name' in editHeater.object ? convertName(editHeater.object.name) : "UNKNOWN" }}
|
||||
</span>
|
||||
</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn small class="minwidth-0" @click="editHeater.bool = false"><v-icon small>mdi-close-thick</v-icon></v-btn>
|
||||
</v-toolbar>
|
||||
<v-card-text class="pt-3">
|
||||
<v-container class="px-0 py-0">
|
||||
<v-row>
|
||||
<v-col class="col-12">
|
||||
<v-checkbox
|
||||
v-model="editHeater.boolTemperature"
|
||||
label="Show current temperature in chart"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
v-if="'chartTemperature' in editHeater.object && editHeater.object.chartTemperature"
|
||||
@change="setVisibleTemperature"
|
||||
></v-checkbox>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="col-12">
|
||||
<v-checkbox
|
||||
v-model="editHeater.boolTarget"
|
||||
label="Show target temperature in chart"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
v-if="'chartTarget' in editHeater.object && editHeater.object.chartTarget"
|
||||
@change="setVisibleTarget"
|
||||
></v-checkbox>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="col-12">
|
||||
<v-checkbox
|
||||
v-model="editHeater.boolPower"
|
||||
label="Show PWM-power in chart"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
v-if="'chartPower' in editHeater.object && editHeater.object.chartPower"
|
||||
@change="setVisiblePower"
|
||||
></v-checkbox>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="col-12 text-center">
|
||||
<v-color-picker
|
||||
hide-canvas
|
||||
hide-mode-switch
|
||||
mode="hexa"
|
||||
v-model="editHeater.color"
|
||||
@input="setChartColor"
|
||||
class="mx-auto"
|
||||
></v-color-picker>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters, mapState } from 'vuex'
|
||||
import { mapState, mapGetters } from 'vuex'
|
||||
import toolInput from '../../inputs/ToolInput'
|
||||
import TempChart from '@/components/charts/TempChart'
|
||||
import {convertName} from "@/plugins/helpers"
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -96,52 +224,127 @@
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
extruderTemps: [250,215,195,0],
|
||||
editHeater: {
|
||||
bool: false,
|
||||
object: {},
|
||||
boolTemperature: false,
|
||||
boolTarget: false,
|
||||
boolPower: false,
|
||||
color: "",
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
datasets: state => state.printer.tempHistory.datasets,
|
||||
boolTempchart: state => state.gui.dashboard.boolTempchart,
|
||||
printer: state => state.printer,
|
||||
cooldownGcode: state => state.gui.cooldownGcode,
|
||||
printer_state: state => state.printer.print_stats.state,
|
||||
}),
|
||||
...mapGetters([
|
||||
'printer/getTemperatureFans',
|
||||
'printer/getTemperatureSensors',
|
||||
'gui/getPreheatPresets'
|
||||
]),
|
||||
heaters: {
|
||||
get () {
|
||||
return this.$store.getters["printer/getHeaters"]
|
||||
}
|
||||
},
|
||||
temperatureFans: {
|
||||
get () {
|
||||
return this.$store.getters["printer/getTemperatureFans"]
|
||||
}
|
||||
},
|
||||
temperatureSensors: {
|
||||
get () {
|
||||
return this.$store.getters["printer/getTemperatureSensors"]
|
||||
}
|
||||
},
|
||||
boolTempchart: {
|
||||
get() {
|
||||
return this.$store.state.gui.dashboard.boolTempchart
|
||||
},
|
||||
set: function(newVal) {
|
||||
return this.$store.dispatch("gui/setSettings", { dashboard: { boolTempchart: newVal } })
|
||||
}
|
||||
},
|
||||
autoscaleTempchart: {
|
||||
get() {
|
||||
return this.$store.state.gui.tempchart.autoscale
|
||||
},
|
||||
set: function(newVal) {
|
||||
return this.$store.dispatch("gui/setSettings", { tempchart: { autoscale: newVal } })
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
convertName: convertName,
|
||||
cssBorderLeftColor(color) {
|
||||
return {
|
||||
"border-left-color": color
|
||||
}
|
||||
},
|
||||
preheat(preset) {
|
||||
for (const [name, attributes] of Object.entries(preset.values)) {
|
||||
if (attributes.bool) {
|
||||
let gcode = "SET_HEATER_TEMPERATURE HEATER="+name+" TARGET="+attributes.value
|
||||
|
||||
},
|
||||
mounted () {
|
||||
if (attributes.type === "temperature_fan") {
|
||||
const fanName = name.replace("temperature_fan ", "")
|
||||
gcode = "SET_TEMPERATURE_FAN_TARGET temperature_fan="+fanName+" TARGET="+attributes.value
|
||||
}
|
||||
|
||||
this.$store.commit('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.sendObj('printer.gcode.script', { script: gcode })
|
||||
}
|
||||
}
|
||||
|
||||
if (preset.gcode !== "") {
|
||||
this.$store.commit('server/addEvent', { message: preset.gcode, type: 'command' })
|
||||
this.$socket.sendObj('printer.gcode.script', { script: preset.gcode })
|
||||
}
|
||||
},
|
||||
cooldown() {
|
||||
this.$store.commit('server/addEvent', { message: this.cooldownGcode, type: 'command' })
|
||||
this.$socket.sendObj('printer.gcode.script', { script: this.cooldownGcode })
|
||||
},
|
||||
openHeater(object) {
|
||||
this.editHeater.object = object
|
||||
|
||||
this.editHeater.color = object.chartColor
|
||||
this.editHeater.boolTemperature = 'chartTemperature' in object && object.chartTemperature !== undefined && 'visible' in object.chartTemperature ? object.chartTemperature.visible : false
|
||||
this.editHeater.boolTarget = 'chartTarget' in object && object.chartTarget !== undefined && 'visible' in object.chartTarget ? object.chartTarget.visible : false
|
||||
this.editHeater.boolPower = 'chartPower' in object && object.chartPower !== undefined && 'visible' in object.chartPower ? object.chartPower.visible : false
|
||||
|
||||
this.editHeater.bool = true
|
||||
},
|
||||
setVisibleTemperature() {
|
||||
if ("name" in this.editHeater.object) {
|
||||
this.$store.commit('printer/tempHistory/setVisible', { name: this.editHeater.object.name, type: 'temperature', value: this.editHeater.boolTemperature })
|
||||
this.$store.dispatch('gui/setTempchartDatasetSetting', { name: this.editHeater.object.name, type: 'temperature', value: this.editHeater.boolTemperature })
|
||||
}
|
||||
},
|
||||
setVisibleTarget() {
|
||||
if ("name" in this.editHeater.object) {
|
||||
this.$store.commit('printer/tempHistory/setVisible', { name: this.editHeater.object.name, type: 'target', value: this.editHeater.boolTarget })
|
||||
this.$store.dispatch('gui/setTempchartDatasetSetting', { name: this.editHeater.object.name, type: 'target', value: this.editHeater.boolTarget })
|
||||
}
|
||||
},
|
||||
setVisiblePower() {
|
||||
if ("name" in this.editHeater.object) {
|
||||
this.$store.commit('printer/tempHistory/setVisible', { name: this.editHeater.object.name, type: 'power', value: this.editHeater.boolPower })
|
||||
this.$store.dispatch('gui/setTempchartDatasetSetting', { name: this.editHeater.object.name, type: 'power', value: this.editHeater.boolPower })
|
||||
}
|
||||
},
|
||||
setChartColor(value) {
|
||||
if ("name" in this.editHeater.object) {
|
||||
this.$store.commit('printer/tempHistory/setColor', { name: this.editHeater.object.name, value: value })
|
||||
this.$store.dispatch('gui/setTempchartDatasetSetting', { name: this.editHeater.object.name, type: 'color', value: value })
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.equal-width {
|
||||
flex-basis: 0;
|
||||
}
|
||||
|
||||
.category-header {
|
||||
flex: 0 0 100px;
|
||||
}
|
||||
a:not(:hover) {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.content span,
|
||||
.content strong {
|
||||
padding-left: 8px;
|
||||
padding-right: 8px;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
</style>
|
||||
</script>
|
||||
@@ -12,7 +12,7 @@
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
<v-card-text class="px-0 py-0 content">
|
||||
<img :src="webcamConfig.url" class="webcamImage" :style="webcamStyle" />
|
||||
<img :src="url" class="webcamImage" :style="webcamStyle" alt="Webcam"/>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
@@ -21,6 +21,15 @@
|
||||
import { mapState } from 'vuex'
|
||||
|
||||
export default {
|
||||
data: function() {
|
||||
return {
|
||||
refresh: Math.ceil(Math.random() * Math.pow(10, 12))
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
document.addEventListener("focus", () => this.handleRefreshChange(), false);
|
||||
document.addEventListener("visibilitychange", this.handleRefreshChange, false);
|
||||
},
|
||||
components: {
|
||||
|
||||
},
|
||||
@@ -28,8 +37,13 @@
|
||||
...mapState({
|
||||
'webcamConfig': state => state.gui.webcam
|
||||
}),
|
||||
url() {
|
||||
const params = new URLSearchParams(this.webcamConfig.url);
|
||||
params.set('bypassCache', ""+this.refresh);
|
||||
return decodeURIComponent(params.toString())
|
||||
},
|
||||
webcamStyle() {
|
||||
var transforms = '';
|
||||
let transforms = '';
|
||||
if (this.webcamConfig.flipX) {
|
||||
transforms += ' scaleX(-1)'
|
||||
}
|
||||
@@ -47,5 +61,12 @@
|
||||
return '';
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleRefreshChange() {
|
||||
if (!document.hidden) {
|
||||
this.refresh = Math.ceil(Math.random() * Math.pow(10, 12))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -10,24 +10,26 @@
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
|
||||
<v-card-text class="py-1">
|
||||
<v-row class="">
|
||||
<v-col class="col-12 pb-0 text-center">
|
||||
<p>Current Offset: {{ homing_origin.length > 1 ? homing_origin[2].toFixed(2) : 0.00 }}mm</p>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="col-12 pt-0 text-center d-flex flex-column align-center flex-sm-row justify-center">
|
||||
<v-btn-toggle dense no-gutters class="mx-2 mb-2 order-last flex-nowrap order-sm-first" >
|
||||
<v-btn small @click="sendBabySteppingDownFine()" class="" :loading="loadings.includes('babySteppingDownFine')" ><v-icon small class="mr-2">mdi-arrow-collapse-down</v-icon> -0.01mm</v-btn>
|
||||
<v-btn small @click="sendBabySteppingDown()" class="" :loading="loadings.includes('babySteppingDown')" >-0.05mm</v-btn>
|
||||
</v-btn-toggle>
|
||||
<v-btn-toggle dense no-gutters class="mx-2 mb-2 order-first flex-nowrap order-sm-last" >
|
||||
<v-btn small @click="sendBabySteppingUpFine()" class="" :loading="loadings.includes('babySteppingUpFine')" ><v-icon small class="mr-2">mdi-arrow-expand-up</v-icon> +0.01mm</v-btn>
|
||||
<v-btn small @click="sendBabySteppingUp()" class="" :loading="loadings.includes('babySteppingUp')" >+0.05mm</v-btn>
|
||||
</v-btn-toggle>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-card-text class="px-0 py-0">
|
||||
<v-container>
|
||||
<v-row class="py-0">
|
||||
<v-col class="col text-center">
|
||||
<p class="mb-0">Current Offset: {{ homing_origin.length > 1 ? homing_origin[2].toFixed(2) : 0.00 }}mm</p>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="col text-center d-flex flex-column align-center flex-sm-row justify-center">
|
||||
<v-btn-toggle dense no-gutters class="mx-2 mt-3 mt-sm-0 order-last flex-nowrap order-sm-first" >
|
||||
<v-btn small @click="sendBabySteppingDownFine()" class="" :loading="loadings.includes('babySteppingDownFine')" ><v-icon small class="mr-2">mdi-arrow-collapse-down</v-icon> -0.01mm</v-btn>
|
||||
<v-btn small @click="sendBabySteppingDown()" class="" :loading="loadings.includes('babySteppingDown')" >-0.05mm</v-btn>
|
||||
</v-btn-toggle>
|
||||
<v-btn-toggle dense no-gutters class="mx-2 order-first flex-nowrap order-sm-last" >
|
||||
<v-btn small @click="sendBabySteppingUpFine()" class="" :loading="loadings.includes('babySteppingUpFine')" ><v-icon small class="mr-2">mdi-arrow-expand-up</v-icon> +0.01mm</v-btn>
|
||||
<v-btn small @click="sendBabySteppingUp()" class="" :loading="loadings.includes('babySteppingUp')" >+0.05mm</v-btn>
|
||||
</v-btn-toggle>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
@@ -57,25 +59,25 @@
|
||||
sendBabySteppingDownFine() {
|
||||
let gcode = "SET_GCODE_OFFSET Z_ADJUST=-0.01"+(this.homed_axis === "xyz" ? " MOVE=1" : "");
|
||||
this.$store.commit('socket/addLoading', { name: 'babySteppingDownFine' });
|
||||
this.$store.commit('server/addEvent', gcode);
|
||||
this.$store.commit('server/addEvent', { message: gcode, type: 'command' });
|
||||
Vue.prototype.$socket.sendObj('printer.gcode.script', { script: gcode }, "socket/removeLoading", { name: 'babySteppingDownFine' });
|
||||
},
|
||||
sendBabySteppingDown() {
|
||||
let gcode = "SET_GCODE_OFFSET Z_ADJUST=-0.05"+(this.homed_axis === "xyz" ? " MOVE=1" : "");
|
||||
this.$store.commit('socket/addLoading', { name: 'babySteppingDown' });
|
||||
this.$store.commit('server/addEvent', gcode);
|
||||
this.$store.commit('server/addEvent', { message: gcode, type: 'command' });
|
||||
Vue.prototype.$socket.sendObj('printer.gcode.script', { script: gcode }, "socket/removeLoading", { name: 'babySteppingDown' });
|
||||
},
|
||||
sendBabySteppingUpFine() {
|
||||
let gcode = "SET_GCODE_OFFSET Z_ADJUST=0.01"+(this.homed_axis === "xyz" ? " MOVE=1" : "");
|
||||
this.$store.commit('socket/addLoading', { name: 'babySteppingUpFine' });
|
||||
this.$store.commit('server/addEvent', gcode);
|
||||
this.$store.commit('server/addEvent', { message: gcode, type: 'command' });
|
||||
Vue.prototype.$socket.sendObj('printer.gcode.script', { script: gcode }, "socket/removeLoading", { name: 'babySteppingUpFine' });
|
||||
},
|
||||
sendBabySteppingUp() {
|
||||
let gcode = "SET_GCODE_OFFSET Z_ADJUST=0.05"+(this.homed_axis === "xyz" ? " MOVE=1" : "");
|
||||
this.$store.commit('socket/addLoading', { name: 'babySteppingUp' });
|
||||
this.$store.commit('server/addEvent', gcode);
|
||||
this.$store.commit('server/addEvent', { message: gcode, type: 'command' });
|
||||
Vue.prototype.$socket.sendObj('printer.gcode.script', { script: gcode }, "socket/removeLoading", { name: 'babySteppingUp' });
|
||||
},
|
||||
}
|
||||
|
||||
@@ -3,11 +3,12 @@ import Vue from 'vue'
|
||||
import StatusPanel from './StatusPanel.vue'
|
||||
import KlippyStatePanel from './KlippyStatePanel.vue'
|
||||
import MinSettingsPanel from './MinSettingsPanel.vue'
|
||||
import MoonrakerFailedPluginsPanel from './MoonrakerFailedPluginsPanel.vue'
|
||||
import ToolsPanel from './ToolsPanel.vue'
|
||||
import ControlPanel from "./ControlPanel";
|
||||
import ExtruderPanel from "./ExtruderPanel";
|
||||
import ZOffsetPanel from "./ZOffsetPanel";
|
||||
import Peripherie from "./PeripheriePanel";
|
||||
import Miscellaneous from "./MiscellaneousPanel";
|
||||
import WebcamPanel from "./WebcamPanel";
|
||||
import MiniconsolePanel from "./MiniconsolePanel";
|
||||
import Settings from "./Settings/";
|
||||
@@ -16,11 +17,12 @@ import PowerControlPanel from "./PowerControlPanel.vue";
|
||||
Vue.component('status-panel', StatusPanel);
|
||||
Vue.component('klippy-state-panel', KlippyStatePanel);
|
||||
Vue.component('min-settings-panel', MinSettingsPanel);
|
||||
Vue.component('moonraker-failed-plugins-panel', MoonrakerFailedPluginsPanel);
|
||||
Vue.component('tools-panel', ToolsPanel);
|
||||
Vue.component('control-panel', ControlPanel);
|
||||
Vue.component('extruder-panel', ExtruderPanel);
|
||||
Vue.component('zoffset-panel', ZOffsetPanel);
|
||||
Vue.component('peripherie-panel', Peripherie);
|
||||
Vue.component('miscellaneous-panel', Miscellaneous);
|
||||
Vue.component('webcam-panel', WebcamPanel);
|
||||
Vue.component('miniconsole-panel', MiniconsolePanel);
|
||||
Vue.component('power-control-panel', PowerControlPanel);
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
<style>
|
||||
._fan-slider-subheader {
|
||||
height: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-row>
|
||||
<v-col :class="controllable ? 'pb-1 pt-3' : 'py-2'">
|
||||
<v-subheader class="_fan-slider-subheader">
|
||||
<span>{{ convertName }}</span>
|
||||
<v-spacer></v-spacer>
|
||||
<span class="font-weight-bold">{{ Math.round(value) }} %</span>
|
||||
</v-subheader>
|
||||
<v-card-text class="py-0" v-if="controllable">
|
||||
<v-slider
|
||||
v-model="value"
|
||||
:min="0"
|
||||
:max="100"
|
||||
@change="sendCmd"
|
||||
hide-details>
|
||||
|
||||
<template v-slot:prepend>
|
||||
<v-icon @click="decrement">mdi-minus</v-icon>
|
||||
</template>
|
||||
|
||||
<template v-slot:append>
|
||||
<v-icon @click="increment">mdi-plus</v-icon>
|
||||
</template>
|
||||
</v-slider>
|
||||
</v-card-text>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data: function() {
|
||||
return {
|
||||
value: this.target * this.multi,
|
||||
}
|
||||
},
|
||||
props: {
|
||||
target: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: ''
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: ''
|
||||
},
|
||||
controllable: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
multi: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: 1
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
convertName() {
|
||||
let tmp = this.name;
|
||||
tmp = tmp.replaceAll("_", " ");
|
||||
tmp = tmp.charAt(0).toUpperCase() + tmp.slice(1);
|
||||
|
||||
return tmp;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
sendCmd() {
|
||||
let gcode = "";
|
||||
|
||||
if (this.type === "fan") gcode = "M106 S"+(this.value * 2.55).toFixed(0);
|
||||
if (this.type === "fan_generic") gcode = "SET_FAN_SPEED FAN="+this.name+" SPEED="+(this.value/100);
|
||||
|
||||
if (gcode !== "") {
|
||||
this.$store.commit('server/addEvent', gcode);
|
||||
this.$socket.sendObj('printer.gcode.script', { script: gcode });
|
||||
}
|
||||
},
|
||||
decrement() {
|
||||
this.value = this.value > 0 ? (this.value - 1).toFixed(0) : 0;
|
||||
this.sendCmd();
|
||||
},
|
||||
increment() {
|
||||
this.value = this.value < 100 ? (this.value + 1).toFixed(0) : 100;
|
||||
this.sendCmd();
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
target: function(newVal) {
|
||||
this.value = newVal * this.multi;
|
||||
},
|
||||
},
|
||||
created: function() {
|
||||
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,120 @@
|
||||
<style>
|
||||
._fan-slider-subheader {
|
||||
height: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-container class="px-0 py-2">
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-subheader class="_fan-slider-subheader">
|
||||
<v-icon small :class="'mr-2 '+(value ? 'icon-rotate' : '')" v-if="type !== 'output_pin'">mdi-fan</v-icon>
|
||||
<span>{{ convertName(this.name) }}</span>
|
||||
<v-spacer></v-spacer>
|
||||
<span class="font-weight-bold" v-if="!controllable || (controllable && pwm)">{{ Math.round(value*100) }} %</span>
|
||||
<v-icon v-if="controllable && !pwm" @click="switchOutputPin">{{ value ? "mdi-toggle-switch" : "mdi-toggle-switch-off-outline" }}</v-icon>
|
||||
</v-subheader>
|
||||
<v-card-text class="py-0" v-if="controllable && pwm">
|
||||
<v-slider
|
||||
v-model="value"
|
||||
:min="0"
|
||||
:max="1"
|
||||
:step="0.01"
|
||||
@change="sendCmd"
|
||||
hide-details>
|
||||
|
||||
<template v-slot:prepend>
|
||||
<v-icon @click="decrement">mdi-minus</v-icon>
|
||||
</template>
|
||||
|
||||
<template v-slot:append>
|
||||
<v-icon @click="increment">mdi-plus</v-icon>
|
||||
</template>
|
||||
</v-slider>
|
||||
</v-card-text>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
import {convertName} from "@/plugins/helpers";
|
||||
|
||||
export default {
|
||||
data: function() {
|
||||
return {
|
||||
value: this.target,
|
||||
}
|
||||
},
|
||||
props: {
|
||||
target: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: ''
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: ''
|
||||
},
|
||||
controllable: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
pwm: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
multi: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: 1
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
convertName: convertName,
|
||||
sendCmd() {
|
||||
let gcode = "";
|
||||
|
||||
if (this.type === "fan") gcode = "M106 S"+(this.value * this.multi).toFixed(0)
|
||||
if (this.type === "fan_generic") gcode = "SET_FAN_SPEED FAN="+this.name+" SPEED="+(this.value*this.multi)
|
||||
if (this.type === "output_pin") gcode = "SET_PIN PIN="+this.name+" VALUE="+(this.value*this.multi).toFixed(2)
|
||||
|
||||
if (gcode !== "") {
|
||||
this.$store.commit('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.sendObj('printer.gcode.script', { script: gcode })
|
||||
}
|
||||
},
|
||||
switchOutputPin() {
|
||||
this.value = this.value ? 0 : 1
|
||||
const gcode = "SET_PIN PIN="+this.name+" VALUE="+(this.value*this.multi).toFixed(2)
|
||||
this.$store.commit('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.sendObj('printer.gcode.script', { script: gcode })
|
||||
},
|
||||
decrement() {
|
||||
this.value = this.value > 0 ? (this.value - 0.01).toFixed(2) : 0;
|
||||
this.sendCmd();
|
||||
},
|
||||
increment() {
|
||||
this.value = this.value < 1 ? (this.value + 0.01).toFixed(2) : 100;
|
||||
this.sendCmd();
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
target: function(newVal) {
|
||||
this.value = newVal;
|
||||
},
|
||||
},
|
||||
created: function() {
|
||||
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -1,11 +1,9 @@
|
||||
<style>
|
||||
.settings_macro_switch .v-messages {
|
||||
display: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-switch v-model="value" :label="name.toUpperCase()" @change="setValue" class="settings_macro_switch mt-0"></v-switch>
|
||||
<v-switch v-model="value" :label="name.toUpperCase()" @change="setValue" hide-details class="mt-0"></v-switch>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
@@ -19,14 +19,27 @@
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-text-field type="number" min="0" :max="max_temp" step="any" ref="toolField" v-model="value" class="tool-input" @change="setTemps" onClick="this.select();">
|
||||
</v-text-field>
|
||||
<v-combobox
|
||||
dense
|
||||
hide-details
|
||||
onClick="this.select();"
|
||||
v-model="value"
|
||||
:items="items"
|
||||
item-text="value"
|
||||
@change="setTemps"
|
||||
></v-combobox>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
import Vue from "vue";
|
||||
|
||||
/*
|
||||
<v-text-field v-if="false" type="number" min="0" :max="max_temp" step="any" ref="toolField" class="tool-input">
|
||||
</v-text-field>
|
||||
*/
|
||||
|
||||
export default {
|
||||
data: function() {
|
||||
return {
|
||||
@@ -40,19 +53,27 @@
|
||||
max_temp: Number,
|
||||
command: String,
|
||||
attributeName: String,
|
||||
items: Array,
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
methods: {
|
||||
setTemps() {
|
||||
if (typeof this.value === 'object' && this.value !== null) this.value = this.value.value
|
||||
if (parseFloat(this.value) === 0) this.value = 0
|
||||
|
||||
if (this.max_temp !== undefined && this.value > this.max_temp) {
|
||||
this.value = this.target;
|
||||
Vue.$toast.error("Temperature too high for "+this.name+"! (max: "+this.max_temp+")");
|
||||
} else if (this.min_temp !== undefined && this.value < this.min_temp && parseFloat(this.value) !== 0) {
|
||||
this.value = this.target;
|
||||
Vue.$toast.error("Temperature too low for "+this.name+"! (min: "+this.min_temp+")");
|
||||
} else this.$socket.sendObj('printer.gcode.script', { script: this.command+' '+this.attributeName+'='+this.name+' TARGET='+this.value });
|
||||
} else {
|
||||
const gcode = this.command+' '+this.attributeName+'='+this.name+' TARGET='+this.value
|
||||
this.$store.commit('server/addEvent', { message: gcode, type: 'command' });
|
||||
this.$socket.sendObj('printer.gcode.script', { script: gcode });
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
@@ -5,32 +5,34 @@
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-row>
|
||||
<v-col class="pb-1 pt-3">
|
||||
<v-subheader class="_tool-slider-subheader">
|
||||
<span>{{ label }}</span>
|
||||
<v-spacer></v-spacer>
|
||||
<span class="font-weight-bold">{{ value }} {{ unit }}</span>
|
||||
</v-subheader>
|
||||
<v-card-text class="py-0">
|
||||
<v-slider
|
||||
v-model="value"
|
||||
:min="min"
|
||||
:max="max"
|
||||
@change="sendCmd"
|
||||
hide-details>
|
||||
<v-container class="px-0 py-2">
|
||||
<v-row>
|
||||
<v-col class="pb-1 pt-3">
|
||||
<v-subheader class="_tool-slider-subheader">
|
||||
<span>{{ label }}</span>
|
||||
<v-spacer></v-spacer>
|
||||
<span class="font-weight-bold">{{ value }} {{ unit }}</span>
|
||||
</v-subheader>
|
||||
<v-card-text class="py-0">
|
||||
<v-slider
|
||||
v-model="value"
|
||||
:min="min"
|
||||
:max="max"
|
||||
@change="sendCmd"
|
||||
hide-details>
|
||||
|
||||
<template v-slot:prepend>
|
||||
<v-icon @click="decrement">mdi-minus</v-icon>
|
||||
</template>
|
||||
<template v-slot:prepend>
|
||||
<v-icon @click="decrement">mdi-minus</v-icon>
|
||||
</template>
|
||||
|
||||
<template v-slot:append>
|
||||
<v-icon @click="increment">mdi-plus</v-icon>
|
||||
</template>
|
||||
</v-slider>
|
||||
</v-card-text>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<template v-slot:append>
|
||||
<v-icon @click="increment">mdi-plus</v-icon>
|
||||
</template>
|
||||
</v-slider>
|
||||
</v-card-text>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -96,7 +98,7 @@
|
||||
methods: {
|
||||
sendCmd() {
|
||||
let gcode = this.command+' '+this.attributeName+(this.value*this.attributeScale).toFixed(0)
|
||||
this.$store.commit('server/addEvent', gcode)
|
||||
this.$store.commit('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.sendObj('printer.gcode.script', { script: gcode })
|
||||
},
|
||||
decrement() {
|
||||
|
||||
@@ -24,13 +24,13 @@ fetch('/config.json')
|
||||
.then(file => {
|
||||
store.commit('socket/setData', file);
|
||||
|
||||
const websocketProtocol = document.location.protocol === 'https:' ? 'wss://' : 'ws://';
|
||||
const socketClient = new WebSocketClient(websocketProtocol + store.state.socket.hostname + ':' + store.state.socket.port + '/websocket', {
|
||||
const socketClient = new WebSocketClient(store.state.socket.protocol + '://' + store.state.socket.hostname + ':' + store.state.socket.port + '/websocket', {
|
||||
store: store,
|
||||
reconnectEnabled: true,
|
||||
reconnectInterval: store.state.socket.reconnectInterval,
|
||||
});
|
||||
socketClient.connect();
|
||||
|
||||
if (!store.state.socket.remoteMode) socketClient.connect()
|
||||
Vue.prototype.$socket = socketClient;
|
||||
|
||||
new Vue({
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
methods: {
|
||||
doSend() {
|
||||
this.$store.commit('socket/addLoading', { name: 'sendGcode' });
|
||||
this.$store.commit('server/addEvent', this.gcode);
|
||||
this.$store.commit('server/addEvent', { message: this.gcode, type: 'command' });
|
||||
Vue.prototype.$socket.sendObj('printer.gcode.script', { script: this.gcode }, "socket/removeLoading", { name: 'sendGcode' });
|
||||
this.lastCommands.push(this.gcode);
|
||||
this.gcode = "";
|
||||
@@ -185,7 +185,6 @@
|
||||
let seconds = date.getSeconds();
|
||||
if (seconds < 10) seconds = "0"+seconds.toString();
|
||||
|
||||
|
||||
return hours+":"+minutes+":"+seconds;
|
||||
},
|
||||
colorConsoleMessage: colorConsoleMessage,
|
||||
@@ -219,7 +218,7 @@
|
||||
let output = "";
|
||||
commands.forEach(command => output += "<b>"+command.command+":</b> "+command.description+"<br />");
|
||||
|
||||
this.$store.commit('server/addEvent', output);
|
||||
this.$store.commit('server/addEvent', { message: output, type: 'command' });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
<v-row>
|
||||
<v-col class="col-sm-12 col-md-5">
|
||||
<min-settings-panel v-if="klippy_state === 'ready' && existsPrinterConfig"></min-settings-panel>
|
||||
<status-panel v-if="klippy_state === 'ready'"></status-panel>
|
||||
<moonraker-failed-plugins-panel v-if="moonrakerFailedPlugins.length"></moonraker-failed-plugins-panel>
|
||||
<klippy-state-panel v-if="socket_connected && klippy_state !== 'ready'"></klippy-state-panel>
|
||||
<webcam-panel v-if="showDashboardWebcam" class="mt-6"></webcam-panel>
|
||||
<status-panel v-if="klippy_state === 'ready'"></status-panel>
|
||||
<webcam-panel class="mt-6" v-if="showDashboardWebcam"></webcam-panel>
|
||||
<z-offset-panel class="mt-6" v-if="klippy_state === 'ready'"></z-offset-panel>
|
||||
<control-panel class="mt-6" v-if="klippy_state === 'ready'"></control-panel>
|
||||
<extruder-panel class="mt-6" v-if="klippy_state === 'ready'"></extruder-panel>
|
||||
<peripherie-panel v-if="klippy_state === 'ready'"></peripherie-panel>
|
||||
<miscellaneous-panel v-if="klippy_state === 'ready'"></miscellaneous-panel>
|
||||
</v-col>
|
||||
<v-col class="col-sm-12 col-md-7" v-if="klippy_connected">
|
||||
<tools-panel v-if="socket_connected && klippy_connected"></tools-panel>
|
||||
@@ -31,6 +32,7 @@
|
||||
socket_connected: state => state.socket.isConnected,
|
||||
klippy_connected: state => state.server.klippy_connected,
|
||||
klippy_state: state => state.server.klippy_state,
|
||||
moonrakerFailedPlugins: state => state.server.failed_plugins,
|
||||
|
||||
showDashboardWebcam: state => state.gui.dashboard.boolWebcam,
|
||||
showDashboardConsole: state => state.gui.dashboard.boolConsole,
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-row>
|
||||
<v-col
|
||||
v-for="(printer,key) in printers"
|
||||
v-bind:key="key"
|
||||
class="col-12 col-sm-6 col-md-4"
|
||||
>
|
||||
<farm-printer-panel v-bind:printer="printer"></farm-printer-panel>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
<script>
|
||||
import FarmPrinterPanel from "@/components/panels/FarmPrinterPanel";
|
||||
|
||||
export default {
|
||||
components: { FarmPrinterPanel },
|
||||
data () {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
printers: {
|
||||
get() {
|
||||
return this.$store.getters["farm/getPrinters"]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -53,7 +53,7 @@
|
||||
<v-card-title>
|
||||
G-Code Files
|
||||
<v-spacer class="d-none d-sm-block"></v-spacer>
|
||||
<input type="file" ref="fileUpload" style="display: none" @change="uploadFile" />
|
||||
<input type="file" ref="fileUpload" accept=".gcode, .ufp" style="display: none" multiple @change="uploadFile" />
|
||||
<v-item-group class="v-btn-toggle my-5 my-sm-0 col-12 col-sm-auto px-0 py-0" name="controllers">
|
||||
<v-btn @click="clickUploadButton" title="Upload new Gcode" class="primary flex-grow-1" :loading="loadings.includes('gcodeUpload')"><v-icon>mdi-upload</v-icon></v-btn>
|
||||
<v-btn @click="createDirectory" title="Create new Directory" class="flex-grow-1"><v-icon>mdi-folder-plus</v-icon></v-btn>
|
||||
@@ -116,7 +116,7 @@
|
||||
@click="clickRowGoBack"
|
||||
@dragover="dragOverFilelist($event, {isDirectory: true, filename: '..'})" @dragleave="dragLeaveFilelist" @drop.prevent.stop="dragDropFilelist($event, {isDirectory: true, filename: '..'})"
|
||||
>
|
||||
<td class=" "><v-icon>mdi-folder-upload</v-icon></td>
|
||||
<td class="pr-0 text-center" style="width: 32px;"><v-icon>mdi-folder-upload</v-icon></td>
|
||||
<td class=" " colspan="8">..</td>
|
||||
</tr>
|
||||
</template>
|
||||
@@ -132,10 +132,16 @@
|
||||
@dragover="dragOverFilelist($event, item)" @dragleave="dragLeaveFilelist" @drop.prevent.stop="dragDropFilelist($event, item)"
|
||||
:data-name="item.filename"
|
||||
>
|
||||
<td class="pr-0" style="width: 32px;">
|
||||
<td class="pr-0 text-center" style="width: 32px;">
|
||||
<v-icon v-if="item.isDirectory">mdi-folder</v-icon>
|
||||
<v-icon v-if="!item.isDirectory && !(item.thumbnails && item.thumbnails.length > 0)">mdi-file</v-icon>
|
||||
<img v-if="!item.isDirectory && item.thumbnails && item.thumbnails.length > 0" :src="'data:image/gif;base64,'+(item.thumbnails.length ? item.thumbnails[0].data : '--')" />
|
||||
<v-icon v-if="!item.isDirectory && !(existsSmallThumbnail(item))">mdi-file</v-icon>
|
||||
<v-tooltip v-if="!item.isDirectory && existsSmallThumbnail(item) && existsBigThumbnail(item)" top>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<img :src="'data:image/gif;base64,'+getSmallThumbnail(item)" width="32" height="32" v-bind="attrs" v-on="on" />
|
||||
</template>
|
||||
<span><img :src="'data:image/gif;base64,'+getBigThumbnail(item)" width="250" /></span>
|
||||
</v-tooltip>
|
||||
<img v-if="!item.isDirectory && existsSmallThumbnail(item) && !existsBigThumbnail(item)" :src="'data:image/gif;base64,'+getSmallThumbnail(item)" width="32" height="32" />
|
||||
</td>
|
||||
<td class=" ">{{ item.filename }}</td>
|
||||
<td class="text-no-wrap text-right" v-if="headers.filter(header => header.value === 'size')[0].visible">{{ item.isDirectory ? '--' : formatFilesize(item.size) }}</td>
|
||||
@@ -174,13 +180,12 @@
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
<v-dialog v-model="dialogPrintFile.show" max-width="400">
|
||||
<v-dialog v-model="dialogPrintFile.show" :max-width="getThumbnailWidth(dialogPrintFile.item)">
|
||||
<v-card>
|
||||
<v-img
|
||||
contain
|
||||
v-if="dialogPrintFile.item.thumbnails && dialogPrintFile.item.thumbnails.find(element => element.width === 300 || element.width === 400)"
|
||||
:src="'data:image/gif;base64,'+(dialogPrintFile.item.thumbnails ? dialogPrintFile.item.thumbnails.find(element => element.width === 300 || element.width === 400).data : '')"
|
||||
:height="(dialogPrintFile.item.thumbnails ? dialogPrintFile.item.thumbnails.find(element => element.width === 400 || element.width === 300).height : '')+'px'"
|
||||
v-if="existsBigThumbnail(dialogPrintFile.item)"
|
||||
:src="'data:image/gif;base64,'+getBigThumbnail(dialogPrintFile.item)"
|
||||
></v-img>
|
||||
<v-card-title class="headline">Start Job</v-card-title>
|
||||
<v-card-text>Do you want to start {{ dialogPrintFile.item.filename }}?</v-card-text>
|
||||
@@ -231,6 +236,30 @@
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-snackbar
|
||||
:timeout="-1"
|
||||
:value="true"
|
||||
fixed
|
||||
right
|
||||
bottom
|
||||
dark
|
||||
v-model="uploadSnackbar.status"
|
||||
>
|
||||
<span v-if="uploadSnackbar.max > 1" class="mr-1">({{ uploadSnackbar.number }}/{{ uploadSnackbar.max }})</span><strong>Uploading {{ uploadSnackbar.filename }}</strong><br />
|
||||
{{ Math.round(uploadSnackbar.percent) }} % @ {{ formatFilesize(Math.round(uploadSnackbar.speed)) }}/s<br />
|
||||
<v-progress-linear class="mt-2" :value="uploadSnackbar.percent"></v-progress-linear>
|
||||
<template v-slot:action="{ attrs }">
|
||||
<v-btn
|
||||
color="red"
|
||||
text
|
||||
v-bind="attrs"
|
||||
@click="cancelUpload"
|
||||
style="min-width: auto;"
|
||||
>
|
||||
<v-icon class="0">mdi-close</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
</v-snackbar>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@@ -298,7 +327,21 @@
|
||||
},
|
||||
input_rules: [
|
||||
value => value.indexOf(" ") === -1 || 'Name contain spaces!'
|
||||
]
|
||||
],
|
||||
uploadSnackbar: {
|
||||
status: false,
|
||||
filename: "",
|
||||
percent: 0,
|
||||
speed: 0,
|
||||
total: 0,
|
||||
number: 0,
|
||||
max: 0,
|
||||
cancelTokenSource: "",
|
||||
lastProgress: {
|
||||
time: 0,
|
||||
loaded: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -354,11 +397,24 @@
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
uploadFile: function() {
|
||||
async uploadFile() {
|
||||
if (this.$refs.fileUpload.files.length) {
|
||||
this.doUploadFile(this.$refs.fileUpload.files[0]).finally(() => {
|
||||
this.$refs.fileUpload.value = ''
|
||||
})
|
||||
this.$store.commit('socket/addLoading', { name: 'gcodeUpload' })
|
||||
let successFiles = []
|
||||
this.uploadSnackbar.number = 0
|
||||
this.uploadSnackbar.max = this.$refs.fileUpload.files.length
|
||||
for (const file of this.$refs.fileUpload.files) {
|
||||
this.uploadSnackbar.number++
|
||||
const result = await this.doUploadFile(file)
|
||||
successFiles.push(result)
|
||||
}
|
||||
|
||||
this.$store.commit('socket/removeLoading', { name: 'gcodeUpload' })
|
||||
for(const file of successFiles) {
|
||||
this.$toast.success("Upload of "+file+" successful!")
|
||||
}
|
||||
|
||||
this.$refs.fileUpload.value = ''
|
||||
}
|
||||
},
|
||||
doUploadFile: function(file) {
|
||||
@@ -366,22 +422,52 @@
|
||||
let formData = new FormData()
|
||||
let filename = file.name.replace(" ", "_")
|
||||
|
||||
formData.append('file', file, (this.currentPath+"/"+filename).substring(7))
|
||||
this.$store.commit('socket/addLoading', { name: 'gcodeUpload' })
|
||||
this.uploadSnackbar.filename = filename
|
||||
this.uploadSnackbar.status = true
|
||||
this.uploadSnackbar.percent = 0
|
||||
this.uploadSnackbar.speed = 0
|
||||
this.uploadSnackbar.lastProgress.loaded = 0
|
||||
this.uploadSnackbar.lastProgress.time = 0
|
||||
|
||||
return axios.post('//' + this.hostname + ':' + this.port + '/server/files/upload',
|
||||
formData, { headers: { 'Content-Type': 'multipart/form-data' } }
|
||||
).then((result) => {
|
||||
this.$store.commit('socket/removeLoading', { name: 'gcodeUpload' })
|
||||
toast.success("Upload of "+result.data.result+" successful!");
|
||||
}).catch(() => {
|
||||
this.$store.commit('socket/removeLoading', { name: 'gcodeUpload' })
|
||||
toast.error("Cannot upload the file!")
|
||||
});
|
||||
formData.append('file', file, (this.currentPath+"/"+filename).substring(7))
|
||||
|
||||
return new Promise(resolve => {
|
||||
this.uploadSnackbar.cancelTokenSource = axios.CancelToken.source();
|
||||
axios.post('//' + this.hostname + ':' + this.port + '/server/files/upload',
|
||||
formData, {
|
||||
cancelToken: this.uploadSnackbar.cancelTokenSource.token,
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
onUploadProgress: (progressEvent) => {
|
||||
this.uploadSnackbar.percent = (progressEvent.loaded * 100) / progressEvent.total
|
||||
if (this.uploadSnackbar.lastProgress.time) {
|
||||
const time = progressEvent.timeStamp - this.uploadSnackbar.lastProgress.time
|
||||
const data = progressEvent.loaded - this.uploadSnackbar.lastProgress.loaded
|
||||
|
||||
if (time) this.uploadSnackbar.speed = data / (time / 1000)
|
||||
}
|
||||
|
||||
this.uploadSnackbar.lastProgress.time = progressEvent.timeStamp
|
||||
this.uploadSnackbar.lastProgress.loaded = progressEvent.loaded
|
||||
this.uploadSnackbar.total = progressEvent.total
|
||||
}
|
||||
}
|
||||
).then((result) => {
|
||||
this.uploadSnackbar.status = false
|
||||
resolve(result.data.result)
|
||||
}).catch(() => {
|
||||
this.uploadSnackbar.status = false
|
||||
this.$store.commit('socket/removeLoading', { name: 'gcodeUpload' })
|
||||
toast.error("Cannot upload the file!")
|
||||
})
|
||||
})
|
||||
},
|
||||
clickUploadButton: function() {
|
||||
this.$refs.fileUpload.click()
|
||||
},
|
||||
cancelUpload: function() {
|
||||
this.uploadSnackbar.cancelTokenSource.cancel()
|
||||
this.uploadSnackbar.status = false
|
||||
},
|
||||
refreshFileList: function() {
|
||||
this.$socket.sendObj('server.files.get_directory', { path: this.currentPath }, 'files/getDirectory')
|
||||
},
|
||||
@@ -467,14 +553,7 @@
|
||||
}, 'files/getMove');
|
||||
},
|
||||
removeFile() {
|
||||
let filename = (this.currentPath+"/"+this.contextMenu.item.filename);
|
||||
axios.delete(
|
||||
'//'+ this.hostname + ':' + this.port +'/server/files/' + encodeURI(filename)
|
||||
).then((result) => {
|
||||
this.$toast.success(result.data.result+" successfully deleted.");
|
||||
}).catch(() => {
|
||||
this.$toast.error("Error! Cannot delete file.");
|
||||
});
|
||||
this.$socket.sendObj('server.files.delete_file', { path: this.currentPath+"/"+this.contextMenu.item.filename }, 'files/getDeleteFile');
|
||||
},
|
||||
createDirectory: function() {
|
||||
this.dialogCreateDirectory.name = "";
|
||||
@@ -539,7 +618,7 @@
|
||||
this.dropzone.visibility = 'hidden';
|
||||
this.dropzone.opacity = 0;
|
||||
|
||||
if (!this.is_printing && e.dataTransfer.files.length) {
|
||||
if (e.dataTransfer.files.length) {
|
||||
await this.doUploadFile(e.dataTransfer.files[0]);
|
||||
}
|
||||
}
|
||||
@@ -646,6 +725,50 @@
|
||||
this.$store.dispatch("gui/setGcodefilesMetadata", {name: name, value: value});
|
||||
}
|
||||
},
|
||||
existsSmallThumbnail(item) {
|
||||
return (
|
||||
'thumbnails' in item &&
|
||||
item.thumbnails !== undefined &&
|
||||
item.thumbnails.findIndex(thumb => thumb.width >= 32 && thumb.width <= 64 && thumb.height >= 32 && thumb.height <= 64) !== -1
|
||||
)
|
||||
},
|
||||
getSmallThumbnail(item) {
|
||||
if (this.existsSmallThumbnail(item)) {
|
||||
const thumbnail = item.thumbnails.find(thumb =>
|
||||
thumb.width >= 32 && thumb.width <= 64 &&
|
||||
thumb.height >= 32 && thumb.height <= 64
|
||||
)
|
||||
|
||||
if (thumbnail) return thumbnail.data
|
||||
}
|
||||
|
||||
return ""
|
||||
},
|
||||
existsBigThumbnail(item) {
|
||||
return (
|
||||
'thumbnails' in item &&
|
||||
item.thumbnails !== undefined &&
|
||||
item.thumbnails.findIndex(thumb => thumb.width >= 300 && thumb.width <= 400) !== -1
|
||||
)
|
||||
},
|
||||
getBigThumbnail(item) {
|
||||
if (this.existsBigThumbnail(item)) {
|
||||
const thumbnail = item.thumbnails.find(thumb => thumb.width >= 300 && thumb.width <= 400)
|
||||
|
||||
if (thumbnail) return thumbnail.data
|
||||
}
|
||||
|
||||
return ""
|
||||
},
|
||||
getThumbnailWidth(item) {
|
||||
if (this.existsBigThumbnail(item)) {
|
||||
const thumbnail = item.thumbnails.find(thumb => thumb.width >= 300 && thumb.width <= 400)
|
||||
|
||||
if (thumbnail) return thumbnail.width
|
||||
}
|
||||
|
||||
return 400
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
filetree: {
|
||||
@@ -672,11 +795,13 @@
|
||||
displayMetadata: {
|
||||
deep: true,
|
||||
handler(newVal) {
|
||||
Object.entries(newVal).forEach(value => {
|
||||
if (this.headers.filter(header => header.value === value[0]).length) {
|
||||
this.headers.filter(header => header.value === value[0])[0].visible = value[1];
|
||||
}
|
||||
});
|
||||
if (newVal !== undefined && typeof(newVal) === 'object') {
|
||||
Object.entries(newVal).forEach(value => {
|
||||
if (this.headers.filter(header => header.value === value[0]).length) {
|
||||
this.headers.filter(header => header.value === value[0])[0].visible = value[1];
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
showHiddenFiles: function() {
|
||||
|
||||
@@ -26,12 +26,14 @@
|
||||
class=" d-sm-none"
|
||||
@click="openRenameProfile()">{{ this.bed_mesh && this.bed_mesh.profile_name ? this.bed_mesh.profile_name : "" }}</v-btn>
|
||||
<v-item-group class="v-btn-toggle d-none d-sm-flex" name="controllers">
|
||||
<v-btn small class="px-2 minwidth-0" color="primary" @click="homePrinter" :loading="loadings.includes('homeAll')" title="Home All"><v-icon small>mdi-home</v-icon></v-btn>
|
||||
<v-btn small class="px-2 minwidth-0" color="primary" @click="clearBedMesh" :loading="loadings.includes('bedMeshClear')" v-if="this.bed_mesh && this.bed_mesh.profile_name" title="Clear bed mesh">Clear</v-btn>
|
||||
<v-btn small class="px-2 minwidth-0" color="primary" @click="calibrateDialog = true" :loading="loadings.includes('bedMeshCalibrate')" :disabled="is_printing" title="Calibrate new bed mesh">Calibrate</v-btn>
|
||||
</v-item-group>
|
||||
</v-toolbar>
|
||||
<v-card-text class="d-sm-none text-center pb-0">
|
||||
<v-item-group class="v-btn-toggle" name="controllers">
|
||||
<v-btn small class="px-2 minwidth-0" color="primary" @click="homePrinter" :loading="loadings.includes('homeAll')" title="Home All"><v-icon small>mdi-home</v-icon></v-btn>
|
||||
<v-btn small class="px-2 minwidth-0" color="primary" @click="clearBedMesh" :loading="loadings.includes('bedMeshClear')" v-if="this.bed_mesh && this.bed_mesh.profile_name" title="Clear bed mesh">Clear</v-btn>
|
||||
<v-btn small class="px-2 minwidth-0" color="primary" @click="calibrateDialog = true" :loading="loadings.includes('bedMeshCalibrate')" :disabled="is_printing" title="Calibrate new bed mesh">Calibrate</v-btn>
|
||||
</v-item-group>
|
||||
@@ -40,11 +42,13 @@
|
||||
No bed_mesh has been loaded yet.
|
||||
</v-card-text>
|
||||
<v-card-text class="px-0 py-0 content" v-if="this.bed_mesh && this.bed_mesh.profile_name">
|
||||
<v-row>
|
||||
<v-col class="pb-0 pt-5">
|
||||
<Plotly ref="heightmap" :data="data" :layout="layout" :display-mode-bar="false"></Plotly>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-container class="px-0 py-0">
|
||||
<v-row>
|
||||
<v-col class="pb-0 pt-5">
|
||||
<Plotly ref="heightmap" :data="data" :layout="layout" :display-mode-bar="false"></Plotly>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
<v-card-actions v-if="this.bed_mesh && this.bed_mesh.profile_name" class="py-0">
|
||||
<v-spacer></v-spacer>
|
||||
@@ -62,26 +66,22 @@
|
||||
<span class="subheading"><v-icon left>mdi-stack-overflow</v-icon>Profile</span>
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
<v-card-text class="py-0">
|
||||
<v-row>
|
||||
<v-col class="px-0 py-1">
|
||||
<v-simple-table>
|
||||
<template v-slot:default>
|
||||
<tbody>
|
||||
<tr v-for="(profile, index) in profiles" :key="index" >
|
||||
<td>{{ profile.name }}<small class="ml-2" v-if="'deleted' in profile.data">(deleted)</small></td>
|
||||
<td class="text-right">
|
||||
<v-btn-toggle dense no-gutters>
|
||||
<v-btn class="btnMinWidthAuto" @click="loadProfile(profile.name)" :loading="loadings.includes('bedMeshLoad_'+profile.name)" :disabled="('profile_name' in bed_mesh && bed_mesh.profile_name === profile.name) || 'deleted' in profile.data" ><v-icon small>mdi-view-grid-plus</v-icon></v-btn>
|
||||
<v-btn class="btnMinWidthAuto" @click="openRemoveProfile(profile.name)" :loading="loadings.includes('bedMeshRemove_'+profile.name)" :disabled="'deleted' in profile.data" ><v-icon small>mdi-delete</v-icon></v-btn>
|
||||
</v-btn-toggle>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</template>
|
||||
</v-simple-table>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-card-text class="py-0 px-0">
|
||||
<v-simple-table>
|
||||
<template v-slot:default>
|
||||
<tbody>
|
||||
<tr v-for="(profile, index) in profiles" :key="index" >
|
||||
<td>{{ profile.name }}<small class="ml-2" v-if="'deleted' in profile.data">(deleted)</small></td>
|
||||
<td class="text-right">
|
||||
<v-btn-toggle dense no-gutters>
|
||||
<v-btn class="btnMinWidthAuto" @click="loadProfile(profile.name)" :loading="loadings.includes('bedMeshLoad_'+profile.name)" :disabled="('profile_name' in bed_mesh && bed_mesh.profile_name === profile.name) || 'deleted' in profile.data" ><v-icon small>mdi-view-grid-plus</v-icon></v-btn>
|
||||
<v-btn class="btnMinWidthAuto" @click="openRemoveProfile(profile.name)" :loading="loadings.includes('bedMeshRemove_'+profile.name)" :disabled="'deleted' in profile.data" ><v-icon small>mdi-delete</v-icon></v-btn>
|
||||
</v-btn-toggle>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</template>
|
||||
</v-simple-table>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-col>
|
||||
@@ -324,7 +324,7 @@
|
||||
},
|
||||
loadProfile: function(name) {
|
||||
this.$store.commit('socket/addLoading', { name: 'bedMeshLoad_'+name })
|
||||
this.$store.commit('server/addEvent', "BED_MESH_PROFILE LOAD="+name)
|
||||
this.$store.commit('server/addEvent', { message: "BED_MESH_PROFILE LOAD="+name, type: 'command' })
|
||||
this.$socket.sendObj('printer.gcode.script', { script: "BED_MESH_PROFILE LOAD="+name }, "socket/removeLoading", { name: 'bedMeshLoad_'+name })
|
||||
},
|
||||
openRenameProfile: function() {
|
||||
@@ -334,7 +334,7 @@
|
||||
renameProfile: function() {
|
||||
this.renameDialog = false;
|
||||
this.$store.commit('socket/addLoading', { name: 'bedMeshRename' })
|
||||
this.$store.commit('server/addEvent', "BED_MESH_PROFILE SAVE="+this.newName.toUpperCase())
|
||||
this.$store.commit('server/addEvent', { message: "BED_MESH_PROFILE SAVE="+this.newName.toUpperCase(), type: 'command' })
|
||||
this.$socket.sendObj('printer.gcode.script', { script: "BED_MESH_PROFILE SAVE="+this.newName.toUpperCase() }, "socket/removeLoading", { name: 'bedMeshRename' })
|
||||
},
|
||||
openRemoveProfile: function(name) {
|
||||
@@ -344,19 +344,24 @@
|
||||
removeProfile: function() {
|
||||
this.removeDialog = false;
|
||||
this.$store.commit('socket/addLoading', { name: 'bedMeshRemove_'+this.newName })
|
||||
this.$store.commit('server/addEvent', "BED_MESH_PROFILE REMOVE="+this.newName)
|
||||
this.$store.commit('server/addEvent', { message: "BED_MESH_PROFILE REMOVE="+this.newName, type: 'command' })
|
||||
this.$socket.sendObj('printer.gcode.script', { script: "BED_MESH_PROFILE REMOVE="+this.newName }, "printer/removeBedMeshProfile", { name: this.newName })
|
||||
this.removeDialogProfile = ""
|
||||
},
|
||||
homePrinter: function() {
|
||||
this.$store.commit('socket/addLoading', { name: 'homeAll' })
|
||||
this.$store.commit('server/addEvent', { message: "G28", type: 'command' })
|
||||
this.$socket.sendObj('printer.gcode.script', { script: "G28" }, "socket/removeLoading", { name: 'homeAll' })
|
||||
},
|
||||
clearBedMesh: function() {
|
||||
this.$store.commit('socket/addLoading', { name: 'bedMeshClear' })
|
||||
this.$store.commit('server/addEvent', "BED_MESH_CLEAR")
|
||||
this.$store.commit('server/addEvent', { message: "BED_MESH_CLEAR", type: 'command' })
|
||||
this.$socket.sendObj('printer.gcode.script', { script: "BED_MESH_CLEAR" }, "socket/removeLoading", { name: 'bedMeshClear' })
|
||||
},
|
||||
calibrateMesh: function() {
|
||||
this.calibrateDialog = false;
|
||||
this.$store.commit('socket/addLoading', { name: 'bedMeshCalibrate' });
|
||||
this.$store.commit('server/addEvent', "BED_MESH_CALIBRATE")
|
||||
this.$store.commit('server/addEvent', { message: "BED_MESH_CALIBRATE", type: 'command' })
|
||||
this.$socket.sendObj('printer.gcode.script', { script: "BED_MESH_CALIBRATE" }, "socket/removeLoading", { name: 'bedMeshCalibrate' });
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<router-view></router-view>
|
||||
</div>
|
||||
<v-container fluid class="px-0 py-0">
|
||||
<v-row>
|
||||
<v-col>
|
||||
<router-view></router-view>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
|
||||
@@ -4,14 +4,16 @@
|
||||
<v-col class="col-12 col-md-6 col-lg-4">
|
||||
<settings-general-panel></settings-general-panel>
|
||||
<settings-webcam-panel class="mt-6"></settings-webcam-panel>
|
||||
</v-col>
|
||||
<v-col class="col-12 col-md-6 col-lg-4">
|
||||
<settings-dashboard-panel></settings-dashboard-panel>
|
||||
<settings-dashboard-panel class="mt-6"></settings-dashboard-panel>
|
||||
<settings-console-panel class="mt-6"></settings-console-panel>
|
||||
</v-col>
|
||||
<v-col class="col-12 col-md-6 col-lg-4">
|
||||
<settings-macros-panel></settings-macros-panel>
|
||||
</v-col>
|
||||
<v-col class="col-12 col-md-6 col-lg-4">
|
||||
<settings-presets-panel></settings-presets-panel>
|
||||
<settings-remote-printers-panel class="mt-6"></settings-remote-printers-panel>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1,35 +1,25 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-container fluid py-0 px-0>
|
||||
<v-row>
|
||||
<v-col class="col-12 col-sm-6">
|
||||
<settings-config-files-panel></settings-config-files-panel>
|
||||
</v-col>
|
||||
<v-col class="col-12 col-sm-6">
|
||||
<v-row v-if="klippy_state === 'ready'">
|
||||
<v-col class="col-12 pt-0">
|
||||
<settings-limits-panel></settings-limits-panel>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-if="klippy_state !== 'ready'">
|
||||
<v-col class="col-12 pt-0">
|
||||
<klippy-state-panel></klippy-state-panel>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<settings-limits-panel v-if="klippy_state === 'ready'"></settings-limits-panel>
|
||||
<klippy-state-panel v-if="klippy_state !== 'ready'"></klippy-state-panel>
|
||||
<settings-update-panel v-if="updateManager" class="mt-6"></settings-update-panel>
|
||||
<v-row class="mt-6">
|
||||
<v-col class="col-md-6" v-if="klippy_state === 'ready'">
|
||||
<settings-endstop-panel></settings-endstop-panel>
|
||||
<settings-runout-panel></settings-runout-panel>
|
||||
</v-col>
|
||||
<v-col :class="(klippy_state !== 'ready' ? 'col-md-12' : 'col-md-6')">
|
||||
<settings-update-panel v-if="updateManager"></settings-update-panel>
|
||||
<settings-logfiles-panel :class="updateManager ? 'mt-6' : ''"></settings-logfiles-panel>
|
||||
<settings-logfiles-panel></settings-logfiles-panel>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
</v-row>
|
||||
</div>
|
||||
</v-container>
|
||||
</template>
|
||||
<script>
|
||||
import {mapState} from "vuex";
|
||||
|
||||
@@ -24,7 +24,7 @@ export function caseInsensitiveNameSort(a, b) {
|
||||
|
||||
export function colorConsoleMessage(item) {
|
||||
if (item.message.startsWith('!! ')) return "red--text"
|
||||
if ('send' in item && item.send) return "blue--text"
|
||||
if ('type' in item && item.type === 'command') return "blue--text"
|
||||
|
||||
return '';
|
||||
}
|
||||
@@ -36,4 +36,15 @@ export function formatConsoleMessage(message) {
|
||||
message = message.replace(/(?:\r\n|\r|\n)/g, '<br>')
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
export function convertName(name) {
|
||||
let output = ""
|
||||
name = name.replaceAll("_", " ")
|
||||
name.split(" ").forEach(split => {
|
||||
output += " "+split.charAt(0).toUpperCase() + split.slice(1)
|
||||
})
|
||||
output = output.slice(1)
|
||||
|
||||
return output;
|
||||
}
|
||||
@@ -1,26 +1,32 @@
|
||||
export default class WebSocketClient {
|
||||
|
||||
constructor (url, options) {
|
||||
this.instance = null;
|
||||
this.url = url;
|
||||
this.reconnectInterval = options.reconnectInterval;
|
||||
this.store = options.store;
|
||||
this.wsData = [];
|
||||
this.timerId = 0;
|
||||
this.keepAliveTimeout = 1000;
|
||||
this.instance = null
|
||||
this.url = url
|
||||
this.reconnects = 0
|
||||
this.maxReconnects = options.maxReconnects || 10
|
||||
this.reconnectInterval = options.reconnectInterval || 1000
|
||||
this.store = options.store
|
||||
this.wsData = []
|
||||
this.timerId = 0
|
||||
this.keepAliveTimeout = 1000
|
||||
|
||||
this.onOpen = null;
|
||||
this.onMessage = null;
|
||||
this.onClose = null;
|
||||
this.onError = null;
|
||||
this.onOpen = null
|
||||
this.onMessage = null
|
||||
this.onClose = null
|
||||
this.onError = null
|
||||
this.blacklistMessages = [
|
||||
"Metadata not available for",
|
||||
"Klippy Request Timed Out",
|
||||
"Klippy Host not connected",
|
||||
];
|
||||
]
|
||||
this.blacklistFunctions = [
|
||||
"getPowerDevices",
|
||||
];
|
||||
]
|
||||
}
|
||||
|
||||
setUrl(url) {
|
||||
this.url = url
|
||||
}
|
||||
|
||||
createMessage (method, params, id) {
|
||||
@@ -42,26 +48,36 @@ export default class WebSocketClient {
|
||||
}
|
||||
|
||||
connect () {
|
||||
this.instance = new WebSocket(this.url);
|
||||
this.store.dispatch("socket/setData", { isConnecting: true })
|
||||
this.instance = new WebSocket(this.url)
|
||||
|
||||
this.instance.onopen = () => {
|
||||
if (this.store) this.passToStore('socket/onOpen', event);
|
||||
};
|
||||
this.reconnects = 0
|
||||
if (this.store) this.passToStore('socket/onOpen', event)
|
||||
}
|
||||
|
||||
this.instance.onclose = (e) => {
|
||||
this.passToStore('socket/onClose', e);
|
||||
this.passToStore('socket/onClose', e)
|
||||
|
||||
setTimeout(() => {
|
||||
this.connect();
|
||||
}, this.reconnectInterval);
|
||||
};
|
||||
if (!e.wasClean && this.reconnects < this.maxReconnects) {
|
||||
this.reconnects++
|
||||
setTimeout(() => {
|
||||
this.connect()
|
||||
}, this.reconnectInterval)
|
||||
} else {
|
||||
this.store.dispatch("socket/setData", {
|
||||
isConnecting: false,
|
||||
connectingFailed: true
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
this.instance.onerror = () => {
|
||||
this.instance.close();
|
||||
};
|
||||
this.instance.close()
|
||||
}
|
||||
|
||||
this.instance.onmessage = (msg) => {
|
||||
let data = JSON.parse(msg.data);
|
||||
let data = JSON.parse(msg.data)
|
||||
if (this.store) {
|
||||
if (this.wsData.filter(item => item.id === data.id).length > 0 &&
|
||||
this.wsData.filter(item => item.id === data.id)[0].action !== "") {
|
||||
@@ -79,11 +95,12 @@ export default class WebSocketClient {
|
||||
error: data.error,
|
||||
requestParams: tmpWsData.params
|
||||
})
|
||||
);
|
||||
)
|
||||
}
|
||||
} else {
|
||||
let result = data.result
|
||||
if (result === "ok") result = { result: result }
|
||||
if (typeof(result) === "string") result = { result: result }
|
||||
|
||||
let preload = {}
|
||||
let wsData = this.wsData.filter(item => item.id === data.id)[0]
|
||||
@@ -94,7 +111,11 @@ export default class WebSocketClient {
|
||||
}
|
||||
} else this.passToStore('socket/onMessage', data)
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
close() {
|
||||
if (this.instance) this.instance.close()
|
||||
}
|
||||
|
||||
sendObj (method, params, action = '', actionPreload = null) {
|
||||
@@ -106,7 +127,7 @@ export default class WebSocketClient {
|
||||
params: params,
|
||||
actionPreload: actionPreload,
|
||||
})
|
||||
this.instance.send(this.createMessage(method, params, id));
|
||||
this.instance.send(this.createMessage(method, params, id))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import Dashboard from '../pages/Dashboard.vue'
|
||||
import Webcam from '../pages/Webcam.vue'
|
||||
import Farm from '../pages/Farm.vue'
|
||||
import Console from '../pages/Console.vue'
|
||||
import Heightmap from '../pages/Heightmap.vue'
|
||||
import Files from '../pages/Files.vue'
|
||||
@@ -11,10 +12,16 @@ const routes = [
|
||||
{
|
||||
title: "Dashboard",
|
||||
path: '/',
|
||||
icon: 'view-dashboard',
|
||||
icon: 'monitor-dashboard',
|
||||
component: Dashboard,
|
||||
alwaysShow: true,
|
||||
},
|
||||
{
|
||||
title: "Printers",
|
||||
path: '/allPrinters',
|
||||
component: Farm,
|
||||
alwaysShow: false,
|
||||
},
|
||||
{
|
||||
title: "Webcam",
|
||||
path: '/cam',
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//import Vue from 'vue'
|
||||
import router from "../plugins/router";
|
||||
|
||||
|
||||
@@ -6,4 +7,22 @@ export default {
|
||||
switchToDashboard() {
|
||||
router.push("/");
|
||||
},
|
||||
|
||||
changePrinter({ dispatch, getters, state }, payload) {
|
||||
const remoteMode = state.socket.remoteMode
|
||||
|
||||
dispatch('files/reset')
|
||||
dispatch('gui/reset')
|
||||
dispatch('printer/reset')
|
||||
dispatch('server/reset')
|
||||
dispatch('socket/reset')
|
||||
|
||||
const printerSocket = getters["farm/"+payload.printer+"/getSocketData"]
|
||||
|
||||
dispatch('socket/setSocket', {
|
||||
hostname: printerSocket.hostname,
|
||||
port: printerSocket.port,
|
||||
remoteMode: remoteMode,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
import printer from './printer'
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: () => {
|
||||
|
||||
},
|
||||
getters: {
|
||||
countPrinters: state => {
|
||||
return Object.keys(state).length
|
||||
},
|
||||
getPrinters: state => {
|
||||
return state
|
||||
},
|
||||
getPrinterName: (getters) => (namespace) => {
|
||||
return getters[namespace+"/getPrinterName"]
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
readStoredPrinters({ rootState, commit }) {
|
||||
if (rootState.socket.remoteMode) {
|
||||
if (localStorage.getItem('printers')) {
|
||||
try {
|
||||
const printers = JSON.parse(localStorage.getItem('printers')) || []
|
||||
printers.forEach((printer) => {
|
||||
commit('addPrinter',{
|
||||
hostname: printer.hostname,
|
||||
port: printer.port,
|
||||
protocol: rootState.socket.protocol
|
||||
})
|
||||
})
|
||||
} catch(e) {
|
||||
localStorage.removeItem('printers')
|
||||
}
|
||||
}
|
||||
} else {
|
||||
rootState.gui.remotePrinters.forEach((printer) => {
|
||||
commit('addPrinter',{
|
||||
hostname: printer.hostname,
|
||||
port: printer.port,
|
||||
webPort: printer.webPort,
|
||||
protocol: rootState.socket.protocol
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
savePrinters({ rootState, state, dispatch }) {
|
||||
const printers = []
|
||||
|
||||
if (rootState.socket.remoteMode) {
|
||||
for (const key in state) {
|
||||
printers.push({
|
||||
hostname: state[key].socket.hostname,
|
||||
port: state[key].socket.port,
|
||||
})
|
||||
}
|
||||
|
||||
localStorage.setItem('printers', JSON.stringify(printers))
|
||||
} else {
|
||||
for (const key in state) {
|
||||
printers.push({
|
||||
hostname: state[key].socket.hostname,
|
||||
port: state[key].socket.port,
|
||||
webPort: state[key].socket.webPort,
|
||||
})
|
||||
}
|
||||
|
||||
dispatch("gui/setSettings", { remotePrinters: printers }, { root: true })
|
||||
}
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
addPrinter(state, payload) {
|
||||
if ('hostname' in payload && payload.hostname !== "") {
|
||||
const pritnerExist = Object.entries(state).findIndex((printer) =>
|
||||
printer.length > 0 &&
|
||||
'socket' in printer[1] &&
|
||||
'hostname' in printer[1].socket && printer[1].socket.hostname === payload.hostname &&
|
||||
'port' in printer[1].socket && printer[1].socket.port === payload.port
|
||||
)
|
||||
|
||||
const nextPrinterName = 'printer'+Object.entries(state).length
|
||||
if (pritnerExist === -1 && !this.hasModule(['farm', nextPrinterName])) {
|
||||
this.registerModule(['farm', nextPrinterName], printer)
|
||||
this.commit('farm/'+nextPrinterName+'/setSocketData', {...payload, _namespace: nextPrinterName })
|
||||
this.dispatch('farm/'+nextPrinterName+'/connect', {}, { root: true })
|
||||
}
|
||||
}
|
||||
},
|
||||
removePrinter(state, payload) {
|
||||
if (payload.name in state) {
|
||||
if (state[payload.name].socket.instance) state[payload.name].socket.instance.close()
|
||||
this.unregisterModule(['farm', payload.name])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
export default {
|
||||
reset({commit}) {
|
||||
commit('reset')
|
||||
},
|
||||
|
||||
connect({ state, commit, dispatch, getters }) {
|
||||
commit("setSocketData", { isConnecting: true })
|
||||
const socket = new WebSocket(getters.getSocketUrl)
|
||||
|
||||
socket.onopen = () => {
|
||||
commit("setSocketData", {
|
||||
instance: socket,
|
||||
reconnects: 0,
|
||||
isConnecting: false,
|
||||
isConnected: true
|
||||
})
|
||||
|
||||
dispatch("initPrinter")
|
||||
}
|
||||
|
||||
socket.onclose = (e) => {
|
||||
if (!e.wasClean && state.socket.reconnects < state.socket.maxReconnects) {
|
||||
commit("setSocketData", { reconnects: state.socket.reconnects + 1 })
|
||||
|
||||
setTimeout(() => {
|
||||
dispatch("connect")
|
||||
}, state.socket.reconnectInterval)
|
||||
} else {
|
||||
commit("setSocketData", {
|
||||
isConnecting: false,
|
||||
isConnected: false,
|
||||
reconnects: 0
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
socket.onerror = () => {
|
||||
|
||||
}
|
||||
|
||||
socket.onmessage = (msg) => {
|
||||
let data = JSON.parse(msg.data)
|
||||
if (data && data.method) {
|
||||
switch (data.method) {
|
||||
case "notify_status_update":
|
||||
commit("setData", data.params[0])
|
||||
break
|
||||
|
||||
case "notify_filelist_changed":
|
||||
commit("notifyFilelistChanged", data.params[0])
|
||||
break
|
||||
|
||||
case "notify_klippy_disconnected":
|
||||
dispatch("disconnectKlippy")
|
||||
break
|
||||
|
||||
case "notify_klippy_ready":
|
||||
dispatch("initPrinter")
|
||||
break
|
||||
}
|
||||
} else if ("result" in data) {
|
||||
if (
|
||||
state.socket.wsData.filter(item => item.id === data.id).length > 0 &&
|
||||
state.socket.wsData.filter(item => item.id === data.id)[0].action !== undefined &&
|
||||
state.socket.wsData.filter(item => item.id === data.id)[0].action !== ""
|
||||
) {
|
||||
let result = data.result
|
||||
if (result === "ok") result = { result: result }
|
||||
if (typeof(result) === "string") result = { result: result }
|
||||
|
||||
let preload = {}
|
||||
let wsData = state.socket.wsData.filter(item => item.id === data.id)[0]
|
||||
if (wsData.actionPreload) Object.assign(preload, wsData.actionPreload)
|
||||
Object.assign(preload, { requestParams: wsData.params })
|
||||
Object.assign(preload, result)
|
||||
|
||||
dispatch(wsData.action, preload)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
reconnect({ state, dispatch }) {
|
||||
if(state.socket.instance) state.socket.instance.close()
|
||||
dispatch("connect")
|
||||
},
|
||||
|
||||
sendObj ({ state, commit }, payload) {
|
||||
if (state.socket.instance && state.socket.instance.readyState === WebSocket.OPEN) {
|
||||
const id = Math.floor(Math.random() * 10000) + 1
|
||||
|
||||
commit("addWsData", {
|
||||
id: id,
|
||||
action: payload.action,
|
||||
params: payload.params || {},
|
||||
actionPreload: payload.actionPreload || null,
|
||||
})
|
||||
|
||||
state.socket.instance.send(JSON.stringify({
|
||||
jsonrpc: '2.0',
|
||||
method: payload.method,
|
||||
params: payload.params || {},
|
||||
id: id
|
||||
}))
|
||||
}
|
||||
},
|
||||
|
||||
disconnectKlippy({ commit }) {
|
||||
commit("setData", { print_stats: { state: "error" }})
|
||||
},
|
||||
|
||||
initPrinter({ commit, dispatch }) {
|
||||
commit("resetData")
|
||||
|
||||
dispatch("sendObj", {
|
||||
method: "printer.objects.list",
|
||||
action: "getObjectsList",
|
||||
})
|
||||
|
||||
dispatch("sendObj", {
|
||||
method: "server.files.list",
|
||||
action: "getConfigDir",
|
||||
params: { root: "config"}
|
||||
})
|
||||
},
|
||||
|
||||
getObjectsList({ dispatch }, payload) {
|
||||
const allowed = [
|
||||
'webhooks',
|
||||
'print_stats',
|
||||
'virtual_sdcard',
|
||||
'display_status',
|
||||
'heaters',
|
||||
'heater_bed',
|
||||
'heater_fan',
|
||||
'fan',
|
||||
'temperature_fan',
|
||||
'temperature_sensor',
|
||||
'idle_timeout',
|
||||
'toolhead'
|
||||
]
|
||||
|
||||
let subscripts = {}
|
||||
payload.objects.forEach((object) => {
|
||||
const splits = object.split(" ")
|
||||
const objectName = splits[0]
|
||||
|
||||
if (
|
||||
allowed.includes(objectName) ||
|
||||
objectName.startsWith("extruder")
|
||||
) {
|
||||
subscripts = {...subscripts, [object]: null }
|
||||
}
|
||||
})
|
||||
|
||||
if (subscripts !== {})
|
||||
dispatch("sendObj", {
|
||||
method: 'printer.objects.subscribe',
|
||||
params: { objects: subscripts },
|
||||
action: "getData"
|
||||
});
|
||||
},
|
||||
|
||||
getData({ commit }, payload) {
|
||||
commit("setData", payload)
|
||||
},
|
||||
|
||||
getMetadataCurrentFile({ commit }, payload) {
|
||||
commit("setCurrentFile", payload)
|
||||
},
|
||||
|
||||
getConfigDir({ commit }, payload) {
|
||||
commit("setConfigDir", payload)
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,250 @@
|
||||
import {themeDir} from "@/store/variables";
|
||||
|
||||
|
||||
export default {
|
||||
|
||||
getSocketUrl: (state) => {
|
||||
return state.socket.protocol+"://"+state.socket.hostname+":"+state.socket.port+"/websocket"
|
||||
},
|
||||
|
||||
getSocketData: (state) => {
|
||||
return state.socket
|
||||
},
|
||||
|
||||
isCurrentPrinter: (state, getters, rootState) => {
|
||||
return (
|
||||
rootState.socket.hostname === state.socket.hostname &&
|
||||
rootState.socket.port === state.socket.port
|
||||
)
|
||||
},
|
||||
|
||||
getPrinterName: (state) => {
|
||||
if (
|
||||
'gui' in state.data &&
|
||||
'general' in state.data.gui &&
|
||||
'printername' in state.data.gui.general &&
|
||||
state.data.gui.general.printername !== ""
|
||||
) return state.data.gui.general.printername
|
||||
|
||||
return parseInt(state.socket.port) !== 80 ? state.socket.hostname+':'+state.socket.port : state.socket.hostname
|
||||
},
|
||||
|
||||
getStatus: (state, getters) => {
|
||||
if (!state.socket.isConnected) {
|
||||
return state.socket.isConnecting ? "Connecting..." : "Disconnected"
|
||||
} else if (state.data.print_stats && state.data.print_stats.state) {
|
||||
if (state.data.print_stats.state === "printing") {
|
||||
const percent = getters["getPrintPercent"]
|
||||
|
||||
return Math.round(percent*100)+"% Printing"
|
||||
}
|
||||
|
||||
return state.data.print_stats.state.charAt(0).toUpperCase() + state.data.print_stats.state.slice(1)
|
||||
}
|
||||
|
||||
return "Unknown"
|
||||
},
|
||||
|
||||
getCurrentFilename: (state) => {
|
||||
if (
|
||||
'print_stats' in state.data &&
|
||||
'filename' in state.data.print_stats
|
||||
) {
|
||||
return state.data.print_stats.filename
|
||||
}
|
||||
|
||||
return ""
|
||||
},
|
||||
|
||||
getPrintPercent: (state) => {
|
||||
if (
|
||||
'filename' in state.current_file &&
|
||||
'gcode_start_byte' in state.current_file &&
|
||||
'gcode_end_byte' in state.current_file &&
|
||||
state.current_file.filename === state.data.print_stats.filename
|
||||
) {
|
||||
if (state.data.virtual_sdcard.file_position <= state.current_file.gcode_start_byte) return 0
|
||||
if (state.data.virtual_sdcard.file_position >= state.current_file.gcode_end_byte) return 1
|
||||
|
||||
let currentPosition = state.data.virtual_sdcard.file_position - state.current_file.gcode_start_byte
|
||||
let maxPosition = state.current_file.gcode_end_byte - state.current_file.gcode_start_byte
|
||||
|
||||
if (currentPosition > 0 && maxPosition > 0) return 1 / maxPosition * currentPosition
|
||||
}
|
||||
|
||||
return state.data.virtual_sdcard.progress
|
||||
},
|
||||
|
||||
getImage: state => {
|
||||
if (
|
||||
'gui' in state.data &&
|
||||
'webcam' in state.data.gui.webcam &&
|
||||
'url' in state.data.gui.webcam &&
|
||||
state.data.gui.webcam.url !== "" &&
|
||||
'bool' in state.data.gui.webcam &&
|
||||
state.data.gui.webcam.bool &&
|
||||
'dashbaord' in state.data.gui &&
|
||||
'boolWebcam' in state.data.gui.dashboard &&
|
||||
state.data.gui.dashboard.boolWebcam
|
||||
) {
|
||||
return state.data.gui.webcam.url
|
||||
} else if (
|
||||
state.current_file &&
|
||||
"thumbnails" in state.current_file &&
|
||||
state.current_file.thumbnails.find((element) => element.width === 400 && element.height === 300)
|
||||
) {
|
||||
return 'data:image/gif;base64,'+state.current_file.thumbnails.find((element) => element.width === 400 && element.height === 300).data
|
||||
} else return "/img/sidebar-background.png"
|
||||
},
|
||||
|
||||
getLogo: state => {
|
||||
let file = state.theme_files.find(element =>
|
||||
element === themeDir+'/sidebar-logo.svg' ||
|
||||
element === themeDir+'/sidebar-logo.jpg' ||
|
||||
element === themeDir+'/sidebar-logo.png' ||
|
||||
element === themeDir+'/sidebar-logo.gif'
|
||||
)
|
||||
if (file) return "//"+state.socket.hostname+":"+state.socket.port+'/server/files/config/'+file
|
||||
|
||||
return '/img/logo.svg'
|
||||
},
|
||||
|
||||
getPosition: state => {
|
||||
if (
|
||||
'toolhead' in state.data &&
|
||||
'position' in state.data.toolhead
|
||||
) return state.data.toolhead.position
|
||||
|
||||
return []
|
||||
},
|
||||
|
||||
getPrinterPreview: (state, getters) => {
|
||||
const output = []
|
||||
|
||||
Object.keys(state.data).filter((key) => key.startsWith("extruder")).forEach((key) => {
|
||||
if (
|
||||
'temperature' in state.data[key] &&
|
||||
'target' in state.data[key]
|
||||
) {
|
||||
output.push({
|
||||
name: key,
|
||||
value: state.data[key].temperature.toFixed(0)+"° / "+state.data[key].target.toFixed(0)+"°",
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
if (
|
||||
'heater_bed' in state.data &&
|
||||
'temperature' in state.data.heater_bed &&
|
||||
'target' in state.data.heater_bed
|
||||
) {
|
||||
output.push({
|
||||
name: 'heater_bed',
|
||||
value: state.data.heater_bed.temperature.toFixed(0)+"° / "+state.data.heater_bed.target.toFixed(0)+"°"
|
||||
})
|
||||
}
|
||||
|
||||
if (
|
||||
'temperature_fan chamber' in state.data &&
|
||||
'temperature' in state.data['temperature_fan chamber'] &&
|
||||
'target' in state.data['temperature_fan chamber']
|
||||
) {
|
||||
output.push({
|
||||
name: 'chamber',
|
||||
value: state.data['temperature_fan chamber'].temperature.toFixed(0)+"° / "+state.data['temperature_fan chamber'].target.toFixed(0)+"°"
|
||||
})
|
||||
}
|
||||
|
||||
if ('temperature_sensor chamber' in state.data) {
|
||||
output.push({
|
||||
name: 'chamber',
|
||||
value: state.data['temperature_sensor chamber'].temperature.toFixed(0)+"°"
|
||||
})
|
||||
}
|
||||
|
||||
if (
|
||||
'print_stats' in state.data &&
|
||||
'state' in state.data.print_stats &&
|
||||
state.data.print_stats.state === "printing" &&
|
||||
getters["getPrintPercent"] > 0
|
||||
) {
|
||||
const eta = new Date(getters.estimated_time_eta)
|
||||
const h = eta.getHours() >= 10 ? eta.getHours() : "0"+eta.getHours()
|
||||
const m = eta.getMinutes() >= 10 ? eta.getMinutes() : "0"+eta.getMinutes()
|
||||
|
||||
output.push({
|
||||
name: "ETA",
|
||||
value: h+":"+m,
|
||||
file: getters.estimated_time_file,
|
||||
filament: getters.estimated_time_filament,
|
||||
slicer: getters.estimated_time_slicer,
|
||||
eta: getters.estimated_time_eta,
|
||||
})
|
||||
}
|
||||
|
||||
return output
|
||||
},
|
||||
|
||||
estimated_time_file: (state, getters) => {
|
||||
if (
|
||||
'print_stats' in state.data &&
|
||||
'print_duration' in state.data.print_stats &&
|
||||
state.data.print_stats.print_duration > 0 && getters.getPrintPercent > 0) {
|
||||
return (state.data.print_stats.print_duration / getters.getPrintPercent - state.data.print_stats.print_duration).toFixed(0)
|
||||
}
|
||||
|
||||
return 0
|
||||
},
|
||||
|
||||
estimated_time_filament: (state) => {
|
||||
if (
|
||||
'print_stats' in state.data &&
|
||||
'print_duration' in state.data.print_stats &&
|
||||
'filament_used' in state.data.print_stats &&
|
||||
'filament_total' in state.current_file &&
|
||||
|
||||
state.data.print_stats.filament_used > 0 &&
|
||||
state.current_file.filament_total > state.data.print_stats.filament_used) {
|
||||
return (state.data.print_stats.print_duration / (state.data.print_stats.filament_used / state.current_file.filament_total) - state.data.print_stats.print_duration).toFixed(0)
|
||||
}
|
||||
|
||||
return 0
|
||||
},
|
||||
|
||||
estimated_time_slicer: (state) => {
|
||||
if (
|
||||
'print_stats' in state.data &&
|
||||
'print_duration' in state.data.print_stats &&
|
||||
'estimated_time' in state.current_file &&
|
||||
|
||||
state.current_file.estimated_time > state.data.print_stats.print_duration) {
|
||||
return (state.current_file.estimated_time - state.data.print_stats.print_duration).toFixed(0)
|
||||
}
|
||||
|
||||
return 0
|
||||
},
|
||||
|
||||
estimated_time_eta: (state, getters) => {
|
||||
let time = 0
|
||||
let timeCount = 0
|
||||
|
||||
if (getters.estimated_time_file > 0) {
|
||||
time += parseInt(getters.estimated_time_file)
|
||||
timeCount++
|
||||
}
|
||||
|
||||
if (getters.estimated_time_filament > 0) {
|
||||
time += parseInt(getters.estimated_time_filament)
|
||||
timeCount++
|
||||
}
|
||||
|
||||
if (getters.estimated_time_slicer > 0) {
|
||||
time += parseInt(getters.estimated_time_slicer)
|
||||
timeCount++
|
||||
}
|
||||
|
||||
if (time && timeCount) return Date.now() + (time / timeCount) * 1000
|
||||
|
||||
return 0
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import actions from './actions'
|
||||
import mutations from './mutations'
|
||||
import getters from './getters'
|
||||
|
||||
export function getDefaultState() {
|
||||
return {
|
||||
_namespace: "",
|
||||
socket: {
|
||||
instance: null,
|
||||
hostname: "",
|
||||
port: 7125,
|
||||
webPort: 80,
|
||||
protocol: 'ws',
|
||||
isConnected: false,
|
||||
isConnecting: false,
|
||||
reconnects: 0,
|
||||
maxReconnects: 2,
|
||||
reconnectInterval: 1000,
|
||||
wsData: [],
|
||||
},
|
||||
data: {
|
||||
|
||||
},
|
||||
current_file: {},
|
||||
theme_files: []
|
||||
}
|
||||
}
|
||||
|
||||
// initial state
|
||||
const state = () => {
|
||||
return getDefaultState()
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
getters,
|
||||
actions,
|
||||
mutations
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
import Vue from 'vue'
|
||||
import { getDefaultState } from './index'
|
||||
|
||||
export default {
|
||||
reset(state) {
|
||||
Object.assign(state, getDefaultState())
|
||||
},
|
||||
|
||||
resetData(state) {
|
||||
Object.assign(state.data, getDefaultState().data)
|
||||
},
|
||||
|
||||
setSocketData (state, payload) {
|
||||
if ("status" in payload) payload = payload.status;
|
||||
if ("requestParams" in payload) delete payload.requestParams
|
||||
if ("_namespace" in payload) {
|
||||
Vue.set(state, "_namespace", payload._namespace)
|
||||
delete payload._namespace
|
||||
}
|
||||
|
||||
Object.entries(payload).forEach(([key, value]) => {
|
||||
Vue.set(state.socket, key, value)
|
||||
})
|
||||
},
|
||||
|
||||
setData(state, payload) {
|
||||
if ("status" in payload) payload = payload.status
|
||||
if ("requestParams" in payload) delete payload.requestParams
|
||||
|
||||
Object.entries(payload).forEach(([key, value]) => {
|
||||
if (key === "print_stats" && 'filename' in value) {
|
||||
this.dispatch("farm/"+state._namespace+"/sendObj", {
|
||||
method: "server.files.metadata",
|
||||
params: {filename: value.filename},
|
||||
action: "getMetadataCurrentFile"
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof (value) === "object") {
|
||||
Vue.set(state.data, key, {
|
||||
...state.data[key],
|
||||
...value
|
||||
})
|
||||
} else Vue.set(state.data, key, value)
|
||||
})
|
||||
},
|
||||
|
||||
addWsData(state, payload) {
|
||||
state.socket.wsData.push(payload)
|
||||
},
|
||||
|
||||
setCurrentFile(state, payload) {
|
||||
if ("requestParams" in payload) delete payload.requestParams
|
||||
Vue.set(state, 'current_file', payload)
|
||||
},
|
||||
|
||||
setConfigDir(state, payload) {
|
||||
for (const [, file] of Object.entries(payload)) {
|
||||
if ("filename" in file) {
|
||||
if (file.filename.startsWith(".theme/")) {
|
||||
state.theme_files.push(file.filename)
|
||||
} else if (file.filename === ".mainsail.json") {
|
||||
fetch('//'+state.socket.hostname+':'+state.socket.port+'/server/files/config/.mainsail.json?time='+Date.now())
|
||||
.then(res => res.json()).then(file => {
|
||||
this.commit("farm/"+state._namespace+"/setMainsailJson", file)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
setMainsailJson(state, payload) {
|
||||
Vue.set(state.data, 'gui', payload.state)
|
||||
},
|
||||
|
||||
notifyFilelistChanged( state, payload) {
|
||||
if (
|
||||
payload.action === "upload_file" &&
|
||||
payload.item.root === "config" &&
|
||||
payload.item.path === ".mainsail.json"
|
||||
) {
|
||||
fetch('//'+state.socket.hostname+':'+state.socket.port+'/server/files/config/.mainsail.json?time='+Date.now())
|
||||
.then(res => res.json()).then(file => {
|
||||
this.commit("farm/"+state._namespace+"/setMainsailJson", file)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,4 +60,15 @@ export default {
|
||||
commit('void', null, { root: true });
|
||||
}
|
||||
},
|
||||
|
||||
getDeleteFile({ commit }, payload) {
|
||||
if (payload.error) {
|
||||
Vue.$toast.error(payload.error.message);
|
||||
} else if ('result' in payload) {
|
||||
let delPath = payload.result.substr(payload.result.lastIndexOf("/")+1);
|
||||
|
||||
Vue.$toast.success("Successfully deleted "+delPath);
|
||||
commit('void', null, { root: true });
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -3,6 +3,22 @@ import { themeDir } from "@/store/variables"
|
||||
|
||||
export default {
|
||||
|
||||
getSidebarLogo: (state, getters, rootState, rootGetters) => {
|
||||
let configDir = findDirectory(state.filetree, ['config', themeDir])
|
||||
|
||||
let file = configDir.find(element =>
|
||||
element.filename !== undefined && (
|
||||
element.filename === 'sidebar-logo.svg' ||
|
||||
element.filename === 'sidebar-logo.jpg' ||
|
||||
element.filename === 'sidebar-logo.png' ||
|
||||
element.filename === 'sidebar-logo.gif'
|
||||
)
|
||||
)
|
||||
if (file) return rootGetters["socket/getUrl"]+'/server/files/config/'+themeDir+'/'+file.filename
|
||||
|
||||
return '/img/logo.svg'
|
||||
},
|
||||
|
||||
getSidebarBackground: (state, getters, rootState, rootGetters) => {
|
||||
let configDir = findDirectory(state.filetree, ['config', themeDir])
|
||||
|
||||
@@ -25,5 +41,23 @@ export default {
|
||||
if (file) return rootGetters["socket/getUrl"]+'/server/files/config/'+themeDir+'/'+file.filename
|
||||
|
||||
return null
|
||||
}
|
||||
},
|
||||
|
||||
getFavicons: (state, getters, rootState, rootGetters) => {
|
||||
let configDir = findDirectory(state.filetree, ['config', themeDir])
|
||||
|
||||
let favicon16 = configDir.find(element => element.filename !== undefined && element.filename === 'favicon-16x16.png')
|
||||
if (favicon16) favicon16 = rootGetters["socket/getUrl"]+'/server/files/config/'+themeDir+'/'+favicon16.filename
|
||||
let favicon16Default = '/img/icons/favicon-16x16.png'
|
||||
|
||||
let favicon32 = configDir.find(element => element.filename !== undefined && element.filename === 'favicon-32x32.png')
|
||||
if (favicon32) favicon32 = rootGetters["socket/getUrl"]+'/server/files/config/'+themeDir+'/'+favicon32.filename
|
||||
let favicon32Default = '/img/icons/favicon-32x32.png'
|
||||
|
||||
if (favicon16 && favicon32) return [favicon16, favicon32]
|
||||
else if (favicon16) return [favicon16, favicon16]
|
||||
else if (favicon32) return [favicon32, favicon32]
|
||||
|
||||
return [favicon16Default, favicon32Default]
|
||||
},
|
||||
}
|
||||
@@ -22,6 +22,12 @@ export function getDefaultState() {
|
||||
filename: 'config',
|
||||
modified: new Date(),
|
||||
childrens: []
|
||||
},
|
||||
{
|
||||
isDirectory: true,
|
||||
filename: 'docs',
|
||||
modified: new Date(),
|
||||
childrens: []
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import Vue from 'vue'
|
||||
import { getDefaultState } from './index'
|
||||
import { findDirectory } from "@/plugins/helpers"
|
||||
import store from "@/store";
|
||||
import axios from "axios";
|
||||
|
||||
export default {
|
||||
reset(state) {
|
||||
@@ -22,7 +20,7 @@ export default {
|
||||
for (const [key, item] of Object.entries(parent)) {
|
||||
if (
|
||||
item.isDirectory &&
|
||||
payload.dirs !== undefined &&
|
||||
'dirs' in payload &&
|
||||
payload.dirs.length > 0 &&
|
||||
payload.dirs.findIndex(element => element.dirname === item.filename) < 0
|
||||
) parent.splice(key, 1)
|
||||
@@ -56,23 +54,6 @@ export default {
|
||||
metadataPulled: false,
|
||||
})
|
||||
}
|
||||
|
||||
if (file.filename === ".mainsail.json" && payload.requestParams.path === "config") {
|
||||
fetch('//'+store.state.socket.hostname+':'+store.state.socket.port+'/server/files/config/.mainsail.json?time='+Date.now())
|
||||
.then(res => res.json()).then(file => {
|
||||
this.commit('gui/setData', file, { root: true })
|
||||
})
|
||||
}
|
||||
|
||||
if (file.filename === "gui.json" && payload.requestParams.path === "config") {
|
||||
fetch('//'+store.state.socket.hostname+':'+store.state.socket.port+'/server/files/config/gui.json?time='+Date.now())
|
||||
.then(res => res.json()).then(file => {
|
||||
this.commit('gui/setData', file, { root: true })
|
||||
this.dispatch('gui/upload', {}, { root: true })
|
||||
|
||||
axios.delete('//'+ store.state.socket.hostname+':'+store.state.socket.port +'/server/files/config/gui.json');
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -117,7 +98,7 @@ export default {
|
||||
let parent = findDirectory(state.filetree, (payload.item.root+"/"+path).split("/"));
|
||||
|
||||
if (parent) {
|
||||
if (parent.findIndex(element => (!element.isDirectory && element.filename === filename)) < 0) {
|
||||
if (parent.findIndex(element => (!element.isDirectory && element.filename === filename)) === -1) {
|
||||
let modified = new Date(payload.item.modified * 1000);
|
||||
|
||||
parent.push({
|
||||
@@ -127,7 +108,7 @@ export default {
|
||||
size: payload.item.size,
|
||||
metadataPulled: false,
|
||||
});
|
||||
}
|
||||
} else Vue.prototype.$socket.sendObj("server.files.metadata", { filename: payload.item.path }, "files/getMetadata")
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -11,6 +11,12 @@ export default {
|
||||
|
||||
setSettings({ commit, dispatch }, payload) {
|
||||
commit('setSettings', payload)
|
||||
|
||||
if ('tempchart' in payload && 'boolPowerDatasets' in payload.tempchart) {
|
||||
if (payload.tempchart.boolPowerDatasets) commit('printer/tempHistory/showPowerDatasets', {}, { root: true })
|
||||
else commit('printer/tempHistory/hidePowerDatasets', {}, { root: true })
|
||||
}
|
||||
|
||||
dispatch('upload')
|
||||
},
|
||||
|
||||
@@ -41,4 +47,24 @@ export default {
|
||||
commit('setGcodefilesShowHiddenFiles', data)
|
||||
dispatch('upload')
|
||||
},
|
||||
|
||||
addPreset({ commit, dispatch }, payload) {
|
||||
commit("addPreset", payload)
|
||||
dispatch("upload")
|
||||
},
|
||||
|
||||
updatePreset({ commit, dispatch }, payload) {
|
||||
commit("updatePreset", payload)
|
||||
dispatch("upload")
|
||||
},
|
||||
|
||||
deletePreset({ commit, dispatch }, payload) {
|
||||
commit("deletePreset", payload)
|
||||
dispatch("upload")
|
||||
},
|
||||
|
||||
setTempchartDatasetSetting({ commit, dispatch }, payload) {
|
||||
commit("setTempchartDatasetSetting", payload)
|
||||
dispatch("upload")
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,52 @@
|
||||
import {caseInsensitiveNameSort} from "@/plugins/helpers";
|
||||
|
||||
export default {
|
||||
|
||||
getPreheatPresets:(state) => {
|
||||
const output = []
|
||||
|
||||
for (const [key, preset] of Object.entries(state.presets)) {
|
||||
output.push({ ...preset, index: key })
|
||||
}
|
||||
|
||||
return output.sort(caseInsensitiveNameSort)
|
||||
},
|
||||
|
||||
getDatasetValue: (state) => (payload) => {
|
||||
if (
|
||||
payload.name in state.tempchart.datasetSettings &&
|
||||
payload.type in state.tempchart.datasetSettings[payload.name]
|
||||
) return state.tempchart.datasetSettings[payload.name][payload.type]
|
||||
|
||||
if (["temperature", "target"].includes(payload.type)) return true
|
||||
|
||||
return false
|
||||
},
|
||||
|
||||
getPresetsFromHeater: state => (payload) => {
|
||||
const output = []
|
||||
|
||||
output.push({
|
||||
value: 0
|
||||
})
|
||||
|
||||
for (const [, preset] of Object.entries(state.presets)) {
|
||||
if (
|
||||
payload.name in preset.values &&
|
||||
preset.values[payload.name].bool &&
|
||||
output.findIndex(entry => entry.value === preset.values[payload.name].value) === -1
|
||||
) {
|
||||
output.push({
|
||||
value: preset.values[payload.name].value,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return output.sort((a,b) => {
|
||||
if (a.value > b.value) return -1
|
||||
if (a.value < b.value) return 1
|
||||
|
||||
return 0
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,14 @@ export function getDefaultState() {
|
||||
flipY: false,
|
||||
bool: false,
|
||||
},
|
||||
tempchart: {
|
||||
intervalChartUpdate: 1000,
|
||||
intervalDatasetUpdate: 500,
|
||||
autoscale: false,
|
||||
datasetSettings: {
|
||||
|
||||
},
|
||||
},
|
||||
console: {
|
||||
hideWaitTemperatures: true,
|
||||
boolCustomFilters: false,
|
||||
@@ -37,7 +45,10 @@ export function getDefaultState() {
|
||||
countPerPage: 10,
|
||||
showHiddenFiles: false,
|
||||
}
|
||||
}
|
||||
},
|
||||
remotePrinters: [],
|
||||
presets: [],
|
||||
cooldownGcode: "TURN_OFF_HEATERS"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,4 +44,33 @@ export default {
|
||||
setGcodefilesShowHiddenFiles(state, value) {
|
||||
Vue.set(state.gcodefiles, "showHiddenFiles", value)
|
||||
},
|
||||
|
||||
addPreset(state, payload) {
|
||||
state.presets.push({
|
||||
name: payload.name,
|
||||
gcode: payload.gcode,
|
||||
values: payload.values
|
||||
})
|
||||
},
|
||||
|
||||
updatePreset(state, payload) {
|
||||
if (state.presets[payload.index]) {
|
||||
Vue.set(state.presets[payload.index], 'name', payload.name)
|
||||
Vue.set(state.presets[payload.index], 'gcode', payload.gcode)
|
||||
Vue.set(state.presets[payload.index], 'values', payload.values)
|
||||
}
|
||||
},
|
||||
|
||||
deletePreset(state, payload) {
|
||||
if (state.presets[payload.index]) {
|
||||
state.presets.splice(payload.index, 1)
|
||||
}
|
||||
},
|
||||
|
||||
setTempchartDatasetSetting(state, payload) {
|
||||
if (!(payload.name in state.tempchart.datasetSettings))
|
||||
Vue.set(state.tempchart.datasetSettings, payload.name, {})
|
||||
|
||||
Vue.set(state.tempchart.datasetSettings[payload.name], payload.type, payload.value)
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import server from './server'
|
||||
import printer from './printer'
|
||||
import files from './files'
|
||||
import gui from './gui'
|
||||
import farm from './farm'
|
||||
|
||||
Vue.use(Vuex);
|
||||
Vue.use(VueToast);
|
||||
@@ -25,6 +26,7 @@ export default new Vuex.Store({
|
||||
printer,
|
||||
files,
|
||||
gui,
|
||||
farm,
|
||||
},
|
||||
getters: getters,
|
||||
mutations: mutations,
|
||||
|
||||
@@ -3,32 +3,38 @@ import Vue from 'vue'
|
||||
export default {
|
||||
reset({ commit }) {
|
||||
commit('reset')
|
||||
//commit('tempHistory/reset')
|
||||
commit('tempHistory/reset')
|
||||
},
|
||||
|
||||
init() {
|
||||
Vue.prototype.$socket.sendObj('printer.info', {}, 'printer/getInfo')
|
||||
|
||||
// only available with klipper is ready
|
||||
Vue.prototype.$socket.sendObj('server.files.get_directory', { path: 'gcodes' }, 'files/getDirectory')
|
||||
//Vue.prototype.$socket.sendObj('server.files.get_directory', { path: 'gcodes' }, 'files/getDirectory')
|
||||
},
|
||||
|
||||
getInfo({ commit }, preload) {
|
||||
getInfo({ commit }, payload) {
|
||||
commit('server/setData', {
|
||||
klippy_state: preload.state,
|
||||
klippy_message: preload.state_message,
|
||||
klippy_state: payload.state,
|
||||
klippy_message: payload.state_message,
|
||||
}, { root: true })
|
||||
|
||||
commit('setData', {
|
||||
hostname: preload.hostname,
|
||||
software_version: preload.software_version,
|
||||
cpu_info: preload.cpu_info,
|
||||
hostname: payload.hostname,
|
||||
software_version: payload.software_version,
|
||||
cpu_info: payload.cpu_info,
|
||||
})
|
||||
|
||||
Vue.prototype.$socket.sendObj('printer.objects.list', {}, 'printer/getObjectsList')
|
||||
Vue.prototype.$socket.sendObj('printer.gcode.help', {}, 'printer/getHelpList')
|
||||
},
|
||||
|
||||
getStateMessage({ commit }, payload) {
|
||||
commit('server/setData', {
|
||||
klippy_message: payload.state_message,
|
||||
}, { root: true })
|
||||
},
|
||||
|
||||
getObjectsList({ commit }, payload) {
|
||||
let subscripts = {}
|
||||
const blocklist = [
|
||||
@@ -42,8 +48,8 @@ export default {
|
||||
if (!blocklist.includes(nameSplit[0])) subscripts = {...subscripts, [key]: null }
|
||||
}
|
||||
|
||||
if (subscripts !== {}) Vue.prototype.$socket.sendObj('printer.objects.subscribe', { objects: subscripts }, "printer/getData");
|
||||
Vue.prototype.$socket.sendObj("server.temperature_store", {}, "printer/tempHistory/getHistory");
|
||||
if (subscripts !== {}) Vue.prototype.$socket.sendObj('printer.objects.subscribe', { objects: subscripts }, "printer/getData")
|
||||
Vue.prototype.$socket.sendObj("server.temperature_store", {}, "printer/tempHistory/getHistory")
|
||||
|
||||
commit('void', null, { root: true })
|
||||
},
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { caseInsensitiveNameSort } from '@/plugins/helpers'
|
||||
import { additionalSensors } from '@/store/variables'
|
||||
|
||||
export default {
|
||||
|
||||
@@ -45,7 +46,7 @@ export default {
|
||||
return array.sort(caseInsensitiveNameSort);
|
||||
},
|
||||
|
||||
getHeaters: (state, getters) => {
|
||||
getHeaters: (state, getters, rootState, rootGetters) => {
|
||||
let heaters = []
|
||||
let colorOff = "grey darken-2"
|
||||
let colorHot = "grey lighten-5"
|
||||
@@ -77,8 +78,13 @@ export default {
|
||||
color: color,
|
||||
target: value.target,
|
||||
temperature: value.temperature,
|
||||
additionValues: getters.getAdditionSensors(nameSplit[1]),
|
||||
power: 'power' in value ? value.power : null,
|
||||
presets: rootGetters["gui/getPresetsFromHeater"]({ name: key }),
|
||||
chartColor: getters["tempHistory/getDatasetColor"](name),
|
||||
chartTemperature: getters["tempHistory/getDataset"](name),
|
||||
chartTarget: getters["tempHistory/getDataset"](name+"_target"),
|
||||
chartPower: getters["tempHistory/getDataset"](name+'_power'),
|
||||
min_temp: state.configfile.config[key] !== undefined ? parseFloat(state.configfile.config[key].min_temp) : undefined,
|
||||
max_temp: state.configfile.config[key] !== undefined ? parseFloat(state.configfile.config[key].max_temp) : undefined,
|
||||
});
|
||||
@@ -89,7 +95,7 @@ export default {
|
||||
return heaters.sort(caseInsensitiveNameSort);
|
||||
},
|
||||
|
||||
getTemperatureFans: (state, getters) => {
|
||||
getTemperatureFans: (state, getters, rootState, rootGetters) => {
|
||||
let fans = []
|
||||
|
||||
for (let [key, value] of Object.entries(state)) {
|
||||
@@ -100,8 +106,13 @@ export default {
|
||||
name: nameSplit[1],
|
||||
target: value.target,
|
||||
temperature: value.temperature,
|
||||
additionValues: getters.getAdditionSensors(nameSplit[1]),
|
||||
speed: value.speed,
|
||||
presets: rootGetters["gui/getPresetsFromHeater"]({ name: key }),
|
||||
chartColor: getters["tempHistory/getDatasetColor"](nameSplit[1]),
|
||||
chartTemperature: getters["tempHistory/getDataset"](nameSplit[1]),
|
||||
chartTarget: getters["tempHistory/getDataset"](nameSplit[1]+"_target"),
|
||||
chartPower: getters["tempHistory/getDataset"](nameSplit[1]+'_power'),
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -124,15 +135,19 @@ export default {
|
||||
if (value.temperature <= min_temp + split) icon = "mdi-thermometer-low"
|
||||
if (value.temperature >= max_temp - split) icon = "mdi-thermometer-high"
|
||||
|
||||
|
||||
|
||||
sensors.push({
|
||||
name: nameSplit[1],
|
||||
temperature: value.temperature,
|
||||
additionValues: getters.getAdditionSensors(nameSplit[1]),
|
||||
icon: icon,
|
||||
min_temp: min_temp,
|
||||
max_temp: max_temp,
|
||||
measured_min_temp: value.measured_min_temp,
|
||||
measured_max_temp: value.measured_max_temp,
|
||||
chartColor: getters["tempHistory/getDatasetColor"](nameSplit[1]),
|
||||
chartTemperature: getters["tempHistory/getDataset"](nameSplit[1]),
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -188,6 +203,118 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
getMiscellaneous: state => {
|
||||
let output = [];
|
||||
const supportedObjects = [
|
||||
'controller_fan',
|
||||
'heater_fan',
|
||||
'fan_generic',
|
||||
'fan',
|
||||
'output_pin'
|
||||
]
|
||||
|
||||
const controllableFans = [
|
||||
'fan_generic',
|
||||
'fan',
|
||||
]
|
||||
|
||||
for (const [key, value] of Object.entries(state)) {
|
||||
let nameSplit = key.split(" ")
|
||||
|
||||
if (supportedObjects.includes(nameSplit[0])) {
|
||||
let name = nameSplit.length > 1 ? nameSplit[1] : nameSplit[0]
|
||||
if (!name.startsWith("_")) {
|
||||
let controllable = controllableFans.includes(nameSplit[0].toLowerCase())
|
||||
let power = 'speed' in value ? value.speed : ('value' in value ? value.value : 0)
|
||||
let pwm = controllable
|
||||
let scale = 1
|
||||
|
||||
if (nameSplit[0].toLowerCase() === "fan") scale = 255
|
||||
|
||||
if (nameSplit[0].toLowerCase() === "output_pin") {
|
||||
controllable = true
|
||||
pwm = false
|
||||
if (
|
||||
'config' in state.configfile &&
|
||||
key in state.configfile.config
|
||||
) {
|
||||
if (
|
||||
'pwm' in state.configfile.config[key] &&
|
||||
state.configfile.config[key].pwm.toLowerCase() === "true"
|
||||
) pwm = true
|
||||
|
||||
if (
|
||||
'scale' in state.configfile.config[key]
|
||||
) scale = state.configfile.config[key].scale
|
||||
}
|
||||
}
|
||||
|
||||
output.push({
|
||||
name: name,
|
||||
type: nameSplit[0],
|
||||
power: power,
|
||||
controllable: controllable,
|
||||
pwm: pwm,
|
||||
scale: scale,
|
||||
object: value,
|
||||
config: state.configfile.config[key]
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return output.sort((a, b) => {
|
||||
if (a.type === "fan") return -1
|
||||
if (b.type === "fan") return 1
|
||||
|
||||
if (a.pwm < b.pwm) return 1
|
||||
if (a.pwm > b.pwm) return -1
|
||||
|
||||
if (a.controllable < b.controllable) return 1
|
||||
if (a.controllable > b.controllable) return -1
|
||||
|
||||
const nameA = a.name.toUpperCase()
|
||||
const nameB = b.name.toUpperCase()
|
||||
|
||||
if (nameA < nameB) return -1
|
||||
if (nameA > nameB) return 1
|
||||
|
||||
return 0
|
||||
})
|
||||
},
|
||||
|
||||
getAdditionSensors: state => (name) => {
|
||||
let additionValues = {}
|
||||
additionalSensors.forEach(sensorName => {
|
||||
if (sensorName+" "+name in state) {
|
||||
Object.keys(state[sensorName+" "+name]).forEach(key => {
|
||||
if (key !== "temperature") {
|
||||
let tmp = {}
|
||||
tmp[key] = {}
|
||||
tmp[key]['value'] = state[sensorName+" "+name][key]
|
||||
|
||||
switch(key) {
|
||||
case 'pressure':
|
||||
tmp[key]['unit'] = "hPa"
|
||||
break
|
||||
|
||||
case 'humidity':
|
||||
tmp[key]['unit'] = "%"
|
||||
break
|
||||
|
||||
default:
|
||||
tmp[key]['unit'] = ""
|
||||
}
|
||||
|
||||
additionValues = Object.assign(additionValues, tmp)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
return additionValues
|
||||
},
|
||||
|
||||
getAllMacros: state => {
|
||||
let array = []
|
||||
|
||||
|
||||
@@ -3,7 +3,17 @@ import { getDefaultState } from './index'
|
||||
|
||||
export default {
|
||||
reset(state) {
|
||||
Object.assign(state, getDefaultState())
|
||||
const defaultState = getDefaultState()
|
||||
|
||||
for (const key of Object.keys(state)) {
|
||||
if (!(key in defaultState) && key !== "tempHistory") {
|
||||
delete state[key]
|
||||
}
|
||||
}
|
||||
|
||||
for (const [key, value] of Object.entries(defaultState)) {
|
||||
Vue.set(state, key, value)
|
||||
}
|
||||
|
||||
this.dispatch('socket/clearLoadings', null, { root: true })
|
||||
if (this.state.server.plugins.includes("update_manager"))
|
||||
@@ -13,7 +23,7 @@ export default {
|
||||
setData(state, payload) {
|
||||
if ("status" in payload) payload = payload.status;
|
||||
if ("requestParams" in payload) delete payload.requestParams
|
||||
let now = Date.now();
|
||||
//let now = Date.now();
|
||||
|
||||
Object.entries(payload).forEach(([key, value]) => {
|
||||
if (key === "webhooks") {
|
||||
@@ -26,31 +36,6 @@ export default {
|
||||
...value
|
||||
})
|
||||
} else Vue.set(state, key, value)
|
||||
|
||||
//update heaters
|
||||
if (
|
||||
Array.isArray(state.heaters.available_heaters) &&
|
||||
state.heaters.available_heaters.length
|
||||
) {
|
||||
let keySplit = key.split(" ")
|
||||
|
||||
if (
|
||||
state.heaters.available_heaters.includes(key) ||
|
||||
keySplit[0] === "temperature_fan" ||
|
||||
keySplit[0] === "temperature_sensor") {
|
||||
|
||||
let name = keySplit[0]
|
||||
if (keySplit[0] === "temperature_fan") name = keySplit[1]
|
||||
else if (keySplit[0] === "temperature_sensor") name = keySplit[1]
|
||||
else if (keySplit[0] === "heater_generic") name = keySplit[1]
|
||||
|
||||
if (value.temperature) this.commit('printer/tempHistory/addValue', { name: name, value: value.temperature, time: now })
|
||||
else if (key in state && 'temperature' in state[key]) this.commit('printer/tempHistory/addValue', { name: name, value: state[key].temperature, time: now })
|
||||
|
||||
if (value.target) this.commit('printer/tempHistory/addValue', { name: name+'_target', value: value.target, time: now })
|
||||
else if (key in state && 'target' in state[key]) this.commit('printer/tempHistory/addValue', { name: name+'_target', value: state[key].target, time: now })
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -1,9 +1,144 @@
|
||||
import {colorArray, colorChamber, colorHeaterBed, datasetTypes} from "@/store/variables";
|
||||
import {convertName} from "@/plugins/helpers";
|
||||
|
||||
export default {
|
||||
reset({ commit }) {
|
||||
commit('reset')
|
||||
},
|
||||
|
||||
getHistory({ commit }, payload) {
|
||||
commit('setHistory', payload);
|
||||
getHistory({ commit, state, rootGetters }, payload) {
|
||||
const now = new Date()
|
||||
if (payload !== undefined) {
|
||||
Object.entries(payload).sort().forEach(([name, datasets]) => {
|
||||
let keySplit = name.split(" ")
|
||||
if (keySplit.length > 1) name = keySplit[1]
|
||||
const type = keySplit[0]
|
||||
|
||||
if ('temperatures' in datasets) {
|
||||
let datasetTemperature = state.datasets.find(element => element.name === name)
|
||||
if (datasetTemperature === undefined) {
|
||||
let color = ''
|
||||
|
||||
switch (name) {
|
||||
case 'heater_bed':
|
||||
color = colorHeaterBed;
|
||||
break;
|
||||
case 'chamber':
|
||||
color = colorChamber;
|
||||
break;
|
||||
default:
|
||||
color = colorArray[state.datasets.filter(element =>
|
||||
!element.name.endsWith("_target") && element.name !== "heater_bed" && element.name !== "chamber"
|
||||
).length];
|
||||
break;
|
||||
}
|
||||
|
||||
datasetTemperature = {
|
||||
type: "line",
|
||||
name: name,
|
||||
legendText: convertName(name),
|
||||
xValueType: "dateTime",
|
||||
dataPoints:[],
|
||||
showInLegend: true,
|
||||
markerType: 'circle',
|
||||
color: rootGetters["gui/getDatasetValue"]({ name: name, type: 'color' }) || color,
|
||||
visible: (rootGetters["gui/getDatasetValue"]({ name: name, type: 'temperature' })) ? 1 : 0,
|
||||
}
|
||||
|
||||
commit('addDataset', datasetTemperature)
|
||||
}
|
||||
|
||||
commit('addValue', {
|
||||
name: name,
|
||||
value: datasets.temperatures,
|
||||
type: type,
|
||||
time: now
|
||||
})
|
||||
|
||||
if ('targets' in datasets && (type.startsWith("extruder") || type === "heater_bed" || type === "temperature_fan")) {
|
||||
let datasetTarget = state.datasets.find(element => element.name === name+"_target")
|
||||
if (datasetTarget === undefined) {
|
||||
datasetTarget = {
|
||||
type: "stepArea",
|
||||
name: name+"_target",
|
||||
xValueType: "dateTime",
|
||||
dataPoints:[],
|
||||
showInLegend: false,
|
||||
markerType: 'none',
|
||||
color: datasetTemperature.color,
|
||||
fillOpacity: .1,
|
||||
lineThickness: 0,
|
||||
visible: (rootGetters["gui/getDatasetValue"]({ name: name, type: 'target' })) ? 1 : 0,
|
||||
}
|
||||
|
||||
commit('addDataset', datasetTarget)
|
||||
}
|
||||
|
||||
commit('addValue', {
|
||||
name: name+"_target",
|
||||
value: datasets.targets,
|
||||
type: type,
|
||||
time: now
|
||||
})
|
||||
}
|
||||
|
||||
if ('powers' in datasets && (type.startsWith("extruder") || type === "heater_bed")) {
|
||||
let datasetPower = state.datasets.find(element => element.name === name+"_power")
|
||||
if (datasetPower === undefined) {
|
||||
datasetPower = {
|
||||
type: "line",
|
||||
name: name+"_power",
|
||||
xValueType: "dateTime",
|
||||
axisYType: "secondary",
|
||||
dataPoints:[],
|
||||
showInLegend: false,
|
||||
markerType: 'none',
|
||||
lineDashType: "dot",
|
||||
lineThickness: 1,
|
||||
visible: (rootGetters["gui/getDatasetValue"]({ name: name, type: 'power' })) ? 1 : 0,
|
||||
color: datasetTemperature.color,
|
||||
}
|
||||
|
||||
commit('addDataset', datasetPower)
|
||||
}
|
||||
|
||||
commit('addValue', {
|
||||
name: name+"_power",
|
||||
value: datasets.powers,
|
||||
type: type,
|
||||
time: now
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
updateDatasets({ commit, rootState }) {
|
||||
if (
|
||||
'heaters' in rootState.printer &&
|
||||
'available_sensors' in rootState.printer.heaters &&
|
||||
rootState.printer.heaters.available_sensors.length
|
||||
) {
|
||||
const now = new Date()
|
||||
rootState.printer.heaters.available_sensors.forEach((objectName) => {
|
||||
if (objectName in rootState.printer) {
|
||||
const objectNameSplits = objectName.split(" ")
|
||||
let name = objectNameSplits[0]
|
||||
if (["temperature_fan", "temperature_sensor", "heater_generic"].includes(objectNameSplits[0])) name = objectNameSplits[1]
|
||||
|
||||
datasetTypes.forEach(datasetType => {
|
||||
if (datasetType in rootState.printer[objectName]) {
|
||||
commit('addValue', {
|
||||
name: datasetType === "temperature" ? name : name+"_"+datasetType,
|
||||
value: rootState.printer[objectName][datasetType],
|
||||
type: objectNameSplits[0],
|
||||
time: now
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,5 +4,9 @@ export default {
|
||||
let dataset = state.datasets.find(element => element.name === name)
|
||||
|
||||
return (dataset) ? dataset.color : null
|
||||
}
|
||||
},
|
||||
|
||||
getDataset: state => (name) => {
|
||||
return state.datasets.find(element => element.name === name)
|
||||
},
|
||||
}
|
||||
@@ -1,134 +1,78 @@
|
||||
import { getDefaultState } from './index'
|
||||
import { colorArray, colorChamber, colorHeaterBed } from "@/store/variables"
|
||||
import Vue from "vue";
|
||||
|
||||
export default {
|
||||
reset(state) {
|
||||
Object.assign(state, getDefaultState())
|
||||
},
|
||||
|
||||
setHistory(state, payload) {
|
||||
let now = new Date();
|
||||
|
||||
if (payload !== undefined) {
|
||||
Object.entries(payload).sort().forEach(([key, datasets]) => {
|
||||
let keySplit = key.split(" ");
|
||||
|
||||
if (keySplit.length > 1) key = keySplit[1];
|
||||
|
||||
if (datasets.temperatures) {
|
||||
let max = datasets.temperatures.length;
|
||||
for (let i = 0; i < max; i++) {
|
||||
let time = new Date(now.getTime() - 1000 * (max - i));
|
||||
|
||||
this.commit('printer/tempHistory/addValue', {
|
||||
name: key,
|
||||
value: datasets.temperatures[i],
|
||||
type: keySplit[0],
|
||||
time: time
|
||||
});
|
||||
|
||||
this.commit('printer/tempHistory/addValue', {
|
||||
name: key+'_target',
|
||||
value: datasets.targets[i],
|
||||
type: keySplit[0],
|
||||
time: time
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
addDataset(state, payload) {
|
||||
state.datasets.push(payload)
|
||||
},
|
||||
|
||||
addValue(state, payload) {
|
||||
// definations for delete old entries
|
||||
let timeOld = new Date().getTime() - (1000 * 60 * 10)
|
||||
let minResolution = 1000 // value in ms
|
||||
//let deletedIndex
|
||||
const multi = payload.name.endsWith("_power") ? 100 : 1
|
||||
const dataset = state.datasets.find(element => element.name === payload.name)
|
||||
|
||||
let mainDataset = state.datasets.find(element => element.name === payload.name)
|
||||
if (!mainDataset) {
|
||||
//TODO load hidden sensors from gui store
|
||||
//let hidden = this.rootState.gui.dashboard.hiddenTempChart.indexOf(payload.name.toUpperCase()) >= 0;
|
||||
//let hidden = false
|
||||
|
||||
if (payload.name.includes('_target')) {
|
||||
let masterDataset = state.datasets.find(element => element.name === payload.name.replace('_target', ''))
|
||||
|
||||
if (masterDataset) {
|
||||
mainDataset = {
|
||||
type: "stepArea",
|
||||
name: payload.name,
|
||||
legendText: payload.name,
|
||||
xValueType: "dateTime",
|
||||
dataPoints:[],
|
||||
showInLegend: false,
|
||||
markerType: 'none',
|
||||
fillOpacity: .3,
|
||||
lineThickness: 0,
|
||||
toolTipContent: "{name}: {y}°C",
|
||||
color: masterDataset.color || '#666'
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let color = '';
|
||||
|
||||
switch (payload.name) {
|
||||
case 'heater_bed': color = colorHeaterBed; break;
|
||||
case 'chamber': color = colorChamber; break;
|
||||
default: color = colorArray[state.datasets.filter(element => !element.name.endsWith("_target") && element.name !== "heater_bed" && element.name !== "chamber").length]; break;
|
||||
}
|
||||
|
||||
mainDataset = {
|
||||
type: "spline",
|
||||
name: payload.name,
|
||||
legendText: payload.name,
|
||||
xValueType: "dateTime",
|
||||
dataPoints:[],
|
||||
showInLegend: true,
|
||||
markerType: 'none',
|
||||
toolTipContent: "{name}: {y}°C",
|
||||
color: color,
|
||||
}
|
||||
}
|
||||
|
||||
mainDataset = state.datasets.push(mainDataset);
|
||||
}
|
||||
|
||||
// update current temp in temperature chart
|
||||
if (mainDataset && payload.value !== undefined) {
|
||||
if (dataset !== undefined && payload.value !== undefined) {
|
||||
if (Array.isArray(payload.value)) {
|
||||
for (let i = 0; i < payload.value.length; i++) {
|
||||
mainDataset.data.push({
|
||||
x: payload.time - 1000 * i,
|
||||
y: Math.round(payload.value[i]*100)/100
|
||||
for (let i = payload.value.length; i > 0; i--) {
|
||||
dataset.dataPoints.push({
|
||||
x: payload.time - (i*1000),
|
||||
y: Math.round(payload.value[payload.value.length - i] * multi * 100)/100
|
||||
})
|
||||
}
|
||||
} else {
|
||||
if (mainDataset.dataPoints && mainDataset.dataPoints.length) {
|
||||
let lastTemp = mainDataset.dataPoints[mainDataset.dataPoints.length - 1].y
|
||||
let lastTime = mainDataset.dataPoints[mainDataset.dataPoints.length - 1].x
|
||||
dataset.dataPoints.push({
|
||||
x: payload.time,
|
||||
y: Math.round(payload.value * multi * 100)/100
|
||||
})
|
||||
|
||||
if (
|
||||
payload.time - lastTime > minResolution &&
|
||||
(lastTemp !== payload.value || payload.time - lastTime > minResolution)
|
||||
) {
|
||||
mainDataset.dataPoints.push({
|
||||
x: payload.time,
|
||||
y: Math.round(payload.value*100)/100
|
||||
});
|
||||
}
|
||||
|
||||
let i
|
||||
while ((i = mainDataset.dataPoints.findIndex(item => timeOld > item.x)) > -1) {
|
||||
mainDataset.dataPoints.splice(i, 1)
|
||||
}
|
||||
} else if (mainDataset.dataPoints) {
|
||||
mainDataset.dataPoints.push({
|
||||
x: payload.time,
|
||||
y: Math.round(payload.value*100)/100
|
||||
});
|
||||
let i
|
||||
const timeOld = new Date().getTime() - (1000 * 60 * 10)
|
||||
while ((i = dataset.dataPoints.findIndex(item => timeOld > item.x)) > -1) {
|
||||
dataset.dataPoints.splice(i, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
hidePowerDatasets(state) {
|
||||
state.datasets.forEach(element => {
|
||||
if (element.name.endsWith("_power")) {
|
||||
element.visible = false
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
showPowerDatasets(state) {
|
||||
state.datasets.forEach(element => {
|
||||
if (element.name.endsWith("_power")) {
|
||||
element.visible = true
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
setVisible(state, payload) {
|
||||
const datasetName = payload.type !== 'temperature' ? payload.name+'_'+payload.type : payload.name
|
||||
|
||||
const datasetIndex = state.datasets.findIndex(element => element.name === datasetName)
|
||||
if (datasetIndex !== -1) {
|
||||
Vue.set(state.datasets[datasetIndex], 'visible', payload.value)
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
setColor(state, payload) {
|
||||
state.datasets.forEach(element => {
|
||||
if (
|
||||
element.name === payload.name ||
|
||||
element.name === payload.name+'_target' ||
|
||||
element.name === payload.name+'_power'
|
||||
) {
|
||||
element.color = payload.value
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
@@ -1,23 +1,38 @@
|
||||
import Vue from 'vue'
|
||||
|
||||
export default {
|
||||
reset({ commit }) {
|
||||
reset({ commit, dispatch }) {
|
||||
commit('reset')
|
||||
dispatch('power/reset')
|
||||
dispatch('updateManager/reset')
|
||||
},
|
||||
|
||||
init({ dispatch, state }) {
|
||||
init() {
|
||||
Vue.prototype.$socket.sendObj('server.info', {}, 'server/getInfo')
|
||||
Vue.prototype.$socket.sendObj('server.gcode_store', {}, 'server/getGcodeStore')
|
||||
Vue.prototype.$socket.sendObj('server.files.get_directory', { path: 'config' }, 'files/getDirectory')
|
||||
Vue.prototype.$socket.sendObj('server.files.get_directory', { path: 'config_examples' }, 'files/getDirectory')
|
||||
|
||||
if (state.plugins.length > 0 && state.plugins.includes("update_manager"))
|
||||
Vue.prototype.$socket.sendObj('machine.update.status', { refresh: false }, 'server/updateManager/getStatus')
|
||||
|
||||
dispatch('printer/init', null, { root: true })
|
||||
Vue.prototype.$socket.sendObj('server.files.list', { root: 'config' }, 'server/checkMainsailJson')
|
||||
},
|
||||
|
||||
getInfo({ commit, state }, payload) {
|
||||
checkMainsailJson({ commit, dispatch, rootState }, payload) {
|
||||
let boolFallback = true
|
||||
|
||||
Object.entries(payload).forEach(([, file]) => {
|
||||
if ('filename' in file && file.filename === '.mainsail.json') {
|
||||
boolFallback = false
|
||||
|
||||
fetch('//'+rootState.socket.hostname+':'+rootState.socket.port+'/server/files/config/.mainsail.json?time='+Date.now())
|
||||
.then(res => res.json()).then(file => {
|
||||
commit('gui/setData', file, { root: true })
|
||||
if (!rootState.socket.remoteMode) dispatch('farm/readStoredPrinters', {}, { root: true })
|
||||
dispatch('printer/init', null, { root: true })
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
if (boolFallback) dispatch('printer/init', null, { root: true })
|
||||
},
|
||||
|
||||
getInfo({ commit, state, rootState }, payload) {
|
||||
Vue.prototype.$socket.sendObj('server.gcode_store', {}, 'server/getGcodeStore')
|
||||
|
||||
if (state.plugins.length === 0) {
|
||||
if (payload.plugins.includes("power") !== false)
|
||||
@@ -27,11 +42,20 @@ export default {
|
||||
Vue.prototype.$socket.sendObj('machine.update.status', {}, 'server/updateManager/getStatus')
|
||||
}
|
||||
|
||||
if (state.registered_directories.length === 0 && 'registered_directories' in payload) {
|
||||
for (const directory of payload.registered_directories) {
|
||||
if (rootState.files.filetree.findIndex((element) => element.isDirectory && element.filename === directory) !== -1) {
|
||||
Vue.prototype.$socket.sendObj('server.files.get_directory', { path: directory }, 'files/getDirectory')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
commit('setData', payload)
|
||||
|
||||
if (!payload.klippy_connected) {
|
||||
if (!payload.klippy_connected || payload.klippy_state === "startup") {
|
||||
setTimeout(function(){
|
||||
Vue.prototype.$socket.sendObj('server.info', {}, 'server/getInfo')
|
||||
Vue.prototype.$socket.sendObj('printer.info', {}, 'printer/getStateMessage')
|
||||
}, 1000)
|
||||
}
|
||||
},
|
||||
@@ -41,6 +65,7 @@ export default {
|
||||
},
|
||||
|
||||
getGcodeStore({ commit }, payload) {
|
||||
commit('clearGcodeStore')
|
||||
commit('setGcodeStore', payload)
|
||||
},
|
||||
|
||||
|
||||