Compare commits

...
54 Commits
Author SHA1 Message Date
Stefan Dej 7956304f64 fix installation.md and update-0.0.x.md link 2020-07-27 00:09:04 +02:00
Stefan Dej e98d6c0ba9 Update root README.md 2020-07-27 00:03:00 +02:00
Stefan Dej be7abdf254 feature: warning tool input if temp too high or too low 2020-07-26 23:42:02 +02:00
Stefan Dej 0e598f83a6 bugfix: count missing update ticks of temp sensor to compensate temp chart 2020-07-26 22:53:22 +02:00
Stefan Dej ded73fc6a8 bugfix: pause state of StatusPanel.vue; cleanup websocket notifies 2020-07-26 21:34:38 +02:00
Stefan Dej 458a6e8592 feature: update package.json 2020-07-21 00:13:01 +02:00
Stefan Dej 15a5e07dca bugfix: remove dir -> remove dir from state.filetree 2020-07-20 23:20:45 +02:00
Stefan Dej efa15131d8 initial upload of the new docs 2020-07-19 23:35:12 +02:00
Stefan Dej 2636311cc1 feature: move files in filemanager
bugfix: update endstop status mutations
2020-07-18 19:38:23 +02:00
Stefan Dej 32daeedcf7 bugfix: reload endstop status by changing the current page
this closes #19
2020-07-18 19:32:12 +02:00
Stefan Dej 98a7292b7b feature: rename files & directories in g-code files
bugfix: message display on dashboard
2020-07-16 00:33:48 +02:00
Stefan Dej 86d9bac54d bugfix: update save config to moonraker .8 2020-07-14 23:37:09 +02:00
Stefan Dej bb0b7b58fa bugfix: heightmap control 2020-07-14 22:50:36 +02:00
Stefan Dej d18355507f bugfix: subscription of special extras 2020-07-14 12:49:51 +02:00
Stefan Dej 316763e92e bugfix: current_file -> update to moonraker 0.8 2020-07-14 03:36:43 +02:00
Stefan Dej 44a381c243 feature: file manager -> create/remove directores
feature: file manager -> show thumbnails (list + printstart)
2020-07-14 02:57:36 +02:00
Stefan Dej c71bc47ab8 feature: file manager -> show/browse directories
feature: file manager -> grab metadata per page
feature: file manager -> search in directory
2020-07-13 03:58:15 +02:00
Stefan Dej 143d9aad7e bugfix: bed_mesh profile loader
feature: load/save/remove bed_mesh_profile
feature: calibrate/clear bed_mesh
feature: change between probe_matrix and mesh_matrix in the visualizer
2020-07-12 03:00:57 +02:00
Stefan Dej f2466b3ad7 bugfix: virtual_sdcard.progress not loaded at startup 2020-07-11 23:30:27 +02:00
Stefan Dej 7f6a1bcabe bugfix: FW restart fixed
feature: Klippy State Panel
2020-07-07 20:51:20 +02:00
Stefan Dej fb242bc5d3 Update to Moonraker .08-alpha (emergency stop) 2020-07-05 23:43:35 +02:00
Stefan Dej accde2227b Update to Moonraker .08-alpha 2020-07-05 23:41:39 +02:00
Stefan Dej e25c10c757 bugfix: sort temp sensors for the tempchart 2020-06-30 23:04:52 +02:00
Stefan Dej 5795fe45d1 feature: show temperature_probe on dashboard 2020-06-30 00:46:43 +02:00
Stefan Dej 1e61749175 feature: babystepping, switch between idle interface & printing interface, first tests with PS thumbnails 2020-06-17 23:39:16 +02:00
Stefan Dej 4b13e4c6ce Merge remote-tracking branch 'origin/master' 2020-05-28 00:58:05 +02:00
Stefan Dej b4ee662a4f feature: if Filament used > 1000mm -> convert to m 2020-05-28 00:16:10 +02:00
meteyou 1fd2473e9e Merge pull request #21 from translucentfocus/MachineSettingsTypo
Machine Limits Typo
2020-05-26 14:14:45 +02:00
meteyou 8a203c1def Merge pull request #20 from translucentfocus/renaming
Renaming kwc to mainsail
2020-05-26 14:14:14 +02:00
translucentfocus 57f6d275a3 Machine Settings Typo
Renamed headline to Machine Settings
2020-05-25 14:01:52 -05:00
translucentfocus 78dfbfb131 Renaming kwc to mainsail
Note: package-lock.json still has kwc in the name. I didn't change due to it being build-related
2020-05-25 13:54:36 -05:00
meteyou da844fec63 Merge pull request #17 from translucentfocus/master
Bumped Update Header Text to current version
2020-05-24 10:34:18 +02:00
translucentfocus 35e8470430 Bumped Update Header Text to current version
Your terminal commands are for the latest update V0.0.12, but the header text still said V0.0.11 🙂

Btw, this is amazing work!
2020-05-24 01:59:03 -05:00
Stefan Dej 5cff1fc45a bugfix: control button position z
feature: add extruder control panel
2020-05-23 00:46:02 +02:00
Stefan Dej 7301cecbdf bugfix: console log sort with milliseconds,
feature: add all gcode buttons to event log
2020-05-12 01:13:55 +02:00
Stefan Dej 0478d1aefb rename nginx log from kwc to mainsail 2020-05-11 11:11:12 +02:00
Stefan Dej d9469b3c8b fixed typos in Heightmap.vue 2020-05-11 08:59:39 +02:00
Stefan Dej 0a51b0d255 bugfix: time format in status panel,
update README.md for V0.0.12
2020-05-11 08:40:00 +02:00
Stefan Dej 52afc35fd6 update README.md for V0.0.11 2020-05-11 01:11:27 +02:00
Stefan Dej 9e5266425c feature: select value by focus heater input field 2020-05-11 01:07:29 +02:00
Stefan Dej 86595ab70b feature: temperature_sensor min/max temp by hover 2020-05-11 01:04:59 +02:00
Stefan Dej 0f87e3f28f bugfix: temperature_fans onload & update fix
feature: save hidden sensors from chart in gui.json
2020-05-11 00:54:36 +02:00
Stefan Dej 88305e74cf fixes #9 2020-05-09 02:20:50 +02:00
Stefan Dej abea5d8660 fixes #13 for time > 24h 2020-05-09 02:12:42 +02:00
Stefan Dej d2bccb737e Update README.md 2020-05-09 02:03:19 +02:00
Stefan Dej 0bfde82ee8 add sensor number 2020-05-09 01:58:16 +02:00
Stefan Dej de9485cc84 update README.md, load tempchart history, update to moonraker 2020-05-09 01:47:30 +02:00
Stefan Dej e8d2c71401 update README.md 2020-04-27 21:52:37 +02:00
meteyou 554b25d754 Merge pull request #5 from pusewicz/patch-1
Few tweaks to the README file

thx!
2020-04-27 12:36:51 +02:00
Piotr Usewicz ecf2ee070b Few tweaks to the README file
This is a PR that tweaks some of the README that fixes some of the typos. I did not go much into detail.
2020-04-27 12:14:42 +02:00
meteyou e35d13d446 Merge pull request #1 from meteyou/dependabot/npm_and_yarn/acorn-6.4.1
Bump acorn from 6.3.0 to 6.4.1
2020-04-27 10:52:07 +02:00
Stefan Dej 9f46a502fc finish README.md 2020-04-27 10:31:56 +02:00
Stefan Dej a4436348df finish README.md 2020-04-27 08:40:06 +02:00
dependabot[bot] d57e888133 Bump acorn from 6.3.0 to 6.4.1
Bumps [acorn](https://github.com/acornjs/acorn) from 6.3.0 to 6.4.1.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/6.3.0...6.4.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-03-16 03:31:57 +00:00
45 changed files with 8513 additions and 2219 deletions

No files matched your search

+4 -218
View File
@@ -1,221 +1,7 @@
# Mainsail
Mainsail is a responsive web interface for [Klipper](https://github.com/KevinOConnor/klipper) 3D printer firmware. It communicates with the klipper-api from [Arksine](https://github.com/arksine).
Mainsail is a lightweight & responsive web interface for the [Klipper](https://github.com/KevinOConnor/klipper)
3D printer firmware. It communicates with the [Moonraker (Klipper-API)](https://github.com/arksine/moonraker) from [Arksine](https://github.com/arksine).
## Requirement
You need a full working Klipper-instance. Install Klipper with the official Installation documentaion and check the Logfile if klipper (/tmp/klippy.log) works.
![screenshot-dashboard](docs/images/screenshot-dashboard.png)
## Installtion of Mainsail
The installation is split into several sections
- [Change branch for Klipper-API](#change-brunch-for-klipper-api)
- [configure Klipper-API](#configure-klipper-api)
- [install webserver & reverse proxy (nginx)](#install-webserver--reverse-proxy-nginx)
- [install & configure Mainsail](#install--configure-mainsail)
### Change brunch for Klipper-API
The Klipper-API isn't merged in Klipper at the moment, so you have to change the Repository to [Arksine's Fork](https://github.com/Arksine/klipper/tree/work-web_server-20200131/klippy/extras/remote_api) with the Klipper-API.
```bash
cd ~/klipper
git fetch arksine
git checkout arksine/work-web_server-20200131
```
and install the python package "tornado"
```bash
~/klippy-env/bin/pip install tornado
```
### configure Klipper-API
edit your `printer.cfg` with `nano ~/printer.cfg` and add following lines:
```
[virtual_sdcard]
path: /home/pi/sdcard
[remote_api]
trusted_clients:
192.168.0.0/24
127.0.0.0/24
```
edit the first line of trusted_clients (192.168.0.0/24) to your network. The second line (127.0.0.0/24) is for reverse proxy later.
at last, we create the virtual_sdcard directory:
```
mkdir ~/sdcard
```
now restart klipper (`sudo service klipper restart`) and check your klippy-log if klipper is starting correct again.
when klipper is running, open the url `http://<printer-ip>:7125/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)"}}
```
your API is working!
### install webserver & reverse proxy (nginx)
nginx is important to mount all components on port 80 and host the static files from Mainsail.
If you have installed lighttpd & haproxy before you have to stop & disable it:
```bash
sudo service haproxy stop
sudo update-rc.d -f haproxy remove
sudo service lighttpd stop
sudo update-rc.d -f lighttpd remove
```
After disable all other webserver you can install nginx now:
```bash
sudo apt install nginx
```
now we create the config file with
```bash
sudo nano /etc/nginx/sites-available/mainsail
```
and fill it with the following content:
```
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream apiserver {
#edit your api port here
ip_hash;
server 127.0.0.1:7125;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
access_log /var/log/nginx/kwc-access.log;
error_log /var/log/nginx/kwc-error.log;
#web_path from mainsail static files
root /home/pi/mainsail;
index index.html;
server_name _;
#max upload size for gcodes
client_max_body_size 200M;
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 /websocket {
proxy_pass http://apiserver/websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
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_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;
}
}
```
create directory for static files and active nginx config:
```bash
mkdir ~/mainsail
sudo rm /etc/nginx/sites-enabled/default
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:
```
{"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)"}}
```
now we can install Mainsail.
### install & configure Mainsail
now you can download the current mainsail static data
```bash
cd ~/mainsail
wget -q -O mainsail.zip https://github.com/meteyou/mainsail/releases/download/v0.0.9/mailsail-alpha-0.0.9.zip && unzip mainsail.zip && rm mainsail.zip
```
Example Klipper macros:
```
[pause_resume]
[gcode_macro CANCEL]
default_parameter_X: 230
default_parameter_Y: 230
default_parameter_Z: 10
gcode:
M104 S0
M140 S0
M141 S0
M106 S0
CLEAR_PAUSE
RESET_SD
[gcode_macro CANCEL_PRINT]
gcode:
CANCEL
[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
default_parameter_X: 230
default_parameter_Y: 230
default_parameter_Z: 10
gcode:
SAVE_GCODE_STATE NAME=PAUSE_state
BASE_PAUSE
G91
G1 E-1.7 F2100
G1 Z{Z}
G90
G1 X{X} Y{Y} F6000
G91
[gcode_macro RESUME]
rename_existing: BASE_RESUME
gcode:
G91
G1 E1.7 F2100
G91
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1
BASE_RESUME
```
## Update Mainsail to V0.0.9
```
rm -R ~/mainsail/*
cd ~/mainsail
wget -q -O kwc.zip https://github.com/meteyou/kwc/releases/download/v0.0.8/kwc-alpha-0.0.8.zip && unzip kwc.zip && rm kwc.zip
```
and update your macros & nginx config.
To begin using Mainsail start by [installing](docs/installation.md) it or read the [documentation](docs/README.md) for more informations.
+6
View File
@@ -0,0 +1,6 @@
# Overview
- [Installation](installation.md)
- [Update from 0.0.x to 0.1.x](update-0.0.x.md)
- [Macros](macros.md)
- [Slicer upload](slicer-upload.md)
Binary file not shown.

After

Width:  |  Height:  |  Size: 617 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

+227
View File
@@ -0,0 +1,227 @@
# Installation
This document provides a guide on how to install Moonraker & Mainsail on a Raspberry
Pi running Raspian/Rasperry Pi OS. Other SBCs and/or linux distributions
may work, however they may need a custom install script.
**Please don't use a octopi image!!!**
Klipper should be installed prior to installing Moonraker. Please see
[Klipper's Documention](https://github.com/KevinOConnor/klipper/blob/master/docs/Installation.md)
for instructions on how to do this.
## Install Moonraker (API)
Moonraker is still in alpha development, and thus some of its dependencies
in Klipper have yet to be merged. Until this has been done it will be
necessary to add a remote and work off a developmental branch of Klipper
to correctly run Moonraker.
### Change Klipper branch
```
cd ~/klipper
git remote add arksine https://github.com/Arksine/klipper.git
```
Now fetch and checkout:
```
git fetch arksine
git checkout arksine/dev-moonraker-testing
```
Note that you are now in a detached head state and you cannot pull. Any
time you want to update to the latest version of this branch you must
repeat the two commands above.
**Note that the above command is NOT part of the Moonraker install procedure.**
### Install Moonraker application
You can now install the Moonraker application:
```
cd ~
git clone https://github.com/Arksine/moonraker.git
```
Finally, run Moonraker's install script:
```
cd ~/moonraker/scripts
./install-moonraker.sh
```
When the script completes it should start both Moonraker and Klipper. In
`klippy.log` you should find the following entry:\
`Moonraker: server connection detected`
### Configure Moonraker
All other configuration is sent to the server via Klippy, thus it is done
in printer.cfg. A basic configuration that authorizes clients on a range
from 192.168.1.1 - 192.168.1.254 is as follows.
Edit your printer.cfg with nano ~/printer.cfg and add the following lines:
```
[moonraker]
trusted_clients:
192.168.1.0/24
```
We also need a `virtual_sdcard` for store the gcode files:
```
[virtual_sdcard]
path: /home/pi/sdcard
```
Finally, we create the virtual_sdcard directory:
```
mkdir ~/sdcard
```
Restart klipper (sudo service klipper restart`) and check your klippy.log if klipper is starting correct again.
When klipper is running, open the url `http://<printer-ip>:7125/printer/info` in your browser. If you see a content like this
```
{"result": {"hostname": "voron250", "error_detected": false, "version": "v0.8.0-643-g528f9f25", "is_ready": true, "message": "Printer is ready", "cpu": "4 core ARMv7 Processor rev 4 (v7l)"}}
```
your API is working!
For more informations about the Moonraker installation or configuration
look at the Repository from Arksine:
[Moonraker Repository install Documentation](https://github.com/Arksine/moonraker/blob/master/docs/installation.md)
## Install Mainsail (webinterface)
### Install webserver & reverse proxy (nginx)
nginx is important to mount all components on port 80 and host the static files from Mainsail.
To install nginx you only need to execute:
```
sudo apt install nginx
```
now we create the config file with:
```
sudo nano /etc/nginx/sites-available/mainsail
```
and fill it with the following content:
```
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream apiserver {
#edit your api port here
ip_hash;
server 127.0.0.1:7125;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
access_log /var/log/nginx/mainsail-access.log;
error_log /var/log/nginx/mainsail-error.log;
#web_path from mainsail static files
root /home/pi/mainsail;
index index.html;
server_name _;
#max upload size for gcodes
client_max_body_size 200M;
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 /websocket {
proxy_pass http://apiserver/websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
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_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;
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;
}
}
```
Create directory for static files and active nginx config:
```
mkdir ~/mainsail
sudo rm /etc/nginx/sites-enabled/default
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:
```
{"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)"}}
```
Now we can install Mainsail (static httpdocs).
### Install httpdocs
Now you can download the current mainsail static data
```
cd ~/mainsail
wget -q -O mainsail.zip https://github.com/meteyou/mainsail/releases/download/v0.1.0/mainsail-beta-0.1.0.zip && unzip mainsail.zip && rm mainsail.zip
```
Now it should be possible to open the interface: `http://<printer-ip>/`.
### Change the Hostname (optional)
to use the hostname instate of the ip, you can install the avahi-daemon:
```
sudo apt install avahi-daemon
```
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.
+45
View File
@@ -0,0 +1,45 @@
# Useful macros for Moonraker/Mainsail
These macros are important for pause/resume/cancel.
```
[pause_resume]
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
default_parameter_X: 230
default_parameter_Y: 230
default_parameter_Z: 10
gcode:
M104 S0
M140 S0
M141 S0
M106 S0
CLEAR_PAUSE
RESET_SD
BASE_CANCEL_PRINT
[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
default_parameter_X: 230
default_parameter_Y: 230
default_parameter_Z: 10
gcode:
SAVE_GCODE_STATE NAME=PAUSE_state
BASE_PAUSE
G91
G1 E-1.7 F2100
G1 Z{Z}
G90
G1 X{X} Y{Y} F6000
G91
[gcode_macro RESUME]
rename_existing: BASE_RESUME
gcode:
G91
G1 E1.7 F2100
G91
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1
BASE_RESUME
```
+7
View File
@@ -0,0 +1,7 @@
# Upload Gcodes from your Slicer
You can upload your gcode-files from your slicer. Moonraker simulate the octoprint-upload.
Just set the slicer to octoprint, enter the hostname or ip and fill in the API-Key field
with something.
![superslicer-upload](images/superslicer-upload.png)
+47
View File
@@ -0,0 +1,47 @@
# Update from 0.0.x to 0.1.x
Between 0.0.x and 0.1.x was a big rebuild of Moonraker. Thats the reason for the separate guide.
## Change Klipper branch
```
cd ~/klipper
git fetch arksine
git checkout arksine/dev-moonraker-testing
```
## Install new Moonraker branch
```
cd ~
git clone https://github.com/Arksine/moonraker.git
```
we have to remove the old moonraker service and install the new version:
```
cd ~/moonraker/scripts
./uninstall-moonraker.sh
./install-moonraker.sh
```
Finally, we have to change the `printer.cfg`. The section `\[api_server\]` is now called `\[moonraker\]`.
## Update the nginx configuration
The nginx configuration (`/etc/nginx/sites-available/mainsail`) will need the following additional section:
```
location /server {
proxy_pass http://apiserver/server;
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;
}
```
Restart nginx with `sudo service nginx restart`
## Update static files from Mainsail
```
rm -R ~/mainsail/*
cd ~/mainsail
wget -q -O mainsail.zip https://github.com/meteyou/mainsail/releases/download/v0.1.0/mainsail-beta-0.1.0.zip && unzip mainsail.zip && rm mainsail.zip
```
+6129 -1479
View File
File diff suppressed because it is too large. Load diff
+16 -15
View File
@@ -14,30 +14,31 @@
"object-assign-deep": "^0.4.0",
"vue": "^2.6.11",
"vue-chartjs": "^3.5.0",
"vue-context": "^5.1.0",
"vue-context": "^5.2.0",
"vue-headful": "^2.1.0",
"vue-plotly": "^1.1.0",
"vue-resource": "^1.5.1",
"vue-simple-upload": "^0.1.6",
"vue-toast-notification": "^0.2.0",
"vuetify": "^2.2.22",
"vuex": "^3.2.0"
"vue-toast-notification": "^0.4.1",
"vuetify": "^2.3.4",
"vuex": "^3.5.1"
},
"devDependencies": {
"@mdi/font": "^5.1.45",
"@vue/cli-plugin-babel": "^4.3.1",
"@vue/cli-plugin-eslint": "^4.3.1",
"@vue/cli-service": "^4.3.1",
"@mdi/font": "^5.3.45",
"@vue/cli-plugin-babel": "^4.4.6",
"@vue/cli-plugin-eslint": "^4.4.6",
"@vue/cli-service": "^4.4.6",
"babel-eslint": "^10.1.0",
"css-loader": "^3.5.2",
"eslint": "^6.8.0",
"css-loader": "^3.6.0",
"eslint": "^7.5.0",
"eslint-plugin-vue": "^6.2.2",
"sass": "^1.26.3",
"sass-loader": "^8.0.2",
"sass": "^1.26.10",
"sass-loader": "^9.0.2",
"vue-cli-plugin-route": "0.0.7",
"vue-cli-plugin-vuetify": "^2.0.5",
"vue-router": "^3.1.6",
"vue-cli-plugin-vuetify": "^2.0.7",
"vue-router": "^3.3.4",
"vue-template-compiler": "^2.6.11",
"vuetify-loader": "^1.4.3"
"vuetify-loader": "^1.6.0"
},
"eslintConfig": {
"root": true,
+2 -3
View File
@@ -1,7 +1,6 @@
{
"socket": {
"hostname": "voron250.local",
"port": 8080,
"reconnectInterval": 3000
"hostname": "kossel.local",
"port": 80
}
}
+2 -2
View File
@@ -5,11 +5,11 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico" id="favicon" />
<title>KlipperWebControl</title>
<title>Mainsail</title>
</head>
<body>
<noscript>
<strong>We're sorry but kwc doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
<strong>We're sorry but Mainsail doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
+44 -14
View File
@@ -13,13 +13,24 @@
>
<div id="nav-header">
<img :src="require('./assets/logo.svg')" />
<v-toolbar-title>{{ hostname }}</v-toolbar-title>
<v-toolbar-title>{{ printername != "" ? printername : hostname }}</v-toolbar-title>
</div>
<ul class="navi" :expand="$vuetify.breakpoint.mdAndUp">
<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">
<router-link slot="activator" class="nav-link" exact :to="category.path" @click.prevent v-if="(category.title === 'Webcam' && boolNaviWebcam) || category.title !== 'Webcam'">
:value="true"
>
<router-link
slot="activator" class="nav-link" exact :to="category.path" @click.prevent
v-if="
(category.title === 'Webcam' && boolNaviWebcam) ||
(category.title === 'Heightmap' && boolNaviHeightmap) ||
(
category.title !== 'Webcam' &&
category.title !== 'Heightmap' &&
(is_ready || category.alwaysShow)
)
">
<v-icon>mdi-{{ category.icon }}</v-icon>
<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>
@@ -27,7 +38,7 @@
<ul class="child">
<li v-for="(page, pageIndex) in category.children" class="nav-item" v-bind:key="`${index}-${pageIndex}`">
<router-link :to="page.path" class="nav-link" @click.prevent>
<router-link :to="page.path" class="nav-link" @click.prevent v-if="is_ready || page.alwaysShow">
<v-icon>mdi-{{ page.icon }}</v-icon>
<span class="nav-title">{{ page.title }}</span>
</router-link>
@@ -45,7 +56,7 @@
<v-btn color="error" v-if="isConnected" :loading="loadingEmergencyStop" @click="emergencyStop">Emergency Stop</v-btn>
</v-app-bar>
<v-content id="content">
<v-main id="content">
<v-scroll-y-transition>
<v-container fluid id="page-container" class="container">
<keep-alive>
@@ -53,12 +64,12 @@
</keep-alive>
</v-container>
</v-scroll-y-transition>
</v-content>
</v-main>
<v-dialog v-model="isConnecting" persistent width="300">
<v-card color="primary" dark >
<v-card-text class="pt-2">
Connecting to Klipper
Connecting...
<v-progress-linear indeterminate color="white" class="mb-0"></v-progress-linear>
</v-card-text>
</v-card>
@@ -85,11 +96,14 @@ export default {
data: () => ({
drawer: null,
activeClass: 'active',
routes: routes
routes: routes,
//is_ready: false,
boolNaviHeightmap: false,
}),
created () {
this.$vuetify.theme.dark = true;
//this.$webSocketsConnect();
//this.is_ready = (this.klippy_state === "ready") ? true : false;
this.boolNaviHeightmap = (typeof(this.config.bed_mesh) !== "undefined");
},
computed: {
currentPage: function() {
@@ -98,12 +112,17 @@ export default {
...mapState({
toolhead: state => state.printer.toolhead,
hostname: state => state.printer.hostname,
printername: state => state.gui.general.printername,
version: state => state.printer.version,
loadingEmergencyStop: state => state.socket.loadingEmergencyStop,
isConnected: state => state.socket.isConnected,
isConnecting: state => !state.socket.isConnected,
progress: state => state.printer.virtual_sdcard.progress,
virtual_sdcard: state => state.printer.virtual_sdcard,
current_file: state => state.printer.virtual_sdcard.filename,
boolNaviWebcam: state => state.gui.webcam.bool,
klippy_state: state => state.socket.klippy_state,
is_ready: state => state.socket.is_ready,
config: state => state.config,
}),
...mapGetters([
'getTitle'
@@ -112,7 +131,7 @@ export default {
methods: {
emergencyStop: function() {
this.$store.commit('setLoadingEmergencyStop', true);
//this.$socket.sendObj('post_printer_gcode', {script: 'M112'}, 'setLoadingEmergencyStop');
this.$socket.sendObj('post_printer_emergency_stop', {}, 'setLoadingEmergencyStop');
},
drawFavicon(val) {
let favicon = document.getElementById('favicon');
@@ -160,12 +179,23 @@ export default {
}
},
watch: {
progress: {
virtual_sdcard: {
deep: true,
handler: function(val) {
this.drawFavicon(val);
let progress = (val && val.progress) ? val.progress : 0;
this.drawFavicon(progress);
}
},
current_file: {
handler: function(newVal) {
this.$socket.sendObj("get_file_metadata", { filename: newVal }, "getMetadataCurrentFile");
}
},
config() {
this.boolNaviHeightmap = (typeof(this.config.bed_mesh) !== "undefined");
}
}
},
}
</script>
+4 -1
View File
@@ -1,3 +1,4 @@
import store from '../store'
import { Line, mixins } from 'vue-chartjs'
const { reactiveProp } = mixins;
@@ -36,11 +37,13 @@ export default {
// See controller.isDatasetVisible comment
meta.hidden = meta.hidden === null ? !ci.data.datasets[index].hidden : null;
if (index_target) {
if (index_target !== -1) {
let meta_target = ci.getDatasetMeta(index_target);
meta_target.hidden = meta.hidden;
}
store.dispatch('setHeaterChartVisibility', { name: legendItem.text, hidden: meta.hidden });
ci.update();
}
},
+36 -29
View File
@@ -4,53 +4,53 @@
<template>
<v-card>
<v-row class="">
<v-row class="" v-if="!is_printing">
<v-col class="col-12 pb-0 text-center">
<div class="d-inline-block mx-2 my-1"><v-btn @click="doHome" :loading="loadingHomeAll" :color="homedAxes.includes('xyz') ? 'primary' : 'warning'" class=""><v-icon class="mr-1">mdi-home</v-icon><span class="d-none d-sm-inline">Home </span>all</v-btn></div>
<div class="d-inline-block mx-2 my-1" v-if="config.hasOwnProperty('quad_gantry_level')"><v-btn @click="doQGL" :loading="loadingQGL" color="primary">QGL</v-btn></div>
</v-col>
</v-row>
<v-row class="mt-3">
<v-row class="mt-3" v-if="!is_printing">
<v-col class="col-12 py-0 px-6 text-center">
<v-btn-toggle borderless no-gutters style="flex-wrap: nowrap; width: 100%;" >
<v-btn @click="doSendMove('X-100')" cols="1" class="flex-grow-1 flex-shrink-0 d-none d-sm-flex"><v-icon left class="d-sm-flex">mdi-chevron-left</v-icon><span>X-100</span></v-btn>
<v-btn @click="doSendMove('X-10')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span>X-10</span></v-btn>
<v-btn @click="doSendMove('X-1')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span>X-1</span></v-btn>
<v-btn @click="doSendMove('X-100')" cols="1" class="flex-grow-1 flex-shrink-0 d-none d-sm-flex"><v-icon left class="d-sm-flex">mdi-chevron-left</v-icon><span class="body-2">X-100</span></v-btn>
<v-btn @click="doSendMove('X-10')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span class="body-2">X-10</span></v-btn>
<v-btn @click="doSendMove('X-1')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span class="body-2">X-1</span></v-btn>
<v-btn @click="doHomeX" :color="homedAxes.includes('x') ? 'primary' : 'warning'" :loading="loadingHomeX"><v-icon class="mdi mdi-home"></v-icon></v-btn>
<v-btn @click="doSendMove('X+1')" cols="1" class="flex-grow-1 flex-shrink-0"><span>X+1</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSendMove('X+10')" cols="1" class="flex-grow-1 flex-shrink-0"><span>X+10</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSendMove('X+100')" cols="1" class="flex-grow-1 flex-shrink-0 d-none d-sm-flex"><span>X+100</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSendMove('X+1')" cols="1" class="flex-grow-1 flex-shrink-0"><span class="body-2">X+1</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSendMove('X+10')" cols="1" class="flex-grow-1 flex-shrink-0"><span class="body-2">X+10</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSendMove('X+100')" cols="1" class="flex-grow-1 flex-shrink-0 d-none d-sm-flex"><span class="body-2">X+100</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
</v-btn-toggle>
</v-col>
</v-row>
<v-row class="mt-3">
<v-row class="mt-3" v-if="!is_printing">
<v-col class="col-12 py-0 px-6 text-center">
<v-btn-toggle borderless no-gutters style="flex-wrap: nowrap; width: 100%;" >
<v-btn @click="doSendMove('Y-100')" cols="1" class="flex-grow-1 flex-shrink-0 d-none d-sm-flex"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span>Y-100</span></v-btn>
<v-btn @click="doSendMove('Y-10')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span>Y-10</span></v-btn>
<v-btn @click="doSendMove('Y-1')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span>Y-1</span></v-btn>
<v-btn @click="doSendMove('Y-100')" cols="1" class="flex-grow-1 flex-shrink-0 d-none d-sm-flex"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span class="body-2">Y-100</span></v-btn>
<v-btn @click="doSendMove('Y-10')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span class="body-2">Y-10</span></v-btn>
<v-btn @click="doSendMove('Y-1')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span class="body-2">Y-1</span></v-btn>
<v-btn @click="doHomeY" :color="homedAxes.includes('y') ? 'primary' : 'warning'" :loading="loadingHomeY"><v-icon class="mdi mdi-home"></v-icon></v-btn>
<v-btn @click="doSendMove('Y+1')" cols="1" class="flex-grow-1 flex-shrink-0"><span>Y+1</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSendMove('Y+10')" cols="1" class="flex-grow-1 flex-shrink-0"><span>Y+10</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSendMove('Y+100')" cols="1" class="flex-grow-1 flex-shrink-0 d-none d-sm-flex"><span>Y+100</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSendMove('Y+1')" cols="1" class="flex-grow-1 flex-shrink-0"><span class="body-2">Y+1</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSendMove('Y+10')" cols="1" class="flex-grow-1 flex-shrink-0"><span class="body-2">Y+10</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSendMove('Y+100')" cols="1" class="flex-grow-1 flex-shrink-0 d-none d-sm-flex"><span class="body-2">Y+100</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
</v-btn-toggle>
</v-col>
</v-row>
<v-row class="mt-3">
<v-row class="mt-3" v-if="!is_printing">
<v-col class="col-12 py-0 px-6 text-center">
<v-btn-toggle borderless no-gutters style="flex-wrap: nowrap; width: 100%;" >
<v-btn @click="doSendMove('Z-25')" cols="1" class="flex-grow-1 flex-shrink-0 d-none d-sm-flex"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span>Z-25</span></v-btn>
<v-btn @click="doSendMove('Z-1')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span>Z-1</span></v-btn>
<v-btn @click="doSendMove('Z-0.1')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span>Z-0.1</span></v-btn>
<v-btn @click="doSendMove('Z-25')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span class="body-2">Z-25</span></v-btn>
<v-btn @click="doSendMove('Z-1')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span class="body-2">Z-1</span></v-btn>
<v-btn @click="doSendMove('Z-0.1')" cols="1" class="flex-grow-1 flex-shrink-0 d-none d-sm-flex"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span class="body-2">Z-0.1</span></v-btn>
<v-btn @click="doHomeZ" :color="homedAxes.includes('z') ? 'primary' : 'warning'" :loading="loadingHomeZ"><v-icon class="mdi mdi-home"></v-icon></v-btn>
<v-btn @click="doSendMove('Z+0.1')" cols="1" class="flex-grow-1 flex-shrink-0"><span>Z+0.1</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSendMove('Z+1')" cols="1" class="flex-grow-1 flex-shrink-0"><span>Z+1</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSendMove('Z+25')" cols="1" class="flex-grow-1 flex-shrink-0 d-none d-sm-flex"><span>Z+25</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSendMove('Z+0.1')" cols="1" class="flex-grow-1 flex-shrink-0 d-none d-sm-flex"><span class="body-2">Z+0.1</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSendMove('Z+1')" cols="1" class="flex-grow-1 flex-shrink-0"><span class="body-2">Z+1</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSendMove('Z+25')" cols="1" class="flex-grow-1 flex-shrink-0"><span class="body-2">Z+25</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
</v-btn-toggle>
</v-col>
</v-row>
<v-row class="" v-if="getMacros.length > 0">
<v-col class="col-12 px-0 py-2 text-center">
<v-col class="col-12 px-4 py-2 text-center">
<div v-for="(macro, index) in getMacros" v-bind:key="index+99" class="d-inline-block mx-1 my-1">
<v-btn color="primary" class="mx-1 my-1" @click="doSend(macro.name)">{{ macro.name }}</v-btn>
</div>
@@ -87,28 +87,34 @@
]),
...mapGetters([
'getMacros',
'is_printing'
])
},
methods: {
doHome() {
this.$store.commit('addGcodeResponse', "G28");
this.$store.commit('setLoading', { name: 'controlHomeAll' });
this.$socket.sendObj('post_printer_gcode', { script: "G28" }, "responseHome");
this.$socket.sendObj('post_printer_gcode_script', { script: "G28" }, "responseHome");
},
doHomeX() {
this.$store.commit('addGcodeResponse', "G28 X");
this.$store.commit('setLoading', { name: 'controlHomeX' });
this.$socket.sendObj('post_printer_gcode', { script: "G28 X" }, "responseHomeX");
this.$socket.sendObj('post_printer_gcode_script', { script: "G28 X" }, "responseHomeX");
},
doHomeY() {
this.$store.commit('addGcodeResponse', "G28 Y");
this.$store.commit('setLoading', { name: 'controlHomeY' });
this.$socket.sendObj('post_printer_gcode', { script: "G28 Y" }, "responseHomeY");
this.$socket.sendObj('post_printer_gcode_script', { script: "G28 Y" }, "responseHomeY");
},
doHomeZ() {
this.$store.commit('addGcodeResponse', "G28 Z");
this.$store.commit('setLoading', { name: 'controlHomeZ' });
this.$socket.sendObj('post_printer_gcode', { script: "G28 Z" }, "responseHomeZ");
this.$socket.sendObj('post_printer_gcode_script', { script: "G28 Z" }, "responseHomeZ");
},
doQGL() {
this.$store.commit('addGcodeResponse', "QUAD_GANTRY_LEVEL");
this.$store.commit('setLoadingQGL', true);
this.$socket.sendObj('post_printer_gcode', { script: "quad_gantry_level" }, "responseQGL");
this.$socket.sendObj('post_printer_gcode_script', { script: "QUAD_GANTRY_LEVEL" }, "responseQGL");
},
doSendMove(gcode) {
gcode = "G91" + "\n" +
@@ -118,7 +124,8 @@
this.doSend(gcode);
},
doSend(gcode) {
Vue.prototype.$socket.sendObj('post_printer_gcode', { script: gcode }, "sendGcode");
this.$store.commit('addGcodeResponse', gcode);
Vue.prototype.$socket.sendObj('post_printer_gcode_script', { script: gcode }, "sendGcode");
},
},
watch: {
+101
View File
@@ -0,0 +1,101 @@
<style>
</style>
<template>
<v-card v-if="!(printer_state === 'Printing' && printer_is_printing)">
<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" no-gutters style="flex-wrap: nowrap; width: 100%;" >
<v-btn @click="setFeedAmount(100)" cols="1" :class="(feedAmount === 100 ? 'v-btn--active' : '') + ' flex-grow-1'">100</v-btn>
<v-btn @click="setFeedAmount(50)" cols="1" :class="(feedAmount === 50 ? 'v-btn--active' : '') + ' flex-grow-1'">50</v-btn>
<v-btn @click="setFeedAmount(20)" cols="1" :class="(feedAmount === 20 ? 'v-btn--active' : '') + ' flex-grow-1'">20</v-btn>
<v-btn @click="setFeedAmount(10)" cols="1" :class="(feedAmount === 10 ? 'v-btn--active' : '') + ' flex-grow-1'">10</v-btn>
<v-btn @click="setFeedAmount(5)" cols="1" :class="(feedAmount === 5 ? 'v-btn--active' : '') + ' flex-grow-1'">5</v-btn>
<v-btn @click="setFeedAmount(1)" cols="1" :class="(feedAmount === 1 ? 'v-btn--active' : '') + ' flex-grow-1'">1</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" no-gutters style="flex-wrap: nowrap; width: 100%;" >
<v-btn @click="setFeedrate(100)" cols="1" :class="(feedrate === 60 ? 'v-btn--active' : '') + ' flex-grow-1'">60</v-btn>
<v-btn @click="setFeedrate(50)" cols="1" :class="(feedrate === 30 ? 'v-btn--active' : '') + ' flex-grow-1'">30</v-btn>
<v-btn @click="setFeedrate(20)" cols="1" :class="(feedrate === 15 ? 'v-btn--active' : '') + ' flex-grow-1'">15</v-btn>
<v-btn @click="setFeedrate(10)" cols="1" :class="(feedrate === 5 ? 'v-btn--active' : '') + ' flex-grow-1'">5</v-btn>
<v-btn @click="setFeedrate(1)" cols="1" :class="(feedrate === 1 ? 'v-btn--active' : '') + ' flex-grow-1'">1</v-btn>
</v-btn-toggle>
</v-col>
</v-row>
<v-row class="px-3">
<v-col class="col-12 text-center">
<v-btn @click="sendRetract()" class="mx-2" :loading="loadingRetract" :disabled="!(extruder !== undefined && extruder.config !== null && extruder.status !== null && extruder.config.min_extrude_temp < extruder.status.temperature)"><v-icon>mdi-arrow-up-bold</v-icon> Retract</v-btn>
<v-btn @click="sendDetract()" class="mx-2" :loading="loadingDetract" :disabled="!(extruder !== undefined && extruder.config !== null && extruder.status !== null && extruder.config.min_extrude_temp < extruder.status.temperature)"><v-icon>mdi-arrow-down-bold</v-icon> Extrude</v-btn>
</v-col>
</v-row>
</v-card>
</template>
<script>
import { mapState, mapGetters } from 'vuex'
import Vue from "vue";
export default {
components: {
},
data: function() {
return {
feedAmount: 20,
feedrate: 5,
loadingRetract: false,
loadingDetract: false,
}
},
computed: {
...mapState({
config: state => state.config,
loadings: state => state.loadings,
printer_state: state => state.printer.idle_timeout.state,
printer_is_paused: state => state.printer.pause_resume.is_paused,
printer_is_printing: state => state.printer.virtual_sdcard.is_active,
}),
...mapGetters([
'getMacros',
'getCurrentExtruder',
'is_printing'
]),
extruder: {
get: function() {
return this.$store.getters.getCurrentExtruder;
}
}
},
methods: {
setFeedAmount(value) {
this.feedAmount = value;
},
setFeedrate(value) {
this.feedrate = value;
},
sendRetract() {
let gcode = "M120\nM83\nG1 E-"+this.feedAmount+" F"+(this.feedrate * 60)+"\nM121";
this.$store.commit('setLoading', { name: 'extruderRetract' });
this.$store.commit('addGcodeResponse', gcode);
Vue.prototype.$socket.sendObj('post_printer_gcode_script', { script: gcode }, "respondeExtruderRetract");
},
sendDetract() {
let gcode = "M120\nM83\nG1 E"+this.feedAmount+" F"+(this.feedrate * 60)+"\nM121";
this.$store.commit('setLoading', { name: 'extruderDetract' });
this.$store.commit('addGcodeResponse', gcode);
Vue.prototype.$socket.sendObj('post_printer_gcode_script', { script: gcode }, "respondeExtruderDetract");
},
},
watch: {
loadings: function(loadings) {
this.loadingRetract = loadings.includes('extruderRetract');
this.loadingDetract = loadings.includes('extruderDetract');
},
}
}
</script>
@@ -0,0 +1,81 @@
<template>
<v-card>
<v-list-item>
<v-list-item-avatar color="grey">
<v-icon dark v-if="error_detected">mdi-alert-circle</v-icon>
<v-icon dark v-if="!error_detected">mdi-information-variant</v-icon>
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">Klippy-Status</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-divider class="my-2" ></v-divider>
<v-card-text class="px-0 pt-0 pb-2 content">
<v-layout wrap class=" text-center">
<v-flex col class="text-left"><pre>{{ klippy_message }}</pre></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 @click="doRestart" :loading="loadingRestart" color="error" class=""><v-icon class="mr-sm-2">mdi-cached</v-icon>Restart</v-btn>
<v-btn @click="doRestartFirmware" :loading="loadingRestartFirmware" class="ml-4" color="error"><v-icon class="mr-sm-2">mdi-cached</v-icon>FIRMWARE_Restart</v-btn>
</v-card-text>
</v-card>
</template>
<script>
import {mapMutations, mapState} from 'vuex';
export default {
computed: {
...mapState({
error_detected: state => state.socket.error_detected,
klippy_message: state => state.socket.klippy_message,
loadingRestart: state => state.socket.loadingRestart,
loadingRestartFirmware: state => state.socket.loadingRestartFirmware,
}),
...mapMutations([
'setLoadingRestart',
'setLoadingRestartFirmware',
]),
},
methods: {
doRestart() {
this.$store.commit('setLoadingRestart', true);
this.$socket.sendObj('post_printer_restart', { }, "responseRestart");
},
doRestartFirmware() {
this.$store.commit('setLoadingRestartFirmware', true);
this.$socket.sendObj('post_printer_firmware_restart', { }, "responseRestartFirmware");
},
},
}
</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;
}
.probe-span {
border-radius: 5px;
}
.probe-span:not(:last-child) {
margin-right: 8px;
}
</style>
+30 -4
View File
@@ -19,13 +19,14 @@
<v-data-table
:headers="headers"
:options="options"
:sort-by.sync="sortBy"
:sort-desc.sync="sortDesc"
:items="events"
item-key="date"
hide-default-footer
hide-default-header
disable-pagination
class="minievent-table"
:custom-sort="customSort"
sort-by="date"
>
<template #no-data>
<div class="text-center">empty</div>
@@ -55,9 +56,19 @@
},
data: function() {
return {
sortBy: 'date',
sortDesc: true,
headers: [
{
text: 'Date',
value: 'date',
width: '15%',
dateType: 'Date',
},
{
text: 'Event',
sortable: false,
value: 'message',
width: '85%'
},
],
options: {
@@ -76,6 +87,21 @@
return message;
},
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;
}
}
}
</script>
@@ -50,14 +50,15 @@
endstops: state => state.printer.endstops,
})
},
created() {
this.getEndstops();
},
methods: {
syncEndstops() {
this.$store.commit('setLoadingEndstopStatus', true);
this.$socket.sendObj('get_printer_endstops', { }, "responseEndstopStatus");
}
},
watch: {
endstops: function() {
this.$socket.sendObj('get_printer_query_endstops_status', { }, "responseEndstopStatus");
},
getEndstops() {
this.sortEndstops = {};
let keys = Object.keys(this.endstops);
@@ -68,6 +69,11 @@
this.sortEndstops[k] = this.endstops[k];
}
}
},
watch: {
endstops: function() {
this.getEndstops();
}
}
}
</script>
@@ -0,0 +1,53 @@
<style>
.webcamImage {
width: 100%;
}
</style>
<template>
<v-card>
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>mdi-cog</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">General</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-divider class="my-2"></v-divider>
<v-card-text class="px-0 pb-0 pt-3 content">
<v-row>
<v-col class="px-10 py-0">
<v-text-field
v-model="printerName"
label="Printer Name"
></v-text-field>
</v-col>
</v-row>
</v-card-text>
</v-card>
</template>
<script>
export default {
components: {
},
data: function() {
return {
}
},
computed: {
printerName: {
get() {
return this.$store.state.gui.general.printername;
},
set(newName) {
return this.$store.dispatch('setSettings', { gui: { general: { printername: newName } } });
}
},
},
methods: {
}
}
</script>
@@ -3,7 +3,7 @@
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>mdi-exclamation-thick</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">Machinelimits</v-list-item-title>
<v-list-item-title class="headline">Machine Limits</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-divider class="my-2"></v-divider>
@@ -7,12 +7,13 @@
</v-list-item-content>
</v-list-item>
<v-divider class="my-2"></v-divider>
<v-card-text class="">
<div><v-btn :href="'http://'+hostname+':'+port+'/printer/log'" color="primary"><v-icon class="mr-sm-2">mdi-download</v-icon>Download Log</v-btn></div>
<v-card-text class=" text-center text-lg-left">
<div><v-btn :href="'http://'+hostname+':'+port+'/server/files/klippy.log'" color="primary"><v-icon class="mr-sm-2">mdi-download</v-icon>Klipper Log</v-btn></div>
<div><v-btn :href="'http://'+hostname+':'+port+'/server/files/moonraker.log'" color="mt-3 primary"><v-icon class="mr-sm-2">mdi-download</v-icon>Moonraker Log</v-btn></div>
<div><v-btn @click="doRestart" :loading="loadingRestart" color="error" class="mt-3"><v-icon class="mr-sm-2">mdi-cached</v-icon>Restart</v-btn></div>
<div><v-btn @click="doRestartFirmware" :loading="loadingRestartFirmware" class="mt-3" color="error"><v-icon class="mr-sm-2">mdi-cached</v-icon><span class="d-none d-sm-block">FW Restart</span></v-btn></div>
<div><v-btn @click="doRebootHost" :loading="loadingRebootHost" class="mt-3" color="error"><v-icon class="mr-sm-2">mdi-cached</v-icon><span class="d-none d-sm-block">Host Restart</span></v-btn></div>
<div><v-btn @click="doShutdownHost" :loading="loadingShutdownHost" class="mt-3" color="error"><v-icon class="mr-sm-2">mdi-power</v-icon><span class="d-none d-sm-block">Host Shutdown</span></v-btn></div>
<div><v-btn @click="doRestartFirmware" :loading="loadingRestartFirmware" class="mt-3" color="error"><v-icon class="mr-sm-2">mdi-cached</v-icon>FW <span class="d-none d-sm-block">Restart</span></v-btn></div>
<div><v-btn @click="doRebootHost" :loading="loadingRebootHost" class="mt-3" color="error"><v-icon class="mr-sm-2">mdi-cached</v-icon>Host <span class="d-none d-sm-block">Restart</span></v-btn></div>
<div><v-btn @click="doShutdownHost" :loading="loadingShutdownHost" class="mt-3" color="error"><v-icon class="mr-sm-2">mdi-power</v-icon>Host <span class="d-none d-sm-block">Shutdown</span></v-btn></div>
</v-card-text>
</v-card>
</template>
+3 -1
View File
@@ -1,6 +1,7 @@
import Vue from 'vue'
import WebcamPanel from './WebcamPanel.vue'
import GeneralPanel from './GeneralPanel'
import WebcamPanel from './WebcamPanel'
import DashboardPanel from "./DashboardPanel";
import MacrosPanel from "./MacrosPanel";
import EndstopPanel from "./EndstopPanel";
@@ -8,6 +9,7 @@ import LimitsPanel from "./LimitsPanel";
import RunoutPanel from "./RunoutPanel";
import SystemPanel from "./SystemPanel";
Vue.component('settings-general-panel', GeneralPanel);
Vue.component('settings-webcam-panel', WebcamPanel);
Vue.component('settings-dashboard-panel', DashboardPanel);
Vue.component('settings-macros-panel', MacrosPanel);
+24 -11
View File
@@ -1,17 +1,30 @@
<style>
.vertical_align_center {
margin: auto 0;
}
</style>
<template>
<v-card>
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>mdi-information-variant</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">Status</v-list-item-title>
<v-list-item-subtitle class="mr-3">{{ printer_state }}{{ printer_is_printing ? " - "+current_file : "" }}</v-list-item-subtitle>
<v-list-item-subtitle class="mr-3">{{ printer_is_paused ? "Pause" : printer_state }}{{ printer_is_printing || printer_is_paused ? " - "+current_file : "" }}</v-list-item-subtitle>
</v-list-item-content>
<v-btn class="orange" v-if="printer_state === 'Printing' && printer_is_printing" @click="btnPauseJob" :loading="btnStatusPause">pause job</v-btn>
<v-btn class="orange" v-if="printer_state === 'Printing' && printer_is_printing && !printer_is_paused" @click="btnPauseJob" :loading="btnStatusPause">pause job</v-btn>
<v-btn class="red" v-if="(is_printing && printer_is_paused)" :loading="btnStatusCancel" @click="btnCancelJob">cancel job</v-btn>
<v-btn class="orange ml-2" v-if="(is_printing && printer_is_paused)" :loading="btnStatusResume" @click="btnResumeJob">resume job</v-btn>
</v-list-item>
<v-divider class="my-2" ></v-divider>
<v-card-text class="px-0 pt-0 pb-2 content">
<v-layout wrap class=" text-center" v-if="display_message">
<v-flex col tag="strong" class="category-header">Message</v-flex>
<v-flex grow class="equal-width text-left vertical_align_center">
<v-flex tag="span">{{ display_message }}</v-flex>
</v-flex>
</v-layout>
<v-divider class="my-2" v-if="display_message" ></v-divider>
<v-layout wrap class=" text-center">
<v-flex col tag="strong" class="category-header">
Position
@@ -43,7 +56,7 @@
<v-flex grow class="equal-width">
<v-layout column>
<v-flex tag="strong">Filament used</v-flex>
<v-flex tag="span">{{ filament_used.toFixed(2) }}mm</v-flex>
<v-flex tag="span">{{ filament_used > 1000 ? (filament_used / 1000).toFixed(2)+"m" : filament_used.toFixed(2)+"mm" }}</v-flex>
</v-layout>
</v-flex>
<v-flex grow class="equal-width">
@@ -103,10 +116,6 @@
import { mapState, mapGetters } from 'vuex';
export default {
data: () => ({
}),
computed: {
...mapState({
toolhead: state => state.printer.toolhead,
@@ -122,10 +131,12 @@
print_time_total: state => state.printer.virtual_sdcard.total_duration,
filament_used: state => state.printer.virtual_sdcard.filament_used,
file_position: state => state.printer.virtual_sdcard.file_position,
current_file: state => state.printer.virtual_sdcard.current_file,
current_file: state => state.printer.virtual_sdcard.filename,
printer_state: state => state.printer.idle_timeout.state,
printer_is_paused: state => state.printer.pause_resume.is_paused,
printer_is_printing: state => state.printer.virtual_sdcard.is_active,
display_message: state => state.printer.display_status.message,
}),
...mapGetters([
@@ -150,10 +161,12 @@
this.$socket.sendObj('post_printer_print_cancel', { }, 'setLoadingPrintCancel');
},
formatTime(seconds) {
let date = new Date(null);
date.setSeconds(seconds);
let h = Math.floor(seconds / 3600);
seconds %= 3600;
let m = ("0" + Math.floor(seconds / 60)).slice(-2);
let s = ("0" + (seconds % 60).toFixed(0)).slice(-2);
return date.toISOString().substr(11,8);
return h+':'+m+':'+s;
},
},
}
-72
View File
@@ -1,72 +0,0 @@
<style>
#line-chart {
height: 250px;
}
</style>
<template>
<v-card>
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>mdi-thermometer</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">Temperature Chart</v-list-item-title>
<v-list-item-subtitle>
<span>{{ heatersCount }} heaters</span>
<span v-if="temperature_fans.length === 1">, {{ temperature_fans.length }} fan</span>
<span v-if="temperature_fans.length > 1">, {{ temperature_fans.length }} fans</span>
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
<v-divider class="my-2"></v-divider>
<v-card-text class="pt-0 pb-2 content">
<line-chart :chart-data="chartdata" v-if="loaded"></line-chart>
</v-card-text>
</v-card>
</template>
<script>
import LineChart from '../../charts/LineChart.js'
import { mapGetters, mapState } from 'vuex'
export default {
components: {
LineChart
},
data () {
return {
loaded: false,
chartdata: {
labels: [],
datasets: []
}
}
},
computed: {
...mapState({
labels: state => state.temperaturChart.labels,
datasets: state => state.temperaturChart.datasets,
}),
...mapGetters([
'heatersCount',
'temperature_fans'
])
},
methods: {
fillData () {
this.loaded = true;
this.chartdata = {
labels: this.labels,
datasets: this.datasets
}
}
},
mounted () {
this.fillData();
},
watch: {
labels() {
this.fillData();
}
}
}
</script>
+25 -3
View File
@@ -2,6 +2,10 @@
.heater-row .vertical_align_center {
margin: auto 0;
}
#line-chart {
height: 250px;
}
</style>
<template>
@@ -9,11 +13,13 @@
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>mdi-thermometer</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">Heaters</v-list-item-title>
<v-list-item-title class="headline">Temperatures</v-list-item-title>
<v-list-item-subtitle>
{{ heatersCount }} heaters
<span v-if="temperature_fans.length === 1">, {{ temperature_fans.length }} fan</span>
<span v-if="temperature_fans.length > 1">, {{ temperature_fans.length }} fans</span>
<span v-if="temperature_sensors.length === 1">, {{ temperature_sensors.length }} sensor</span>
<span v-if="temperature_sensors.length > 1">, {{ temperature_sensors.length }} sensors</span>
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
@@ -33,7 +39,7 @@
</v-col>
<v-col class="text-center py-0 vertical_align_center"><span>{{ heater.temperature.toFixed(1) }}°C</span></v-col>
<v-col class="text-center py-0 vertical_align_center">
<toolInput :name="heater.name" :target="heater.target" command="SET_HEATER_TEMPERATURE" attribute-name="HEATER" ></toolInput>
<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>
@@ -50,6 +56,18 @@
</v-col>
</v-row>
</div>
<div v-if="temperature_sensors.length" >
<v-divider class="my-2"></v-divider>
<v-row class="pl-3 pr-3 heater-row">
<v-col class="text-center py-0">
<b>Temperature<br />Sensors</b>
</v-col>
<v-col class="text-center py-0 vertical_align_center" v-for="(sensor,index) in temperature_sensors" v-bind:key="index+999" >
<span style="cursor: default;" :title="'min: '+sensor.measured_min_temp.toFixed(1)+'° / max: '+sensor.measured_max_temp.toFixed(1)+'°'">{{ sensor.temperature.toFixed(1) }}°C</span><br />
<small style="cursor: default;" :title="'min: '+sensor.measured_min_temp.toFixed(1)+'° / max: '+sensor.measured_max_temp.toFixed(1)+'°'">{{ sensor.name }}</small>
</v-col>
</v-row>
</div>
<v-divider class="my-2" v-if="boolTempchart"></v-divider>
<v-row v-if="boolTempchart">
<v-col>
@@ -61,7 +79,7 @@
</template>
<script>
import {mapGetters, mapState} from 'vuex'
import { mapGetters, mapState } from 'vuex'
import toolInput from '../../inputs/ToolInput'
import LineChart from '../../charts/LineChart.js'
@@ -90,7 +108,11 @@
'heaters',
'heatersCount',
'temperature_fans',
'temperature_sensors',
])
},
created() {
},
methods: {
fillData () {
+73
View File
@@ -0,0 +1,73 @@
<style>
</style>
<template>
<v-card v-if="(printer_state === 'Printing' && printer_is_printing)">
<v-toolbar flat dense >
<v-toolbar-title>
<span class="subheading"><v-icon class="mdi mdi-arrow-collapse-vertical" left></v-icon>Z Baby Stepping</span>
</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: {{ base_zpos.toFixed(2) }}mm</p>
</v-col>
</v-row>
<v-row>
<v-col class="col-12 pt-0 text-center">
<v-btn @click="sendBabySteppingDown()" class="mx-2" :loading="loadingBabySteppingDown" ><v-icon class="mr-2">mdi-arrow-collapse-down</v-icon> -0.05mm</v-btn>
<v-btn @click="sendBabySteppingUp()" class="mx-2" :loading="loadingBabySteppingUp" ><v-icon class="mr-2">mdi-arrow-expand-up</v-icon> +0.05mm</v-btn>
</v-col>
</v-row>
</v-card-text>
</v-card>
</template>
<script>
import { mapState } from 'vuex'
import Vue from "vue";
export default {
components: {
},
data: function() {
return {
loadingBabySteppingDown: false,
loadingBabySteppingUp: false,
}
},
computed: {
...mapState({
loadings: state => state.loadings,
base_zpos: state => state.printer.gcode.base_zpos,
printer_state: state => state.printer.idle_timeout.state,
printer_is_paused: state => state.printer.pause_resume.is_paused,
printer_is_printing: state => state.printer.virtual_sdcard.is_active,
}),
},
methods: {
sendBabySteppingDown() {
let gcode = "SET_GCODE_OFFSET Z_ADJUST=-0.05 MOVE=1";
this.$store.commit('setLoading', { name: 'babySteppingDown' });
this.$store.commit('addGcodeResponse', gcode);
Vue.prototype.$socket.sendObj('post_printer_gcode_script', { script: gcode }, "respondeBabySteppingDown");
},
sendBabySteppingUp() {
let gcode = "SET_GCODE_OFFSET Z_ADJUST=0.05 MOVE=1";
this.$store.commit('setLoading', { name: 'babySteppingUp' });
this.$store.commit('addGcodeResponse', gcode);
Vue.prototype.$socket.sendObj('post_printer_gcode_script', { script: gcode }, "respondeBabySteppingUp");
},
},
watch: {
loadings: function(loadings) {
this.loadingBabySteppingDown = loadings.includes('babySteppingDown');
this.loadingBabySteppingUp = loadings.includes('babySteppingUp');
},
}
}
</script>
+6 -2
View File
@@ -1,18 +1,22 @@
import Vue from 'vue'
import StatusPanel from './StatusPanel.vue'
import KlippyStatePanel from './KlippyStatePanel.vue'
import ToolsPanel from './ToolsPanel.vue'
import TempchartPanel from './TempchartPanel.vue'
import ControlPanel from "./ControlPanel";
import ExtruderPanel from "./ExtruderPanel";
import ZOffsetPanel from "./ZOffsetPanel";
import Peripherie from "./PeripheriePanel";
import WebcamPanel from "./WebcamPanel";
import MiniconsolePanel from "./MiniconsolePanel";
import Settings from "./Settings/";
Vue.component('status-panel', StatusPanel);
Vue.component('klippy-state-panel', KlippyStatePanel);
Vue.component('tools-panel', ToolsPanel);
Vue.component('tempchart-panel', TempchartPanel);
Vue.component('control-panel', ControlPanel);
Vue.component('extruder-panel', ExtruderPanel);
Vue.component('zoffset-panel', ZOffsetPanel);
Vue.component('peripherie-panel', Peripherie);
Vue.component('webcam-panel', WebcamPanel);
Vue.component('miniconsole-panel', MiniconsolePanel);
+1 -1
View File
@@ -42,7 +42,7 @@
},
methods: {
changeSensor() {
this.$socket.sendObj('post_printer_gcode', { script: 'SET_FILAMENT_SENSOR SENSOR='+this.name+' ENABLE='+(this.enabled ? 0 : 1) });
this.$socket.sendObj('post_printer_gcode_script', { script: 'SET_FILAMENT_SENSOR SENSOR='+this.name+' ENABLE='+(this.enabled ? 0 : 1) });
}
},
watch: {
+12 -2
View File
@@ -10,12 +10,14 @@
</style>
<template>
<v-text-field type="number" min="-273" max="1999" step="any" ref="toolField" v-model="value" class="tool-input" @change="setTemps">
<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>
</template>
<script>
import Vue from "vue";
export default {
data: function() {
return {
@@ -25,6 +27,8 @@
props: {
name: String,
target: Number,
min_temp: Number,
max_temp: Number,
command: String,
attributeName: String,
},
@@ -33,7 +37,13 @@
},
methods: {
setTemps() {
this.$socket.sendObj('post_printer_gcode', {script: this.command+' '+this.attributeName+'='+this.name+' TARGET='+this.value});
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 && this.value !== 0) {
this.value = this.target;
Vue.$toast.error("Temperature too low for "+this.name+"! (min: "+this.min_temp+")");
} else this.$socket.sendObj('post_printer_gcode_script', {script: this.command+' '+this.attributeName+'='+this.name+' TARGET='+this.value});
}
},
watch: {
+1 -1
View File
@@ -69,7 +69,7 @@
},
methods: {
sendCmd() {
this.$socket.sendObj('post_printer_gcode', { script: this.command+' '+this.attributeName+(this.value*this.attributeScale).toFixed(0) });
this.$socket.sendObj('post_printer_gcode_script', { script: this.command+' '+this.attributeName+(this.value*this.attributeScale).toFixed(0) });
},
decrement() {
this.value--;
+32 -15
View File
@@ -54,12 +54,12 @@
:headers="headers"
:options="options"
:sort-by.sync="sortBy"
:sort-desc.sync="sortDesc"
:items="events"
item-key="date"
hide-default-footer
disable-pagination
class="event-table"
:custom-sort="customSort"
>
<template #no-data>
<div class="text-center">empty</div>
@@ -89,12 +89,12 @@
return {
gcode: "",
sortBy: 'date',
sortDesc: true,
headers: [
{
text: 'Date',
value: 'date',
width: '15%'
width: '15%',
dateType: 'Date',
},
{
text: 'Event',
@@ -110,36 +110,31 @@
],
lastCommandNumber: null,
items: []
items: [],
loadingSendGcode: false,
}
},
computed: {
...mapState({
events: state => state.events,
helplist: state => state.helplist,
loadings: state => state.loadings,
}),
...mapGetters([
'getMacros'
]),
loadingSendGcode: {
get() {
return this.$store.state.socket.loadingSendGcode
},
set(value) {
return this.$store.dispatch('setLoadingSendGcode', value)
}
}
},
methods: {
doSend() {
this.loadingSendGcode = true;
Vue.prototype.$socket.sendObj('post_printer_gcode', { script: this.gcode }, "sendGcode");
this.$store.commit('setLoading', { name: 'loadingSendGcode' });
this.$store.commit('addGcodeResponse', this.gcode);
Vue.prototype.$socket.sendObj('post_printer_gcode_script', { script: this.gcode }, "sendGcode");
this.lastCommands.push(this.gcode);
this.gcode = "";
this.lastCommandNumber = null;
},
formatMessage(message) {
message = message.replace(/(?:\r\n|\r|\n)/g, '<br>');
if (typeof message === "string") message = message.replace(/(?:\r\n|\r|\n)/g, '<br>');
return message;
},
@@ -177,6 +172,28 @@
}
}
this.$refs.gcodeCommandField.focus();
},
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;
}
},
watch: {
loadings: {
handler: function(newVal) {
this.loadingSendGcode = newVal.includes('loadingSendGcode');
}
}
}
}
+22 -4
View File
@@ -1,29 +1,47 @@
<template>
<v-row>
<v-col class="col-sm-12 col-md-7">
<status-panel></status-panel>
<status-panel v-if="is_ready"></status-panel>
<klippy-state-panel v-if="!is_ready"></klippy-state-panel>
<webcam-panel v-if="showDashboardWebcam" class="mt-6"></webcam-panel>
<control-panel class="mt-6"></control-panel>
<z-offset-panel class="mt-6" v-if="is_ready"></z-offset-panel>
<control-panel class="mt-6" v-if="is_ready"></control-panel>
<extruder-panel class="mt-6" v-if="is_ready"></extruder-panel>
</v-col>
<v-col class="col-sm-12 col-md-5">
<tools-panel></tools-panel>
<peripherie-panel class="mt-6"></peripherie-panel>
<miniconsole-panel class="mt-6" v-if="showDashboardConsole"></miniconsole-panel>
<peripherie-panel class="mt-6" v-if="is_ready"></peripherie-panel>
<miniconsole-panel class="mt-6" v-if="is_ready && showDashboardConsole"></miniconsole-panel>
</v-col>
</v-row>
</template>
<script>
import { mapState, mapGetters } from 'vuex'
import ZOffsetPanel from "../components/panels/ZOffsetPanel";
export default {
components: {ZOffsetPanel},
data: () => ({
//is_ready: false
}),
computed: {
...mapState({
showDashboardConsole: state => state.gui.dashboard.boolConsole,
klippy_state: state => state.socket.klippy_state,
is_ready: state => state.socket.is_ready,
}),
...mapGetters([
'showDashboardWebcam'
])
},
/*created() {
//this.is_ready = (this.klippy_state === "ready") ? true : false;
},
watch: {
klippy_state() {
this.is_ready = (this.klippy_state === "ready") ? true : false;
}
}*/
}
</script>
+380 -127
View File
@@ -45,36 +45,82 @@
<template>
<div>
<v-card class="fileupload-card" @dragover="dragOver" @dragleave="dragLeave" @drop.prevent.stop="dragDrop">
<v-card class="fileupload-card" @dragover="dragOverUpload" @dragleave="dragLeaveUpload" @drop.prevent.stop="dragDropUpload">
<v-card-title>
G-Code Files
<v-spacer></v-spacer>
<v-btn :loading="loadingRefresh" @click="refreshFileList"><v-icon class="mr-1">mdi-refresh</v-icon> Refresh</v-btn>
<v-btn :loading="loadingMakeDirectory" @click="createDirectory"><v-icon class="mr-1">mdi-folder-plus</v-icon> new Directory</v-btn>
<v-btn color="primary ml-4" :loading="loadingGcodeRefresh" @click="refreshFileList"><v-icon class="mr-1">mdi-refresh</v-icon> Refresh</v-btn>
<input type="file" ref="fileUpload" style="display: none" @change="uploadFile" />
<v-btn color="primary ml-4 " v-if="!is_printing" :loading="loadingUpload" @click="clickUploadButton"><v-icon>mdi-upload</v-icon>Upload</v-btn>
<v-btn color="primary ml-4 " :loading="loadingGcodeUpload" @click="clickUploadButton"><v-icon>mdi-upload</v-icon>Upload</v-btn>
</v-card-title>
<v-card-subtitle>
Current path: {{ this.currentPath }}
</v-card-subtitle>
<v-card-text>
<v-text-field
v-model="search"
append-icon="mdi-magnify"
label="Search"
single-line
hide-details
></v-text-field>
</v-card-text>
<v-data-table
:headers="headers"
:options="options"
:custom-sort="sort"
:sort-by.sync="sortBy"
:sort-desc.sync="sortDesc"
:items="files"
:items-per-page="countPerPage"
item-key="date"
class="files-table"
>
:items="files"
class="files-table"
:headers="headers"
:options="options"
:custom-sort="sortFiles"
:sort-by.sync="sortBy"
:sort-desc.sync="sortDesc"
:items-per-page="countPerPage"
item-key="name"
:search="search"
:custom-filter="advancedSearch"
@pagination="refreshMetadata">
<template #no-data>
<div class="text-center">empty</div>
</template>
<template v-slot:body.prepend>
<tr
v-if="(currentPath !== 'gcodes')"
class="file-list-cursor"
@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=" " colspan="8">
..
</td>
</tr>
</template>
<template #item="{ item }">
<tr @contextmenu="showContextMenu($event, item)" @click="dialog.show = true, dialog.filename = item.filename" class="file-list-cursor">
<tr
@contextmenu="showContextMenu($event, item)"
@click="clickRow(item)"
class="file-list-cursor"
draggable="true"
@drag="dragFile($event, item)"
@dragend="dragendFile($event)"
@dragover="dragOverFilelist($event, item)" @dragleave="dragLeaveFilelist" @drop.prevent.stop="dragDropFilelist($event, item)"
:data-name="item.filename"
>
<td class=" ">
<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 : '--')" />
</td>
<td class=" ">
{{ item.filename }}
</td>
<td class="text-no-wrap text-right">
{{ formatFilesize(item.size) }}
{{ item.isDirectory ? '--' : formatFilesize(item.size) }}
</td>
<td class="text-right">
{{ formatDate(item.modified) }}
@@ -86,7 +132,7 @@
{{ item.layer_height ? item.layer_height.toFixed(2)+' mm' : '--' }}
</td>
<td class="text-no-wrap text-right">
{{ item.filament_used ? item.filament_used.toFixed()+' mm' : '--' }}
{{ item.filament_total ? item.filament_total.toFixed()+' mm' : '--' }}
</td>
<td class="text-no-wrap text-right">
{{ formatPrintTime(item.estimated_time) }}
@@ -103,22 +149,79 @@
</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="downloadFile">
<v-list-item @click="downloadFile" :disabled="is_printing" v-if="!contextMenu.item.isDirectory">
<v-icon class="mr-1">mdi-play</v-icon> Print start
</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="removeFile">
<v-list-item @click="renameDirectory(contextMenu.item)" v-if="contextMenu.item.isDirectory">
<v-icon class="mr-1">mdi-pencil</v-icon> Rename
</v-list-item>
<v-list-item @click="renameFile(contextMenu.item)" v-if="!contextMenu.item.isDirectory">
<v-icon class="mr-1">mdi-pencil</v-icon> Rename
</v-list-item>
<v-list-item @click="removeFile" v-if="!contextMenu.item.isDirectory">
<v-icon class="mr-1">mdi-delete</v-icon> Delete
</v-list-item>
<v-list-item @click="deleteDirectoryAction" v-if="contextMenu.item.isDirectory">
<v-icon class="mr-1">mdi-delete</v-icon> Delete
</v-list-item>
</v-list>
</v-menu>
<v-dialog v-model="dialog.show" max-width="400">
<v-dialog v-model="dialogPrintFile.show" max-width="400">
<v-card>
<v-img
v-if="dialogPrintFile.item.thumbnails && dialogPrintFile.item.thumbnails.find(element => element.width === 400)"
:src="'data:image/gif;base64,'+(dialogPrintFile.item.thumbnails ? dialogPrintFile.item.thumbnails.find(element => element.width === 400).data : '')"
:height="(dialogPrintFile.item.thumbnails ? dialogPrintFile.item.thumbnails.find(element => element.width === 400).height : '')+'px'"
></v-img>
<v-card-title class="headline">Start Job</v-card-title>
<v-card-text>Do you want to start {{ dialog.filename }}?</v-card-text>
<v-card-text>Do you want to start {{ dialogPrintFile.item.filename }}?</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="red darken-1" text @click="dialog.show = false">No</v-btn>
<v-btn color="green darken-1" text @click="startPrint(dialog.filename)">Yes</v-btn>
<v-btn color="red darken-1" text @click="dialogPrintFile.show = false">No</v-btn>
<v-btn color="green darken-1" text @click="startPrint(dialogPrintFile.item.filename)">Yes</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog v-model="dialogCreateDirectory.show" max-width="400">
<v-card>
<v-card-title class="headline">New Directory</v-card-title>
<v-card-text>
Please enter a new directory name:
<v-text-field label="Name" :rules="input_rules" @keypress.enter="createDirectoryAction" required v-model="dialogCreateDirectory.name"></v-text-field>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="" text @click="dialogCreateDirectory.show = false">Cancel</v-btn>
<v-btn color="primary" text @click="createDirectoryAction">create</v-btn>
</v-card-actions>
</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="dialogRenameDirectory.show" max-width="400">
<v-card>
<v-card-title class="headline">Rename Directory</v-card-title>
<v-card-text>
<v-text-field label="Name" required v-model="dialogRenameDirectory.newName"></v-text-field>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="" text @click="dialogRenameDirectory.show = false">Cancel</v-btn>
<v-btn color="primary" text @click="renameDirectoryAction">rename</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
@@ -127,62 +230,51 @@
<script>
import { mapState, mapGetters } from 'vuex';
import axios from 'axios';
import { findDirectory } from "../plugins/helpers";
import Vue from "vue";
export default {
data () {
return {
search: '',
sortBy: 'modified',
sortDesc: true,
dialog: {
selected: [],
dialogPrintFile: {
show: false,
filename: ""
item: {}
},
dialogCreateDirectory: {
show: false,
name: ""
},
dialogRenameFile: {
show: false,
newName: "",
item: {}
},
dialogRenameDirectory: {
show: false,
newName: "",
item: {}
},
headers: [
{
text: 'Name',
value: 'filename',
},
{
text: 'Filesize',
value: 'size',
align: 'right',
},
{
text: 'Last modified',
value: 'modified',
align: 'right',
},
{
text: 'Object Height',
value: 'object_height',
align: 'right',
},
{
text: 'Layer Height',
value: 'layer_height',
align: 'right',
},
{
text: 'Filament Usage',
value: 'filament_used',
align: 'right',
},
{
text: 'Print Time',
value: 'estimated_time',
align: 'right',
},
{
text: 'Generated by',
value: 'slicer',
align: 'right',
},
{ text: '', value: '', },
{ text: 'Name', value: 'filename', },
{ text: 'Filesize', value: 'size', align: 'right', },
{ text: 'Last modified', value: 'modified', align: 'right', },
{ text: 'Object Height', value: 'object_height', align: 'right', },
{ text: 'Layer Height', value: 'layer_height', align: 'right', },
{ text: 'Filament Usage', value: 'filament_total', align: 'right', },
{ text: 'Print Time', value: 'estimated_time', align: 'right', },
{ text: 'Generated by', value: 'slicer', align: 'right', },
],
options: {
},
contextMenu: {
shown: false,
isDirectory: false,
touchTimer: undefined,
x: 0,
y: 0,
@@ -191,22 +283,37 @@
dropzone: {
visibility: 'hidden',
opacity: 0,
}
},
files: [],
currentPath: 'gcodes',
loadingGcodeUpload: false,
loadingGcodeRefresh: false,
loadingMakeDirectory: false,
draggingFile: {
status: false,
item: {}
},
input_rules: [
value => value.indexOf(" ") === -1 || 'Name contain spaces!'
]
}
},
computed: {
...mapState({
files: state => state.files,
loadingUpload: state => state.socket.loadingGcodeUpload,
loadingRefresh: state => state.socket.loadingGcodeRefresh,
filetree: state => state.filetree,
countPerPage: state => state.gui.gcodefiles.countPerPage,
hostname: state => state.socket.hostname,
port: state => state.socket.port,
loadings: state => state.loadings,
}),
...mapGetters([
'is_printing'
])
},
created() {
let dirArray = this.currentPath.split("/");
this.files = findDirectory(this.filetree, dirArray);
},
methods: {
uploadFile: function() {
if (this.$refs.fileUpload.files.length) {
@@ -216,19 +323,27 @@
doUploadFile: function(file) {
let toast = this.$toast;
let formData = new FormData();
formData.append('file', file);
this.$store.commit('setLoadingGcodeUpload', true);
let filename = file.name.replace(" ", "_");
axios.post('http://' + this.hostname + ':' + this.port + '/printer/files/upload',
formData.append('file', file, (this.currentPath+"/"+filename).substring(7));
this.$store.commit('setLoading', { name: 'loadingGcodeUpload' });
axios.post('http://' + this.hostname + ':' + this.port + '/server/files/upload',
formData, {
headers: { 'Content-Type': 'multipart/form-data' }
}
).then((result) => {
this.$store.commit('setLoadingGcodeUpload', false);
this.$store.commit('removeLoading', { name: 'loadingGcodeUpload' });
toast.success("Upload of "+result.data.result+" successful!");
this.$socket.sendObj('get_directory', { path: this.currentPath }, 'getDirectory');
let filename = (this.currentPath+"/"+file.name).substring(7);
setTimeout(function() {
Vue.prototype.$socket.sendObj("get_file_metadata", { filename: filename }, "getMetadata");
}, 1000);
})
.catch(() => {
this.$store.commit('setLoadingGcodeUpload', false);
this.$store.commit('removeLoading', { name: 'loadingGcodeUpload' });
toast.error("Cannot upload the file!");
});
},
@@ -236,8 +351,8 @@
this.$refs.fileUpload.click();
},
refreshFileList: function() {
this.$store.commit('setLoadingGcodeRefresh', true);
this.$socket.sendObj('get_printer_files', {}, 'getFileList');
this.$store.commit('setLoading', { name: 'loadingGcodeRefresh' });
this.$socket.sendObj('get_directory', { path: this.currentPath }, 'getDirectory');
},
formatDate(date) {
let tmp2 = new Date(date);
@@ -282,85 +397,223 @@
});
},
downloadFile() {
let filename = (this.currentPath+"/"+this.contextMenu.item.filename);
let link = document.createElement("a");
link.download = name;
link.href = 'http://' + this.hostname + ':' + this.port + '/printer/files/' + this.contextMenu.item.filename;
link.href = 'http://' + this.hostname + ':' + this.port + '/server/files/' + filename;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
},
renameFile(item) {
this.dialogRenameFile.item = item;
this.dialogRenameFile.newName = item.filename;
this.dialogRenameFile.show = true;
},
renameFileAction() {
this.dialogRenameFile.show = false;
this.$socket.sendObj('post_file_move', {
source: this.currentPath+"/"+this.dialogRenameFile.item.filename,
dest: this.currentPath+"/"+this.dialogRenameFile.newName
}, 'getPostFileMove');
},
renameDirectory(item) {
this.dialogRenameDirectory.item = item;
this.dialogRenameDirectory.newName = item.filename;
this.dialogRenameDirectory.show = true;
},
renameDirectoryAction() {
this.dialogRenameDirectory.show = false;
this.$socket.sendObj('post_file_move', {
source: this.currentPath+"/"+this.dialogRenameDirectory.item.filename,
dest: this.currentPath+"/"+this.dialogRenameDirectory.newName
}, 'getPostFileMove');
},
removeFile() {
let filename = (this.currentPath+"/"+this.contextMenu.item.filename);
axios.delete(
'http://'+ this.hostname + ':' + this.port +'/printer/files/'+this.contextMenu.item.filename
'http://'+ this.hostname + ':' + this.port +'/server/files/'+filename
).then((result) => {
this.$toast.success(result.data.result+" successfully deleted.");
this.$socket.sendObj('get_directory', { path: this.currentPath }, 'getDirectory');
}).catch(() => {
this.$toast.error("Error! Cannot delete file.");
});
},
createDirectory: function() {
this.dialogCreateDirectory.name = "";
this.dialogCreateDirectory.show = true;
},
createDirectoryAction: function() {
if (this.dialogCreateDirectory.name.length && this.dialogCreateDirectory.name.indexOf(" ") === -1) {
this.dialogCreateDirectory.show = false;
this.$socket.sendObj('post_directory', { path: this.currentPath+"/"+this.dialogCreateDirectory.name }, 'getPostDirectory');
}
},
deleteDirectoryAction: function() {
this.$socket.sendObj('delete_directory', { path: this.currentPath+"/"+this.contextMenu.item.filename }, 'getDeleteDirectory');
},
clickRow: function(item) {
if (!item.isDirectory) {
this.dialogPrintFile.show = true;
this.dialogPrintFile.item = item;
} else {
this.currentPath += "/"+item.filename;
this.loadPath();
}
},
clickRowGoBack: function() {
this.currentPath = this.currentPath.substr(0, this.currentPath.lastIndexOf("/"));
},
loadPath: function() {
this.$socket.sendObj('get_directory', { path: this.currentPath }, 'getDirectory');
let dirArray = this.currentPath.split("/");
this.files = findDirectory(this.filetree, dirArray);
},
startPrint(filename = "") {
this.dialog.show = false;
filename = (this.currentPath+"/"+filename).substring(7);
this.dialogPrintFile.show = false;
this.$socket.sendObj('post_printer_print_start', { filename: filename }, 'switchToDashboard');
},
dragOver(e) {
e.preventDefault();
e.stopPropagation();
dragOverUpload(e) {
if (!this.draggingFile.status) {
e.preventDefault();
e.stopPropagation();
this.dropzone.visibility = 'visible';
this.dropzone.opacity = 1;
},
dragLeave(e) {
e.preventDefault();
e.stopPropagation();
this.dropzone.visibility = 'hidden';
this.dropzone.opacity = 0;
},
async dragDrop(e) {
e.preventDefault();
this.dropzone.visibility = 'hidden';
this.dropzone.opacity = 0;
if (!this.is_printing && e.dataTransfer.files.length) {
await this.doUploadFile(e.dataTransfer.files[0]);
this.dropzone.visibility = 'visible';
this.dropzone.opacity = 1;
}
},
sort(items, sortBy, sortDesc) {
sortBy = sortBy.length ? sortBy[0] : 'name';
dragLeaveUpload(e) {
if (!this.draggingFile.status) {
e.preventDefault();
e.stopPropagation();
this.dropzone.visibility = 'hidden';
this.dropzone.opacity = 0;
}
},
async dragDropUpload(e) {
if (!this.draggingFile.status) {
e.preventDefault();
this.dropzone.visibility = 'hidden';
this.dropzone.opacity = 0;
if (!this.is_printing && e.dataTransfer.files.length) {
await this.doUploadFile(e.dataTransfer.files[0]);
}
}
},
dragFile(e, item) {
e.preventDefault();
this.draggingFile.status = true;
this.draggingFile.item = item;
},
dragendFile(e) {
e.preventDefault();
this.draggingFile.status = false;
this.draggingFile.item = { };
},
dragOverFilelist(e, row) {
if (this.draggingFile.status) {
e.preventDefault();
//e.stopPropagation();
if (row.isDirectory) {
e.target.parentElement.style.backgroundColor = '#43A04720';
}
}
},
dragLeaveFilelist(e) {
if (this.draggingFile.status) {
e.preventDefault();
e.stopPropagation();
e.target.parentElement.style.backgroundColor = 'transparent';
}
},
async dragDropFilelist(e, row) {
if (this.draggingFile.status) {
e.preventDefault();
e.target.parentElement.style.backgroundColor = 'transparent';
this.$socket.sendObj('post_file_move', {
source: this.currentPath+"/"+this.draggingFile.item.filename,
dest: this.currentPath+"/"+row.filename+"/"+this.draggingFile.item.filename,
}, 'getPostFileMove');
}
},
sortFiles(items, sortBy, sortDesc) {
sortBy = sortBy.length ? sortBy[0] : 'filename';
sortDesc = sortDesc[0];
// Sort by index
items.sort(function(a, b) {
if (a[sortBy] === b[sortBy]) {
return 0;
}
if (a[sortBy] === null || a[sortBy] === undefined) {
return -1;
}
if (b[sortBy] === null || b[sortBy] === undefined) {
return 1;
}
if (a[sortBy].constructor === String && b[sortBy].constructor === String) {
return a[sortBy].localeCompare(b[sortBy], undefined, { sensivity: 'base' });
}
if (a[sortBy] instanceof Array && b[sortBy] instanceof Array) {
const reducedA = a[sortBy].length ? a.filament.reduce((a, b) => a + b) : 0;
const reducedB = b[sortBy].length ? b.filament.reduce((a, b) => a + b) : 0;
return reducedA - reducedB;
}
return a[sortBy] - b[sortBy];
});
if (items !== undefined) {
// Sort by index
items.sort(function(a, b) {
if (a[sortBy] === b[sortBy]) {
return 0;
}
if (a[sortBy] === null || a[sortBy] === undefined) {
return -1;
}
if (b[sortBy] === null || b[sortBy] === undefined) {
return 1;
}
if (a[sortBy].constructor === String && b[sortBy].constructor === String) {
return a[sortBy].localeCompare(b[sortBy], undefined, { sensivity: 'base' });
}
if (a[sortBy] instanceof Array && b[sortBy] instanceof Array) {
const reducedA = a[sortBy].length ? a.filament.reduce((a, b) => a + b) : 0;
const reducedB = b[sortBy].length ? b.filament.reduce((a, b) => a + b) : 0;
return reducedA - reducedB;
}
return a[sortBy] - b[sortBy];
});
// Deal with descending order
if (sortDesc) {
items.reverse();
// Deal with descending order
if (sortDesc) items.reverse();
// Then make sure directories come first
items.sort((a, b) => (a.isDirectory === b.isDirectory) ? 0 : (a.isDirectory ? -1 : 1));
}
// Then make sure directories come first
items.sort((a, b) => (a.isDirectory === b.isDirectory) ? 0 : (a.isDirectory ? -1 : 1));
return items;
},
refreshMetadata: function(data) {
let items = this.sortFiles(this.files, [this.sortBy], [this.sortDesc]);
for (let i = data.pageStart; i < data.pageStop; i++) {
if (items[i] && !items[i].isDirectory && !items[i].metadataPulled) {
let filename = (this.currentPath+"/"+items[i].filename).substring(7);
this.$socket.sendObj("get_file_metadata", { filename: filename }, "getMetadata");
}
}
},
advancedSearch: function(value, search) {
return value != null &&
search != null &&
typeof value === 'string' &&
value.toString().toLowerCase().indexOf(search.toLowerCase()) !== -1
}
},
watch: {
filetree: {
deep: true,
handler(newVal) {
let dirArray = this.currentPath.split("/");
this.files = findDirectory(newVal, dirArray);
}
},
currentPath: {
handler(newVal) {
let dirArray = newVal.split("/");
this.files = findDirectory(this.filetree, dirArray);
}
},
loadings: function(loadings) {
this.loadingGcodeRefresh = loadings.includes('loadingGcodeRefresh');
this.loadingGcodeUpload = loadings.includes('loadingGcodeUpload');
}
}
}
</script>
+353
View File
@@ -0,0 +1,353 @@
<style>
</style>
<template>
<div>
<v-row>
<v-col class="col-12 col-md-8">
<v-card>
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>mdi-grid</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">Heightmap</v-list-item-title>
<v-list-item-subtitle class="mr-3" v-if="boolShowBedMesh">Current profile: {{ this.bed_mesh ? this.bed_mesh.profile_name : "unknown" }}</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
<v-divider class="my-2"></v-divider>
<v-card-text class="px-0 py-0 content" v-if="boolShowBedMesh">
<Plotly ref="heightmap" :data="data" :layout="layout" :display-mode-bar="false"></Plotly>
</v-card-text>
<v-card-text v-if="!boolShowBedMesh">
No bed_mesh has been loaded yet.
</v-card-text>
<v-card-actions v-if="boolShowBedMesh">
<v-spacer></v-spacer>
<v-btn text :color="(this.showMeshType === 'probed' ? 'primary accent-4' : 'grey lighten-2')" @click="switchToProbed">Probed</v-btn>
<v-btn text :color="(this.showMeshType === 'mesh' ? 'primary accent-4' : 'grey lighten-2')" @click="switchToMesh">Mesh</v-btn>
<v-spacer></v-spacer>
</v-card-actions>
</v-card>
</v-col>
<v-col class="col-12 col-md-4">
<v-card>
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>mdi-cogs</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">Profile</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-divider class="my-2"></v-divider>
<v-card-text>
<v-row>
<v-col class="col-12">
<v-select
:items="profiles"
v-model="profile"
item-text="name"
item-value="name"
label="Profile"
outlined
></v-select>
</v-col>
</v-row>
<v-row>
<v-col class="col-12">
<v-btn color="primary" class="mr-3" @click="loadProfile" :loading="loadingLoad" :disabled="disabledLoad">LOAD</v-btn>
<v-btn color="primary" class="mr-3" @click="saveDialog = true; newName = profile" :loading="loadingSave" :disabled="disabledSave">SAVE</v-btn>
<v-btn color="primary" class="mr-3" @click="removeDialog = true" :loading="loadingRemove" :disabled="disabledRemove">REMOVE</v-btn>
</v-col>
</v-row>
<v-row>
<v-col class="col-12">
<v-btn color="primary" class="mr-3" @click="clearBedMesh" :loading="loadingClear" :disabled="disabledClear">CLEAR</v-btn>
<v-btn color="primary" class="mr-3" @click="calibrateDialog = true" :loading="loadingCalibrate" :disabled="is_printing">Calibrate</v-btn>
</v-col>
</v-row>
</v-card-text>
</v-card>
</v-col>
</v-row>
<v-dialog v-model="saveDialog" persistent max-width="600px">
<v-card>
<v-card-title>
<span class="headline">Mesh Profile</span>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col cols="12">
<v-text-field label="Name" required v-model="newName"></v-text-field>
</v-col>
</v-row>
</v-container>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="waring darken-1" text @click="saveDialog = false">abort</v-btn>
<v-btn color="blue darken-1" text @click="saveProfile">save</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog v-model="calibrateDialog" persistent max-width="600px">
<v-card>
<v-card-title>
<span class="headline">Bed Mesh Calibrate</span>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col cols="12">
<p>Do you really want to start the bed calibration?</p>
</v-col>
</v-row>
</v-container>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="waring darken-1" text @click="calibrateDialog = false">abort</v-btn>
<v-btn color="blue darken-1" text @click="calibrateMesh">calibrate</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog v-model="removeDialog" persistent max-width="600px">
<v-card>
<v-card-title>
<span class="headline">Bed Mesh Profile</span>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col cols="12">
<p>Do you really want to delete the profile "{{ this.profile }}"?</p>
</v-col>
</v-row>
</v-container>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="waring darken-1" text @click="removeDialog = false">abort</v-btn>
<v-btn color="blue darken-1" text @click="removeProfile">remove</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</div>
</template>
<script>
import {mapGetters, mapState} from 'vuex';
import { Plotly } from 'vue-plotly'
export default {
components: {
Plotly
},
data () {
return {
data:[
{
x: [],
y: [],
z: [],
type:"surface",
intensity: [0, .05, .1],
cmin: -0.1,
cmax: 0.1,
showscale: true,
autocolorscale: true,
colorbar: {
tickfont: {
color: '#fff'
},
}
}
],
layout:{
showScale: true,
plot_bgcolor: 'transparent',
paper_bgcolor: 'transparent',
margin: {
l: 0,
r: 100,
b: 0,
t: 0
},
scene: {
camera: {
eye: {
x: -1.25,
y: -1.25,
z: 0.5
}
},
xaxis: {
color: '#fff',
range: [0,200]
},
yaxis: {
color: '#fff',
range: [0,200]
},
zaxis: {
color: '#fff',
range: [-1,1]
}
}
},
profiles: [],
profile: {},
boolShowBedMesh: false,
loadingLoad: false,
disabledLoad: true,
loadingSave: false,
disabledSave: true,
loadingRemove: false,
disabledRemove: true,
loadingClear: false,
disabledClear: true,
loadingCalibrate: false,
showMeshType: 'probed',
saveDialog: false,
removeDialog: false,
calibrateDialog: false,
newName: '',
}
},
computed: {
...mapState({
config: state => state.config,
bed_mesh: state => state.printer.bed_mesh,
loadings: state => state.loadings,
}),
...mapGetters([
'is_printing',
]),
},
methods: {
showBedMesh: function() {
this.data[0].x = [];
this.data[0].y = [];
this.data[0].z = [];
if (this.bed_mesh && this.bed_mesh.profile_name !== "") {
if (this.config.stepper_x !== undefined && this.config.stepper_y !== undefined) {
this.layout.scene.xaxis.range = [this.config.stepper_x.position_min, this.config.stepper_x.position_max];
this.layout.scene.yaxis.range= [this.config.stepper_y.position_min, this.config.stepper_y.position_max];
} else {
this.layout.scene.xaxis.range = [this.bed_mesh.mesh_min[0], this.bed_mesh.mesh_max[0]];
this.layout.scene.yaxis.range = [this.bed_mesh.mesh_min[1], this.bed_mesh.mesh_max[1]];
}
let x_count = 0;
let y_count = 0;
if (this.showMeshType === 'probed') {
x_count = this.bed_mesh.probed_matrix[0].length;
y_count = this.bed_mesh.probed_matrix.length;
this.data[0].z = this.bed_mesh.probed_matrix;
} else if (this.showMeshType === 'mesh') {
x_count = this.bed_mesh.mesh_matrix[0].length;
y_count = this.bed_mesh.mesh_matrix.length;
this.data[0].z = this.bed_mesh.mesh_matrix;
}
let x_step = (this.bed_mesh.mesh_max[0] - this.bed_mesh.mesh_min[0]) / (x_count - 1);
for(let i = 0; i < x_count; i++) {
this.data[0].x.push(parseFloat(this.bed_mesh.mesh_min[0]) + parseFloat(x_step) * i);
}
let y_step = (this.bed_mesh.mesh_max[1] - this.bed_mesh.mesh_min[1]) / (y_count - 1);
for(let i = 0; i < y_count; i++) {
this.data[0].y.push(parseFloat(this.bed_mesh.mesh_min[1]) + parseFloat(y_step) * i);
}
this.boolShowBedMesh = true;
} else this.boolShowBedMesh = false;
//this.$refs.heightmap.update();
},
switchToProbed: function() {
this.showMeshType = 'probed';
this.showBedMesh();
},
switchToMesh: function() {
this.showMeshType = 'mesh';
this.showBedMesh();
},
loadProfile: function() {
this.$store.commit('setLoading', { name: 'bedMeshLoad' });
this.$socket.sendObj('post_printer_gcode_script', { script: "BED_MESH_PROFILE LOAD="+this.profile }, "responseBedMeshLoad");
},
saveProfile: function() {
this.saveDialog = false;
this.$store.commit('setLoading', { name: 'bedMeshSave' });
this.$socket.sendObj('post_printer_gcode_script', { script: "BED_MESH_PROFILE SAVE="+this.newName.toUpperCase() }, "responseBedMeshSave");
},
removeProfile: function() {
this.removeDialog = false;
this.$store.commit('setLoading', { name: 'bedMeshRemove' });
this.$socket.sendObj('post_printer_gcode_script', { script: "BED_MESH_PROFILE REMOVE="+this.profile }, "responseBedMeshRemove");
},
clearBedMesh: function() {
this.$store.commit('setLoading', { name: 'bedMeshClear' });
this.$socket.sendObj('post_printer_gcode_script', { script: "BED_MESH_CLEAR" }, "responseBedMeshClear");
},
calibrateMesh: function() {
this.calibrateDialog = false;
this.$store.commit('setLoading', { name: 'bedMeshCalibrate' });
this.$socket.sendObj('post_printer_gcode_script', { script: "BED_MESH_CALIBRATE" }, "responseBedMeshCalibrate");
}
},
created: function() {
this.profiles = this.$store.getters.getBedMeshProfiles;
},
watch: {
config: function() {
this.profiles = this.$store.getters.getBedMeshProfiles;
},
profile: function() {
if (this.profile !== "" && this.bed_mesh !== undefined && this.profile === this.bed_mesh.profile_name) {
this.disabledLoad = true;
this.disabledRemove = false;
} else if (this.profile !== "") {
this.disabledLoad = false;
this.disabledRemove = false;
} else {
this.disabledLoad = true;
this.disabledRemove = true;
}
},
bed_mesh: {
deep: false,
handler(newVal) {
if (newVal !== undefined) {
this.profiles = this.$store.getters.getBedMeshProfiles;
this.showBedMesh();
if (this.profile !== "" && this.profile === this.bed_mesh.profile_name) this.disabledLoad = true;
else if (this.profile !== "") this.disabledLoad = false;
else this.disabledLoad = true;
if (
this.bed_mesh.probed_matrix.length &&
this.bed_mesh.probed_matrix[0].length) {
this.disabledClear = false;
this.disabledSave = false;
} else {
this.disabledClear = true;
this.disabledSave = true;
}
}
}
},
loadings: function(loadings) {
this.loadingLoad = loadings.includes('bedMeshLoad');
this.loadingClear = loadings.includes('bedMeshClear');
this.loadingSave = loadings.includes('bedMeshSave');
this.loadingRemove = loadings.includes('bedMeshRemove');
this.loadingCalibrate = loadings.includes('bedMeshCalibrate');
}
}
}
</script>
+3 -2
View File
@@ -2,10 +2,11 @@
<div>
<v-row>
<v-col class="col-12 col-md-6 col-lg-4">
<settings-dashboard-panel></settings-dashboard-panel>
<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-webcam-panel></settings-webcam-panel>
<settings-dashboard-panel></settings-dashboard-panel>
</v-col>
<v-col class="col-12 col-md-6 col-lg-4">
<settings-macros-panel></settings-macros-panel>
+18 -3
View File
@@ -1,10 +1,10 @@
<template>
<div>
<v-row>
<v-col class="col-sm-12 col-md-6">
<v-col class="col-sm-12 col-md-6" v-if="is_ready">
<settings-limits-panel></settings-limits-panel>
</v-col>
<v-col class="col-sm-12 col-md-3">
<v-col class="col-sm-12 col-md-3" v-if="is_ready">
<settings-endstop-panel></settings-endstop-panel>
<settings-runout-panel></settings-runout-panel>
</v-col>
@@ -15,7 +15,22 @@
</div>
</template>
<script>
export default {
import {mapState} from "vuex";
export default {
data: () => ({
}),
computed: {
...mapState({
is_ready: state => state.socket.is_ready,
}),
},
created() {
},
watch: {
}
}
</script>
+13
View File
@@ -0,0 +1,13 @@
export function findDirectory (folder, dirArray) {
if (dirArray.length) {
if (folder.childrens) folder = folder.childrens;
let parent = folder.find(element => (element.isDirectory && element.filename === dirArray[0]));
if (parent) {
dirArray.shift();
if (dirArray.length) {
return findDirectory(parent, dirArray);
} else return parent.childrens;
} else return folder;
}
}
+24 -6
View File
@@ -13,6 +13,10 @@ export default class WebSocketClient {
this.onMessage = null;
this.onClose = null;
this.onError = null;
this.blackErrorList = [
"Metadata not available for",
"Klippy Request Timed Out",
];
}
createMessage (method, params, id) {
@@ -30,7 +34,7 @@ export default class WebSocketClient {
if (event && event.data) {
msg = JSON.parse(event.data)
}
this.store[method](target, msg)
this.store[method](target, msg);
}
connect () {
@@ -59,10 +63,23 @@ export default class WebSocketClient {
if (this.store) {
if (this.wsData.filter(item => item.id === data.id).length > 0 &&
this.wsData.filter(item => item.id === data.id)[0].action !== "") {
this.store.dispatch(
this.wsData.filter(item => item.id === data.id)[0].action,
data.result
)
if (data.error && data.error.message) {
if (!this.blackErrorList.find(element => data.error.message.startsWith(element))) {
window.console.error("Response Error: "+this.wsData.filter(item => item.id === data.id)[0].action+" > "+data.error.message);
this.store.dispatch(
this.wsData.filter(item => item.id === data.id)[0].action,
Object.assign({requestParams: this.wsData.filter(item => item.id === data.id)[0].params }, {error: data.error})
);
}
} else {
let result = data.result;
if (result === "ok") result = { result: result };
this.store.dispatch(
this.wsData.filter(item => item.id === data.id)[0].action,
Object.assign({requestParams: this.wsData.filter(item => item.id === data.id)[0].params }, result)
)
}
} else this.passToStore('socket_on_message', data)
}
};
@@ -72,7 +89,8 @@ export default class WebSocketClient {
let id = Math.floor(Math.random() * 10000) + 1
this.wsData.push({
id: id,
action: action
action: action,
params: params
})
this.instance.send(this.createMessage(method, params, id))
}
+17 -2
View File
@@ -2,6 +2,7 @@ import Dashboard from '../pages/Dashboard.vue'
//import Status from '../pages/Status.vue'
import Webcam from '../pages/Webcam.vue'
import Console from '../pages/Console.vue'
import Heightmap from '../pages/Heightmap.vue'
import Files from '../pages/Files.vue'
import Settings from '../pages/Settings.vue'
import SettingsInterface from '../pages/settings/interface.vue'
@@ -13,18 +14,28 @@ const routes = [
path: '/',
icon: 'view-dashboard',
component: Dashboard,
alwaysShow: true,
},
{
title: "Webcam",
path: '/webcam',
icon: 'webcam',
component: Webcam,
alwaysShow: false,
},
{
title: "Console",
path: '/console',
icon: 'console-line',
component: Console,
alwaysShow: true,
},
{
title: "Heightmap",
path: '/heightmap',
icon: 'grid',
component: Heightmap,
alwaysShow: false,
},
/*{
title: "Current Job",
@@ -37,6 +48,7 @@ const routes = [
path: '/files',
icon: 'printer-3d-nozzle',
component: Files,
alwaysShow: false,
},
{
title: "Settings",
@@ -44,16 +56,19 @@ const routes = [
redirect: '/settings/machine',
icon: 'wrench',
component: Settings,
alwaysShow: true,
children: [
{
title: 'Machine',
path: '/settings/machine',
component: SettingsMachine
component: SettingsMachine,
alwaysShow: true,
},
{
title: 'Interface',
path: '/settings/interface',
component: SettingsInterface
component: SettingsInterface,
alwaysShow: true,
},
]
},
+194 -56
View File
@@ -7,42 +7,16 @@ import axios from "axios";
export default {
socket_on_open ({ commit }) {
commit('setConnected');
Vue.prototype.$socket.sendObj('get_printer_status', { }, 'getHelpData');
fetch('http://'+store.state.socket.hostname+':'+store.state.socket.port+'/printer/files/gui.json')
.then(res => res.json()).then(file => {
store.commit('setSettings', file);
}).catch(function() {
window.console.warn('No kwc config file found.');
});
Vue.prototype.$socket.sendObj('get_printer_objects_status', { }, 'getHelpData');
Vue.prototype.$socket.sendObj('get_directory', { path: 'gcodes' }, 'getDirectoryRoot');
Vue.prototype.$socket.sendObj('get_printer_info', {}, 'getKlipperInfo');
Vue.prototype.$socket.sendObj('get_printer_objects', {}, 'getObjectInfo');
Vue.prototype.$socket.sendObj('get_printer_status', { heater: [] }, 'getObjectInfo');
Vue.prototype.$socket.sendObj('get_printer_status', { configfile: ['config'] }, 'getPrinterConfig');
Vue.prototype.$socket.sendObj('post_printer_subscriptions', {
gcode: [],
toolhead: [],
virtual_sdcard: [],
heater: [],
heater_bed: [],
extruder: ["temperature", "target"],
fan: [],
pause_resume: [],
idle_timeout: [],
});
Vue.prototype.$socket.sendObj('get_printer_files', {}, 'getFileList');
Vue.prototype.$socket.sendObj('get_printer_gcode_help', {}, 'getHelpList');
},
socket_on_close ({ commit }, event) {
commit('setDisconnected');
if (event.wasClean) {
window.console.log('Socket closed clear')
} else {
window.console.error('Connection failure')
}
commit('setDisconnect');
if (event.wasClean) window.console.log('Socket closed clear')
else window.console.error('Connection failure')
window.console.error('Code: ' + event.code)
},
@@ -57,31 +31,30 @@ export default {
commit('addGcodeResponse', data.params[0]);
break;
case 'notify_printer_state_changed':
commit('setPrinterStatus', data.params[0]);
case 'notify_klippy_state_changed':
commit('setKlippyStatus', data.params[0]);
break;
/*case 'notify_klippy_state_changed':
commit('setPrinterStatus', data.params[0]);
break;*/
case 'notify_filelist_changed':
commit('setFileList', data.params[0].filelist);
break;
case 'notify_paused_state_changed':
commit('setPausedState', data.params[0]);
break;
default:
if (data.result !== "ok") {
window.console.log("Default return");
if (data.error) window.console.error("JSON-RPC: " + data.error.message);
else window.console.log(data);
if (data.error && data.error.message !== "Klippy Request Timed Out") window.console.error("JSON-RPC: " + data.error.message);
}
}
},
getDirectoryRoot({ commit }, data) {
if (data.files && data.files.filter((file) => file.filename === "gui.json")) {
fetch('http://'+store.state.socket.hostname+':'+store.state.socket.port+'/server/files/gcodes/gui.json')
.then(res => res.json()).then(file => {
commit('setSettings', file);
});
}
},
saveGuiSettings({ commit, state }) {
commit('setLoadingSaveGuiConfige', true);
let file = new File([JSON.stringify({ webcam: state.webcam, gui: state.gui })], 'gui.json');
@@ -89,7 +62,7 @@ export default {
let formData = new FormData();
formData.append('file', file);
axios.post('http://' + state.socket.hostname + ':' + state.socket.port + '/printer/files/upload',
axios.post('http://' + state.socket.hostname + ':' + state.socket.port + '/server/files/upload',
formData, {
headers: { 'Content-Type': 'multipart/form-data' }
}
@@ -100,15 +73,84 @@ export default {
});
},
getKlipperInfo({ commit }, data) {
commit('setPrinterData', {
hostname: data.hostname,
version: data.version
});
getKlipperInfo({ commit, state }, data) {
if (data !== undefined && data.is_ready && !state.socket.is_ready) {
commit('resetPrinter');
commit('setPrinterData', {
hostname: data.hostname,
version: data.version
});
commit('setKlippyStatus', 'ready');
Vue.prototype.$socket.sendObj('get_printer_objects_list', {}, 'getObjectInfo');
Vue.prototype.$socket.sendObj('get_printer_objects_status', { heaters: [] }, 'getHeatersInfo');
Vue.prototype.$socket.sendObj('get_printer_objects_status', { configfile: ['config'] }, 'getPrinterConfig');
Vue.prototype.$socket.sendObj('post_printer_objects_subscription', {
gcode: [],
toolhead: [],
virtual_sdcard: [],
heaters: [],
fan: [],
pause_resume: [],
idle_timeout: [],
display_status: [],
});
Vue.prototype.$socket.sendObj('get_file_list', {}, 'getFileList');
Vue.prototype.$socket.sendObj('get_directory', { path: 'gcodes' }, 'getDirectory');
Vue.prototype.$socket.sendObj('get_printer_gcode_help', {}, 'getHelpList');
} else if (data !== undefined && !data.is_ready) commit('setKlippyStatus', 'disconnect');
commit('setPrinterStatusDetails', data);
setTimeout(function() {
if (state.socket.is_ready) Vue.prototype.$socket.sendObj('get_printer_info', {}, 'getKlipperInfo');
}, 5000);
},
getObjectInfo({ commit }, data) {
commit('setObjectData', data);
let subscripts = {}
for (let key of Object.keys(data)) {
let nameSplit = key.split(" ");
if (
nameSplit[0] === "temperature_fan" ||
nameSplit[0] === "temperature_probe" ||
nameSplit[0] === "temperature_sensor" ||
nameSplit[0] === "filament_switch_sensor" ||
nameSplit[0] === "bed_mesh"
) subscripts = {...subscripts, [key]: []}
}
if (subscripts !== {}) Vue.prototype.$socket.sendObj('post_printer_objects_subscription', subscripts);
if (subscripts.bed_mesh) Vue.prototype.$socket.sendObj('get_printer_objects_status', { bed_mesh: [] }, 'getPrinterData');
},
getPrinterData({ commit }, data) {
commit('setPrinterData', data);
},
getHeatersInfo({ commit }, data) {
commit('setObjectData', data);
if (data.heaters && data.heaters.available_heaters && data.heaters.available_heaters.length) {
let subscripts = {};
data.heaters.available_heaters.forEach(function(heater) {
subscripts = {...subscripts, [heater]: []}
});
Vue.prototype.$socket.sendObj('post_printer_objects_subscription', subscripts );
Vue.prototype.$socket.sendObj("get_server_temperature_store", {}, "getHeatersHistory");
}
},
getHeatersHistory({ commit }, data) {
commit('setHeaterHistory', data);
},
getPrinterConfig({commit}, data) {
@@ -117,15 +159,76 @@ export default {
getFileList({ commit }, data) {
commit('setFileList', data);
commit('setLoadingGcodeRefresh', false);
commit('removeLoading', 'loadingGcodeRefresh');
},
getDirectory({ commit }, data) {
commit('setDirectory', data);
commit('removeLoading', { name: 'loadingGcodeRefresh' });
},
getMetadata({ commit }, data) {
commit('setMetadata', data);
},
getMetadataCurrentFile({ commit }, data) {
commit('setMetadataCurrentFile', data);
},
getPostDirectory({ commit }, data) {
if (data.error) {
Vue.$toast.error(data.error.message);
} else if (data.result === "ok") {
let currentPath = data.requestParams.path.substr(0, data.requestParams.path.lastIndexOf("/"));
let newPath = data.requestParams.path.substr(data.requestParams.path.lastIndexOf("/")+1);
Vue.$toast.success("Successfully created "+newPath);
Vue.prototype.$socket.sendObj('get_directory', { path: currentPath }, 'getDirectory');
commit('voidMutation');
}
},
getDeleteDirectory({ commit }, data) {
if (data.error) {
Vue.$toast.error(data.error.message);
} else if (data.result === "ok") {
let currentPath = data.requestParams.path.substr(0, data.requestParams.path.lastIndexOf("/"));
let delPath = data.requestParams.path.substr(data.requestParams.path.lastIndexOf("/")+1);
Vue.$toast.success("Successfully deleted "+delPath);
//Vue.prototype.$socket.sendObj('get_directory', { path: currentPath }, 'getDirectory');
commit('removeDirFromFiletree', {
currentPath: currentPath,
delPathName: delPath
});
}
},
getPostFileMove({ commit }, data) {
if (data.error) {
Vue.$toast.error(data.error.message);
} else if (data.result === "ok") {
let filename = data.requestParams.dest.substr(data.requestParams.dest.lastIndexOf("/")).replace("/", "");
let sourceDir = data.requestParams.dest.substr(0, data.requestParams.dest.lastIndexOf("/"));
let destDir = data.requestParams.dest.substr(0, data.requestParams.dest.lastIndexOf("/"));
if (sourceDir === destDir) Vue.$toast.success("Successfully renamed "+filename);
else Vue.$toast.success("Successfully moved "+filename);
commit('renameMetadataFilename', {
source: data.requestParams.source,
dest: data.requestParams.dest
});
}
},
getHelpList({ commit }, data) {
commit('setHelpList', data);
},
setLoadingSendGcode({commit}, value) {
commit('setLoadingSendGcode', value);
setHeaterChartVisibility({ commit, dispatch }, data) {
commit('setHeaterChartVisibility', data);
dispatch('saveGuiSettings');
},
setLoadingEmergencyStop({commit}) {
@@ -145,8 +248,7 @@ export default {
},
sendGcode({commit}, data) {
commit('setLoadingSendGcode', false);
commit('sendGcode', data);
commit('removeLoading', { name: 'loadingSendGcode' });
commit('addGcodeResponse', data);
},
@@ -183,6 +285,42 @@ export default {
commit('setEndstopStatus', data);
},
respondeExtruderRetract({commit}) {
commit('removeLoading', { name: 'extruderRetract' });
},
respondeExtruderDetract({commit}) {
commit('removeLoading', { name: 'extruderDetract' });
},
respondeBabySteppingDown({commit}) {
commit('removeLoading', { name: 'babySteppingDown' });
},
respondeBabySteppingUp({commit}) {
commit('removeLoading', { name: 'babySteppingUp' });
},
responseBedMeshLoad({commit}) {
commit('removeLoading', { name: 'bedMeshLoad' });
},
responseBedMeshClear({commit}) {
commit('removeLoading', { name: 'bedMeshClear' });
},
responseBedMeshCalibrate({commit}) {
commit('removeLoading', { name: 'bedMeshCalibrate' });
},
responseBedMeshSave({commit}) {
commit('removeLoading', { name: 'bedMeshSave' });
},
responseBedMeshRemove({commit}) {
commit('removeLoading', { name: 'bedMeshRemove' });
},
switchToDashboard() {
router.push("/");
},
+108 -21
View File
@@ -1,3 +1,5 @@
export default {
toolhead(state) {
return (state.socket.isConnected) ? state.printer.toolhead : null;
@@ -6,13 +8,15 @@ export default {
heaters: state => {
let heaters = [];
if (state.object.heater.available_heaters) {
if (state.object.heaters.available_heaters) {
for (let [key, value] of Object.entries(state.printer)) {
if (state.object.heater.available_heaters.includes(key)) {
if (state.object.heaters.available_heaters.includes(key)) {
heaters.push({
name: key,
target: value.target,
temperature: value.temperature,
min_temp: state.config[key] !== undefined ? parseFloat(state.config[key].min_temp) : undefined,
max_temp: state.config[key] !== undefined ? parseFloat(state.config[key].max_temp) : undefined,
});
}
}
@@ -60,34 +64,67 @@ export default {
});
},
current_file_size: state => {
let file = state.files.filter((file) => file.filename === state.printer.virtual_sdcard.current_file);
temperature_sensors: state => {
let sensors = [];
if (file.length) return file[0]['size'];
for (let [key, value] of Object.entries(state.printer)) {
let nameSplit = key.split(" ");
if (nameSplit[0] === "temperature_sensor") {
sensors.push({
name: nameSplit[1],
temperature: value.temperature,
measured_min_temp: value.measured_min_temp,
measured_max_temp: value.measured_max_temp,
});
}
if (nameSplit[0] === "temperature_probe") {
sensors.push({
name: "Probe",
temperature: value.temperature,
//TODO: update measured_temps
measured_min_temp: 0,
measured_max_temp: 0,
});
}
}
return sensors.sort((a, b) => {
let nameA = a.name.toUpperCase();
let nameB = b.name.toUpperCase();
if (nameA < nameB) return -1;
if (nameA > nameB) return 1;
return 0;
});
},
current_file_size: state => {
if (state.printer.virtual_sdcard.filename === state.printer.current_file.filename) {
return state.printer.current_file.size;
}
return 0;
},
current_file_metadata: state => {
let file = state.files.filter((file) => file.filename === state.printer.virtual_sdcard.current_file);
if (file.length) return file[0];
return []
return state.printer.current_file;
},
current_file_estimated_time: state => {
let file = state.files.filter((file) => file.filename === state.printer.virtual_sdcard.current_file);
if (file.length) return file[0]['estimated_time'];
if (state.printer.virtual_sdcard.filename === state.printer.current_file.filename) {
return state.printer.current_file.estimated_time;
}
return 0;
},
current_file_filament_total: state => {
let file = state.files.filter((file) => file.filename === state.printer.virtual_sdcard.current_file);
if (file.length) return file[0]['filament_total'];
if (state.printer.virtual_sdcard.filename === state.printer.current_file.filename) {
return state.printer.current_file.filament_total;
}
return 0;
},
@@ -97,7 +134,7 @@ export default {
},
is_printing: state => {
return (state.printer.virtual_sdcard.current_file !== "");
return (state.printer.virtual_sdcard.filename !== "");
},
getMacros: state => {
@@ -180,16 +217,66 @@ export default {
});
},
getBedMeshProfiles: state => {
let profiles = [];
let currentProfile = "";
if (state.printer.bed_mesh) {
currentProfile = state.printer.bed_mesh.profile_name;
}
for (let [key, value] of Object.entries(state.config)) {
let nameSplit = key.split(" ");
if (nameSplit.length > 1 && nameSplit[0] === "bed_mesh" && nameSplit[1] !== undefined) {
profiles.push({
name: nameSplit[1],
data: value,
is_active: (currentProfile === nameSplit[1] ? true: false),
});
}
}
return profiles.sort((a, b) => {
let nameA = a.name.toUpperCase();
let nameB = b.name.toUpperCase();
if (nameA < nameB) return -1;
if (nameA > nameB) return 1;
return 0;
});
},
getTitle: state => {
if (state.socket.isConnected) {
if (state.printer.pause_resume.is_paused) return "Pause Print";
else if (state.printer.virtual_sdcard.is_active) return (state.printer.virtual_sdcard.progress * 100).toFixed(0)+"% Printing - "+state.printer.virtual_sdcard.current_file;
if (state.printer.pause_resume && state.printer.pause_resume.is_paused) return "Pause Print";
else if (state.printer.virtual_sdcard && state.printer.virtual_sdcard.is_active) return (state.printer.virtual_sdcard.progress * 100).toFixed(0)+"% Printing - "+state.printer.virtual_sdcard.filename;
return state.printer.hostname;
} else return "KlipperWebControl";
return state.gui.general.printername ? state.gui.general.printername : state.printer.hostname;
} else return "Mainsail";
},
showDashboardWebcam: state => {
return (state.webcam.url !== "" && state.gui.dashboard.boolWebcam);
},
getCurrentExtruder: state => {
let extruder = {
name: "",
status: null,
config: null,
};
let extruderName = state.printer.toolhead.extruder;
extruder.name = extruderName;
if (state.config[extruderName]) {
extruder.config = state.config[extruderName];
}
if (state.printer[extruderName]) {
extruder.status = state.printer[extruderName];
}
return extruder;
}
}
+31 -3
View File
@@ -27,16 +27,25 @@ export default new Vuex.Store({
loadingShutdownHost: false,
loadingSaveGuiConfig: false,
loadingEndstopStatus: false,
printer_state: "",
klippy_state: "disconnect",
klippy_message: "",
is_ready: false,
error_detected: false,
},
webcam: {
url: ""
},
gui: {
general: {
printername: "",
},
dashboard: {
boolWebcam: true,
boolTempchart: true,
boolConsole: false,
hiddenMacros: [],
hiddenTempChart: [],
},
webcam: {
bool: false,
@@ -55,6 +64,7 @@ export default new Vuex.Store({
toolhead: {
position: [],
homed_axes: [],
extruder: "",
status: "",
print_time: 0,
printing_time: 0,
@@ -71,18 +81,28 @@ export default new Vuex.Store({
printing_time: 0,
state: "",
},
display_status: {
message: null,
progress: 0,
},
virtual_sdcard: {
progress: 0,
current_file: "",
filename: "",
is_active: false,
filament_used: 0,
file_position: 0,
print_duration: 0,
total_duration: 0,
},
current_file: {
},
gcode: {
extrude_factor: 1,
speed_factor: 1,
base_zpos: 0,
absolute_coordinates: true,
absolute_extrude: true,
},
fan: {
speed: 0,
@@ -90,16 +110,24 @@ export default new Vuex.Store({
endstops: {},
},
object: {
heater: {
heaters: {
available_heaters: []
}
},
temperaturChart: {
labels: [],
datasets: [],
updateTicks: []
},
helplist: [],
files: [],
filetree: [
{
isDirectory: true,
filename: 'gcodes',
modified: new Date(),
childrens: []
}
],
events: []
},
+321 -110
View File
@@ -1,94 +1,206 @@
import Vue from "vue";
const objectAssignDeep = require(`object-assign-deep`);
import { colorArray, colorChamber, colorHeaterBed, temperaturChartSampleInterval, temperaturChartSampleLength } from './variables';
import { findDirectory } from '../plugins/helpers';
import { colorArray, colorChamber, colorHeaterBed, temperaturChartSampleLength } from './variables';
export default {
setConnected (state) {
state.socket.isConnected = true;
//TODO reset store
},
setDisconnected (state) {
state.socket.isConnected = false;
//Vue.prototype.$socket.reconnect();
},
resetPrinter(state) {
//TODO check reset in storage
Vue.set(state, '', {
state: {
loadings: [],
config: {},
object: {
heaters: {
available_heaters: []
}
},
temperaturChart: {
labels: [],
datasets: [],
},
helplist: [],
filetree: [],
}
}
);
},
setPrinterData(state, data) {
Object.assign(state.printer, data);
if (data.requestParams) delete data.requestParams;
let now = Date.now();
let updateTicks = false;
if (Array.isArray(state.object.heater.available_heaters) && state.object.heater.available_heaters.length) {
let boolAddValues = false;
let now = new Date();
Object.entries(data).forEach(([key, value]) => {
Vue.set(state.printer, key, value);
if (state.temperaturChart.labels.length === 0 || now - state.temperaturChart.labels[state.temperaturChart.labels.length - 1] > temperaturChartSampleInterval) {
for (let [key, value] of Object.entries(data)) {
let keySplit = key.split(" ");
if (Array.isArray(state.object.heaters.available_heaters) && state.object.heaters.available_heaters.length) {
let keySplit = key.split(" ");
if (state.object.heater.available_heaters.includes(key) || keySplit[0] === "temperature_fan") {
if (keySplit[0] === "temperature_fan") key = keySplit[1];
if (
state.object.heaters.available_heaters.includes(key) ||
keySplit[0] === "temperature_fan" ||
keySplit[0] === "temperature_sensor" ||
keySplit[0] === "temperature_probe") {
if (keySplit[0] === "temperature_fan") key = keySplit[1];
else if (keySplit[0] === "temperature_sensor") key = keySplit[1];
else if (keySplit[0] === "temperature_probe") key = "probe";
let index = state.temperaturChart.datasets.findIndex(element => element.label === key);
let index_target = state.temperaturChart.datasets.findIndex(element => element.label === key+'_target');
if (index >= 0) {
state.temperaturChart.datasets[index].data.push(value.temperature.toFixed(1));
state.temperaturChart.datasets[index_target].data.push(value.target.toFixed(1));
} else {
let color = '#f87979';
switch (key) {
case 'heater_bed': color = colorHeaterBed; break;
case 'chamber': color = colorChamber; break;
default: color = colorArray[state.temperaturChart.datasets.length]; break;
}
state.temperaturChart.datasets.push({
label: key,
data: [value.temperature.toFixed(1)],
borderColor: color,
backgroundColor: color,
fill: false,
borderDash: undefined,
borderWidth: 2,
pointRadius: 0,
pointHitRadius: 5,
showLine: true
});
state.temperaturChart.datasets.push({
label: key+"_target",
data: [value.target.toFixed(1)],
borderColor: color,
backgroundColor: color+'20',
fill: true,
borderDash: undefined,
borderWidth: 0,
pointRadius: 0,
pointHitRadius: 0,
showLine: true
});
// increment update ticks array only 1 time per setPrinterData with heaters/sensors
if (!updateTicks) {
for (let index in state.temperaturChart.updateTicks) {
state.temperaturChart.updateTicks[index] += 1;
}
boolAddValues = true;
updateTicks = true;
}
// add object to update ticks array if it doesn't exists
if (state.temperaturChart.updateTicks[key] === undefined) {
state.temperaturChart.updateTicks[key] = 1;
}
this.commit('addTemperatureChartValue', { name: key, value: value, time: now });
}
}
});
},
setHeaterHistory(state, data) {
let now = new Date();
if (data !== undefined) {
Object.entries(data).sort().forEach(([key, datasets]) => {
let keySplit = key.split(" ");
if (keySplit.length > 1) key = keySplit[1];
if (keySplit[0] === "temperature_probe") key = "probe";
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('addTemperatureChartValue', {
name: key,
value: {
temperature: datasets.temperatures[i],
target: datasets.targets[i],
},
type: keySplit[0],
time: time
});
}
}
});
}
},
if (boolAddValues) {
state.temperaturChart.labels.push(now);
if (state.temperaturChart.labels.length > temperaturChartSampleLength) {
state.temperaturChart.labels.splice(0, state.temperaturChart.labels.length-temperaturChartSampleLength)
}
}
for (let [key, dataset] of Object.entries(state.temperaturChart.datasets)) {
if (dataset.data.length > temperaturChartSampleLength) {
state.temperaturChart.datasets[key].data.splice(0, dataset.data.length-temperaturChartSampleLength)
}
}
addTemperatureChartValue(state, payload) {
if (state.temperaturChart.labels.map(Number).indexOf(+payload.time) < 0) {
state.temperaturChart.labels.push(payload.time);
if (state.temperaturChart.labels.length > temperaturChartSampleLength) {
state.temperaturChart.labels = state.temperaturChart.labels.splice(state.temperaturChart.labels.length - temperaturChartSampleLength)
}
}
let index = state.temperaturChart.datasets.findIndex(element => element.label === payload.name);
if (index < 0) {
this.commit('addTemperatureChartHeater', {
name: payload.name,
type: payload.type,
});
index = state.temperaturChart.datasets.findIndex(element => element.label === payload.name);
}
let index_target = state.temperaturChart.datasets.findIndex(element => element.label === payload.name+'_target');
let ticks = 1;
// find missing ticks in update ticks array and reset it
if (state.temperaturChart.updateTicks[payload.name] !== undefined) {
ticks = state.temperaturChart.updateTicks[payload.name];
state.temperaturChart.updateTicks[payload.name] = 0;
}
// update current temp in temperature chart
if (index >= 0) {
for (let i = 0; i < ticks; i++) state.temperaturChart.datasets[index].data.push(payload.value.temperature.toFixed(1));
}
// update target temp in temperature chart
if (index_target >= 0) {
for (let i = 0; i < ticks; i++) state.temperaturChart.datasets[index_target].data.push(payload.value.target.toFixed(1));
}
if (index >= 0 && state.temperaturChart.datasets[index].data.length > temperaturChartSampleLength) {
state.temperaturChart.datasets[index].data = state.temperaturChart.datasets[index].data.splice(state.temperaturChart.datasets[index].data.length - temperaturChartSampleLength)
}
if (index_target >= 0 && state.temperaturChart.datasets[index_target].data.length > temperaturChartSampleLength) {
state.temperaturChart.datasets[index_target].data = state.temperaturChart.datasets[index_target].data.splice(state.temperaturChart.datasets[index_target].data.length - temperaturChartSampleLength)
}
},
addTemperatureChartHeater(state, payload) {
let color = '';
switch (payload.name) {
case 'heater_bed': color = colorHeaterBed; break;
case 'chamber': color = colorChamber; break;
default: color = colorArray[state.temperaturChart.datasets.length]; break;
}
let hidden = state.gui.dashboard.hiddenTempChart.indexOf(payload.name.toUpperCase()) >= 0 ? true : null;
state.temperaturChart.datasets.push({
label: payload.name,
data: [],
borderColor: color,
backgroundColor: color,
fill: false,
borderDash: undefined,
borderWidth: 2,
pointRadius: 0,
pointHitRadius: 5,
showLine: true,
lineTension: 0,
hidden: hidden,
});
if (payload.type !== "temperature_sensor") {
state.temperaturChart.datasets.push({
label: payload.name+"_target",
data: [],
borderColor: color,
backgroundColor: color+'20',
fill: true,
borderDash: undefined,
borderWidth: 0,
pointRadius: 0,
pointHitRadius: 0,
showLine: true,
lineTension: 0,
hidden: hidden,
});
}
},
setHeaterChartVisibility(state, data) {
let index = state.gui.dashboard.hiddenTempChart.indexOf(data.name.toUpperCase());
if (data.hidden && index === -1) state.gui.dashboard.hiddenTempChart.push(data.name.toUpperCase())
else if (data.hidden !== true && index > -1) state.gui.dashboard.hiddenTempChart.splice(index, 1);
},
setSettings(state, data) {
@@ -97,26 +209,15 @@ export default {
setObjectData(state, data) {
Object.assign(state.object, data);
for (let key of Object.keys(data)) {
let nameSplit = key.split(" ");
if (nameSplit[0] === "temperature_fan") {
Vue.prototype.$socket.sendObj('post_printer_subscriptions', { [key]: [] });
}
if (nameSplit[0] === "filament_switch_sensor") {
Vue.prototype.$socket.sendObj('post_printer_subscriptions', { [key]: [] });
}
}
},
setPrinterConfig(state, data) {
Vue.set(state, 'config', data.configfile.config);
if (data.configfile) Vue.set(state, 'config', data.configfile.config);
},
setFileList(state, data) {
state.files = [];
//window.console.log(data);
let array = Object.entries(data);
for (let [key, file] of array) {
@@ -132,12 +233,132 @@ export default {
layer_height: file.layer_height,
first_layer_height: file.first_layer_height,
object_height: file.object_height,
thumbnails : file.thumbnails ? file.thumbnails : [],
});
}
}
//state.files = data;
},
setDirectory(state, data) {
let parent = undefined;
//let parentPath = "";
if (data && data.requestParams && data.requestParams.path) {
let arrayPath = data.requestParams.path.split("/");
parent = findDirectory(state.filetree, arrayPath);
//parentPath = data.requestParams.path;
}
if (parent === undefined) parent = state.filetree;
if (Array.isArray(parent) && parent.length) {
for (const [key, item] of Object.entries(parent)) {
if (
item.isDirectory &&
data.dirs !== undefined &&
data.dirs.length > 0 &&
data.dirs.findIndex(element => element.dirname === item.filename) < 0
) parent.splice(key, 1);
else if (!item.isDirectory && data.files.findIndex(element => element.filename === item.filename) < 0) parent.splice(key, 1);
}
}
if (data.dirs && data.dirs.length) {
for (let dir of data.dirs) {
if (!parent.find(element => (element.isDirectory === true && element.filename === dir.dirname))) {
parent.push({
isDirectory: true,
filename: dir.dirname,
modified: Date.parse(dir.modified),
childrens: [],
});
}
}
}
if (data.files && data.files.length) {
for (let file of data.files) {
if (file.filename === "gui.json") continue;
if (!parent.find(element => (element.isDirectory === false && element.filename === file.filename))) {
parent.push({
isDirectory: false,
filename: file.filename,
modified: Date.parse(file.modified),
size: parseInt(file.size),
metadataPulled: false,
});
}
}
}
},
setMetadata(state, data) {
if (data !== undefined && data.filename !== "") {
let filename = "gcodes/"+data.filename;
let dirArray = filename.split("/");
filename = dirArray[dirArray.length-1];
let path = findDirectory(state.filetree, dirArray);
let index = path.findIndex(element => element.filename === filename);
if (index >= 0 && path[index]) {
let newData = {
estimated_time: data.estimated_time ? data.estimated_time : undefined,
filament_total: data.filament_total ? data.filament_total : undefined,
first_layer_height: data.first_layer_height ? data.first_layer_height : undefined,
layer_height: data.layer_height ? data.layer_height : undefined,
object_height: data.object_height ? data.object_height : undefined,
slicer: data.slicer ? data.slicer : undefined,
thumbnails: data.thumbnails ? data.thumbnails : undefined,
metadataPulled: true,
};
let newObject = Object.assign(path[index], newData);
Vue.set(path, index, newObject);
}
}
},
setMetadataCurrentFile(state, data) {
if (data !== undefined && data.filename !== "") {
Vue.set(state.printer, 'current_file', data);
}
},
renameMetadataFilename(state, data) {
let sourceDirArray = data.source.split("/");
let sourceFilename = sourceDirArray[sourceDirArray.length-1];
sourceDirArray.splice(-1,1);
let sourcePath = findDirectory(state.filetree, sourceDirArray);
let destDirArray = data.dest.split("/");
let destFilename = destDirArray[destDirArray.length-1];
let index = sourcePath.findIndex(element => element.filename === sourceFilename);
if (destFilename === sourceFilename) {
destDirArray.splice(-1,1);
if (destDirArray[destDirArray.length-1] === "..") destDirArray.splice(-2,2);
let destPath = findDirectory(state.filetree, destDirArray);
destPath.push(sourcePath[index]);
sourcePath.splice(index, 1);
} else if (index >= 0 && sourcePath[index]) {
let newObject = Object.assign(sourcePath[index], { filename: destFilename });
Vue.set(sourcePath, index, newObject);
}
},
removeDirFromFiletree(state, data) {
let currentPathArray = data.currentPath.split("/");
let currentPath = findDirectory(state.filetree, currentPathArray);
let index = currentPath.findIndex(element => element.filename === data.delPathName);
if (index >= 0 && currentPath[index]) currentPath.splice(index, 1);
},
setHelpList(state, data) {
state.helplist = [];
@@ -151,28 +372,27 @@ export default {
},
addGcodeResponse(state, data) {
let message = data;
if (message.result !== undefined) message = message.result;
else if (message.error !== undefined) message = message.error.message;
state.events.push({
date: new Date(),
message: data
message: message
});
if (data.substring(0,2) === "!!") {
Vue.$toast.error(data);
if (message !== undefined && message.substring(0,2) === "!!") {
Vue.$toast.error(message);
}
},
setEndstopStatus(state, data) {
delete data.requestParams;
Vue.set(state.printer, 'endstops', data);
},
setLoadingSendGcode(state, value) {
state.socket.loadingSendGcode = value;
},
sendGcode(state) {
state.socket.loadingSendGcode = false;
},
setLoading(state, data) {
if (!state.loadings.includes(data.name)) {
state.loadings.push(data.name);
@@ -183,8 +403,18 @@ export default {
state.loadings = state.loadings.filter(function(ele){ return ele !== data.name; });
},
setPrinterStatus(state, value) {
state.printer.toolhead.status = value;
setKlippyStatus(state, value) {
state.socket.klippy_state = value;
if (value === "disconnect") {
state.socket.is_ready = false;
state.socket.klippy_message = "";
} else if (value === "ready") Vue.prototype.$socket.sendObj('get_printer_info', {}, 'getKlipperInfo');
},
setPrinterStatusDetails(state, data) {
state.socket.error_detected = data.error_detected;
state.socket.is_ready = data.is_ready;
state.socket.klippy_message = data.message;
},
setLoadingGcodeUpload(state, value) {
@@ -244,25 +474,6 @@ export default {
window.console.log(data);
},
setPausedState(state, data) {
switch (data) {
case 'paused':
state.printer.pause_resume.is_paused = true;
break;
case 'resumed':
state.printer.pause_resume.is_paused = false;
break;
case 'cleared':
state.printer.pause_resume.is_paused = false;
break;
default:
window.console.log('setPausedState -> Default: '+data);
}
},
voidMutation() {
},
-1
View File
@@ -14,5 +14,4 @@ export const colorArray = [
export const colorHeaterBed = '#2196F3';
export const colorChamber = '#4CAF50';
export const temperaturChartSampleInterval = 1000;
export const temperaturChartSampleLength = 600;