Compare commits

...
271 Commits
Author SHA1 Message Date
Stefan Dej d3845f94f6 [Automated] Merged develop into target master 2023-10-07 20:49:08 +02:00
Stefan Dej 5b62b97420 chore: fix ftp upload in release workflow (#1590) 2023-10-07 20:48:29 +02:00
Stefan Dej 6884326cd9 [Automated] Merged develop into target master 2023-10-07 20:30:04 +02:00
github-actions c8a1e8cb79 chore: push version number to v2.8.0 2023-10-07 18:29:49 +00:00
Stefan Dej e445fbe5cc fix: fix webcam switch button (#1589) 2023-10-07 20:28:46 +02:00
Samuel Wang 09a994d854 locale(zh): Update Chinese (zh) localization (#1588) 2023-10-07 19:05:11 +02:00
Stefan Dej 1a7aca6680 fix: fix webcam flip in timelapse preview (#1587) 2023-10-07 17:16:00 +02:00
Stefan Dej a3e74aa57a fix: fix WebRTC (camera-streamer) port with external instance (#1586) 2023-10-07 15:16:31 +02:00
Stefan Dej cd1b9b85bd locale(en): remove unused keys in english locale (#1585) 2023-10-07 14:36:40 +02:00
Stefan Dej 4970d0218a locale(de): update german translations (#1583) 2023-10-07 14:34:45 +02:00
Stefan Dejanddw-0 82e3dd8b18 feat: add optional background color for big gcode thumbnails (#1535)
Co-authored-by: dw-0 <domwil1091+github@gmail.com>
2023-10-07 12:54:41 +02:00
Stefan Dej 3994a8ebe8 refactor: update webcam "WebRTC MediaMTX" client (#1558) 2023-10-07 12:08:49 +02:00
Pieter Willekens 8a43ecafd1 build(dependabot): add Dependabot to the repository (#1577) 2023-10-06 22:19:52 +02:00
Stefan Dej d8430f54ed feat: add spoolman support (#1542) 2023-10-06 21:22:46 +02:00
Stefan Dej 5734f1cd1d feat: add monitors (like TMC2240) to Temperature Panel (#1532) 2023-10-06 21:12:07 +02:00
Stefan Dej 7d86df0c81 fix: fix wrong date function in multiple files (#1568) 2023-10-04 22:27:01 +02:00
Stefan Dej 2670eb6447 refactor: rework tool color in extruder panel (#1576) 2023-10-04 22:26:48 +02:00
Stefan Dej 5eb50bbcec refactor: remove unused import in store/printer/getters.ts (#1574) 2023-10-04 22:26:33 +02:00
Pieter Willekens 79a5f9a7e4 build: update toolchain to the latest version (#1575) 2023-10-02 20:35:28 +02:00
Daviteusz 8fc0d5c23c locale(pl): Update Polish translations (#1573) 2023-10-01 10:07:36 +02:00
Stefan Dej a28c6fdb03 feat: add 12-hour time format in printers overview (#1571) 2023-10-01 09:54:22 +02:00
Stefan Dej b7914f8de6 fix: fix gcode command for generic_heater in presets (#1569) 2023-10-01 07:47:34 +02:00
Stefan Dej 2b73cce47a fix: fix webcam (camera-streamer) stop autorestart beforeDestory (#1556) 2023-10-01 07:47:22 +02:00
Stefan Dej 890b9969ae refactor: split ExtruderControlPanel.vue in multiple SFC (#1565) 2023-09-24 01:16:59 +02:00
Alejandro Ramos 79014acf7f locale(es): update spanish locale (#1548) 2023-09-23 10:58:42 +02:00
Daviteusz f3fcce3252 locale(pl): update polish locale (#1554) 2023-09-23 10:52:52 +02:00
Stefan Dej e1dd59db15 fix: fix type issue in TemperaturePanelListItem (#1563) 2023-09-20 21:34:33 +02:00
dependabot[bot] 7ae958934f build(deps): bump @cypress/request and cypress (#1560)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-19 20:22:43 +02:00
dependabot[bot] bf04ec312e build(deps): bump tough-cookie and @cypress/request (#1517)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-19 20:05:35 +02:00
Stefan Dej 09c2526642 feat: add option to block autoscroll in console (#1519) 2023-09-19 20:04:36 +02:00
Stefan Dej a0ad7e84ab feat: hide Moonraker power devices with a _ as first char (#1545) 2023-09-19 20:04:22 +02:00
Stefan Dej 9a2328ba69 feat: automatic selection of the gcode offset save gcode (#1531) 2023-09-19 20:03:14 +02:00
Stefan Dej 5007646ff0 feat: add warning for outdated browsers (#1537) 2023-09-19 20:01:07 +02:00
Stefan Dej c87586aebb fix: fix macro parameter with spaces (#1551) 2023-09-14 18:35:31 +02:00
Stefan Dej ecaa894fbb refactor: refactor ToolheadControlPanel (#1530) 2023-09-05 07:34:18 +02:00
Stefan Dej e0f51667eb fix: fix some issues with the presets (#1529) 2023-09-05 07:33:56 +02:00
Stefan Dej 9f08afc138 fix: fix missing reset options for print history data (#1534) 2023-09-05 07:33:43 +02:00
Stefan Dej fd293d21ec fix: fix autorestart of webcam camerastreamer (#1546) 2023-09-04 12:05:08 +02:00
Stefan Dej 1aa9f341fa fix: fix min/max positions in heightmap current mesh data panel (#1533) 2023-09-04 12:04:54 +02:00
Daviteusz 98d99d2d11 locale(pl): Update Polish translations (#1544) 2023-09-01 22:43:47 +02:00
rackrick 18a5c732b2 fix: eta time format detection from browser (#1522) 2023-08-22 23:25:12 +02:00
rackrick 871688f3c8 fix: show confirm emergency stop dialog only when turned on (#1526) 2023-08-21 21:45:28 +02:00
meteyou c725fb09f5 docs(changelog): update changelog 2023-08-16 15:15:58 +00:00
Stefan Dej 54ce2e029c [Automated] Merged develop into target master 2023-08-16 17:13:21 +02:00
github-actions 5997689ef8 chore: push version number to v2.7.1 2023-08-16 15:13:09 +00:00
Stefan Dej 218f85c81f fix: fix issue on tablet and smaller devices with the sidebar (#1518) 2023-08-16 17:11:36 +02:00
Samuel Wangandmeteyou caaf5e1606 locale(zh): Update Chinese (zh) localization (#1521)
Co-authored-by: meteyou <meteyou@gmail.com>
2023-08-16 17:10:07 +02:00
meteyou 57de746adc docs(changelog): update changelog 2023-08-12 16:08:49 +00:00
Stefan Dej c9dc251e35 [Automated] Merged develop into target master 2023-08-12 18:06:12 +02:00
github-actions b0491deb93 chore: push version number to v2.7.0 2023-08-12 16:06:03 +00:00
DaviteuszandStefan Dej 90d76c1ffe locale(pl): Update Polish translation (#1515)
Co-authored-by: Stefan Dej <meteyou@gmail.com>
2023-08-10 22:07:35 +02:00
Stefan Dejandrackrick 1cd2541d6f feat: add nevermore to temperature panel (#1511)
Co-authored-by: rackrick <45207681+rackrick@users.noreply.github.com>
2023-08-09 23:40:48 +02:00
François LaBergeandStefan Dej 0c4b9e7551 feat: add a select all option on the backup and restore dialogs (#1448)
Co-authored-by: Stefan Dej <meteyou@gmail.com>
2023-08-09 23:40:12 +02:00
Stefan Dej 16165ec85f refactor: soft down info buttons in update manager (#1513) 2023-08-09 20:05:26 +02:00
Stefan Dej 69eaeb6557 feat: add option to hide FPS counter in webcams (#1488) 2023-08-09 20:04:48 +02:00
Stefan Dej e9c22d32bc feat: add an option to set the sidebar default state (#1462) 2023-08-09 01:08:49 +02:00
rackrick 98d9b0aa59 fix: fix cursor style for item name to be a pointer (#1514)
Signed-off-by: Patrick Stainbrook <patrick@hohestadt.de>
2023-08-09 00:56:34 +02:00
sddev0andSebastian Duerholt da157891a4 feat: hide axis controls during print (#1452)
Co-authored-by: Sebastian Duerholt <s.duerholt@gmail.com>
2023-08-07 23:43:20 +02:00
Stefan Dej 9883457e9d feat: add option to hide MCU/Host sensors in the temp panel (#1496) 2023-08-07 23:25:43 +02:00
Stefan Dej 15371adc3d feat: hide screws tilt adjust dialog, when using MAX_DEVIATION (#1474) 2023-08-07 23:25:00 +02:00
DaviteuszandStefan Dej fe7aee9307 locale(pl): Update Polish translation (#1502)
Co-authored-by: Stefan Dej <meteyou@gmail.com>
2023-08-07 23:03:29 +02:00
Samuel-0-0andStefan Dej dbb5f81206 locale(zh): Update Chinese (zh) localization (#1503)
Co-authored-by: Stefan Dej <meteyou@gmail.com>
2023-08-07 22:54:54 +02:00
meteyou 9e2e923a8f docs(changelog): update changelog 2023-07-30 19:26:46 +00:00
Stefan Dej 1b763e23ef [Automated] Merged develop into target master 2023-07-30 21:23:05 +02:00
github-actions 1a12554821 chore: push version number to v2.6.2 2023-07-30 19:22:55 +00:00
Zhu QianandStefan Dej 7251a8c6ba locale(zh): update chinese locale (#1486)
Co-authored-by: Stefan Dej <meteyou@gmail.com>
2023-07-30 21:17:39 +02:00
Stefan Dej cda3098c9e fix: fix issue with cannot extrude after a Klipper restart (#1495) 2023-07-30 21:03:00 +02:00
Stefan Dej 9eb133bd85 fix: fix multiple issues in the refactored update manager (#1497) 2023-07-30 21:02:28 +02:00
Stefan Dej 6a4cca751c fix: fix issue with create/edit presets and refactor settings (#1499) 2023-07-30 21:01:05 +02:00
Stefan Dej d67ef3aa90 fix: use webcam name instead of UUID for timelapse plugin (#1492) 2023-07-30 12:41:08 +02:00
Stefan Dej aeee198239 fix: fix issue with camel-case object names in temperature panel (#1491) 2023-07-28 22:48:01 +02:00
Stefan Dej 5c40820108 fix: fix flip function in several webcam clients (#1487) 2023-07-27 23:02:51 +02:00
Stefan Dej e929c7cc0f fix: hide rpm in temperature_fans without tachometer_pin (#1489) 2023-07-27 09:42:07 +02:00
Stefan Dej 0b47a80b13 refactor: refactor SettingsRow (#1484) 2023-07-24 22:13:16 +02:00
Stefan Dej 8447be2ece fix: fix editor save & restart button behavior (#1483) 2023-07-24 22:08:50 +02:00
Daviteusz 0c5aca8baf locale(pl): Update Polish translation (#1482) 2023-07-24 19:27:21 +02:00
meteyou eceb442a4c docs(changelog): update changelog 2023-07-24 07:36:14 +00:00
Stefan Dej 4d241fc4b4 [Automated] Merged develop into target master 2023-07-24 09:33:02 +02:00
github-actions 98160e1368 chore: push version number to v2.6.1 2023-07-24 07:32:51 +00:00
Stefan Dej f52b94c459 locale(tr): update turkish locale (#1480) 2023-07-24 09:32:00 +02:00
0cefa24e76 refactor: display errors and warnings in the update_manager (#1453)
Co-authored-by: th33xitus <domwil1091+github@gmail.com>
Co-authored-by: rackrick <45207681+rackrick@users.noreply.github.com>
2023-07-22 19:49:03 +02:00
Stefan Dej be253165a0 refactor: extract Presets and Settings from TemperaturePanel (#1465) 2023-07-22 15:07:30 +02:00
Stefan Dej 5b2bea51aa fix: fix issue with webcams in farm printers (#1469) 2023-07-22 15:07:12 +02:00
Stefan Dej db09bbe043 refactor: change SettingsGeneralTab file (#1475) 2023-07-22 15:06:55 +02:00
DaviteuszandWeblate 6758049d29 locale(pl): Update Polish translation (#1476)
Co-authored-by: Weblate <noreply@weblate.org>
2023-07-20 17:06:46 +02:00
antekmeco a58bef2a03 locale(pl): update polish locale (#1471) 2023-07-19 22:49:53 +02:00
dependabot[bot] a1d3dc9118 build(deps-dev): bump word-wrap from 1.2.3 to 1.2.4 (#1470)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-19 18:41:57 +02:00
Stefan Dej 1895d2d905 fix: fix issue with CSV separator in contents (#1460) 2023-07-16 22:43:57 +02:00
Stefan Dej 7c81690c1e refactor: use moonraker webcam api instead of direct DB access (#1445) 2023-07-16 21:51:45 +02:00
Stefan Dej 039a446944 fix: fix issue with ETA and 12h time format (#1463) 2023-07-13 21:40:10 +02:00
Samuel-0-0 bcbef2f19a locale(zh): Update Chinese (zh) localization (#1459) 2023-07-12 21:43:58 +02:00
Jamin Collins 39590004da fix: avoid hitting 100% before print is complete (#1455) 2023-07-09 19:32:40 +02:00
Stefan Dej ef2d17cadd chore: add dev-dist to .gitignore (#1451)
This commit adds 'dev-dist' directory to .gitignore. 'dev-dist' is a folder that gets created when we build the application in development environment, it's not needed to be tracked as it only contains generated files.

Signed-off-by: Stefan Dej <meteyou@gmail.com>
2023-07-01 15:06:37 +02:00
Stefan Dej a7e70c75d0 fix: fix condition in restartServiceNameExists check (#1450) 2023-07-01 11:08:10 +02:00
Stefan Dej 21d3d39503 refactor: build version file for moonraker (#1449) 2023-07-01 08:41:43 +02:00
DaviteuszandWeblate d8441254db locale(pl): Update Polish translation (#1447)
Co-authored-by: Weblate <noreply@weblate.org>
2023-06-28 20:17:04 +02:00
Stefan Dej 6e7ef6554e fix: remove variable check in klipper config StreamParser (#1435) 2023-06-28 20:16:19 +02:00
dependabot[bot] 98a750922a build(deps): bump semver from 7.3.7 to 7.5.2 (#1443)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-25 00:11:28 +02:00
th33xitus 7da33523d1 fix: show delete dialog for single files too (#1442) 2023-06-25 00:11:05 +02:00
Stefan Dej 2962df21e5 chore(pwa): remove debug warnings in browser console (#1441) 2023-06-25 00:01:48 +02:00
DaviteuszandWeblate 73e503fc64 locale(pl): Update Polish translation (#1434)
Co-authored-by: Weblate <noreply@weblate.org>
2023-06-24 22:00:11 +02:00
meteyou 705065d65e docs(changelog): update changelog 2023-06-19 19:53:50 +00:00
Stefan Dej c07606a13c [Automated] Merged develop into target master 2023-06-19 21:50:41 +02:00
Stefan Dej 7966270ea7 chore: update ftp upload action in release workflow (#1430) 2023-06-19 21:47:39 +02:00
Stefan Dej c6a3bbc1ca [Automated] Merged develop into target master 2023-06-19 21:09:15 +02:00
github-actions f5aee3e20d chore: push version number to v2.6.0 2023-06-19 19:08:44 +00:00
Stefan Dejandth33xitus 8fc275086a chore: add PWA caching and cache updater (#1421)
Co-authored-by: th33xitus <domwil1091+github@gmail.com>
2023-06-19 20:15:49 +02:00
Stefan Dej 2752cfc975 feat: add retry button to ScrewsTiltAdjust helper dialog (#1429) 2023-06-19 19:56:01 +02:00
Stefan Dej 6ce0f4f074 refactor: remove unused import in FarmPrinterPanel.vue (#1428) 2023-06-18 21:58:50 +02:00
Stefan Dej 5abf417303 refactor: refactor Panel.vue (#1427) 2023-06-18 21:48:30 +02:00
Stefan Dej 5b55727485 locale(en): remove unused key (#1425) 2023-06-18 21:28:13 +02:00
Stefan Dejandth33xitus 4a41430f40 locale(de): update German localization (#1424)
Co-authored-by: th33xitus <domwil1091+github@gmail.com>
2023-06-18 21:24:57 +02:00
slynn1324andStefan Dej 8682dd7855 feat: add WebRTC (MediaMTX / rtsp-simple-server) webcam mode (#1318)
Co-authored-by: Stefan Dej <meteyou@gmail.com>
2023-06-18 20:18:35 +02:00
Stefan Dej cff7b32f02 refactor: add webcam-wrapper component (#1422) 2023-06-18 19:54:16 +02:00
Stefan Dej 8a34656e82 fix: fix navigation to display allPrinters (#1423) 2023-06-18 19:28:20 +02:00
wyapxandStefan Dej 30efd6496e locale(zh): fix translation (#1418)
Co-authored-by: Stefan Dej <meteyou@gmail.com>
2023-06-18 17:08:24 +02:00
Michael JägerandStefan Dej 2b4b881c55 feat: add bed aspect ratio to heightmap graph (#1420)
Co-authored-by: Stefan Dej <meteyou@gmail.com>
2023-06-18 17:06:56 +02:00
IvanandStefan Dej 7468f882c1 locale(ru): update russian localization (#1394)
Co-authored-by: Stefan Dej <meteyou@gmail.com>
2023-06-15 22:26:02 +02:00
Stefan Dej f9556e27b3 fix: check only not empty filename for metadata in farm printers (#1392) 2023-06-15 22:22:44 +02:00
Luciano Charles ModaandStefan Dej 630d67efc5 feat: add portuguese/brazil translate (#1407)
Co-authored-by: Stefan Dej <meteyou@gmail.com>
2023-06-15 22:15:37 +02:00
a85ec9d0d7 locale(pl): update Polish language (#1411)
Co-authored-by: Daviteusz <imefiu3@gmail.com>
Co-authored-by: Weblate <noreply@weblate.org>
Co-authored-by: Stefan Dej <meteyou@gmail.com>
2023-06-15 21:46:15 +02:00
Quinn Damerell b94840736f feat: Updating WebRTC with camera-streamer signaling protocol (#1417) 2023-06-15 21:04:34 +02:00
dependabot[bot] 9c3c56bd56 build(deps-dev): bump vite from 3.1.4 to 3.2.7 (#1412)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-14 19:46:18 +02:00
dependabot[bot] 23cc6b18e5 build(deps): bump @antfu/utils and unplugin-vue-components (#1409)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-14 19:30:17 +02:00
Titus d4f1bf209d docs: fix broken coding standards link in contributing doc (#1415) 2023-06-14 09:34:14 +02:00
BrownRhinedandStefan Dej 8481408029 locale(zh_TW): update Chinese localization (#1386)
Co-authored-by: Stefan Dej <meteyou@gmail.com>
2023-05-18 17:16:41 +02:00
Stefan Dejandth33xitus d578c2a107 feat: add an option to change the height of the temperatur chart (#1391)
Co-authored-by: th33xitus <domwil1091+github@gmail.com>
2023-05-18 16:45:59 +02:00
080a713f4c refactor: improve syntax highlighting and change theme in editor (#1200)
Co-authored-by: truckershitch <truckershitch@hambone.e4ward.com>
Co-authored-by: Stefan Dej <meteyou@gmail.com>
2023-05-18 16:40:57 +02:00
Mike Constantino 140d796f51 feat: Add printer name to browser tab while printing or complete (#1371) 2023-05-12 16:06:14 +02:00
Stefan Dej 23da8818c3 style: fix eslint issue in SettingsNavigationTabItem (#1383) 2023-05-09 00:04:19 +02:00
bakatrouble 34e3e69e5e fear: Add WebRTC (janus-gateway) webcam mode (#1360) 2023-05-08 20:26:57 +02:00
Benjamin Liertz ea274c6d4a feat: allows adjustable tab size in file editor (#1354) 2023-05-07 22:01:50 +02:00
Mike Constantino a08f9ac9a5 fix: disableFanAnimation getter getting wrong value (#1381) 2023-05-07 21:56:57 +02:00
siparkerandStefan Dej 8bbd5bdb0f feat: add facility to Scan Metadata from G-code Files (#1316)
Co-authored-by: Stefan Dej <meteyou@gmail.com>
2023-05-06 23:09:46 +02:00
Stefan Dej 74816c5c21 feat: add options to disable klipper helper dialogs (#1319) 2023-05-06 23:08:00 +02:00
Christian IversenandStefan Dej 40e8f9cd63 feat: add jmuxer-stream webcam type, supporting raw h264 (#1342)
Co-authored-by: Stefan Dej <meteyou@gmail.com>
2023-05-06 23:03:07 +02:00
Stefan Dej 4d7ffbe090 feat: add function to duplicate gcode files (#1321) 2023-05-06 23:01:38 +02:00
Ben Phelps ec53b974fd feat: Add AHT10 to additionalSensors (#1378) 2023-05-06 23:01:25 +02:00
Stefan Dej a3316eb23b feat: customize sidebar navi (#1336) 2023-05-06 23:01:06 +02:00
Mike Constantino e6505fe55a feat: Allow negative time estimate in slicer (#1372) 2023-05-06 23:00:50 +02:00
Stefan Dej 6484a41eca fix: fix issue when moving a file to the root directory (#1377) 2023-05-06 20:26:30 +02:00
NUTYPEandth33xitus 0e86652d1c locale(ko): update Korean localization (#1368)
Co-authored-by: th33xitus <th33xitus@googlemail.com>
2023-05-04 22:39:00 +02:00
Mike Constantino bb710794d2 fix: Make the correct notification appear on gcode file move (#1376) 2023-05-04 22:38:32 +02:00
pauhull f701dfbcf8 fix: fix zip file timestamp (#1375) 2023-05-04 21:37:16 +02:00
Stefan Dejandth33xitus 301e8386b8 chore: add PULL_REQUEST_TEMPLATE (#1340)
Co-authored-by: th33xitus <domwil1091+github@gmail.com>
2023-04-30 21:34:26 +02:00
Stefan Dej ab777d5e04 fix: add gcode offset to live position in gcodeviewer (#1341) 2023-04-30 21:30:40 +02:00
Stefan Dej c598d6260d fix: fix miscellaneous slider + button for fans/outputs with max power (#1344) 2023-04-30 20:42:36 +02:00
Stefan Dej 370d7d4142 chore: exclude htaccess file on upload to my.mainsail.xyz (#1347) 2023-04-21 20:49:42 +02:00
pauhull faf09f24f9 fix: fix configuration guide link for thumbnails (#1338) 2023-04-16 23:46:39 +02:00
Stefan Dej dd262f74b0 docs: add Contributing section in README.md (#1339) 2023-04-16 12:17:23 +02:00
Gleb ad8d8efb6a fix: fix thumbnail guide link in settings (#1337) 2023-04-15 20:34:51 +02:00
Stefan Dej df83c9d8cc fix: find LOAD & UNLOAD_FILAMENT macros case-insensitive (#1335) 2023-04-08 10:03:05 +02:00
meteyou 6b68be1121 docs(changelog): update changelog 2023-04-02 12:54:19 +00:00
Stefan Dej 3584c0393f [Automated] Merged develop into target master 2023-04-02 14:51:30 +02:00
github-actions 8a199a00b6 chore: push version number to v2.5.1 2023-04-02 12:51:20 +00:00
Stefan Dej c18a9594e6 chore: update caniuse (#1330) 2023-04-02 11:18:16 +02:00
Stefan Dej 85ea45fbe9 fix: fix invalid name input checks (#1312) 2023-04-01 18:41:20 +02:00
Stefan Dej 44f4079dac fix: fix issue of empty Screws tilt adjust helper dialog (#1329) 2023-04-01 15:56:43 +02:00
Staubgeborener ec1b32eaaf locale(de): update German localization (#1326) 2023-04-01 15:56:21 +02:00
Pavel Tajduš 531b75fffd locale(cz): add Czech localization (#1327) 2023-04-01 15:56:09 +02:00
Stefan Dej 7301ae986a fix: disallow non-ascii chars in bed_mesh name (#1311) 2023-04-01 15:55:16 +02:00
Stefan Dej 0f01a8f994 fix: missing M117 output in status panel (#1309) 2023-04-01 15:54:59 +02:00
meteyou 7ad25e3851 docs(changelog): update changelog 2023-03-12 12:17:21 +00:00
Stefan Dej eac516e0e6 [Automated] Merged develop into target master 2023-03-12 13:14:34 +01:00
github-actions 6a7f2f56a4 chore: push version number to v2.5.0 2023-03-12 12:14:21 +00:00
Stefan Dej 47feaef671 feat: allow fan animations to be disabled to save browser perf. (#1232) 2023-03-12 13:12:09 +01:00
Stefan Dejandth33xitus 0e4d104d20 locale(de): update German localization (#1277)
Co-authored-by: th33xitus <domwil1091+github@gmail.com>
2023-03-12 13:06:01 +01:00
Stefan Dej 9665fb9a38 chore: update gcodeviewer from v3.2.0 to v3.2.2 (#1303) 2023-03-12 01:28:33 +01:00
chai-mdandStefan Dej b0cdbb48f3 locale(ja): update Japanese localization (#1270)
* update Japanese localization

* minor fix

* JA: additional follow up

---------

Co-authored-by: Stefan Dej <meteyou@gmail.com>
2023-03-11 11:41:20 +01:00
pauhull 52d0ea4ec5 chore: add armv6 support for Docker image (#1285) 2023-03-10 19:18:50 +01:00
c42f09acc9 locale(da): update Danish localization (#1288)
Co-authored-by: th33xitus <th33xitus@googlemail.com>
Co-authored-by: Stefan Dej <meteyou@gmail.com>
2023-03-10 18:43:21 +01:00
Stefan Dej 1a6969eeea refactor: add ENABLE=1 to SET_PAUSE_AT_LAYER/NEXT_LAYER (#1293) 2023-03-10 18:34:59 +01:00
Stefan Dej a3a71c8f15 fix: only display PAUSE AT LAYER button, when the macros exists (#1291) 2023-03-10 18:25:25 +01:00
Stefan Dej 3e49847fc3 fix: fix browser title, when printer is off (#1300) 2023-03-10 18:05:00 +01:00
Stefan Dejandmeteyou 6703721593 feat: add WebRTC (camera streamer) support (#1275)
Co-authored-by: meteyou <meteyou@users.noreply.github.com>
2023-03-10 18:04:44 +01:00
Stefan Dej f3c42954f1 fix: fix position of webcam fps (#1278) 2023-02-28 22:43:31 +01:00
Stefan Dej 1bbbc0c0a8 chore: add .vscode to .gitignore (#1290) 2023-02-28 20:02:02 +01:00
Samuel-0-0 2f868b537d locale(zh): Update Chinese (zh) localization (#1284) 2023-02-28 19:09:20 +01:00
Stefan Dej c1a50180d0 locale(fr): update French localization (#1289) 2023-02-28 19:05:37 +01:00
Bart Lammers 3743023514 locale(nl): update NL locale (#1282) 2023-02-22 08:01:54 +01:00
Stefan Dej a798d8973c chore: push version number to v2.5.0-beta1
Signed-off-by: Stefan Dej <meteyou@gmail.com>
2023-02-19 13:51:19 +01:00
Samuel-0-0 328530a6a3 locale(zh): update locale (#1269) 2023-02-18 15:05:06 +01:00
Stefan Dej 43dc843eca feat: max webcam height to fit on the screen (#1246) 2023-02-18 15:04:10 +01:00
Stefan Dej 92438bf8a7 refactor: change jobqueue entry attribute to hyphenated names (#1271) 2023-02-18 15:03:56 +01:00
Richard MitchellandStefan Dej e0e90bcdaf feat: support a color or colour variable from tool change macros (#1244)
Co-authored-by: Stefan Dej <meteyou@gmail.com>
2023-02-18 15:03:27 +01:00
Eric HebertandEric Hebert 6a2a1baaab refactor: HLS streamer - improve latency (#1268)
Co-authored-by: Eric Hebert <ehebert@demolitionxp.com>
2023-02-18 14:27:55 +01:00
Stefan Dej 2a924bcd27 feat: add x_only and y_only option in timelapse park position (#1231) 2023-02-12 12:45:40 +01:00
Stefan Dej cec3a9fe33 feat: add function to send PAUSE at a specific layer change (#1230) 2023-02-12 12:45:28 +01:00
Stefan Dej b3ce868dec feat: add jobs to queue in batches (#1253)
fixes https://github.com/mainsail-crew/mainsail/issues/920
2023-02-11 22:30:52 +01:00
Stefan Dej c904b7ba71 feat: add helper display for screws_tilt_adjust (#1261) 2023-02-11 17:36:01 +01:00
Stefan Dejandth33xitus a8bf9e9559 fix: fix output of klippy state, if UDS path/address dont fit (#1263)
Co-authored-by: th33xitus <domwil1091+github@gmail.com>
2023-02-11 12:11:52 +01:00
Stefan Dej 3b5d7f146b locale: remove unused locale PresetSubTitle (#1264) 2023-02-11 11:25:49 +01:00
6b9b69501a feat: add HLS Support for webcams (#1258)
Co-authored-by: Eric Hebert <ehebert@demolitionxp.com>
Co-authored-by: Stefan Dej <meteyou@gmail.com>
2023-02-10 23:23:54 +01:00
dependabot[bot] 57a53b5ac3 build(deps): bump @sideway/formula from 3.0.0 to 3.0.1 (#1259)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-09 15:54:35 +01:00
Stefan Dej c65527ddf2 fix: fix cancel button in rollover logs dialog (#1256) 2023-02-06 19:34:57 +01:00
Stefan Dej 22ccab831b refactor: rename download zip name (#1252) 2023-02-05 19:37:41 +01:00
Stefan Dej 0f94e80135 feat: add button to hide SAVE_CONFIG button for pending bed_mesh (#1255)
Co-authored-by: th33xitus <domwil1091+github@gmail.com>
fixes https://github.com/mainsail-crew/mainsail/issues/1066
2023-02-05 19:37:24 +01:00
Stefan Dej d29ce0a4f0 feat: add power button on dashboard to switch printer on (#1254)
Co-authored-by: th33xitus <domwil1091+github@gmail.com>
fixes https://github.com/mainsail-crew/mainsail/issues/897
2023-02-05 15:09:39 +01:00
Stefan Dej 8782c89d71 refactor: use moonraker zip function (#1245) 2023-02-01 20:27:08 +01:00
Stefan Dej b6fe84f19d feat: log rollover function for klipper and moonraker (#1243) 2023-01-29 16:57:49 +01:00
Stefan Dej 051b89662b feat: hide/ignore .git directories in file init process (#1227) 2023-01-29 16:57:29 +01:00
Stefan Dej e7eb94faa1 fix: hide unused panels on dashboard (#1233) 2023-01-29 15:23:52 +01:00
Stefan Dejandth33xitus 2b7bf2a3f4 fix: fix dateTime output in print history detail dialog (#1248)
Co-authored-by: th33xitus <th33xitus@googlemail.com>
2023-01-29 15:23:32 +01:00
Juan Rosario 9c4fb547b5 fix: G-Code Viewer UI fixes (#1240) 2023-01-22 04:17:01 +01:00
Juan Rosario 727fc722af feat: add support for cnc mode in g-code viewer (#1239)
Signed-off-by: Stefan Dej <meteyou@gmail.com>
2023-01-19 21:36:07 +01:00
Juan RosarioandStefan Dej 1a32147d68 feat: add new CodeStream control to Gcodeviewer (#1224)
Co-authored-by: Stefan Dej <meteyou@gmail.com>
2023-01-19 21:36:06 +01:00
dependabot[bot] 380f3c1b6d build(deps): bump json5 from 2.2.1 to 2.2.3 (#1218)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-07 22:58:14 +01:00
Stefan Dej 7ac6a723b4 feat: add table view for print status stats (#1192)
fix https://github.com/mainsail-crew/mainsail/issues/891
2023-01-07 22:42:01 +01:00
Stefan Dej 712d68136b feat: add multi download to ConfigFilesPanel.vue (#1194)
fixes https://github.com/mainsail-crew/mainsail/issues/1074
2023-01-07 22:08:24 +01:00
Stefan Dej 034ff81e49 fix: fix ExcludeObjectDialogMap for delta printers (#1217) 2023-01-07 22:08:07 +01:00
Stefan Dej c2ecc845ca fix: add webcam rotate to timelapse preview (#1198) 2022-12-18 21:43:03 +01:00
Stefan Dej e21439d061 fix: hide temperature sensors with _ at first char (#1195)
Signed-off-by: Stefan Dej <meteyou@gmail.com>

Signed-off-by: Stefan Dej <meteyou@gmail.com>
2022-12-17 18:33:38 +01:00
meteyou 41fa1d98ca docs(changelog): update changelog 2022-12-10 18:31:12 +00:00
Stefan Dej 350bc1927a [Automated] Merged develop into target master 2022-12-10 19:27:44 +01:00
Stefan Dej 655d2fd339 chore: fix release workflow (#1190) 2022-12-10 18:53:47 +01:00
Bart Lammers 0735ed37a9 locale(nl): Update NL localization (#1191) 2022-12-10 18:52:32 +01:00
github-actions d96070f336 chore: push version number to v2.4.1 2022-12-10 11:16:34 +00:00
Stefan Dej d259abb749 Merge branch 'main/master' into main/develop 2022-12-10 12:15:15 +01:00
Stefan Dej 3e06c5fd66 chore: add release workflow (#1185) 2022-12-10 11:59:40 +01:00
Stefan Dej 288e5110f4 fix: add more space between the rows in manual probe window (#1189)
fix https://github.com/mainsail-crew/mainsail/issues/1183
2022-12-09 21:52:56 +01:00
vajonamandStefan Dej 41ca5244cc fix: disable circle control while printing or not homed (#1171)
Co-authored-by: Stefan Dej <meteyou@gmail.com>
2022-12-09 21:23:59 +01:00
3d4b5451ae fix(Heightmap): save z scale setting (#1175)
Co-authored-by: th33xitus <domwil1091+github@gmail.com>
Co-authored-by: Stefan Dej <meteyou@gmail.com>
2022-12-09 21:21:49 +01:00
srbjessenandth33xitus dc17ff1158 locale(da): update Danish localization (#1179)
Co-authored-by: th33xitus <th33xitus@googlemail.com>
2022-12-09 21:03:24 +01:00
Stefan Dej de23cb6243 locale(tr): update Turkish localization (#1188) 2022-12-09 21:00:01 +01:00
vajonamandStefan Dej 94d7f0dc16 fix: add theming for find/search panel Search panel (#1174)
Co-authored-by: Stefan Dej <meteyou@gmail.com>
2022-12-09 01:56:02 +01:00
Stefan Dej 45c52e3571 fix: fix dashboard interface settings (#1176)
fixed https://github.com/mainsail-crew/mainsail/issues/1167
2022-12-01 21:59:15 +01:00
Stefan Dej 03640e239b docs: add BIGTREETECH to repo README as official sponsor (#1178)
Signed-off-by: Stefan Dej <meteyou@gmail.com>

Signed-off-by: Stefan Dej <meteyou@gmail.com>
2022-12-01 09:05:02 +01:00
th33xitus 4c24fa7284 refactor: replace emergency stop icon (#1170)
Fixes https://github.com/mainsail-crew/mainsail/pull/932
2022-11-25 23:13:47 +01:00
Stefan Dej 12483ee63b fix: fix neopixel settings if name is uppercase (#1169)
fixes https://github.com/mainsail-crew/mainsail/issues/1164
2022-11-25 23:00:19 +01:00
Stefan Dej bae712540e fix: fix handling issues with number-inputs (#1168)
fix https://github.com/mainsail-crew/mainsail/issues/972
2022-11-25 22:43:57 +01:00
Stefan Dej 31664b5f38 fix: fix relative webcam urls on multi instances (#1162) 2022-11-25 21:15:59 +01:00
Stefan Dej ba5aea2b88 refactor: rename variance to range in heightmap (#1166) 2022-11-25 21:11:14 +01:00
Stefan Dej a6e38df012 fix: display can interfaces in system panel (#1159) 2022-11-18 21:55:49 +01:00
Stefan Dej bc0018dadc fix: display layer count with older klipper versions (#1161) 2022-11-18 21:55:32 +01:00
Samuel-0-0andth33xitus 1a659d30d2 locale(zh): update Chinese localization (#1142)
Co-authored-by: th33xitus <th33xitus@googlemail.com>
2022-11-17 09:54:20 +01:00
ZoZo d0bf0bde11 Fix: bad printerUrl check in ternary operator (#1158)
fix https://github.com/mainsail-crew/mainsail/issues/1156
2022-11-16 21:57:11 +01:00
th33xitus d87fe4173d fix(ExtruderPanel): wrong calculation for estimated extrusion length (#1157) 2022-11-16 21:07:56 +01:00
Stefan Dej f8c66af48b Merge branch 'main/develop' into main/master 2022-11-14 23:33:27 +01:00
Stefan Dej da14c44873 chore: push version number to v2.4.0
Signed-off-by: Stefan Dej <meteyou@gmail.com>
2022-11-14 23:31:31 +01:00
Stefan Dej 20adf79e7c feat: multi column for many inputs in gcode macro (#1153) 2022-11-14 22:37:46 +01:00
Stefan Dej 2aa181c7f5 fix: cannot upload GCODE files on iOS (#1152)
fix https://github.com/mainsail-crew/mainsail/issues/1117
2022-11-14 21:31:10 +01:00
chai-md c9ab0782bf locale(ja): update Japanese localization (#1131) 2022-11-10 23:22:24 +01:00
th33xitus 6f8cfaa276 fix(Heightmap): flat for bed mesh not displayed if only one probe count set (#1146)
fixes https://github.com/mainsail-crew/mainsail/issues/1132
2022-11-10 23:21:20 +01:00
Stefan Dej 4760b9d9f1 fix: fix relative webcam urls with port (#1147)
This will fix relative webcam URLs, if Nginx is not running on port 80.
fixes https://github.com/mainsail-crew/mainsail/issues/1126
2022-11-10 23:03:33 +01:00
th33xitus d6015be734 refactor(KlippyStatePanel): display buttons as outlined text buttons (#1134) 2022-10-30 19:16:55 +01:00
th33xitus 837623e0a1 refactor(editor): use the config reference link of a translated version if it exists (#1120) 2022-10-26 20:51:48 +02:00
Stefan Dejandth33xitus 7c28027189 feat: add bed_screws helper dialog (#1115)
* feat: add manual_probe dialog

Signed-off-by: Stefan Dej <meteyou@gmail.com>

* feat: add loading function to abort & accept buttons

Signed-off-by: Stefan Dej <meteyou@gmail.com>

* refactor: rework manual probe dialog

Signed-off-by: Stefan Dej <meteyou@gmail.com>

* refactor: rework manual probe dialog

Signed-off-by: Stefan Dej <meteyou@gmail.com>

* refactor: remove row/cols in sub-panel

Signed-off-by: Stefan Dej <meteyou@gmail.com>

* refactor: add close button in the manual probe panel

Signed-off-by: Stefan Dej <meteyou@gmail.com>

* refactor: move ManualProbe from ToolheadControlPanel to App.vue

Signed-off-by: Stefan Dej <meteyou@gmail.com>

* locale(en): remove unused keys

Signed-off-by: Stefan Dej <meteyou@gmail.com>

* locale(de): add DE locale

Signed-off-by: Stefan Dej <meteyou@gmail.com>

* feat: add bed_screws helper dialog

Signed-off-by: Stefan Dej <meteyou@gmail.com>

* refactor: add all needed outputs for the helper panel

Signed-off-by: Stefan Dej <meteyou@gmail.com>

* locale: fix EN locale

Signed-off-by: Stefan Dej <meteyou@gmail.com>

* locale: add DE locale

Signed-off-by: Stefan Dej <meteyou@gmail.com>

* locale: fix locale by th33

Co-authored-by: th33xitus <domwil1091+github@gmail.com>

Signed-off-by: Stefan Dej <meteyou@gmail.com>
Co-authored-by: th33xitus <domwil1091+github@gmail.com>
2022-10-19 00:11:50 +02:00
Stefan Dej a88c9ba083 feat: add LED / Neopixel support (#1050) 2022-10-18 23:44:32 +02:00
Stefan Dej 128baea88c chore: update gcode viewer to V3.1.4 (#1119) 2022-10-14 00:14:42 +02:00
th33xitus cca17a8822 refactor: rework of the KlippyState panel (#1118) 2022-10-11 10:14:43 +02:00
Stefan Dej 685665bd46 feat: add option to change date & time format in settings (#1069) 2022-10-09 19:59:47 +02:00
th33xitusandStefan Dej d1cfe7251d refactor: improve webcam settings logic and layout (#1114)
Co-authored-by: Stefan Dej <meteyou@gmail.com>
2022-10-09 18:45:22 +02:00
Stefan Dej 05dea0c78b feat: add z_thermal_adjust to temperatures panel (#1113) 2022-10-09 17:14:30 +02:00
Stefan Dej d05efe26c4 chore(build): update compiler target to support import.meta (#1112) 2022-10-08 22:46:20 +02:00
Stefan Dej 835c5dacd2 refactor: fix lint issues (#1111) 2022-10-08 21:06:13 +02:00
Stefan Dej 57bb268ea0 feat: add SET_PRINT_STATS_INFO command support (#1034) 2022-10-08 18:37:25 +02:00
th33xitus d5cafaaa06 chore(locales): remove all unused keys (#1109)
Signed-off-by: Dominik Willner th33xitus@gmail.com
2022-10-06 09:17:29 +02:00
Andriyandth33xitus 8cba020fb2 locale(uk): update Ukrainian localization (#1094)
Co-authored-by: th33xitus <th33xitus@googlemail.com>
2022-10-06 00:42:56 +02:00
th33xitus a305f243da chore(locales): rename locales as per ISO 639 (#1108) 2022-10-05 23:20:57 +02:00
pataarandpieter 666c942b18 chore(deps): update dependencies (#1103)
Co-authored-by: pieter <pieter@interactivestudios.nl>
2022-10-05 23:19:11 +02:00
Samuel-0-0 f01f421c1c locale(zh): update Chinese localization (#1089) 2022-10-05 23:07:28 +02:00
ZISQO 285b8b9b6f locale(ko-kr): update Korean localization (#1098) 2022-10-05 23:07:12 +02:00
th33xitus feadc73847 fix(UI): tweak font sizes (#1107) 2022-10-05 21:27:07 +02:00
dependabot[bot] ceca6ce2f7 build(deps): bump vuetify from 2.6.4 to 2.6.10 (#1095)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-05 21:17:59 +02:00
th33xitus ff37c7de32 fix(UI): missing bottom border radius in status panel (#1106) 2022-10-05 21:15:36 +02:00
lixxbox 829e7a497d fix: broken link in readme (#1104) 2022-10-04 23:32:30 +02:00
Stefan Dej 37c9fa8657 refactor: display bit version of OS (#1101) 2022-09-30 11:21:01 +02:00
Stefan Dej 6a40e6047d fix: set init values in TheManualProbeDialog.vue (#1092) 2022-09-19 01:41:00 +02:00
Stefan Dej 78b9864d11 chore: remove LGTM workflow (#1091) 2022-09-18 01:28:22 +02:00
Stefan Dej 950dea1e08 feat: add manual_probe helper dialog (#1077) 2022-09-18 00:43:49 +02:00
th33xitus 27c57eef68 chore: rename and clean up AboutModal (#1090) 2022-09-18 00:37:10 +02:00
287 changed files with 27368 additions and 18802 deletions

No files matched your search

+1
View File
@@ -13,6 +13,7 @@
"rules": {
"vue/no-v-html": 0,
"vue/component-tags-order": 0,
"vue/no-v-text-v-html-on-component": 0,
"vue/valid-v-slot": [
"error",
{
+51
View File
@@ -0,0 +1,51 @@
<!--
For Work In Progress Pull Requests, please use the Draft PR feature,
see https://github.blog/2019-02-14-introducing-draft-pull-requests/ for further details.
For a timely review/response, please avoid force-pushing additional
commits if your PR already received reviews or comments.
We use squash-merge to merge PRs, so the commit history is clean, but we use the PR title as the commit message.
So we recommend you to use the PR title with conventional commits type prefixes. We use the following prefixes for the PR title:
- feat: A new feature
- fix: A bug fix
- docs: Documentation only changes
- style: Changes that do not affect the meaning of the code (white-space, formatting, etc)
- refactor: A code change that neither fixes a bug nor adds a feature
- perf: A code change that improves performance
- test: Adding missing tests or correcting existing tests
- chore: Changes to the build process or auxiliary tools and libraries such as documentation generation
- locale: Changes to the translations
You can found more information about Conventional Commits here: https://www.conventionalcommits.org/en/v1.0.0/.
Before submitting a Pull Request, please ensure you've done the following:
- 📖 Read the Mainsail Contributing Guidelines: https://github.com/mainsail-crew/mainsail/blob/HEAD/CONTRIBUTING.md#-submitting-a-pull-request-pr.
- 📖 Read the Mainsail Code of Conduct: https://github.com/mainsail-crew/mainsail/blob/HEAD/.github/CODE_OF_CONDUCT.md.
- 👷‍♀️ Create small PRs. In most cases, this will be possible.
- ✅ Provide tests for your changes.
- 📝 Use descriptive commit messages.
- 📗 Update any related documentation and include any relevant screenshots.
-->
## Description
<!--
Please do not leave this blank
This PR [adds/removes/fixes/replaces] the [feature/bug/etc].
-->
## Related Tickets & Documents
<!--
Please use this format link issue numbers: Fixes #123
https://docs.github.com/en/free-pro-team@latest/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword
-->
## Mobile & Desktop Screenshots/Recordings
<!-- Visual changes require screenshots -->
## [optional] Are there any post-deployment tasks we need to perform?
<!-- note: PRs with deleted sections will be marked invalid -->
+21
View File
@@ -0,0 +1,21 @@
# Set update schedule for GitHub Actions
version: 2
updates:
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
# Check for updates to GitHub Actions every week
interval: 'weekly'
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'weekly'
allow:
# Ignore major updates to all dependencies. We're using old versions of some packages that are incompatible with newer versions of other packages.
- dependency-name: '*'
update-type: 'semver:non-major'
dependency-type: 'direct'
assignees:
- 'meteyou'
+2 -2
View File
@@ -12,7 +12,7 @@ jobs:
auto-analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
@@ -27,7 +27,7 @@ jobs:
uses: actions/setup-node@v3
if: contains(steps.changed-file-package-json.outputs.modified_files, 'package.json')
with:
node-version: '16'
node-version: 20
cache: 'npm'
- uses: preactjs/compressed-size-action@v2
+3 -3
View File
@@ -23,12 +23,12 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Fetch repo
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v3
with:
node-version: '16'
node-version: 20
- name: Install dependencies
run: npm ci
@@ -39,7 +39,7 @@ jobs:
- name: Copy output
run: cp ${{ github.workspace }}/dist/mainsail.zip mainsail-latest.zip
- uses: actions/upload-artifact@v2.2.4
- uses: actions/upload-artifact@v3
with:
name: mainsail-latest.zip
path: mainsail-latest.zip
+1 -1
View File
@@ -8,7 +8,7 @@ jobs:
if: contains(github.event.pull_request.labels.*.name, 'analyze')
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: preactjs/compressed-size-action@v2
+3 -3
View File
@@ -13,7 +13,7 @@ jobs:
run: sudo apt install -y jq
- name: Fetch repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
@@ -21,7 +21,7 @@ jobs:
- name: Install node
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
- name: Install dependencies
run: npm ci
@@ -46,7 +46,7 @@ jobs:
echo "::set-output name=$file::|${file##*/}|${MISSING}|${UNUSED}|"
done
- name: Comment PR
uses: thollander/actions-comment-pull-request@v1
uses: thollander/actions-comment-pull-request@v2
with:
message: |
Language file analysis report:
+4 -4
View File
@@ -25,22 +25,22 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Fetch repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install node
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
- name: Install dependencies
run: npm ci
- name: Run linters
uses: wearerequired/lint-action@v1
uses: wearerequired/lint-action@v2
with:
eslint: true
prettier: true
eslint_dir: src
eslint_extensions: ts,vue
eslint_extensions: ts,vue,json
+1 -1
View File
@@ -16,4 +16,4 @@ jobs:
action:
runs-on: ubuntu-latest
steps:
- uses: dessant/label-actions@v2
- uses: dessant/label-actions@v3
-18
View File
@@ -1,18 +0,0 @@
name: Send LGTM reaction
on:
issue_comment:
types: [created]
pull_request_review:
types: [submitted]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@1.0.0
- uses: micnncim/action-lgtm-reaction@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIPHY_API_KEY: ${{ secrets.GIPHY_API_KEY }}
with:
trigger: '["^(?i)lgtm!*$"]'
source: 'giphy'
+7 -7
View File
@@ -22,10 +22,10 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
@@ -33,7 +33,7 @@ jobs:
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
@@ -41,15 +41,15 @@ jobs:
type=edge,branch=develop
type=ref,event=tag
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64,linux/arm/v7
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
+146
View File
@@ -0,0 +1,146 @@
name: Release
on:
workflow_dispatch:
inputs:
version:
type: string
description: New version number in X.Y.Z
required: true
jobs:
push-version-number:
runs-on: ubuntu-latest
steps:
- name: Clone develop repository
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
ref: 'develop'
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@main
- name: Push version number
if: steps.package-version.outputs.current-version != github.event.inputs.version
shell: bash
run: |
npm version --no-git-tag-version ${{ github.event.inputs.version }}
- name: git add & commit & push
if: steps.package-version.outputs.current-version != github.event.inputs.version
uses: EndBug/add-and-commit@v9
with:
add: 'package.json package-lock.json'
default_author: github_actions
message: 'chore: push version number to v${{ github.event.inputs.version }}'
push: true
update-master-branch:
needs: ['push-version-number']
runs-on: ubuntu-latest
steps:
- uses: everlytic/branch-merge@1.1.5
with:
github_token: ${{ secrets.PAT }}
source_ref: 'develop'
target_branch: 'master'
commit_message_template: '[Automated] Merged {source_ref} into target {target_branch}'
release:
needs: ['update-master-branch']
runs-on: ubuntu-latest
steps:
- name: Fetch repo
uses: actions/checkout@v4
with:
ref: 'master'
fetch-depth: 0
- name: Install node
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Move build out of dist
shell: bash
run: mv ./dist/mainsail.zip ./mainsail.zip
- name: Get latest tag
id: latest_tag
shell: bash
run: |
echo "TAG_NAME=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_OUTPUT
- name: Generate a changelog
uses: orhun/git-cliff-action@v2
id: generate-changelog
with:
config: ./cliff-release.toml
args: ${{ steps.latest_tag.outputs.TAG_NAME }}..HEAD
- name: Create release and upload build
uses: softprops/action-gh-release@v1
id: create-release
with:
name: v${{ github.event.inputs.version }}
tag_name: v${{ github.event.inputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
files: ./mainsail.zip
body: ${{ steps.generate-changelog.outputs.content }}
- name: Copy remote configs to dist
shell: bash
run: cp ./remote/* ./dist/
- name: Upload to remote server
uses: SamKirkland/FTP-Deploy-Action@v4.3.4
with:
server: ${{ secrets.REMOTEHOST }}
username: ${{ secrets.REMOTEUSER }}
password: ${{ secrets.REMOTEPASSWORD }}
dangerous-clean-slate: true
exclude: .htaccess
local-dir: ./dist/
update-changelog:
needs: ['release']
name: Generate changelog
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: 'develop'
token: ${{ secrets.PAT }}
fetch-depth: 0
- name: Get latest tag
id: latest_tag
shell: bash
run: |
echo "TAG_NAME=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_OUTPUT
- name: Generate a changelog
uses: orhun/git-cliff-action@v1
id: git-cliff
with:
config: cliff.toml
args: v0.0.4..${{ steps.latest_tag.outputs.TAG_NAME }}
env:
OUTPUT: ${{ github.workspace }}/CHANGELOG.md
- name: Show CHANGELOG
run: |
cat CHANGELOG.md
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'docs(changelog): update changelog'
file_pattern: CHANGELOG.md
+4 -4
View File
@@ -14,12 +14,12 @@ jobs:
# container: cypress/browsers:node16.13.2-chrome97-ff96
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v3
with:
node-version: '16'
node-version: 20
- name: Install dependencies
run: npm ci
@@ -28,6 +28,6 @@ jobs:
run: npm run build
- name: Cypress run
uses: cypress-io/github-action@v2
uses: cypress-io/github-action@v4
with:
start: npm start
start: npm run preview
-42
View File
@@ -1,42 +0,0 @@
name: Update changelog
on:
# Update the changelog after pushing a new tag
push:
tags:
- '*'
# Update the changelog by invoking this workflow manually
workflow_dispatch:
jobs:
changelog:
name: Generate changelog
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get latest tag
run: |
echo "::set-output name=TAG_NAME::$(git describe --tags $(git rev-list --tags --max-count=1))"
id: latest_tag
- name: Generate a changelog
uses: orhun/git-cliff-action@v1
id: git-cliff
with:
config: cliff.toml
args: v0.0.4..${{ steps.latest_tag.outputs.TAG_NAME }}
env:
OUTPUT: CHANGELOG.md
- name: show CHANGELOG
run: |
cat CHANGELOG.md
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'chore(changelog): update changelog'
file_pattern: CHANGELOG.md
branch: develop
+4
View File
@@ -4,15 +4,19 @@ design
*.log
packages/test
dist
dev-dist
temp
.vuerc
.version
.versions
.changelog
.idea
.vscode
package-lock.json
*.local
.env
.vscode
cypress/screenshots/
cypress/videos/
components.d.ts
+1
View File
@@ -4,6 +4,7 @@
"semi": false,
"printWidth": 120,
"bracketSameLine": true,
"trailingComma": "es5",
"htmlWhitespaceSensitivity": "ignore",
"overrides": [
{
+979 -214
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -52,7 +52,7 @@ Before you work on a PR and submit it, please pay attention to the following gui
1. Search the [pull requests](https://github.com/mainsail-crew/mainsail/pulls) for an open or closed PR related to your submission.
- You don't want to duplicate existing efforts or work on something unlikely to be merged into the project.
2. Do not submit PRs against the `master` branch. PRs need to be submitted against the `develop` branch.
3. Follow our [Code Standards](https://docs.mainsail.xyz/development/code-standards)
3. Follow our [Code Standards](https://docs.mainsail.xyz/overview/developement/code-standards)
4. If there is an issue describing the problem you're fixing or a discussion of a feature you are implementing, make sure to link it in the PRs body.
- You can also add `fix #<id>` or `fixes #<id>` in the PR body where `<id>` is the issue id.
+1 -1
View File
@@ -1,7 +1,7 @@
#
# Builder stage, builds the application in node
#
FROM --platform=$BUILDPLATFORM node:16-alpine as builder
FROM --platform=$BUILDPLATFORM node:20-alpine as builder
RUN apk add zip
+22 -1
View File
@@ -73,7 +73,7 @@ You can find the latest release notes [here](https://github.com/mainsail-crew/ma
- **Power Control:** _Control power devices such as relays, TP-Link and Tasmota devices, and more_
- **Powerful Macro-Management:** _Manage your macros on a micro level_
- **[Configurable Dashboard](https://docs.mainsail.xyz/features/dashboard-organisation):** _Create your own personal dashboard_
- **[Theming Support](https://docs.mainsail.xyz/features/theming/):** _Customizable user interface including logos, backgrounds, and custom CSS_
- **[Theming Support](https://docs.mainsail.xyz/features/theming):** _Customizable user interface including logos, backgrounds, and custom CSS_
- **[Additional Sensors](https://docs.mainsail.xyz/quicktips/additional-sensors):** _Add extra sensors to the temperature graph_
- **Exclude Objects:** _Exclude parts of your print <sup>(not officially supported by Klipper yet)</sup>_
@@ -84,6 +84,14 @@ Do you need help or just want to talk? Join our active community on [Discord](ht
Did you find a bug or did you thought of a feature?
Please create an [Issue](https://github.com/mainsail-crew/mainsail/issues) in GitHub and let us know.
## Official Sponsors
<p align='center'>
<img src="https://raw.githubusercontent.com/mainsail-crew/docs/master/assets/img/logo-bigtreetech.png" alt='Mainsail logo' width="150">
</p>
**BIGTREETECH** is the official mainboard partner of Mainsail. BIGTREETECH is committed to developing innovative and competitive products to better serve the 3D printing community.
## Support Mainsail
Mainsail is primarily developed and maintained by meteyou. To keep the project going he invests his free time, almost
@@ -92,6 +100,19 @@ every day. To motivate him (☕🍺😜) there are several ways to support him:
[![patreon](https://img.shields.io/badge/patreon-participate-yellow.svg?style=flat-square)](https://www.patreon.com/meteyou)
[![kofi](https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg?style=flat-square)](https://ko-fi.com/mainsail)
## Contributing
Contributions to Mainsail are always welcome!
- 📥 Pull requests and 🌟 Stars are always welcome.
- Read our [contributing guidelines](CONTRIBUTING.md) to get started,
or find us on [Discord](https://discord.gg/mainsail), we will take the time to guide you.
Looking for a first issue to tackle?
- We tag issues with [![Good First Issue](https://img.shields.io/github/issues/mainsail-crew/mainsail/good%20first%20issue.svg)](https://github.com/mainsail-crew/mainsail/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) when we think they are well suited for people who are new to the codebase or OSS in general.
- [Talk to us](https://discord.gg/mainsail), we'll find something that suits your skills and learning interest.
## Credit, sources and inspiration
- [Kevin O'Connor](https://github.com/KevinOConnor) for the awesome 3D printer firmware [Klipper](https://github.com/KevinOConnor/klipper)
+68
View File
@@ -0,0 +1,68 @@
# configuration file for git-cliff (0.1.0)
[changelog]
# changelog header
header = """
# What's Changed
"""
# template for the changelog body
# https://tera.netlify.app/docs/#introduction
body = """
{% for group, commits in commits | group_by(attribute="group") %}\
### {{ group | split(pat="$") | last | upper_first }}
{% for commit in commits
| filter(attribute="scope")
| sort(attribute="scope") %}
- **{{commit.scope}}**: {{ commit.message | upper_first | trim }} | [{{ commit.id | truncate(length=7, end="") }}]({{ commit.id }})\
{%- if commit.breaking %}
{% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}}
{%- endif -%}
{%- endfor -%}
{%- for commit in commits %}
{%- if commit.scope -%}
{% else -%}
{% raw %}\n{% endraw %}\
- {{ commit.message | upper_first | trim }} | [{{ commit.id | truncate(length=7, end="") }}]({{ commit.id }})\
{%- if commit.breaking %}
{% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}}
{%- endif -%}
{% endif -%}
{% endfor -%}
{% raw %}\n{% endraw %}
{% endfor %}\n\
"""
# remove the leading and trailing whitespaces from the template
trim = true
# changelog footer
footer = """
"""
[git]
# allow only conventional commits
# https://www.conventionalcommits.org
conventional_commits = true
filter_unconventional = true
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^docs\\(changelog\\):", group = "Changelog", skip = true}, # Old redundant commits
{ message = "^chore\\(changelog\\): update changelog", group = "Changelog", skip = true}, # Old redundant commits
{ message = "^chore: push version number to", group = "9$Other", skip = true}, # Old redundant commits
{ message = "^feat(\\(.*\\))?:", group = "1$Features"},
{ message = "^feature(\\(.*\\))?:", group = "1$Features"},
{ message = "^fix(\\(.*\\))?:", group = "2$Bug Fixes and Improvements"},
{ message = "^docs(\\(.*\\))?:", group = "7$Documentation"},
{ message = "^perf(\\(.*\\))?:", group = "3$Performance"},
{ message = "^refactor(\\(.*\\))?:", group = "4$Refactor"},
{ message = "^style(\\(.*\\))?:", group = "5$Styling"},
{ message = "^test(\\(.*\\))?:", group = "9$Other"},
{ message = "^locale(\\(.*\\))?:", group = "6$Localization"},
{ message = "^chore(\\(.*\\))?:", group = "9$Other"},
{ body = ".*security", group = "Security"},
]
# filter out the commits that are not matched by commit parsers
filter_commits = true
ignore_tags="v*-(beta|rc)*"
# glob pattern for matching git tags
tag_pattern = "v[0-9]*"
+14 -14
View File
@@ -17,7 +17,7 @@ body = """
## [unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}\
### {{ group | upper_first }}
### {{ group | split(pat="$") | last | upper_first }}
{% for commit in commits
| filter(attribute="scope")
| sort(attribute="scope") %}
@@ -25,7 +25,6 @@ body = """
{%- if commit.breaking %}
{% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}}
{%- endif -%}
{%- endfor -%}
{%- for commit in commits %}
{%- if commit.scope -%}
@@ -35,7 +34,6 @@ body = """
{%- if commit.breaking %}
{% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}}
{%- endif -%}
{% endif -%}
{% endfor -%}
{% raw %}\n{% endraw %}
@@ -55,16 +53,18 @@ filter_unconventional = false
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^docs\\(changelog\\):", group = "Changelog", skip = true}, # Old redundant commits
{ message = "^feat(\\(.*\\))?:", group = "Features"},
{ message = "^feature(\\(.*\\))?:", group = "Features"},
{ message = "^fix(\\(.*\\))?:", group = "Bug Fixes"},
{ message = "^docs(\\(.*\\))?:", group = "Documentation"},
{ message = "^perf(\\(.*\\))?:", group = "Performance"},
{ message = "^refactor(\\(.*\\))?:", group = "Refactor"},
{ message = "^style(\\(.*\\))?:", group = "Styling"},
{ message = "^test(\\(.*\\))?:", group = "Testing"},
{ message = "^locale(\\(.*\\))?:", group = "Localization"},
{ message = "^chore(\\(.*\\))?:", group = "Miscellaneous Tasks", skip = true}, # chore tasks are not relevant for the changelog
{ message = "^chore\\(changelog\\): update changelog", group = "Changelog", skip = true}, # Old redundant commits
{ message = "^chore: push version number to", group = "9$Other", skip = true}, # Old redundant commits
{ message = "^feat(\\(.*\\))?:", group = "1$Features"},
{ message = "^feature(\\(.*\\))?:", group = "1$Features"},
{ message = "^fix(\\(.*\\))?:", group = "2$Bug Fixes and Improvements"},
{ message = "^docs(\\(.*\\))?:", group = "7$Documentation"},
{ message = "^perf(\\(.*\\))?:", group = "3$Performance"},
{ message = "^refactor(\\(.*\\))?:", group = "4$Refactor"},
{ message = "^style(\\(.*\\))?:", group = "5$Styling"},
{ message = "^test(\\(.*\\))?:", group = "9$Other"},
{ message = "^locale(\\(.*\\))?:", group = "6$Localization"},
{ message = "^chore(\\(.*\\))?:", group = "9$Other"},
{ body = ".*security", group = "Security"},
{ message = "release v2.1.2", group = "Release"}, # workaround for v2.1.2 release
]
@@ -72,4 +72,4 @@ commit_parsers = [
filter_commits = true
ignore_tags="v*-(beta|rc)*"
# glob pattern for matching git tags
tag_pattern = "v[0-9]*"
tag_pattern = "v[0-9]*"
+13
View File
@@ -0,0 +1,13 @@
import { defineConfig } from 'cypress'
export default defineConfig({
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
// @ts-ignore
return require('./cypress/plugins/index.js')(on, config)
},
baseUrl: 'http://localhost:4173',
},
})
-3
View File
@@ -1,3 +0,0 @@
{
"baseUrl": "http://localhost:4173"
}
File renamed without changes.
File renamed without changes.
+1 -1
View File
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
+3604 -9121
View File
File diff suppressed because it is too large. Load diff
+34 -25
View File
@@ -1,6 +1,6 @@
{
"name": "mainsail",
"version": "2.3.1",
"version": "2.8.0",
"private": true,
"decription": "a klipper web interface",
"author": {
@@ -16,8 +16,9 @@
"lint:fix": "npm run lint -- --fix",
"build.zip": "cd ./dist && zip -r mainsail.zip ./ -x '**.DS_Store' ./ && cd ..",
"i18n-extract": "vue-i18n-extract use-config",
"start": "vite preview",
"test": "npm run build && cypress run",
"preview": "vite preview",
"start": "vite build && vite preview",
"test": "start-server-and-test preview http://127.0.0.1:4173/ 'cypress run'",
"test:ui": "cypress open",
"changelog": "git cliff v0.0.4..$(git describe --tags $(git rev-list --tags --max-count=1)) --output CHANGELOG.md"
},
@@ -30,15 +31,20 @@
"@codemirror/search": "^6.0.0",
"@codemirror/state": "^6.1.0",
"@codemirror/view": "^6.0.3",
"@jaames/iro": "^5.5.2",
"@lezer/highlight": "^1.0.0",
"@sindarius/gcodeviewer": "^3.1.3",
"@types/node": "^16.11.22",
"@sindarius/gcodeviewer": "^3.2.2",
"@types/node": "^18.0.0",
"@types/overlayscrollbars": "^1.12.1",
"axios": "^0.26.0",
"@uiw/codemirror-theme-vscode": "^4.19.11",
"axios": "^0.27.0",
"codemirror": "^6.0.1",
"core-js": "^3.16.0",
"detect-browser": "^5.3.0",
"echarts": "^5.2.2",
"echarts-gl": "^2.0.8",
"hls.js": "^1.3.3",
"jmuxer": "^2.0.5",
"js-sha256": "^0.9.0",
"lodash.kebabcase": "^4.1.1",
"lodash.throttle": "^4.1.1",
@@ -46,9 +52,10 @@
"overlayscrollbars-vue": "^0.2.2",
"regenerator-runtime": "^0.13.9",
"resize-observer-polyfill": "^1.5.1",
"semver": "^7.3.5",
"uuid": "^8.3.2",
"vue": "^2.6.14",
"semver": "^7.5.2",
"typed_janus_js": "^1.0.14",
"uuid": "^9.0.0",
"vue": "^2.7.10",
"vue-class-component": "^7.2.6",
"vue-echarts": "^6.0.2",
"vue-i18n": "^8.25.0",
@@ -59,40 +66,42 @@
"vue-resize": "^1.0.1",
"vue-toast-notification": "^0.6.1",
"vuedraggable": "^2.24.3",
"vuetify": "^2.6.1",
"vuetify": "^2.6.10",
"vuex": "^3.6.2"
},
"devDependencies": {
"@intlify/vite-plugin-vue-i18n": "^2.5.0",
"@mdi/js": "^6.5.95",
"@mdi/js": "^7.0.0",
"@types/file-saver": "^2.0.5",
"@types/jmuxer": "^2.0.3",
"@types/lodash.kebabcase": "^4.1.6",
"@types/lodash.throttle": "^4.1.6",
"@types/semver": "^7.3.8",
"@types/uuid": "^8.3.1",
"@typescript-eslint/eslint-plugin": "^5.11.0",
"@typescript-eslint/parser": "^5.11.0",
"@vue/composition-api": "^1.4.6",
"@vue/eslint-config-typescript": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@vue/eslint-config-typescript": "^12.0.0",
"autoprefixer": "^10.4.2",
"cypress": "^9.5.0",
"cypress": "^13.2.0",
"eslint": "^8.9.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-jsonc": "^2.2.1",
"eslint-plugin-vue": "^8.4.1",
"prettier": "^2.5.1",
"eslint-plugin-vue": "^9.0.0",
"prettier": "^3.0.0",
"sass": "~1.32",
"start-server-and-test": "^1.14.0",
"typescript": "^4.5.5",
"unplugin-vue-components": "^0.18.0",
"vite": "^2.9.15",
"vite-plugin-checker": "^0.4.2",
"unplugin-vue-components": "^0.22.12",
"vite": "^3.2.7",
"vite-plugin-checker": "^0.5.0",
"vite-plugin-package-version": "^1.0.2",
"vite-plugin-pwa": "^0.11.13",
"vite-plugin-pwa": "^0.16.4",
"vite-plugin-vue2": "^2.0.1",
"vue-debounce-decorator": "^1.0.1",
"vue-i18n-extract": "^2.0.7",
"vue-router": "^3.5.2",
"vue-template-compiler": "^2.6.14",
"workbox-core": "^6.4.2"
"workbox-core": "^7.0.0"
},
"postcss": {
"plugins": {
@@ -110,6 +119,6 @@
"last 2 edge major versions"
],
"engines": {
"node": "^16"
"node": "^18 || ^20"
}
}
+8
View File
@@ -0,0 +1,8 @@
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
+7
View File
@@ -0,0 +1,7 @@
{
"defaultLocale": "en",
"hostname": null,
"port": null,
"instancesDB": "browser",
"instances": []
}
+85 -47
View File
@@ -1,47 +1,25 @@
<style>
@import './assets/styles/fonts.css';
@import './assets/styles/toastr.css';
@import './assets/styles/page.scss';
@import './assets/styles/sidebar.scss';
@import './assets/styles/utils.scss';
@import './assets/styles/updateManager.scss';
:root {
--app-height: 100%;
}
#content {
background-attachment: fixed;
background-size: cover;
background-repeat: no-repeat;
}
/*noinspection CssUnusedSymbol*/
.v-btn:not(.v-btn--outlined).primary {
/*noinspection CssUnresolvedCustomProperty*/
color: var(--v-btn-text-primary);
}
</style>
<template>
<v-app dark :style="cssVars">
<template v-if="socketIsConnected && guiIsReady">
<the-sidebar></the-sidebar>
<the-topbar></the-topbar>
<the-sidebar />
<the-topbar />
<v-main id="content" :style="mainStyle">
<v-container id="page-container" fluid class="container px-3 px-sm-6 py-sm-6 mx-auto">
<router-view></router-view>
<router-view />
</v-container>
</v-main>
<the-update-dialog></the-update-dialog>
<the-editor></the-editor>
<the-timelapse-rendering-snackbar></the-timelapse-rendering-snackbar>
<the-fullscreen-upload></the-fullscreen-upload>
<the-upload-snackbar></the-upload-snackbar>
<the-service-worker />
<the-update-dialog />
<the-editor />
<the-timelapse-rendering-snackbar />
<the-fullscreen-upload />
<the-upload-snackbar />
<the-manual-probe-dialog />
<the-bed-screws-dialog />
<the-screws-tilt-adjust-dialog />
</template>
<the-select-printer-dialog v-else-if="instancesDB !== 'moonraker'"></the-select-printer-dialog>
<the-connecting-dialog v-else></the-connecting-dialog>
<the-select-printer-dialog v-else-if="instancesDB !== 'moonraker'" />
<the-connecting-dialog v-else />
</v-app>
</template>
@@ -59,6 +37,11 @@ import { panelToolbarHeight, topbarHeight, navigationItemHeight } from '@/store/
import TheTimelapseRenderingSnackbar from '@/components/TheTimelapseRenderingSnackbar.vue'
import TheFullscreenUpload from '@/components/TheFullscreenUpload.vue'
import TheUploadSnackbar from '@/components/TheUploadSnackbar.vue'
import TheManualProbeDialog from '@/components/dialogs/TheManualProbeDialog.vue'
import TheBedScrewsDialog from '@/components/dialogs/TheBedScrewsDialog.vue'
import TheScrewsTiltAdjustDialog from '@/components/dialogs/TheScrewsTiltAdjustDialog.vue'
Component.registerHooks(['metaInfo'])
@Component({
components: {
@@ -71,15 +54,23 @@ import TheUploadSnackbar from '@/components/TheUploadSnackbar.vue'
TheSidebar,
TheFullscreenUpload,
TheUploadSnackbar,
},
metaInfo() {
const title = this.$store.getters['getTitle']
return {
titleTemplate: () => title,
}
TheManualProbeDialog,
TheBedScrewsDialog,
TheScrewsTiltAdjustDialog,
},
})
export default class App extends Mixins(BaseMixin) {
public metaInfo(): any {
let title = this.$store.getters['getTitle']
if (this.isPrinterPowerOff) title = this.$t('App.Titles.PrinterOff')
return {
title,
titleTemplate: '%s',
}
}
get title(): string {
return this.$store.getters['getTitle']
}
@@ -88,13 +79,27 @@ export default class App extends Mixins(BaseMixin) {
return this.$store.getters['files/getMainBackground']
}
get naviDrawer(): boolean {
return this.$store.state.naviDrawer
}
get navigationStyle() {
return this.$store.state.gui.uiSettings.navigationStyle
}
get mainStyle() {
let style = ''
let style: any = {
paddingLeft: '0',
}
if (this.mainBackground !== null) {
style = 'background-image: url(' + this.mainBackground + ');'
style.backgroundImage = 'url(' + this.mainBackground + ')'
}
// overwrite padding left for the sidebar
if (this.naviDrawer && this.navigationStyle === 'iconsAndText') style.paddingLeft = '220px'
if (this.naviDrawer && this.navigationStyle === 'iconsOnly') style.paddingLeft = '56px'
return style
}
@@ -153,7 +158,7 @@ export default class App extends Mixins(BaseMixin) {
}
get print_percent(): number {
return Math.round(this.$store.getters['printer/getPrintPercent'] * 100)
return Math.floor(this.$store.getters['printer/getPrintPercent'] * 100)
}
@Watch('language')
@@ -178,8 +183,9 @@ export default class App extends Mixins(BaseMixin) {
@Watch('current_file')
current_fileChanged(newVal: string): void {
if (newVal !== '')
this.$socket.emit('server.files.metadata', { filename: newVal }, { action: 'files/getMetadataCurrentFile' })
if (newVal === '') return
this.$socket.emit('server.files.metadata', { filename: newVal }, { action: 'files/getMetadataCurrentFile' })
}
@Watch('primaryColor')
@@ -271,6 +277,7 @@ export default class App extends Mixins(BaseMixin) {
@Watch('print_percent')
print_percentChanged(newVal: number): void {
this.drawFavicon(newVal)
this.refreshSpoolman()
}
@Watch('printerIsPrinting')
@@ -278,6 +285,12 @@ export default class App extends Mixins(BaseMixin) {
this.drawFavicon(this.print_percent)
}
refreshSpoolman(): void {
if (this.moonrakerComponents.includes('spoolman')) {
this.$store.dispatch('server/spoolman/refreshActiveSpool', null, { root: true })
}
}
appHeight() {
this.$nextTick(() => {
const doc = document.documentElement
@@ -293,3 +306,28 @@ export default class App extends Mixins(BaseMixin) {
}
}
</script>
<style>
@import './assets/styles/fonts.css';
@import './assets/styles/toastr.css';
@import './assets/styles/page.scss';
@import './assets/styles/sidebar.scss';
@import './assets/styles/utils.scss';
@import './assets/styles/updateManager.scss';
:root {
--app-height: 100%;
}
#content {
background-attachment: fixed;
background-size: cover;
background-repeat: no-repeat;
}
/*noinspection CssUnusedSymbol*/
.v-btn:not(.v-btn--outlined).primary {
/*noinspection CssUnresolvedCustomProperty*/
color: var(--v-btn-text-primary);
}
</style>
+28 -7
View File
@@ -4,7 +4,10 @@
font-style: normal;
font-display: swap;
font-weight: 100;
src: local('Roboto Thin'), local('Roboto-Thin'), url(/fonts/roboto-thin.woff2) format('woff2');
src:
local('Roboto Thin'),
local('Roboto-Thin'),
url(/fonts/roboto-thin.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC,
U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@@ -14,7 +17,10 @@
font-style: normal;
font-display: swap;
font-weight: 300;
src: local('Roboto Light'), local('Roboto-Light'), url(/fonts/roboto-light.woff2) format('woff2');
src:
local('Roboto Light'),
local('Roboto-Light'),
url(/fonts/roboto-light.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC,
U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@@ -24,7 +30,10 @@
font-style: normal;
font-display: swap;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(/fonts/roboto-regular.woff2) format('woff2');
src:
local('Roboto'),
local('Roboto-Regular'),
url(/fonts/roboto-regular.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC,
U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@@ -34,7 +43,10 @@
font-style: normal;
font-display: swap;
font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(/fonts/roboto-medium.woff2) format('woff2');
src:
local('Roboto Medium'),
local('Roboto-Medium'),
url(/fonts/roboto-medium.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC,
U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@@ -44,7 +56,10 @@
font-style: normal;
font-display: swap;
font-weight: 700;
src: local('Roboto Bold'), local('Roboto-Bold'), url(/fonts/roboto-bold.woff2) format('woff2');
src:
local('Roboto Bold'),
local('Roboto-Bold'),
url(/fonts/roboto-bold.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC,
U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@@ -54,7 +69,10 @@
font-style: normal;
font-display: swap;
font-weight: 900;
src: local('Roboto Black'), local('Roboto-Black'), url(/fonts/roboto-black.woff2) format('woff2');
src:
local('Roboto Black'),
local('Roboto-Black'),
url(/fonts/roboto-black.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC,
U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@@ -64,7 +82,10 @@
font-style: normal;
font-display: swap;
font-weight: 400;
src: local('Roboto Mono'), local('Roboto-Mono'), url(/fonts/robotoMono-regular.woff) format('woff');
src:
local('Roboto Mono'),
local('Roboto-Mono'),
url(/fonts/robotoMono-regular.woff) format('woff');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC,
U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
+83 -9
View File
@@ -17,7 +17,7 @@
v-if="restartServiceName === 'klipper'"
text
tile
href="https://www.klipper3d.org/Config_Reference.html"
:href="klipperConfigReference"
target="_blank"
class="d-none d-md-flex">
<v-icon small class="mr-1">{{ mdiHelp }}</v-icon>
@@ -124,6 +124,7 @@ import { Component, Mixins, Watch } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { capitalize, formatFilesize, windowBeforeUnloadFunction } from '@/plugins/helpers'
import Panel from '@/components/ui/Panel.vue'
import { availableKlipperConfigReferenceTranslations } from '@/store/variables'
import CodemirrorAsync from '@/components/inputs/CodemirrorAsync'
import {
mdiClose,
@@ -238,27 +239,35 @@ export default class TheEditor extends Mixins(BaseMixin) {
if (!this.isWriteable) return null
if (['printing', 'paused'].includes(this.printer_state)) return null
// check for generic services <service>.conf (like moonraker.conf, crowsnest.conf, sonar.conf)
if (this.availableServices.includes(this.filenameWithoutExtension) && this.fileExtension === 'conf')
return this.filenameWithoutExtension
if (this.filename.startsWith('webcam') && ['conf', 'txt'].includes(this.fileExtension)) return 'webcamd'
if (this.filename.startsWith('mooncord') && this.fileExtension === 'json') return 'mooncord'
if (this.filename === 'moonraker.conf') return this.moonrakerRestartInstance ?? 'moonraker'
// old webcam service DEPRECATED
if (this.filename.startsWith('webcam') && ['conf', 'txt'].includes(this.fileExtension)) return 'webcamd'
// check for mooncord config files
if (this.filename.startsWith('mooncord') && this.fileExtension === 'json') return 'mooncord'
// fallback for moonraker with multi instances
if (this.filename === 'moonraker.conf') return 'moonraker'
// all .cfg files will be klipper config files
if (this.fileExtension === 'cfg') return 'klipper'
return null
}
get restartServiceNameExists() {
if (this.restartServiceName) return true
// hide the button, if there is no service found
if (this.restartServiceName === null) return false
// klipper and moonraker uses specific api calls instead of generic service restart
if (['klipper', 'moonraker'].includes(this.restartServiceName)) return true
return this.availableServices.includes(this.restartServiceName)
}
get moonrakerRestartInstance() {
return this.$store.state.gui.editor.moonrakerRestartInstance
}
get confirmUnsavedChanges() {
return this.$store.state.gui.editor.confirmUnsavedChanges ?? false
}
@@ -275,6 +284,22 @@ export default class TheEditor extends Mixins(BaseMixin) {
return `${title} ${this.changedOutput}`
}
get currentLanguage() {
return this.$store.state.gui.general.language
}
get klipperConfigReference(): string {
const currentLanguage = this.currentLanguage
const translations = availableKlipperConfigReferenceTranslations
let url = 'https://www.klipper3d.org/Config_Reference.html'
if (translations.includes(currentLanguage)) {
url = `https://www.klipper3d.org/${currentLanguage}/Config_Reference.html`
}
return url
}
cancelDownload() {
this.$store.dispatch('editor/cancelLoad')
}
@@ -316,3 +341,52 @@ export default class TheEditor extends Mixins(BaseMixin) {
}
}
</script>
<style lang="scss" scoped>
::v-deep .ͼ1 .cm-panel.cm-search *:focus:not(.focus-visible) {
outline: none;
}
::v-deep .ͼ1 .cm-panel.cm-search input[type='checkbox'] {
width: 2.2em;
height: 2.2em;
color: dodgerblue;
vertical-align: middle;
-webkit-appearance: none;
border: 10px;
outline: 0;
flex-grow: 0;
border-radius: 4px;
background: var(--v-toolbar-base);
transition: background 300ms;
cursor: pointer;
margin-right: 0.5em;
}
/* Pseudo element for check styling */
::v-deep .ͼ1 .cm-panel.cm-search input[type='checkbox']::before {
content: '';
color: transparent;
display: block;
width: inherit;
height: inherit;
border-radius: inherit;
border: 2px;
background-color: transparent;
background-size: contain;
box-shadow: inset 0 0 0 1px #ccd3d8;
font-size: 16px;
}
/* Checked */
::v-deep .ͼ1 .cm-panel.cm-search input[type='checkbox']:checked {
background-color: var(--color-primary);
}
::v-deep .ͼ1 .cm-panel.cm-search input[type='checkbox']:checked::before {
box-shadow: none;
background-color: var(--color-primary);
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E %3Cpath d='M15.88 8.29L10 14.17l-1.88-1.88a.996.996 0 1 0-1.41 1.41l2.59 2.59c.39.39 1.02.39 1.41 0L17.3 9.7a.996.996 0 0 0 0-1.41c-.39-.39-1.03-.39-1.42 0z' fill='%23fffff'/%3E %3C/svg%3E");
}
</style>
+8 -2
View File
@@ -116,8 +116,14 @@ export default class TheFullscreenUpload extends Mixins(BaseMixin) {
z-index: 99999;
visibility: hidden;
opacity: 0;
transition: visibility 200ms, opacity 200ms;
font: bold 42px Oswald, DejaVu Sans, Tahoma, sans-serif;
transition:
visibility 200ms,
opacity 200ms;
font:
bold 42px Oswald,
DejaVu Sans,
Tahoma,
sans-serif;
}
/*noinspection CssUnusedSymbol*/
+60
View File
@@ -0,0 +1,60 @@
<template>
<v-dialog v-model="showDialog" persistent max-width="400" class="mx-0">
<panel
:title="$t('App.TheServiceWorker.TitleNeedUpdate')"
card-class="service-worker-dialog"
:margin-bottom="false">
<v-card-text>
<p>{{ $t('App.TheServiceWorker.DescriptionNeedUpdate') }}</p>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn text color="primary" @click="update">{{ $t('App.TheServiceWorker.Update') }}</v-btn>
</v-card-actions>
</panel>
</v-dialog>
</template>
<script lang="ts">
import Component from 'vue-class-component'
import { Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
@Component
export default class TheServiceWorker extends Mixins(BaseMixin) {
showDialog = false
updateSW: ((reloadPage?: boolean | undefined) => Promise<void>) | null = null
onOfflineReady() {
window.console.info('PWA is offline ready')
}
onNeedRefresh() {
window.console.warn('PWA needs to refresh')
this.showDialog = true
}
onRegistered() {
window.console.debug('PWA is registered')
}
onRegisterError(error: any) {
window.console.error('PWA registration error:', error)
}
update() {
this.updateSW?.(true)
this.showDialog = false
}
async mounted() {
const { registerSW } = await import('virtual:pwa-register')
this.updateSW = registerSW({
immediate: true,
onOfflineReady: this.onOfflineReady,
onNeedRefresh: this.onNeedRefresh,
onRegistered: this.onRegistered,
onRegisterError: this.onRegisterError,
})
}
}
</script>
+17 -1
View File
@@ -55,7 +55,7 @@
ref="settingsScroll"
:class="'settings-tabs ' + (isMobile ? '' : 'height500')"
:options="{ overflowBehavior: { x: 'hidden' } }">
<component :is="'settings-' + activeTab + '-tab'" @scrollToTop="scrollToTop"></component>
<component :is="'settings-' + activeTab + '-tab'" @scrollToTop="scrollToTop" />
</overlay-scrollbars>
</v-col>
</v-row>
@@ -80,6 +80,7 @@ import SettingsDashboardTab from '@/components/settings/SettingsDashboardTab.vue
import SettingsGCodeViewerTab from '@/components/settings/SettingsGCodeViewerTab.vue'
import SettingsEditorTab from '@/components/settings/SettingsEditorTab.vue'
import SettingsTimelapseTab from '@/components/settings/SettingsTimelapseTab.vue'
import SettingsNavigationTab from '@/components/settings/SettingsNavigationTab.vue'
import Panel from '@/components/ui/Panel.vue'
import {
@@ -97,7 +98,10 @@ import {
mdiTune,
mdiVideo3d,
mdiWebcam,
mdiDipSwitch,
mdiMenu,
} from '@mdi/js'
import SettingsMiscellaneousTab from '@/components/settings/SettingsMiscellaneousTab.vue'
@Component({
components: {
Panel,
@@ -113,6 +117,8 @@ import {
SettingsGCodeViewerTab,
SettingsEditorTab,
SettingsTimelapseTab,
SettingsMiscellaneousTab,
SettingsNavigationTab,
},
})
export default class TheSettingsMenu extends Mixins(BaseMixin) {
@@ -186,6 +192,16 @@ export default class TheSettingsMenu extends Mixins(BaseMixin) {
name: 'editor',
title: this.$t('Settings.EditorTab.Editor'),
},
{
icon: mdiDipSwitch,
name: 'miscellaneous',
title: this.$t('Settings.MiscellaneousTab.Miscellaneous'),
},
{
icon: mdiMenu,
name: 'navigation',
title: this.$t('Settings.NavigationTab.Navigation'),
},
]
if (this.moonrakerComponents.includes('timelapse')) {
+46 -156
View File
@@ -1,46 +1,3 @@
<style>
.nav-logo {
height: 32px;
}
.small-list-item {
height: var(--sidebar-menu-item-height);
}
.no-text-decoration {
text-decoration: none;
background-color: transparent;
}
.no-background:before {
background-color: rgba(255, 255, 255, 0) !important;
}
.no-border {
border: 0 !important;
}
</style>
<style scoped>
.active-nav-item {
border-right: 4px solid var(--v-primary-base);
}
.menu-item-icon {
opacity: 0.85;
}
.menu-item-title {
line-height: 30px;
font-size: 14px;
font-weight: 600;
text-transform: uppercase;
opacity: 0.85;
}
.nav-scrollbar {
height: 100%;
}
</style>
<template>
<v-navigation-drawer
:key="navigationStyle"
@@ -59,78 +16,27 @@
v-if="isMobile"
router
to="/"
:class="
'sidebar-logo no-text-decoration no-background no-border ' +
(navigationStyle === 'iconsOnly' ? 'pa-0 justify-center' : '')
"
:class="mobileLogoClass"
:style="'height: ' + topbarHeight + 'px'"
:ripple="false">
<template v-if="sidebarLogo">
<img :src="sidebarLogo" :style="logoCssVars" class="nav-logo" alt="Logo" />
</template>
<template v-else>
<mainsail-logo
:color="logoColor"
:style="logoCssVars"
class="nav-logo"
:ripple="false"></mainsail-logo>
<mainsail-logo :color="logoColor" :style="logoCssVars" class="nav-logo" :ripple="false" />
</template>
<template v-if="navigationStyle !== 'iconsOnly'">
<span class="text-h6 font-weight-regular text-truncate">{{ printerName }}</span>
</template>
</v-list-item>
<template v-if="countPrinters">
<v-tooltip right :open-delay="500" :disabled="navigationStyle !== 'iconsOnly'">
<template #activator="{ on, attrs }">
<v-list-item
router
to="/allPrinters"
class="small-list-item mt-1"
v-bind="attrs"
v-on="on">
<v-list-item-icon class="my-3 mr-3 menu-item-icon">
<v-icon>{{ mdiViewDashboardOutline }}</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title tile class="menu-item-title">
{{ $t('App.Printers') }}
</v-list-item-title>
</v-list-item-content>
</v-list-item>
</template>
<span>{{ $t('App.Printers') }}</span>
</v-tooltip>
<v-divider class="my-1"></v-divider>
</template>
<div v-for="(category, index) in naviPoints" :key="index">
<v-tooltip right :open-delay="500" :disabled="navigationStyle !== 'iconsOnly'">
<template #activator="{ on, attrs }">
<v-list-item
router
:to="category.path"
class="small-list-item"
v-bind="attrs"
v-on="on">
<v-list-item-icon class="my-3 mr-3 menu-item-icon">
<v-icon>{{ category.icon }}</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title tile class="menu-item-title">
{{ $t(`Router.${category.title}`) }}
</v-list-item-title>
</v-list-item-content>
</v-list-item>
</template>
<span>{{ $t(`Router.${category.title}`) }}</span>
</v-tooltip>
</div>
<sidebar-item v-for="(category, index) in visibleNaviPoints" :key="index" :item="category" />
</v-list-item-group>
</v-list>
</overlay-scrollbars>
<template #append>
<v-list-item class="small-list-item mb-2">
<v-list-item-icon class="menu-item-icon">
<about-modal></about-modal>
<about-dialog />
</v-list-item-icon>
</v-list-item>
</template>
@@ -139,37 +45,32 @@
<script lang="ts">
import Component from 'vue-class-component'
import routes, { AppRoute } from '@/routes'
import { Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { PrinterStateKlipperConfig } from '@/store/printer/types'
import TheSelectPrinterDialog from '@/components/TheSelectPrinterDialog.vue'
import AboutModal from '@/components/modals/AboutModal.vue'
import AboutDialog from '@/components/dialogs/AboutDialog.vue'
import { navigationWidth, topbarHeight } from '@/store/variables'
import MainsailLogo from '@/components/ui/MainsailLogo.vue'
import { mdiViewDashboardOutline } from '@mdi/js'
import SidebarItem from '@/components/ui/SidebarItem.vue'
import NavigationMixin from '@/components/mixins/navigation'
@Component({
components: {
SidebarItem,
TheSelectPrinterDialog,
AboutModal,
AboutDialog,
MainsailLogo,
},
})
export default class TheSidebar extends Mixins(BaseMixin) {
export default class TheSidebar extends Mixins(NavigationMixin, BaseMixin) {
navigationWidth = navigationWidth
topbarHeight = topbarHeight
/**
* Icons
*/
mdiViewDashboardOutline = mdiViewDashboardOutline
get naviDrawer(): boolean {
return this.$store.state.naviDrawer
}
set naviDrawer(newVal: boolean) {
set naviDrawer(newVal) {
this.$store.dispatch('setNaviDrawer', newVal)
}
@@ -181,45 +82,12 @@ export default class TheSidebar extends Mixins(BaseMixin) {
return this.$store.getters['files/getSidebarBackground']
}
get naviPoints(): AppRoute[] {
return routes.filter((element) => {
return element.showInNavi && this.showInNavi(element)
})
}
get klippy_state(): string {
return this.$store.state.server.klippy_state
}
get boolNaviWebcam(): boolean {
return this.$store.state.gui.uiSettings.boolWebcamNavi
}
get moonrakerComponents(): string[] {
return this.$store.state.server.components
}
get registeredDirectories(): string[] {
return this.$store.state.server.registered_directories
}
get klipperConfigfileSettings(): PrinterStateKlipperConfig[] {
return this.$store.state.printer.configfile?.settings ?? {}
}
get currentPage(): string {
return this.$route.fullPath
}
get countPrinters() {
return this.$store.getters['farm/countPrinters']
}
get boolNaviTemp(): boolean {
if (!this.isMobile && this.$vuetify.breakpoint.mdAndDown) {
return true
}
return false
return !this.isMobile && this.$vuetify.breakpoint.mdAndDown
}
get sidebarCssVars(): any {
@@ -255,20 +123,42 @@ export default class TheSidebar extends Mixins(BaseMixin) {
return {}
}
showInNavi(route: AppRoute): boolean {
if (['shutdown', 'error', 'disconnected'].includes(this.klippy_state) && !route.alwaysShow) return false
else if (route.title === 'Webcam' && !this.boolNaviWebcam) return false
else if (route.moonrakerComponent && !this.moonrakerComponents.includes(route.moonrakerComponent)) return false
else if (route.registeredDirectory && !this.registeredDirectories.includes(route.registeredDirectory))
return false
else if (route.klipperComponent && !(route.klipperComponent in this.klipperConfigfileSettings)) return false
else if (route.klipperIsConnected && !this.klippyIsConnected) return false
get mobileLogoClass() {
const output = ['sidebar-logo', 'no-text-decoration', 'no-background', 'no-border']
return true
}
if (this.navigationStyle === 'iconsOnly') {
output.push('pa-0')
output.push('justify-center')
}
mounted() {
this.naviDrawer = this.$vuetify.breakpoint.lgAndUp
return output
}
}
</script>
<style scoped>
.no-text-decoration {
text-decoration: none;
background-color: transparent;
}
.no-background:before {
background-color: rgba(255, 255, 255, 0) !important;
}
.no-border {
border: 0 !important;
}
.nav-logo {
height: 32px;
}
.menu-item-icon {
opacity: 0.85;
}
.nav-scrollbar {
height: 100%;
}
</style>
+3 -1
View File
@@ -238,7 +238,9 @@ export default class TheTopCornerMenu extends Mixins(BaseMixin) {
}
get powerDevices() {
return this.$store.getters['server/power/getDevices']
const devices = this.$store.getters['server/power/getDevices'] ?? []
return devices.filter((device: ServerPowerStateDevice) => !device.device.startsWith('_'))
}
get service_states() {
+67 -26
View File
@@ -1,7 +1,7 @@
<template>
<div>
<v-app-bar app elevate-on-scroll :height="topbarHeight" class="topbar pa-0" clipped-left>
<v-app-bar-nav-icon tile @click.stop="naviDrawer = !naviDrawer"></v-app-bar-nav-icon>
<v-app-bar-nav-icon tile @click.stop="naviDrawer = !naviDrawer" />
<router-link to="/">
<template v-if="sidebarLogo">
<img
@@ -17,20 +17,20 @@
class="nav-logo ml-4 mr-1 d-none d-sm-flex"
router
to="/"
:ripple="false"></mainsail-logo>
:ripple="false" />
</template>
</router-link>
<v-toolbar-title class="text-no-wrap ml-0 pl-2 mr-2">{{ printerName }}</v-toolbar-title>
<printer-selector v-if="countPrinters"></printer-selector>
<v-spacer></v-spacer>
<printer-selector v-if="countPrinters" />
<v-spacer />
<input
ref="fileUploadAndStart"
type="file"
:accept="validGcodeExtensions.join(', ')"
:accept="gcodeInputFileAccept.join(', ')"
style="display: none"
@change="uploadAndStart" />
<v-btn
v-if="klippyIsConnected && saveConfigPending"
v-if="showSaveConfigButton"
tile
:icon="$vuetify.breakpoint.smAndDown"
:text="$vuetify.breakpoint.mdAndUp"
@@ -63,12 +63,12 @@
class="button-min-width-auto px-3 emergency-button"
:loading="loadings.includes('topbarEmergencyStop')"
@click="btnEmergencyStop">
<v-icon class="mr-md-2">{{ mdiAlertCircleOutline }}</v-icon>
<v-icon class="mr-md-2">{{ mdiAlertOctagonOutline }}</v-icon>
<span class="d-none d-md-inline">{{ $t('App.TopBar.EmergencyStop') }}</span>
</v-btn>
<the-notification-menu></the-notification-menu>
<the-settings-menu></the-settings-menu>
<the-top-corner-menu></the-top-corner-menu>
<the-notification-menu />
<the-settings-menu />
<the-top-corner-menu />
</v-app-bar>
<v-snackbar v-model="uploadSnackbar.status" :timeout="-1" :value="true" fixed right bottom dark>
<strong>{{ $t('App.TopBar.Uploading') }} {{ uploadSnackbar.filename }}</strong>
@@ -87,7 +87,7 @@
:title="$t('EmergencyStopDialog.EmergencyStop')"
toolbar-color="error"
card-class="emergency-stop-dialog"
:icon="mdiAlertCircleOutline"
:icon="mdiAlertOctagonOutline"
:margin-bottom="false">
<template #buttons>
<v-btn icon tile @click="showEmergencyStopDialog = false">
@@ -96,7 +96,7 @@
</template>
<v-card-text>{{ $t('EmergencyStopDialog.AreYouSure') }}</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-spacer />
<v-btn text @click="showEmergencyStopDialog = false">{{ $t('EmergencyStopDialog.No') }}</v-btn>
<v-btn color="primary" text @click="emergencyStop">{{ $t('EmergencyStopDialog.Yes') }}</v-btn>
</v-card-actions>
@@ -119,7 +119,7 @@ import PrinterSelector from '@/components/ui/PrinterSelector.vue'
import MainsailLogo from '@/components/ui/MainsailLogo.vue'
import TheNotificationMenu from '@/components/notifications/TheNotificationMenu.vue'
import { topbarHeight } from '@/store/variables'
import { mdiAlertCircleOutline, mdiContentSave, mdiFileUpload, mdiClose, mdiCloseThick } from '@mdi/js'
import { mdiAlertOctagonOutline, mdiContentSave, mdiFileUpload, mdiClose, mdiCloseThick } from '@mdi/js'
type uploadSnackbar = {
status: boolean
@@ -145,7 +145,7 @@ type uploadSnackbar = {
},
})
export default class TheTopbar extends Mixins(BaseMixin) {
mdiAlertCircleOutline = mdiAlertCircleOutline
mdiAlertOctagonOutline = mdiAlertOctagonOutline
mdiContentSave = mdiContentSave
mdiFileUpload = mdiFileUpload
mdiClose = mdiClose
@@ -174,6 +174,12 @@ export default class TheTopbar extends Mixins(BaseMixin) {
fileUploadAndStart: HTMLFormElement
}
get gcodeInputFileAccept() {
if (this.isIOS) return []
return validGcodeExtensions
}
get naviDrawer() {
return this.$store.state.naviDrawer
}
@@ -182,10 +188,6 @@ export default class TheTopbar extends Mixins(BaseMixin) {
this.$store.dispatch('setNaviDrawer', newVal)
}
get validGcodeExtensions() {
return validGcodeExtensions
}
get currentPage() {
return this.$route.fullPath
}
@@ -194,6 +196,20 @@ export default class TheTopbar extends Mixins(BaseMixin) {
return this.$store.state.printer.configfile?.save_config_pending ?? false
}
get hideSaveConfigForBedMash() {
return this.$store.state.gui.uiSettings.hideSaveConfigForBedMash ?? false
}
get showSaveConfigButton() {
if (!this.klipperReadyForGui) return false
if (!this.hideSaveConfigForBedMash) return this.saveConfigPending
let pendingKeys = Object.keys(this.$store.state.printer.configfile?.save_config_pending_items ?? {})
pendingKeys = pendingKeys.filter((key: string) => !key.startsWith('bed_mesh '))
return pendingKeys.length > 0
}
get printerName(): string {
if (this.$store.state.gui.general.printername.length) return this.$store.state.gui.general.printername
@@ -229,13 +245,34 @@ export default class TheTopbar extends Mixins(BaseMixin) {
)
}
get defaultNavigationStateSetting() {
return this.$store.state.gui?.uiSettings?.defaultNavigationStateSetting ?? 'alwaysOpen'
}
mounted() {
//this.naviDrawer = this.$vuetify.breakpoint.lgAndUp
switch (this.defaultNavigationStateSetting) {
case 'alwaysClosed':
this.naviDrawer = false
break
case 'lastState':
this.naviDrawer = (localStorage.getItem('naviDrawer') ?? 'true') === 'true'
break
default:
this.naviDrawer = this.$vuetify.breakpoint.lgAndUp
}
}
btnEmergencyStop() {
const confirmOnEmergencyStop = this.$store.state.gui.uiSettings.confirmOnEmergencyStop
if (confirmOnEmergencyStop) {
this.showEmergencyStopDialog = true
} else {
this.emergencyStop()
return
}
this.emergencyStop()
}
emergencyStop() {
@@ -254,14 +291,14 @@ export default class TheTopbar extends Mixins(BaseMixin) {
async uploadAndStart() {
if (this.$refs.fileUploadAndStart?.files.length) {
this.$store.dispatch('socket/addLoading', { name: 'btnUploadAndStart' })
await this.$store.dispatch('socket/addLoading', { name: 'btnUploadAndStart' })
let successFiles = []
for (const file of this.$refs.fileUploadAndStart?.files || []) {
const result = await this.doUploadAndStart(file)
successFiles.push(result)
}
this.$store.dispatch('socket/removeLoading', { name: 'btnUploadAndStart' })
await this.$store.dispatch('socket/removeLoading', { name: 'btnUploadAndStart' })
for (const file of successFiles) {
const text = this.$t('App.TopBar.UploadOfFileSuccessful', { file: file }).toString()
this.$toast.success(text)
@@ -326,23 +363,27 @@ export default class TheTopbar extends Mixins(BaseMixin) {
}
</script>
<style>
.topbar .v-toolbar__content {
<style scoped>
/*noinspection CssUnusedSymbol*/
::v-deep .topbar .v-toolbar__content {
padding-top: 0 !important;
padding-bottom: 0 !important;
}
</style>
<style scoped>
.button-min-width-auto {
min-width: auto !important;
}
/*noinspection CssUnusedSymbol*/
.topbar .v-btn {
height: 100% !important;
max-height: none;
}
/*noinspection CssUnusedSymbol*/
.topbar .v-btn.v-btn--icon {
/*noinspection CssUnresolvedCustomProperty*/
width: var(--topbar-icon-btn-width) !important;
}
/*noinspection CssUnusedSymbol*/
@media (min-width: 768px) {
header.topbar {
z-index: 8 !important;
+6 -2
View File
@@ -161,10 +161,14 @@ export default class TheUpdateDialog extends Mixins(BaseMixin) {
this.complete &&
['client', 'mainsail', 'full'].includes(this.application.toLowerCase())
)
window.location.reload(true)
window.location.reload()
else {
this.$store.commit('server/updateManager/resetUpdateResponse')
this.$socket.emit('machine.update.status', { refresh: false }, { action: 'server/updateManager/getStatus' })
this.$socket.emit(
'machine.update.status',
{ refresh: false },
{ action: 'server/updateManager/onUpdateStatus' }
)
}
}
@@ -5,7 +5,7 @@
:option="chartOptions"
:autoresize="true"
:init-options="{ renderer: 'svg' }"
style="height: 250px; width: 100%"></e-chart>
style="height: 200px; width: 100%"></e-chart>
</template>
<script lang="ts">
@@ -19,7 +19,7 @@ import { ServerHistoryStateAllPrintStatusEntry } from '@/store/server/history/ty
@Component({
components: {},
})
export default class HistoryAllPrintStatus extends Mixins(BaseMixin) {
export default class HistoryAllPrintStatusChart extends Mixins(BaseMixin) {
declare $refs: {
historyAllPrintStatus: any
}
@@ -0,0 +1,47 @@
<template>
<v-simple-table>
<tbody>
<tr v-for="status in printStatusArray" :key="status.name">
<td>{{ status.displayName }}</td>
<td class="text-right">{{ status.value }}</td>
</tr>
</tbody>
</v-simple-table>
</template>
<script lang="ts">
import Component from 'vue-class-component'
import { Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { ServerHistoryStateAllPrintStatusEntry } from '@/store/server/history/types'
@Component({
components: {},
})
export default class HistoryAllPrintStatusTable extends Mixins(BaseMixin) {
get selectedJobs() {
return this.$store.state.gui.view.history.selectedJobs ?? []
}
get allPrintStatusArray() {
return this.$store.getters['server/history/getAllPrintStatusArrayAll']
}
get selectedPrintStatusArray() {
return this.$store.getters['server/history/getSelectedPrintStatusArray']
}
get printStatusArray() {
const output: ServerHistoryStateAllPrintStatusEntry[] = []
const orgArray = this.selectedJobs.length ? this.selectedPrintStatusArray : this.allPrintStatusArray
orgArray.forEach((status: ServerHistoryStateAllPrintStatusEntry) => {
const tmp = { ...status }
tmp.name = status.displayName
output.push(tmp)
})
return output
}
}
</script>
+133 -139
View File
@@ -5,7 +5,8 @@
:option="chartOptions"
:init-options="{ renderer: 'svg' }"
:autoresize="true"
style="height: 250px; width: 100%"></e-chart>
:style="tempchartStyle"
class="tempchart" />
</template>
<script lang="ts">
@@ -13,11 +14,12 @@ import { convertName } from '@/plugins/helpers'
import Component from 'vue-class-component'
import { Mixins, Watch } from 'vue-property-decorator'
import BaseMixin from '../mixins/base'
import { PrinterTempHistoryStateSerie, PrinterTempHistoryStateSourceEntry } from '@/store/printer/tempHistory/types'
import { PrinterTempHistoryStateSourceEntry } from '@/store/printer/tempHistory/types'
import type { ECharts } from 'echarts/core'
import type { ECBasicOption } from 'echarts/types/dist/shared.d'
import { mdiClock } from '@mdi/js'
import { datasetTypesInPercents } from '@/store/variables'
interface echartsTooltipObj {
[key: string]: any
@@ -32,11 +34,48 @@ export default class TempChart extends Mixins(BaseMixin) {
}
private isVisible = true
public chartOptions: ECBasicOption = {
darkMode: true,
renderer: 'svg',
animation: false,
tooltip: {
get chartOptions(): ECBasicOption {
return {
darkMode: true,
renderer: 'svg',
animation: false,
tooltip: this.tooltip,
grid: {
top: 35,
right: this.gridRight,
bottom: 30,
left: 25,
},
legend: {
animation: false,
show: false,
selected: this.selectedLegends,
},
xAxis: {
type: 'time',
splitNumber: 5,
minInterval: 60 * 1000,
splitLine: {
show: true,
lineStyle: {
color: 'rgba(255, 255, 255, 0.06)',
},
},
axisLabel: {
color: 'rgba(255, 255, 255, 0.24)',
margin: 10,
formatter: this.timeFormat,
},
},
yAxis: this.yAxis,
media: this.media,
dataset: { source: this.source },
series: this.series,
}
}
get tooltip() {
return {
animation: false,
trigger: 'axis',
backgroundColor: 'rgba(0,0,0,0.9)',
@@ -56,37 +95,11 @@ export default class TempChart extends Mixins(BaseMixin) {
obj[['left', 'right'][+(pos[0] < size.viewSize[0] / 2)]] = 5
return obj
},
},
grid: {
top: 35,
right: 15,
bottom: 30,
left: 25,
},
legend: {
animation: false,
show: false,
selected: {},
},
/*dataZoom: [{
type: 'inside',
}],*/
xAxis: {
type: 'time',
splitNumber: 5,
minInterval: 60 * 1000,
splitLine: {
show: true,
lineStyle: {
color: 'rgba(255, 255, 255, 0.06)',
},
},
axisLabel: {
color: 'rgba(255, 255, 255, 0.24)',
margin: 10,
},
},
yAxis: [
}
}
get yAxis() {
return [
{
name: this.$t('Panels.TemperaturePanel.TemperaturesInChart'),
type: 'value',
@@ -156,15 +169,18 @@ export default class TempChart extends Mixins(BaseMixin) {
},
},
},
],
media: [
]
}
get media() {
return [
{
query: {
minWidth: 500,
},
option: {
grid: {
right: 15,
right: this.optionGridRight,
left: 40,
},
yAxis: [
@@ -186,11 +202,7 @@ export default class TempChart extends Mixins(BaseMixin) {
],
},
},
],
dataset: {
source: [],
},
series: [],
]
}
get chart(): ECharts | null {
@@ -225,8 +237,28 @@ export default class TempChart extends Mixins(BaseMixin) {
return this.$store.getters['printer/tempHistory/getSelectedLegends']
}
mounted() {
this.initChart()
get timeFormat() {
return this.hours12Format ? '{hh}:{mm}' : '{HH}:{mm}'
}
get tempchartHeight() {
return this.$store.state.gui.uiSettings.tempchartHeight ?? 250
}
get tempchartStyle() {
return {
height: this.tempchartHeight + 'px',
}
}
get gridRight() {
return this.boolDisplayPwmAxis ? 25 : 15
}
get optionGridRight() {
if (this.boolDisplayPwmAxis) return 35
return 15
}
beforeDestroy() {
@@ -234,75 +266,17 @@ export default class TempChart extends Mixins(BaseMixin) {
if (this.chart) this.chart.dispose()
}
initChart() {
this.chartOptions.series = this.series
this.chartOptions.legend.selected = this.selectedLegends
this.updateChartPwmAxis()
}
updateChart() {
if (this.chart && this.isVisible) {
//const t0 = performance.now()
const limitDate = new Date(Date.now() - this.maxHistory * 1000)
let newSource = [...this.source].filter((entry: PrinterTempHistoryStateSourceEntry) => {
return entry.date >= limitDate
})
this.chart?.setOption(
{
dataset: {
source: newSource,
},
},
false,
true
)
//const t1 = performance.now()
//window.console.debug('calc chart', (t1-t0).toFixed(), newSource.length, this.source.length)
// reset tempHistory if working sources are smaller than 80%
if (this.source.length > 0 && newSource.length < this.maxHistory * 0.8) {
this.$socket.emit('server.temperature_store', {}, { action: 'printer/tempHistory/init' })
}
}
}
updateChartPwmAxis() {
if (this.boolDisplayPwmAxis) {
this.chartOptions.yAxis[1].show = true
this.chartOptions.grid.right = 25
this.chartOptions.media[0].option.grid.right = 35
} else {
this.chartOptions.yAxis[1].show = false
this.chartOptions.grid.right = 15
this.chartOptions.media[0].option.grid.right = 15
}
}
visibilityChanged(isVisible: boolean) {
this.isVisible = isVisible
if (isVisible) {
this.initChart()
}
}
tooltipFormatter(datasets: any) {
let output = ''
const mainDatasets = datasets.filter((dataset: any) => {
if (dataset.seriesName === 'date') return false
const lastIndex = dataset.seriesName.lastIndexOf('-')
if (lastIndex === -1) return true
const suffix = dataset.seriesName.slice(lastIndex + 1)
return !['target', 'power', 'speed'].includes(suffix)
})
const mainDatasets = datasets.filter((dataset: any) => dataset.seriesName.endsWith('-temperature'))
if (datasets.length) {
let outputTime = datasets[0]['axisValueLabel']
outputTime = outputTime.substr(outputTime.indexOf(' '))
outputTime = outputTime.substring(outputTime.indexOf(' '))
output +=
'<div class="row">' +
@@ -321,24 +295,43 @@ export default class TempChart extends Mixins(BaseMixin) {
}
mainDatasets.forEach((dataset: any) => {
const baseSeriesName = dataset.seriesName.substring(0, dataset.seriesName.lastIndexOf('-'))
let displayName = baseSeriesName
if (displayName.indexOf(' ') !== -1) {
displayName = displayName.substring(displayName.indexOf(' ') + 1)
}
output += '<div class="row">'
output += '<div class="col-auto py-0">'
output += dataset.marker
output += "<span class='ml-2'>" + convertName(dataset.seriesName) + ':</span>'
output += "<span class='ml-2'>" + convertName(displayName) + ':</span>'
output += '</div>'
output += '<div class="col text-right py-0 font-weight-bold">'
if (dataset.seriesName in dataset.value) output += dataset.value[dataset.seriesName].toFixed(1)
if (dataset.seriesName + '-target' in dataset.value)
output += ' / ' + dataset.value[dataset.seriesName + '-target'].toFixed(1)
const seriesNameTemperature = `${baseSeriesName}-temperature`
const seriesNameTarget = `${baseSeriesName}-target`
if (seriesNameTemperature in dataset.value) {
const value = dataset.value[seriesNameTemperature]
output += value !== null ? value.toFixed(1) : '--'
}
if (seriesNameTarget in dataset.value) {
output += ' / '
const value = dataset.value[seriesNameTemperature]
output += value !== null ? value.toFixed(1) : '--'
}
output += '°C'
if (dataset.seriesName + '-power' in dataset.value)
output += ' [ ' + (dataset.value[dataset.seriesName + '-power'] * 100).toFixed(0) + '% ]'
if (dataset.seriesName + '-speed' in dataset.value)
output += ' [ ' + (dataset.value[dataset.seriesName + '-speed'] * 100).toFixed(0) + '% ]'
datasetTypesInPercents.forEach((attrKey) => {
const seriesName = `${baseSeriesName}-${attrKey}`
if (!(seriesName in dataset.value)) return
let value = dataset.value[seriesName]
value = value !== null ? (dataset.value[seriesName] * 100).toFixed(0) : '--'
output += ` [ ${value}% ]`
})
output += '</div>'
output += '</div>'
@@ -347,26 +340,6 @@ export default class TempChart extends Mixins(BaseMixin) {
return output
}
@Watch('series', { deep: true })
seriesChanged(newVal: PrinterTempHistoryStateSerie[]) {
if (this.chart && this.chart?.isDisposed() !== true) {
this.chart.setOption(
{
series: newVal,
},
false,
true
)
}
}
@Watch('source')
sourceChanged() {
if (this.chart?.isDisposed() !== true) {
this.updateChart()
}
}
@Watch('selectedLegends')
selectedLegendsChanged(newVal: any, oldVal: any) {
if (this.chart?.isDisposed() !== true) {
@@ -379,9 +352,30 @@ export default class TempChart extends Mixins(BaseMixin) {
}
}
@Watch('boolDisplayPwmAxis')
boolDisplayPwmAxisChanged() {
this.updateChartPwmAxis()
@Watch('source')
sourceChanged(newVal: PrinterTempHistoryStateSourceEntry[]) {
// break if chart isn't initialized or not visible
if (!this.chart || !this.isVisible) return
const limitDate = new Date(Date.now() - this.maxHistory * 1000)
let newSource = newVal.filter((entry: PrinterTempHistoryStateSourceEntry) => {
return entry.date >= limitDate
})
// reset tempHistory if working sources are smaller than 80%
if (newVal.length > 0 && newSource.length < this.maxHistory * 0.8) {
this.$socket.emit(
'server.temperature_store',
{ include_monitors: true },
{ action: 'printer/tempHistory/init' }
)
}
}
}
</script>
<style scoped>
.tempchart {
width: 100%;
}
</style>
+8 -4
View File
@@ -25,7 +25,7 @@
<template>
<v-row :class="'ma-0 ' + entryStyle">
<v-col class="col-auto pr-0 text--disabled console-time">{{ event.formatTime }}</v-col>
<v-col class="col-auto pr-0 text--disabled console-time">{{ entryFormatTime }}</v-col>
<v-col
:class="colorConsoleMessage(event) + ' ' + 'console-message'"
@click.capture="commandClick"
@@ -35,12 +35,12 @@
<script lang="ts">
import Component from 'vue-class-component'
import Vue from 'vue'
import { Prop } from 'vue-property-decorator'
import { Mixins, Prop } from 'vue-property-decorator'
import { ServerStateEvent } from '@/store/server/types'
import BaseMixin from '@/components/mixins/base'
@Component
export default class ConsoleTableEntry extends Vue {
export default class ConsoleTableEntry extends Mixins(BaseMixin) {
@Prop({ required: true })
declare readonly event: ServerStateEvent
@@ -48,6 +48,10 @@ export default class ConsoleTableEntry extends Vue {
return this.$store.state.gui.console.entryStyle ?? 'default'
}
get entryFormatTime() {
return this.formatTime(this.event.date.getTime(), true)
}
colorConsoleMessage(item: ServerStateEvent): string {
if (item.message.startsWith('!! ')) return 'error--text'
+59
View File
@@ -0,0 +1,59 @@
<template>
<v-tooltip right color="panel">
<template #activator="{ on, attrs }">
<v-icon v-bind="attrs" v-on="on">
{{ mdiHelpCircleOutline }}
</v-icon>
</template>
<v-container class="version-container pa-0">
<div><img height="12" src="/img/logo.svg" alt="mainsail-logo" /></div>
<div>v{{ mainsailVersion }}</div>
<div>
<v-icon small class="moonraker-logo">{{ mdiMoonWaningCrescent }}</v-icon>
</div>
<div>{{ moonrakerVersion }}</div>
<div><img height="12" src="/img/klipper.svg" class="klipper-logo" alt="klipper-logo" /></div>
<div>{{ klipperVersion }}</div>
</v-container>
</v-tooltip>
</template>
<script lang="ts">
import BaseMixin from '../mixins/base'
import { Mixins } from 'vue-property-decorator'
import Component from 'vue-class-component'
import { mdiCloseThick, mdiHelpCircleOutline, mdiMoonWaningCrescent } from '@mdi/js'
@Component({})
export default class AboutDialog extends Mixins(BaseMixin) {
mdiHelpCircleOutline = mdiHelpCircleOutline
mdiCloseThick = mdiCloseThick
mdiMoonWaningCrescent = mdiMoonWaningCrescent
get mainsailVersion(): string {
return this.$store.state.packageVersion
}
get klipperVersion(): string {
return this.$store.state.printer?.software_version ?? ''
}
get moonrakerVersion(): string {
return this.$store.state.server?.moonraker_version ?? ''
}
}
</script>
<style scoped>
.klipper-logo {
transform: rotate(90deg);
}
.moonraker-logo {
transform: rotate(45deg);
color: #ebc815;
}
.version-container {
display: grid;
grid-template-columns: 20px auto;
}
</style>
@@ -0,0 +1,174 @@
<template>
<div>
<v-dialog v-model="showDialog" width="800" persistent :fullscreen="isMobile">
<panel
:title="$t('Panels.SpoolmanPanel.ChangeSpool')"
:icon="mdiAdjust"
card-class="spoolman-change-spool-dialog"
:margin-bottom="false">
<template #buttons>
<v-btn icon tile @click="close">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-card-title>
<v-text-field
v-model="search"
:append-icon="mdiMagnify"
:label="$t('Panels.SpoolmanPanel.Search')"
outlined
dense
hide-details
style="max-width: 300px" />
<v-spacer />
<v-btn
:title="$t('Panels.SpoolmanPanel.Refresh')"
class="px-2 minwidth-0 ml-3"
:loading="loadings.includes('refreshSpools')"
@click="refreshSpools">
<v-icon>{{ mdiRefresh }}</v-icon>
</v-btn>
<v-btn
:title="$t('Panels.SpoolmanPanel.OpenSpoolManager')"
class="px-2 minwidth-0 ml-3"
@click="openSpoolManager">
<v-icon>{{ mdiDatabase }}</v-icon>
</v-btn>
</v-card-title>
<v-card-text class="px-0 pb-0">
<v-data-table
:headers="headers"
:items="spools"
item-key="id"
:search="search"
sort-by="last_used"
:sort-desc="true"
:custom-filter="customFilter">
<template #no-data>
<div class="text-center">{{ $t('Panels.SpoolmanPanel.NoSpools') }}</div>
</template>
<template #no-results>
<div class="text-center">{{ $t('Panels.SpoolmanPanel.NoResults') }}</div>
</template>
<template #item="{ item }">
<SpoolmanChangeSpoolDialogRow :key="item.id" :spool="item" @set-spool="setSpool" />
</template>
</v-data-table>
</v-card-text>
</panel>
</v-dialog>
</div>
</template>
<script lang="ts">
import Component from 'vue-class-component'
import { Mixins, Prop, Watch } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import Panel from '@/components/ui/Panel.vue'
import { mdiCloseThick, mdiAdjust, mdiDatabase, mdiMagnify, mdiRefresh } from '@mdi/js'
import { ServerSpoolmanStateSpool } from '@/store/server/spoolman/types'
import SpoolmanChangeSpoolDialogRow from '@/components/dialogs/SpoolmanChangeSpoolDialogRow.vue'
@Component({
components: { SpoolmanChangeSpoolDialogRow, Panel },
})
export default class SpoolmanChangeSpoolDialog extends Mixins(BaseMixin) {
mdiAdjust = mdiAdjust
mdiCloseThick = mdiCloseThick
mdiDatabase = mdiDatabase
mdiMagnify = mdiMagnify
mdiRefresh = mdiRefresh
@Prop({ required: true }) declare readonly showDialog: boolean
search = ''
get spools(): ServerSpoolmanStateSpool[] {
return this.$store.state.server.spoolman.spools ?? []
}
get headers() {
return [
{
text: ' ',
align: 'start',
sortable: false,
},
{
text: this.$t('Panels.SpoolmanPanel.Filament'),
align: 'start',
value: 'filament.name',
sortable: false,
},
{
text: this.$t('Panels.SpoolmanPanel.Material'),
align: 'center',
value: 'filament.material',
},
{
text: this.$t('Panels.SpoolmanPanel.LastUsed'),
align: 'end',
value: 'last_used',
},
{
text: this.$t('Panels.SpoolmanPanel.Weight'),
align: 'end',
value: 'remaining_weight',
},
]
}
get spoolManagerUrl() {
return this.$store.state.server.config.config?.spoolman?.server ?? null
}
openSpoolManager() {
window.open(this.spoolManagerUrl, '_blank')
}
mounted() {
this.refresh()
}
refresh() {
this.$store.dispatch('server/spoolman/refreshSpools')
}
close() {
this.$emit('close')
}
refreshSpools() {
this.$store.dispatch('server/spoolman/refreshSpools')
}
customFilter(value: any, search: string, item: ServerSpoolmanStateSpool): boolean {
const querySplits = search.toLowerCase().split(' ')
const searchArray = [
item.comment,
item.filament.name,
item.filament.vendor.name,
item.filament.material,
item.location,
]
for (const query of querySplits) {
const result = searchArray.some((q) => q?.toLowerCase().includes(query))
if (!result) return false
}
return true
}
setSpool(spool: ServerSpoolmanStateSpool) {
this.$store.dispatch('server/spoolman/setActiveSpool', spool.id)
this.close()
}
@Watch('showDialog')
onShowDialogChanged(newVal: boolean) {
if (newVal) this.search = ''
}
}
</script>
@@ -0,0 +1,104 @@
<template>
<tr class="cursor-pointer" @click="setSpoolRow">
<td style="width: 50px" class="pr-0 py-2">
<spool-icon :color="color" style="width: 50px; float: left" class="mr-3" />
</td>
<td class="py-2" style="min-width: 300px">
<strong class="text-no-wrap">{{ vendor }} - {{ name }}</strong>
<template v-if="location">
<br />
{{ $t('Panels.SpoolmanPanel.Location') }}: {{ location }}
</template>
<template v-if="spool.comment">
<br />
{{ spool.comment }}
</template>
</td>
<td class="text-center text-no-wrap">{{ material }}</td>
<td class="text-right text-no-wrap">{{ last_used }}</td>
<td class="text-right text-no-wrap">
<strong>{{ remaining_weight_format }}</strong>
<small class="ml-1">/ {{ total_weight_format }}</small>
</td>
</tr>
</template>
<script lang="ts">
import Component from 'vue-class-component'
import { Mixins, Prop } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { ServerSpoolmanStateSpool } from '@/store/server/spoolman/types'
@Component({})
export default class SpoolmanChangeSpoolDialogRow extends Mixins(BaseMixin) {
@Prop({ required: true }) declare readonly spool: ServerSpoolmanStateSpool
get color() {
const color = this.spool.filament?.color_hex ?? '000'
return `#${color}`
}
get vendor() {
return this.spool.filament?.vendor?.name ?? 'Unknown'
}
get name() {
return this.spool.filament?.name ?? 'Unknown'
}
get location() {
return this.spool.location
}
get material() {
return this.spool.filament?.material ?? '--'
}
get remaining_weight() {
return this.spool.remaining_weight ?? 0
}
get total_weight() {
return this.spool.filament?.weight ?? 0
}
get remaining_weight_format() {
return `${this.remaining_weight.toFixed(0)}g`
}
get total_weight_format() {
if (this.total_weight < 1000) {
return `${this.total_weight.toFixed(0)}g`
}
let totalRound = Math.round(this.total_weight / 1000)
if (totalRound !== this.total_weight / 1000) {
totalRound = Math.round(this.total_weight / 100) / 10
}
return `${totalRound}kg`
}
get last_used() {
const last_used = this.spool.last_used ?? null
if (!last_used) return this.$t('Panels.SpoolmanPanel.Never')
const date = new Date(this.spool.last_used)
const now = new Date()
const diff = now.getTime() - date.getTime()
if (diff <= 1000 * 60 * 60 * 24) return this.$t('Panels.SpoolmanPanel.Today')
if (diff <= 1000 * 60 * 60 * 24 * 2) return this.$t('Panels.SpoolmanPanel.Yesterday')
if (diff <= 1000 * 60 * 60 * 24 * 14) {
const days = Math.floor(diff / (1000 * 60 * 60 * 24))
return this.$t('Panels.SpoolmanPanel.DaysAgo', { days })
}
return date.toLocaleDateString()
}
setSpoolRow() {
this.$emit('set-spool', this.spool)
}
}
</script>
@@ -0,0 +1,55 @@
<template>
<v-dialog v-model="showDialog" width="400" persistent :fullscreen="isMobile">
<panel
:title="$t('Panels.SpoolmanPanel.EjectSpool')"
:icon="mdiEject"
card-class="spoolman-eject-spool-dialog"
:margin-bottom="false">
<template #buttons>
<v-btn icon tile @click="close">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-card-text>
<v-row>
<v-col>
<p class="body-2">{{ $t('Panels.SpoolmanPanel.EjectSpoolQuestion') }}</p>
</v-col>
</v-row>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn text @click="close">{{ $t('Panels.SpoolmanPanel.Cancel') }}</v-btn>
<v-btn color="primary" text @click="removeSpool">
{{ $t('Panels.SpoolmanPanel.EjectSpool') }}
</v-btn>
</v-card-actions>
</panel>
</v-dialog>
</template>
<script lang="ts">
import Component from 'vue-class-component'
import { Mixins, Prop } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import Panel from '@/components/ui/Panel.vue'
import { mdiCloseThick, mdiEject } from '@mdi/js'
@Component({
components: { Panel },
})
export default class SpoolmanEjectSpoolDialog extends Mixins(BaseMixin) {
mdiEject = mdiEject
mdiCloseThick = mdiCloseThick
@Prop({ required: true }) declare readonly showDialog: boolean
close() {
this.$emit('close')
}
removeSpool() {
this.$store.dispatch('server/spoolman/setActiveSpool', 0)
this.close()
}
}
</script>
+55 -10
View File
@@ -1,23 +1,26 @@
<template>
<v-dialog v-model="bool" :max-width="dialogWidth">
<v-dialog v-model="bool" :max-width="dialogWidth" @click:outside="closeDialog" @keydown.esc="closeDialog">
<v-card>
<v-img v-if="file.big_thumbnail" contain :src="file.big_thumbnail"></v-img>
<v-card-title class="headline">{{ $t('Dialogs.StartPrint.Headline') }}</v-card-title>
<v-img v-if="file.big_thumbnail" contain :src="file.big_thumbnail" :style="bigThumbnailStyle" />
<v-card-title class="text-h5">{{ $t('Dialogs.StartPrint.Headline') }}</v-card-title>
<v-card-text class="pb-0">
{{ $t('Dialogs.StartPrint.DoYouWantToStartFilename', { filename: file.filename }) }}
<p class="body-2">
{{ question }}
</p>
</v-card-text>
<start-print-dialog-spoolman v-if="moonrakerComponents.includes('spoolman')" :file="file" />
<template v-if="moonrakerComponents.includes('timelapse')">
<v-divider class="mt-3 mb-2"></v-divider>
<v-card-text class="pb-0">
<v-divider v-if="!moonrakerComponents.includes('spoolman')" class="mt-3 mb-2" />
<v-card-text class="py-0">
<settings-row :title="$t('Dialogs.StartPrint.Timelapse')">
<v-switch v-model="timelapseEnabled" hide-details class="mt-0"></v-switch>
<v-switch v-model="timelapseEnabled" hide-details class="mt-0" />
</settings-row>
</v-card-text>
<v-divider class="mt-2 mb-0"></v-divider>
<v-divider class="mt-2 mb-0" />
</template>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="" text @click="closeDialog">{{ $t('Dialogs.StartPrint.Cancel') }}</v-btn>
<v-spacer />
<v-btn text @click="closeDialog">{{ $t('Dialogs.StartPrint.Cancel') }}</v-btn>
<v-btn
color="primary"
text
@@ -35,6 +38,9 @@ import { Component, Mixins, Prop } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { FileStateGcodefile } from '@/store/files/types'
import SettingsRow from '@/components/settings/SettingsRow.vue'
import { mdiPrinter3d } from '@mdi/js'
import { ServerSpoolmanStateSpool } from '@/store/server/spoolman/types'
import { defaultBigThumbnailBackground } from '@/store/variables'
@Component({
components: {
@@ -42,6 +48,8 @@ import SettingsRow from '@/components/settings/SettingsRow.vue'
},
})
export default class StartPrintDialog extends Mixins(BaseMixin) {
mdiPrinter3d = mdiPrinter3d
@Prop({ required: true, default: false })
declare readonly bool: boolean
@@ -67,6 +75,43 @@ export default class StartPrintDialog extends Mixins(BaseMixin) {
return this.file.big_thumbnail_width ?? 400
}
get bigThumbnailBackground() {
return this.$store.state.gui.uiSettings.bigThumbnailBackground ?? defaultBigThumbnailBackground
}
get bigThumbnailStyle() {
if (defaultBigThumbnailBackground.toLowerCase() === this.bigThumbnailBackground.toLowerCase()) {
return {}
}
return { backgroundColor: this.bigThumbnailBackground }
}
get active_spool(): ServerSpoolmanStateSpool | null {
return this.$store.state.server.spoolman.active_spool ?? null
}
get filamentVendor() {
return this.active_spool?.filament?.vendor?.name ?? 'Unknown'
}
get filamentName() {
return this.active_spool?.filament.name ?? 'Unknown'
}
get filament() {
return `${this.filamentVendor} - ${this.filamentName}`
}
get question() {
if (this.active_spool)
return this.$t('Dialogs.StartPrint.DoYouWantToStartFilenameFilament', {
filename: this.file?.filename ?? 'unknown',
})
return this.$t('Dialogs.StartPrint.DoYouWantToStartFilename', { filename: this.file?.filename ?? 'unknown' })
}
startPrint(filename = '') {
filename = (this.currentPath + '/' + filename).substring(1)
this.closeDialog()
@@ -0,0 +1,105 @@
<template>
<div>
<v-divider class="mt-3 mb-0" />
<v-card-text class="py-0 px-2">
<spoolman-panel-active-spool
v-if="activeSpoolId !== null"
:small="true"
class="my-0"
@change-spool="showChangeSpoolDialog = true" />
<v-alert v-for="alert in alerts" :key="alert.text" text :color="alert.color" class="mt-4 mx-3">
{{ alert.text }}
</v-alert>
<div class="text-center">
<v-btn color="primary" small class="mx-auto" @click="showChangeSpoolDialog = true">
{{ buttonText }}
</v-btn>
</div>
</v-card-text>
<v-divider :class="classSecondDivider" />
<spoolman-change-spool-dialog :show-dialog="showChangeSpoolDialog" @close="showChangeSpoolDialog = false" />
</div>
</template>
<script lang="ts">
import { Component, Mixins, Prop } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import SpoolmanPanelActiveSpool from '@/components/panels/Spoolman/SpoolmanPanelActiveSpool.vue'
import { FileStateGcodefile } from '@/store/files/types'
@Component({
components: { SpoolmanPanelActiveSpool },
})
export default class StartPrintDialogSpoolman extends Mixins(BaseMixin) {
@Prop({ required: true }) readonly file!: FileStateGcodefile
showChangeSpoolDialog = false
get activeSpoolId() {
let spoolId = this.$store.state.server.spoolman?.active_spool_id ?? null
if (spoolId === 0) spoolId = null
return spoolId
}
get activeSpool() {
return this.$store.state.server.spoolman?.active_spool ?? null
}
get classSecondDivider() {
const classes = ['mt-4']
classes.push(this.moonrakerComponents.includes('timelapse') ? 'mb-2' : 'mb-0')
return classes
}
get buttonText() {
if (this.activeSpoolId === null) return this.$t('Panels.SpoolmanPanel.SelectSpool') as string
return this.$t('Panels.SpoolmanPanel.ChangeSpool') as string
}
get alerts() {
let alerts = []
if (this.activeSpoolId === null) {
alerts.push({
text: this.$t('Panels.SpoolmanPanel.NoSpoolSelected'),
color: 'orange',
})
// No need to check for filament type mismatch if no spool is selected
return alerts
}
const gcodeFilamentType = this.file.filament_type ?? ''
if (
gcodeFilamentType !== '' &&
this.activeSpool?.filament?.material?.toLowerCase() !== gcodeFilamentType.toLowerCase()
) {
alerts.push({
text: this.$t('Panels.SpoolmanPanel.FilamentTypeMismatch', {
fileType: gcodeFilamentType,
spoolType: this.activeSpool?.filament?.material,
}),
color: 'warning',
})
}
const fileWeight = Math.round(this.file.filament_weight_total ?? 0)
const spoolWeight = Math.round(this.activeSpool?.remaining_weight ?? 0)
if (spoolWeight < fileWeight) {
alerts.push({
text: this.$t('Panels.SpoolmanPanel.TooLessFilament', {
fileWeight,
spoolWeight,
}),
color: 'warning',
})
}
return alerts
}
}
</script>
@@ -0,0 +1,176 @@
<template>
<v-dialog :value="showDialog" width="400" persistent :fullscreen="isMobile">
<panel
:title="$t('BedScrews.Headline').toString()"
:icon="mdiArrowCollapseDown"
card-class="manual_probe-dialog"
:margin-bottom="false"
style="overflow: hidden"
:height="isMobile ? 0 : 548">
<template #buttons>
<v-btn icon tile @click="sendAbort">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-card-text>
<v-row>
<v-col>
<v-text-field
v-model="currentScrewName"
:label="$t('BedScrews.ScrewName')"
outlined
dense
clearable
hide-details></v-text-field>
</v-col>
</v-row>
<v-row>
<v-col cols="6">
<v-text-field
v-model="currentScrewOutput"
:label="$t('BedScrews.ScrewIndex')"
outlined
dense
clearable
hide-details></v-text-field>
</v-col>
<v-col cols="6">
<v-text-field
v-model="acceptedScrewOutput"
:label="$t('BedScrews.ScrewAccepted')"
outlined
dense
clearable
hide-details></v-text-field>
</v-col>
</v-row>
<v-row>
<v-col>
<p class="text-center mb-0" v-html="$t('BedScrews.Description')" />
</v-col>
</v-row>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn text :loading="loadingAbort" @click="sendAbort">
{{ $t('BedScrews.Abort') }}
</v-btn>
<v-btn color="primary" text :loading="loadingAdjusted" @click="sendAdjusted">
{{ $t('BedScrews.Adjusted') }}
</v-btn>
<v-btn color="primary" text :loading="loadingAccept" @click="sendAccept">
{{ $t('BedScrews.Accept') }}
</v-btn>
</v-card-actions>
</panel>
</v-dialog>
</template>
<script lang="ts">
import { Component, Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import Panel from '@/components/ui/Panel.vue'
import Responsive from '@/components/ui/Responsive.vue'
import { mdiArrowCollapseDown, mdiInformation, mdiCloseThick } from '@mdi/js'
import ControlMixin from '@/components/mixins/control'
@Component({
components: { Panel, Responsive },
})
export default class TheBedScrewsDialog extends Mixins(BaseMixin, ControlMixin) {
mdiArrowCollapseDown = mdiArrowCollapseDown
mdiInformation = mdiInformation
mdiCloseThick = mdiCloseThick
get showDialog() {
if (!this.boolBedScrewsDialog) return false
const is_active = this.$store.state.printer.bed_screws?.is_active ?? false
return is_active && this.homedAxes.includes('xyz')
}
get boolBedScrewsDialog() {
return this.$store.state.gui.uiSettings.boolBedScrewsDialog ?? true
}
get config() {
return this.$store.state.printer.configfile?.settings?.bed_screws ?? {}
}
get bed_screws_state() {
return this.$store.state.printer.bed_screws?.state
}
get current_screw() {
return this.$store.state.printer.bed_screws?.current_screw
}
get accepted_screws() {
return this.$store.state.printer.bed_screws?.accepted_screws
}
get loadingAbort() {
return this.loadings.includes('bedScrewsAbort')
}
get loadingAccept() {
return this.loadings.includes('bedScrewsAccept')
}
get loadingAdjusted() {
return this.loadings.includes('bedScrewsAdjusted')
}
get screwNames() {
const configKeys = Object.keys(this.config)
const screwNameKeys = configKeys.filter((name: string) => name.startsWith('screw') && name.endsWith('_name'))
const output: string[] = []
screwNameKeys?.forEach((fullName: string) => {
const index = fullName.indexOf('_')
const number = parseInt(fullName.slice(5, index))
output[number - 1] = this.config[`screw${number}_name`] ?? ''
})
return output
}
get countScrews() {
return this.screwNames.length
}
get currentScrewName() {
return this.screwNames[this.current_screw] ?? 'UNKNOWN'
}
get currentScrewOutput() {
return this.$t('BedScrews.ScrewOutput', { current: this.current_screw, max: this.countScrews })
}
get acceptedScrewOutput() {
return this.$t('BedScrews.ScrewOutput', { current: this.accepted_screws, max: this.countScrews })
}
sendAbort() {
const gcode = `ABORT`
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'manualProbeAbort' })
}
sendAccept() {
const gcode = `ACCEPT`
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'manualProbeAccept' })
}
sendAdjusted() {
const gcode = `ADJUSTED`
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'manualProbeAccept' })
}
}
</script>
<style lang="scss" scoped></style>
@@ -0,0 +1,228 @@
<template>
<v-dialog :value="showDialog" width="400" persistent :fullscreen="isMobile">
<panel
:title="$t('ManualProbe.Headline').toString()"
:icon="mdiArrowCollapseDown"
card-class="manual_probe-dialog"
:margin-bottom="false"
style="overflow: hidden"
:height="isMobile ? 0 : 548">
<template #buttons>
<v-btn icon tile @click="sendAbort">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-container>
<v-row>
<v-col class="d-flex align-center justify-center">
<span class="text-h5">{{ z_position_lower }}</span>
<v-icon class="mx-2">{{ mdiChevronTripleRight }}</v-icon>
<span class="text-h4">{{ z_position }}</span>
<v-icon class="mx-2">{{ mdiChevronTripleLeft }}</v-icon>
<span class="text-h5">{{ z_position_upper }}</span>
</v-col>
</v-row>
<v-row>
<v-col class="text-left">
<v-btn class="" color="primary" @click="sendTestZ('--')">
<v-icon small>{{ mdiMinusThick }}</v-icon>
<v-icon small>{{ mdiMinusThick }}</v-icon>
</v-btn>
</v-col>
<v-col class="text-left">
<v-btn class="" color="primary" @click="sendTestZ('-')">
<v-icon small>{{ mdiMinusThick }}</v-icon>
</v-btn>
</v-col>
<v-col class="text-right">
<v-btn class="" color="primary" @click="sendTestZ('+')">
<v-icon small>{{ mdiPlusThick }}</v-icon>
</v-btn>
</v-col>
<v-col class="text-right">
<v-btn class="" color="primary" @click="sendTestZ('++')">
<v-icon small>{{ mdiPlusThick }}</v-icon>
<v-icon small>{{ mdiPlusThick }}</v-icon>
</v-btn>
</v-col>
</v-row>
</v-container>
<sub-panel :title="$t('ManualProbe.Advanced')" sub-panel-class="manual-probe-dialog-advanced" class="mb-n2">
<v-container>
<v-item-group class="_btn-group">
<v-btn
v-for="(offset, index) in offsetsZ"
:key="`offsetsUp-${index}`"
small
class="_btn-qs flex-grow-1 px-1"
@click="sendTestZ(offset.toString())">
<v-icon v-if="index === 0" left small class="mr-1 ml-n1">
{{ mdiArrowExpandUp }}
</v-icon>
<span>&plus;{{ offset }}</span>
</v-btn>
</v-item-group>
<v-item-group class="_btn-group mt-6 mt-sm-3">
<v-btn
v-for="(offset, index) in offsetsZ"
:key="`offsetsDown-${index}`"
small
class="_btn-qs flex-grow-1 px-1"
@click="sendTestZ((offset * -1).toString())">
<v-icon v-if="index === 0" left small class="mr-1 ml-n1">
{{ mdiArrowCollapseDown }}
</v-icon>
<span>&minus;{{ offset }}</span>
</v-btn>
</v-item-group>
</v-container>
</sub-panel>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn text :loading="loadingAbort" @click="sendAbort">
{{ $t('ManualProbe.Abort') }}
</v-btn>
<v-btn color="primary" text :loading="loadingAccept" @click="sendAccept">
{{ $t('ManualProbe.Accept') }}
</v-btn>
</v-card-actions>
</panel>
</v-dialog>
</template>
<script lang="ts">
import { Component, Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import Panel from '@/components/ui/Panel.vue'
import Responsive from '@/components/ui/Responsive.vue'
import {
mdiArrowCollapseDown,
mdiArrowExpandUp,
mdiInformation,
mdiPlusThick,
mdiMinusThick,
mdiChevronTripleLeft,
mdiChevronTripleRight,
mdiCloseThick,
} from '@mdi/js'
@Component({
components: { Panel, Responsive },
})
export default class TheManualProbeDialog extends Mixins(BaseMixin) {
mdiArrowCollapseDown = mdiArrowCollapseDown
mdiArrowExpandUp = mdiArrowExpandUp
mdiInformation = mdiInformation
mdiPlusThick = mdiPlusThick
mdiMinusThick = mdiMinusThick
mdiChevronTripleLeft = mdiChevronTripleLeft
mdiChevronTripleRight = mdiChevronTripleRight
mdiCloseThick = mdiCloseThick
get showDialog() {
if (!this.boolManualProbeDialog) return false
return this.$store.state.printer.manual_probe?.is_active ?? false
}
get boolManualProbeDialog() {
return this.$store.state.gui.uiSettings.boolManualProbeDialog ?? true
}
get offsetsZ() {
const offsets = [1, 0.1, 0.05, 0.01, 0.005]
return offsets.sort()
}
get z_position() {
return (this.$store.state.printer.manual_probe?.z_position ?? 0).toFixed(3)
}
get z_position_lower() {
const value = this.$store.state.printer.manual_probe?.z_position_lower ?? null
if (value === null) return '??????'
return value.toFixed(3)
}
get z_position_upper() {
const value = this.$store.state.printer.manual_probe?.z_position_upper ?? null
if (value === null) return '??????'
return value.toFixed(3)
}
get loadingAbort() {
return this.loadings.includes('manualProbeAbort')
}
get loadingAccept() {
return this.loadings.includes('manualProbeAccept')
}
sendTestZ(offset: string) {
const gcode = `TESTZ Z=${offset}`
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
this.$socket.emit('printer.gcode.script', { script: gcode })
}
sendAbort() {
const gcode = `ABORT`
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'manualProbeAbort' })
}
sendAccept() {
const gcode = `ACCEPT`
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'manualProbeAccept' })
}
}
</script>
<style lang="scss" scoped>
.v-btn-toggle {
width: 100%;
}
._btn-group {
border-radius: 4px;
display: inline-flex;
flex-wrap: nowrap;
max-width: 100%;
min-width: 100%;
width: 100%;
.v-btn {
border-radius: 0;
border-color: rgba(255, 255, 255, 0.12) !important;
border-style: solid;
border-width: thin;
box-shadow: none;
height: 28px;
opacity: 0.8;
min-width: auto !important;
}
.v-btn:first-child {
border-top-left-radius: inherit;
border-bottom-left-radius: inherit;
}
.v-btn:last-child {
border-top-right-radius: inherit;
border-bottom-right-radius: inherit;
}
.v-btn:not(:first-child) {
border-left-width: 0;
}
}
._btn-qs {
font-size: 0.8rem !important;
font-weight: 400;
max-height: 28px;
}
</style>
@@ -0,0 +1,100 @@
<template>
<v-dialog :value="showDialog" width="400" persistent :fullscreen="isMobile">
<panel
:title="$t('ScrewsTiltAdjust.Headline')"
:icon="mdiArrowCollapseDown"
card-class="manual_probe-dialog"
:margin-bottom="false"
style="overflow: hidden"
:height="isMobile ? 0 : 548">
<template #buttons>
<v-btn icon tile @click="clearScrewsTiltAdjust">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-card-text v-if="error">
<v-row>
<v-col>
<v-alert border="left" text type="error">{{ $t('ScrewsTiltAdjust.ErrorText') }}</v-alert>
</v-col>
</v-row>
</v-card-text>
<v-card-text v-if="Object.keys(results).length">
<template v-for="(result, name, index) of results">
<v-divider v-if="index" :key="`result-divider-${name}`" class="my-1" />
<the-screws-tilt-adjust-dialog-entry
:key="`result-${name}-${name}`"
:name="name.toString()"
:result="result" />
</template>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn text @click="retryScrewsTiltAdjust">
{{ $t('ScrewsTiltAdjust.Retry') }}
</v-btn>
<v-btn color="primary" text @click="clearScrewsTiltAdjust">
{{ $t('ScrewsTiltAdjust.Accept') }}
</v-btn>
</v-card-actions>
</panel>
</v-dialog>
</template>
<script lang="ts">
import { Component, Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import Panel from '@/components/ui/Panel.vue'
import Responsive from '@/components/ui/Responsive.vue'
import SettingsRow from '@/components/settings/SettingsRow.vue'
import { mdiArrowCollapseDown, mdiCloseThick } from '@mdi/js'
import ControlMixin from '@/components/mixins/control'
import TheScrewsTiltAdjustDialogEntry from '@/components/dialogs/TheScrewsTiltAdjustDialogEntry.vue'
@Component({
components: { TheScrewsTiltAdjustDialogEntry, Panel, Responsive, SettingsRow },
})
export default class TheScrewsTiltAdjustDialog extends Mixins(BaseMixin, ControlMixin) {
mdiArrowCollapseDown = mdiArrowCollapseDown
mdiCloseThick = mdiCloseThick
get state() {
return this.$store.state.printer.screws_tilt_adjust ?? {}
}
get error() {
return this.$store.state.printer.screws_tilt_adjust?.error ?? false
}
get max_deviation() {
return this.$store.state.printer.screws_tilt_adjust?.max_deviation ?? null
}
get results() {
return this.$store.state.printer.screws_tilt_adjust?.results ?? {}
}
get showDialog() {
// don't display the dialog, if the user disabled it in the UI settings
if (!this.boolScrewsTiltAdjustDialog) return false
// don't display the dialog, if the user add the MAX_DEVIATION attribute to the SCREWS_TILT_CALCULATE command
if (this.max_deviation !== null) return false
return this.error || Object.keys(this.results).length
}
get boolScrewsTiltAdjustDialog() {
return this.$store.state.gui.uiSettings.boolScrewsTiltAdjustDialog ?? true
}
clearScrewsTiltAdjust() {
this.$store.dispatch('printer/clearScrewsTiltAdjust')
}
async retryScrewsTiltAdjust() {
await this.$store.dispatch('printer/clearScrewsTiltAdjust')
this.doSend('SCREWS_TILT_CALCULATE')
}
}
</script>
@@ -0,0 +1,65 @@
<template>
<settings-row :title="outputName" :sub-title="subTitle">
<v-chip v-if="!(is_base ?? false)" label small>
<v-icon v-if="sign === 'CCW'" small left>{{ mdiRotateLeft }}</v-icon>
<v-icon v-if="sign === 'CW'" small left>{{ mdiRotateRight }}</v-icon>
{{ adjust }}
</v-chip>
<v-chip v-else label small>{{ $t('ScrewsTiltAdjust.Base') }}</v-chip>
</settings-row>
</template>
<script lang="ts">
import { Component, Mixins, Prop } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import Panel from '@/components/ui/Panel.vue'
import Responsive from '@/components/ui/Responsive.vue'
import SettingsRow from '@/components/settings/SettingsRow.vue'
import { mdiRotateLeft, mdiRotateRight, mdiCloseThick } from '@mdi/js'
import ControlMixin from '@/components/mixins/control'
interface ScrewsTiltAdjustResult {
z: number
sign?: string
adjust?: string
is_base: boolean
}
@Component({
components: { Panel, Responsive, SettingsRow },
})
export default class TheScrewsTiltAdjustDialogEntry extends Mixins(BaseMixin, ControlMixin) {
mdiRotateLeft = mdiRotateLeft
mdiCloseThick = mdiCloseThick
mdiRotateRight = mdiRotateRight
@Prop({ required: true }) declare readonly name: string
@Prop({ required: true }) declare readonly result: ScrewsTiltAdjustResult
get settings() {
return this.$store.state.printer.configfile?.settings?.screws_tilt_adjust ?? {}
}
get outputName() {
return this.settings[this.name + '_name'] ?? 'Unknown'
}
get coordinates() {
return this.settings[this.name] ?? [0, 0]
}
get x() {
return this.coordinates[0] ?? 0
}
get y() {
return this.coordinates[1] ?? 0
}
get z() {
return this.result.z.toFixed(3)
}
get subTitle() {
return `(X: ${this.x}, Y: ${this.y}, Z: ${this.z})`
}
get sign() {
return this.result.sign ?? ''
}
get adjust() {
return this.result.adjust ?? '00:00'
}
get is_base() {
return this.result.is_base ?? false
}
}
</script>
+82
View File
@@ -0,0 +1,82 @@
<template>
<div ref="view" class="codeview" @mouseup="mouseUp" @keydown="keyPress"></div>
</template>
<script lang="ts">
import { Component, PropSync, Prop, Vue, Watch } from 'vue-property-decorator'
import { EditorView, basicSetup } from 'codemirror'
import { EditorState } from '@codemirror/state'
@Component({})
export default class CodeStream extends Vue {
@PropSync('currentline') currentLineNumber!: number
@Prop({ type: String, default: '' }) declare document: string
@Prop({ type: Boolean, default: false }) declare isSimulating: boolean
@Prop({ type: Boolean, default: false }) declare shown: boolean
view: EditorView | undefined = undefined
private mounted() {
this.view = new EditorView({
doc: this.document,
extensions: [basicSetup, EditorState.readOnly.of(true)],
parent: this.$refs['view'] as HTMLElement,
})
}
mouseUp() {
if (this.view) {
let line = this.view.state.doc.lineAt(this.view.state.selection.ranges[0].from)
this.$emit('update:currentline', line.to)
this.view.contentDOM.blur()
this.$emit('got-focus')
}
}
keyPress() {
if (this.view) {
let line = this.view.state.doc.lineAt(this.view.state.selection.ranges[0].from)
this.$emit('update:currentline', line.to)
this.$emit('got-focus')
}
}
@Watch('document')
documentUpdated() {
if (this.view && this.shown) {
this.view.dispatch({
changes: {
from: 0,
to: this.view.state.doc.length,
insert: this.document,
},
})
}
}
@Watch('currentLineNumber')
currentlineUpdated(to: number) {
if (this.view && this.shown) {
let line = this.view.state.doc.lineAt(to)
this.view.dispatch({
selection: {
anchor: line.from,
head: line.from,
},
scrollIntoView: true,
})
}
}
}
</script>
<style scoped>
/deep/ .cm-activeLine {
background-color: #333 !important;
}
.codeview {
height: 100%;
overflow: auto;
}
</style>
+82 -6
View File
@@ -19,9 +19,19 @@
</template>
<v-card-text>
<v-row :class="showScrubber ? 'withScrubber' : ''">
<v-col>
<v-col :cols="showGCode ? 8 : 12">
<div ref="viewerCanvasContainer"></div>
</v-col>
<v-col v-show="showGCode" cols="4">
<div class="viewer">
<CodeStream
ref="gcodestream"
:shown="showGCode"
:currentline.sync="scrubPosition"
:document="fileData"
:is-simulating="!printerIsPrinting" />
</div>
</v-col>
</v-row>
<v-row v-show="showScrubber" class="scrubber">
<v-col class="pt-0">
@@ -123,6 +133,14 @@
hide-details
:label="$t('GCodeViewer.ShowTravelMoves')"></v-checkbox>
</v-list-item>
<v-list-item class="minHeight36">
<v-checkbox
v-model="showGCode"
class="mt-0"
hide-details
:label="$t('GCodeViewer.ShowGCode')"></v-checkbox>
</v-list-item>
<v-list-item
v-if="loadedFile === sdCardFilePath && printing_objects.length"
class="minHeight36">
@@ -168,6 +186,13 @@
hide-details
:label="$t('GCodeViewer.SpecularLighting')"></v-checkbox>
</v-list-item>
<v-list-item class="minHeight36">
<v-checkbox
v-model="cncMode"
class="mt-0"
hide-details
:label="$t('GCodeViewer.CNCMode')"></v-checkbox>
</v-list-item>
</v-list>
</v-menu>
</v-col>
@@ -255,6 +280,7 @@ import GCodeViewer from '@sindarius/gcodeviewer'
import axios from 'axios'
import { formatFilesize } from '@/plugins/helpers'
import Panel from '@/components/ui/Panel.vue'
import CodeStream from '@/components/gcodeviewer/CodeStream.vue'
import {
mdiCameraRetake,
mdiCog,
@@ -286,7 +312,7 @@ interface downloadSnackbar {
let viewer: any = null
@Component({
components: { Panel },
components: { Panel, CodeStream },
})
export default class Viewer extends Mixins(BaseMixin) {
/**
@@ -342,6 +368,8 @@ export default class Viewer extends Mixins(BaseMixin) {
name: '',
}
private fileData: string = ''
@Prop({ type: String, default: '', required: false }) declare filename: string
@Ref('fileInput') declare fileInput: HTMLInputElement
@Ref('viewerCanvasContainer') declare viewerCanvasContainer: HTMLElement
@@ -366,6 +394,9 @@ export default class Viewer extends Mixins(BaseMixin) {
await this.init()
if (this.loadedFile !== null) this.scrubFileSize = viewer.fileSize
if (viewer) {
this.fileData = viewer.fileData
}
}
beforeDestroy() {
@@ -405,10 +436,23 @@ export default class Viewer extends Mixins(BaseMixin) {
return this.$store.state.printer.print_stats?.filename ?? ''
}
get currentPosition() {
get livePosition() {
return this.$store.state.printer.motion_report?.live_position ?? [0, 0, 0, 0]
}
get gcodeOffset() {
return this.$store.state.printer?.gcode_move?.homing_origin ?? [0, 0, 0]
}
get currentPosition() {
return [
this.livePosition[0] - this.gcodeOffset[0],
this.livePosition[1] - this.gcodeOffset[1],
this.livePosition[2] - this.gcodeOffset[2],
this.livePosition[3],
]
}
get showTrackingButton() {
return this.printerIsPrinting && this.sdCardFilePath === this.loadedFile
}
@@ -484,13 +528,14 @@ export default class Viewer extends Mixins(BaseMixin) {
}
viewer.gcodeProcessor.useHighQualityExtrusion(this.hdRendering)
viewer.gcodeProcessor.updateForceWireMode(this.forceLineRendering)
viewer.gcodeProcessor.updateForceWireMode(this.forceLineRendering || this.cncMode)
viewer.gcodeProcessor.setAlpha(this.transparency)
viewer.gcodeProcessor.setVoxelMode(this.voxelMode)
viewer.gcodeProcessor.voxelWidth = this.voxelWidth
viewer.gcodeProcessor.voxelHeight = this.voxelHeight
viewer.gcodeProcessor.useSpecularColor(this.specularLighting)
viewer.gcodeProcessor.setLiveTracking(false)
viewer.gcodeProcessor.g1AsExtrusion = this.cncMode
viewer.buildObjects.objectCallback = this.objectCallback
this.loadToolColors(this.extruderColors)
@@ -574,6 +619,7 @@ export default class Viewer extends Mixins(BaseMixin) {
this.fileSize = blob.length
// Do something with result
await viewer.processFile(blob)
this.fileData = viewer.fileData
}
this.finishLoad()
})
@@ -621,6 +667,7 @@ export default class Viewer extends Mixins(BaseMixin) {
viewer.updateRenderQuality(this.renderQuality.value)
await viewer.processFile(text)
this.fileData = viewer.fileData
this.loadingPercent = 100
this.finishLoad()
this.scrubFileSize = viewer.fileSize
@@ -652,6 +699,7 @@ export default class Viewer extends Mixins(BaseMixin) {
this.loading = true
this.loadingPercent = 0
await viewer.reload()
this.fileData = viewer.fileData
this.loadingPercent = 100
this.finishLoad()
}
@@ -694,6 +742,7 @@ export default class Viewer extends Mixins(BaseMixin) {
const offset = 350
if (newVal > 0 && this.printerIsPrinting && this.tracking && newVal > offset) {
viewer.gcodeProcessor.updateFilePosition(newVal - offset)
this.scrubPosition = newVal - offset
} else {
viewer.gcodeProcessor.updateFilePosition(viewer.fileSize)
}
@@ -739,6 +788,18 @@ export default class Viewer extends Mixins(BaseMixin) {
this.$store.dispatch('gui/saveSetting', { name: 'gcodeViewer.showTravelMoves', value: newVal })
}
get showGCode(): boolean {
return this.$store.state.gui.gcodeViewer.showGCode ?? false
}
set showGCode(newVal: boolean) {
this.$store.dispatch('gui/saveSetting', { name: 'gcodeViewer.showGCode', value: newVal })
if (newVal && viewer) {
this.fileData = viewer.fileData
}
this.handleResize()
}
@Watch('showTravelMoves')
showTravelMovesChanged(newVal: boolean) {
viewer?.toggleTravels(newVal)
@@ -784,7 +845,7 @@ export default class Viewer extends Mixins(BaseMixin) {
@Watch('forceLineRendering')
async forceLineRenderingChanged(newVal: boolean) {
if (viewer) {
viewer.gcodeProcessor.updateForceWireMode(newVal)
viewer.gcodeProcessor.updateForceWireMode(newVal || this.cncMode)
await this.reloadViewer()
}
}
@@ -855,6 +916,17 @@ export default class Viewer extends Mixins(BaseMixin) {
}
}
get cncMode() {
return this.$store.state.gui.gcodeViewer.cncMode
}
set cncMode(newVal) {
this.$store.dispatch('gui/saveSetting', { name: 'gcodeViewer.cncMode', value: newVal })
viewer.gcodeProcessor.g1AsExtrusion = newVal
viewer.gcodeProcessor.updateForceWireMode(this.forceLineRendering || newVal)
this.reloadViewer()
}
get extruderColors() {
return this.$store.state.gui.gcodeViewer?.extruderColors ?? false
}
@@ -1044,6 +1116,7 @@ export default class Viewer extends Mixins(BaseMixin) {
this.scrubInterval = setInterval(() => {
this.scrubPosition += 100 * this.scrubSpeed
viewer.gcodeProcessor.updateFilePosition(this.scrubPosition)
viewer.simulateToolPosition()
if (this.tracking || this.scrubPosition >= this.scrubFileSize) {
this.scrubPlaying = false
}
@@ -1062,7 +1135,10 @@ export default class Viewer extends Mixins(BaseMixin) {
@Debounce(200)
@Watch('scrubPosition')
updateScrubPosition(to: number): void {
if (!this.tracking) viewer.gcodeProcessor.updateFilePosition(to)
if (!this.tracking) {
viewer.gcodeProcessor.updateFilePosition(to)
viewer.simulateToolPosition()
}
}
fastForward(): void {
+66
View File
@@ -0,0 +1,66 @@
<template>
<v-col class="pl-6">
<template v-if="selectAll">
<v-checkbox
v-model="selectAllModel"
:label="$t('Settings.GeneralTab.Everything')"
hide-details
class="mt-0"
:indeterminate="selectAllIndeterminate"
@change="$emit('update:selectedCheckboxes', selectedCheckboxes)"></v-checkbox>
<v-divider class="my-2" />
</template>
<template v-for="option in options">
<v-checkbox
:key="option.value"
v-model="selectedCheckboxes"
:label="option.label"
hide-details
class="mt-0"
:value="option.value"
@change="$emit('update:selectedCheckboxes', selectedCheckboxes)"></v-checkbox>
</template>
</v-col>
</template>
<script lang="ts">
import { Component, Mixins, Prop } from 'vue-property-decorator'
import BaseMixin from '../mixins/base'
import { computed } from 'vue'
import { TranslateResult } from 'vue-i18n'
@Component
export default class CheckboxList extends Mixins(BaseMixin) {
@Prop({ required: true })
declare readonly options: { label: string | TranslateResult; value: string }[]
@Prop({ type: Boolean, required: false, default: false })
declare readonly selectAll: boolean
selectedCheckboxes: (string | TranslateResult)[] = []
selectAllIndeterminate: boolean = false
selectAllModel = computed<boolean>({
get: this.getSelectAll,
set: this.setSelectAll,
})
getSelectAll(): boolean {
this.selectAllIndeterminate = false
if (0 < this.selectedCheckboxes.length && this.selectedCheckboxes.length < this.options.length) {
this.selectAllIndeterminate = true
return false
}
return this.selectedCheckboxes.length == this.options.length
}
setSelectAll(state: boolean) {
if (state) {
this.selectedCheckboxes = this.options.map((o) => o.value)
return
}
this.selectedCheckboxes = []
}
}
</script>
+9 -2
View File
@@ -12,13 +12,14 @@ import BaseMixin from '../mixins/base'
import { basicSetup } from 'codemirror'
import { EditorView, keymap } from '@codemirror/view'
import { EditorState } from '@codemirror/state'
import { mainsailTheme } from '@/plugins/codemirrorTheme'
import { vscodeDark } from '@uiw/codemirror-theme-vscode'
import { StreamLanguage } from '@codemirror/language'
import { klipper_config } from '@/plugins/StreamParserKlipperConfig'
import { gcode } from '@/plugins/StreamParserGcode'
import { indentWithTab } from '@codemirror/commands'
import { json } from '@codemirror/lang-json'
import { css } from '@codemirror/lang-css'
import { indentUnit } from '@codemirror/language'
@Component
export default class Codemirror extends Mixins(BaseMixin) {
@@ -81,8 +82,10 @@ export default class Codemirror extends Mixins(BaseMixin) {
get cmExtensions() {
const extensions = [
EditorView.theme({}, { dark: true }),
basicSetup,
mainsailTheme,
vscodeDark,
indentUnit.of(' '.repeat(this.tabSize)),
keymap.of([indentWithTab]),
EditorView.updateListener.of((update) => {
this.content = update.state?.doc.toString()
@@ -103,5 +106,9 @@ export default class Codemirror extends Mixins(BaseMixin) {
visibilityChanged(isVisible: boolean) {
if (isVisible) this.cminstance?.focus()
}
get tabSize() {
return this.$store.state.gui.editor.tabSize || 2
}
}
</script>
+63
View File
@@ -0,0 +1,63 @@
<template>
<div>
<div ref="picker"></div>
</div>
</template>
<script lang="ts">
import { Component, Mixins, Prop, Ref, Watch } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import iro from '@jaames/iro'
import { IroColor } from '@irojs/iro-core'
import { ColorPickerProps, IroColorPicker as IroCP } from '@jaames/iro/dist/ColorPicker.d'
@Component
export default class ColorPicker extends Mixins(BaseMixin) {
colorPicker: IroCP | null = null
@Ref('picker')
readonly picker!: HTMLElement
@Prop({ type: [Object, String], default: '#ffffff' })
readonly color!: IroColor
@Prop({ type: Object, default: () => ({}) })
readonly options!: ColorPickerProps
@Watch('color', { deep: true })
colorChanged(value: string) {
if (this.colorPicker && this.colorPicker.color.rgbString !== value) {
this.colorPicker.color.rgbString = value
}
}
get internalOptions(): ColorPickerProps {
return {
...this.options,
color: this.color,
borderWidth: 2,
sliderSize: 16,
}
}
emitColorChange(color: IroColor) {
this.$emit('change', color)
this.$emit('update:color', color)
}
onColorChange(color: IroColor) {
this.emitColorChange(color)
}
mounted() {
this.colorPicker = iro.ColorPicker(this.picker, this.internalOptions)
this.colorPicker.on('color:change', this.onColorChange)
}
beforeDestroy() {
this.colorPicker?.off('color:change', this.onColorChange)
}
}
</script>
<style scoped></style>
+80 -10
View File
@@ -10,7 +10,7 @@
{{ alias ? alias : macro.name.replace(/_/g, ' ') }}
</v-btn>
<template v-if="paramArray.length">
<v-menu offset-y :close-on-content-click="false">
<v-menu v-if="!isMobile" offset-y :close-on-content-click="false">
<template #activator="{ on, attrs }">
<v-btn
:disabled="disabled"
@@ -22,10 +22,10 @@
<v-icon>{{ mdiMenuDown }}</v-icon>
</v-btn>
</template>
<v-card max-width="200">
<v-card :max-width="paramsOverlayWidth">
<v-card-text class="py-2">
<v-row v-for="(name, key) in paramArray" :key="'param_' + key" class="my-2">
<v-col class="py-0">
<v-row class="my-2">
<v-col v-for="(name, key) in paramArray" :key="'param_' + key" :cols="paramCssCols">
<v-text-field
v-model="params[name].value"
:label="name"
@@ -49,6 +49,47 @@
</v-card-text>
</v-card>
</v-menu>
<template v-else>
<v-btn
:disabled="disabled"
:color="color"
class="minwidth-0 px-1 btnMacroMenu"
small
@click="paramsDialog = true">
<v-icon>{{ mdiMenuDown }}</v-icon>
</v-btn>
<v-dialog v-model="paramsDialog">
<panel :title="macro.name" :card-class="`macro-params-mobile-${macro.name}`" :margin-bottom="false">
<template #buttons>
<v-btn icon tile @click="paramsDialog = false">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-card-text>
<v-row>
<v-col v-for="(name, key) in paramArray" :key="'param_mobile_' + key" :cols="6">
<v-text-field
v-model="params[name].value"
:label="name"
:placeholder="params[name].default"
:persistent-placeholder="true"
hide-details
outlined
dense
clearable
:clear-icon="mdiRefresh"
@keyup.enter="sendWithParams"></v-text-field>
</v-col>
</v-row>
</v-card-text>
<v-card-actions class="px-4 pb-4">
<v-btn color="primary" class="text-uppercase" block @click="sendWithParams">
{{ $t('Panels.MacrosPanel.Send') }}
</v-btn>
</v-card-actions>
</panel>
</v-dialog>
</template>
</template>
</v-item-group>
</template>
@@ -58,7 +99,10 @@ import Component from 'vue-class-component'
import { Mixins, Prop, Watch } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { GuiMacrosStateMacrogroupMacro } from '@/store/gui/macros/types'
import { mdiMenuDown, mdiRefresh } from '@mdi/js'
import { mdiCloseThick, mdiMenuDown, mdiRefresh } from '@mdi/js'
import Panel from '@/components/ui/Panel.vue'
import { TranslateResult } from 'vue-i18n'
import { PrinterStateMacro } from '@/store/printer/types'
interface param {
type: 'int' | 'double' | 'string' | null
@@ -70,25 +114,29 @@ interface params {
[key: string]: param
}
@Component
@Component({
components: { Panel },
})
export default class MacroButton extends Mixins(BaseMixin) {
/**
* Icons
*/
mdiCloseThick = mdiCloseThick
mdiMenuDown = mdiMenuDown
mdiRefresh = mdiRefresh
private paramArray: string[] = []
private params: params = {}
private paramsDialog = false
@Prop({ required: true })
declare readonly macro: GuiMacrosStateMacrogroupMacro
declare readonly macro: GuiMacrosStateMacrogroupMacro | PrinterStateMacro
@Prop({ default: 'primary' })
declare readonly color: string
@Prop({ default: null })
declare readonly alias: string
declare readonly alias: string | TranslateResult
@Prop({ default: false })
declare readonly disabled: boolean
@@ -101,6 +149,24 @@ export default class MacroButton extends Mixins(BaseMixin) {
return this.macro.name.match(/[G|M]\d{1,3}/gm)
}
get paramCols() {
if (this.isMobile) return 1
const cols = Math.ceil(this.paramArray.length / 5)
if (cols > 4) return 4
return cols
}
get paramCssCols() {
return 12 / this.paramCols
}
get paramsOverlayWidth() {
return 200 * this.paramCols
}
@Watch('klipperMacro')
klipperMacroChange() {
this.refreshParams()
@@ -135,9 +201,13 @@ export default class MacroButton extends Mixins(BaseMixin) {
sendWithParams() {
let params: string[] = []
this.paramArray.forEach((paramname: string) => {
if (this.params[paramname].value !== null && this.params[paramname].value !== '') {
let value = this.params[paramname].value?.toString().trim()
if (this.params[paramname].value !== null && value !== '') {
let tmp: string = paramname
tmp += this.isGcodeStyle ? this.params[paramname].value : `=${this.params[paramname].value}`
if (value?.includes(' ')) value = `"${value}"`
tmp += this.isGcodeStyle ? value : `=${value}`
params.push(tmp)
}
@@ -0,0 +1,519 @@
<template>
<v-container :class="containerClass">
<v-row>
<v-col class="pb-3">
<v-subheader class="_light-subheader">
<v-icon v-if="(!root || groups.length === 0) && isOn" small left @click="off">
{{ mdiLightbulbOnOutline }}
</v-icon>
<v-icon v-else-if="!root || groups.length === 0" small left @click="on">
{{ mdiLightbulbOutline }}
</v-icon>
<span>{{ name }}</span>
<v-spacer></v-spacer>
<span
v-if="!root || groups.length === 0"
class="_currentState"
:style="currentStateStyle"
@click="boolDialog = true"></span>
</v-subheader>
</v-col>
</v-row>
<template v-if="root && groups.length">
<miscellaneous-light v-for="group in groups" :key="group.id" :object="object" :group="group" />
</template>
<v-dialog v-model="boolDialog" persistent :width="400">
<panel
:title="name"
:icon="mdiLightbulbOutline"
card-class="temperature-edit-heater-dialog"
:margin-bottom="false">
<template #buttons>
<v-btn icon tile @click="boolDialog = false">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-card-text class="pt-6">
<template v-if="presets.length">
<v-row>
<v-col class="light-presets-container pt-0 d-flex flex-wrap flex-row justify-center">
<v-tooltip v-for="preset in presets" :key="preset.id" top>
<template #activator="{ on, attrs }">
<div
:style="presetStyle(preset)"
v-bind="attrs"
v-on="on"
@click="usePreset(preset)"></div>
</template>
<span>{{ preset.name }}</span>
</v-tooltip>
</v-col>
</v-row>
<v-divider class="my-3"></v-divider>
</template>
<v-row>
<v-col class="text-center">
<color-picker
:color="colorRGB"
:options="colorPickerOptions"
@update:color="onColorRGBChanged" />
<color-picker
v-if="existWhite"
:color="colorRGBW"
:options="colorPickerWhiteOptions"
class="mt-3"
@update:color="onColorWhiteChanged" />
</v-col>
<v-col>
<v-row v-if="existRed">
<v-col>
<number-input
:label="$t('Panels.MiscellaneousPanel.Light.Red')"
param="red"
:target="redInt"
:default-value="Math.round(object.initialRed * 255)"
:min="0"
:max="255"
:dec="1"
:step="1"
:output-error-msg="true"
:has-spinner="true"
@submit="onColorInput" />
</v-col>
</v-row>
<v-row v-if="existGreen">
<v-col>
<number-input
:label="$t('Panels.MiscellaneousPanel.Light.Green')"
param="green"
:target="greenInt"
:default-value="Math.round(object.initialGreen * 255)"
:min="0"
:max="255"
:dec="1"
:step="1"
:has-spinner="true"
@submit="onColorInput" />
</v-col>
</v-row>
<v-row v-if="existBlue">
<v-col>
<number-input
:label="$t('Panels.MiscellaneousPanel.Light.Blue')"
param="blue"
:target="blueInt"
:default-value="Math.round(object.initialBlue * 255)"
:min="0"
:max="255"
:dec="1"
:step="1"
:has-spinner="true"
@submit="onColorInput" />
</v-col>
</v-row>
<v-row v-if="existWhite">
<v-col>
<number-input
:label="$t('Panels.MiscellaneousPanel.Light.White')"
param="white"
:target="whiteInt"
:default-value="Math.round(object.initialWhite * 255)"
:min="0"
:max="255"
:dec="1"
:step="1"
:has-spinner="true"
@submit="onColorInput" />
</v-col>
</v-row>
</v-col>
</v-row>
</v-card-text>
</panel>
</v-dialog>
</v-container>
</template>
<script lang="ts">
import { convertName } from '@/plugins/helpers'
import { Component, Mixins, Prop } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { mdiCloseThick, mdiLightbulbOutline, mdiLightbulbOnOutline } from '@mdi/js'
import { PrinterStateLight } from '@/store/printer/types'
import ColorPicker from '@/components/inputs/ColorPicker.vue'
import { ColorPickerProps } from '@jaames/iro/dist/ColorPicker.d'
import { Debounce } from 'vue-debounce-decorator'
import iro from '@jaames/iro'
import { IroColor } from '@irojs/iro-core'
import { GuiMiscellaneousStateEntryLightgroup, GuiMiscellaneousStateEntryPreset } from '@/store/gui/miscellaneous/types'
interface ColorData {
red: number | null
green: number | null
blue: number | null
white: number | null
}
@Component({
components: {
ColorPicker,
},
})
export default class MiscellaneousLight extends Mixins(BaseMixin) {
mdiCloseThick = mdiCloseThick
mdiLightbulbOutline = mdiLightbulbOutline
mdiLightbulbOnOutline = mdiLightbulbOnOutline
@Prop({ type: Object, required: true })
declare object: PrinterStateLight
@Prop({ type: Boolean, default: false }) readonly root!: boolean
@Prop(Object) readonly group!: GuiMiscellaneousStateEntryLightgroup | undefined
private boolDialog = false
private inputValue = 0
get name() {
if (this.group) return convertName(this.group.name)
return convertName(this.object.name)
}
get colorPickerOptions() {
let options: ColorPickerProps = {
width: 200,
margin: 15,
layout: [],
}
if (this.existRed) {
// @ts-ignore
options?.layout.push({
component: iro.ui.Slider,
options: {
sliderType: 'red',
},
})
}
if (this.existGreen) {
// @ts-ignore
options?.layout.push({
component: iro.ui.Slider,
options: {
sliderType: 'green',
},
})
}
if (this.existBlue) {
// @ts-ignore
options?.layout.push({
component: iro.ui.Slider,
options: {
sliderType: 'blue',
},
})
}
if (this.existRed && this.existGreen && this.existBlue) {
options.layout = [
{
component: iro.ui.Wheel,
},
{
component: iro.ui.Slider,
options: {
sliderType: 'value',
},
},
]
}
return options
}
get colorPickerWhiteOptions() {
let options: ColorPickerProps = {
width: 200,
margin: 15,
layout: [
{
component: iro.ui.Slider,
options: {
sliderType: 'alpha',
},
},
],
}
return options
}
get optionsColors() {
let output: string[] = []
this.presets.forEach((preset: GuiMiscellaneousStateEntryPreset) => {
output.push(`rgb(${preset.red}%, ${preset.green}%, ${preset.blue}%)`)
})
return output
}
get current() {
const color: ColorData = {
red: 0,
green: 0,
blue: 0,
white: null,
}
if (this.existWhite) color.white = 0
if (this.object.colorData.length === 0) return color
const firstColorData = this.object.colorData[(this.group?.start ?? 1) - 1]
color.red = firstColorData[0] * 255
color.green = firstColorData[1] * 255
color.blue = firstColorData[2] * 255
if (this.object.colorOrder.indexOf('W') !== -1) color.white = firstColorData[3] * 255
return color
}
get isOn() {
return (
(this.current.red ?? 0) +
(this.current?.green ?? 0) +
(this.current.blue ?? 0) +
(this.current.white ?? 0) >
0
)
}
get existRed() {
return this.object.colorOrder.indexOf('R') !== -1
}
get existGreen() {
return this.object.colorOrder.indexOf('G') !== -1
}
get existBlue() {
return this.object.colorOrder.indexOf('B') !== -1
}
get existWhite() {
return this.object.colorOrder.indexOf('W') !== -1
}
get currentStateStyle() {
let output = this.colorRGB
if (this.current.white !== null && this.current.red == 0 && this.current.green == 0 && this.current.blue == 0)
output = `rgb(${this.current.white * 255}, ${this.current.white * 255}, ${this.current.white * 255})`
return {
'background-color': output,
}
}
get colorRGB() {
return `rgb(${Math.round(this.current.red ?? 0)}, ${Math.round(this.current.green ?? 0)}, ${Math.round(
this.current.blue ?? 0
)})`
}
get colorRGBW() {
return `rgba(255, 255, 255, ${(this.current.white ?? 0) / 255})`
}
get redInt() {
return Math.round(this.current.red ?? 0)
}
get greenInt() {
return Math.round(this.current.green ?? 0)
}
get blueInt() {
return Math.round(this.current.blue ?? 0)
}
get whiteInt() {
return Math.round(this.current.white ?? 0)
}
get groups() {
return (
this.$store.getters['gui/miscellaneous/getEntryLightgroups']({
type: this.object.type,
name: this.object.name,
}) ?? []
)
}
get presets() {
return (
this.$store.getters['gui/miscellaneous/getEntryPresets']({
type: this.object.type,
name: this.object.name,
}) ?? []
)
}
get containerClass() {
let output = ['px-0']
output.push(this.root ? 'py-2' : 'pt-2 pb-0')
return output
}
colorChanged(color: ColorData) {
if (
Math.round(color.red ?? 0) === Math.round(this.current.red ?? 0) &&
Math.round(color.green ?? 0) === Math.round(this.current.green ?? 0) &&
Math.round(color.blue ?? 0) === Math.round(this.current.blue ?? 0) &&
Math.round(color.white ?? 0) === Math.round(this.current.white ?? 0)
)
return
const red = Math.round(((color.red ?? 0) / 255) * 10000) / 10000
const green = Math.round(((color.green ?? 0) / 255) * 10000) / 10000
const blue = Math.round(((color.blue ?? 0) / 255) * 10000) / 10000
const white = Math.round(((color.white ?? 0) / 255) * 10000) / 10000
let gcode = `SET_LED LED="${this.object.name}" RED=${red} GREEN=${green} BLUE=${blue}`
if (this.existWhite) gcode += ` WHITE=${white}`
gcode += ` SYNC=0`
if (this.group) {
const tmp = gcode
for (let i = this.group.start; i <= this.group.end; i++) {
if (i === this.group.start) {
gcode += ` INDEX=${i}`
continue
}
gcode += `\n${tmp} INDEX=${i}`
}
}
gcode += ` TRANSMIT=1`
this.$store.dispatch('server/addEvent', {
message: gcode,
type: 'command',
})
this.$socket.emit('printer.gcode.script', { script: gcode })
}
@Debounce({ time: 500 })
onColorRGBChanged(payload: IroColor) {
const color: ColorData = {
red: payload.red,
green: payload.green,
blue: payload.blue,
white: this.current.white,
}
this.colorChanged(color)
}
@Debounce({ time: 500 })
onColorWhiteChanged(payload: IroColor) {
const color: ColorData = {
red: this.current.red,
green: this.current.green,
blue: this.current.blue,
white: this.current.white,
}
// @ts-ignore
color.white = payload.alpha * 255
this.colorChanged(color)
}
@Debounce({ time: 500 })
onColorInput(payload: { name: string; value: number }) {
const color: ColorData = {
red: this.current.red,
green: this.current.green,
blue: this.current.blue,
white: this.current.white,
}
// @ts-ignore
color[payload.name] = payload.value
this.colorChanged(color)
}
off() {
const color: ColorData = {
red: 0,
green: 0,
blue: 0,
white: 0,
}
this.colorChanged(color)
}
on() {
const color: ColorData = {
red: 255,
green: 255,
blue: 255,
white: 255,
}
this.colorChanged(color)
}
presetStyle(preset: GuiMiscellaneousStateEntryPreset) {
if ((preset?.red ?? 0) + (preset?.green ?? 0) + (preset?.blue ?? 0) === 0 && (preset?.white ?? 0) > 0) {
return {
backgroundColor: `rgb(${preset.white}%, ${preset.white}%, ${preset.white}%)`,
}
}
return {
backgroundColor: `rgb(${preset.red}%, ${preset.green}%, ${preset.blue}%)`,
}
}
usePreset(preset: GuiMiscellaneousStateEntryPreset) {
const color: ColorData = { ...preset }
this.colorChanged(color)
}
}
</script>
<style scoped>
._light-subheader {
height: auto;
}
._currentState {
width: 15px;
height: 15px;
border-radius: 50%;
border: 1px solid lightgray;
cursor: pointer;
}
.light-presets-container {
gap: 6px;
}
.light-presets-container > div {
width: 28px;
height: 28px;
border-radius: 4px;
cursor: pointer;
}
</style>
+45 -5
View File
@@ -3,7 +3,18 @@
<v-row>
<v-col :class="pwm ? 'pb-1' : 'pb-3'">
<v-subheader class="_fan-slider-subheader">
<v-icon v-if="type !== 'output_pin'" small :class="fanClasses">{{ mdiFan }}</v-icon>
<v-icon
v-if="type === 'led' && target > 0"
class="mr-2"
small
:retain-focus-on-click="true"
@click="ledOff">
{{ mdiLightbulbOnOutline }}
</v-icon>
<v-icon v-else-if="type === 'led'" class="mr-2" small :retain-focus-on-click="true" @click="ledOn">
{{ mdiLightbulbOutline }}
</v-icon>
<v-icon v-else-if="type !== 'output_pin'" small :class="fanClasses">{{ mdiFan }}</v-icon>
<span>{{ convertName(name) }}</span>
<v-spacer></v-spacer>
<small v-if="rpm !== null" :class="rpmClasses">{{ Math.round(rpm ?? 0) }} RPM</small>
@@ -65,7 +76,7 @@
</template>
<template #append>
<v-icon :disabled="isLocked || sliderValue >= max" @click="increment">{{ mdiPlus }}</v-icon>
<v-icon :disabled="isLocked || sliderValue >= 1" @click="increment">{{ mdiPlus }}</v-icon>
</template>
</v-slider>
</v-card-text>
@@ -87,6 +98,8 @@ import {
mdiPlus,
mdiToggleSwitch,
mdiToggleSwitchOffOutline,
mdiLightbulbOutline,
mdiLightbulbOnOutline,
} from '@mdi/js'
@Component
@@ -98,6 +111,8 @@ export default class MiscellaneousSlider extends Mixins(BaseMixin) {
mdiLockOpenVariantOutline = mdiLockOpenVariantOutline
mdiMinus = mdiMinus
mdiPlus = mdiPlus
mdiLightbulbOutline = mdiLightbulbOutline
mdiLightbulbOnOutline = mdiLightbulbOnOutline
convertName = convertName
private declare timeout: ReturnType<typeof setTimeout>
@@ -135,6 +150,9 @@ export default class MiscellaneousSlider extends Mixins(BaseMixin) {
@Prop({ type: Number, default: 0 })
declare off_below: number
@Prop({ type: String, default: '' })
declare colorOrder: string
get value(): number {
return Math.round((this.target / this.max) * 100) / 100
}
@@ -187,6 +205,8 @@ export default class MiscellaneousSlider extends Mixins(BaseMixin) {
if (this.type === 'fan') gcode = `M106 S${newVal.toFixed(0)}`
if (this.type === 'fan_generic') gcode = `SET_FAN_SPEED FAN=${this.name} SPEED=${newVal}`
if (this.type === 'output_pin') gcode = `SET_PIN PIN=${this.name} VALUE=${newVal.toFixed(2)}`
if (this.type === 'led')
gcode = `SET_LED LED=${this.name} ${this.ledChannelName}=${newVal.toFixed(2)} SYNC=0 TRANSMIT=1`
if (gcode !== '') {
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
@@ -196,6 +216,14 @@ export default class MiscellaneousSlider extends Mixins(BaseMixin) {
this.startLockTimer()
}
ledOff() {
this.sendCmd(0)
}
ledOn() {
this.sendCmd(1)
}
switchOutputPin(): void {
const newVal = this.value ? 0 : 1
const gcode = `SET_PIN PIN=${this.name} VALUE=${(newVal * this.multi).toFixed(2)}`
@@ -250,9 +278,13 @@ export default class MiscellaneousSlider extends Mixins(BaseMixin) {
return errors
}
get disableFanAnimation() {
return this.$store.state.gui.uiSettings.disableFanAnimation ?? false
}
get fanClasses() {
const output = ['mr-2']
if (this.value >= this.off_below && this.value > 0) output.push('icon-rotate')
if (!this.disableFanAnimation && this.value >= this.off_below && this.value > 0) output.push('icon-rotate')
return output
}
@@ -266,6 +298,14 @@ export default class MiscellaneousSlider extends Mixins(BaseMixin) {
return output
}
get ledChannelName() {
if (this.colorOrder === 'R') return 'RED'
if (this.colorOrder === 'G') return 'GREEN'
if (this.colorOrder === 'B') return 'BLUE'
return 'WHITE'
}
submitInput(): void {
if (this.errors.length > 0) return
@@ -313,8 +353,8 @@ export default class MiscellaneousSlider extends Mixins(BaseMixin) {
}
._slider-input {
font-size: 0.875rem;
max-width: 5.4rem;
min-width: 4.2rem;
max-width: 5rem;
margin-left: 12px;
}
+65 -82
View File
@@ -1,40 +1,26 @@
<style scoped>
._spin_button_group {
width: 24px;
margin-top: -6px;
margin-left: -6px;
margin-bottom: -6px;
}
.v-input--has-state {
margin-bottom: -18px !important;
}
</style>
<template>
<form @submit.prevent="submit">
<v-text-field
v-model.number="value"
v-model="value"
:label="label"
:suffix="unit"
:error="invalidInput()"
:error-messages="inputErrors()"
:error="invalidInput"
:error-messages="inputErrors"
:disabled="disabled"
:step="step"
:min="min"
:max="max"
:dec="dec"
type="number"
hide-spin-buttons
hide-details="auto"
outlined
dense
class="d-flex align-top"
@blur="value = target"
@blur="value = target.toString()"
@focus="$event.target.select()"
@keydown="checkInvalidChars">
<template v-if="defaultValue" #append>
<v-icon @click="resetToDefault">{{ value !== defaultValue ? mdiRestart : '' }}</v-icon>
<v-icon @click="resetToDefault">{{ value !== defaultValue.toString() ? mdiRestart : '' }}</v-icon>
</template>
<template v-if="hasSpinner" #append-outer>
<div class="_spin_button_group">
@@ -67,6 +53,7 @@ import Component from 'vue-class-component'
import { Mixins, Prop, Watch } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { mdiChevronDown, mdiChevronUp, mdiRestart } from '@mdi/js'
import { TranslateResult } from 'vue-i18n'
@Component
export default class NumberInput extends Mixins(BaseMixin) {
@@ -74,89 +61,68 @@ export default class NumberInput extends Mixins(BaseMixin) {
mdiChevronUp = mdiChevronUp
mdiChevronDown = mdiChevronDown
private value: number = 0
private value: string = '0'
private error: boolean = false
private invalidChars: string[] = ['e', 'E', '+']
// input field name and identifier
@Prop({ type: String, required: true })
declare readonly label: string
@Prop({ type: String, required: true })
declare readonly param: string
@Prop({ required: true }) declare readonly label: TranslateResult | string
@Prop({ type: String, required: true }) declare readonly param: string
// props defining incoming data
@Prop({ type: Number, required: true })
declare readonly target: number
@Prop({ type: Number, required: false })
declare readonly defaultValue: number
@Prop({ type: Number, required: true }) declare readonly target: number
@Prop({ type: Number, required: false }) declare readonly defaultValue: number
// props for internal processing
@Prop({ type: Number, required: true })
declare readonly min: number
@Prop({ type: Number, default: null })
declare readonly max: number | null
@Prop({ type: Number, required: true })
declare readonly dec: number
@Prop({ type: Number, required: false, default: 1 })
declare readonly step: number
@Prop({ type: String, required: false })
declare readonly unit: string
@Prop({ type: Number, required: true }) declare readonly min: number
@Prop({ default: null }) declare readonly max: number | null
@Prop({ type: Number, required: true }) declare readonly dec: number
@Prop({ type: Number, required: false, default: 1 }) declare readonly step: number
@Prop({ type: String, required: false }) declare readonly unit: string
// spinner related props
@Prop({ type: Boolean, required: false, default: false })
declare readonly hasSpinner: boolean
@Prop({ type: Number, required: false, default: 1 })
declare readonly spinnerFactor: number
@Prop({ type: Boolean, required: false, default: false }) declare readonly hasSpinner: boolean
@Prop({ type: Number, required: false, default: 1 }) declare readonly spinnerFactor: number
// props for general internal behaviour
@Prop({ type: Boolean, required: false, default: false })
declare readonly disabled: boolean
@Prop({ type: Boolean, required: false, default: false })
declare readonly outputErrorMsg: boolean
@Prop({ type: Boolean, required: false, default: false }) declare readonly disabled: boolean
@Prop({ type: Boolean, required: false, default: false }) declare readonly outputErrorMsg: boolean
created(): void {
this.value = this.target
this.value = this.target.toString()
}
@Watch('target')
updateTarget(): void {
this.value = this.target
this.value = this.target.toString()
}
incrementValue(): void {
if (this.value + this.step * this.spinnerFactor < this.max! || this.max === null) {
this.value = Math.round((this.value + this.step * this.spinnerFactor) * 10 ** this.dec) / 10 ** this.dec
} else {
this.value = this.max
}
if (this.inputValue + this.step * this.spinnerFactor < this.max! || this.max === null) {
this.value = (
Math.round((this.inputValue + this.step * this.spinnerFactor) * 10 ** this.dec) /
10 ** this.dec
).toString()
} else this.value = this.max.toString()
this.submit()
}
decrementValue(): void {
if (this.value - this.step * this.spinnerFactor > this.min) {
this.value = Math.round((this.value - this.step * this.spinnerFactor) * 10 ** this.dec) / 10 ** this.dec
} else {
this.value = this.min
}
if (this.inputValue - this.step * this.spinnerFactor > this.min) {
this.value = (
Math.round((this.inputValue - this.step * this.spinnerFactor) * 10 ** this.dec) /
10 ** this.dec
).toString()
} else this.value = this.min.toString()
this.submit()
}
resetToDefault(): void {
this.value = this.defaultValue
this.value = this.defaultValue.toString()
this.submit()
}
submit(): void {
if (this.invalidInput()) return
this.$emit('submit', { name: this.param, value: this.value })
if (this.invalidInput) return
this.$emit('submit', { name: this.param, value: this.inputValue })
}
// input validation //
@@ -166,27 +132,44 @@ export default class NumberInput extends Mixins(BaseMixin) {
if (this.invalidChars.includes(event.key)) event.preventDefault()
}
invalidInput(): boolean {
return this.value.toString() === '' || this.value < this.min || (this.value > this.max! && this.max !== null)
// this function only parse this.value, to escape an empty input
get inputValue(): number {
if (this.value.toString() === '') return 0
return parseFloat(this.value.replace(',', '.'))
}
inputErrors() {
get invalidInput(): boolean {
return this.inputErrors.length > 0
}
get inputErrors() {
if (!this.outputErrorMsg) return []
const errors = []
if (this.value.toString() === '') {
// "Input must not be empty!"
errors.push(this.$t('App.NumberInput.NoEmptyAllowedError'))
}
if (this.max === null && this.value < this.min) {
if (this.max === null && this.inputValue < this.min) {
// "Must be grater or equal than {min}!"
errors.push(this.$t('App.NumberInput.GreaterOrEqualError', { min: this.min }))
}
if (this.max !== null && (this.value > this.max! || this.value < this.min)) {
if (this.max !== null && (this.inputValue > this.max! || this.inputValue < this.min)) {
// "Must be between {min} and {max}!"
errors.push(this.$t('App.NumberInput.MustBeBetweenError', { min: this.min, max: this.max }))
}
return errors
}
}
</script>
<style scoped>
._spin_button_group {
width: 24px;
margin-top: -6px;
margin-left: -6px;
margin-bottom: -6px;
}
.v-input--has-state {
margin-bottom: -18px !important;
}
</style>
+30 -26
View File
@@ -1,26 +1,3 @@
<style scoped>
._temp-input {
font-size: 0.875rem;
min-width: 4rem;
max-width: 5rem;
}
._temp-input >>> .v-input__slot {
min-height: 1rem !important;
padding-left: 8px !important;
padding-right: 8px !important;
}
._temp-input >>> .v-text-field__slot input {
padding: 4px 0 4px;
}
._preset {
font-size: 0.8125rem;
font-weight: 500;
}
</style>
<template>
<div class="d-flex align-center">
<form @submit.prevent="setTemps">
@@ -57,11 +34,11 @@
link
style="min-height: 32px"
@click="doSend(`${command} ${attributeName}=${name} TARGET=${preset.value}`)">
<div class="d-flex align-center _preset">
<v-icon v-if="preset.value === 0" else color="primary" small class="mr-1">
<div class="_preset">
<v-icon v-if="preset.value === 0" else color="primary" small class="_preset-icon">
{{ mdiSnowflake }}
</v-icon>
<v-icon v-else small class="mr-1">{{ mdiFire }}</v-icon>
<v-icon v-else small class="_preset-icon">{{ mdiFire }}</v-icon>
<span style="padding-top: 2px">{{ preset.value }}°C</span>
</div>
</v-list-item>
@@ -124,3 +101,30 @@ export default class TemperatureInput extends Mixins(BaseMixin, ControlMixin) {
}
}
</script>
<style scoped>
._temp-input {
min-width: 4.2rem;
max-width: 5rem;
}
._temp-input >>> .v-input__slot {
min-height: 1rem !important;
padding-left: 8px !important;
padding-right: 8px !important;
}
._temp-input >>> .v-text-field__slot input {
padding-top: 4px;
padding-bottom: 4px;
}
._preset {
font-size: 0.875rem;
}
._preset-icon {
margin-top: -1px;
margin-right: 4px;
}
</style>
+53 -51
View File
@@ -1,53 +1,3 @@
<style scoped>
._tool-slider-subheader {
height: auto;
}
._lock-button {
margin-left: -6px;
}
._error-msg {
color: #ff5252;
font-size: 12px;
padding: 4px 16px 2px 0;
}
.fade-enter-active {
animation: slide-in 0.15s reverse;
opacity: 1;
}
.fade-leave-active {
animation: slide-in 0.15s;
opacity: 1;
}
@keyframes slide-in {
100% {
transform: translateY(-5px);
}
}
._slider-input {
font-size: 0.875rem;
max-width: 5.4rem;
margin-left: 12px;
}
._slider-input >>> .v-input__slot {
min-height: 1rem !important;
}
._slider-input >>> .v-text-field__slot input {
padding: 4px 0 4px;
}
._slider-input >>> .v-input__append-inner {
margin: auto -5px auto 0 !important;
}
</style>
<template>
<v-row dense>
<v-col class="pa-0">
@@ -135,6 +85,7 @@ import { Component, Mixins, Prop, Watch } from 'vue-property-decorator'
import { Debounce } from 'vue-debounce-decorator'
import BaseMixin from '@/components/mixins/base'
import { mdiLockOpenVariantOutline, mdiLockOutline, mdiMinus, mdiPlus, mdiRestart } from '@mdi/js'
import { TranslateResult } from 'vue-i18n'
@Component
export default class ToolSlider extends Mixins(BaseMixin) {
@@ -157,7 +108,7 @@ export default class ToolSlider extends Mixins(BaseMixin) {
@Prop({ type: Number, required: true }) declare readonly target: number
@Prop({ type: String, required: true }) declare readonly command: string
@Prop({ type: String, default: '' }) declare readonly attributeName: string
@Prop({ type: String, default: '' }) declare readonly label: string
@Prop({ default: '' }) declare readonly label: string | TranslateResult
@Prop({ type: String, default: '' }) declare readonly icon: string
@Prop({ type: String, default: '%' }) declare readonly unit: string
@Prop({ type: Number, default: 1 }) declare readonly attributeScale: number
@@ -301,3 +252,54 @@ export default class ToolSlider extends Mixins(BaseMixin) {
}
}
</script>
<style scoped>
._tool-slider-subheader {
height: auto;
}
._lock-button {
margin-left: -6px;
}
._error-msg {
color: #ff5252;
font-size: 12px;
padding: 4px 16px 2px 0;
}
.fade-enter-active {
animation: slide-in 0.15s reverse;
opacity: 1;
}
.fade-leave-active {
animation: slide-in 0.15s;
opacity: 1;
}
@keyframes slide-in {
100% {
transform: translateY(-5px);
}
}
._slider-input {
min-width: 4.2rem;
max-width: 5rem;
margin-left: 12px;
}
._slider-input >>> .v-input__slot {
min-height: 1rem !important;
}
._slider-input >>> .v-text-field__slot input {
padding-top: 4px;
padding-bottom: 4px;
}
._slider-input >>> .v-input__append-inner {
margin: auto -5px auto 0 !important;
}
</style>
+137
View File
@@ -1,5 +1,7 @@
import Vue from 'vue'
import Component from 'vue-class-component'
import { DateTimeFormatOptions } from 'vue-i18n'
import { ServerPowerStateDevice } from '@/store/server/power/types'
@Component
export default class BaseMixin extends Vue {
@@ -11,6 +13,10 @@ export default class BaseMixin extends Vue {
return this.$store.getters['socket/getHostUrl']
}
get hostPort(): boolean {
return this.$store.state.socket.port ?? 80
}
get instancesDB() {
return this.$store.state.instancesDB ?? 'moonraker'
}
@@ -28,6 +34,8 @@ export default class BaseMixin extends Vue {
}
get klipperState(): string {
if (!this.klippyIsConnected) return 'disconnected'
return this.$store.state.server.klippy_state ?? ''
}
@@ -39,6 +47,35 @@ export default class BaseMixin extends Vue {
return this.klipperReadyForGui && ['printing', 'paused'].includes(this.printer_state)
}
get printerIsPrintingOnly() {
return this.klipperReadyForGui && this.printer_state === 'printing'
}
get printerPowerDevice(): string {
let deviceName = this.$store.state.gui.uiSettings.powerDeviceName ?? null
if (deviceName === null) deviceName = 'printer'
return deviceName
}
get isPrinterPowerOff() {
const devices = this.$store.getters['server/power/getDevices'] ?? []
if (devices.length === 0) return false
const deviceIndex = devices.findIndex(
(device: ServerPowerStateDevice) => device.device === this.printerPowerDevice
)
// stop if device is not found
if (deviceIndex === -1) return false
const device = devices[deviceIndex]
// Printer is on, if device status is "on" or "error"
if (device.status !== 'off') return false
// if klippy is not connected (service shutdown) and device.status === off
return !this.klippyIsConnected
}
get loadings(): string[] {
return this.$store.state.socket.loadings ?? []
}
@@ -78,6 +115,14 @@ export default class BaseMixin extends Vue {
return 'ontouchstart' in window || (navigator.maxTouchPoints > 0 && navigator.maxTouchPoints !== 256)
}
get isIOS() {
return !!(
navigator.userAgent.match(/(iPad|iPhone|iPod)/) ||
// @ts-ignore
(navigator.platform === 'MacIntel' && typeof navigator.standalone !== 'undefined')
)
}
get moonrakerComponents() {
return this.$store.state.server?.components ?? []
}
@@ -87,4 +132,96 @@ export default class BaseMixin extends Vue {
return roots.findIndex((root: string) => root === 'gcodes') >= 0
}
get formatDateOptions(): DateTimeFormatOptions {
const format = this.$store.state.gui.general.dateFormat
switch (format) {
case '2-digits':
return { day: '2-digit', month: '2-digit', year: 'numeric' }
case 'short':
return { day: '2-digit', month: 'short', year: 'numeric' }
default:
return { dateStyle: 'medium' }
}
}
get formatTimeOptions(): DateTimeFormatOptions {
const format = this.$store.state.gui.general.timeFormat
switch (format) {
case '24hours':
return { hour: '2-digit', minute: '2-digit', hourCycle: 'h23' }
case '12hours':
return { hour: '2-digit', minute: '2-digit', hourCycle: 'h12' }
default:
return { timeStyle: 'short' }
}
}
get formatTimeWithSecondsOptions(): DateTimeFormatOptions {
const format = this.$store.state.gui.general.timeFormat
switch (format) {
case '24hours':
return { hour: '2-digit', minute: '2-digit', second: '2-digit', hourCycle: 'h23' }
case '12hours':
return { hour: '2-digit', minute: '2-digit', second: '2-digit', hourCycle: 'h12' }
default:
return { timeStyle: 'short' }
}
}
get browserLocale() {
return navigator.language
}
get hours12Format() {
const setting = this.$store.state.gui.general.timeFormat
if (setting === '12hours') return true
if (setting === null && this.browserLocale === 'en-US') return true
return false
}
formatDate(value: number | Date): string {
let tmp = null
try {
// @ts-ignore
tmp = (typeof value.getMonth === 'function' ? value : new Date(value)) as Date
} catch (_) {
return 'UNKNOWN'
}
return tmp.toLocaleDateString(this.browserLocale, this.formatDateOptions)
}
formatTime(value: number | Date, boolSeconds = false): string {
let tmp = null
try {
// @ts-ignore
tmp = (typeof value.getMonth === 'function' ? value : new Date(value)) as Date
} catch (_) {
return 'UNKNOWN'
}
if (boolSeconds) return tmp.toLocaleTimeString(this.browserLocale, this.formatTimeWithSecondsOptions)
return tmp.toLocaleTimeString(this.browserLocale, this.formatTimeOptions)
}
formatDateTime(value: number, boolSeconds = false): string {
const date = this.formatDate(value)
const time = this.formatTime(value, boolSeconds)
return `${date} ${time}`
}
}
+40 -106
View File
@@ -1,33 +1,22 @@
import Component from 'vue-class-component'
import BaseMixin from '@/components/mixins/base'
import { allDashboardPanels } from '@/store/variables'
import { capitalize } from '@/plugins/helpers'
import { GuiMacrosStateMacrogroup } from '@/store/gui/macros/types'
import kebabCase from 'lodash.kebabcase'
import Vue from 'vue'
import {
mdiArrowCollapseVertical,
mdiCodeTags,
mdiConsoleLine,
mdiDipSwitch,
mdiEngine,
mdiGamepad,
mdiInformation,
mdiPrinter3dNozzle,
mdiThermometerLines,
mdiWebcam,
} from '@mdi/js'
@Component
export default class DashboardMixin extends BaseMixin {
get printerKinematics() {
return this.$store.getters['printer/getKinematics']
}
get printerExtruderCount() {
return this.$store.getters['printer/getExtruders'].length
}
get printerAvailableHeatersCount() {
return this.$store.getters['printer/getAvailableHeaters'].length
}
get printerTemperatureSensorsCount() {
return this.$store.getters['printer/getTemperatureSensors'].length
}
get macroMode() {
return this.$store.state.gui.macros.mode ?? 'simple'
}
get macrogroups() {
return this.$store.getters['gui/macros/getAllMacrogroups'] ?? []
}
@@ -36,89 +25,6 @@ export default class DashboardMixin extends BaseMixin {
return this.$store.getters['gui/webcams/getWebcams'] ?? []
}
get missingPanelsMobile() {
const panels = [...this.$store.state.gui.dashboard.mobileLayout]
return this.checkMissingPanels(panels)
}
get missingPanelsTablet() {
const panels = [
...this.$store.state.gui.dashboard.tabletLayout1,
...this.$store.state.gui.dashboard.tabletLayout2,
]
return this.checkMissingPanels(panels)
}
get missingPanelsDesktop() {
const panels = [
...this.$store.state.gui.dashboard.desktopLayout1,
...this.$store.state.gui.dashboard.desktopLayout2,
]
return this.checkMissingPanels(panels)
}
get missingPanelsWidescreen() {
const panels = [
...this.$store.state.gui.dashboard.widescreenLayout1,
...this.$store.state.gui.dashboard.widescreenLayout2,
...this.$store.state.gui.dashboard.widescreenLayout3,
]
return this.checkMissingPanels(panels)
}
get allPossiblePanels() {
let allPanels = [...allDashboardPanels]
// remove macros panel and add macrogroups panels if macroMode === expert
if (this.macroMode === 'expert') {
this.macrogroups.forEach((group: GuiMacrosStateMacrogroup) => {
allPanels.push('macrogroup_' + group.id)
})
allPanels = allPanels.filter((name) => name !== 'macros')
}
// remove toolhead panel, if kinematics === none
if (this.printerKinematics === 'none') {
allPanels = allPanels.filter((name) => name !== 'toolhead-control')
}
// remove extruder panel, if printerExtruderCount < 1
if (this.printerExtruderCount < 1) {
allPanels = allPanels.filter((name) => name !== 'extruder-control')
}
// remove temperature panel, if heaters & sensors < 1
if (this.printerAvailableHeatersCount + this.printerTemperatureSensorsCount < 1) {
allPanels = allPanels.filter((name) => name !== 'temperature')
}
// remove webcam panel, if no webcam exists
if (this.webcams.length === 0) {
allPanels = allPanels.filter((name) => name !== 'webcam')
}
return allPanels
}
checkMissingPanels(panels: any[]) {
const missingPanels: any[] = []
this.allPossiblePanels.forEach((panelname) => {
if (!panels.find((panel) => panel.name === panelname))
missingPanels.push({
name: panelname,
visible: true,
})
})
return missingPanels
}
getPanelName(name: string) {
if (name.startsWith('macrogroup_')) {
const groupId = name.split('_')[1] ?? ''
@@ -138,4 +44,32 @@ export default class DashboardMixin extends BaseMixin {
return this.$t(`Panels.${capitalize(name)}Panel.Headline`)
}
convertPanelnameToIcon(name: string): string {
if (name.startsWith('macrogroup_')) return mdiCodeTags
switch (name) {
case 'webcam':
return mdiWebcam
case 'zoffset':
return mdiArrowCollapseVertical
case 'toolhead-control':
return mdiGamepad
case 'macros':
return mdiCodeTags
case 'miscellaneous':
return mdiDipSwitch
case 'temperature':
return mdiThermometerLines
case 'miniconsole':
return mdiConsoleLine
case 'machine-settings':
return mdiEngine
case 'extruder-control':
return mdiPrinter3dNozzle
default:
return mdiInformation
}
}
}
+40
View File
@@ -0,0 +1,40 @@
import Vue from 'vue'
import { Component } from 'vue-property-decorator'
@Component
export default class ExtruderMixin extends Vue {
get activeExtruder(): string {
return this.$store.state.printer.toolhead?.extruder
}
get activeExtruderSettings(): any {
return this.$store.state.printer.configfile?.settings?.[this.activeExtruder]
}
get filamentDiameter(): number {
return this.activeExtruderSettings?.filament_diameter ?? 1.75
}
get nozzleDiameter(): number {
return this.activeExtruderSettings?.nozzle_diameter ?? 0.4
}
get feedamount(): number {
return parseFloat(this.$store.state.gui.control.extruder.feedamount)
}
get feedrate(): number {
return parseFloat(this.$store.state.gui.control.extruder.feedrate)
}
get extrudeFactor() {
return this.$store.state.printer?.gcode_move?.extrude_factor ?? 1
}
get extrudePossible(): boolean {
return this.$store.getters['printer/getExtrudePossible']
}
get minExtrudeTemp(): number {
return this.activeExtruderSettings?.min_extrude_temp ?? 170
}
}
+173
View File
@@ -0,0 +1,173 @@
import Component from 'vue-class-component'
import routes, { AppRoute } from '@/routes'
import { Mixins, Watch } from 'vue-property-decorator'
import { mdiLinkVariant, mdiViewDashboardOutline } from '@mdi/js'
import BaseMixin from '@/components/mixins/base'
import { PrinterStateKlipperConfig } from '@/store/printer/types'
import { GuiNavigationStateEntry } from '@/store/gui/navigation/types'
export interface NaviPoint {
type: 'link' | 'route'
title: string
to?: string
href?: string
target?: string
icon: string
position: number
visible: boolean
}
@Component
export default class NavigationMixin extends Mixins(BaseMixin) {
private customNaviLinks: NaviPoint[] = []
get countPrinters() {
return this.$store.getters['farm/countPrinters']
}
get routesNaviPoints(): NaviPoint[] {
const points: NaviPoint[] = []
if (this.countPrinters) {
points.push({
title: this.$t('App.Printers'),
icon: mdiViewDashboardOutline,
to: '/allPrinters',
position: 0,
visible: true,
} as NaviPoint)
}
routes
.filter((element) => {
return element.showInNavi && this.showInNavi(element)
})
.forEach((element) => {
const [position, visible] = this.getUiSettings({
type: 'route',
title: element.title ?? 'unknown',
visible: true,
position: element.position ?? 999,
})
points.push({
type: 'route',
title: this.$t(`Router.${element.title}`),
icon: element.icon,
to: element.path,
position,
visible,
} as NaviPoint)
})
if (this.customNaviLinks.length) {
this.customNaviLinks.forEach((element) => {
const [position, visible] = this.getUiSettings({
type: 'link',
title: element.title ?? 'unknown',
visible: element.visible ?? true,
position: element.position ?? 999,
})
points.push({
type: 'link',
title: element.title,
icon: element.icon,
href: element.href,
target: element.target,
position,
visible,
})
})
}
return points
}
get naviPoints(): NaviPoint[] {
return this.routesNaviPoints.sort((a, b) => a.position - b.position)
}
get visibleNaviPoints(): NaviPoint[] {
return this.naviPoints.filter((entry) => entry.visible)
}
get uiSettings(): GuiNavigationStateEntry[] {
return this.$store.state.gui.navigation.entries
}
get klippy_state(): string {
return this.$store.state.server.klippy_state
}
get boolNaviWebcam(): boolean {
return this.$store.state.gui.uiSettings.boolWebcamNavi
}
get moonrakerComponents(): string[] {
return this.$store.state.server.components
}
get registeredDirectories(): string[] {
return this.$store.state.server.registered_directories
}
get klipperConfigfileSettings(): PrinterStateKlipperConfig[] {
return this.$store.state.printer.configfile?.settings ?? {}
}
get sidebarNaviFile(): string {
return this.$store.getters['files/getCustomNaviPoints']
}
get webcamCount(): number {
return this.$store.getters['gui/webcams/getWebcams'].length
}
@Watch('sidebarNaviFile', { immediate: true })
async sidebarNaviFileChanged(newVal: string) {
this.customNaviLinks = []
// stop if no file is set
if (!newVal) return
const content = await fetch(newVal)
.then((res) => res.json())
.catch((err) => {
window.console.error('Unable to parse .theme/navi.json.')
throw err
})
content.forEach((item: NaviPoint) => {
this.customNaviLinks.push({
title: item.title ?? 'Unknown',
icon: item.icon ?? mdiLinkVariant,
href: item.href ?? '#',
target: item.target ?? undefined,
position: item.position ?? 999,
} as NaviPoint)
})
}
showInNavi(route: AppRoute): boolean {
if (['shutdown', 'error', 'disconnected'].includes(this.klippy_state) && !route.alwaysShow) return false
else if (route.title === 'Webcam' && this.webcamCount === 0) return false
else if (route.moonrakerComponent && !this.moonrakerComponents.includes(route.moonrakerComponent)) return false
else if (route.registeredDirectory && !this.registeredDirectories.includes(route.registeredDirectory))
return false
else if (route.klipperComponent && !(route.klipperComponent in this.klipperConfigfileSettings)) return false
else if (route.klipperIsConnected && !this.klippyIsConnected) return false
return true
}
getUiSettings(entry: GuiNavigationStateEntry): [number, boolean] {
const index = this.uiSettings.findIndex((point) => {
return point.title === entry.title && point.type === entry.type
})
if (index === -1) return [entry.position, entry.visible]
return [this.uiSettings[index].position, this.uiSettings[index].visible]
}
}
@@ -0,0 +1,152 @@
import Component from 'vue-class-component'
import BaseMixin from './base'
import { TranslateResult } from 'vue-i18n'
@Component
export default class SettingsGeneralDatabase extends BaseMixin {
get availableKeys() {
return [
// gui namespace
{
value: 'general',
label: this.$t('Settings.GeneralTab.General'),
},
{
value: 'control',
label: this.$t('Settings.ControlTab.Control'),
},
{
value: 'dashboard',
label: this.$t('Settings.DashboardTab.Dashboard'),
},
{
value: 'editor',
label: this.$t('Settings.EditorTab.Editor'),
},
{
value: 'gcodeViewer',
label: this.$t('Settings.GCodeViewerTab.GCodeViewer'),
},
{
value: 'navigation',
label: this.$t('Settings.GeneralTab.DBNavigation'),
},
{
value: 'uiSettings',
label: this.$t('Settings.UiSettingsTab.UiSettings'),
},
{
value: 'view',
label: this.$t('Settings.GeneralTab.DbView'),
},
// gui modules
{
value: 'console',
label: this.$t('Settings.ConsoleTab.Console'),
},
{
value: 'gcodehistory',
label: this.$t('Settings.GeneralTab.DbConsoleHistory'),
},
{
value: 'macros',
label: this.$t('Settings.MacrosTab.Macros'),
},
{
value: 'notifications',
label: this.$t('App.Notifications.Notifications'),
},
{
value: 'presets',
label: this.$t('Settings.PresetsTab.PreheatPresets'),
},
{
value: 'remoteprinters',
label: this.$t('Settings.RemotePrintersTab.RemotePrinters'),
},
{
value: 'timelapse',
label: this.$t('Settings.TimelapseTab.Timelapse'),
},
]
}
async loadBackupableNamespaces() {
// init namespaces
let backupableNamespaces: { value: string; label: string | TranslateResult }[] = []
// load DB namespaces from moonraker
const urlRequestDbList = this.$store.getters['socket/getUrl'] + '/server/database/list'
const availableNamespaces = await fetch(urlRequestDbList)
// read json
.then((response) => response?.json())
// extract result namespaces
.then((response) => response?.result?.namespaces ?? [])
.catch(() => {
window.console.error('Cannot load Moonraker DB namespaces')
return []
})
// load mainsail keys, if mainsail namespace exists
if (availableNamespaces.includes('mainsail')) {
const urlRequestMainsailNamespace =
this.$store.getters['socket/getUrl'] + '/server/database/item?namespace=mainsail'
backupableNamespaces = await fetch(urlRequestMainsailNamespace)
// read json
.then((response) => response?.json())
// extract result object
.then((response) => response?.result?.value ?? {})
// extract keys from mainsail gui object
.then((objects) => Object.keys(objects))
// filter initVersion
.then((keys) => keys.filter((key) => key !== 'initVersion'))
// convert to locale
.then((keys) =>
keys.map((key) => {
const namespace = this.availableKeys.find((namespace) => namespace.value === key)
if (namespace) return namespace
// fallback return key name
return { value: key, label: key }
})
)
backupableNamespaces = backupableNamespaces.sort(this.sortNamespaces)
}
// add timelapse if exists
if (availableNamespaces.includes('timelapse')) {
backupableNamespaces.push({
value: 'timelapse',
label: this.$t('Settings.GeneralTab.DbTimelapseSettings'),
})
}
// add webcams if exists
if (availableNamespaces.includes('webcams')) {
backupableNamespaces.push({
value: 'webcams',
label: this.$t('Settings.WebcamsTab.Webcams'),
})
}
return backupableNamespaces
}
sortNamespaces(
a: { value: string; label: string | TranslateResult },
b: { value: string; label: string | TranslateResult }
) {
if (a.value === 'general') return -1
if (b.value === 'general') return 1
const stringA = a.label.toString().toLowerCase()
const stringB = b.label.toString().toLowerCase()
if (stringA < stringB) return -1
if (stringA > stringB) return 1
return 0
}
}
+28 -2
View File
@@ -1,4 +1,3 @@
import Vue from 'vue'
import Component from 'vue-class-component'
import {
mdiAlbum,
@@ -10,9 +9,23 @@ import {
mdiRaspberryPi,
mdiWebcam,
} from '@mdi/js'
import { Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
@Component
export default class WebcamMixin extends Vue {
export default class WebcamMixin extends Mixins(BaseMixin) {
convertUrl(baseUrl: string, printerUrl: string | null) {
let url = new URL(baseUrl, this.hostUrl.toString())
// use printerURL if it exists
if (printerUrl !== null) url = new URL(baseUrl, printerUrl)
// overwrite url to baseUrl, if it is an absolute URL
if (baseUrl.startsWith('http') || baseUrl.startsWith('://')) url = new URL(baseUrl)
return decodeURIComponent(url.toString())
}
convertWebcamIcon(iconName: string): string {
switch (iconName) {
case 'mdiAlbum':
@@ -34,4 +47,17 @@ export default class WebcamMixin extends Vue {
return mdiWebcam
}
}
generateTransform(flip_horizontal: boolean, flip_vertical: boolean, rotation: number) {
let transforms = ''
if (flip_horizontal) transforms += ' scaleX(-1)'
if (flip_vertical) transforms += ' scaleY(-1)'
if (rotation === 180) transforms += ' rotate(180deg)'
// return transform when exist
if (transforms.trimStart().length) return transforms.trimStart()
// return none as fallback
return 'none'
}
}
-93
View File
@@ -1,93 +0,0 @@
<style scoped>
.klipper-logo {
transform: rotate(90deg);
}
.moonraker-logo {
transform: rotate(45deg);
color: #ebc815;
}
.version-container {
display: grid;
grid-template-columns: 20px auto;
}
</style>
<template>
<v-dialog v-model="isOpen" transition="dialog-bottom-transition" max-width="600" scrollable>
<template #activator="{ an }">
<v-tooltip right color="panel">
<template #activator="{ on, attrs }">
<v-icon v-bind="attrs" v-on="an" @mouseenter="on.mouseenter" @mouseleave="on.mouseleave">
{{ mdiHelpCircleOutline }}
</v-icon>
</template>
<span class="dark version-container">
<div><img height="12" src="/img/logo.svg" /></div>
<div>v{{ mainsailVersion }}</div>
<div>
<v-icon small class="moonraker-logo">{{ mdiMoonWaningCrescent }}</v-icon>
</div>
<div>{{ moonrakerVersion }}</div>
<div><img height="12" src="/img/klipper.svg" class="klipper-logo" /></div>
<div>{{ klipperVersion }}</div>
</span>
</v-tooltip>
</template>
<template #default>
<panel title="About" :margin-bottom="false">
<template #buttons>
<v-btn icon tile @click="isOpen = false">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-card-text>
<v-container fliud class="align-self-start">
<v-row tag="logo">
<v-col cols="auto">
<v-img
height="80"
contain
src="https://docs.mainsail.xyz/assets/img/logo-mainsail.png"></v-img>
</v-col>
</v-row>
<v-row tag="data1" justify="center">
<v-col class="pr-3 text-right">Version</v-col>
<v-col>v2.1.0-alpha</v-col>
</v-row>
</v-container>
</v-card-text>
</panel>
</template>
</v-dialog>
</template>
<script lang="ts">
import BaseMixin from '../mixins/base'
import { Mixins } from 'vue-property-decorator'
import Component from 'vue-class-component'
import Panel from '@/components/ui/Panel.vue'
import { mdiCloseThick, mdiHelpCircleOutline, mdiMoonWaningCrescent } from '@mdi/js'
@Component({
components: { Panel },
})
export default class AboutModal extends Mixins(BaseMixin) {
mdiHelpCircleOutline = mdiHelpCircleOutline
mdiCloseThick = mdiCloseThick
mdiMoonWaningCrescent = mdiMoonWaningCrescent
private isOpen = false
get mainsailVersion(): string {
return this.$store.state.packageVersion
}
get klipperVersion(): string {
return this.$store.state.printer?.software_version ?? ''
}
get moonrakerVersion(): string {
return this.$store.state.server?.moonraker_version ?? ''
}
}
</script>
@@ -0,0 +1,42 @@
<template>
<v-container v-if="showEstimatedExtrusion" class="pa-0 ma-0 pb-1">
<div style="font-size: 0.8em" class="text--disabled text-caption font-weight-light d-flex justify-center">
<span>
{{ $t('Panels.ExtruderControlPanel.EstimatedExtrusion') }} ~ {{ extrudedLength }} mm @
{{ volumetricFlow }} mm³/s -
<v-icon x-small style="opacity: 0.4; margin-top: -2px">
{{ mdiDiameterVariant }}
</v-icon>
{{ nozzleDiameter }} mm
</span>
</div>
</v-container>
</template>
<script lang="ts">
import { Component, Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { mdiDiameterVariant } from '@mdi/js'
import ExtruderMixin from '@/components/mixins/extruder'
@Component({})
export default class PressureAdvanceSettings extends Mixins(BaseMixin, ExtruderMixin) {
mdiDiameterVariant = mdiDiameterVariant
get showEstimatedExtrusion() {
return this.$store.state.gui.control.extruder.showEstimatedExtrusionInfo ?? true
}
get extrudedLength(): number {
return Math.round(
this.feedamount *
this.extrudeFactor *
(Math.pow(this.filamentDiameter, 2) / Math.pow(this.nozzleDiameter, 2))
)
}
get volumetricFlow(): number {
return Math.round(Math.pow(this.filamentDiameter / 2, 2) * Math.PI * this.feedrate * 10) / 10
}
}
</script>
@@ -0,0 +1,320 @@
<template>
<responsive :breakpoints="{ large: (el) => el.width >= 640 }">
<template #default="{ el }">
<v-container>
<v-row>
<v-col>
<number-input
:label="$t('Panels.ExtruderControlPanel.FilamentLength')"
param="feedamount"
:target="feedamount"
:disabled="printerIsPrintingOnly"
:output-error-msg="true"
:has-spinner="true"
:spinner-factor="100"
:step="0.01"
:min="0.01"
:max="maxExtrudeOnlyDistance"
:dec="2"
unit="mm"
:submit-on-blur="true"
@submit="setFeedamount" />
<v-item-group class="_btn-group pt-3">
<v-btn
v-for="value in feedamountsSorted"
:key="value"
:disabled="printerIsPrintingOnly"
dense
class="_btn-qs flex-grow-1 px-0"
@click="setFeedamount({ value })">
{{ value }}
</v-btn>
</v-item-group>
</v-col>
<v-col>
<number-input
:label="$t('Panels.ExtruderControlPanel.ExtrusionFeedrate')"
param="feedrate"
:target="feedrate"
:disabled="printerIsPrintingOnly"
:has-spinner="true"
:output-error-msg="true"
:spinner-factor="100"
:step="0.01"
:min="0.01"
:max="null"
:dec="2"
type="number"
unit="mm/s"
@submit="setFeedrate" />
<v-item-group class="_btn-group pt-3">
<v-btn
v-for="value in feedratesSorted"
:key="value"
:disabled="printerIsPrintingOnly"
dense
class="_btn-qs flex-grow-1 px-0"
@click="setFeedrate({ value })">
{{ value }}
</v-btn>
</v-item-group>
</v-col>
<!-- EXTRUDE AND RETRACT BUTTON LARGE SIZED PANEL -->
<v-col v-if="el.is.large" class="col-3 d-flex align-center flex-column justify-center">
<!-- RETRACT -->
<v-tooltip left :disabled="extrudePossible && !tooLargeExtrusion" color="secondary">
<template #activator="{ on }">
<div class="mb-4" v-on="on">
<v-btn
:loading="loadings.includes('btnRetract')"
:disabled="!extrudePossible || tooLargeExtrusion || printerIsPrintingOnly"
small
class="_btn-extruder-cmd"
@click="sendRetract()">
<v-icon small class="mr-1">{{ mdiArrowUpBold }}</v-icon>
{{ $t('Panels.ExtruderControlPanel.Retract') }}
</v-btn>
</div>
</template>
<span v-show="!extrudePossible">
{{ $t('Panels.ExtruderControlPanel.ExtruderTempTooLow') }}
{{ minExtrudeTemp }} °C
</span>
<span v-show="tooLargeExtrusion">
{{ $t('Panels.ExtruderControlPanel.TooLargeExtrusion') }}
<br />
{{ $t('Panels.ExtruderControlPanel.Requested') }}: {{ feedamount * extrudeFactor }} mm
<br />
{{ $t('Panels.ExtruderControlPanel.Allowed') }}: {{ maxExtrudeOnlyDistance }} mm
</span>
</v-tooltip>
<!-- EXTRUDE -->
<v-tooltip left :disabled="extrudePossible && !tooLargeExtrusion" color="secondary">
<template #activator="{ on }">
<div v-on="on">
<v-btn
:loading="loadings.includes('btnDetract')"
:disabled="!extrudePossible || tooLargeExtrusion || printerIsPrintingOnly"
small
class="_btn-extruder-cmd"
@click="sendExtrude()">
<v-icon small class="mr-1">{{ mdiArrowDownBold }}</v-icon>
{{ $t('Panels.ExtruderControlPanel.Extrude') }}
</v-btn>
</div>
</template>
<span v-show="!extrudePossible">
{{ $t('Panels.ExtruderControlPanel.ExtruderTempTooLow') }}
{{ minExtrudeTemp }} °C
</span>
<span v-show="tooLargeExtrusion">
{{ $t('Panels.ExtruderControlPanel.TooLargeExtrusion') }}
<br />
{{ $t('Panels.ExtruderControlPanel.Requested') }}: {{ feedamount * extrudeFactor }} mm
<br />
{{ $t('Panels.ExtruderControlPanel.Allowed') }}: {{ maxExtrudeOnlyDistance }} mm
</span>
</v-tooltip>
</v-col>
</v-row>
<!-- EXTRUDE AND RETRACT BUTTON SMALL AND MEDIUM SIZED PANEL -->
<v-row v-if="!el.is.large">
<v-col class="pa-0">
<div class="d-flex justify-space-around">
<div class="d-flex align-center">
<!-- RETRACT -->
<v-tooltip top :disabled="extrudePossible && !tooLargeExtrusion" color="secondary">
<template #activator="{ on }">
<div class="pt-1 pb-2 px-3" v-on="on">
<v-btn
:loading="loadings.includes('btnRetract')"
:disabled="
!extrudePossible || tooLargeExtrusion || printerIsPrintingOnly
"
small
class="_btn-extruder-cmd"
@click="sendRetract()">
<v-icon small class="mr-1">{{ mdiArrowUpBold }}</v-icon>
{{ $t('Panels.ExtruderControlPanel.Retract') }}
</v-btn>
</div>
</template>
<span v-show="!extrudePossible">
{{ $t('Panels.ExtruderControlPanel.ExtruderTempTooLow') }}
{{ minExtrudeTemp }} °C
</span>
<span v-show="tooLargeExtrusion">
{{ $t('Panels.ExtruderControlPanel.TooLargeExtrusion') }}
<br />
{{ $t('Panels.ExtruderControlPanel.Requested') }}:
{{ feedamount * extrudeFactor }} mm
<br />
{{ $t('Panels.ExtruderControlPanel.Allowed') }}: {{ maxExtrudeOnlyDistance }} mm
</span>
</v-tooltip>
<!-- EXTRUDE -->
<v-tooltip top :disabled="extrudePossible && !tooLargeExtrusion" color="secondary">
<template #activator="{ on }">
<div class="pt-1 pb-2 px-3" v-on="on">
<v-btn
:loading="loadings.includes('btnDetract')"
:disabled="
!extrudePossible || tooLargeExtrusion || printerIsPrintingOnly
"
small
class="_btn-extruder-cmd"
@click="sendExtrude()">
<v-icon small class="mr-1">{{ mdiArrowDownBold }}</v-icon>
{{ $t('Panels.ExtruderControlPanel.Extrude') }}
</v-btn>
</div>
</template>
<span v-show="!extrudePossible">
{{ $t('Panels.ExtruderControlPanel.ExtruderTempTooLow') }}
{{ minExtrudeTemp }} °C
</span>
<span v-show="tooLargeExtrusion">
{{ $t('Panels.ExtruderControlPanel.TooLargeExtrusion') }}
<br />
{{ $t('Panels.ExtruderControlPanel.Requested') }}:
{{ feedamount * extrudeFactor }} mm
<br />
{{ $t('Panels.ExtruderControlPanel.Allowed') }}: {{ maxExtrudeOnlyDistance }} mm
</span>
</v-tooltip>
</div>
</div>
</v-col>
</v-row>
</v-container>
</template>
</responsive>
</template>
<script lang="ts">
import { mdiArrowDownBold, mdiArrowUpBold, mdiPrinter3dNozzle } from '@mdi/js'
import { Component, Mixins, Watch } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import NumberInput from '@/components/inputs/NumberInput.vue'
import Responsive from '@/components/ui/Responsive.vue'
import ToolSlider from '@/components/inputs/ToolSlider.vue'
import ExtruderMixin from '@/components/mixins/extruder'
@Component({
components: {
NumberInput,
Responsive,
ToolSlider,
},
})
export default class ExtruderControlPanel extends Mixins(BaseMixin, ExtruderMixin) {
mdiArrowDownBold = mdiArrowDownBold
mdiArrowUpBold = mdiArrowUpBold
mdiPrinter3dNozzle = mdiPrinter3dNozzle
get feedamounts(): number[] {
return this.$store.state.gui.control.extruder?.feedamounts ?? []
}
get feedrates(): number[] {
return this.$store.state.gui.control.extruder?.feedrates ?? []
}
get feedamountsSorted(): number[] {
return [...this.feedamounts].sort((a, b) => {
return b - a
})
}
get feedratesSorted(): number[] {
return [...this.feedrates].sort((a, b) => {
return b - a
})
}
setFeedamount(params: { value: number }): void {
this.$store.dispatch('gui/saveSetting', { name: 'control.extruder.feedamount', value: params.value })
}
setFeedrate(params: { value: number }): void {
this.$store.dispatch('gui/saveSetting', { name: 'control.extruder.feedrate', value: params.value })
}
get maxExtrudeOnlyDistance(): number {
return this.activeExtruderSettings?.max_extrude_only_distance ?? 50
}
get tooLargeExtrusion(): boolean {
return this.feedamount * this.extrudeFactor > this.maxExtrudeOnlyDistance
}
@Watch('maxExtrudeOnlyDistance', { immediate: true })
onMaxExtrudeOnlyDistanceChange(): void {
/**
* If, while switching from ex. A to ex. B, the feedamount
* from ex. an exceeds the maxExtrudeOnlyDistance of ex. B,
* set the feedamount to maxExtrudeOnlyDistance of ex. B
*/
if (this.feedamount > this.maxExtrudeOnlyDistance) {
this.setFeedamount({ value: this.maxExtrudeOnlyDistance })
}
}
sendRetract(): void {
const gcode = `M83\nG1 E-${this.feedamount} F${this.feedrate * 60}`
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'btnRetract' })
}
sendExtrude(): void {
const gcode = `M83\nG1 E${this.feedamount} F${this.feedrate * 60}`
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'btnDetract' })
}
}
</script>
<style lang="scss" scoped>
._btn-group {
border-radius: 4px;
display: inline-flex;
flex-wrap: nowrap;
max-width: 100%;
min-width: 100%;
width: 100%;
.v-btn {
border-radius: 0;
border-color: rgba(255, 255, 255, 0.12);
border-style: solid;
border-width: thin;
box-shadow: none;
height: 28px;
opacity: 0.8;
min-width: auto !important;
}
.v-btn:first-child {
border-top-left-radius: inherit;
border-bottom-left-radius: inherit;
}
.v-btn:last-child {
border-top-right-radius: inherit;
border-bottom-right-radius: inherit;
}
.v-btn:not(:first-child) {
border-left-width: 0;
}
}
._btn-qs {
font-size: 0.8rem !important;
max-height: 24px;
}
._btn-extruder-cmd {
min-width: 135px !important;
}
</style>
@@ -0,0 +1,86 @@
<template>
<div v-if="toolchangeMacros.length > 1">
<v-row v-for="(row, index) in rows" :key="'row_' + index" class="mt-0">
<v-col>
<v-item-group class="_btn-group py-0 px-3">
<extruder-control-panel-tools-item v-for="macro in row" :key="macro.name" :macro="macro" />
</v-item-group>
</v-col>
</v-row>
</div>
</template>
<script lang="ts">
import { mdiPrinter3dNozzle } from '@mdi/js'
import { Component, Mixins } from 'vue-property-decorator'
import { PrinterStateMacro, PrinterStateToolchangeMacro } from '@/store/printer/types'
import BaseMixin from '@/components/mixins/base'
import ControlMixin from '@/components/mixins/control'
@Component({})
export default class ExtruderControlPanel extends Mixins(BaseMixin, ControlMixin) {
mdiPrinter3dNozzle = mdiPrinter3dNozzle
get macros() {
return this.$store.getters['printer/getMacros']
}
get toolchangeMacros(): PrinterStateToolchangeMacro[] {
return this.macros
.filter((macro: PrinterStateMacro) => macro.name.toUpperCase().match(/^T\d+/))
.sort((a: PrinterStateMacro, b: PrinterStateMacro) => {
const numberA = parseInt(a.name.slice(1))
const numberB = parseInt(b.name.slice(1))
return numberA - numberB
})
}
get rows() {
const cols = 6
let rows = []
for (let i = 0; i < this.toolchangeMacros.length; i += cols) {
rows.push(this.toolchangeMacros.slice(i, i + cols))
}
return rows
}
}
</script>
<style lang="scss" scoped>
._btn-group {
border-radius: 4px;
display: inline-flex;
flex-wrap: nowrap;
max-width: 100%;
min-width: 100%;
width: 100%;
.v-btn {
border-radius: 0;
border-color: rgba(255, 255, 255, 0.12);
border-style: solid;
border-width: thin;
box-shadow: none;
height: 28px;
opacity: 0.8;
min-width: auto !important;
}
.v-btn:first-child {
border-top-left-radius: inherit;
border-bottom-left-radius: inherit;
}
.v-btn:last-child {
border-top-right-radius: inherit;
border-bottom-right-radius: inherit;
}
.v-btn:not(:first-child) {
border-left-width: 0;
}
}
</style>
@@ -0,0 +1,88 @@
<template>
<v-btn
:disabled="printerIsPrintingOnly"
dense
class="flex-grow-1 px-0"
:style="buttonStyle"
@click="doSend(macro.name)">
<span v-if="color != null" class="_extruderColorState mr-1" :style="dotStyle" />
{{ macro.name }}
</v-btn>
</template>
<script lang="ts">
import { Component, Mixins, Prop } from 'vue-property-decorator'
import { PrinterStateMacro } from '@/store/printer/types'
import BaseMixin from '@/components/mixins/base'
import ControlMixin from '@/components/mixins/control'
@Component({
components: {},
})
export default class ExtruderControlPanel extends Mixins(BaseMixin, ControlMixin) {
@Prop({ type: Object }) macro!: PrinterStateMacro
get active() {
return this.macro.variables.active ?? false
}
get color() {
const color = this.macro.variables.color ?? this.macro.variables.colour ?? null
if (color === '' || color === 'undefined') return null
return color
}
get primaryColor(): string {
return this.$store.state.gui.uiSettings.primary
}
get primaryTextColor(): string {
let splits = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(this.primaryColor)
if (splits) {
const r = parseInt(splits[1], 16) * 0.2126
const g = parseInt(splits[2], 16) * 0.7152
const b = parseInt(splits[3], 16) * 0.0722
const perceivedLightness = (r + g + b) / 255
return perceivedLightness > 0.7 ? '#222' : '#fff'
}
return '#ffffff'
}
get warningColor(): string {
return this.$vuetify?.theme?.currentTheme?.warning?.toString() ?? '#ff8300'
}
get buttonStyle() {
let backgroundColor = ''
if (this.active) {
backgroundColor = this.homedAxes.includes('xyz') ? this.primaryColor : this.warningColor
}
const textColor = this.active ? this.primaryTextColor : ''
return {
color: textColor,
'background-color': backgroundColor,
}
}
get dotStyle() {
return {
'border-color': this.active ? this.primaryTextColor : '',
'background-color': '#' + this.color,
}
}
}
</script>
<style lang="scss" scoped>
._extruderColorState {
width: 15px;
height: 15px;
border-radius: 50%;
border: 1px solid lightgray;
}
</style>
@@ -0,0 +1,27 @@
<template>
<v-container class="pb-1">
<tool-slider
:label="$t('Panels.ExtruderControlPanel.ExtrusionFactor')"
:icon="mdiPrinter3dNozzleOutline"
:target="extrudeFactor"
:min="1"
:max="200"
:multi="100"
:step="1"
:has-input-field="true"
command="M221"
attribute-name="S" />
</v-container>
</template>
<script lang="ts">
import { Component, Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { mdiPrinter3dNozzleOutline } from '@mdi/js'
import ExtruderMixin from '@/components/mixins/extruder'
@Component({})
export default class PressureAdvanceSettings extends Mixins(BaseMixin, ExtruderMixin) {
mdiPrinter3dNozzleOutline = mdiPrinter3dNozzleOutline
}
</script>
@@ -0,0 +1,148 @@
<template>
<div v-if="existsFirmwareRetraction">
<v-divider />
<v-container>
<responsive
:breakpoints="{
small: (el) => el.width <= 350,
}">
<template #default="{ el }">
<v-row>
<v-col :class="{ 'col-12': el.is.small }">
<number-input
:label="$t('Panels.ExtruderControlPanel.FirmwareRetractionSettings.RetractLength')"
param="RETRACT_LENGTH"
:target="retractLength"
:default-value="defaultRetractLength"
:output-error-msg="true"
:has-spinner="true"
:spinner-factor="10"
:step="0.01"
:min="0"
:max="null"
:dec="2"
unit="mm"
@submit="sendCmd" />
</v-col>
<v-col :class="{ 'col-12': el.is.small }">
<number-input
:label="$t('Panels.ExtruderControlPanel.FirmwareRetractionSettings.RetractSpeed')"
param="RETRACT_SPEED"
:target="retractSpeed"
:default-value="defaultRetractSpeed"
:output-error-msg="true"
:has-spinner="true"
:spinner-factor="5"
:step="1"
:min="1"
:max="null"
:dec="0"
unit="mm/s"
@submit="sendCmd" />
</v-col>
</v-row>
<v-row>
<v-col :class="{ 'col-12': el.is.small }">
<number-input
:label="
$t('Panels.ExtruderControlPanel.FirmwareRetractionSettings.UnretractExtraLength')
"
param="UNRETRACT_EXTRA_LENGTH"
:target="unretractExtraLength"
:default-value="defaultUnretractExtraLength"
:output-error-msg="true"
:has-spinner="true"
:spinner-factor="10"
:step="0.01"
:min="0"
:max="null"
:dec="2"
unit="mm"
@submit="sendCmd" />
</v-col>
<v-col :class="{ 'col-12': el.is.small }">
<number-input
:label="$t('Panels.ExtruderControlPanel.FirmwareRetractionSettings.UnretractSpeed')"
param="UNRETRACT_SPEED"
:target="unretractSpeed"
:default-value="defaultUnretractSpeed"
:output-error-msg="true"
:has-spinner="true"
:spinner-factor="5"
:step="1"
:min="1"
:max="null"
:dec="0"
unit="mm/s"
@submit="sendCmd" />
</v-col>
</v-row>
</template>
</responsive>
</v-container>
</div>
</template>
<script lang="ts">
import { Component, Mixins } from 'vue-property-decorator'
import { Debounce } from 'vue-debounce-decorator'
import BaseMixin from '@/components/mixins/base'
import Panel from '@/components/ui/Panel.vue'
import NumberInput from '@/components/inputs/NumberInput.vue'
import Responsive from '@/components/ui/Responsive.vue'
import ControlMixin from '@/components/mixins/control'
@Component({
components: { Panel, NumberInput, Responsive },
})
export default class FirmwareRetractionSettings extends Mixins(BaseMixin, ControlMixin) {
get retractLength(): number {
return Math.floor((this.$store.state.printer?.firmware_retraction?.retract_length ?? 0) * 100) / 100
}
get retractSpeed(): number {
return Math.trunc(this.$store.state.printer?.firmware_retraction?.retract_speed ?? 20)
}
get unretractExtraLength(): number {
return Math.floor((this.$store.state.printer?.firmware_retraction?.unretract_extra_length ?? 0) * 100) / 100
}
get unretractSpeed(): number {
return Math.trunc(this.$store.state.printer?.firmware_retraction?.unretract_speed ?? 10)
}
get defaultRetractLength(): number {
return (
Math.floor(
(this.$store.state.printer?.configfile?.settings?.firmware_retraction?.retract_length ?? 0) * 100
) / 100
)
}
get defaultRetractSpeed(): number {
return Math.trunc(this.$store.state.printer?.configfile?.settings?.firmware_retraction?.retract_speed ?? 20)
}
get defaultUnretractExtraLength(): number {
return (
Math.floor(
(this.$store.state.printer?.configfile?.settings?.firmware_retraction?.unretract_extra_length ?? 0) *
100
) / 100
)
}
get defaultUnretractSpeed(): number {
return Math.trunc(this.$store.state.printer?.configfile?.settings?.firmware_retraction?.unretract_speed ?? 0)
}
@Debounce(500)
sendCmd(params: { name: string; value: number }): void {
const gcode = `SET_RETRACTION ${params.name}=${params.value}`
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
this.$socket.emit('printer.gcode.script', { script: gcode })
}
}
</script>
@@ -0,0 +1,144 @@
<template>
<div v-if="show">
<v-divider />
<v-container>
<responsive
:breakpoints="{
small: (el) => el.width <= 350,
medium: (el) => el.width > 350 && el.width <= 500,
}">
<template #default="{ el }">
<v-row>
<v-col v-if="allExtruders.length > 1" :class="{ 'col-12': el.is.small || el.is.medium }">
<div class="d-flex align-center">
<v-btn
v-if="selectedExtruder !== activeExtruder"
icon
plain
@click="resetToActiveExtruder">
<v-icon>{{ mdiRestart }}</v-icon>
</v-btn>
<v-select
v-model="selectedExtruder"
:label="$t('Panels.ExtruderControlPanel.PressureAdvanceSettings.Extruder')"
:items="allExtruders"
:value="activeExtruder"
hide-details
outlined
dense />
</div>
</v-col>
<v-col :class="{ 'col-12': el.is.small }">
<number-input
:label="$t('Panels.ExtruderControlPanel.PressureAdvanceSettings.Advance')"
param="ADVANCE"
:target="pressureAdvance"
:default-value="defaultPressureAdvance"
:extruder="selectedExtruder"
:output-error-msg="true"
:has-spinner="true"
:min="0"
:max="null"
:step="0.001"
:dec="3"
unit="s"
@submit="sendCmd" />
</v-col>
<v-col :class="{ 'col-12': el.is.small }">
<number-input
:label="$t('Panels.ExtruderControlPanel.PressureAdvanceSettings.SmoothTime')"
param="SMOOTH_TIME"
:target="smoothTime"
:default-value="defaultSmoothTime"
:extruder="selectedExtruder"
:output-error-msg="true"
:has-spinner="true"
:spinner-factor="10"
:min="0"
:max="0.2"
:step="0.001"
:dec="3"
unit="s"
@submit="sendCmd" />
</v-col>
</v-row>
</template>
</responsive>
</v-container>
</div>
</template>
<script lang="ts">
import { Component, Mixins } from 'vue-property-decorator'
import { Debounce } from 'vue-debounce-decorator'
import BaseMixin from '@/components/mixins/base'
import NumberInput from '@/components/inputs/NumberInput.vue'
import Panel from '@/components/ui/Panel.vue'
import Responsive from '@/components/ui/Responsive.vue'
import { mdiRestart } from '@mdi/js'
@Component({
components: { NumberInput, Panel, Responsive },
})
export default class PressureAdvanceSettings extends Mixins(BaseMixin) {
mdiRestart = mdiRestart
private extruders: string[] = []
private selectedExtruder = ''
resetToActiveExtruder(): void {
this.selectedExtruder = this.$store.state.printer.toolhead?.extruder
}
get show(): boolean {
return !(this.$store.getters['printer/getExtruderSteppers'].length > 0)
}
get allExtruders(): string[] {
Object.keys(this.$store.state.printer).forEach((e) => {
if (e.startsWith('extruder') && !this.extruders.includes(e)) this.extruders.push(e)
})
this.extruders.length === 1 ? this.resetToActiveExtruder() : {}
return this.extruders
}
get activeExtruder(): string {
this.resetToActiveExtruder()
return this.$store.state.printer.toolhead?.extruder
}
get pressureAdvance(): number {
return Math.floor((this.$store.state.printer?.[this.selectedExtruder]?.pressure_advance ?? 0) * 1000) / 1000
}
get smoothTime(): number {
return Math.floor((this.$store.state.printer?.[this.selectedExtruder]?.smooth_time ?? 0.04) * 1000) / 1000
}
get defaultPressureAdvance(): number {
return (
Math.floor(
(this.$store.state.printer.configfile?.settings?.[this.selectedExtruder]?.pressure_advance ?? 0) * 1000
) / 1000
)
}
get defaultSmoothTime(): number {
return (
Math.floor(
(this.$store.state.printer.configfile?.settings?.[this.selectedExtruder]
?.pressure_advance_smooth_time ?? 0.04) * 1000
) / 1000
)
}
@Debounce(500)
sendCmd(params: { name: string; value: number }): void {
const gcode = `SET_PRESSURE_ADVANCE EXTRUDER=${this.selectedExtruder} ${params.name}=${params.value}`
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
this.$socket.emit('printer.gcode.script', { script: gcode })
}
}
</script>
+36 -451
View File
@@ -1,10 +1,11 @@
<template>
<panel
v-if="klipperReadyForGui && extruders.length"
v-if="showPanel"
:icon="mdiPrinter3dNozzle"
:title="$t('Panels.ExtruderControlPanel.Headline').toString()"
:title="$t('Panels.ExtruderControlPanel.Headline')"
:collapsible="true"
card-class="extruder-control-panel">
card-class="extruder-control-panel"
class="pb-1">
<!-- PANEL-HEADER 3-DOT-MENU -->
<template #buttons>
<v-menu v-if="showFilamentMacros" :offset-y="true" :close-on-content-click="false" left>
@@ -21,8 +22,8 @@
<div v-on="on">
<macro-button
:macro="unloadFilamentMacro"
:alias="$t('Panels.ExtruderControlPanel.UnloadFilament').toString()"
:disabled="!canExecuteUnloadMacro || isPrinting"
:alias="$t('Panels.ExtruderControlPanel.UnloadFilament')"
:disabled="!canExecuteUnloadMacro || printerIsPrintingOnly"
color="#272727" />
</div>
</template>
@@ -39,8 +40,8 @@
<div v-on="on">
<macro-button
:macro="loadFilamentMacro"
:alias="$t('Panels.ExtruderControlPanel.LoadFilament').toString()"
:disabled="!canExecuteLoadMacro || isPrinting"
:alias="$t('Panels.ExtruderControlPanel.LoadFilament')"
:disabled="!canExecuteLoadMacro || printerIsPrintingOnly"
color="#272727" />
</div>
</template>
@@ -53,319 +54,56 @@
</v-list>
</v-menu>
</template>
<responsive :breakpoints="{ large: (el) => el.width >= 640 }">
<template #default="{ el }">
<!-- TOOL SELECTOR BUTTONS -->
<v-container v-if="toolchangeMacros.length > 1" class="pb-1">
<v-item-group class="_btn-group py-0">
<v-btn
v-for="tool in toolchangeMacros"
:key="tool.name"
:class="tool.active ? 'primary--text' : {}"
:disabled="isPrinting"
dense
class="flex-grow-1 px-0"
@click="doSend(tool.name)">
{{ tool.name }}
</v-btn>
</v-item-group>
</v-container>
<!-- EXTRUSION FACTOR SLIDER -->
<v-container class="pb-1">
<tool-slider
:label="$t('Panels.ExtruderControlPanel.ExtrusionFactor').toString()"
:icon="mdiPrinter3dNozzleOutline"
:target="extrudeFactor"
:min="1"
:max="200"
:multi="100"
:step="1"
:has-input-field="true"
command="M221"
attribute-name="S"></tool-slider>
</v-container>
<!-- PRESSURE ADVANCE SETTINGS -->
<template v-if="!extruderSteppers.length > 0">
<v-divider></v-divider>
<pressure-advance-settings></pressure-advance-settings>
</template>
<!-- FIRMWARE RETRACTION SETTINGS -->
<template v-if="existsFirmwareRetraction">
<v-divider></v-divider>
<firmware-retraction-settings></firmware-retraction-settings>
</template>
<v-divider class="pb-1"></v-divider>
<!-- EXTRUDER INPUTS AND QUICKSELECTS -->
<v-container>
<v-row>
<v-col>
<number-input
:label="$t('Panels.ExtruderControlPanel.FilamentLength').toString()"
param="feedamount"
:target="feedamount"
:disabled="isPrinting"
:output-error-msg="true"
:has-spinner="true"
:spinner-factor="100"
:step="0.01"
:min="0.01"
:max="maxExtrudeOnlyDistance"
:dec="2"
unit="mm"
:submit-on-blur="true"
@submit="setFeedamount"></number-input>
<v-item-group class="_btn-group pt-3">
<v-btn
v-for="value in feedamountsSorted"
:key="value"
:disabled="isPrinting"
dense
class="_btn-qs flex-grow-1 px-0"
@click="setFeedamount({ value })">
{{ value }}
</v-btn>
</v-item-group>
</v-col>
<v-col>
<number-input
:label="$t('Panels.ExtruderControlPanel.ExtrusionFeedrate').toString()"
param="feedrate"
:target="feedrate"
:disabled="isPrinting"
:has-spinner="true"
:output-error-msg="true"
:spinner-factor="100"
:step="0.01"
:min="0.01"
:max="null"
:dec="2"
type="number"
unit="mm/s"
@submit="setFeedrate"></number-input>
<v-item-group class="_btn-group pt-3">
<v-btn
v-for="value in feedratesSorted"
:key="value"
:disabled="isPrinting"
dense
class="_btn-qs flex-grow-1 px-0"
@click="setFeedrate({ value })">
{{ value }}
</v-btn>
</v-item-group>
</v-col>
<!-- EXTRUDE AND RETRACT BUTTON LARGE SIZED PANEL -->
<v-col v-if="el.is.large" class="col-3 d-flex align-center flex-column justify-center">
<!-- RETRACT -->
<v-tooltip left :disabled="extrudePossible && !tooLargeExtrusion" color="secondary">
<template #activator="{ on }">
<div class="mb-4" v-on="on">
<v-btn
:loading="loadings.includes('btnRetract')"
:disabled="!extrudePossible || tooLargeExtrusion || isPrinting"
small
class="_btn-extruder-cmd"
@click="sendRetract()">
<v-icon small class="mr-1">{{ mdiArrowUpBold }}</v-icon>
{{ $t('Panels.ExtruderControlPanel.Retract') }}
</v-btn>
</div>
</template>
<span v-show="!extrudePossible">
{{ $t('Panels.ExtruderControlPanel.ExtruderTempTooLow') }}
{{ minExtrudeTemp }} °C
</span>
<span v-show="tooLargeExtrusion">
{{ $t('Panels.ExtruderControlPanel.TooLargeExtrusion') }}
<br />
{{ $t('Panels.ExtruderControlPanel.Requested') }}:
{{ feedamount * extrudeFactor }} mm
<br />
{{ $t('Panels.ExtruderControlPanel.Allowed') }}: {{ maxExtrudeOnlyDistance }} mm
</span>
</v-tooltip>
<!-- EXTRUDE -->
<v-tooltip left :disabled="extrudePossible && !tooLargeExtrusion" color="secondary">
<template #activator="{ on }">
<div v-on="on">
<v-btn
:loading="loadings.includes('btnDetract')"
:disabled="!extrudePossible || tooLargeExtrusion || isPrinting"
small
class="_btn-extruder-cmd"
@click="sendExtrude()">
<v-icon small class="mr-1">{{ mdiArrowDownBold }}</v-icon>
{{ $t('Panels.ExtruderControlPanel.Extrude') }}
</v-btn>
</div>
</template>
<span v-show="!extrudePossible">
{{ $t('Panels.ExtruderControlPanel.ExtruderTempTooLow') }}
{{ minExtrudeTemp }} °C
</span>
<span v-show="tooLargeExtrusion">
{{ $t('Panels.ExtruderControlPanel.TooLargeExtrusion') }}
<br />
{{ $t('Panels.ExtruderControlPanel.Requested') }}:
{{ feedamount * extrudeFactor }} mm
<br />
{{ $t('Panels.ExtruderControlPanel.Allowed') }}: {{ maxExtrudeOnlyDistance }} mm
</span>
</v-tooltip>
</v-col>
</v-row>
<!-- EXTRUDE AND RETRACT BUTTON SMALL AND MEDIUM SIZED PANEL -->
<v-row v-if="!el.is.large" :class="{ 'pb-1': !showEstimatedExtrusion }">
<v-col class="pa-0">
<div class="d-flex justify-space-around">
<div class="d-flex align-center">
<!-- RETRACT -->
<v-tooltip top :disabled="extrudePossible && !tooLargeExtrusion" color="secondary">
<template #activator="{ on }">
<div class="pt-1 pb-2 px-3" v-on="on">
<v-btn
:loading="loadings.includes('btnRetract')"
:disabled="!extrudePossible || tooLargeExtrusion || isPrinting"
small
class="_btn-extruder-cmd"
@click="sendRetract()">
<v-icon small class="mr-1">{{ mdiArrowUpBold }}</v-icon>
{{ $t('Panels.ExtruderControlPanel.Retract') }}
</v-btn>
</div>
</template>
<span v-show="!extrudePossible">
{{ $t('Panels.ExtruderControlPanel.ExtruderTempTooLow') }}
{{ minExtrudeTemp }} °C
</span>
<span v-show="tooLargeExtrusion">
{{ $t('Panels.ExtruderControlPanel.TooLargeExtrusion') }}
<br />
{{ $t('Panels.ExtruderControlPanel.Requested') }}:
{{ feedamount * extrudeFactor }} mm
<br />
{{ $t('Panels.ExtruderControlPanel.Allowed') }}:
{{ maxExtrudeOnlyDistance }} mm
</span>
</v-tooltip>
<!-- EXTRUDE -->
<v-tooltip top :disabled="extrudePossible && !tooLargeExtrusion" color="secondary">
<template #activator="{ on }">
<div class="pt-1 pb-2 px-3" v-on="on">
<v-btn
:loading="loadings.includes('btnDetract')"
:disabled="!extrudePossible || tooLargeExtrusion || isPrinting"
small
class="_btn-extruder-cmd"
@click="sendExtrude()">
<v-icon small class="mr-1">{{ mdiArrowDownBold }}</v-icon>
{{ $t('Panels.ExtruderControlPanel.Extrude') }}
</v-btn>
</div>
</template>
<span v-show="!extrudePossible">
{{ $t('Panels.ExtruderControlPanel.ExtruderTempTooLow') }}
{{ minExtrudeTemp }} °C
</span>
<span v-show="tooLargeExtrusion">
{{ $t('Panels.ExtruderControlPanel.TooLargeExtrusion') }}
<br />
{{ $t('Panels.ExtruderControlPanel.Requested') }}:
{{ feedamount * extrudeFactor }} mm
<br />
{{ $t('Panels.ExtruderControlPanel.Allowed') }}:
{{ maxExtrudeOnlyDistance }} mm
</span>
</v-tooltip>
</div>
</div>
</v-col>
</v-row>
</v-container>
<!-- EXTRUSION ESTIMATION NOTE -->
<v-container v-if="showEstimatedExtrusion" class="pa-0 ma-0 pb-2">
<div
v-if="filamentDiameter && nozzleDiameter"
style="font-size: 0.8em"
class="text--disabled text-caption font-weight-light d-flex justify-center">
<span>
{{ $t('Panels.ExtruderControlPanel.EstimatedExtrusion') }} ~ {{ extrudedLength }} mm @
{{ volumetricFlow }} mm³/s -
<v-icon x-small style="opacity: 0.4; margin-top: -2px">
{{ mdiDiameterVariant }}
</v-icon>
{{ nozzleDiameter }} mm
</span>
</div>
</v-container>
</template>
</responsive>
<!-- TOOL SELECTOR BUTTONS -->
<extruder-control-panel-tools />
<!-- EXTRUSION FACTOR SLIDER -->
<extrusion-factor-settings />
<!-- PRESSURE ADVANCE SETTINGS -->
<pressure-advance-settings />
<!-- FIRMWARE RETRACTION SETTINGS -->
<firmware-retraction-settings />
<v-divider class="pb-1" />
<!-- EXTRUDER INPUTS AND QUICKSELECTS -->
<extruder-control-panel-control />
<!-- EXTRUSION ESTIMATION NOTE -->
<estimated-extrusion-output />
</panel>
</template>
<script lang="ts">
import {
mdiArrowDownBold,
mdiArrowUpBold,
mdiPrinter3dNozzle,
mdiPrinter3dNozzleOutline,
mdiDotsVertical,
mdiDiameterVariant,
} from '@mdi/js'
import { Component, Mixins, Watch } from 'vue-property-decorator'
import {
PrinterStateExtruder,
PrinterStateExtruderStepper,
PrinterStateMacro,
PrinterStateToolchangeMacro,
} from '@/store/printer/types'
import BaseMixin from '../mixins/base'
import ControlMixin from '../mixins/control'
import NumberInput from '@/components/inputs/NumberInput.vue'
import { mdiPrinter3dNozzle, mdiDotsVertical } from '@mdi/js'
import { Component, Mixins } from 'vue-property-decorator'
import { PrinterStateExtruder, PrinterStateMacro } from '@/store/printer/types'
import BaseMixin from '@/components/mixins/base'
import ControlMixin from '@/components/mixins/control'
import Panel from '@/components/ui/Panel.vue'
import PressureAdvanceSettings from '@/components/panels/ExtruderSettings/PressureAdvanceSettings.vue'
import FirmwareRetractionSettings from '@/components/panels/ExtruderSettings/FirmwareRetractionSettings.vue'
import Responsive from '@/components/ui/Responsive.vue'
import ToolSlider from '@/components/inputs/ToolSlider.vue'
import ExtruderMixin from '@/components/mixins/extruder'
@Component({
components: {
Panel,
PressureAdvanceSettings,
FirmwareRetractionSettings,
NumberInput,
Responsive,
ToolSlider,
},
})
export default class ExtruderControlPanel extends Mixins(BaseMixin, ControlMixin) {
mdiArrowUpBold = mdiArrowUpBold
mdiArrowDownBold = mdiArrowDownBold
export default class ExtruderControlPanel extends Mixins(BaseMixin, ControlMixin, ExtruderMixin) {
mdiPrinter3dNozzle = mdiPrinter3dNozzle
mdiPrinter3dNozzleOutline = mdiPrinter3dNozzleOutline
mdiDotsVertical = mdiDotsVertical
mdiDiameterVariant = mdiDiameterVariant
private heatWaitGcodes = ['printer.extruder.can_extrude', 'TEMPERATURE_WAIT', 'M109']
get isPrinting(): boolean {
return ['printing'].includes(this.printer_state)
get showPanel(): boolean {
return this.klipperReadyForGui && this.extruders.length > 0
}
get macros() {
return this.$store.getters['printer/getMacros']
}
get toolchangeMacros(): PrinterStateToolchangeMacro[] {
return this.$store.getters['printer/getToolchangeMacros']
get loadFilamentMacro(): PrinterStateMacro | undefined {
return this.macros.find((macro: PrinterStateMacro) => macro.name.toUpperCase() === 'LOAD_FILAMENT')
}
get loadFilamentMacro() {
return this.macros.find((macro: PrinterStateMacro) => macro.name === 'LOAD_FILAMENT')
}
get unloadFilamentMacro() {
return this.macros.find((macro: PrinterStateMacro) => macro.name === 'UNLOAD_FILAMENT')
get unloadFilamentMacro(): PrinterStateMacro | undefined {
return this.macros.find((macro: PrinterStateMacro) => macro.name.toUpperCase() === 'UNLOAD_FILAMENT')
}
/**
@@ -375,13 +113,13 @@ export default class ExtruderControlPanel extends Mixins(BaseMixin, ControlMixin
get canExecuteLoadMacro(): boolean {
if (this.extrudePossible) return true
return this.heatWaitGcodes.some((gcode) => this.loadFilamentMacro.prop.gcode.includes(gcode))
return this.heatWaitGcodes.some((gcode) => this.loadFilamentMacro?.prop.gcode.includes(gcode))
}
get canExecuteUnloadMacro(): boolean {
if (this.extrudePossible) return true
return this.heatWaitGcodes.some((gcode) => this.unloadFilamentMacro.prop.gcode.includes(gcode))
return this.heatWaitGcodes.some((gcode) => this.unloadFilamentMacro?.prop.gcode.includes(gcode))
}
get showFilamentMacros(): boolean {
@@ -391,158 +129,5 @@ export default class ExtruderControlPanel extends Mixins(BaseMixin, ControlMixin
get extruders(): PrinterStateExtruder[] {
return this.$store.getters['printer/getExtruders']
}
get extruderSteppers(): PrinterStateExtruderStepper[] {
return this.$store.getters['printer/getExtruderSteppers']
}
get activeExtruder(): string {
return this.$store.state.printer.toolhead?.extruder
}
get filamentDiameter(): number {
return this.$store.state.printer.configfile?.settings?.[this.activeExtruder]?.filament_diameter ?? 1.75
}
get nozzleDiameter(): number {
return this.$store.state.printer.configfile?.settings?.[this.activeExtruder]?.nozzle_diameter ?? 0.4
}
get feedamounts(): number[] {
return this.$store.state.gui.control.extruder?.feedamounts ?? []
}
get feedrates(): number[] {
return this.$store.state.gui.control.extruder?.feedrates ?? []
}
get feedamountsSorted(): number[] {
return [...this.feedamounts].sort((a, b) => {
return b - a
})
}
get feedratesSorted(): number[] {
return [...this.feedrates].sort((a, b) => {
return b - a
})
}
get feedamount(): number {
return parseFloat(this.$store.state.gui.control.extruder.feedamount)
}
setFeedamount(params: { value: number }): void {
this.$store.dispatch('gui/saveSetting', { name: 'control.extruder.feedamount', value: params.value })
}
get feedrate(): number {
return parseFloat(this.$store.state.gui.control.extruder.feedrate)
}
setFeedrate(params: { value: number }): void {
this.$store.dispatch('gui/saveSetting', { name: 'control.extruder.feedrate', value: params.value })
}
get extrudePossible(): boolean {
return this.$store.getters['printer/getExtrudePossible']
}
get minExtrudeTemp(): number {
return this.$store.state.printer.configfile?.settings?.[this.activeExtruder]?.min_extrude_temp ?? 170
}
get maxExtrudeOnlyDistance(): number {
return this.$store.state.printer.configfile?.settings?.[this.activeExtruder]?.max_extrude_only_distance ?? 50
}
get tooLargeExtrusion(): boolean {
return this.feedamount * this.extrudeFactor > this.maxExtrudeOnlyDistance
}
get extrudedLength(): number {
return Math.round(this.feedamount * this.extrudeFactor * (this.filamentDiameter / this.nozzleDiameter))
}
get volumetricFlow(): number {
return Math.round(Math.pow(this.filamentDiameter / 2, 2) * Math.PI * this.feedrate * 10) / 10
}
get extrudeFactor() {
return this.$store.state.printer?.gcode_move?.extrude_factor ?? 1
}
get showEstimatedExtrusion() {
return this.$store.state.gui.control.extruder.showEstimatedExtrusionInfo
}
@Watch('maxExtrudeOnlyDistance', { immediate: true })
onMaxExtrudeOnlyDistanceChange(): void {
/**
* If, while switching from ex. A to ex. B, the feedamount
* from ex. A exceeds the maxExtrudeOnlyDistance of ex. B,
* set the feedamount to maxExtrudeOnlyDistance of ex. B
*/
if (this.feedamount > this.maxExtrudeOnlyDistance) {
this.setFeedamount({ value: this.maxExtrudeOnlyDistance })
}
}
sendRetract(): void {
const gcode = `M83\nG1 E-${this.feedamount} F${this.feedrate * 60}`
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'btnRetract' })
}
sendExtrude(): void {
const gcode = `M83\nG1 E${this.feedamount} F${this.feedrate * 60}`
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'btnDetract' })
}
}
</script>
<style lang="scss" scoped>
._btn-group {
border-radius: 4px;
display: inline-flex;
flex-wrap: nowrap;
max-width: 100%;
min-width: 100%;
width: 100%;
.v-btn {
border-radius: 0;
border-color: rgba(255, 255, 255, 0.12);
border-style: solid;
border-width: thin;
box-shadow: none;
height: 28px;
opacity: 0.8;
min-width: auto !important;
}
.v-btn:first-child {
border-top-left-radius: inherit;
border-bottom-left-radius: inherit;
}
.v-btn:last-child {
border-top-right-radius: inherit;
border-bottom-right-radius: inherit;
}
.v-btn:not(:first-child) {
border-left-width: 0;
}
}
._btn-qs {
font-size: 0.8rem !important;
max-height: 24px;
}
._btn-extruder-cmd {
min-width: 135px !important;
}
</style>
@@ -1,152 +0,0 @@
<template>
<v-container>
<responsive
:breakpoints="{
small: (el) => el.width <= 350,
}">
<template #default="{ el }">
<v-row>
<v-col :class="{ 'col-12': el.is.small }">
<number-input
:label="
$t('Panels.ExtruderControlPanel.FirmwareRetractionSettings.RetractLength').toString()
"
param="RETRACT_LENGTH"
:target="retractLength"
:default-value="defaultRetractLength"
:output-error-msg="true"
:has-spinner="true"
:spinner-factor="10"
:step="0.01"
:min="0"
:max="null"
:dec="2"
unit="mm"
@submit="sendCmd"></number-input>
</v-col>
<v-col :class="{ 'col-12': el.is.small }">
<number-input
:label="
$t('Panels.ExtruderControlPanel.FirmwareRetractionSettings.RetractSpeed').toString()
"
param="RETRACT_SPEED"
:target="retractSpeed"
:default-value="defaultRetractSpeed"
:output-error-msg="true"
:has-spinner="true"
:spinner-factor="5"
:step="1"
:min="1"
:max="null"
:dec="0"
unit="mm/s"
@submit="sendCmd"></number-input>
</v-col>
</v-row>
<v-row>
<v-col :class="{ 'col-12': el.is.small }">
<number-input
:label="
$t(
'Panels.ExtruderControlPanel.FirmwareRetractionSettings.UnretractExtraLength'
).toString()
"
param="UNRETRACT_EXTRA_LENGTH"
:target="unretractExtraLength"
:default-value="defaultUnretractExtraLength"
:output-error-msg="true"
:has-spinner="true"
:spinner-factor="10"
:step="0.01"
:min="0"
:max="null"
:dec="2"
unit="mm"
@submit="sendCmd"></number-input>
</v-col>
<v-col :class="{ 'col-12': el.is.small }">
<number-input
:label="
$t('Panels.ExtruderControlPanel.FirmwareRetractionSettings.UnretractSpeed').toString()
"
param="UNRETRACT_SPEED"
:target="unretractSpeed"
:default-value="defaultUnretractSpeed"
:output-error-msg="true"
:has-spinner="true"
:spinner-factor="5"
:step="1"
:min="1"
:max="null"
:dec="0"
unit="mm/s"
@submit="sendCmd"></number-input>
</v-col>
</v-row>
</template>
</responsive>
</v-container>
</template>
<script lang="ts">
import { Component, Mixins } from 'vue-property-decorator'
import { Debounce } from 'vue-debounce-decorator'
import BaseMixin from '@/components/mixins/base'
import Panel from '@/components/ui/Panel.vue'
import NumberInput from '@/components/inputs/NumberInput.vue'
import Responsive from '@/components/ui/Responsive.vue'
@Component({
components: { Panel, NumberInput, Responsive },
})
export default class FirmwareRetractionSettings extends Mixins(BaseMixin) {
get retractLength(): number {
return Math.floor((this.$store.state.printer?.firmware_retraction?.retract_length ?? 0) * 100) / 100
}
get retractSpeed(): number {
return Math.trunc(this.$store.state.printer?.firmware_retraction?.retract_speed ?? 20)
}
get unretractExtraLength(): number {
return Math.floor((this.$store.state.printer?.firmware_retraction?.unretract_extra_length ?? 0) * 100) / 100
}
get unretractSpeed(): number {
return Math.trunc(this.$store.state.printer?.firmware_retraction?.unretract_speed ?? 10)
}
get defaultRetractLength(): number {
return (
Math.floor(
(this.$store.state.printer?.configfile?.settings?.firmware_retraction?.retract_length ?? 0) * 100
) / 100
)
}
get defaultRetractSpeed(): number {
return Math.trunc(this.$store.state.printer?.configfile?.settings?.firmware_retraction?.retract_speed ?? 20)
}
get defaultUnretractExtraLength(): number {
return (
Math.floor(
(this.$store.state.printer?.configfile?.settings?.firmware_retraction?.unretract_extra_length ?? 0) *
100
) / 100
)
}
get defaultUnretractSpeed(): number {
return Math.trunc(this.$store.state.printer?.configfile?.settings?.firmware_retraction?.unretract_speed ?? 0)
}
@Debounce(500)
sendCmd(params: { name: string; value: number }): void {
const gcode = `SET_RETRACTION ${params.name}=${params.value}`
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
this.$socket.emit('printer.gcode.script', { script: gcode })
}
}
</script>
@@ -1,133 +0,0 @@
<template>
<v-container>
<responsive
:breakpoints="{
small: (el) => el.width <= 350,
medium: (el) => el.width > 350 && el.width <= 500,
}">
<template #default="{ el }">
<v-row>
<v-col v-if="allExtruders.length > 1" :class="{ 'col-12': el.is.small || el.is.medium }">
<div class="d-flex align-center">
<v-btn v-if="selectedExtruder !== activeExtruder" icon plain @click="resetToActiveExtruder">
<v-icon>{{ mdiRestart }}</v-icon>
</v-btn>
<v-select
v-model="selectedExtruder"
:label="$t('Panels.ExtruderControlPanel.PressureAdvanceSettings.Extruder').toString()"
:items="allExtruders"
:value="activeExtruder"
hide-details
outlined
dense></v-select>
</div>
</v-col>
<v-col :class="{ 'col-12': el.is.small }">
<number-input
:label="$t('Panels.ExtruderControlPanel.PressureAdvanceSettings.Advance').toString()"
param="ADVANCE"
:target="pressureAdvance"
:default-value="defaultPressureAdvance"
:extruder="selectedExtruder"
:output-error-msg="true"
:has-spinner="true"
:min="0"
:max="null"
:step="0.001"
:dec="3"
unit="s"
@submit="sendCmd"></number-input>
</v-col>
<v-col :class="{ 'col-12': el.is.small }">
<number-input
:label="$t('Panels.ExtruderControlPanel.PressureAdvanceSettings.SmoothTime').toString()"
param="SMOOTH_TIME"
:target="smoothTime"
:default-value="defaultSmoothTime"
:extruder="selectedExtruder"
:output-error-msg="true"
:has-spinner="true"
:spinner-factor="10"
:min="0"
:max="0.2"
:step="0.001"
:dec="3"
unit="s"
@submit="sendCmd"></number-input>
</v-col>
</v-row>
</template>
</responsive>
</v-container>
</template>
<script lang="ts">
import { Component, Mixins } from 'vue-property-decorator'
import { Debounce } from 'vue-debounce-decorator'
import BaseMixin from '@/components/mixins/base'
import NumberInput from '@/components/inputs/NumberInput.vue'
import Panel from '@/components/ui/Panel.vue'
import Responsive from '@/components/ui/Responsive.vue'
import { mdiRestart } from '@mdi/js'
@Component({
components: { NumberInput, Panel, Responsive },
})
export default class PressureAdvanceSettings extends Mixins(BaseMixin) {
mdiRestart = mdiRestart
private extruders: string[] = []
private selectedExtruder = ''
resetToActiveExtruder(): void {
this.selectedExtruder = this.$store.state.printer.toolhead?.extruder
}
get allExtruders(): string[] {
Object.keys(this.$store.state.printer).forEach((e) => {
if (e.startsWith('extruder') && !this.extruders.includes(e)) this.extruders.push(e)
})
this.extruders.length === 1 ? this.resetToActiveExtruder() : {}
return this.extruders
}
get activeExtruder(): string {
this.resetToActiveExtruder()
return this.$store.state.printer.toolhead?.extruder
}
get pressureAdvance(): number {
return Math.floor((this.$store.state.printer?.[this.selectedExtruder]?.pressure_advance ?? 0) * 1000) / 1000
}
get smoothTime(): number {
return Math.floor((this.$store.state.printer?.[this.selectedExtruder]?.smooth_time ?? 0.04) * 1000) / 1000
}
get defaultPressureAdvance(): number {
return (
Math.floor(
(this.$store.state.printer.configfile?.settings?.[this.selectedExtruder]?.pressure_advance ?? 0) * 1000
) / 1000
)
}
get defaultSmoothTime(): number {
return (
Math.floor(
(this.$store.state.printer.configfile?.settings?.[this.selectedExtruder]
?.pressure_advance_smooth_time ?? 0.04) * 1000
) / 1000
)
}
@Debounce(500)
sendCmd(params: { name: string; value: number }): void {
const gcode = `SET_PRESSURE_ADVANCE EXTRUDER=${this.selectedExtruder} ${params.name}=${params.value}`
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
this.$socket.emit('printer.gcode.script', { script: gcode })
}
}
</script>
+33 -49
View File
@@ -2,10 +2,8 @@
<panel
:icon="mdiPrinter3d"
:title="printer_name"
:card-class="
'farmprinter-panel ' +
(!printer.socket.isConnected && !printer.socket.isConnecting ? 'disabledPrinter' : '')
"
card-class="farmprinter-panel"
:class="panelClass"
:loading="printer.socket.isConnecting"
:toolbar-color="isCurrentPrinter ? 'primary' : ''">
<template #buttons>
@@ -17,7 +15,7 @@
</v-btn>
</template>
<v-list dense class="py-0">
<v-list-item link @click="currentCamId = 'off'">
<v-list-item link @click="currentCamName = 'off'">
<v-list-item-icon class="mr-2">
<v-icon small class="mt-1">{{ mdiWebcamOff }}</v-icon>
</v-list-item-icon>
@@ -26,15 +24,15 @@
</v-list-item-content>
</v-list-item>
<v-list-item
v-for="webcam of supportedPrinterWebcams"
:key="webcam.index"
v-for="webcam of printer_webcams"
:key="webcam.name"
link
@click="currentCamId = webcam.id">
@click="currentCamName = webcam.name">
<v-list-item-icon class="mr-2">
<v-icon small class="mt-1">{{ convertWebcamIcon(webcam.icon) }}</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title v-text="webcam.name"></v-list-item-title>
<v-list-item-title v-text="webcam.name" />
</v-list-item-content>
</v-list-item>
</v-list>
@@ -47,26 +45,12 @@
<div
v-if="
printer.socket.isConnected &&
currentCamId !== 'off' &&
currentCamName !== 'off' &&
currentWebcam &&
'service' in currentWebcam
"
class="webcamContainer">
<webcam-mjpegstreamer
v-if="currentWebcam.service === 'mjpegstreamer'"
:cam-settings="currentWebcam"
:printer-url="printerUrl"
:show-fps="false"></webcam-mjpegstreamer>
<webcam-mjpegstreamer-adaptive
v-else-if="currentWebcam.service === 'mjpegstreamer-adaptive'"
:cam-settings="currentWebcam"
:printer-url="printerUrl"
:show-fps="false"></webcam-mjpegstreamer-adaptive>
<webcam-uv4l-mjpeg
v-else-if="currentWebcam.service === 'uv4l-mjpeg'"
:cam-settings="currentWebcam"
:printer-url="printerUrl"
:show-fps="false"></webcam-uv4l-mjpeg>
<webcam-wrapper :webcam="currentWebcam" :printer-url="printerUrl" :show-fps="false" />
</div>
<v-card-title
class="white--text py-2"
@@ -130,22 +114,18 @@
import { Component, Mixins, Prop, Ref, Vue } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { FarmPrinterState } from '@/store/farm/printer/types'
import Mjpegstreamer from '@/components/webcams/Mjpegstreamer.vue'
import MjpegstreamerAdaptive from '@/components/webcams/MjpegstreamerAdaptive.vue'
import Uv4lMjpeg from '@/components/webcams/Uv4lMjpeg.vue'
import MainsailLogo from '@/components/ui/MainsailLogo.vue'
import Panel from '@/components/ui/Panel.vue'
import { mdiPrinter3d, mdiWebcam, mdiMenuDown, mdiWebcamOff, mdiFileOutline } from '@mdi/js'
import { Debounce } from 'vue-debounce-decorator'
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
import WebcamMixin from '@/components/mixins/webcam'
import WebcamWrapper from '@/components/webcams/WebcamWrapper.vue'
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
@Component({
components: {
Panel,
'webcam-mjpegstreamer': Mjpegstreamer,
'webcam-mjpegstreamer-adaptive': MjpegstreamerAdaptive,
'webcam-uv4l-mjpeg': Uv4lMjpeg,
'webcam-wrapper': WebcamWrapper,
'mainsail-logo': MainsailLogo,
},
})
@@ -175,12 +155,12 @@ export default class FarmPrinterPanel extends Mixins(BaseMixin, WebcamMixin) {
return this.$store.getters['farm/' + this.printer._namespace + '/isCurrentPrinter']
}
get currentCamId() {
return this.$store.getters['farm/' + this.printer._namespace + '/getSetting']('currentCamId', 'off')
get currentCamName() {
return this.$store.getters['farm/' + this.printer._namespace + '/getSetting']('currentCamName', 'off')
}
set currentCamId(newVal) {
this.$store.dispatch('farm/' + this.printer._namespace + '/setSettings', { currentCamId: newVal })
set currentCamName(newVal) {
this.$store.dispatch('farm/' + this.printer._namespace + '/setSettings', { currentCamName: newVal })
}
get printer_name() {
@@ -218,24 +198,30 @@ export default class FarmPrinterPanel extends Mixins(BaseMixin, WebcamMixin) {
}
get showWebcamSwitch() {
return this.printer.socket.isConnected && this.supportedPrinterWebcams.length > 0
if (this.printer_webcams.length == 0) return false
return this.printer.socket.isConnected
}
get printer_webcams() {
get printer_webcams(): GuiWebcamStateWebcam[] {
return this.$store.getters['farm/' + this.printer._namespace + '/getPrinterWebcams']
}
get supportedPrinterWebcams() {
return this.printer_webcams.filter((webcam: GuiWebcamStateWebcam) =>
['mjpegstreamer', 'mjpegstreamer-adaptive', 'uv4l-mjpeg'].includes(webcam.service)
get currentWebcam(): GuiWebcamStateWebcam | null {
const currentCam = this.printer_webcams?.find(
(webcam: GuiWebcamStateWebcam) => webcam.name === this.currentCamName
)
}
get currentWebcam() {
const currentCam = this.printer_webcams.find((webcam: any) => webcam.id === this.currentCamId)
if (currentCam) return currentCam
return false
return null
}
get panelClass(): string[] {
let output = []
if (!this.printer.socket.isConnected && !this.printer.socket.isConnecting) output.push('disabledPrinter')
return output
}
clickPrinter() {
@@ -293,10 +279,8 @@ export default class FarmPrinterPanel extends Mixins(BaseMixin, WebcamMixin) {
.v-overlay {
top: 48px;
}
</style>
<style>
.farmprinter-panel {
::v-deep .farmprinter-panel {
position: relative;
}
</style>
+291 -35
View File
@@ -1,9 +1,6 @@
<template>
<div>
<panel
:title="$t('Files.GCodeFiles').toString()"
:icon="mdiFileDocumentMultipleOutline"
card-class="gcode-files-panel">
<panel :title="$t('Files.GCodeFiles')" :icon="mdiFileDocumentMultipleOutline" card-class="gcode-files-panel">
<v-card-text>
<v-row>
<v-col class="col-12 d-flex align-center">
@@ -18,6 +15,15 @@
dense
style="max-width: 300px"></v-text-field>
<v-spacer></v-spacer>
<v-btn
v-if="selectedFiles.length"
:title="$t('Files.Download')"
color="primary"
class="px-2 minwidth-0 ml-3"
:loading="loadings.includes('gcodeDownloadZip')"
@click="downloadSelectedFiles">
<v-icon>{{ mdiCloudDownload }}</v-icon>
</v-btn>
<v-btn
v-if="selectedFiles.length"
:title="$t('Files.Delete')"
@@ -29,7 +35,7 @@
<input
ref="fileUpload"
type="file"
:accept="validGcodeExtensions.join(', ')"
:accept="gcodeInputFileAccept.join(', ')"
style="display: none"
multiple
@change="uploadFile" />
@@ -234,6 +240,7 @@
<v-tooltip
top
content-class="tooltip__content-opacity1"
:color="bigThumbnailTooltipColor"
:disabled="!item.big_thumbnail">
<template #activator="{ on, attrs }">
<vue-load-image>
@@ -246,16 +253,16 @@
v-bind="attrs"
v-on="on" />
<div slot="preloader">
<v-progress-circular
indeterminate
color="primary"></v-progress-circular>
<v-progress-circular indeterminate color="primary" />
</div>
<div slot="error">
<v-icon>{{ mdiFile }}</v-icon>
</div>
</vue-load-image>
</template>
<span><img :src="item.big_thumbnail" width="250" :alt="item.filename" /></span>
<span>
<img :src="item.big_thumbnail" width="250" :alt="item.filename" />
</span>
</v-tooltip>
</template>
<template v-else>
@@ -298,7 +305,7 @@
:bool="dialogPrintFile.show"
:file="dialogPrintFile.item"
:current-path="currentPath"
@closeDialog="closeStartPrint"></start-print-dialog>
@closeDialog="closeStartPrint" />
<v-menu v-model="contextMenu.shown" :position-x="contextMenu.x" :position-y="contextMenu.y" absolute offset-y>
<v-list>
<v-list-item
@@ -315,6 +322,13 @@
<v-icon class="mr-1">{{ mdiPlaylistPlus }}</v-icon>
{{ $t('Files.AddToQueue') }}
</v-list-item>
<v-list-item
v-if="!contextMenu.item.isDirectory && moonrakerComponents.includes('job_queue')"
:disabled="!isGcodeFile(contextMenu.item)"
@click="openAddBatchToQueueDialog(contextMenu.item)">
<v-icon class="mr-1">{{ mdiPlaylistPlus }}</v-icon>
{{ $t('Files.AddBatchToQueue') }}
</v-list-item>
<v-list-item
v-if="contextMenu.item.preheat_gcode !== null"
:disabled="['error', 'printing', 'paused'].includes(printer_state)"
@@ -329,6 +343,13 @@
<v-icon class="mr-1">{{ mdiVideo3d }}</v-icon>
{{ $t('Files.View3D') }}
</v-list-item>
<v-list-item
v-if="!contextMenu.item.isDirectory"
:disabled="!isGcodeFile(contextMenu.item)"
@click="scanMeta(contextMenu.item)">
<v-icon class="mr-1">{{ mdiMagnify }}</v-icon>
{{ $t('Files.ScanMeta') }}
</v-list-item>
<v-list-item v-if="!contextMenu.item.isDirectory" @click="downloadFile">
<v-icon class="mr-1">{{ mdiCloudDownload }}</v-icon>
{{ $t('Files.Download') }}
@@ -345,7 +366,11 @@
<v-icon class="mr-1">{{ mdiRenameBox }}</v-icon>
{{ $t('Files.Rename') }}
</v-list-item>
<v-list-item v-if="!contextMenu.item.isDirectory" class="red--text" @click="removeFile">
<v-list-item v-if="!contextMenu.item.isDirectory" @click="duplicateFile(contextMenu.item)">
<v-icon class="mr-1">{{ mdiContentCopy }}</v-icon>
{{ $t('Files.Duplicate') }}
</v-list-item>
<v-list-item v-if="!contextMenu.item.isDirectory" class="red--text" @click="deleteDialog = true">
<v-icon class="mr-1" color="error">{{ mdiDelete }}</v-icon>
{{ $t('Files.Delete') }}
</v-list-item>
@@ -360,7 +385,7 @@
</v-menu>
<v-dialog v-model="dialogCreateDirectory.show" :max-width="400">
<panel
:title="$t('Files.NewDirectory').toString()"
:title="$t('Files.NewDirectory')"
card-class="gcode-files-new-directory-dialog"
:margin-bottom="false">
<template #buttons>
@@ -375,7 +400,7 @@
:label="$t('Files.Name')"
required
:rules="nameInputRules"
@update:error="isInvalidName = !isInvalidName"
@update:error="(bool) => (isInvalidName = bool)"
@keypress.enter="createDirectoryAction"></v-text-field>
</v-card-text>
<v-card-actions>
@@ -388,10 +413,7 @@
</panel>
</v-dialog>
<v-dialog v-model="dialogRenameFile.show" :max-width="400">
<panel
:title="$t('Files.RenameFile').toString()"
card-class="gcode-files-rename-file-dialog"
:margin-bottom="false">
<panel :title="$t('Files.RenameFile')" card-class="gcode-files-rename-file-dialog" :margin-bottom="false">
<template #buttons>
<v-btn icon tile @click="dialogRenameFile.show = false">
<v-icon>{{ mdiCloseThick }}</v-icon>
@@ -401,10 +423,10 @@
<v-text-field
ref="inputFieldRenameFile"
v-model="dialogRenameFile.newName"
:label="$t('Files.Name').toString()"
:label="$t('Files.Name')"
required
:rules="nameInputRules"
@update:error="isInvalidName = !isInvalidName"
@update:error="(bool) => (isInvalidName = bool)"
@keyup.enter="renameFileAction"></v-text-field>
</v-card-text>
<v-card-actions>
@@ -416,9 +438,38 @@
</v-card-actions>
</panel>
</v-dialog>
<v-dialog v-model="dialogDuplicateFile.show" :max-width="400">
<panel
:title="$t('Files.DuplicateFile')"
card-class="gcode-files-duplicate-file-dialog"
:margin-bottom="false">
<template #buttons>
<v-btn icon tile @click="dialogDuplicateFile.show = false">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-card-text>
<v-text-field
ref="inputFieldDuplicateFile"
v-model="dialogDuplicateFile.newName"
:label="$t('Files.Name')"
required
:rules="nameInputRules"
@update:error="(bool) => (isInvalidName = bool)"
@keyup.enter="duplicateFileAction"></v-text-field>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="" text @click="dialogDuplicateFile.show = false">{{ $t('Files.Cancel') }}</v-btn>
<v-btn :disabled="isInvalidName" color="primary" text @click="duplicateFileAction">
{{ $t('Files.Duplicate') }}
</v-btn>
</v-card-actions>
</panel>
</v-dialog>
<v-dialog v-model="dialogRenameDirectory.show" max-width="400">
<panel
:title="$t('Files.RenameDirectory').toString()"
:title="$t('Files.RenameDirectory')"
card-class="gcode-files-rename-directory-dialog"
:margin-bottom="false">
<template #buttons>
@@ -433,7 +484,7 @@
:label="$t('Files.Name')"
required
:rules="nameInputRules"
@update:error="isInvalidName = !isInvalidName"
@update:error="(bool) => (isInvalidName = bool)"
@keyup.enter="renameDirectoryAction"></v-text-field>
</v-card-text>
<v-card-actions>
@@ -447,7 +498,7 @@
</v-dialog>
<v-dialog v-model="dialogDeleteDirectory.show" max-width="400">
<panel
:title="$t('Files.DeleteDirectory').toString()"
:title="$t('Files.DeleteDirectory')"
card-class="gcode-files-delete-directory-dialog"
:margin-bottom="false">
<template #buttons>
@@ -467,18 +518,45 @@
</v-card-actions>
</panel>
</v-dialog>
<!-- CONFIRM DELETE SINGLE FILE DIALOG -->
<v-dialog v-model="deleteDialog" max-width="400">
<panel :title="$t('Files.Delete')" card-class="gcode-files-delete-dialog" :margin-bottom="false">
<template #buttons>
<v-btn icon tile @click="deleteDialog = false">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-card-text>
<p class="mb-0">
{{ $t('Files.DeleteSingleFileQuestion', { name: contextMenu.item.filename }) }}
</p>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="" text @click="deleteDialog = false">
{{ $t('Files.Cancel') }}
</v-btn>
<v-btn color="error" text @click="removeFile">
{{ $t('Files.Delete') }}
</v-btn>
</v-card-actions>
</panel>
</v-dialog>
<!-- CONFIRM DELETE MULTIPLE FILES DIALOG -->
<v-dialog v-model="deleteSelectedDialog" max-width="400">
<panel
:title="$t('Files.Delete').toString()"
card-class="gcode-files-delete-selected-dialog"
:margin-bottom="false">
<panel :title="$t('Files.Delete')" card-class="gcode-files-delete-selected-dialog" :margin-bottom="false">
<template #buttons>
<v-btn icon tile @click="deleteSelectedDialog = false">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-card-text>
<p class="mb-0">{{ $t('Files.DeleteSelectedQuestion', { count: selectedFiles.length }) }}</p>
<p v-if="selectedFiles.length === 1" class="mb-0">
{{ $t('Files.DeleteSingleFileQuestion', { name: selectedFiles[0].filename }) }}
</p>
<p v-else class="mb-0">{{ $t('Files.DeleteSelectedQuestion', { count: selectedFiles.length }) }}</p>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
@@ -487,19 +565,68 @@
</v-card-actions>
</panel>
</v-dialog>
<v-dialog v-model="dialogAddBatchToQueue.show" max-width="400">
<panel
:title="$t('Files.AddToQueue')"
card-class="gcode-files-add-to-queue-dialog"
:icon="mdiPlaylistPlus"
:margin-bottom="false">
<template #buttons>
<v-btn icon tile @click="dialogAddBatchToQueue.show = false">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-card-text>
<v-text-field
ref="inputFieldAddToQueueCount"
v-model="dialogAddBatchToQueue.count"
:label="$t('Files.Count')"
required
hide-spin-buttons
type="number"
:rules="countInputRules"
@keyup.enter="addBatchToQueueAction">
<template #append-outer>
<div class="_spin_button_group">
<v-btn class="mt-n3" icon plain small @click="dialogAddBatchToQueue.count++">
<v-icon>{{ mdiChevronUp }}</v-icon>
</v-btn>
<v-btn
:disabled="dialogAddBatchToQueue.count <= 1"
class="mb-n3"
icon
plain
small
@click="dialogAddBatchToQueue.count--">
<v-icon>{{ mdiChevronDown }}</v-icon>
</v-btn>
</div>
</template>
</v-text-field>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="" text @click="dialogAddBatchToQueue.show = false">{{ $t('Files.Cancel') }}</v-btn>
<v-btn color="primary" text @click="addBatchToQueueAction">{{ $t('Files.AddToQueue') }}</v-btn>
</v-card-actions>
</panel>
</v-dialog>
</div>
</template>
<script lang="ts">
import { Component, Mixins, Watch } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { validGcodeExtensions } from '@/store/variables'
import { formatDate, formatFilesize, formatPrintTime, sortFiles } from '@/plugins/helpers'
import { defaultBigThumbnailBackground, validGcodeExtensions } from '@/store/variables'
import { formatFilesize, formatPrintTime, sortFiles } from '@/plugins/helpers'
import { FileStateFile, FileStateGcodefile } from '@/store/files/types'
import Panel from '@/components/ui/Panel.vue'
import SettingsRow from '@/components/settings/SettingsRow.vue'
import draggable from 'vuedraggable'
import {
mdiChevronDown,
mdiChevronUp,
mdiDragVertical,
mdiCheckboxBlankOutline,
mdiCheckboxMarked,
@@ -521,6 +648,7 @@ import {
mdiUpload,
mdiVideo3d,
mdiFileDocumentEditOutline,
mdiContentCopy,
} from '@mdi/js'
import StartPrintDialog from '@/components/dialogs/StartPrintDialog.vue'
import ControlMixin from '@/components/mixins/control'
@@ -543,6 +671,12 @@ interface dialogPrintFile {
item: FileStateGcodefile
}
interface dialogAddBatchToQueue {
show: boolean
count: number
item: FileStateGcodefile
}
interface dialogRenameObject {
show: boolean
newName: string
@@ -563,6 +697,9 @@ interface tableColumnSetting {
components: { StartPrintDialog, Panel, SettingsRow, draggable },
})
export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
mdiChevronDown = mdiChevronDown
mdiChevronUp = mdiChevronUp
mdiContentCopy = mdiContentCopy
mdiFile = mdiFile
mdiFileDocumentMultipleOutline = mdiFileDocumentMultipleOutline
mdiMagnify = mdiMagnify
@@ -585,8 +722,6 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
mdiCheckboxMarked = mdiCheckboxMarked
mdiDragVertical = mdiDragVertical
validGcodeExtensions = validGcodeExtensions
formatDate = formatDate
formatFilesize = formatFilesize
formatPrintTime = formatPrintTime
sortFiles = sortFiles
@@ -594,6 +729,7 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
declare $refs: {
fileUpload: HTMLInputElement
inputFieldRenameFile: HTMLInputElement
inputFieldDuplicateFile: HTMLInputElement
inputFieldCreateDirectory: HTMLInputElement
inputFieldRenameDirectory: HTMLInputElement
}
@@ -639,12 +775,24 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
item: { ...this.contextMenu.item },
}
private dialogAddBatchToQueue: dialogAddBatchToQueue = {
show: false,
count: 1,
item: { ...this.contextMenu.item },
}
private dialogRenameFile: dialogRenameObject = {
show: false,
newName: '',
item: { ...this.contextMenu.item },
}
private dialogDuplicateFile: dialogRenameObject = {
show: false,
newName: '',
item: { ...this.contextMenu.item },
}
private dialogRenameDirectory: dialogRenameObject = {
show: false,
newName: '',
@@ -657,6 +805,7 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
item: { ...this.contextMenu.item },
}
private deleteDialog = false
private deleteSelectedDialog = false
private isInvalidName = true
@@ -664,9 +813,19 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
(value: string) => !!value || this.$t('Files.InvalidNameEmpty'),
(value: string) => !this.existsFilename(value) || this.$t('Files.InvalidNameAlreadyExists'),
]
private countInputRules = [
(value: string) => !!value || this.$t('JobQueue.InvalidCountEmpty'),
(value: string) => parseInt(value) > 0 || this.$t('JobQueue.InvalidCountGreaterZero'),
]
existsFilename(name: string) {
return this.files.findIndex((file) => file.filename === name) >= 0
return this.files.findIndex((file: FileStateFile) => file.filename === name) >= 0
}
get gcodeInputFileAccept() {
if (this.isIOS) return []
return validGcodeExtensions
}
get currentPath() {
@@ -943,6 +1102,18 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
this.$store.dispatch('gui/saveSetting', { name: 'view.gcodefiles.countPerPage', value: newVal })
}
get bigThumbnailBackground() {
return this.$store.state.gui.uiSettings.bigThumbnailBackground ?? defaultBigThumbnailBackground
}
get bigThumbnailTooltipColor() {
if (defaultBigThumbnailBackground.toLowerCase() === this.bigThumbnailBackground.toLowerCase()) {
return undefined
}
return this.bigThumbnailBackground
}
getStatusIcon(status: string | null) {
return this.$store.getters['server/history/getPrintStatusIcon'](status)
}
@@ -1084,11 +1255,31 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
this.currentPath = this.currentPath.slice(0, this.currentPath.lastIndexOf('/'))
}
addToQueue(item: FileStateGcodefile | FileStateFile) {
async addToQueue(item: FileStateGcodefile) {
let filename = [this.currentPath, item.filename].join('/')
if (filename.startsWith('/')) filename = filename.slice(1)
this.$store.dispatch('server/jobQueue/addToQueue', [filename])
await this.$store.dispatch('server/jobQueue/addToQueue', [filename])
}
openAddBatchToQueueDialog(item: FileStateGcodefile) {
this.dialogAddBatchToQueue.show = true
this.dialogAddBatchToQueue.count = 1
this.dialogAddBatchToQueue.item = item
}
async addBatchToQueueAction() {
let filename = [this.currentPath, this.dialogAddBatchToQueue.item.filename].join('/')
if (filename.startsWith('/')) filename = filename.slice(1)
const array: string[] = []
for (let i = 0; i < this.dialogAddBatchToQueue.count; i++) {
array.push(filename)
}
await this.$store.dispatch('server/jobQueue/addToQueue', array)
this.dialogAddBatchToQueue.show = false
}
changeMetadataVisible(name: string, value: boolean) {
@@ -1125,6 +1316,36 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
window.open(href)
}
async downloadSelectedFiles() {
let items: string[] = []
const addElementToItems = async (absolutPath: string, directory: FileStateFile[]) => {
for (const file of directory) {
const filePath = `${absolutPath}/${file.filename}`
if (file.isDirectory && file.childrens) {
await addElementToItems(filePath, file.childrens)
continue
}
items.push(filePath)
}
}
await addElementToItems('gcodes/' + this.currentPath, this.selectedFiles)
const date = new Date()
const timestamp = `${date.getFullYear()}${date.getMonth()}${date.getDate()}-${date.getHours()}${date.getMinutes()}${date.getSeconds()}`
this.$socket.emit(
'server.files.zip',
{ items, dest: `config/gcodes-${timestamp}.zip` },
{ action: 'files/downloadZip', loading: 'gcodeDownloadZip' }
)
this.selectedFiles = []
}
renameFile(item: FileStateGcodefile) {
this.dialogRenameFile.item = item
this.dialogRenameFile.newName = item.filename
@@ -1147,6 +1368,24 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
)
}
duplicateFile(item: FileStateGcodefile) {
this.dialogDuplicateFile.item = item
this.dialogDuplicateFile.newName = item.filename
this.dialogDuplicateFile.show = true
setTimeout(() => {
this.$refs.inputFieldDuplicateFile?.focus()
}, 200)
}
duplicateFileAction() {
this.dialogDuplicateFile.show = false
this.$socket.emit('server.files.copy', {
source: 'gcodes' + this.currentPath + '/' + this.dialogDuplicateFile.item.filename,
dest: 'gcodes' + this.currentPath + '/' + this.dialogDuplicateFile.newName,
})
}
renameDirectory(item: FileStateGcodefile) {
this.dialogRenameDirectory.item = item
this.dialogRenameDirectory.newName = item.filename
@@ -1175,6 +1414,8 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
{ path: 'gcodes' + this.currentPath + '/' + this.contextMenu.item.filename },
{ action: 'files/getDeleteFile' }
)
this.deleteDialog = false
}
deleteDirectory(item: FileStateGcodefile) {
@@ -1239,6 +1480,12 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
this.$router.push({ path: '/viewer', query: { filename: 'gcodes' + this.currentPath + '/' + item.filename } })
}
scanMeta(item: FileStateFile) {
this.$store.dispatch('files/scanMetadata', {
filename: 'gcodes' + this.currentPath + '/' + item.filename,
})
}
deleteSelectedFiles() {
this.selectedFiles.forEach((item: FileStateGcodefile) => {
if (item.isDirectory) {
@@ -1269,7 +1516,7 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
return formatFilesize(value)
case 'date':
return this.formatDate(value)
return this.formatDateTime(value)
case 'time':
return this.formatPrintTime(value)
@@ -1293,6 +1540,15 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
}
</script>
<style scoped>
._spin_button_group {
width: 24px;
margin-top: -6px;
margin-left: -6px;
margin-bottom: -6px;
}
</style>
<style>
/*noinspection CssUnusedSymbol*/
.files-table .v-data-table-header__icon {
+68 -28
View File
@@ -1,13 +1,3 @@
<style>
.history-jobs-table th {
white-space: nowrap;
}
.history-jobs-table th.text-start {
padding-right: 0 !important;
}
</style>
<template>
<div>
<panel
@@ -234,7 +224,7 @@
<v-icon class="mr-1">{{ mdiPrinter }}</v-icon>
{{ $t('History.Reprint') }}
</v-list-item>
<v-list-item class="red--text" @click="deleteJob(contextMenu.item)">
<v-list-item class="red--text" @click="deleteDialog = true">
<v-icon class="mr-1" color="error">{{ mdiDelete }}</v-icon>
{{ $t('History.Delete') }}
</v-list-item>
@@ -272,7 +262,9 @@
<v-divider class="my-3"></v-divider>
<v-row>
<v-col>{{ $t('History.LastModified') }}</v-col>
<v-col class="text-right">{{ formatDate(detailsDialog.item.metadata.modified) }}</v-col>
<v-col class="text-right">
{{ formatDateTime(detailsDialog.item.metadata.modified * 1000) }}
</v-col>
</v-row>
</template>
<v-divider class="my-3"></v-divider>
@@ -289,13 +281,15 @@
<v-divider class="my-3"></v-divider>
<v-row>
<v-col>{{ $t('History.StartTime') }}</v-col>
<v-col class="text-right">{{ formatDate(detailsDialog.item.start_time) }}</v-col>
<v-col class="text-right">{{ formatDateTime(detailsDialog.item.start_time * 1000) }}</v-col>
</v-row>
<template v-if="'end_time' in detailsDialog.item && detailsDialog.item.end_time > 0">
<v-divider class="my-3"></v-divider>
<v-row>
<v-col>{{ $t('History.EndTime') }}</v-col>
<v-col class="text-right">{{ formatDate(detailsDialog.item.end_time) }}</v-col>
<v-col class="text-right">
{{ formatDateTime(detailsDialog.item.end_time * 1000) }}
</v-col>
</v-row>
</template>
<template
@@ -426,6 +420,33 @@
</v-card-text>
</panel>
</v-dialog>
<!-- CONFIRM DELETE SINGLE FILE DIALOG -->
<v-dialog v-model="deleteDialog" max-width="400">
<panel :title="$t('History.Delete')" card-class="history-delete-dialog" :margin-bottom="false">
<template #buttons>
<v-btn icon tile @click="deleteDialog = false">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-card-text>
<p class="mb-0">
{{ $t('History.DeleteSingleJobQuestion') }}
</p>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="" text @click="deleteDialog = false">
{{ $t('History.Cancel') }}
</v-btn>
<v-btn color="error" text @click="deleteJob">
{{ $t('History.Delete') }}
</v-btn>
</v-card-actions>
</panel>
</v-dialog>
<!-- CONFIRM DELETE MULTIPLE FILES DIALOG -->
<v-dialog v-model="deleteSelectedDialog" max-width="400">
<panel :title="$t('History.Delete')" card-class="history-delete-selected-dialog" :margin-bottom="false">
<template #buttons>
@@ -434,7 +455,12 @@
</v-btn>
</template>
<v-card-text>
<p class="mb-0">{{ $t('History.DeleteSelectedQuestion', { count: selectedJobs.length }) }}</p>
<p v-if="selectedJobs.length === 1" class="mb-0">
{{ $t('History.DeleteSingleJobQuestion') }}
</p>
<p v-else class="mb-0">
{{ $t('History.DeleteSelectedQuestion', { count: selectedJobs.length }) }}
</p>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
@@ -548,6 +574,7 @@ export default class HistoryListPanel extends Mixins(BaseMixin) {
type: 'create',
}
private deleteDialog = false
private deleteSelectedDialog = false
get jobs() {
@@ -761,12 +788,6 @@ export default class HistoryListPanel extends Mixins(BaseMixin) {
this.$socket.emit('server.history.list', { start: 0, limit: 50 }, { action: 'server/history/getHistory' })
}
formatDate(date: number) {
const tmp2 = new Date(date * 1000)
return tmp2.toLocaleString().replace(',', '')
}
formatPrintTime(totalSeconds: number) {
if (totalSeconds) {
let output = ''
@@ -917,12 +938,14 @@ export default class HistoryListPanel extends Mixins(BaseMixin) {
this.$socket.emit('printer.print.start', { filename: item.filename }, { action: 'switchToDashboard' })
}
deleteJob(item: ServerHistoryStateJob) {
deleteJob() {
this.$socket.emit(
'server.history.delete_job',
{ uid: item.job_id },
{ uid: this.contextMenu.item.job_id },
{ action: 'server/history/getDeletedJobs' }
)
this.deleteDialog = false
}
deleteSelectedJobs() {
@@ -939,7 +962,7 @@ export default class HistoryListPanel extends Mixins(BaseMixin) {
}
exportHistory() {
const checkString = parseFloat('1.23').toLocaleString()
const checkString = parseFloat('1.23').toLocaleString(this.browserLocale)
const decimalSeparator = checkString.indexOf(',') >= 0 ? ',' : '.'
const csvSeperator = decimalSeparator === ',' ? ';' : ','
@@ -988,7 +1011,14 @@ export default class HistoryListPanel extends Mixins(BaseMixin) {
})
}
const csvContent = 'data:text/csv;charset=utf-8,' + content.map((e) => e.join(csvSeperator)).join('\n')
// escape fields with the csvSeperator in the content
// prettier-ignore
const csvContent =
'data:text/csv;charset=utf-8,' +
content.map((entry) =>
entry.map((field) => (field.indexOf(csvSeperator) === -1 ? field : `"${field}"`)).join(csvSeperator)
).join('\n')
const link = document.createElement('a')
link.setAttribute('href', encodeURI(csvContent))
link.setAttribute('download', 'print_history.csv')
@@ -1013,7 +1043,7 @@ export default class HistoryListPanel extends Mixins(BaseMixin) {
if (!format) {
switch (col.outputType) {
case 'date':
return this.formatDate(value)
return this.formatDateTime(value * 1000)
case 'time':
return value?.toFixed() ?? ''
@@ -1021,7 +1051,7 @@ export default class HistoryListPanel extends Mixins(BaseMixin) {
default:
switch (typeof value) {
case 'number':
return value?.toLocaleString(undefined, { useGrouping: false }) ?? 0
return value?.toLocaleString(this.browserLocale, { useGrouping: false }) ?? 0
case 'string':
if (escapeChar !== null && value.includes(escapeChar)) value = '"' + value + '"'
@@ -1038,7 +1068,7 @@ export default class HistoryListPanel extends Mixins(BaseMixin) {
return formatFilesize(value)
case 'date':
return this.formatDate(value)
return this.formatDateTime(value * 1000)
case 'time':
return this.formatPrintTime(value)
@@ -1081,3 +1111,13 @@ export default class HistoryListPanel extends Mixins(BaseMixin) {
}
}
</script>
<style scoped>
::v-deep .history-jobs-table th {
white-space: nowrap;
}
::v-deep .history-jobs-table th.text-start {
padding-right: 0 !important;
}
</style>
@@ -57,11 +57,23 @@
</v-simple-table>
</v-col>
<v-col class="col-12 col-sm-6 col-md-4">
<history-all-print-status></history-all-print-status>
<history-all-print-status-chart
v-if="togglePrintStatus === 'chart'"></history-all-print-status-chart>
<history-all-print-status-table v-else></history-all-print-status-table>
<div class="text-center mb-3">
<v-btn-toggle v-model="togglePrintStatus" small mandatory>
<v-btn small value="chart">
{{ $t('History.Chart') }}
</v-btn>
<v-btn small value="table">
{{ $t('History.Table') }}
</v-btn>
</v-btn-toggle>
</div>
</v-col>
<v-col class="col-12 col-sm-12 col-md-4">
<history-filament-usage v-if="toggleChart === 'filament_usage'"></history-filament-usage>
<history-printtime-avg v-if="toggleChart === 'printtime_avg'"></history-printtime-avg>
<history-printtime-avg v-else-if="toggleChart === 'printtime_avg'"></history-printtime-avg>
<div class="text-center mt-3">
<v-btn-toggle v-model="toggleChart" small mandatory>
<v-btn small value="filament_usage">
@@ -84,11 +96,11 @@ import BaseMixin from '@/components/mixins/base'
import Panel from '@/components/ui/Panel.vue'
import HistoryFilamentUsage from '@/components/charts/HistoryFilamentUsage.vue'
import HistoryPrinttimeAvg from '@/components/charts/HistoryPrinttimeAvg.vue'
import HistoryAllPrintStatus from '@/components/charts/HistoryAllPrintStatus.vue'
import HistoryAllPrintStatusChart from '@/components/charts/HistoryAllPrintStatusChart.vue'
import { ServerHistoryStateJob } from '@/store/server/history/types'
import { mdiChartAreaspline } from '@mdi/js'
@Component({
components: { Panel, HistoryFilamentUsage, HistoryPrinttimeAvg, HistoryAllPrintStatus },
components: { Panel, HistoryFilamentUsage, HistoryPrinttimeAvg, HistoryAllPrintStatusChart },
})
export default class HistoryStatisticsPanel extends Mixins(BaseMixin) {
mdiChartAreaspline = mdiChartAreaspline
@@ -177,6 +189,14 @@ export default class HistoryStatisticsPanel extends Mixins(BaseMixin) {
this.$store.dispatch('gui/saveSetting', { name: 'view.history.toggleChartCol3', value: newVal })
}
get togglePrintStatus() {
return this.$store.state.gui.view.history.toggleChartCol2
}
set togglePrintStatus(newVal) {
this.$store.dispatch('gui/saveSetting', { name: 'view.history.toggleChartCol2', value: newVal })
}
formatPrintTime(totalSeconds: number) {
if (totalSeconds) {
let output = ''
+10 -125
View File
@@ -1,6 +1,10 @@
<template>
<div>
<panel ref="jobqueuePanel" :icon="mdiTrayFull" :title="$t('JobQueue.JobQueue')" card-class="jobqueue-panel">
<panel
ref="jobqueuePanel"
:icon="mdiTrayFull"
:title="$t('JobQueue.JobQueue').toString()"
card-class="jobqueue-panel">
<template #buttons>
<v-btn
v-if="queueState === 'paused'"
@@ -48,98 +52,29 @@
</template>
<template #item="{ item }">
<tr
:key="item.job_id"
v-longpress:600="(e) => showContextMenu(e, item)"
class="file-list-cursor user-select-none"
@contextmenu="showContextMenu($event, item)">
<td class="pr-0 text-center" style="width: 32px">
<template v-if="getSmallThumbnail(item) && getBigThumbnail(item)">
<v-tooltip
v-if="!item.isDirectory && getSmallThumbnail(item) && getBigThumbnail(item)"
top
content-class="tooltip__content-opacity1">
<template #activator="{ on, attrs }">
<vue-load-image>
<img
slot="image"
:src="getSmallThumbnail(item)"
width="32"
height="32"
v-bind="attrs"
v-on="on" />
<v-progress-circular
slot="preloader"
indeterminate
color="primary"></v-progress-circular>
<v-icon slot="error">{{ mdiFile }}</v-icon>
</vue-load-image>
</template>
<span><img :src="getBigThumbnail(item)" width="250" /></span>
</v-tooltip>
</template>
<template v-else-if="getSmallThumbnail(item)">
<vue-load-image>
<img slot="image" :src="getSmallThumbnail(item)" width="32" height="32" />
<v-progress-circular
slot="preloader"
indeterminate
color="primary"></v-progress-circular>
<v-icon slot="error">{{ mdiFile }}</v-icon>
</vue-load-image>
</template>
<template v-else>
<v-icon>{{ mdiFile }}</v-icon>
</template>
</td>
<td class=" ">
<div class="d-block text-truncate" :style="styleContentTdWidth">{{ item.filename }}</div>
<small v-if="existMetadata(item)">{{ getDescription(item) }}</small>
</td>
</tr>
<jobqueue-entry :key="item.job_id" :item="item" :content-td-width="contentTdWidth" />
</template>
</v-data-table>
<resize-observer @notify="handleResize" />
</panel>
<v-menu v-model="contextMenu.shown" :position-x="contextMenu.x" :position-y="contextMenu.y" absolute offset-y>
<v-list>
<v-list-item @click="deleteJob(contextMenu.item)">
<v-icon class="mr-1">{{ mdiPlaylistRemove }}</v-icon>
{{ $t('JobQueue.RemoveFromQueue') }}
</v-list-item>
</v-list>
</v-menu>
</div>
</template>
<script lang="ts">
import { Component, Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { ServerHistoryStateJob } from '@/store/server/history/types'
import { formatFilesize, formatPrintTime } from '@/plugins/helpers'
import Panel from '@/components/ui/Panel.vue'
import { ServerJobQueueStateJob } from '@/store/server/jobQueue/types'
import { mdiPlay, mdiPause, mdiFile, mdiPlaylistRemove, mdiTrayFull } from '@mdi/js'
import { mdiPlay, mdiPause, mdiTrayFull } from '@mdi/js'
import JobqueueEntry from '@/components/panels/Status/JobqueueEntry.vue'
@Component({
components: { Panel },
components: { JobqueueEntry, Panel },
})
export default class JobqueuePanel extends Mixins(BaseMixin) {
mdiPlay = mdiPlay
mdiPause = mdiPause
mdiFile = mdiFile
mdiPlaylistRemove = mdiPlaylistRemove
mdiTrayFull = mdiTrayFull
formatFilesize = formatFilesize
private contentTdWidth = 100
private contextMenu = {
shown: false,
touchTimer: undefined,
x: 0,
y: 0,
item: {},
}
declare $refs: {
jobqueuePanel: any
@@ -161,27 +96,6 @@ export default class JobqueuePanel extends Mixins(BaseMixin) {
this.$store.dispatch('gui/saveSetting', { name: 'view.jobqueue.countPerPage', value: newVal })
}
get styleContentTdWidth() {
return `width: ${this.contentTdWidth}px;`
}
showContextMenu(e: any, item: ServerHistoryStateJob) {
if (!this.contextMenu.shown) {
e?.preventDefault()
this.contextMenu.shown = true
this.contextMenu.x = e?.clientX || e?.pageX || window.screenX / 2
this.contextMenu.y = e?.clientY || e?.pageY || window.screenY / 2
this.contextMenu.item = item
this.$nextTick(() => {
this.contextMenu.shown = true
})
}
}
deleteJob(item: ServerJobQueueStateJob) {
this.$store.dispatch('server/jobQueue/deleteFromQueue', [item.job_id])
}
startJobqueue() {
this.$store.dispatch('server/jobQueue/start')
}
@@ -190,35 +104,6 @@ export default class JobqueuePanel extends Mixins(BaseMixin) {
this.$store.dispatch('server/jobQueue/pause')
}
getSmallThumbnail(item: ServerJobQueueStateJob) {
return this.$store.getters['server/jobQueue/getSmallThumbnail'](item)
}
getBigThumbnail(item: ServerJobQueueStateJob) {
return this.$store.getters['server/jobQueue/getBigThumbnail'](item)
}
getDescription(item: ServerJobQueueStateJob) {
let output = ''
output += this.$t('Files.Filament') + ': '
if (item.metadata?.filament_total || item.metadata.filament_weight_total) {
if (item.metadata?.filament_total) output += item.metadata.filament_total.toFixed() + ' mm'
if (item.metadata?.filament_total && item.metadata.filament_weight_total) output += ' / '
if (item.metadata?.filament_weight_total) output += item.metadata.filament_weight_total.toFixed(2) + ' g'
} else output += '--'
output += ', ' + this.$t('Files.PrintTime') + ': '
if (item.metadata?.estimated_time) output += formatPrintTime(item.metadata.estimated_time)
else output += '--'
return output
}
existMetadata(item: ServerJobQueueStateJob) {
return item?.metadata?.metadataPulled
}
mounted() {
this.calcContentTdWidth()
}
@@ -235,7 +120,7 @@ export default class JobqueuePanel extends Mixins(BaseMixin) {
}
</script>
<style>
<style scoped>
.jobqueue-panel {
position: relative;
}
+142 -47
View File
@@ -1,37 +1,106 @@
<template>
<panel
v-if="klipperState !== 'ready' && socketIsConnected"
:icon="mdiAlertCircle"
:title="$t('Panels.KlippyStatePanel.KlippyState') + ': ' + klipperState"
card-class="klippy-state-panel">
<div v-if="klipperState !== 'ready' && socketIsConnected">
<template v-if="klippyIsConnected">
<v-card-text v-if="klippy_message !== null" class="py-1 mt-2">
<pre style="white-space: pre-wrap">{{ klippy_message }}</pre>
</v-card-text>
<v-card-text v-else class="text-center py-3">
<v-progress-circular indeterminate color="primary"></v-progress-circular>
</v-card-text>
<v-divider class="mt-2"></v-divider>
<v-card-actions class="justify-start">
<v-btn small class="ml-2 error--text" @click="restart">
<v-icon class="mr-sm-2">{{ mdiRestart }}</v-icon>
{{ $t('Panels.KlippyStatePanel.Restart') }}
</v-btn>
<v-btn small class="ml-4 error--text" @click="firmwareRestart">
<v-icon class="mr-sm-2">{{ mdiRestart }}</v-icon>
{{ $t('Panels.KlippyStatePanel.FirmwareRestart') }}
</v-btn>
</v-card-actions>
<v-alert :color="messageType.color" dense text border="left" class="mb-0 mb-6">
<!-- KLIPPER MESSAGE TITLE -->
<p class="font-weight-medium d-flex align-center">
<v-icon :color="messageType.color" class="pr-2">{{ messageType.icon }}</v-icon>
{{ $t('Panels.KlippyStatePanel.ServiceReports', { service: 'Klipper' }) }}:
{{ klipperState.toUpperCase() }}
</p>
<!-- KLIPPER MESSAGE -->
<div v-if="klippy_message !== null">
<pre style="white-space: pre-wrap">{{ klippy_message.trim() }}</pre>
<v-divider class="mt-2 pb-3"></v-divider>
<v-row>
<!-- RESTART BUTTONS -->
<v-col>
<v-btn
small
outlined
text
:class="`${messageType.color}--text my-1`"
style="width: 100%"
@click="restart">
<v-icon class="mr-sm-2">{{ mdiRestart }}</v-icon>
{{ $t('Panels.KlippyStatePanel.Restart') }}
</v-btn>
<v-btn
small
outlined
text
:class="`${messageType.color}--text my-1`"
style="width: 100%"
@click="firmwareRestart">
<v-icon class="mr-sm-2">{{ mdiRestart }}</v-icon>
{{ $t('Panels.KlippyStatePanel.FirmwareRestart') }}
</v-btn>
</v-col>
<!-- LOG DOWNLOAD BUTTONS -->
<v-col>
<v-btn
:href="apiUrl + '/server/files/klippy.log'"
small
outlined
text
:class="`${messageType.color}--text my-1`"
style="width: 100%"
@click="downloadLog">
<v-icon class="mr-2">{{ mdiDownload }}</v-icon>
Klipper Log
</v-btn>
<v-btn
:href="apiUrl + '/server/files/moonraker.log'"
small
outlined
text
:class="`${messageType.color}--text my-1`"
style="width: 100%"
@click="downloadLog">
<v-icon class="mr-2">{{ mdiDownload }}</v-icon>
Moonraker Log
</v-btn>
</v-col>
</v-row>
</div>
<!-- LOADER -->
<v-card-text v-else class="text-center py-3">
<v-progress-circular indeterminate :color="messageType.color"></v-progress-circular>
</v-card-text>
</v-alert>
</template>
<template v-else>
<v-card-text class="pt-5 pb-1">
<!-- Power OFF panel -->
<template v-else-if="isPrinterPowerOff">
<v-alert dense text border="left" class="mb-6">
<p class="font-weight-medium d-flex align-center">
<v-icon class="pr-2">{{ messageType.icon }}</v-icon>
{{ $t('Panels.KlippyStatePanel.PrinterSwitchedOff') }}
</p>
<p>{{ $t('Panels.KlippyStatePanel.PrinterSwitchedOffDescription') }}</p>
<v-row>
<v-col class="text-center">
<v-btn small outlined text :class="`${messageType.color}--text my-1`" @click="powerOn">
<v-icon class="mr-sm-2">{{ mdiPower }}</v-icon>
{{ $t('Panels.KlippyStatePanel.PowerOn') }}
</v-btn>
</v-col>
</v-row>
</v-alert>
</template>
<!-- DISCONNECTED INFOGRAPHIC -->
<template v-else-if="klipperState === 'disconnected'">
<v-alert dense text border="left" class="mb-6">
<p class="font-weight-medium d-flex align-center">
<v-icon class="pr-2">{{ messageType.icon }}</v-icon>
{{ $t('Panels.KlippyStatePanel.ServiceReports', { service: 'Moonraker' }) }}:
{{ klipperState.toUpperCase() }}
</p>
<connection-status :moonraker="true" :klipper="false"></connection-status>
<p class="mt-2 mb-0 text-center">{{ $t('Panels.KlippyStatePanel.MoonrakerCannotConnect') }}</p>
<v-divider class="my-2"></v-divider>
<p class="mt-2">{{ $t('Panels.KlippyStatePanel.KlipperCheck') }}</p>
</v-card-text>
<p class="mb-0 text-center">{{ $t('Panels.KlippyStatePanel.CheckKlippyAndUdsAddress') }}</p>
</v-alert>
</template>
</panel>
</div>
</template>
<script lang="ts">
@@ -40,21 +109,45 @@ import { Mixins } from 'vue-property-decorator'
import BaseMixin from '../mixins/base'
import ConnectionStatus from '../ui/ConnectionStatus.vue'
import Panel from '@/components/ui/Panel.vue'
import { mdiAlertCircle, mdiRestart } from '@mdi/js'
import {
mdiRestart,
mdiDownload,
mdiMessageOutline,
mdiAlertOutline,
mdiRocketLaunch,
mdiConnection,
mdiPrinter3d,
mdiPower,
} from '@mdi/js'
@Component({
components: { Panel, ConnectionStatus },
})
export default class KlippyStatePanel extends Mixins(BaseMixin) {
//private timer: number | null = null
mdiAlertCircle = mdiAlertCircle
mdiPrinter3d = mdiPrinter3d
mdiRestart = mdiRestart
mdiDownload = mdiDownload
mdiPower = mdiPower
get klippy_message() {
return this.$store.state.server.klippy_message ?? null
}
get messageType(): { color: string; icon: string } {
switch (this.klipperState) {
case 'startup':
return { color: 'info', icon: mdiRocketLaunch }
case 'shutdown':
return { color: 'warning', icon: mdiAlertOutline }
case 'error':
return { color: 'error', icon: mdiAlertOutline }
case 'disconnected':
return { color: '', icon: mdiConnection }
default:
return { color: '', icon: mdiMessageOutline }
}
}
restart() {
this.$socket.emit('printer.restart', {}, { loading: 'restart' })
}
@@ -63,22 +156,24 @@ export default class KlippyStatePanel extends Mixins(BaseMixin) {
this.$socket.emit('printer.firmware_restart', {}, { loading: 'firmwareRestart' })
}
/*requestKlippyState() {
this.$socket.emit('printer.info', {}, { action: 'printer/getInfo' })
downloadLog(event: any) {
event.preventDefault()
let href = ''
if ('href' in event.target.attributes) href = event.target.attributes.href.value
if ('href' in event.target.parentElement.attributes) href = event.target.parentElement.attributes.href.value
window.open(href)
}
@Watch('klipperState')
klipperStateChanged(newVal: string) {
if (['ready', 'disconnected'].includes(newVal)) {
if (this.timer) {
clearInterval(this.timer)
this.timer = null
}
} else if (this.timer === null) {
this.timer = setInterval(() => {
this.requestKlippyState()
}, 2000)
}
}*/
powerOn() {
this.$socket.emit(
'machine.device_power.post_device',
{
device: this.printerPowerDevice,
action: 'on',
},
{ action: 'server/power/responseToggle' }
)
}
}
</script>
@@ -1,9 +1,7 @@
<style scoped></style>
<template>
<div>
<panel
:title="$t('Machine.ConfigFilesPanel.ConfigFiles').toString()"
:title="$t('Machine.ConfigFilesPanel.ConfigFiles')"
card-class="machine-configfiles-panel"
:icon="mdiInformation"
:collapsible="true">
@@ -162,7 +160,7 @@
<td class="text-no-wrap text-right">
{{ item.isDirectory ? '--' : formatFilesize(item.size) }}
</td>
<td class="text-right">{{ formatDate(item.modified) }}</td>
<td class="text-right">{{ formatDateTime(item.modified) }}</td>
</tr>
</template>
</v-data-table>
@@ -203,6 +201,10 @@
<v-icon class="mr-1">{{ mdiRenameBox }}</v-icon>
{{ $t('Machine.ConfigFilesPanel.Rename') }}
</v-list-item>
<v-list-item v-if="!contextMenu.item.isDirectory" @click="duplicateFile(contextMenu.item)">
<v-icon class="mr-1">{{ mdiContentCopy }}</v-icon>
{{ $t('Machine.ConfigFilesPanel.Duplicate') }}
</v-list-item>
<v-list-item
v-if="contextMenu.item.isDirectory && contextMenu.item.permissions.includes('w')"
@click="renameDirectory(contextMenu.item)">
@@ -212,7 +214,7 @@
<v-list-item
v-if="!contextMenu.item.isDirectory && contextMenu.item.permissions.includes('w')"
class="red--text"
@click="removeFile">
@click="deleteDialog = true">
<v-icon class="mr-1" color="error">{{ mdiDelete }}</v-icon>
{{ $t('Machine.ConfigFilesPanel.Delete') }}
</v-list-item>
@@ -236,7 +238,7 @@
dialogImage.item.svg = null
">
<panel
:title="dialogImage.item.name"
:title="dialogImage.item.name ?? ''"
card-class="maschine-configfiles-imageviewer-dialog"
style="position: relative">
<template #buttons>
@@ -263,7 +265,7 @@
</v-dialog>
<v-dialog v-model="dialogCreateFile.show" max-width="400">
<panel
:title="$t('Machine.ConfigFilesPanel.CreateFile').toString()"
:title="$t('Machine.ConfigFilesPanel.CreateFile')"
card-class="maschine-configfiles-create-file-dialog"
:margin-bottom="false">
<template #buttons>
@@ -278,7 +280,7 @@
:label="$t('Machine.ConfigFilesPanel.Name')"
required
:rules="nameInputRules"
@update:error="isInvalidName = !isInvalidName"
@update:error="(bool) => (isInvalidName = bool)"
@keyup.enter="createFileAction"></v-text-field>
</v-card-text>
<v-card-actions>
@@ -294,7 +296,7 @@
</v-dialog>
<v-dialog v-model="dialogRenameFile.show" max-width="400">
<panel
:title="$t('Machine.ConfigFilesPanel.RenameFile').toString()"
:title="$t('Machine.ConfigFilesPanel.RenameFile')"
card-class="maschine-configfiles-rename-file-dialog"
:margin-bottom="false">
<template #buttons>
@@ -309,7 +311,7 @@
:label="$t('Machine.ConfigFilesPanel.Name')"
required
:rules="nameInputRules"
@update:error="isInvalidName = !isInvalidName"
@update:error="(bool) => (isInvalidName = bool)"
@keyup.enter="renameFileAction"></v-text-field>
</v-card-text>
<v-card-actions>
@@ -323,9 +325,40 @@
</v-card-actions>
</panel>
</v-dialog>
<v-dialog v-model="dialogDuplicateFile.show" max-width="400">
<panel
:title="$t('Machine.ConfigFilesPanel.DuplicateFile')"
card-class="maschine-configfiles-duplicate-file-dialog"
:margin-bottom="false">
<template #buttons>
<v-btn icon tile @click="dialogDuplicateFile.show = false">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-card-text>
<v-text-field
ref="inputDialoDuplicateFileName"
v-model="dialogDuplicateFile.newName"
:label="$t('Machine.ConfigFilesPanel.Name')"
required
:rules="nameInputRules"
@update:error="(bool) => (isInvalidName = bool)"
@keyup.enter="duplicateFileAction" />
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn color="" text @click="dialogDuplicateFile.show = false">
{{ $t('Machine.ConfigFilesPanel.Cancel') }}
</v-btn>
<v-btn :disabled="isInvalidName" color="primary" text @click="duplicateFileAction">
{{ $t('Machine.ConfigFilesPanel.Duplicate') }}
</v-btn>
</v-card-actions>
</panel>
</v-dialog>
<v-dialog v-model="dialogCreateDirectory.show" max-width="400">
<panel
:title="$t('Machine.ConfigFilesPanel.CreateDirectory').toString()"
:title="$t('Machine.ConfigFilesPanel.CreateDirectory')"
card-class="maschine-configfiles-create-directory-dialog"
:margin-bottom="false">
<template #buttons>
@@ -340,7 +373,7 @@
:label="$t('Machine.ConfigFilesPanel.Name')"
required
:rules="nameInputRules"
@update:error="isInvalidName = !isInvalidName"
@update:error="(bool) => (isInvalidName = bool)"
@keyup.enter="createDirectoryAction"></v-text-field>
</v-card-text>
<v-card-actions>
@@ -356,7 +389,7 @@
</v-dialog>
<v-dialog v-model="dialogRenameDirectory.show" max-width="400">
<panel
:title="$t('Machine.ConfigFilesPanel.RenameDirectory').toString()"
:title="$t('Machine.ConfigFilesPanel.RenameDirectory')"
card-class="maschine-configfiles-rename-directory-dialog"
:margin-bottom="false">
<template #buttons>
@@ -371,7 +404,7 @@
:label="$t('Machine.ConfigFilesPanel.Name')"
required
:rules="nameInputRules"
@update:error="isInvalidName = !isInvalidName"
@update:error="(bool) => (isInvalidName = bool)"
@keyup.enter="renameDirectoryAction"></v-text-field>
</v-card-text>
<v-card-actions>
@@ -387,7 +420,7 @@
</v-dialog>
<v-dialog v-model="dialogDeleteDirectory.show" max-width="400">
<panel
:title="$t('Machine.ConfigFilesPanel.DeleteDirectory').toString()"
:title="$t('Machine.ConfigFilesPanel.DeleteDirectory')"
card-class="maschine-configfiles-delete-directory-dialog"
:margin-bottom="false">
<template #buttons>
@@ -415,10 +448,42 @@
</v-card-actions>
</panel>
</v-dialog>
<!-- CONFIRM DELETE SINGLE FILE DIALOG -->
<v-dialog v-model="deleteDialog" max-width="400">
<panel
:title="$t('Machine.ConfigFilesPanel.Delete')"
card-class="maschine-configfiles-delete-dialog"
:margin-bottom="false">
<template #buttons>
<v-btn icon tile @click="deleteDialog = false">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-card-text>
<p class="mb-0">
{{
$t('Machine.ConfigFilesPanel.DeleteSingleFileQuestion', { name: contextMenu.item.filename })
}}
</p>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="" text @click="deleteDialog = false">
{{ $t('Machine.ConfigFilesPanel.Cancel') }}
</v-btn>
<v-btn color="error" text @click="removeFile">
{{ $t('Machine.ConfigFilesPanel.Delete') }}
</v-btn>
</v-card-actions>
</panel>
</v-dialog>
<!-- CONFIRM DELETE MULTIPLE FILES DIALOG -->
<v-dialog v-model="deleteSelectedDialog" max-width="400">
<panel
:title="$t('Machine.ConfigFilesPanel.Delete').toString()"
card-class="gcode-files-delete-selected-dialog"
:title="$t('Machine.ConfigFilesPanel.Delete')"
card-class="maschine-configfiles-delete-selected-dialog"
:margin-bottom="false">
<template #buttons>
<v-btn icon tile @click="deleteSelectedDialog = false">
@@ -426,7 +491,12 @@
</v-btn>
</template>
<v-card-text>
<p class="mb-0">
<p v-if="selectedFiles.length === 1" class="mb-0">
{{
$t('Machine.ConfigFilesPanel.DeleteSingleFileQuestion', { name: selectedFiles[0].filename })
}}
</p>
<p v-else class="mb-0">
{{ $t('Machine.ConfigFilesPanel.DeleteSelectedQuestion', { count: selectedFiles.length }) }}
</p>
</v-card-text>
@@ -441,6 +511,7 @@
</v-card-actions>
</panel>
</v-dialog>
<v-snackbar v-model="uploadSnackbar.status" :timeout="-1" :value="true" fixed right bottom dark>
<span v-if="uploadSnackbar.max > 1" class="mr-1">
({{ uploadSnackbar.number }}/{{ uploadSnackbar.max }})
@@ -462,7 +533,7 @@
<script lang="ts">
import { Component, Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { formatDate, formatFilesize, sortFiles } from '@/plugins/helpers'
import { formatFilesize, sortFiles } from '@/plugins/helpers'
import { FileStateFile, FileStateGcodefile } from '@/store/files/types'
import axios from 'axios'
import Panel from '@/components/ui/Panel.vue'
@@ -484,6 +555,7 @@ import {
mdiDelete,
mdiCloseThick,
mdiLockOutline,
mdiContentCopy,
} from '@mdi/js'
interface contextMenu {
@@ -550,15 +622,16 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
mdiDelete = mdiDelete
mdiCloseThick = mdiCloseThick
mdiLockOutline = mdiLockOutline
mdiContentCopy = mdiContentCopy
sortFiles = sortFiles
formatFilesize = formatFilesize
formatDate = formatDate
declare $refs: {
fileUpload: HTMLInputElement
inputDialogCreateFileName: HTMLInputElement
inputDialogRenameFileName: HTMLInputElement
inputDialogDuplicateFileName: HTMLInputElement
inputDialogCreateDirectoryName: HTMLInputElement
inputDialogRenameDirectoryName: HTMLInputElement
}
@@ -599,6 +672,16 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
modified: new Date(),
},
}
private dialogDuplicateFile: dialogRenameObject = {
show: false,
newName: '',
item: {
isDirectory: false,
filename: '',
permissions: '',
modified: new Date(),
},
}
private dialogCreateDirectory = {
show: false,
name: '',
@@ -645,6 +728,7 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
},
}
private deleteDialog = false
private deleteSelectedDialog = false
private isInvalidName = true
@@ -667,6 +751,17 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
get toolbarButtons() {
return [
{
text: this.$t('Machine.ConfigFilesPanel.Download'),
color: 'primary',
icon: mdiCloudDownload,
loadingName: 'configDownloadZip',
onlyWriteable: false,
condition: this.selectedFiles.length > 0,
click: () => {
this.downloadSelectedFiles()
},
},
{
text: this.$t('Machine.ConfigFilesPanel.Delete'),
color: 'error',
@@ -703,7 +798,7 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
loadingName: null,
onlyWriteable: true,
condition: true,
click: this.createDirecotry,
click: this.createDirectory,
},
{
text: this.$t('Machine.ConfigFilesPanel.RefreshDirectory'),
@@ -854,6 +949,8 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
}
set currentPath(newVal) {
this.selectedFiles = []
this.$store.dispatch('gui/saveSettingWithoutUpload', { name: 'view.configfiles.currentPath', value: newVal })
}
@@ -932,7 +1029,43 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
window.open(href)
}
createDirecotry() {
async downloadSelectedFiles() {
let items: string[] = []
const addElementToItems = async (absolutPath: string, directory: FileStateFile[]) => {
for (const file of directory) {
const filePath = `${absolutPath}/${file.filename}`
if (file.isDirectory && file.childrens) {
await addElementToItems(filePath, file.childrens)
continue
}
items.push(filePath)
}
}
await addElementToItems(this.absolutePath, this.selectedFiles)
const date = new Date()
const month = (date.getMonth() + 1).toString().padStart(2, '0')
const day = date.getDate().toString().padStart(2, '0')
const hours = date.getHours().toString().padStart(2, '0')
const minutes = date.getMinutes().toString().padStart(2, '0')
const seconds = date.getSeconds().toString().padStart(2, '0')
const timestamp = `${date.getFullYear()}${month}${day}-${hours}${minutes}${seconds}`
this.$socket.emit(
'server.files.zip',
{ items, dest: `config/${this.root}-${timestamp}.zip` },
{ action: 'files/downloadZip', loading: 'configDownloadZip' }
)
this.selectedFiles = []
}
createDirectory() {
this.dialogCreateDirectory.name = ''
this.dialogCreateDirectory.show = true
@@ -1044,12 +1177,32 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
)
}
duplicateFile(item: FileStateFile) {
this.dialogDuplicateFile.item = item
this.dialogDuplicateFile.newName = item.filename
this.dialogDuplicateFile.show = true
setTimeout(() => {
this.$refs.inputDialogDuplicateFileName?.focus()
}, 200)
}
duplicateFileAction() {
this.dialogDuplicateFile.show = false
this.$socket.emit('server.files.copy', {
source: (this.absolutePath + '/' + this.dialogDuplicateFile.item.filename).slice(1),
dest: (this.absolutePath + '/' + this.dialogDuplicateFile.newName).slice(1),
})
}
removeFile() {
this.$socket.emit(
'server.files.delete_file',
{ path: this.absolutePath + '/' + this.contextMenu.item.filename },
{ action: 'files/getDeleteFile' }
)
this.deleteDialog = false
}
deleteSelectedFiles() {
+105 -12
View File
@@ -1,11 +1,30 @@
<template>
<panel
:title="$t('Machine.LogfilesPanel.Logfiles').toString()"
:icon="mdiFileDocumentEdit"
card-class="machine-logfiles-panel"
:collapsible="true">
<v-card-text :class="'text-center text-lg-left py-0'">
<v-container pb-0 px-0>
<div>
<panel
:title="$t('Machine.LogfilesPanel.Logfiles').toString()"
:icon="mdiFileDocumentEdit"
card-class="machine-logfiles-panel"
:collapsible="true">
<template #buttons>
<v-tooltip top>
<template #activator="{ on, attrs }">
<v-btn
icon
tile
color="primary"
:ripple="true"
:loading="loadings.includes('loadingBtnRolloverLogs')"
:disabled="['printing', 'paused'].includes(printer_state)"
v-bind="attrs"
v-on="on"
@click="showRolloverDialog = true">
<v-icon>{{ mdiFileSyncOutline }}</v-icon>
</v-btn>
</template>
<span>{{ $t('Machine.LogfilesPanel.Rollover') }}</span>
</v-tooltip>
</template>
<v-card-text :class="'text-center text-lg-left'">
<v-row>
<v-col :class="'col-12' + (klipperState !== 'ready' ? 'col-md-6' : 'col-md-12') + ''">
<v-btn
@@ -53,23 +72,74 @@
</v-btn>
</v-col>
</v-row>
</v-container>
</v-card-text>
</panel>
</v-card-text>
</panel>
<v-dialog :value="showRolloverDialog" persistent width="400" :fullscreen="isMobile">
<panel
:title="$t('Machine.LogfilesPanel.Rollover').toString()"
card-class="machine_rollover_logfiles-dialog"
:icon="mdiFileSyncOutline"
:margin-bottom="false">
<template #buttons>
<v-btn icon tile @click="showRolloverDialog = false">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-card-text>
<v-row>
<v-col>
<p class="mb-0">{{ $t('Machine.LogfilesPanel.RolloverDescription') }}</p>
</v-col>
</v-row>
<v-row class="mt-0">
<v-col>
<v-checkbox
v-for="log in rolloverLogfiles"
:key="log"
v-model="selectedRolloverLogs"
:label="capitalize(log)"
:value="log"
hide-details
class="mt-0" />
</v-col>
</v-row>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn text @click="showRolloverDialog = false">
{{ $t('Machine.LogfilesPanel.Cancel') }}
</v-btn>
<v-btn color="primary" text @click="btnRolloverLogs">
{{ $t('Machine.LogfilesPanel.Accept') }}
</v-btn>
</v-card-actions>
</panel>
</v-dialog>
</div>
</template>
<script lang="ts">
import { Component, Mixins } from 'vue-property-decorator'
import { Component, Mixins, Watch } from 'vue-property-decorator'
import BaseMixin from '../../mixins/base'
import Panel from '@/components/ui/Panel.vue'
import { FileStateFile } from '@/store/files/types'
import { mdiDownload, mdiFileDocumentEdit } from '@mdi/js'
import { mdiDownload, mdiFileDocumentEdit, mdiCloseThick, mdiFileSyncOutline } from '@mdi/js'
import { rolloverLogfiles } from '@/store/variables'
import { capitalize } from '@/plugins/helpers'
@Component({
components: { Panel },
})
export default class LogfilesPanel extends Mixins(BaseMixin) {
mdiFileDocumentEdit = mdiFileDocumentEdit
mdiDownload = mdiDownload
mdiCloseThick = mdiCloseThick
mdiFileSyncOutline = mdiFileSyncOutline
rolloverLogfiles = rolloverLogfiles
capitalize = capitalize
private showRolloverDialog = false
private selectedRolloverLogs: string[] = []
get logfiles() {
return this.$store.getters['files/getDirectory']('logs')?.childrens ?? []
@@ -85,6 +155,10 @@ export default class LogfilesPanel extends Mixins(BaseMixin) {
return sonarLog?.size > 0
}
get loadingRolloverLogs() {
return this.loadings.filter((log) => log.startsWith('rolloverLog_')).length > 0
}
downloadLog(event: any) {
event.preventDefault()
let href = ''
@@ -93,5 +167,24 @@ export default class LogfilesPanel extends Mixins(BaseMixin) {
window.open(href)
}
btnRolloverLogs() {
if (this.selectedRolloverLogs.length === 0) return
this.selectedRolloverLogs.forEach((name) => {
this.$socket.emit(
'server.logs.rollover',
{ application: name },
{ loading: 'rolloverLog_' + name, action: 'files/rolloverLog' }
)
})
this.selectedRolloverLogs = []
}
@Watch('loadingRolloverLogs')
loadingRolloverLogsChanged(newVal: boolean) {
if (newVal) this.showRolloverDialog = false
}
}
</script>
@@ -9,16 +9,12 @@
<v-row class="py-0 pr-4">
<v-col class="pl-6">
<strong style="cursor: pointer" @click="hostDetailsDialog = true">Host</strong>
<template v-if="hostStats.cpuDesc">
<v-tooltip top>
<template #activator="{ on, attrs }">
<small v-if="hostStats.cpuName" class="ml-2" v-bind="attrs" v-on="on">
({{ hostStats.cpuName }})
</small>
</template>
<span>{{ hostStats.cpuDesc }}</span>
</v-tooltip>
</template>
<v-tooltip top>
<template #activator="{ on, attrs }">
<small v-if="hostStats.cpuName" class="ml-2" v-bind="attrs" v-on="on">({{ cpuName }})</small>
</template>
<span>{{ cpuDesc }}</span>
</v-tooltip>
<br />
<div class="text-body-2">
<div v-if="hostStats.version">
@@ -90,7 +86,11 @@
<template v-if="networkInterfaces">
<div v-for="(interfaceStats, interfaceName) in networkInterfaces" :key="interfaceName">
<span class="text-no-wrap">
{{ interfaceName }}{{ getIpAddress(interfaceStats.details.ip_addresses) }}:
{{ interfaceName }}
<template v-if="'details' in interfaceStats">
{{ getIpAddress(interfaceStats.details.ip_addresses) }}
</template>
:
</span>
<span class="text-no-wrap">
{{
@@ -261,5 +261,21 @@ export default class SystemPanelHost extends Mixins(BaseMixin) {
return null
}
get cpuDesc() {
let output = this.hostStats.cpuDesc
return output
}
get cpuName() {
let output = this.hostStats.cpuName
if (this.hostStats.bits) {
output += `, ${this.hostStats.bits}`
}
return output
}
}
</script>
+72 -591
View File
@@ -1,63 +1,3 @@
<style lang="scss" scoped>
.cursor--pointer {
cursor: pointer;
}
ul.commits {
list-style: none;
li {
border-color: rgb(48, 54, 61);
border-style: solid;
border-width: 1px;
border-bottom-width: 0;
&:first-child {
border-top-left-radius: 6px;
border-top-right-radius: 6px;
}
&:last-child {
border-bottom-width: 1px;
border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
}
}
}
</style>
<style lang="scss">
.v-timeline.groupedCommits {
.v-timeline-item__dot--small {
width: 18px;
height: 15px;
margin-top: 2px;
&:before {
display: block;
content: ' ';
position: relative;
width: 18px;
height: 2px;
top: 7px;
background: rgba(255, 255, 255, 0.5);
z-index: 1;
}
}
.v-timeline-item__inner-dot {
background-color: #1e1e1e !important;
border: 2px solid rgba(255, 255, 255, 0.5) !important;
width: 8px;
height: 8px;
position: relative;
z-index: 2;
margin-left: 5px;
margin-top: 2px;
}
}
</style>
<template>
<div>
<panel
@@ -85,578 +25,119 @@ ul.commits {
<span>{{ $t('Machine.UpdatePanel.CheckForUpdates') }}</span>
</v-tooltip>
</template>
<v-card-text class="px-0 py-0">
<v-container py-0 px-0>
<div v-for="(value, key, index) of updateableSoftwares" :key="key">
<v-divider v-if="index" class="my-0"></v-divider>
<v-row class="py-2">
<v-col class="pl-6">
<strong>{{ 'name' in value ? value.name : key }}</strong>
<br />
<span
:class="getVersionClickable(value) ? 'primary--text cursor--pointer' : ''"
@click="openCommitsOverlay(key, value)">
<v-icon v-if="getVersionClickable(value)" small color="primary" class="mr-1">
{{ mdiInformation }}
</v-icon>
{{ getVersionOutput(value) }}
</span>
</v-col>
<v-col class="col-auto pr-6 text-right" align-self="center">
<template v-if="getRecoveryOptions(value)">
<v-menu :offset-y="true" title="Webcam">
<template #activator="{ on, attrs }">
<v-chip
small
label
outlined
:color="getBtnColor(value)"
:disabled="getBtnDisabled(value)"
class="minwidth-0 px-2 text-uppercase"
v-bind="attrs"
v-on="on">
<v-icon small class="mr-1">{{ getBtnIcon(value) }}</v-icon>
{{ getBtnText(value) }}
<v-icon small>{{ mdiMenuDown }}</v-icon>
</v-chip>
</template>
<v-list dense class="py-0">
<v-list-item @click="recovery(key, false)">
<v-list-item-icon class="mr-0">
<v-icon small>{{ mdiReload }}</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>Soft Recovery</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-list-item @click="recovery(key, true)">
<v-list-item-icon class="mr-0">
<v-icon small>{{ mdiReload }}</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>Hard Recovery</v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list>
</v-menu>
</template>
<template v-else>
<v-chip
small
label
outlined
:color="getBtnColor(value)"
:disabled="getBtnDisabled(value)"
class="minwidth-0 px-2 text-uppercase"
@click="updateModule(key)">
<v-icon small class="mr-1">{{ getBtnIcon(value) }}</v-icon>
{{ getBtnText(value) }}
</v-chip>
</template>
</v-col>
</v-row>
</div>
<template v-if="'system' in version_info">
<v-divider class="my-0 border-top-2"></v-divider>
<v-row class="pt-2">
<v-col class="col-auto pl-6 text-no-wrap">
<strong>{{ $t('Machine.UpdatePanel.System') }}</strong>
<br />
<v-tooltip v-if="version_info.system.package_count > 0" top :max-width="300">
<template #activator="{ on, attrs }">
<span v-bind="attrs" v-on="on">
{{ version_info.system.package_count }}
{{ $t('Machine.UpdatePanel.PackagesCanBeUpgraded') }}
</span>
</template>
<span>{{ version_info.system.package_list.join(', ') }}</span>
</v-tooltip>
<span v-if="version_info.system.package_count === 0">
{{ $t('Machine.UpdatePanel.OSPackages') }}
</span>
</v-col>
<v-col class="pr-6 text-right" align-self="center">
<v-chip
small
label
outlined
:color="version_info.system.package_count ? 'primary' : 'green'"
:disabled="!version_info.system.package_count || printer_state === 'printing'"
class="minwidth-0 px-2 text-uppercase"
@click="updateSystem">
<v-icon small class="mr-1">
{{ version_info.system.package_count ? mdiProgressUpload : mdiCheck }}
</v-icon>
{{
version_info.system.package_count
? $t('Machine.UpdatePanel.Upgrade')
: $t('Machine.UpdatePanel.UpToDate')
}}
</v-chip>
</v-col>
</v-row>
<v-card-text class="px-0 py-0 update-manager-list">
<template v-if="checkInitState">
<template v-for="(module, index) in modules">
<v-divider v-if="index" :key="'divider_' + module.name" class="my-0" />
<update-panel-entry :key="module.name" :repo="module.data" />
</template>
<template v-if="existsSystemModul">
<v-divider v-if="modules.length" class="my-0" />
<update-panel-entry-system />
</template>
<template v-if="showUpdateAll">
<v-divider class="mb-0 mt-2 border-top-2"></v-divider>
<v-row class="pt-3">
<v-col class="text-center">
<v-btn
text
color="primary"
small
:disabled="['printing', 'paused'].includes(printer_state)"
@click="updateAll">
<v-icon left>{{ mdiProgressUpload }}</v-icon>
{{ $t('Machine.UpdatePanel.UpdateAll') }}
</v-btn>
</v-col>
</v-row>
<v-divider class="mb-0 mt-2 border-top-2" />
<update-panel-entry-all />
</template>
</v-container>
</template>
<template v-else>
<v-row class="mt-0 mb-0">
<v-col class="px-6">
<v-alert class="mb-0" text dense type="info" border="left">
{{ $t('Machine.UpdatePanel.InitUpdateManager') }}
</v-alert>
</v-col>
</v-row>
</template>
</v-card-text>
</panel>
<v-dialog v-model="commitsOverlay.bool" persistent max-width="800">
<panel
:title="$t('Machine.UpdatePanel.Commits')"
:icon="mdiUpdate"
:margin-bottom="false"
card-class="machine-update-commits-dialog">
<template #buttons>
<v-btn icon tile @click="commitsOverlay.bool = false">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-card-text class="py-0 px-0">
<overlay-scrollbars style="max-height: 400px" :options="{ overflowBehavior: { x: 'hidden' } }">
<v-row>
<v-col class="pt-3 pl-0">
<v-timeline class="groupedCommits" align-top dense>
<v-timeline-item
v-for="group of commitsOverlay.groupedCommits"
:key="group.date.getTime()"
small>
<v-row class="pt-0">
<v-col class="pr-12">
<h3 class="caption">
{{
$t('Machine.UpdatePanel.CommitsOnDate', {
date: new Date(group.date).toLocaleDateString(
language,
dateOptions
),
})
}}
</h3>
<ul class="commits mt-3 pl-0">
<li
v-for="commit of group.commits"
:key="commit.sha"
class="commit px-3 py-2">
<v-row>
<v-col>
<h4 class="subtitle-2 text--white mb-0">
{{ commit.subject }}
<v-chip
v-if="!openCommits.includes(commit.sha)"
outlined
label
x-small
class="ml-2 px-2"
@click="openCommits.push(commit.sha)">
<v-icon small>{{ mdiDotsHorizontal }}</v-icon>
</v-chip>
</h4>
<p
v-if="openCommits.includes(commit.sha)"
class="caption text--secondary mb-2"
style="white-space: pre-line"
v-html="commit.message"></p>
<p class="caption mb-0">
<span
class="font-weight-bold text-decoration-none white--text">
{{ commit.author }}
</span>
<span>{{ convertCommitDate(commit.date) }}</span>
</p>
</v-col>
<v-col class="col-auto pt-4">
<v-chip
outlined
label
small
:href="
'https://github.com/' +
commitsOverlay.owner +
'/' +
commitsOverlay.repoName +
'/commit/' +
commit.sha
"
target="_blank">
{{ commit.sha.substr(0, 6) }}
</v-chip>
</v-col>
</v-row>
</li>
</ul>
</v-col>
</v-row>
</v-timeline-item>
</v-timeline>
</v-col>
</v-row>
</overlay-scrollbars>
</v-card-text>
</panel>
</v-dialog>
</div>
</template>
<script lang="ts">
import { Component, Mixins } from 'vue-property-decorator'
import BaseMixin from '../../mixins/base'
import semver from 'semver'
import Panel from '@/components/ui/Panel.vue'
import { ServerUpdateMangerStateVersionInfoGitRepoCommits } from '@/store/server/updateManager/types'
import VueI18n from 'vue-i18n'
import DateTimeFormatOptions = VueI18n.DateTimeFormatOptions
import {
mdiRefresh,
mdiAlertCircle,
mdiCheck,
mdiHelpCircleOutline,
mdiInformation,
mdiMenuDown,
mdiProgressUpload,
mdiReload,
mdiDotsHorizontal,
mdiCloseThick,
mdiUpdate,
} from '@mdi/js'
interface groupedCommit {
date: Date
commits: ServerUpdateMangerStateVersionInfoGitRepoCommits[]
}
interface commitsOverlay {
bool: boolean
owner: string
modul: string
repoName: string
commits: ServerUpdateMangerStateVersionInfoGitRepoCommits[]
groupedCommits: groupedCommit[]
}
import UpdatePanelEntry from '@/components/panels/Machine/UpdatePanel/Entry.vue'
import UpdatePanelEntrySystem from '@/components/panels/Machine/UpdatePanel/EntrySystem.vue'
import UpdatePanelEntryAll from '@/components/panels/Machine/UpdatePanel/EntryAll.vue'
import { mdiRefresh, mdiInformation, mdiCloseThick, mdiUpdate } from '@mdi/js'
import { ServerUpdateManagerStateGuiList } from '@/store/server/updateManager/types'
import semver from 'semver'
@Component({
components: { Panel },
components: { Panel, UpdatePanelEntry, UpdatePanelEntrySystem, UpdatePanelEntryAll },
})
export default class UpdatePanel extends Mixins(BaseMixin) {
mdiCheck = mdiCheck
mdiRefresh = mdiRefresh
mdiInformation = mdiInformation
mdiMenuDown = mdiMenuDown
mdiReload = mdiReload
mdiProgressUpload = mdiProgressUpload
mdiCloseThick = mdiCloseThick
mdiDotsHorizontal = mdiDotsHorizontal
mdiUpdate = mdiUpdate
private openCommits: string[] = []
private dateOptions: DateTimeFormatOptions = {
year: 'numeric',
month: 'short',
day: 'numeric',
}
private commitsOverlay: commitsOverlay = {
bool: false,
owner: '',
modul: '',
repoName: '',
commits: [],
groupedCommits: [],
}
get language() {
return this.$store.state.gui.general.language ?? 'en'
}
get enableUpdateManager() {
return this.$store.state.server.components.includes('update_manager')
}
get version_info() {
return this.$store.state.server.updateManager.version_info
get modules() {
return this.$store.getters['server/updateManager/getUpdateManagerList'] ?? []
}
get updateableSoftwares() {
return this.$store.getters['server/updateManager/getUpdateableSoftwares']
get existsSystemModul() {
return 'system' in this.$store.state.server.updateManager
}
get systemPackagesCount() {
return this.$store.state.server.updateManager?.system?.package_count ?? 0
}
get checkInitState() {
const initModules = this.modules.filter(
(module: ServerUpdateManagerStateGuiList) => module.data.remote_version !== '?'
)
return initModules.length > 0
}
get showUpdateAll() {
let updateableModuls = 0
let count = 0
Object.keys(this.updateableSoftwares).forEach((modulename) => {
const module = this.updateableSoftwares[modulename]
this.modules.forEach((module: ServerUpdateManagerStateGuiList) => {
// check git repos for updates
if (module.type === 'git' && module.data?.commits_behind?.length) {
count++
return
}
// check client web for updates
if (
'version' in module &&
'remote_version' in module &&
semver.valid(module.remote_version) &&
semver.valid(module.version) &&
semver.gt(module.remote_version, module.version)
)
updateableModuls++
module.type === 'web' &&
semver.valid(module.data?.remote_version) &&
semver.valid(module.data?.version) &&
semver.gt(module.data?.remote_version, module.data?.version)
) {
count++
return
}
})
if (this.version_info?.system?.package_count > 0) updateableModuls++
return updateableModuls > 1
// check system packages for upgrades
if (this.systemPackagesCount > 0) count++
return count > 1
}
btnSync() {
this.$socket.emit(
'machine.update.status',
{ refresh: true },
{ action: 'server/updateManager/getStatus', loading: 'loadingBtnSyncUpdateManager' }
{ action: 'server/updateManager/onUpdateStatus', loading: 'loadingBtnSyncUpdateManager' }
)
}
getBtnColor(object: any) {
if (typeof object === 'object' && object !== false) {
if ('debug_enabled' in object && !object.debug_enabled && 'detached' in object && object.detached)
return 'orange'
if ('is_dirty' in object && object.is_dirty) return 'orange'
if ('is_valid' in object && !object.is_valid) return 'red'
if (
'version' in object &&
'remote_version' in object &&
semver.valid(object.remote_version) &&
semver.valid(object.version) &&
semver.gt(object.remote_version, object.version)
)
return 'primary'
if ((object.commits_behind ?? []).length) return 'primary'
if (
'version' in object &&
'remote_version' in object &&
(object.version === '?' || object.remote_version === '?')
)
return 'gray'
return 'green'
}
return 'red'
}
getBtnText(object: any) {
if (typeof object === 'object' && object !== false) {
if ('debug_enabled' in object && !object.debug_enabled && 'detached' in object && object.detached)
return this.$t('Machine.UpdatePanel.Detached')
if ('is_valid' in object && !object.is_valid) return this.$t('Machine.UpdatePanel.Invalid')
if ('is_dirty' in object && object.is_dirty) return this.$t('Machine.UpdatePanel.Dirty')
if (
'version' in object &&
'remote_version' in object &&
semver.valid(object.remote_version) &&
semver.valid(object.version) &&
semver.gt(object.remote_version, object.version)
)
return this.$t('Machine.UpdatePanel.Update')
if ((object.commits_behind ?? []).length) return this.$t('Machine.UpdatePanel.Update')
if (
'version' in object &&
'remote_version' in object &&
(object.version === '?' || object.remote_version === '?')
)
return this.$t('Machine.UpdatePanel.Unknown')
return this.$t('Machine.UpdatePanel.UpToDate')
}
return this.$t('Machine.UpdatePanel.ERROR')
}
getBtnIcon(object: any) {
if (typeof object === 'object' && object !== false) {
if ('debug_enabled' in object && !object.debug_enabled && 'detached' in object && object.detached)
return mdiAlertCircle
if ('is_valid' in object && !object.is_valid) return mdiAlertCircle
if ('is_dirty' in object && object.is_dirty) return mdiAlertCircle
if (
'version' in object &&
'remote_version' in object &&
semver.valid(object.remote_version) &&
semver.valid(object.version) &&
semver.gt(object.remote_version, object.version)
)
return mdiProgressUpload
if ((object.commits_behind ?? []).length) return mdiProgressUpload
if (
'version' in object &&
'remote_version' in object &&
(object.version === '?' || object.remote_version === '?')
)
return mdiHelpCircleOutline
return mdiCheck
}
return 'ERROR'
}
getBtnDisabled(object: any) {
if (['printing', 'paused'].includes(this.printer_state)) return true
if ('is_valid' in object && !object.is_valid) return false
if ('is_dirty' in object && object.is_dirty) return false
if (typeof object === 'object' && object !== false) {
if ((object.commits_behind ?? []).length) return false
if (
'version' in object &&
'remote_version' in object &&
semver.valid(object.remote_version) &&
semver.valid(object.version) &&
semver.gt(object.remote_version, object.version)
)
return false
}
return true
}
getVersionOutput(object: any) {
const local_version = object.version ?? '?'
const remote_version = object.remote_version ?? '?'
const commits_behind = object.commits_behind ?? []
let output = ''
if ('remote_alias' in object && object.remote_alias !== 'origin') output += object.remote_alias
if ('branch' in object && !['master', 'main'].includes(object.branch)) {
if (output !== '') output += '/'
output += object.branch
}
if (output !== '') output += ': '
if (semver.valid(remote_version) && semver.valid(local_version) && semver.gt(remote_version, local_version))
output += local_version + ' > ' + remote_version
else if (commits_behind.length)
output +=
local_version +
' > ' +
this.$tc('Machine.UpdatePanel.CommitsAvailable', commits_behind.length, {
count: commits_behind.length,
})
else if ('full_version_string' in object && object.full_version_string !== '?')
output += object.full_version_string
else output += local_version
return output
}
getVersionClickable(object: any) {
return 'commits_behind' in object && object.commits_behind.length
}
getRecoveryOptions(object: any) {
if ('is_valid' in object && !object.is_valid) return true
else if ('is_dirty' in object && object.is_dirty) return true
return false
}
updateAll() {
this.$socket.emit('machine.update.full', {})
}
updateModule(key: string) {
if (['klipper', 'moonraker'].includes(key)) this.$socket.emit('machine.update.' + key, {})
else this.$socket.emit('machine.update.client', { name: key })
}
recovery(name: string, hard: boolean) {
this.$socket.emit('machine.update.recover', { name: name, hard: hard })
}
updateSystem() {
this.$socket.emit('machine.update.system', {})
}
openCommitsOverlay(key: string, object: any) {
if ('commits_behind' in object && 'owner' in object && object.commits_behind.length) {
this.openCommits = []
this.commitsOverlay.owner = object.owner
this.commitsOverlay.modul = key
this.commitsOverlay.repoName = object.repo_name ?? key
this.commitsOverlay.commits = object.commits_behind
this.commitsOverlay.groupedCommits = []
let lastDate: null | Date = null
let tmpCommits: ServerUpdateMangerStateVersionInfoGitRepoCommits[] = []
object.commits_behind.forEach((commit: any) => {
const commitDate = new Date(commit.date * 1000)
if (
lastDate === null ||
commitDate.getFullYear() !== lastDate.getFullYear() ||
commitDate.getMonth() !== lastDate.getMonth() ||
commitDate.getDay() !== lastDate.getDay()
) {
if (tmpCommits.length && lastDate !== null) {
this.commitsOverlay.groupedCommits.push({
date: lastDate,
commits: [...tmpCommits],
})
}
lastDate = commitDate
tmpCommits = []
}
tmpCommits.push(commit)
})
if (lastDate && tmpCommits.length) {
this.commitsOverlay.groupedCommits.push({
date: lastDate,
commits: [...tmpCommits],
})
}
this.commitsOverlay.bool = true
}
}
convertCommitDate(timestamp: number) {
const commitDay = new Date(timestamp * 1000)
commitDay.setHours(0, 0, 0, 0)
const todayDay = new Date()
todayDay.setHours(0, 0, 0, 0)
const diff = Math.floor(todayDay.getTime() - commitDay.getTime()) / (1000 * 60 * 60 * 24)
if (diff === 0) {
const diffHours = Math.floor((new Date().getTime() - timestamp * 1000) / (1000 * 60 * 60))
return this.$t('Machine.UpdatePanel.CommittedHoursAgo', { hours: diffHours })
} else if (diff === 1) return this.$t('Machine.UpdatePanel.CommittedYesterday')
else if (diff < 29) return this.$t('Machine.UpdatePanel.CommittedDaysAgo', { days: diff })
else
return this.$t('Machine.UpdatePanel.CommittedOnDate', {
date: commitDay.toLocaleDateString(this.language, this.dateOptions),
})
}
}
</script>
<style scoped>
::v-deep .update-manager-list > div:last-child > div.row {
padding-bottom: 0 !important;
}
</style>
@@ -0,0 +1,371 @@
<template>
<div>
<v-row class="py-2">
<v-col class="pl-6">
<strong>{{ repo.name }}</strong>
<br />
<template v-if="type === 'git_repo' && commitsBehind.length">
<a class="info--text cursor--pointer" @click="boolShowCommitList = true">
<v-icon small color="info" class="mr-1">{{ mdiUpdate }}</v-icon>
{{ versionOutput }}
</a>
</template>
<template v-else-if="type === 'web' && webUpdatable">
<a class="info--text text-decoration-none" :href="webLinkRelease" target="_blank">
<v-icon small color="info" class="mr-1">{{ mdiUpdate }}</v-icon>
{{ versionOutput }}
</a>
</template>
<span v-else>{{ versionOutput }}</span>
</v-col>
<v-col class="col-auto pr-6 text-right" align-self="center">
<v-chip
v-if="anomalies.length > 0"
small
label
:outlined="!toggleAnomalies"
color="grey"
class="minwidth-0 px-1 mr-2"
@click="toggleAnomalies = !toggleAnomalies">
<v-icon small>{{ toggleAnomalies ? mdiInformationOutline : mdiInformation }}</v-icon>
</v-chip>
<template v-if="!isValid">
<v-menu :offset-y="true">
<template #activator="{ on, attrs }">
<v-chip
small
label
outlined
:color="btnColor"
:disabled="btnDisabled"
class="minwidth-0 px-2 text-uppercase"
v-bind="attrs"
v-on="on">
<v-icon small class="mr-1">{{ btnIcon }}</v-icon>
{{ btnText }}
<v-icon small>{{ mdiMenuDown }}</v-icon>
</v-chip>
</template>
<v-list dense class="py-0">
<v-list-item v-if="!isCorrupt" @click="doRecovery(false)">
<v-list-item-icon class="mr-0 pt-1">
<v-icon small>{{ mdiReload }}</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>{{ $t('Machine.UpdatePanel.SoftRecovery') }}</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-list-item :disabled="!existsRecoveryUrl" @click="doRecovery(true)">
<v-list-item-icon class="mr-0 pt-1">
<v-icon small>{{ mdiReload }}</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>{{ $t('Machine.UpdatePanel.HardRecovery') }}</v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list>
</v-menu>
</template>
<v-chip
v-else
small
label
outlined
:color="btnColor"
:disabled="btnDisabled"
class="minwidth-0 px-2 text-uppercase"
@click="clickUpdate">
<v-icon small class="mr-1">{{ btnIcon }}</v-icon>
{{ btnText }}
</v-chip>
</v-col>
</v-row>
<v-row v-if="warnings.length" class="mt-0">
<v-col class="px-6 pt-0">
<v-alert
v-for="(message, index) in warnings"
:key="'warnings_' + index"
dense
text
color="orange"
border="left"
:icon="mdiCloseCircle">
<p class="text--disabled mb-0">{{ message }}</p>
</v-alert>
</v-col>
</v-row>
<v-row v-show="toggleAnomalies" class="mt-0">
<v-col class="px-6 pt-0">
<v-alert
v-for="(message, index) in anomalies"
:key="'anomalies_' + index"
dense
text
color="grey"
border="left"
:icon="mdiInformation">
{{ message }}
</v-alert>
</v-col>
</v-row>
<git-commits-list
v-if="type === 'git_repo'"
:bool-show-dialog="boolShowCommitList"
:repo="repo"
@close-dialog="closeCommitList" />
<update-hint
:bool-show-dialog="boolShowUpdateHint"
:repo="repo"
@open-commit-history="boolShowCommitList = true"
@do-update="doUpdate"
@close-dialog="closeShowUpdateHint" />
</div>
</template>
<script lang="ts">
import { Component, Mixins, Prop } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { ServerUpdateManagerStateGitRepo } from '@/store/server/updateManager/types'
import {
mdiCloseCircle,
mdiCheck,
mdiHelpCircleOutline,
mdiInformation,
mdiInformationOutline,
mdiMenuDown,
mdiProgressUpload,
mdiReload,
mdiUpdate,
} from '@mdi/js'
import semver from 'semver'
import GitCommitsList from '@/components/panels/Machine/UpdatePanel/GitCommitsList.vue'
import UpdateHint from '@/components/panels/Machine/UpdatePanel/UpdateHint.vue'
@Component({
components: { GitCommitsList, UpdateHint },
})
export default class UpdatePanelEntry extends Mixins(BaseMixin) {
mdiInformation = mdiInformation
mdiMenuDown = mdiMenuDown
mdiReload = mdiReload
mdiCloseCircle = mdiCloseCircle
mdiUpdate = mdiUpdate
mdiInformationOutline = mdiInformationOutline
boolShowCommitList = false
boolShowUpdateHint = false
toggleAnomalies = false
@Prop({ required: true }) readonly repo!: ServerUpdateManagerStateGitRepo
get name() {
return this.repo.name ?? 'UNKNOWN'
}
get type() {
return this.repo.configured_type
}
get localVersion() {
const version = this.repo.version ?? '?'
if (!semver.valid(version)) return null
return version
}
get remoteVersion() {
const version = this.repo.remote_version ?? '?'
if (!semver.valid(version)) return null
return version
}
get branch() {
return this.repo.branch ?? 'master'
}
get remoteAlias() {
return this.repo.remote_alias ?? 'origin'
}
get branchOutput() {
if (this.remoteAlias !== 'origin') return `${this.remoteAlias}/${this.branch}`
if (!['master', 'main'].includes(this.branch)) return this.branch
return null
}
get commitsBehind() {
return this.repo.commits_behind ?? []
}
get fullVersionString() {
return this.repo.full_version_string ?? null
}
get versionOutput() {
let output = this.branchOutput ? `${this.branchOutput}: ` : ''
if (this.localVersion && this.remoteVersion && semver.gt(this.remoteVersion, this.localVersion)) {
return `${output}${this.localVersion} > ${this.remoteVersion}`
}
if (this.commitsBehind.length) {
const tmp = this.$tc('Machine.UpdatePanel.CommitsAvailable', this.commitsBehind.length, {
count: this.commitsBehind.length,
}).toString()
if (this.localVersion) return `${output}${this.localVersion} > ${tmp}`
return `${output}${tmp}`
}
if (this.fullVersionString) return this.fullVersionString
if (this.localVersion) return this.localVersion
return 'UNKNOWN'
}
get configuredType() {
return this.repo.configured_type ?? 'git_repo'
}
get isValid() {
return this.repo.is_valid ?? true
}
get isDirty() {
return this.repo.is_dirty ?? false
}
get isCorrupt() {
return this.repo.corrupt ?? false
}
get debugEnabled() {
return this.repo.debug_enabled ?? false
}
get isDetached() {
if (this.configuredType !== 'git_repo') return false
return !this.debugEnabled && (this.repo.detached ?? false)
}
get existsRecoveryUrl() {
const url = this.repo.recovery_url ?? '?'
return url !== '?'
}
get btnDisabled() {
if (['printing', 'paused'].includes(this.printer_state)) return true
if (!this.isValid || this.isCorrupt || this.isDirty || this.commitsBehind.length) return false
return !(this.localVersion && this.remoteVersion && semver.gt(this.remoteVersion, this.localVersion))
}
get btnIcon() {
if (this.isDetached || !this.isValid || this.isCorrupt || this.isDirty) return mdiCloseCircle
if (
this.commitsBehind.length ||
(this.localVersion && this.remoteVersion && semver.gt(this.remoteVersion, this.localVersion))
)
return mdiProgressUpload
if (this.localVersion === null || this.remoteVersion === null) return mdiHelpCircleOutline
return mdiCheck
}
get btnColor() {
if (this.isCorrupt || this.isDetached || this.isDirty || !this.isValid) return 'orange'
if (
this.commitsBehind.length ||
(this.localVersion && this.remoteVersion && semver.gt(this.remoteVersion, this.localVersion))
)
return 'primary'
return 'green'
}
get btnText() {
if (this.isCorrupt) return this.$t('Machine.UpdatePanel.Corrupt')
if (this.isDetached) return this.$t('Machine.UpdatePanel.Detached')
if (this.isDirty) return this.$t('Machine.UpdatePanel.Dirty')
if (!this.isValid) return this.$t('Machine.UpdatePanel.Invalid')
if (
this.commitsBehind.length ||
(this.localVersion && this.remoteVersion && semver.gt(this.remoteVersion, this.localVersion))
)
return this.$t('Machine.UpdatePanel.Update')
if (this.localVersion === null || this.remoteVersion === null) return this.$t('Machine.UpdatePanel.Unknown')
return this.$t('Machine.UpdatePanel.UpToDate')
}
get anomalies() {
return this.repo.anomalies ?? []
}
get warnings() {
return this.repo.warnings ?? []
}
get webUpdatable() {
if (!this.localVersion) return false
if (!this.remoteVersion) return false
return semver.gt(this.remoteVersion, this.localVersion)
}
get repo_name() {
return this.repo.repo_name ?? this.repo.name ?? ''
}
get webLinkRelease() {
return `https://github.com/${this.repo.owner}/${this.repo_name}/releases/tag/${this.repo.remote_version}`
}
get hideUpdateWarning() {
return this.$store.state.gui.uiSettings.hideUpdateWarnings ?? false
}
clickUpdate() {
if (this.hideUpdateWarning) {
this.doUpdate()
return
}
this.boolShowUpdateHint = true
}
doUpdate() {
if (['klipper', 'moonraker'].includes(this.repo.name)) {
this.$socket.emit('machine.update.' + this.repo.name, {})
return
}
this.$socket.emit('machine.update.client', { name: this.repo.name })
}
doRecovery(hard: boolean) {
this.$socket.emit('machine.update.recover', { name: this.repo.name, hard: hard })
}
closeCommitList() {
this.boolShowCommitList = false
}
closeShowUpdateHint() {
this.boolShowUpdateHint = false
}
}
</script>
<style scoped></style>
@@ -0,0 +1,55 @@
<template>
<div>
<v-row class="pt-3">
<v-col class="text-center">
<v-btn
text
color="primary"
small
:disabled="['printing', 'paused'].includes(printer_state)"
@click="clickUpdate">
<v-icon left>{{ mdiProgressUpload }}</v-icon>
{{ $t('Machine.UpdatePanel.UpdateAll') }}
</v-btn>
</v-col>
</v-row>
<update-hint-all
:bool-show-dialog="boolShowDialog"
@close-dialog="boolShowDialog = false"
@update-all="updateAll" />
</div>
</template>
<script lang="ts">
import { Component, Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { mdiProgressUpload } from '@mdi/js'
import UpdateHintAll from '@/components/panels/Machine/UpdatePanel/UpdateHintAll.vue'
@Component({
components: { UpdateHintAll },
})
export default class UpdatePanelEntryAll extends Mixins(BaseMixin) {
mdiProgressUpload = mdiProgressUpload
boolShowDialog = false
get hideUpdateWarning() {
return this.$store.state.gui.uiSettings.hideUpdateWarnings ?? false
}
clickUpdate() {
if (this.hideUpdateWarning) {
this.updateAll()
return
}
this.boolShowDialog = true
}
updateAll() {
this.$socket.emit('machine.update.full', {})
}
}
</script>
<style scoped></style>
@@ -0,0 +1,92 @@
<template>
<div>
<v-row class="py-2">
<v-col class="pl-6">
<strong>{{ $t('Machine.UpdatePanel.System') }}</strong>
<br />
<template v-if="package_count">
<a class="info--text cursor--pointer" @click="boolShowPackageList = true">
<v-icon small color="info" class="mr-1">{{ mdiInformation }}</v-icon>
{{ $t('Machine.UpdatePanel.CountPackagesCanBeUpgraded', { count: package_count }) }}
</a>
</template>
<span v-else>{{ $t('Machine.UpdatePanel.OSPackages') }}</span>
</v-col>
<v-col class="col-auto pr-6 text-right" align-self="center">
<v-chip
small
label
outlined
:color="btnColor"
:disabled="btnDisabled"
class="minwidth-0 px-2 text-uppercase"
@click="doUpdate">
<v-icon small class="mr-1">{{ btnIcon }}</v-icon>
{{ btnText }}
</v-chip>
</v-col>
</v-row>
<system-packages-list
:bool-show-dialog="boolShowPackageList"
:packages-list="package_list"
@close-dialog="closePackagesList" />
</div>
</template>
<script lang="ts">
import { Component, Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { mdiCheck, mdiInformation, mdiProgressUpload } from '@mdi/js'
@Component
export default class UpdatePanelEntrySystem extends Mixins(BaseMixin) {
mdiInformation = mdiInformation
// to display the dialog for packages
boolShowPackageList = false
get package_count() {
return this.$store.state.server.updateManager?.system?.package_count ?? 0
}
get package_list() {
return this.$store.state.server.updateManager?.system?.package_list ?? []
}
get btnDisabled() {
// disable button if the printer is printing
if (['printing', 'paused'].includes(this.printer_state)) return true
// disable button if no package is available to update
return this.package_count === 0
}
get btnIcon() {
if (this.package_count) return mdiProgressUpload
return mdiCheck
}
get btnColor() {
// set button to primary, if updates are available
if (this.package_count) return 'primary'
return 'green'
}
get btnText() {
if (this.package_count) return this.$t('Machine.UpdatePanel.Upgrade')
return this.$t('Machine.UpdatePanel.UpToDate')
}
doUpdate() {
this.$socket.emit('machine.update.system', {})
}
closePackagesList() {
this.boolShowPackageList = false
}
}
</script>
<style scoped></style>
@@ -0,0 +1,164 @@
<template>
<v-dialog v-model="boolShowDialog" persistent max-width="800">
<panel
:title="$t('Machine.UpdatePanel.Commits')"
:icon="mdiUpdate"
:margin-bottom="false"
card-class="machine-update-commits-dialog">
<template #buttons>
<v-btn icon tile @click="closeDialog">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-card-text class="py-0 px-0">
<overlay-scrollbars style="max-height: 400px" :options="{ overflowBehavior: { x: 'hidden' } }">
<v-row>
<v-col>
<v-timeline class="groupedCommits" align-top dense>
<git-commits-list-day
v-for="group of groupedCommits"
:key="group.date.getTime()"
:repo="repo"
:grouped-commits="group" />
<v-timeline-item
v-if="displayFullHistoryWaring"
small
class="git-commit-list-day git-commit-list-warning">
<v-row class="pt-0">
<v-col class="pr-12">
<v-alert dense text type="info">
<p>{{ $t('Machine.UpdatePanel.MoreCommitsInfo') }}</p>
<div class="text-center mb-3">
<v-btn :href="linkToGithub" target="_blank">
{{ $t('Machine.UpdatePanel.LinkToGithub') }}
</v-btn>
</div>
</v-alert>
</v-col>
</v-row>
</v-timeline-item>
</v-timeline>
</v-col>
</v-row>
</overlay-scrollbars>
</v-card-text>
</panel>
</v-dialog>
</template>
<script lang="ts">
import { Component, Mixins, Prop } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import {
ServerUpdateManagerStateGitRepo,
ServerUpdateManagerStateGitRepoCommit,
ServerUpdateManagerStateGitRepoGroupedCommits,
} from '@/store/server/updateManager/types'
import { mdiUpdate, mdiCloseThick } from '@mdi/js'
import Panel from '@/components/ui/Panel.vue'
import GitCommitsListDay from '@/components/panels/Machine/UpdatePanel/GitCommitsListDay.vue'
@Component({
components: { GitCommitsListDay, Panel },
})
export default class GitCommitsList extends Mixins(BaseMixin) {
mdiUpdate = mdiUpdate
mdiCloseThick = mdiCloseThick
@Prop({ required: true }) readonly boolShowDialog!: boolean
@Prop({ required: true }) readonly repo!: ServerUpdateManagerStateGitRepo | null
get commitsBehind(): ServerUpdateManagerStateGitRepoCommit[] {
return this.repo?.commits_behind ?? []
}
get groupedCommits() {
let output: ServerUpdateManagerStateGitRepoGroupedCommits[] = []
let lastCommit: ServerUpdateManagerStateGitRepoCommit | null = null
this.commitsBehind.forEach((commit: any) => {
const lastCommitDate = new Date((lastCommit?.date ?? 0) * 1000)
const commitDate = new Date(commit.date * 1000)
if (
commitDate.getFullYear() !== lastCommitDate.getFullYear() ||
commitDate.getMonth() !== lastCommitDate.getMonth() ||
commitDate.getDate() !== lastCommitDate.getDate()
) {
output.push({
date: commitDate,
commits: [],
})
}
output[output.length - 1].commits.push(commit)
lastCommit = commit
})
return output
}
get displayFullHistoryWaring() {
return this.commitsBehind.length >= 30
}
get lastCommit() {
return this.commitsBehind.slice(-1)[0]
}
get linkToGithub() {
return `https://github.com/${this.repo?.owner}/${this.repo?.name}/commits/${this.repo?.branch}/?after=${this.lastCommit?.sha}+0`
}
closeDialog() {
this.$emit('close-dialog')
}
}
</script>
<style lang="scss" scoped>
.groupedCommits {
padding-top: 0;
}
::v-deep {
.git-commit-list-day {
padding-top: 24px;
padding-bottom: 0;
.v-timeline-item__dot--small {
width: 18px;
height: 15px;
margin-top: 2px;
&:before {
display: block;
content: ' ';
position: relative;
width: 18px;
height: 2px;
top: 7px;
background: rgba(255, 255, 255, 0.5);
z-index: 1;
}
}
.v-timeline-item__inner-dot {
background-color: #1e1e1e !important;
border: 2px solid rgba(255, 255, 255, 0.5) !important;
width: 8px;
height: 8px;
position: relative;
z-index: 2;
margin-left: 5px;
margin-top: 2px;
}
&.git-commit-list-warning {
.v-timeline-item__dot--small {
margin-top: 10px;
}
}
}
}
</style>
@@ -0,0 +1,53 @@
<template>
<div>
<v-timeline-item small class="git-commit-list-day">
<v-row class="pt-0">
<v-col class="pr-12">
<h3 class="caption">
{{ $t('Machine.UpdatePanel.CommitsOnDate', { date: groupedCommitsDate }) }}
</h3>
<ul class="commits mt-3 pl-0">
<git-commits-list-day-commit
v-for="commit of groupedCommits.commits"
:key="commit.sha"
:commit="commit"
:repo="repo" />
</ul>
</v-col>
</v-row>
</v-timeline-item>
</div>
</template>
<script lang="ts">
import { Component, Mixins, Prop } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import {
ServerUpdateManagerStateGitRepo,
ServerUpdateManagerStateGitRepoGroupedCommits,
} from '@/store/server/updateManager/types'
import Panel from '@/components/ui/Panel.vue'
import GitCommitsListDayCommit from '@/components/panels/Machine/UpdatePanel/GitCommitsListDayCommit.vue'
@Component({
components: { Panel, GitCommitsListDayCommit },
})
export default class GitCommitsListDay extends Mixins(BaseMixin) {
@Prop({ required: true }) readonly groupedCommits!: ServerUpdateManagerStateGitRepoGroupedCommits
@Prop({ required: true }) readonly repo!: ServerUpdateManagerStateGitRepo
get groupedCommitsDate() {
return new Date(this.groupedCommits.date).toLocaleDateString(this.browserLocale, {
year: 'numeric',
month: 'short',
day: 'numeric',
})
}
}
</script>
<style scoped>
ul.commits {
list-style: none;
}
</style>
@@ -0,0 +1,120 @@
<template>
<li class="commit px-3 py-2">
<v-row>
<v-col>
<h4 class="subtitle-2 text--white mb-0">
{{ title }}
<v-chip outlined label x-small class="ml-2 px-2" @click="showDetails = !showDetails">
<v-icon small>{{ mdiDotsHorizontal }}</v-icon>
</v-chip>
</h4>
<p
v-if="showDetails"
class="caption text--secondary mb-2"
style="white-space: pre-line"
v-html="message"></p>
<p class="caption mb-0">
<span class="font-weight-bold text-decoration-none white--text">
{{ author }}
</span>
<span>{{ commitFormatDate }}</span>
</p>
</v-col>
<v-col class="col-auto pt-4">
<v-chip outlined label small :href="commitHref" target="_blank">
{{ commitShortSha }}
</v-chip>
</v-col>
</v-row>
</li>
</template>
<script lang="ts">
import { Component, Mixins, Prop } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { mdiDotsHorizontal } from '@mdi/js'
import {
ServerUpdateManagerStateGitRepo,
ServerUpdateManagerStateGitRepoCommit,
} from '@/store/server/updateManager/types'
import Panel from '@/components/ui/Panel.vue'
@Component({
components: { Panel },
})
export default class GitCommitsListDayCommit extends Mixins(BaseMixin) {
mdiDotsHorizontal = mdiDotsHorizontal
@Prop({ required: true }) readonly commit!: ServerUpdateManagerStateGitRepoCommit
@Prop({ required: true }) readonly repo!: ServerUpdateManagerStateGitRepo
showDetails = false
get title() {
return this.commit.subject
}
get message() {
return this.commit.message
}
get author() {
return this.commit.author
}
get commitFormatDate() {
const commitDay = new Date(this.commit.date * 1000)
commitDay.setHours(0, 0, 0, 0)
const todayDay = new Date()
todayDay.setHours(0, 0, 0, 0)
const diff = Math.floor(todayDay.getTime() - commitDay.getTime()) / (1000 * 60 * 60 * 24)
if (diff === 0) {
const diffHours = Math.floor((new Date().getTime() - this.commit.date * 1000) / (1000 * 60 * 60))
return this.$t('Machine.UpdatePanel.CommittedHoursAgo', { hours: diffHours })
} else if (diff === 1) return this.$t('Machine.UpdatePanel.CommittedYesterday')
else if (diff < 29) return this.$t('Machine.UpdatePanel.CommittedDaysAgo', { days: diff })
else
return this.$t('Machine.UpdatePanel.CommittedOnDate', {
date: commitDay.toLocaleDateString(this.browserLocale, {
year: 'numeric',
month: 'short',
day: 'numeric',
}),
})
}
get repo_name() {
return this.repo.repo_name ?? this.repo.name ?? ''
}
get commitHref() {
return `https://github.com/${this.repo.owner}/${this.repo_name}/commit/${this.commit.sha}`
}
get commitShortSha() {
return this.commit.sha.substring(0, 6)
}
}
</script>
<style lang="scss" scoped>
li.commit {
border-color: rgb(48, 54, 61);
border-style: solid;
border-width: 1px;
border-bottom-width: 0;
&:first-child {
border-top-left-radius: 6px;
border-top-right-radius: 6px;
}
&:last-child {
border-bottom-width: 1px;
border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
}
}
</style>
@@ -0,0 +1,56 @@
<template>
<v-dialog v-model="boolShowDialog" persistent max-width="800">
<panel
:title="$t('Machine.UpdatePanel.UpgradeableSystemPackages')"
:icon="mdiPackageVariantClosed"
:margin-bottom="false"
card-class="machine-update-system-packages-list-dialog">
<template #buttons>
<v-btn icon tile @click="closeDialog">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-card-text>
<v-row>
<v-col>
<p>{{ $t('Machine.UpdatePanel.ThesePackagesCanBeUpgrade') }}</p>
<p class="system-packages-list">{{ packagesList.join(', ') }}</p>
</v-col>
</v-row>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn text color="primary" @click="closeDialog">{{ $t('Machine.UpdatePanel.Close') }}</v-btn>
</v-card-actions>
</panel>
</v-dialog>
</template>
<script lang="ts">
import { Component, Mixins, Prop } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { mdiCloseThick, mdiPackageVariantClosed } from '@mdi/js'
import Panel from '@/components/ui/Panel.vue'
@Component({
components: { Panel },
})
export default class SystemPackagesList extends Mixins(BaseMixin) {
mdiCloseThick = mdiCloseThick
mdiPackageVariantClosed = mdiPackageVariantClosed
@Prop({ required: true }) readonly boolShowDialog!: boolean
@Prop({ required: true }) readonly packagesList!: string[]
closeDialog() {
this.$emit('close-dialog')
}
}
</script>
<style scoped>
.system-packages-list {
font-family: monospace;
margin-bottom: 0 !important;
}
</style>
Loaded 100 of 287 files, more files were not shown because too many files have changed in this diff. Show more