Compare commits

..
83 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
Stefan Dej c07606a13c [Automated] Merged develop into target master 2023-06-19 21:50:41 +02:00
Stefan Dej c6a3bbc1ca [Automated] Merged develop into target master 2023-06-19 21:09:15 +02:00
Stefan Dej 3584c0393f [Automated] Merged develop into target master 2023-04-02 14:51:30 +02:00
Stefan Dej eac516e0e6 [Automated] Merged develop into target master 2023-03-12 13:14:34 +01:00
Stefan Dej 350bc1927a [Automated] Merged develop into target master 2022-12-10 19:27:44 +01:00
148 changed files with 7470 additions and 12073 deletions

No files matched your search

+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
+6 -6
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,13 +41,13 @@ 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,linux/arm/v6
push: ${{ github.event_name != 'pull_request' }}
+4 -4
View File
@@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone develop repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
ref: 'develop'
@@ -53,7 +53,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Fetch repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: 'master'
fetch-depth: 0
@@ -61,7 +61,7 @@ jobs:
- name: Install node
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
- name: Install dependencies
run: npm ci
@@ -80,7 +80,7 @@ jobs:
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
uses: orhun/git-cliff-action@v2
id: generate-changelog
with:
config: ./cliff-release.toml
+2 -2
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: 18
node-version: 20
- name: Install dependencies
run: npm ci
+1
View File
@@ -4,6 +4,7 @@
"semi": false,
"printWidth": 120,
"bracketSameLine": true,
"trailingComma": "es5",
"htmlWhitespaceSensitivity": "ignore",
"overrides": [
{
+88
View File
@@ -2,6 +2,94 @@
# Changelog
All notable changes to Mainsail will be documented in this file.
## [2.7.1](https://github.com/mainsail-crew/mainsail/releases/tag/v2.7.1) - 2023-08-16
### Bug Fixes and Improvements
- Fix issue on tablet and smaller devices with the sidebar (#1518) | [218f85c](218f85c81feafecc80043e26e880f45be5bc5e3d)
### Localization
- **zh**: Update Chinese (zh) localization (#1521) | [caaf5e1](caaf5e16062d12f765d2e7d6c985dbc351e34336)
## [2.7.0](https://github.com/mainsail-crew/mainsail/releases/tag/v2.7.0) - 2023-08-12
### Features
- Hide screws tilt adjust dialog, when using MAX_DEVIATION (#1474) | [15371ad](15371adc3d550817663aabca6c2f4b76fd585e4f)
- Add option to hide MCU/Host sensors in the temp panel (#1496) | [9883457](9883457e9d622c16f6edb8e368c77b99e6728085)
- Hide axis controls during print (#1452) | [da15789](da157891a44bc6a6b9cdec87e0e8fb2c0f060dba)
- Add an option to set the sidebar default state (#1462) | [e9c22d3](e9c22d32bc3615360407caf544ed5751f30adb09)
- Add option to hide FPS counter in webcams (#1488) | [69eaeb6](69eaeb65573c5dda5773c5f9c60fa249d136c213)
- Add a select all option on the backup and restore dialogs (#1448) | [0c4b9e7](0c4b9e75516c55bfe6678ce3a66ed8e281295ace)
- Add nevermore to temperature panel (#1511) | [1cd2541](1cd2541d6f2f7d567f33b00708fe055b929df3dd)
### Bug Fixes and Improvements
- Fix cursor style for item name to be a pointer (#1514) | [98d9b0a](98d9b0aa597ab482314876b11d261c81aae1bbf9)
### Refactor
- Soft down info buttons in update manager (#1513) | [16165ec](16165ec85f05a92edcd52f57be869ea31f8b0460)
### Localization
- **pl**: Update Polish translation (#1502) | [fe7aee9](fe7aee9307cca63ae993c062e2d9a84a6f215856)
- **pl**: Update Polish translation (#1515) | [90d76c1](90d76c1ffeea42bc59f6d7dcc9374eee600f2cc7)
- **zh**: Update Chinese (zh) localization (#1503) | [dbb5f81](dbb5f81206d4d161eb0593b9d5e8c7b5189ffc2d)
## [2.6.2](https://github.com/mainsail-crew/mainsail/releases/tag/v2.6.2) - 2023-07-30
### Bug Fixes and Improvements
- Fix editor save & restart button behavior (#1483) | [8447be2](8447be2ecee64fa4a3c0211ac57f42c3adf1d050)
- Hide rpm in temperature_fans without tachometer_pin (#1489) | [e929c7c](e929c7cc0f45074f40407420b3585d9c02284fa1)
- Fix flip function in several webcam clients (#1487) | [5c40820](5c4082010890e0b341754f42673affe7d1ca9d99)
- Fix issue with camel-case object names in temperature panel (#1491) | [aeee198](aeee1982398acca803f7f4eae7b7b39a29253179)
- Use webcam name instead of UUID for timelapse plugin (#1492) | [d67ef3a](d67ef3aa908601b6bb87353957bcc97ea4f829ea)
- Fix issue with create/edit presets and refactor settings (#1499) | [6a4cca7](6a4cca751c88e89ddf5f2cc0f09a58f097a461af)
- Fix multiple issues in the refactored update manager (#1497) | [9eb133b](9eb133bd85530ac08416e94f02ebe19f060bc095)
- Fix issue with cannot extrude after a Klipper restart (#1495) | [cda3098](cda3098c9e09a054aa7baa69a3195e0a73f43e54)
### Refactor
- Refactor SettingsRow (#1484) | [0b47a80](0b47a80b133e6093aecdb0d7d87b718899dff0c7)
### Localization
- **pl**: Update Polish translation (#1482) | [0c5aca8](0c5aca8baffb65198f43a7d3b2b57571d8e911c9)
- **zh**: Update chinese locale (#1486) | [7251a8c](7251a8c6bae2b92395de4c8c23e8e8e3900df66a)
## [2.6.1](https://github.com/mainsail-crew/mainsail/releases/tag/v2.6.1) - 2023-07-24
### Bug Fixes and Improvements
- Show delete dialog for single files too (#1442) | [7da3352](7da33523d1ec7c4a3206400fb92803685176167e)
- Remove variable check in klipper config StreamParser (#1435) | [6e7ef65](6e7ef6554ec88ceb29f66b4d6a5d5f21ef77671b)
- Fix condition in restartServiceNameExists check (#1450) | [a7e70c7](a7e70c75d0009ffed14e8717ad8286f91e4e7e8a)
- Avoid hitting 100% before print is complete (#1455) | [3959000](39590004da7ca22fef82fbd148b31683c462bb13)
- Fix issue with ETA and 12h time format (#1463) | [039a446](039a446944f05ea241574c65040d520bbbef0e9b)
- Fix issue with CSV separator in contents (#1460) | [1895d2d](1895d2d90591946c792faaf3f62c52865f27cd62)
- Fix issue with webcams in farm printers (#1469) | [5b2bea5](5b2bea51aab79aabfab02825cdce45be351c1c6f)
### Refactor
- Build version file for moonraker (#1449) | [21d3d39](21d3d395039ec855d062a5ee5e5b43e2d858f402)
- Use moonraker webcam api instead of direct DB access (#1445) | [7c81690](7c81690c1e299c804edb4ede0acab7d77d1dedbe)
- Change SettingsGeneralTab file (#1475) | [db09bbe](db09bbe043b2e43053779709f5260c7275bc4969)
- Extract Presets and Settings from TemperaturePanel (#1465) | [be25316](be253165a003c50fd992f43c586ce5315dc2352d)
- Display errors and warnings in the update_manager (#1453) | [0cefa24](0cefa24e766c568a56127bfd55272735383cb45e)
### Localization
- **pl**: Update Polish translation (#1434) | [73e503f](73e503fc6448ae174dd7f9d59236c820bd4b6631)
- **pl**: Update Polish translation (#1447) | [d844125](d8441254db04d672fe2137f64e39127f524c4769)
- **pl**: Update polish locale (#1471) | [a58bef2](a58bef2a03479262b4ee5db2b5d103e8dc2194c5)
- **pl**: Update Polish translation (#1476) | [6758049](6758049d29c7410bcdedec689eaca503952b2c7e)
- **tr**: Update turkish locale (#1480) | [f52b94c](f52b94c459ad759e160a568d3b6f366b0e65f484)
- **zh**: Update Chinese (zh) localization (#1459) | [bcbef2f](bcbef2f19af4746b941ddcb29c98ff5f071611d0)
### Other
- **pwa**: Remove debug warnings in browser console (#1441) | [2962df2](2962df21e512baad6976dc502d6234c2969da686)
- Add dev-dist to .gitignore (#1451) | [ef2d17c](ef2d17cadde566e8b713031cb7292d65ca1bec12)
## [2.6.0](https://github.com/mainsail-crew/mainsail/releases/tag/v2.6.0) - 2023-06-19
### Features
+1 -1
View File
@@ -1,7 +1,7 @@
#
# Builder stage, builds the application in node
#
FROM --platform=$BUILDPLATFORM node:18-alpine as builder
FROM --platform=$BUILDPLATFORM node:20-alpine as builder
RUN apk add zip
+1 -1
View File
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
+1696 -9148
View File
File diff suppressed because it is too large. Load diff
+9 -8
View File
@@ -1,6 +1,6 @@
{
"name": "mainsail",
"version": "2.6.1",
"version": "2.8.0",
"private": true,
"decription": "a klipper web interface",
"author": {
@@ -40,6 +40,7 @@
"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",
@@ -77,16 +78,16 @@
"@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/eslint-config-typescript": "^11.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": "^10.0.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": "^9.0.0",
"prettier": "^2.5.1",
"prettier": "^3.0.0",
"sass": "~1.32",
"start-server-and-test": "^1.14.0",
"typescript": "^4.5.5",
@@ -118,6 +119,6 @@
"last 2 edge major versions"
],
"engines": {
"node": "^16 || ^18"
"node": "^18 || ^20"
}
}
+53 -33
View File
@@ -1,37 +1,11 @@
<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-service-worker />
@@ -44,8 +18,8 @@
<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>
@@ -105,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
}
@@ -289,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')
@@ -296,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
@@ -311,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;
}
+16 -8
View File
@@ -239,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
}
+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*/
+1 -5
View File
@@ -70,7 +70,7 @@ export default class TheSidebar extends Mixins(NavigationMixin, BaseMixin) {
return this.$store.state.naviDrawer
}
set naviDrawer(newVal: boolean) {
set naviDrawer(newVal) {
this.$store.dispatch('setNaviDrawer', newVal)
}
@@ -133,10 +133,6 @@ export default class TheSidebar extends Mixins(NavigationMixin, BaseMixin) {
return output
}
mounted() {
this.naviDrawer = this.$vuetify.breakpoint.lgAndUp
}
}
</script>
+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() {
+35 -15
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,12 +17,12 @@
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"
@@ -66,9 +66,9 @@
<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>
@@ -84,7 +84,7 @@
</v-snackbar>
<v-dialog v-model="showEmergencyStopDialog" width="400" :fullscreen="isMobile">
<panel
:title="$t('EmergencyStopDialog.EmergencyStop').toString()"
:title="$t('EmergencyStopDialog.EmergencyStop')"
toolbar-color="error"
card-class="emergency-stop-dialog"
:icon="mdiAlertOctagonOutline"
@@ -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>
@@ -245,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() {
@@ -342,14 +363,13 @@ export default class TheTopbar extends Mixins(BaseMixin) {
}
</script>
<style>
<style scoped>
/*noinspection CssUnusedSymbol*/
.topbar .v-toolbar__content {
::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;
}
+16 -4
View File
@@ -313,15 +313,23 @@ export default class TempChart extends Mixins(BaseMixin) {
const seriesNameTemperature = `${baseSeriesName}-temperature`
const seriesNameTarget = `${baseSeriesName}-target`
if (seriesNameTemperature in dataset.value) output += dataset.value[seriesNameTemperature].toFixed(1)
if (seriesNameTarget in dataset.value) output += ' / ' + dataset.value[seriesNameTarget].toFixed(1)
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'
datasetTypesInPercents.forEach((attrKey) => {
const seriesName = `${baseSeriesName}-${attrKey}`
if (!(seriesName in dataset.value)) return
const value = (dataset.value[seriesName] * 100).toFixed(0)
let value = dataset.value[seriesName]
value = value !== null ? (dataset.value[seriesName] * 100).toFixed(0) : '--'
output += ` [ ${value}% ]`
})
@@ -356,7 +364,11 @@ export default class TempChart extends Mixins(BaseMixin) {
// 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', {}, { action: 'printer/tempHistory/init' })
this.$socket.emit(
'server.temperature_store',
{ include_monitors: true },
{ action: 'printer/tempHistory/init' }
)
}
}
}
@@ -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>
@@ -65,13 +65,21 @@ export default class TheScrewsTiltAdjustDialog extends Mixins(BaseMixin, Control
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
}
+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>
+11 -5
View File
@@ -59,7 +59,7 @@
<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="0">
<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>
@@ -101,6 +101,8 @@ import BaseMixin from '@/components/mixins/base'
import { GuiMacrosStateMacrogroupMacro } from '@/store/gui/macros/types'
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
@@ -128,13 +130,13 @@ export default class MacroButton extends Mixins(BaseMixin) {
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
@@ -199,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)
}
+14 -38
View File
@@ -53,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) {
@@ -65,48 +66,23 @@ export default class NumberInput extends Mixins(BaseMixin) {
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.toString()
+2 -1
View File
@@ -85,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) {
@@ -107,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
+4
View File
@@ -47,6 +47,10 @@ 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'
+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
}
}
@@ -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
}
}
+13
View File
@@ -47,4 +47,17 @@ export default class WebcamMixin extends Mixins(BaseMixin) {
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'
}
}
@@ -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>
+34 -454
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,55 @@
</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"
:style="{ 'background-color': '#' + tool.color }"
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() {
get loadFilamentMacro(): PrinterStateMacro | undefined {
return this.macros.find((macro: PrinterStateMacro) => macro.name.toUpperCase() === 'LOAD_FILAMENT')
}
get unloadFilamentMacro() {
get unloadFilamentMacro(): PrinterStateMacro | undefined {
return this.macros.find((macro: PrinterStateMacro) => macro.name.toUpperCase() === 'UNLOAD_FILAMENT')
}
@@ -376,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 {
@@ -392,162 +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 *
(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
}
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>
+20 -7
View File
@@ -240,6 +240,7 @@
<v-tooltip
top
content-class="tooltip__content-opacity1"
:color="bigThumbnailTooltipColor"
:disabled="!item.big_thumbnail">
<template #activator="{ on, attrs }">
<vue-load-image>
@@ -252,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>
@@ -304,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
@@ -617,7 +618,7 @@
<script lang="ts">
import { Component, Mixins, Watch } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { validGcodeExtensions } from '@/store/variables'
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'
@@ -1101,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)
}
@@ -1322,7 +1335,7 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
await addElementToItems('gcodes/' + this.currentPath, this.selectedFiles)
const date = new Date()
const timestamp = `${date.getFullYear()}${date.getMonth()}${date.getDay()}-${date.getHours()}${date.getMinutes()}${date.getSeconds()}`
const timestamp = `${date.getFullYear()}${date.getMonth()}${date.getDate()}-${date.getHours()}${date.getMinutes()}${date.getSeconds()}`
this.$socket.emit(
'server.files.zip',
@@ -1050,7 +1050,7 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
const date = new Date()
const month = (date.getMonth() + 1).toString().padStart(2, '0')
const day = date.getDay().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')
@@ -5,21 +5,31 @@
<strong>{{ repo.name }}</strong>
<br />
<template v-if="type === 'git_repo' && commitsBehind.length">
<a class="primary--text cursor--pointer" @click="boolShowCommitList = true">
<v-icon small color="primary" class="mr-1">{{ mdiInformation }}</v-icon>
<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="primary--text text-decoration-none" :href="webLinkRelease" target="_blank">
<v-icon small color="primary" class="mr-1">{{ mdiInformation }}</v-icon>
<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">
<template v-if="needsRecovery">
<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
@@ -37,16 +47,16 @@
</v-chip>
</template>
<v-list dense class="py-0">
<v-list-item @click="doRecovery(false)">
<v-list-item-icon class="mr-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 @click="doRecovery(true)">
<v-list-item-icon class="mr-0">
<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>
@@ -70,36 +80,30 @@
</v-chip>
</v-col>
</v-row>
<v-row v-if="notificationText" class="mt-0">
<v-col class="px-6 pt-0">
<v-alert text dense :color="notificationColor" :icon="notificationIcon" border="left">
{{ notificationText }}
</v-alert>
</v-col>
</v-row>
<v-row v-if="gitMessages.length" class="mt-0">
<v-col class="px-6 pt-0">
<v-alert
v-for="(message, index) in gitMessages"
:key="'message_' + index"
text
dense
border="left"
type="info">
{{ message }}
</v-alert>
</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"
text
dense
border="left"
text
color="orange"
:icon="mdiAlertCircle">
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>
@@ -123,13 +127,15 @@ import { Component, Mixins, Prop } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { ServerUpdateManagerStateGitRepo } from '@/store/server/updateManager/types'
import {
mdiAlertCircle,
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'
@@ -141,11 +147,15 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) {
mdiInformation = mdiInformation
mdiMenuDown = mdiMenuDown
mdiReload = mdiReload
mdiAlertCircle = mdiAlertCircle
mdiCloseCircle = mdiCloseCircle
mdiUpdate = mdiUpdate
mdiInformationOutline = mdiInformationOutline
boolShowCommitList = false
boolShowUpdateHint = false
toggleAnomalies = false
@Prop({ required: true }) readonly repo!: ServerUpdateManagerStateGitRepo
get name() {
@@ -230,6 +240,10 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) {
return this.repo.is_dirty ?? false
}
get isCorrupt() {
return this.repo.corrupt ?? false
}
get debugEnabled() {
return this.repo.debug_enabled ?? false
}
@@ -240,19 +254,21 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) {
return !this.debugEnabled && (this.repo.detached ?? false)
}
get needsRecovery() {
return !this.isValid || this.isDirty
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.isDirty || this.commitsBehind.length) return false
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.isDirty) return mdiAlertCircle
if (this.isDetached || !this.isValid || this.isCorrupt || this.isDirty) return mdiCloseCircle
if (
this.commitsBehind.length ||
@@ -266,8 +282,7 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) {
}
get btnColor() {
if (this.isDetached || !this.isValid) return 'orange'
if (this.isDirty) return 'red'
if (this.isCorrupt || this.isDetached || this.isDirty || !this.isValid) return 'orange'
if (
this.commitsBehind.length ||
@@ -279,9 +294,10 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) {
}
get btnText() {
if (this.isCorrupt) return this.$t('Machine.UpdatePanel.Corrupt')
if (this.isDetached) return this.$t('Machine.UpdatePanel.Detached')
if (!this.isValid) return this.$t('Machine.UpdatePanel.Invalid')
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))
@@ -293,23 +309,8 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) {
return this.$t('Machine.UpdatePanel.UpToDate')
}
get notificationText() {
if (this.isDetached) return this.$t('Machine.UpdatePanel.Notification.Detached')
if (this.isDirty) return this.$t('Machine.UpdatePanel.Notification.Dirty')
return null
}
get notificationColor() {
return this.btnColor
}
get notificationIcon() {
return this.btnIcon
}
get gitMessages() {
return this.repo.git_messages ?? []
get anomalies() {
return this.repo.anomalies ?? []
}
get warnings() {
@@ -323,8 +324,12 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) {
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}`
return `https://github.com/${this.repo.owner}/${this.repo_name}/releases/tag/${this.repo.remote_version}`
}
get hideUpdateWarning() {
@@ -5,8 +5,8 @@
<strong>{{ $t('Machine.UpdatePanel.System') }}</strong>
<br />
<template v-if="package_count">
<a class="primary--text cursor--pointer" @click="boolShowPackageList = true">
<v-icon small color="primary" class="mr-1">{{ mdiInformation }}</v-icon>
<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>
@@ -83,7 +83,7 @@ export default class GitCommitsList extends Mixins(BaseMixin) {
if (
commitDate.getFullYear() !== lastCommitDate.getFullYear() ||
commitDate.getMonth() !== lastCommitDate.getMonth() ||
commitDate.getDay() !== lastCommitDate.getDay()
commitDate.getDate() !== lastCommitDate.getDate()
) {
output.push({
date: commitDate,
@@ -85,8 +85,12 @@ export default class GitCommitsListDayCommit extends Mixins(BaseMixin) {
})
}
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}`
return `https://github.com/${this.repo.owner}/${this.repo_name}/commit/${this.commit.sha}`
}
get commitShortSha() {
@@ -69,13 +69,17 @@ export default class UpdateHintAlert extends Mixins(BaseMixin) {
return null
}
get repo_name() {
return this.repo.repo_name ?? this.repo.name ?? ''
}
get externalLink() {
if (this.name === 'klipper') return '//www.klipper3d.org/Config_Changes.html'
if (this.name === 'moonraker') return '//moonraker.readthedocs.io/en/latest/changelog/'
if (this.repo?.configured_type === 'web')
return `//github.com/${this.repo.owner}/${this.repo.name}/releases/tag/${this.repo.remote_version}`
return `//github.com/${this.repo.owner}/${this.repo_name}/releases/tag/${this.repo.remote_version}`
return `//github.com/${this.repo.owner}/${this.repo.name}`
return `//github.com/${this.repo.owner}/${this.repo_name}`
}
get externalLinkText() {
+39 -19
View File
@@ -1,13 +1,3 @@
<style scoped lang="scss">
.consoleTable {
border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.gcode-command-field {
font-family: 'Roboto Mono', monospace;
}
</style>
<template>
<panel
v-if="socketIsConnected && klipperState !== 'disconnected'"
@@ -20,30 +10,37 @@
<v-btn icon tile @click="clearConsole">
<v-icon small>{{ mdiTrashCan }}</v-icon>
</v-btn>
<command-help-modal :in-toolbar="true" @onCommand="gcode = $event"></command-help-modal>
<command-help-modal :in-toolbar="true" @onCommand="gcode = $event" />
<v-menu
:offset-y="true"
:close-on-content-click="false"
:title="$t('Panels.MiniconsolePanel.SetupConsole')">
<template #activator="{ on, attrs }">
<v-btn icon tile v-bind="attrs" v-on="on">
<v-icon small>{{ mdiFilter }}</v-icon>
<v-icon small>{{ mdiCog }}</v-icon>
</v-btn>
</template>
<v-list>
<v-list-item v-if="consoleDirection === 'shell'" class="minHeight36">
<v-checkbox
v-model="autoscroll"
class="mt-0"
hide-details
:label="$t('Panels.MiniconsolePanel.Autoscroll')" />
</v-list-item>
<v-list-item class="minHeight36">
<v-checkbox
v-model="hideWaitTemperatures"
class="mt-0"
hide-details
:label="$t('Panels.MiniconsolePanel.HideTemperatures')"></v-checkbox>
:label="$t('Panels.MiniconsolePanel.HideTemperatures')" />
</v-list-item>
<v-list-item v-if="moonrakerComponents.includes('timelapse')" class="minHeight36">
<v-checkbox
v-model="hideTlCommands"
class="mt-0"
hide-details
:label="$t('Panels.MiniconsolePanel.HideTimelapse')"></v-checkbox>
:label="$t('Panels.MiniconsolePanel.HideTimelapse')" />
</v-list-item>
<v-list-item v-for="(filter, index) in customFilters" :key="index" class="minHeight36">
<v-checkbox
@@ -51,7 +48,7 @@
class="mt-0"
hide-details
:label="filter.name"
@change="toggleFilter(filter)"></v-checkbox>
@change="toggleFilter(filter)" />
</v-list-item>
</v-list>
</v-menu>
@@ -93,7 +90,7 @@
:events="events"
:is-mini="true"
@command-click="commandClick" />
<v-divider></v-divider>
<v-divider />
</overlay-scrollbars>
</v-col>
</v-row>
@@ -109,7 +106,7 @@ import BaseMixin from '@/components/mixins/base'
import { CommandHelp, VTextareaType } from '@/store/printer/types'
import ConsoleTable from '@/components/console/ConsoleTable.vue'
import Panel from '@/components/ui/Panel.vue'
import { mdiChevronDoubleRight, mdiConsoleLine, mdiFilter, mdiSend, mdiTrashCan } from '@mdi/js'
import { mdiChevronDoubleRight, mdiCog, mdiConsoleLine, mdiSend, mdiTrashCan } from '@mdi/js'
import CommandHelpModal from '@/components/CommandHelpModal.vue'
@Component({
@@ -122,7 +119,7 @@ import CommandHelpModal from '@/components/CommandHelpModal.vue'
export default class MiniconsolePanel extends Mixins(BaseMixin) {
mdiTrashCan = mdiTrashCan
mdiConsoleLine = mdiConsoleLine
mdiFilter = mdiFilter
mdiCog = mdiCog
mdiSend = mdiSend
mdiChevronDoubleRight = mdiChevronDoubleRight
@@ -155,13 +152,18 @@ export default class MiniconsolePanel extends Mixins(BaseMixin) {
@Watch('events')
eventsChanged() {
if (this.consoleDirection === 'shell') {
if (this.consoleDirection === 'shell' && this.autoscroll) {
setTimeout(() => {
this.scrollToBottom()
}, 50)
}
}
@Watch('autoscroll')
autoscrollChanged(newVal: boolean) {
if (newVal) this.scrollToBottom()
}
clearConsole() {
this.$store.dispatch('gui/console/clear')
}
@@ -194,6 +196,14 @@ export default class MiniconsolePanel extends Mixins(BaseMixin) {
return this.$store.state.gui.gcodehistory.entries ?? []
}
get autoscroll(): boolean {
return this.$store.state.gui.console.autoscroll ?? true
}
set autoscroll(newVal) {
this.$store.dispatch('gui/saveSetting', { name: 'console.autoscroll', value: newVal })
}
commandClick(msg: string): void {
this.gcode = msg
@@ -325,3 +335,13 @@ export default class MiniconsolePanel extends Mixins(BaseMixin) {
}
}
</script>
<style scoped>
.consoleTable {
border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.gcode-command-field {
font-family: 'Roboto Mono', monospace;
}
</style>
@@ -0,0 +1,129 @@
<template>
<v-list-item three-line>
<v-list-item-content :class="listItemContentClass">
<div :class="overlineClass">#{{ id }} | {{ vendor }}</div>
<v-list-item-title :class="listItemTitleClass">
<span class="cursor-pointer" @click="clickSpool">{{ name }}</span>
</v-list-item-title>
<v-list-item-subtitle>{{ subtitle }}</v-list-item-subtitle>
</v-list-item-content>
<v-list-item-avatar tile :size="avatarSize">
<spool-icon :color="color" @click-spool="clickSpool" />
</v-list-item-avatar>
</v-list-item>
</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 SpoolmanChangeSpoolDialog from '@/components/dialogs/SpoolmanChangeSpoolDialog.vue'
import SpoolmanEjectSpoolDialog from '@/components/dialogs/SpoolmanEjectSpoolDialog.vue'
import { ServerSpoolmanStateSpool } from '@/store/server/spoolman/types'
@Component({
components: { Panel, SpoolmanChangeSpoolDialog, SpoolmanEjectSpoolDialog },
})
export default class SpoolmanPanelActiveSpool extends Mixins(BaseMixin) {
@Prop({ required: false, default: false }) readonly small!: boolean
get listItemContentClass() {
if (this.small) return 'my-0'
return ''
}
get overlineClass() {
const classes = ['text-overline', 'mb-1']
if (this.small) classes.push('line-height-auto')
return classes
}
get listItemTitleClass() {
if (this.small) return ['text-h6', 'mb-1']
return ['text-h5', 'mb-1']
}
get avatarSize() {
if (this.small) return 60
return 80
}
get active_spool(): ServerSpoolmanStateSpool | null {
return this.$store.state.server.spoolman.active_spool ?? null
}
get color() {
const color = this.active_spool?.filament.color_hex ?? null
if (color === null) return '#000'
return `#${color}`
}
get id() {
return this.active_spool?.id ?? 'XX'
}
get vendor() {
return this.active_spool?.filament?.vendor?.name ?? 'Unknown'
}
get name() {
return this.active_spool?.filament.name ?? 'Unknown'
}
get materialOutput() {
const material = this.active_spool?.filament.material ?? null
if (material === null) return null
return material
}
get weightOutput() {
let remaining = this.active_spool?.remaining_weight ?? null
let total = this.active_spool?.filament.weight ?? null
let unit = 'g'
if (remaining === null || total === null) return null
remaining = Math.round(remaining)
let totalRound = Math.floor(total / 1000)
if (total >= 1000) {
if (totalRound !== total / 1000) {
totalRound = Math.round(total / 100) / 10
}
return `${remaining}g / ${totalRound}kg`
}
return `${remaining} / ${total}${unit}`
}
get lengthOutput() {
let remaining = this.active_spool?.remaining_length ?? null
if (remaining === null) return null
remaining = Math.round(remaining / 1000)
return `${remaining}m`
}
get subtitle() {
return [this.materialOutput, this.weightOutput, this.lengthOutput].filter((v) => v !== null).join(' | ')
}
clickSpool() {
this.$emit('change-spool')
}
}
</script>
<style scoped>
.line-height-auto {
line-height: 1;
}
</style>
+102
View File
@@ -0,0 +1,102 @@
<template>
<div>
<panel :icon="mdiAdjust" :title="title" card-class="spoolman-panel" :collapsible="true">
<template #buttons>
<v-btn icon tile :title="changeSpoolTooltip" @click="showChangeSpoolDialog = true">
<v-icon>{{ mdiSwapVertical }}</v-icon>
</v-btn>
<v-menu :offset-y="true" :close-on-content-click="false" left>
<template #activator="{ on, attrs }">
<v-btn icon tile v-bind="attrs" v-on="on">
<v-icon>{{ mdiDotsVertical }}</v-icon>
</v-btn>
</template>
<v-list dense>
<v-list-item>
<v-btn small style="width: 100%" @click="showEjectSpoolDialog = true">
<v-icon left>{{ mdiEject }}</v-icon>
{{ $t('Panels.SpoolmanPanel.EjectSpool') }}
</v-btn>
</v-list-item>
<v-list-item>
<v-btn small style="width: 100%" @click="openSpoolManager">
<v-icon left>{{ mdiOpenInNew }}</v-icon>
{{ $t('Panels.SpoolmanPanel.OpenSpoolManager') }}
</v-btn>
</v-list-item>
</v-list>
</v-menu>
</template>
<v-card-text v-if="active_spool === null">
<v-row>
<v-col class="text-center">
<p class="text--disabled">{{ $t('Panels.SpoolmanPanel.NoActiveSpool') }}</p>
<v-btn small color="primary" @click="showChangeSpoolDialog = true">
{{ $t('Panels.SpoolmanPanel.SelectSpool') }}
</v-btn>
</v-col>
</v-row>
</v-card-text>
<spoolman-panel-active-spool v-else @change-spool="showChangeSpoolDialog = true" />
</panel>
<spoolman-change-spool-dialog :show-dialog="showChangeSpoolDialog" @close="showChangeSpoolDialog = false" />
<spoolman-eject-spool-dialog :show-dialog="showEjectSpoolDialog" @close="showEjectSpoolDialog = false" />
</div>
</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 { mdiAdjust, mdiDotsVertical, mdiEject, mdiOpenInNew, mdiSwapVertical } from '@mdi/js'
import SpoolmanChangeSpoolDialog from '@/components/dialogs/SpoolmanChangeSpoolDialog.vue'
import SpoolmanEjectSpoolDialog from '@/components/dialogs/SpoolmanEjectSpoolDialog.vue'
import { ServerSpoolmanStateSpool } from '@/store/server/spoolman/types'
import SpoolmanPanelActiveSpool from '@/components/panels/Spoolman/SpoolmanPanelActiveSpool.vue'
@Component({
components: { SpoolmanPanelActiveSpool, Panel, SpoolmanChangeSpoolDialog, SpoolmanEjectSpoolDialog },
})
export default class SpoolmanPanel extends Mixins(BaseMixin) {
mdiAdjust = mdiAdjust
mdiDotsVertical = mdiDotsVertical
mdiEject = mdiEject
mdiOpenInNew = mdiOpenInNew
mdiSwapVertical = mdiSwapVertical
showChangeSpoolDialog = false
showEjectSpoolDialog = false
get health() {
return this.$store.state.server.spoolman.health ?? ''
}
get title() {
const headline = this.$t('Panels.SpoolmanPanel.Headline') as string
if (this.health === '' || this.health === 'healthy') return headline
return `${headline} (${this.health})`
}
get changeSpoolTooltip(): string {
if (this.active_spool === null) return this.$t('Panels.SpoolmanPanel.SelectSpool') as string
return this.$t('Panels.SpoolmanPanel.ChangeSpool') as string
}
get active_spool(): ServerSpoolmanStateSpool | null {
return this.$store.state.server.spoolman.active_spool ?? null
}
get spoolManagerUrl() {
return this.$store.state.server.config.config?.spoolman?.server ?? null
}
openSpoolManager() {
window.open(this.spoolManagerUrl, '_blank')
}
}
</script>
<style scoped></style>
+19 -2
View File
@@ -20,7 +20,11 @@
@click="showDialog(item)">
<td class="pr-0 text-center" style="width: 32px">
<template v-if="item.small_thumbnail">
<v-tooltip top content-class="tooltip__content-opacity1" :disabled="!item.big_thumbnail">
<v-tooltip
top
content-class="tooltip__content-opacity1"
:disabled="!item.big_thumbnail"
:color="bigThumbnailTooltipColor">
<template #activator="{ on, attrs }">
<vue-load-image class="d-flex">
<img
@@ -72,7 +76,7 @@
:bool="showDialogBool"
:file="dialogFile"
:current-path="currentPath"
@closeDialog="closeDialog"></start-print-dialog>
@closeDialog="closeDialog" />
<v-menu v-model="contextMenu.shown" :position-x="contextMenu.x" :position-y="contextMenu.y" absolute offset-y>
<v-list>
<v-list-item :disabled="printerIsPrinting || !klipperReadyForGui" @click="showDialog(contextMenu.item)">
@@ -241,6 +245,7 @@ import {
mdiCloseThick,
} from '@mdi/js'
import Panel from '@/components/ui/Panel.vue'
import { defaultBigThumbnailBackground } from '@/store/variables'
interface dialogRenameObject {
show: boolean
@@ -356,6 +361,18 @@ export default class StatusPanelGcodefiles extends Mixins(BaseMixin, ControlMixi
return `width: ${this.contentTdWidth}px;`
}
get bigThumbnailBackground() {
return this.$store.state.gui.uiSettings.bigThumbnailBackground ?? defaultBigThumbnailBackground
}
get bigThumbnailTooltipColor() {
if (defaultBigThumbnailBackground.toLowerCase() === this.bigThumbnailBackground.toLowerCase()) {
return undefined
}
return this.bigThumbnailBackground
}
showContextMenu(e: any, item: FileStateGcodefile) {
if (!this.contextMenu.shown) {
e?.preventDefault()
+18 -1
View File
@@ -5,7 +5,11 @@
@contextmenu="showContextMenu($event, item)">
<td class="pr-0 text-center" style="width: 32px">
<template v-if="smallThumbnail && bigThumbnail">
<v-tooltip v-if="smallThumbnail && bigThumbnail" top content-class="tooltip__content-opacity1">
<v-tooltip
v-if="smallThumbnail && bigThumbnail"
top
content-class="tooltip__content-opacity1"
:color="bigThumbnailTooltipColor">
<template #activator="{ on, attrs }">
<vue-load-image>
<img slot="image" :src="smallThumbnail" width="32" height="32" v-bind="attrs" v-on="on" />
@@ -116,6 +120,7 @@ import BaseMixin from '@/components/mixins/base'
import { ServerJobQueueStateJob } from '@/store/server/jobQueue/types'
import { mdiChevronDown, mdiChevronUp, mdiCloseThick, mdiCounter, mdiFile, mdiPlay, mdiPlaylistRemove } from '@mdi/js'
import NumberInput from '@/components/inputs/NumberInput.vue'
import { defaultBigThumbnailBackground } from '@/store/variables'
@Component({
components: { NumberInput },
})
@@ -192,6 +197,18 @@ export default class StatusPanelJobqueueEntry extends Mixins(BaseMixin) {
return output
}
get bigThumbnailBackground() {
return this.$store.state.gui.uiSettings.bigThumbnailBackground ?? defaultBigThumbnailBackground
}
get bigThumbnailTooltipColor() {
if (defaultBigThumbnailBackground.toLowerCase() === this.bigThumbnailBackground.toLowerCase()) {
return undefined
}
return this.bigThumbnailBackground
}
formatPrintTime(totalSeconds: number) {
if (totalSeconds) {
let output = ''
@@ -7,6 +7,7 @@
tabindex="-1"
class="d-flex align-end statusPanel-big-thumbnail"
height="200"
:style="thumbnailStyle"
@focus="focusBigThumbnail"
@blur="blurBigThumbnail">
<v-card-title
@@ -43,26 +44,34 @@
:src="thumbnailSmall"
width="32"
height="32"
:alt="current_filename"
v-bind="attrs"
v-on="on" />
<v-progress-circular
slot="preloader"
indeterminate
color="primary"></v-progress-circular>
<v-icon slot="error">{{ mdiFile }}</v-icon>
<div slot="preloader">
<v-progress-circular indeterminate color="primary" />
</div>
<div slot="error">
<v-icon>{{ mdiFile }}</v-icon>
</div>
</vue-load-image>
</template>
<span><img :src="thumbnailBig" width="250" /></span>
<span><img :src="thumbnailBig" width="250" :alt="current_filename" /></span>
</v-tooltip>
</template>
<template v-else-if="thumbnailSmall">
<vue-load-image>
<img slot="image" :src="thumbnailSmall" width="32" height="32" />
<v-progress-circular
slot="preloader"
indeterminate
color="primary"></v-progress-circular>
<v-icon slot="error">{{ mdiFile }}</v-icon>
<img
slot="image"
:src="thumbnailSmall"
width="32"
height="32"
:alt="current_filename" />
<div slot="preloader">
<v-progress-circular indeterminate color="primary" />
</div>
<div slot="error">
<v-icon>{{ mdiFile }}</v-icon>
</div>
</vue-load-image>
</template>
</v-col>
@@ -77,13 +86,11 @@
import Component from 'vue-class-component'
import { Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { thumbnailBigMin, thumbnailSmallMax, thumbnailSmallMin } from '@/store/variables'
import { defaultBigThumbnailBackground, thumbnailBigMin, thumbnailSmallMax, thumbnailSmallMin } from '@/store/variables'
import { mdiFileOutline, mdiFile } from '@mdi/js'
import { Debounce } from 'vue-debounce-decorator'
@Component({
components: {},
})
@Component({})
export default class StatusPanelPrintstatusThumbnail extends Mixins(BaseMixin) {
mdiFileOutline = mdiFileOutline
mdiFile = mdiFile
@@ -178,6 +185,18 @@ export default class StatusPanelPrintstatusThumbnail extends Mixins(BaseMixin) {
return this.current_filename && setting && this.thumbnailBig
}
get bigThumbnailBackground() {
return this.$store.state.gui.uiSettings.bigThumbnailBackground ?? defaultBigThumbnailBackground
}
get thumbnailStyle() {
if (defaultBigThumbnailBackground.toLowerCase() !== this.bigThumbnailBackground.toLowerCase()) {
return { backgroundColor: this.bigThumbnailBackground }
}
return {}
}
focusBigThumbnail() {
if (this.$refs.bigThumbnail) {
const clientWidth = this.$refs.bigThumbnail.$el.clientWidth
@@ -22,10 +22,25 @@
</thead>
<tbody>
<temperature-panel-list-item
v-for="objectName in tempObjects"
v-for="objectName in heaterObjects"
:key="objectName"
:object-name="objectName"
:is-responsive-mobile="el.is.mobile ?? false" />
<temperature-panel-list-item-nevermore
v-if="existsNevermoreFilter"
:is-responsive-mobile="el.is.mobile ?? false" />
<temperature-panel-list-item
v-for="objectName in temperature_sensors"
:key="objectName"
:object-name="objectName"
:is-responsive-mobile="el.is.mobile ?? false" />
<template v-if="!hideMonitors">
<temperature-panel-list-item
v-for="objectName in monitors"
:key="objectName"
:object-name="objectName"
:is-responsive-mobile="el.is.mobile ?? false" />
</template>
</tbody>
</v-simple-table>
</template>
@@ -36,8 +51,11 @@
import Component from 'vue-class-component'
import { Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import TemperaturePanelListItemNevermore from '@/components/panels/Temperature/TemperaturePanelListItemNevermore.vue'
@Component
@Component({
components: { TemperaturePanelListItemNevermore },
})
export default class TemperaturePanelList extends Mixins(BaseMixin) {
get available_heaters() {
return this.$store.state.printer?.heaters?.available_heaters ?? []
@@ -59,18 +77,41 @@ export default class TemperaturePanelList extends Mixins(BaseMixin) {
return this.$store.state.printer?.heaters?.available_sensors ?? []
}
get available_monitors() {
return this.$store.state.printer?.heaters?.available_monitors ?? []
}
get monitors() {
return this.available_monitors.sort(this.sortObjectName)
}
get temperature_fans() {
return this.available_sensors
.filter((name: string) => name.startsWith('temperature_fan') && !name.startsWith('temperature_fan _'))
.sort(this.sortObjectName)
}
get existsNevermoreFilter() {
return 'nevermore' in this.$store.state.printer
}
get hideMcuHostSensors(): boolean {
return this.$store.state.gui.view.tempchart.hideMcuHostSensors ?? false
}
get hideMonitors(): boolean {
return this.$store.state.gui.view.tempchart.hideMonitors ?? false
}
get temperature_sensors() {
return this.available_sensors
.filter((fullName: string) => {
if (this.available_heaters.includes(fullName)) return false
if (this.temperature_fans.includes(fullName)) return false
// hide MCU & Host sensors, if the function is enabled
if (this.hideMcuHostSensors && this.checkMcuHostSensor(fullName)) return false
const splits = fullName.split(' ')
let name = splits[0]
if (splits.length > 1) name = splits[1]
@@ -80,8 +121,19 @@ export default class TemperaturePanelList extends Mixins(BaseMixin) {
.sort(this.sortObjectName)
}
get tempObjects() {
return [...this.filteredHeaters, ...this.temperature_fans, ...this.temperature_sensors]
get heaterObjects() {
return [...this.filteredHeaters, ...this.temperature_fans]
}
get settings() {
return this.$store.state.printer?.configfile?.settings ?? {}
}
checkMcuHostSensor(fullName: string) {
const settingsObject = this.settings[fullName.toLowerCase()] ?? {}
const sensor_type = settingsObject.sensor_type ?? ''
return ['temperature_mcu', 'temperature_host'].includes(sensor_type)
}
sortObjectName(a: string, b: string) {
@@ -6,7 +6,7 @@
</v-icon>
</td>
<td class="name">
<span @click="showEditDialog = true">{{ formatName }}</span>
<span class="cursor-pointer" @click="showEditDialog = true">{{ formatName }}</span>
</td>
<td v-if="!isResponsiveMobile" class="state">
<v-tooltip v-if="state !== null" top>
@@ -68,6 +68,7 @@ import { convertName } from '@/plugins/helpers'
import {
mdiFan,
mdiFire,
mdiMemory,
mdiPrinter3dNozzle,
mdiPrinter3dNozzleAlert,
mdiRadiator,
@@ -90,9 +91,12 @@ export default class TemperaturePanelListItem extends Mixins(BaseMixin) {
}
get printerObjectSettings() {
if (!(this.objectName in (this.$store.state.printer?.configfile?.settings ?? {}))) return {}
// convert objectName to lowercase, because klipper only user lowercase in configfile.settings
const lowerCaseObjectName = this.objectName.toLowerCase()
return this.$store.state.printer?.configfile?.settings[this.objectName]
if (!(lowerCaseObjectName in (this.$store.state.printer?.configfile?.settings ?? {}))) return {}
return this.$store.state.printer?.configfile?.settings[lowerCaseObjectName]
}
get name() {
@@ -128,6 +132,9 @@ export default class TemperaturePanelListItem extends Mixins(BaseMixin) {
// show heater_generic icon
if (this.objectName.startsWith('heater_generic')) return mdiFire
// show heater_generic icon
if (this.objectName.startsWith('tmc')) return mdiMemory
// show fan icon, if it is a fan
if (this.isFan) return mdiFan
@@ -135,7 +142,7 @@ export default class TemperaturePanelListItem extends Mixins(BaseMixin) {
}
get color() {
return this.$store.getters['printer/tempHistory/getDatasetColor'](this.objectName)
return this.$store.getters['printer/tempHistory/getDatasetColor'](this.objectName) ?? '#FFFFFF'
}
get iconColor() {
@@ -231,7 +238,10 @@ export default class TemperaturePanelListItem extends Mixins(BaseMixin) {
}
get rpm() {
if (!('rpm' in this.printerObject)) return null
const rpm = this.printerObject.rpm ?? null
// return null when rpm doesn't exist
if (rpm === null) return null
return parseInt(this.printerObject.rpm)
}
@@ -67,6 +67,7 @@ export default class TemperaturePanelListItemEdit extends Mixins(BaseMixin) {
get additionalValues() {
if (this.objectName === 'z_thermal_adjust') return ['current_z_adjust']
if (this.objectName === 'nevermore') return ['temperature', 'pressure', 'humidity', 'rpm']
return Object.keys(this.printerObjectAdditionalSensor).filter((key) => key !== 'temperature')
}
@@ -0,0 +1,110 @@
<template>
<tr>
<td class="icon">
<v-icon :color="iconColor" :class="iconClass" tabindex="-1" @click="showEditDialog = true">
{{ mdiFan }}
</v-icon>
</td>
<td class="name">
<span class="cursor-pointer" @click="showEditDialog = true">Nevermore</span>
</td>
<td class="text-no-wrap text-center" colspan="3">
<temperature-panel-list-item-nevermore-value
:printer-object="printerObject"
:small="false"
object-name="nevermore"
key-name="gas" />
<temperature-panel-list-item-nevermore-value
v-for="keyName in nevermoreValues"
:key="keyName"
:printer-object="printerObject"
object-name="nevermore"
:key-name="keyName" />
<div v-if="rpm !== null">
<small :class="rpmClass">{{ rpm }} RPM</small>
</div>
</td>
<temperature-panel-list-item-edit
:bool-show="showEditDialog"
object-name="nevermore"
name="nevermore"
format-name="Nevermore"
additional-sensor-name="nevermore"
:icon="mdiFan"
:color="color"
@close-dialog="showEditDialog = false" />
</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 { mdiFan } from '@mdi/js'
import { opacityHeaterActive, opacityHeaterInactive } from '@/store/variables'
@Component
export default class TemperaturePanelListItemNevermore extends Mixins(BaseMixin) {
mdiFan = mdiFan
@Prop({ type: Boolean, required: true }) readonly isResponsiveMobile!: boolean
showEditDialog = false
nevermoreValues = ['temperature', 'pressure', 'humidity']
get printerObject() {
return this.$store.state.printer.nevermore ?? {}
}
get color() {
return this.$store.state.gui?.view?.tempchart?.datasetSettings?.nevermore?.color ?? '#ffffff'
}
get iconColor() {
// set icon color to active, if no target exists (temperature_sensors) or a heater is active
if (this.state === null || this.state > 0) return `${this.color}${opacityHeaterActive}`
return `${this.color}${opacityHeaterInactive}`
}
get iconClass() {
const classes = ['_no-focus-style', 'cursor-pointer']
// add icon animation, when it is a fan and state > 0
const disableFanAnimation = this.$store.state.gui?.uiSettings.disableFanAnimation ?? false
if (!disableFanAnimation && (this.state ?? 0) > 0) classes.push('icon-rotate')
return classes
}
get state(): number | null {
return this.printerObject.speed ?? null
}
get rpm() {
const rpm = this.printerObject.rpm ?? null
// return null when rpm doesn't exist
if (rpm === null) return null
return parseInt(this.printerObject.rpm)
}
get rpmClass() {
if (this.rpm === 0 && (this.printerObject.speed ?? 0) > 0) return 'red--text'
return ''
}
}
</script>
<style lang="scss" scoped>
::v-deep .v-icon._no-focus-style:focus::after {
opacity: 0 !important;
}
::v-deep .cursor-pointer {
cursor: pointer;
}
</style>
@@ -0,0 +1,141 @@
<template>
<div v-if="isVisible">
<v-tooltip top :disabled="disableTooltip">
<template #activator="{ on, attrs }">
<span :style="cssStyle" v-bind="attrs" v-on="on">{{ formatValue }}</span>
</template>
<span>
{{ $t('Panels.TemperaturePanel.Max') }}: {{ formatValue_max }}
<br />
{{ $t('Panels.TemperaturePanel.Min') }}: {{ formatValue_min }}
</span>
</v-tooltip>
</div>
</template>
<script lang="ts">
import Component from 'vue-class-component'
import { Mixins, Prop } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
@Component
export default class TemperaturePanelListItemNevermoreValue extends Mixins(BaseMixin) {
@Prop({ type: Object, required: true }) readonly printerObject!: { [key: string]: number }
@Prop({ type: String, required: true }) readonly objectName!: string
@Prop({ type: String, required: true }) readonly keyName!: string
@Prop({ type: Boolean, required: false, default: true }) readonly small!: boolean
get cssStyle() {
let style = { cursor: 'default', fontSize: '1em' }
if (this.small) style.fontSize = '0.8em'
return style
}
get value() {
const value = this.printerObject[this.keyName] ?? null
if (isNaN(value)) return null
return value
}
get intake_value(): number | null {
const name = `intake_${this.keyName}`
return this.printerObject[name] ?? null
}
get intake_value_min(): number | null {
const name = `intake_${this.keyName}_min`
return this.printerObject[name] ?? null
}
get intake_value_max(): number | null {
const name = `intake_${this.keyName}_max`
return this.printerObject[name] ?? null
}
get exhaust_value(): number | null {
const name = `exhaust_${this.keyName}`
return this.printerObject[name] ?? null
}
get exhaust_value_min(): number | null {
const name = `exhaust_${this.keyName}_min`
return this.printerObject[name] ?? null
}
get exhaust_value_max(): number | null {
const name = `exhaust_${this.keyName}_max`
return this.printerObject[name] ?? null
}
get unit(): string | null {
switch (this.keyName) {
case 'temperature':
return '°C'
case 'pressure':
return 'hPa'
case 'humidity':
return '%'
}
return null
}
get digits() {
return ['gas', 'pressure'].includes(this.keyName) ? 0 : 1
}
get formatValue() {
return this.getFormatedValue(this.intake_value, this.exhaust_value)
}
get formatValue_min() {
return this.getFormatedValue(this.intake_value_min, this.exhaust_value_min)
}
get formatValue_max() {
return this.getFormatedValue(this.intake_value_max, this.exhaust_value_max)
}
getFormatedValue(intake: number | null, exhaust: number | null): string {
let intake_value = intake?.toFixed(this.digits)
let exhaust_value = exhaust?.toFixed(this.digits)
if (this.intake_value === null) intake_value = '--'
if (this.exhaust_value === null) exhaust_value = '--'
// return only the value, if unit is null
if (this.unit === null) return `${intake_value} > ${exhaust_value}`
return `${intake_value} ${this.unit} > ${exhaust_value} ${this.unit}`
}
get disableTooltip() {
return (
this.intake_value_min === null ||
this.exhaust_value_min === null ||
this.intake_value_max === null ||
this.exhaust_value_max === null
)
}
get guiSetting() {
return this.$store.getters['gui/getDatasetAdditionalSensorValue']({
name: this.objectName,
sensor: this.keyName,
})
}
get isVisible() {
if (this.intake_value === null && this.exhaust_value === null) return false
return this.guiSetting
}
}
</script>
@@ -70,13 +70,23 @@ export default class TemperaturePanelPresets extends Mixins(BaseMixin) {
preheat(preset: GuiPresetsStatePreset): void {
for (const [name, attributes] of Object.entries(preset.values)) {
if (attributes.bool) {
let gcode = `SET_HEATER_TEMPERATURE HEATER=${name} TARGET=${attributes.value}`
const splits = name.split(' ')
const printerObject = splits[0]
let printerObjectName = splits[1] ?? splits[0]
if (attributes.type === 'temperature_fan') {
const fanName = name.replace('temperature_fan ', '')
gcode = `SET_TEMPERATURE_FAN_TARGET temperature_fan=${fanName} TARGET=${attributes.value}`
// set default heater command
let command = 'SET_HEATER_TEMPERATURE'
let commandAttribute = 'HEATER'
// override command for temperature_fan
if (printerObject === 'temperature_fan') {
command = 'SET_TEMPERATURE_FAN_TARGET'
commandAttribute = 'TEMPERATURE_FAN'
}
// build gcode
const gcode = `${command} ${commandAttribute}=${printerObjectName} TARGET=${attributes.value}`
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
this.$socket.emit('printer.gcode.script', { script: gcode })
}
@@ -13,6 +13,20 @@
hide-details
:label="$t('Panels.TemperaturePanel.ShowChart')" />
</v-list-item>
<v-list-item class="minHeight36">
<v-checkbox
v-model="hideMcuHostSensors"
class="mt-0"
hide-details
:label="$t('Panels.TemperaturePanel.HideMcuHostSensors')" />
</v-list-item>
<v-list-item class="minHeight36">
<v-checkbox
v-model="hideMonitors"
class="mt-0"
hide-details
:label="$t('Panels.TemperaturePanel.HideMonitors')" />
</v-list-item>
<v-list-item class="minHeight36">
<v-checkbox
v-model="autoscaleTempchart"
@@ -49,5 +63,21 @@ export default class TemperaturePanelSettings extends Mixins(BaseMixin) {
set autoscaleTempchart(newVal: boolean) {
this.$store.dispatch('gui/saveSetting', { name: 'view.tempchart.autoscale', value: newVal })
}
get hideMcuHostSensors(): boolean {
return this.$store.state.gui.view.tempchart.hideMcuHostSensors ?? false
}
set hideMcuHostSensors(newVal: boolean) {
this.$store.dispatch('gui/saveSetting', { name: 'view.tempchart.hideMcuHostSensors', value: newVal })
}
get hideMonitors(): boolean {
return this.$store.state.gui.view.tempchart.hideMonitors ?? false
}
set hideMonitors(newVal: boolean) {
this.$store.dispatch('gui/saveSetting', { name: 'view.tempchart.hideMonitors', value: newVal })
}
}
</script>
@@ -746,7 +746,7 @@ export default class TimelapseFilesPanel extends Mixins(BaseMixin) {
await addElementToItems(this.currentPath, this.selectedFiles)
const date = new Date()
const timestamp = `${date.getFullYear()}${date.getMonth()}${date.getDay()}-${date.getHours()}${date.getMinutes()}${date.getSeconds()}`
const timestamp = `${date.getFullYear()}${date.getMonth()}${date.getDate()}-${date.getHours()}${date.getMinutes()}${date.getSeconds()}`
this.$socket.emit(
'server.files.zip',
@@ -202,10 +202,11 @@ import BaseMixin from '@/components/mixins/base'
import SettingsRow from '@/components/settings/SettingsRow.vue'
import Panel from '@/components/ui/Panel.vue'
import { mdiFile, mdiInformation, mdiTextBoxSearchOutline, mdiCloseThick } from '@mdi/js'
import WebcamMixin from '@/components/mixins/webcam'
@Component({
components: { Panel, SettingsRow },
})
export default class TimelapseStatusPanel extends Mixins(BaseMixin) {
export default class TimelapseStatusPanel extends Mixins(BaseMixin, WebcamMixin) {
mdiInformation = mdiInformation
mdiFile = mdiFile
mdiCloseThick = mdiCloseThick
@@ -351,14 +352,13 @@ export default class TimelapseStatusPanel extends Mixins(BaseMixin) {
}
get webcamStyle() {
let transforms = []
const scale = [0, 180].includes(this.camSettings.rotate) ? 1 : this.scale
this.camSettings?.flipX ? transforms.push(`scaleX(-${scale})`) : transforms.push(`scaleX(${scale})`)
this.camSettings?.flipY ? transforms.push(`scaleY(-${scale})`) : transforms.push(`scaleY(${scale})`)
if (this.camSettings.rotate !== 0) transforms.push(`rotate(${this.camSettings.rotate}deg)`)
if (transforms.length) return { transform: transforms.join(' ') }
return {}
return {
transform: this.generateTransform(
this.camSettings.flip_horizontal ?? false,
this.camSettings.flip_vertical ?? false,
this.camSettings.rotation ?? 0
),
}
}
startRender() {
+24 -18
View File
@@ -2,19 +2,11 @@
<panel
v-if="klipperReadyForGui"
:icon="mdiGamepad"
:title="$t('Panels.ToolheadControlPanel.Headline').toString()"
:title="$t('Panels.ToolheadControlPanel.Headline')"
:collapsible="true"
card-class="toolhead-control-panel">
<!-- PANEL-HEADER 3-DOT-MENU -->
<template
v-if="
(controlStyle !== 'bars' && (existsZtilt || existsQGL)) ||
existsBedScrews ||
existsBedTilt ||
existsDeltaCalibrate ||
existsScrewsTilt
"
#buttons>
<template v-if="showButtons" #buttons>
<v-menu left offset-y :close-on-content-click="false" class="pa-0">
<template #activator="{ on, attrs }">
<v-btn icon tile v-bind="attrs" :disabled="['printing'].includes(printer_state)" v-on="on">
@@ -92,21 +84,21 @@
</v-menu>
</template>
<!-- MOVE TO CONTROL -->
<move-to-control class="py-0 pt-3"></move-to-control>
<move-to-control class="py-0 pt-3" />
<!-- AXIS CONTROL -->
<v-container>
<component :is="`${controlStyle}-control`"></component>
<v-container v-if="axisControlVisible">
<component :is="`${controlStyle}-control`" />
</v-container>
<!-- Z-OFFSET CONTROL -->
<v-divider></v-divider>
<v-divider :class="{ 'mt-3': !axisControlVisible }" />
<v-container>
<zoffset-control></zoffset-control>
<zoffset-control />
</v-container>
<!-- SPEED FACTOR -->
<v-divider></v-divider>
<v-divider />
<v-container>
<tool-slider
:label="$t('Panels.ToolheadControlPanel.SpeedFactor').toString()"
:label="$t('Panels.ToolheadControlPanel.SpeedFactor')"
:icon="mdiSpeedometer"
:target="speedFactor"
:min="1"
@@ -116,7 +108,7 @@
:dynamic-range="true"
:has-input-field="true"
command="M220"
attribute-name="S"></tool-slider>
attribute-name="S" />
</v-container>
</panel>
</template>
@@ -164,5 +156,19 @@ export default class ToolheadControlPanel extends Mixins(BaseMixin, ControlMixin
get speedFactor(): number {
return this.$store.state.printer?.gcode_move?.speed_factor ?? 1
}
get isPrinting() {
return ['printing'].includes(this.printer_state)
}
get axisControlVisible() {
return !(this.isPrinting && (this.$store.state.gui.control.hideDuringPrint ?? false))
}
get showButtons() {
if (this.controlStyle !== 'bars' && (this.existsZtilt || this.existsQGL)) return true
return this.existsBedScrews || this.existsBedTilt || this.existsDeltaCalibrate || this.existsScrewsTilt
}
}
</script>
@@ -27,11 +27,7 @@
<span v-if="!el.is.xsmall" class="ml-1">{{ $t('Panels.ZoffsetPanel.Clear') }}</span>
</v-btn>
<v-btn
v-if="
z_gcode_offset !== 0 &&
((existZOffsetApplyProbe && !existZOffsetApplyEndstop) ||
(!existZOffsetApplyProbe && existZOffsetApplyEndstop))
"
v-if="showSaveButton"
color="primary"
text
small
@@ -41,31 +37,6 @@
<v-icon small>{{ mdiContentSave }}</v-icon>
<span v-if="!el.is.xsmall" class="ml-1">{{ $t('Panels.ZoffsetPanel.Save') }}</span>
</v-btn>
<v-menu v-else-if="z_gcode_offset !== 0" offset-y left :close-on-content-click="false">
<template #activator="{ on, attrs }">
<v-btn plain text small color="primary" v-bind="attrs" class="pl-2 pr-0" v-on="on">
<v-icon small>{{ mdiContentSave }}</v-icon>
<span v-if="!el.is.xsmall" class="ml-1">
{{ $t('Panels.ZoffsetPanel.Save') }}
</span>
<v-icon small>{{ mdiMenuDown }}</v-icon>
</v-btn>
</template>
<v-list dense>
<v-list-item>
<v-btn small style="width: 100%" @click="saveZOffsetToEndstop">
<v-icon left small>{{ mdiElectricSwitch }}</v-icon>
{{ $t('Panels.ZoffsetPanel.ToEndstop') }}
</v-btn>
</v-list-item>
<v-list-item>
<v-btn small style="width: 100%" @click="saveZOffsetToProbe">
<v-icon left small>{{ mdiElevator }}</v-icon>
{{ $t('Panels.ZoffsetPanel.ToProbe') }}
</v-btn>
</v-list-item>
</v-list>
</v-menu>
</div>
</v-col>
</v-row>
@@ -123,7 +94,7 @@
<v-dialog v-model="saveOffsetDialog" max-width="290">
<panel
:title="$t('Panels.ZoffsetPanel.SaveInfoHeadline').toString()"
:title="$t('Panels.ZoffsetPanel.SaveInfoHeadline')"
:icon="mdiInformation"
card-class="zoffset-saveinfo-dialog"
:margin-bottom="false">
@@ -160,12 +131,9 @@ import Responsive from '@/components/ui/Responsive.vue'
import {
mdiBroom,
mdiElectricSwitch,
mdiElevator,
mdiContentSave,
mdiArrowCollapseDown,
mdiInformation,
mdiMenuDown,
mdiArrowExpandUp,
mdiLayersOutline,
} from '@mdi/js'
@@ -174,16 +142,13 @@ import {
})
export default class ZoffsetControl extends Mixins(BaseMixin) {
mdiBroom = mdiBroom
mdiElectricSwitch = mdiElectricSwitch
mdiElevator = mdiElevator
mdiContentSave = mdiContentSave
mdiArrowCollapseDown = mdiArrowCollapseDown
mdiInformation = mdiInformation
mdiMenuDown = mdiMenuDown
mdiArrowExpandUp = mdiArrowExpandUp
mdiLayersOutline = mdiLayersOutline
private saveOffsetDialog = false
saveOffsetDialog = false
get homing_origin() {
return this.$store.state.printer?.gcode_move?.homing_origin ?? []
@@ -198,13 +163,37 @@ export default class ZoffsetControl extends Mixins(BaseMixin) {
}
get homed_axis() {
return this.$store.state.printer.toolhead.homed_axes ?? ''
return this.$store.state.printer.toolhead?.homed_axes ?? ''
}
get helplist() {
return this.$store.state.printer.helplist ?? []
}
get settings() {
return this.$store.state.printer.configfile?.settings ?? {}
}
get kinematics() {
return this.settings.printer?.kinematics ?? 'cartesian'
}
get stepper_name() {
if (this.kinematics === 'delta') return 'stepper_a'
return 'stepper_z'
}
get endstop_pin() {
const stepperConfig = this.settings[this.stepper_name] ?? {}
return stepperConfig?.endstop_pin
}
get isEndstopProbe() {
return this.endstop_pin.search('probe:z_virtual_endstop') !== -1
}
get existZOffsetApplyProbe() {
return this.helplist.findIndex((gcode: CommandHelp) => gcode.commandLow === 'z_offset_apply_probe') !== -1
}
@@ -217,6 +206,17 @@ export default class ZoffsetControl extends Mixins(BaseMixin) {
return this.$store.state.printer?.gcode_move?.homing_origin[2].toFixed(3)
}
get showSaveButton() {
// hide button when offset is 0
if (this.z_gcode_offset === 0) return false
// show button when z endstop is probe and probe gcode exists
if (this.isEndstopProbe && this.existZOffsetApplyProbe) return true
// show button when z endstop is endstop and endstop gcode exists
return !this.isEndstopProbe && this.existZOffsetApplyEndstop
}
sendBabyStepDown(offset: number): void {
const gcode = `SET_GCODE_OFFSET Z_ADJUST=-${offset} ${this.homed_axis === 'xyz' ? 'MOVE=1' : ''}`
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
@@ -236,12 +236,12 @@ export default class ZoffsetControl extends Mixins(BaseMixin) {
}
saveZOffset(): void {
if (this.existZOffsetApplyProbe && !this.existZOffsetApplyEndstop) {
if (this.isEndstopProbe && this.existZOffsetApplyProbe) {
this.saveZOffsetToProbe()
return
}
if (!this.existZOffsetApplyProbe && this.existZOffsetApplyEndstop) {
this.saveZOffsetToEndstop()
}
this.saveZOffsetToEndstop()
}
saveZOffsetToEndstop(): void {
+7 -3
View File
@@ -8,8 +8,8 @@
:collapsible="$route.fullPath !== '/cam'"
card-class="webcam-panel"
:margin-bottom="currentPage !== 'page'">
<template v-if="webcams.length > 1" #buttons>
<v-menu :offset-y="true" title="Webcam">
<template #buttons>
<v-menu v-if="showSwitch" :offset-y="true">
<template #activator="{ on, attrs }">
<v-btn text tile v-bind="attrs" v-on="on">
<v-icon v-if="'icon' in currentCam" small class="mr-2">
@@ -33,7 +33,7 @@
<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>
@@ -77,6 +77,10 @@ export default class WebcamPanel extends Mixins(BaseMixin, WebcamMixin) {
return this.$store.getters['gui/webcams/getWebcams']
}
get showSwitch() {
return this.webcams.length > 1
}
// id changed to name with the refactoring of using moonraker webcam API
get currentCamId(): string {
if (this.webcams.length === 1) return this.webcams[0].name ?? 'all'
@@ -0,0 +1,88 @@
<template>
<div>
<v-btn :loading="loadings.includes('backupDbButton')" small @click="openDialog">
{{ $t('Settings.GeneralTab.Backup') }}
</v-btn>
<v-dialog v-model="showDialog" persistent :width="360">
<panel
:title="$t('Settings.GeneralTab.Backup')"
card-class="mainsail-backup-dialog"
:margin-bottom="false"
:icon="mdiHelpCircle">
<template #buttons>
<v-btn icon tile @click="closeDialog">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-card-text>
<v-row>
<v-col>
<p class="mb-0">{{ $t('Settings.GeneralTab.BackupDialog') }}</p>
</v-col>
</v-row>
<v-row>
<checkbox-list
:options="backupableNamespaces"
select-all
@update:selectedCheckboxes="onSelectBackupCheckboxes" />
</v-row>
<v-row>
<v-col class="text-center">
<v-btn color="red" :loading="loadings.includes('backupMainsail')" @click="backupMainsail">
{{ $t('Settings.GeneralTab.Backup') }}
</v-btn>
</v-col>
</v-row>
</v-card-text>
</panel>
</v-dialog>
</div>
</template>
<script lang="ts">
import Component from 'vue-class-component'
import { Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import SettingsRow from '@/components/settings/SettingsRow.vue'
import Panel from '@/components/ui/Panel.vue'
import { mdiCloseThick, mdiHelpCircle } from '@mdi/js'
import CheckboxList from '@/components/inputs/CheckboxList.vue'
import { TranslateResult } from 'vue-i18n'
import SettingsGeneralDatabase from '@/components/mixins/settingsGeneralDatabase'
@Component({
components: { Panel, SettingsRow, CheckboxList },
})
export default class SettingsGeneralTabBackupDatabase extends Mixins(BaseMixin, SettingsGeneralDatabase) {
mdiHelpCircle = mdiHelpCircle
mdiCloseThick = mdiCloseThick
showDialog = false
backupableNamespaces: { value: string; label: string | TranslateResult }[] = []
backupCheckboxes: string[] = []
async mounted() {
this.backupableNamespaces = await this.loadBackupableNamespaces()
}
onSelectBackupCheckboxes(backupCheckboxes: string[]) {
this.backupCheckboxes = backupCheckboxes
}
async backupMainsail() {
await this.$store.dispatch('socket/addLoading', 'backupMainsail')
await this.$store.dispatch('gui/backupMoonrakerDB', this.backupCheckboxes)
await this.$store.dispatch('socket/removeLoading', 'backupMainsail')
this.closeDialog()
}
async openDialog() {
this.backupableNamespaces = await this.loadBackupableNamespaces()
this.showDialog = true
}
closeDialog() {
this.showDialog = false
}
}
</script>
@@ -0,0 +1,105 @@
<template>
<div>
<v-btn color="error" small @click="openDialog">
{{ $t('Settings.GeneralTab.FactoryReset') }}
</v-btn>
<v-dialog v-model="showDialog" persistent :width="360">
<panel
:title="$t('Settings.GeneralTab.FactoryReset')"
card-class="mainsail-reset-dialog"
:margin-bottom="false"
:icon="mdiHelpCircle">
<template #buttons>
<v-btn icon tile @click="closeDialog">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-card-text>
<v-row>
<v-col>
<p class="mb-0">{{ $t('Settings.GeneralTab.FactoryDialog') }}</p>
</v-col>
</v-row>
<v-row>
<checkbox-list
:options="resetableNamespaces"
select-all
@update:selectedCheckboxes="onSelectResetCheckboxes" />
</v-row>
<v-row>
<v-col class="text-center">
<v-btn
color="red"
:loading="loadings.includes('resetMainsail')"
@click="resetMainsailAction">
{{ $t('Settings.GeneralTab.Reset') }}
</v-btn>
</v-col>
</v-row>
</v-card-text>
</panel>
</v-dialog>
</div>
</template>
<script lang="ts">
import Component from 'vue-class-component'
import { Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import SettingsRow from '@/components/settings/SettingsRow.vue'
import Panel from '@/components/ui/Panel.vue'
import { mdiCloseThick, mdiHelpCircle } from '@mdi/js'
import CheckboxList from '@/components/inputs/CheckboxList.vue'
import { TranslateResult } from 'vue-i18n'
import SettingsGeneralDatabase from '@/components/mixins/settingsGeneralDatabase'
@Component({
components: { Panel, SettingsRow, CheckboxList },
})
export default class SettingsGeneralTabResetDatabase extends Mixins(BaseMixin, SettingsGeneralDatabase) {
mdiHelpCircle = mdiHelpCircle
mdiCloseThick = mdiCloseThick
showDialog = false
resetableNamespaces: { value: string; label: string | TranslateResult }[] = []
resetCheckboxes: string[] = []
async mounted() {
await this.loadResetableNamespaces()
}
onSelectResetCheckboxes(resetCheckboxes: string[]) {
this.resetCheckboxes = resetCheckboxes
}
resetMainsailAction() {
this.$store.dispatch('socket/addLoading', 'resetMainsail')
this.$store.dispatch('gui/resetMoonrakerDB', this.resetCheckboxes)
}
async openDialog() {
await this.loadResetableNamespaces()
this.showDialog = true
}
async loadResetableNamespaces() {
this.resetableNamespaces = await this.loadBackupableNamespaces()
if (this.moonrakerComponents.includes('history')) {
this.resetableNamespaces.push({
value: 'history_jobs',
label: this.$t('Settings.GeneralTab.DbHistoryJobs'),
})
this.resetableNamespaces.push({
value: 'history_totals',
label: this.$t('Settings.GeneralTab.DbHistoryTotals'),
})
}
}
closeDialog() {
this.showDialog = false
}
}
</script>
@@ -0,0 +1,137 @@
<template>
<div>
<input ref="uploadBackupFile" type="file" :accept="['.json']" class="d-none" @change="uploadRestore" />
<v-btn small :loading="loadings.includes('restoreUploadButton')" class="ml-3" @click="restoreDb">
{{ $t('Settings.GeneralTab.Restore') }}
</v-btn>
<v-dialog :value="showDialog" persistent :width="360">
<panel
:title="$t('Settings.GeneralTab.Restore')"
card-class="mainsail-restore-dialog"
:margin-bottom="false"
:icon="mdiHelpCircle">
<template #buttons>
<v-btn icon tile @click="closeDialog">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-card-text>
<v-row>
<v-col>
<p class="mb-0">{{ $t('Settings.GeneralTab.RestoreDialog') }}</p>
</v-col>
</v-row>
<v-row>
<checkbox-list
:options="restoreableNamespaces"
select-all
@update:selectedCheckboxes="onSelectRestoreCheckboxes" />
</v-row>
<v-row>
<v-col class="text-center">
<v-btn color="red" :loading="loadings.includes('restoreMainsail')" @click="restoreDbAction">
{{ $t('Settings.GeneralTab.Restore') }}
</v-btn>
</v-col>
</v-row>
</v-card-text>
</panel>
</v-dialog>
</div>
</template>
<script lang="ts">
import Component from 'vue-class-component'
import { Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import SettingsRow from '@/components/settings/SettingsRow.vue'
import Panel from '@/components/ui/Panel.vue'
import { mdiCloseThick, mdiHelpCircle } from '@mdi/js'
import CheckboxList from '@/components/inputs/CheckboxList.vue'
import { TranslateResult } from 'vue-i18n'
import SettingsGeneralDatabase from '@/components/mixins/settingsGeneralDatabase'
import SettingsGeneralTabBackupDatabase from '@/components/settings/General/GeneralBackup.vue'
import Vue from 'vue'
@Component({
components: { SettingsGeneralTabBackupDatabase, Panel, SettingsRow, CheckboxList },
})
export default class SettingsGeneralTabRestoreDatabase extends Mixins(BaseMixin, SettingsGeneralDatabase) {
mdiHelpCircle = mdiHelpCircle
mdiCloseThick = mdiCloseThick
declare $refs: {
uploadBackupFile: HTMLInputElement
}
showDialog = false
restoreableNamespaces: { value: string; label: string | TranslateResult }[] = []
restoreCheckboxes: string[] = []
restoreObjects: any = {}
onSelectRestoreCheckboxes(backupCheckboxes: string[]) {
this.restoreCheckboxes = backupCheckboxes
}
async restoreDb() {
this.$refs?.uploadBackupFile?.click()
}
uploadRestore() {
if ((this.$refs.uploadBackupFile.files?.length ?? 0) === 0) {
window.console.error('No json uploaded')
return
}
// get file
// @ts-ignore
const backup = this.$refs?.uploadBackupFile?.files[0]
const reader = new FileReader()
reader.readAsText(backup, 'UTF-8')
reader.onload = (evt) => {
this.restoreableNamespaces = []
try {
this.restoreObjects = JSON.parse(evt?.target?.result + '')
const keys = Object.keys(this.restoreObjects)
this.restoreableNamespaces = keys.map((key) => {
const namespace = this.availableKeys.find((namespace) => namespace.value === key)
if (namespace) return namespace
return { value: key, label: key }
})
// sort restoreableNamespaces
this.restoreableNamespaces = this.restoreableNamespaces.sort(this.sortNamespaces)
this.openDialog()
} catch (e) {
Vue.$toast.error(this.$t('Settings.GeneralTab.CannotReadJson').toString())
}
}
reader.onerror = (evt) => {
window.console.error(evt)
}
// empty input file field
this.$refs.uploadBackupFile.value = ''
}
openDialog() {
this.showDialog = true
}
closeDialog() {
this.showDialog = false
}
restoreDbAction() {
this.$store.dispatch('socket/addLoading', 'restoreDbAction')
this.$store.dispatch('gui/restoreMoonrakerDB', {
dbCheckboxes: this.restoreCheckboxes,
restoreObjects: this.restoreObjects,
})
}
}
</script>
@@ -0,0 +1,56 @@
<template>
<settings-row :title="preset.name" :sub-title="subTitle">
<v-btn small outlined class="ml-3" @click="editPreset">
<v-icon left small>{{ mdiPencil }}</v-icon>
{{ $t('Settings.Edit') }}
</v-btn>
<v-btn small outlined class="ml-3 minwidth-0 px-2" color="error" @click="deletePreset">
<v-icon small>{{ mdiDelete }}</v-icon>
</v-btn>
</settings-row>
</template>
<script lang="ts">
import { Component, Mixins, Prop } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import SettingsRow from '@/components/settings/SettingsRow.vue'
import { GuiPresetsStatePreset } from '@/store/gui/presets/types'
import { convertName } from '@/plugins/helpers'
import { mdiDelete, mdiPencil } from '@mdi/js'
@Component({
components: { SettingsRow },
})
export default class PresetsEntry extends Mixins(BaseMixin) {
mdiPencil = mdiPencil
mdiDelete = mdiDelete
@Prop({ required: true }) readonly preset!: GuiPresetsStatePreset
get subTitle() {
let output: string[] = []
Object.keys(this.preset.values).forEach((key: string) => {
const values = this.preset.values[key]
if (values.bool) {
const name = key.indexOf(' ') ? key.slice(key.indexOf(' ') + 1) : key
output.push(convertName(name) + ': ' + values.value + '°C')
}
})
if (this.preset.gcode) output.push(this.$t('Settings.PresetsTab.CustomGCode').toString())
return output.join(', ')
}
editPreset() {
this.$emit('edit', this.preset)
}
deletePreset() {
this.$store.dispatch('gui/presets/delete', this.preset.id)
}
}
</script>
@@ -0,0 +1,26 @@
<template>
<settings-row :title="$t('Settings.PresetsTab.Cooldown')">
<v-btn small outlined class="ml-3" @click="editCooldown">
<v-icon left small>{{ mdiPencil }}</v-icon>
{{ $t('Settings.Edit') }}
</v-btn>
</settings-row>
</template>
<script lang="ts">
import { Component, Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import SettingsRow from '@/components/settings/SettingsRow.vue'
import { mdiPencil } from '@mdi/js'
@Component({
components: { SettingsRow },
})
export default class PresetsEntryCooldown extends Mixins(BaseMixin) {
mdiPencil = mdiPencil
editCooldown() {
this.$emit('edit')
}
}
</script>
@@ -0,0 +1,182 @@
<template>
<v-card flat>
<v-form v-model="valid" @submit.prevent="savePreset">
<v-card-title>{{ title }}</v-card-title>
<v-card-text>
<v-row v-if="boolInvalidMin" class="mt-3">
<v-col class="py-0">
<v-alert dense text type="error">{{ $t('Settings.PresetsTab.PresetInfo') }}</v-alert>
</v-col>
</v-row>
<settings-row :title="$t('Settings.PresetsTab.Name')">
<v-text-field
v-model="preset.name"
:placeholder="$t('Settings.PresetsTab.PresetNamePlaceholder')"
hide-details="auto"
:rules="[rules.required, rules.unique]"
dense
outlined />
</settings-row>
<div v-for="(value, key) of preset.values" :key="key">
<v-divider class="my-2" />
<settings-row :title="converNameObject(key)">
<v-checkbox v-model="value.bool" hide-details class="shrink mt-0" />
<v-text-field
v-model="value.value"
hide-details="auto"
:rules="[rules.invalid]"
type="number"
suffix="°C"
dense
outlined
hide-spin-buttons
@focus="$event.target.select()" />
</settings-row>
</div>
<v-divider class="my-2" />
<settings-row :title="$t('Settings.PresetsTab.CustomGCode')">
<v-textarea v-model="preset.gcode" outlined hide-details />
</settings-row>
</v-card-text>
<v-card-actions class="d-flex justify-end">
<v-btn text @click="closeForm">
{{ $t('Settings.Cancel') }}
</v-btn>
<v-btn color="primary" text type="submit" :disabled="!valid">
{{ storeButtonText }}
</v-btn>
</v-card-actions>
</v-form>
</v-card>
</template>
<script lang="ts">
import { Component, Mixins, Prop } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import SettingsRow from '@/components/settings/SettingsRow.vue'
import { GuiPresetsStatePreset } from '@/store/gui/presets/types'
import { convertName } from '@/plugins/helpers'
import { mdiDelete, mdiPencil } from '@mdi/js'
@Component({
components: { SettingsRow },
})
export default class PresetsForm extends Mixins(BaseMixin) {
mdiPencil = mdiPencil
mdiDelete = mdiDelete
@Prop({ required: true }) readonly preset!: GuiPresetsStatePreset
valid = false
boolInvalidMin = false
private rules = {
required: (value: string) => value !== '' || this.$t('Settings.PresetsTab.ErrorNameRequired'),
unique: (value: string) => !this.existsPresetName(value) || this.$t('Settings.PresetsTab.ErrorNameNotUnique'),
invalid: (value: string) => parseFloat(value) >= 0 || this.$t('Settings.PresetsTab.ErrorInvalidValue'),
}
get title() {
if (this.preset.id === null) return this.$t('Settings.PresetsTab.CreateHeadline')
return this.$t('Settings.PresetsTab.EditHeadline')
}
get storeButtonText() {
if (this.preset.id === null) return this.$t('Settings.PresetsTab.StoreButton')
return this.$t('Settings.PresetsTab.UpdateButton')
}
get presets() {
return this.$store.getters['gui/presets/getPresets'] ?? []
}
get available_heaters() {
return (this.$store.state.printer?.heaters?.available_heaters ?? []).sort()
}
get available_temperature_fans() {
return (this.$store.state.printer?.heaters?.available_sensors ?? [])
.filter((name: string) => name.startsWith('temperature_fan '))
.sort()
}
mounted() {
const presetValues = Object.keys(this.preset.values)
// add missing heaters to preset
this.available_heaters
.filter((name: string) => !presetValues.includes(name))
.forEach((name: string) => {
this.preset.values[name] = {
bool: false,
type: 'heater',
value: 0,
}
})
// add missing temperature_fans to preset
this.available_temperature_fans
.filter((name: string) => !presetValues.includes(name))
.forEach((name: string) => {
this.preset.values[name] = {
bool: false,
type: 'temperature_fan',
value: 0,
}
})
// remove unused values from preset
presetValues
.filter(
(name: string) =>
!this.available_heaters.includes(name) && !this.available_temperature_fans.includes(name)
)
.forEach((name) => {
delete this.preset.values[name]
})
}
existsPresetName(name: string) {
return (
this.presets.findIndex(
(preset: GuiPresetsStatePreset) => preset.name === name && preset.id !== this.preset.id
) !== -1
)
}
converNameObject(name: string) {
return convertName(name.replace('temperature_fan ', ''))
}
closeForm() {
this.$emit('close')
}
savePreset() {
let setValues = 0
for (const key of Object.keys(this.preset.values)) {
if (this.preset.values[key].bool) setValues++
}
if (this.preset.gcode.length) setValues++
// stop here, when no values are set
if (setValues === 0) {
this.boolInvalidMin = true
return
}
// create new preset, if id === null
if (this.preset.id === null) {
this.$store.dispatch('gui/presets/store', { values: this.preset })
this.closeForm()
return
}
// update existing preset
this.$store.dispatch('gui/presets/update', { id: this.preset.id, values: this.preset })
this.closeForm()
}
}
</script>
@@ -0,0 +1,52 @@
<template>
<v-card flat>
<v-form @submit.prevent="saveCooldown">
<v-card-title>{{ $t('Settings.PresetsTab.EditCooldown') }}</v-card-title>
<v-card-text>
<settings-row :title="$t('Settings.PresetsTab.CustomGCode')">
<v-textarea v-model="gcode" outlined hide-details />
</settings-row>
</v-card-text>
<v-card-actions class="d-flex justify-end">
<v-btn text @click="closeForm">
{{ $t('Settings.Cancel') }}
</v-btn>
<v-btn color="primary" text type="submit">
{{ $t('Settings.PresetsTab.UpdateCooldown') }}
</v-btn>
</v-card-actions>
</v-form>
</v-card>
</template>
<script lang="ts">
import { Component, Mixins, Prop } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import SettingsRow from '@/components/settings/SettingsRow.vue'
import { mdiDelete, mdiPencil } from '@mdi/js'
@Component({
components: { SettingsRow },
})
export default class PresetsFormCooldown extends Mixins(BaseMixin) {
mdiPencil = mdiPencil
mdiDelete = mdiDelete
@Prop({ required: true }) readonly inputGcode!: string
gcode = ''
mounted() {
this.gcode = this.inputGcode
}
closeForm() {
this.$emit('close')
}
saveCooldown() {
this.$store.dispatch('gui/presets/saveSetting', { name: 'cooldownGcode', value: this.gcode })
this.closeForm()
}
}
</script>
@@ -35,6 +35,12 @@
</settings-row>
<v-divider class="my-2"></v-divider>
</template>
<settings-row
:title="$t('Settings.ControlTab.HideDuringPrint').toString()"
:dynamic-slot-width="true">
<v-switch v-model="hideDuringPrint" hide-details class="mt-0"></v-switch>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row
:title="$t('Settings.ControlTab.EnableXYHoming').toString()"
:dynamic-slot-width="true">
@@ -336,6 +342,14 @@ export default class SettingsControlTab extends Mixins(BaseMixin, ControlMixin)
this.$store.dispatch('gui/saveSetting', { name: 'control.style', value: newVal })
}
get hideDuringPrint(): Boolean {
return this.$store.state.gui.control.hideDuringPrint ?? false
}
set hideDuringPrint(newVal) {
this.$store.dispatch('gui/saveSetting', { name: 'control.hideDuringPrint', value: newVal })
}
get actionOptions() {
let actions = [
{
+7 -38
View File
@@ -6,25 +6,23 @@
:title="$t('Settings.EditorTab.UseEscToClose')"
:sub-title="$t('Settings.EditorTab.UseEscToCloseDescription')"
:dynamic-slot-width="true">
<v-switch v-model="escToClose" hide-details class="mt-0"></v-switch>
<v-switch v-model="escToClose" hide-details class="mt-0" />
</settings-row>
<v-divider class="my-2"></v-divider>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.EditorTab.ConfirmUnsavedChanges')"
:sub-title="$t('Settings.EditorTab.ConfirmUnsavedChangesDescription')"
:dynamic-slot-width="true">
<v-switch v-model="confirmUnsavedChanges" hide-details class="mt-0"></v-switch>
<v-switch v-model="confirmUnsavedChanges" hide-details class="mt-0" />
</settings-row>
<v-divider class="my-2"></v-divider>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.EditorTab.TabSize')"
:sub-title="$t('Settings.EditorTab.TabSizeDescription')"
:dynamic-slot-width="true">
<v-select v-model="tabSize" :items="tabSizes" hide-details outlined dense attached></v-select>
<v-select v-model="tabSize" :items="tabSizes" hide-details outlined dense attached />
</settings-row>
<v-divider class="my-2"></v-divider>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.EditorTab.KlipperRestartMethod')"
:sub-title="$t('Settings.EditorTab.KlipperRestartMethodDescription')">
@@ -34,23 +32,8 @@
hide-details
outlined
dense
attached></v-select>
attached />
</settings-row>
<v-divider class="my-2"></v-divider>
<template v-if="availableMoonrakerInstances.length > 1">
<settings-row
:title="$t('Settings.EditorTab.MoonrakerRestartInstance')"
:sub-title="$t('Settings.EditorTab.MoonrakerRestartInstanceDescription')">
<v-select
v-model="moonrakerRestartInstance"
:items="availableMoonrakerInstances"
hide-details
outlined
dense
attached></v-select>
</settings-row>
<v-divider class="my-2"></v-divider>
</template>
</v-card-text>
</v-card>
</div>
@@ -115,19 +98,5 @@ export default class SettingsEditorTab extends Mixins(BaseMixin) {
set klipperRestartMethod(newVal) {
this.$store.dispatch('gui/saveSetting', { name: 'editor.klipperRestartMethod', value: newVal })
}
get moonrakerRestartInstance() {
return this.$store.state.gui.editor.moonrakerRestartInstance
}
set moonrakerRestartInstance(newVal) {
this.$store.dispatch('gui/saveSetting', { name: 'editor.moonrakerRestartInstance', value: newVal })
}
get availableMoonrakerInstances() {
const available_instances = this.$store.state.server.system_info?.available_services ?? []
return available_instances.filter((name: string) => name.startsWith('moonraker')).sort()
}
}
</script>
+23 -414
View File
@@ -7,33 +7,21 @@
</settings-row>
<v-divider class="my-2" />
<settings-row :title="$t('Settings.GeneralTab.Language')">
<v-select
v-model="currentLanguage"
:items="availableLanguages"
hide-details
outlined
dense
attach />
<v-select v-model="currentLanguage" :items="availableLanguages" hide-details outlined dense />
</settings-row>
<v-divider class="my-2" />
<settings-row :title="$t('Settings.GeneralTab.DateFormat')">
<v-select v-model="dateFormat" :items="dateFormatItems" hide-details outlined dense attach />
<v-select v-model="dateFormat" :items="dateFormatItems" hide-details outlined dense />
</settings-row>
<v-divider class="my-2" />
<settings-row :title="$t('Settings.GeneralTab.TimeFormat')">
<v-select v-model="timeFormat" :items="timeFormatItems" hide-details outlined dense attach />
<v-select v-model="timeFormat" :items="timeFormatItems" hide-details outlined dense />
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.GeneralTab.CalcPrintProgress')"
:sub-title="$t('Settings.GeneralTab.CalcPrintProgressDescription')">
<v-select
v-model="calcPrintProgress"
:items="calcPrintProgressItems"
hide-details
dense
outlined
attach />
<v-select v-model="calcPrintProgress" :items="calcPrintProgressItems" hide-details dense outlined />
</settings-row>
<v-divider class="my-2" />
<settings-row
@@ -45,189 +33,25 @@
multiple
hide-details
dense
outlined
attach />
outlined />
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.GeneralTab.CalcEtaTime')"
:sub-title="$t('Settings.GeneralTab.CalcEtaTimeDescription')">
<v-select
v-model="calcEtaTime"
:items="calcEtaTimeItems"
multiple
hide-details
dense
outlined
attach />
<v-select v-model="calcEtaTime" :items="calcEtaTimeItems" multiple hide-details dense outlined />
</settings-row>
<v-divider class="my-2" />
<settings-row :title="$t('Settings.GeneralTab.MainsailSettingsMoonrakerDb')" :dynamic-slot-width="true">
<input
ref="uploadBackupFile"
type="file"
:accept="['.json']"
class="d-none"
@change="uploadRestore" />
<v-btn :loading="loadings.includes('backupDbButton')" small @click="backupDb">
{{ $t('Settings.GeneralTab.Backup') }}
</v-btn>
<v-btn small :loading="loadings.includes('restoreUploadButton')" class="ml-3" @click="restoreDb">
{{ $t('Settings.GeneralTab.Restore') }}
</v-btn>
<settings-general-tab-backup-database />
<settings-general-tab-restore-database />
</settings-row>
<v-divider class="my-2" />
<settings-row :title="$t('Settings.GeneralTab.FactoryReset')" :dynamic-slot-width="true">
<v-btn color="error" small @click="resetMainsail">
{{ $t('Settings.GeneralTab.FactoryReset') }}
</v-btn>
<settings-general-tab-reset-database />
</settings-row>
</v-card-text>
</v-card>
<v-dialog v-model="dialogBackupMainsail" persistent :width="360">
<panel
:title="$t('Settings.GeneralTab.Backup')"
card-class="mainsail-backup-dialog"
:margin-bottom="false"
:icon="mdiHelpCircle">
<template #buttons>
<v-btn icon tile @click="dialogBackupMainsail = false">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-card-text>
<v-row>
<v-col>
<p class="mb-0">{{ $t('Settings.GeneralTab.BackupDialog') }}</p>
</v-col>
</v-row>
<v-row>
<v-col class="pl-6">
<template v-for="db in mainsailKeys">
<v-checkbox
:key="db.name"
:label="db.label"
hide-details
class="mt-0"
@change="changeNamespace(db.name)" />
</template>
<v-checkbox
v-if="availableNamespaces.includes('timelapse')"
:label="$t('Settings.GeneralTab.DbTimelapseSettings')"
hide-details
class="mt-0"
@change="changeNamespace('timelapse')" />
</v-col>
</v-row>
<v-row>
<v-col class="text-center">
<v-btn color="red" :loading="loadings.includes('backupMainsail')" @click="backupMainsail">
{{ $t('Settings.GeneralTab.Backup') }}
</v-btn>
</v-col>
</v-row>
</v-card-text>
</panel>
</v-dialog>
<v-dialog v-model="dialogResetMainsail" persistent :width="360">
<panel
:title="$t('Settings.GeneralTab.FactoryReset')"
card-class="factory-reset-dialog"
:margin-bottom="false"
:icon="mdiHelpCircle">
<template #buttons>
<v-btn icon tile @click="dialogResetMainsail = false">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-card-text>
<v-row>
<v-col>
<p class="mb-0">{{ $t('Settings.GeneralTab.FactoryDialog') }}</p>
</v-col>
</v-row>
<v-row>
<v-col class="pl-6">
<template v-for="db in mainsailKeys">
<v-checkbox
:key="db.name"
:label="db.label"
hide-details
class="mt-0"
@change="changeNamespace(db.name)" />
</template>
<v-checkbox
v-if="availableNamespaces.includes('timelapse')"
:label="$t('Settings.GeneralTab.DbTimelapseSettings')"
hide-details
class="mt-0"
@change="changeNamespace('timelapse')" />
<v-checkbox
v-if="moonrakerComponents.includes('history')"
:label="$t('Settings.GeneralTab.DbHistoryJobs')"
hide-details
class="mt-0"
@change="changeNamespace('history_jobs')" />
<v-checkbox
v-if="moonrakerComponents.includes('history')"
:label="$t('Settings.GeneralTab.DbHistoryTotals')"
hide-details
class="mt-0"
@change="changeNamespace('history_totals')" />
</v-col>
</v-row>
<v-row>
<v-col class="text-center">
<v-btn
color="red"
:loading="loadings.includes('resetMainsail')"
@click="resetMainsailAction">
{{ $t('Settings.GeneralTab.Reset') }}
</v-btn>
</v-col>
</v-row>
</v-card-text>
</panel>
</v-dialog>
<v-dialog v-model="dialogRestoreMainsail" persistent :width="360">
<panel
:title="$t('Settings.GeneralTab.Restore')"
card-class="factory-reset-dialog"
:margin-bottom="false"
:icon="mdiHelpCircle">
<template #buttons>
<v-btn icon tile @click="dialogRestoreMainsail = false">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-card-text>
<v-row>
<v-col>
<p class="mb-0">{{ $t('Settings.GeneralTab.RestoreDialog') }}</p>
</v-col>
</v-row>
<v-row>
<v-col class="pl-6">
<template v-for="db in restoreableNamespaces">
<v-checkbox
:key="db.name"
:label="db.label"
hide-details
class="mt-0"
@change="changeNamespace(db.name)" />
</template>
</v-col>
</v-row>
<v-row>
<v-col class="text-center">
<v-btn color="red" :loading="loadings.includes('restoreMainsail')" @click="restoreDbAction">
{{ $t('Settings.GeneralTab.Restore') }}
</v-btn>
</v-col>
</v-row>
</v-card-text>
</panel>
</v-dialog>
</div>
</template>
@@ -237,93 +61,27 @@ import { Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import SettingsRow from '@/components/settings/SettingsRow.vue'
import Panel from '@/components/ui/Panel.vue'
import Vue from 'vue'
import { mdiCloseThick, mdiHelpCircle } from '@mdi/js'
import CheckboxList from '@/components/inputs/CheckboxList.vue'
import SettingsGeneralTabBackupDatabase from '@/components/settings/General/GeneralBackup.vue'
import SettingsGeneralTabRestoreDatabase from '@/components/settings/General/GeneralRestore.vue'
import SettingsGeneralTabResetDatabase from '@/components/settings/General/GeneralReset.vue'
import SettingsGeneralDatabase from '@/components/mixins/settingsGeneralDatabase'
@Component({
components: { Panel, SettingsRow },
components: {
Panel,
SettingsRow,
CheckboxList,
SettingsGeneralTabBackupDatabase,
SettingsGeneralTabRestoreDatabase,
SettingsGeneralTabResetDatabase,
},
})
export default class SettingsGeneralTab extends Mixins(BaseMixin) {
export default class SettingsGeneralTab extends Mixins(BaseMixin, SettingsGeneralDatabase) {
mdiHelpCircle = mdiHelpCircle
mdiCloseThick = mdiCloseThick
private dialogBackupMainsail = false
private dialogResetMainsail = false
private dialogRestoreMainsail = false
private dbCheckboxes: string[] = []
private restoreableNamespaces: { name: string; label: string }[] = []
private restoreObjects: any = {}
private mainsailKeys: { name: string; label: string }[] = []
private availableNamespaces: string[] = []
declare $refs: {
uploadBackupFile: HTMLInputElement
}
get availableKeys() {
return [
{
name: 'general',
label: this.$t('Settings.GeneralTab.General'),
},
{
name: 'console',
label: this.$t('Settings.ConsoleTab.Console'),
},
{
name: 'control',
label: this.$t('Settings.ControlTab.Control'),
},
{
name: 'dashboard',
label: this.$t('Settings.DashboardTab.Dashboard'),
},
{
name: 'editor',
label: this.$t('Settings.EditorTab.Editor'),
},
{
name: 'gcodeViewer',
label: this.$t('Settings.GCodeViewerTab.GCodeViewer'),
},
{
name: 'gcodehistory',
label: this.$t('Settings.GeneralTab.DbConsoleHistory'),
},
{
name: 'macros',
label: this.$t('Settings.MacrosTab.Macros'),
},
{
name: 'notifications',
label: this.$t('App.Notifications.Notifications'),
},
{
name: 'presets',
label: this.$t('Settings.PresetsTab.PreheatPresets'),
},
{
name: 'remoteprinters',
label: this.$t('Settings.RemotePrintersTab.RemotePrinters'),
},
{
name: 'timelapse',
label: this.$t('Settings.TimelapseTab.Timelapse'),
},
{
name: 'uiSettings',
label: this.$t('Settings.UiSettingsTab.UiSettings'),
},
{
name: 'view',
label: this.$t('Settings.GeneralTab.DbView'),
},
]
}
get printerName() {
return this.$store.state.gui.general.printername
}
@@ -459,154 +217,5 @@ export default class SettingsGeneralTab extends Mixins(BaseMixin) {
set calcEtaTime(newVal) {
this.$store.dispatch('gui/saveSetting', { name: 'general.calcEtaTime', value: newVal })
}
get moonrakerDbNamespaces() {
return this.$store.state.server.dbNamespaces ?? []
}
get moonrakerComponents() {
return this.$store.state.server.components ?? []
}
async refreshNamespaces() {
this.availableNamespaces = []
const url = this.$store.getters['socket/getUrl'] + '/server/database/list'
const response = await fetch(url)
if (response) {
const objects = await response.json()
this.availableNamespaces = [...(objects.result?.namespaces || {})] ?? []
}
}
async refreshMainsailKeys() {
this.mainsailKeys = []
const url = this.$store.getters['socket/getUrl'] + '/server/database/item?namespace=mainsail'
const response = await fetch(url)
if (response) {
const objects = await response.json()
if (objects?.result?.value) {
Object.keys(objects?.result?.value).forEach((tmp: string) => {
if (tmp !== 'initVersion') {
const namespace = this.availableKeys.find((namespace) => namespace.name === tmp)
const tmpNamespace = namespace ? namespace : { name: tmp, label: tmp }
this.mainsailKeys.push(tmpNamespace)
}
})
this.mainsailKeys = this.mainsailKeys.sort((a, b) => {
if (a.name === 'general') return -1
if (b.name === '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
})
}
}
}
changeNamespace(name: string) {
if (this.dbCheckboxes.includes(name)) {
const index = this.dbCheckboxes.indexOf(name)
if (index >= 0) this.dbCheckboxes.splice(index, 1)
} else this.dbCheckboxes.push(name)
}
async resetMainsail() {
await this.refreshNamespaces()
if (this.availableNamespaces.includes('mainsail')) await this.refreshMainsailKeys()
else this.mainsailKeys = []
this.dbCheckboxes = []
this.dialogResetMainsail = true
}
async resetMainsailAction() {
await this.$store.dispatch('socket/addLoading', 'resetMainsail')
await this.$store.dispatch('gui/resetMoonrakerDB', this.dbCheckboxes)
}
async backupDb() {
await this.$store.dispatch('socket/addLoading', 'backupDbButton')
await this.refreshNamespaces()
if (this.availableNamespaces.includes('mainsail')) await this.refreshMainsailKeys()
else this.mainsailKeys = []
this.dbCheckboxes = []
this.dialogBackupMainsail = true
}
async backupMainsail() {
await this.$store.dispatch('socket/addLoading', 'backupMainsail')
await this.$store.dispatch('gui/backupMoonrakerDB', this.dbCheckboxes)
await this.$store.dispatch('socket/removeLoading', 'backupMainsail')
this.dialogBackupMainsail = false
}
async restoreDb() {
await this.$store.dispatch('socket/addLoading', 'restoreUploadButton')
this.$refs?.uploadBackupFile?.click()
}
uploadRestore() {
if (this.$refs.uploadBackupFile.files?.length) {
const backup = this.$refs.uploadBackupFile.files[0]
if (backup) {
const reader = new FileReader()
reader.readAsText(backup, 'UTF-8')
reader.onload = (evt) => {
this.restoreableNamespaces = []
try {
this.restoreObjects = JSON.parse(evt?.target?.result + '')
Object.keys(this.restoreObjects).forEach((tmp: string) => {
const namespace = this.availableKeys.find((namespace) => namespace.name === tmp)
const tmpNamespace = namespace ? namespace : { name: tmp, label: tmp }
this.restoreableNamespaces.push(tmpNamespace)
})
this.restoreableNamespaces = this.restoreableNamespaces.sort((a, b) => {
if (a.name === 'general') return -1
if (b.name === '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
})
this.dbCheckboxes = []
this.dialogRestoreMainsail = true
} catch (e) {
Vue.$toast.error(this.$t('Settings.GeneralTab.CannotReadJson') + '')
}
}
reader.onerror = (evt) => {
window.console.error(evt)
}
}
this.$refs.uploadBackupFile.value = ''
}
}
async restoreDbAction() {
this.$store.dispatch('socket/addLoading', 'restoreDbAction')
this.$store.dispatch('gui/restoreMoonrakerDB', {
dbCheckboxes: this.dbCheckboxes,
restoreObjects: this.restoreObjects,
})
}
}
</script>
+27 -294
View File
@@ -1,336 +1,69 @@
<template>
<div>
<v-card v-if="!form.bool && !cooldownForm.bool" flat>
<presets-form v-if="boolForm" :preset="formPreset" @close="boolForm = false" />
<presets-form-cooldown
v-else-if="boolFormCooldown"
:input-gcode="cooldownGcode"
@close="boolFormCooldown = false" />
<v-card v-else flat>
<v-card-text>
<h3 class="text-h5 mb-3">{{ $t('Settings.PresetsTab.PreheatPresets') }}</h3>
<div v-for="(preset, key) in presets" :key="preset.index">
<v-divider v-if="key" class="my-2"></v-divider>
<settings-row :title="preset.name" :sub-title="getSubTitle(preset)">
<v-btn small outlined class="ml-3" @click="editPreset(preset)">
<v-icon left small>{{ mdiPencil }}</v-icon>
{{ $t('Settings.Edit') }}
</v-btn>
<v-btn
small
outlined
class="ml-3 minwidth-0 px-2"
color="error"
@click="deletePreset(preset.id)">
<v-icon small>{{ mdiDelete }}</v-icon>
</v-btn>
</settings-row>
<v-divider v-if="key" class="my-2" />
<presets-entry :preset="preset" @edit="edit" />
</div>
<v-divider v-if="presets.length" class="my-2"></v-divider>
<settings-row :title="$t('Settings.PresetsTab.Cooldown').toString()">
<v-btn small outlined class="ml-3" @click="editCooldown">
<v-icon left small>{{ mdiPencil }}</v-icon>
{{ $t('Settings.Edit') }}
</v-btn>
</settings-row>
<v-divider v-if="presets.length" class="my-2" />
<presets-entry-cooldown @edit="boolFormCooldown = true" />
</v-card-text>
<v-card-actions class="d-flex justify-end">
<v-btn text color="primary" @click="createPreset">{{ $t('Settings.PresetsTab.AddPreset') }}</v-btn>
</v-card-actions>
</v-card>
<v-card v-else-if="form.bool" flat>
<v-form v-model="form.valid" @submit.prevent="savePreset">
<v-card-title>
{{
form.id === null
? $t('Settings.PresetsTab.CreateHeadline')
: $t('Settings.PresetsTab.EditHeadline')
}}
</v-card-title>
<v-card-text>
<v-row v-if="form.boolInvalidMin" class="mt-3">
<v-col class="py-0">
<v-alert dense text type="error">{{ $t('Settings.PresetsTab.PresetInfo') }}</v-alert>
</v-col>
</v-row>
<settings-row :title="$t('Settings.PresetsTab.Name').toString()">
<v-text-field
v-model="form.name"
:placeholder="$t('Settings.PresetsTab.PresetNamePlaceholder')"
hide-details="auto"
:rules="[rules.required, rules.unique]"
:append-icon="form.name !== '' ? mdiCloseCircle : {}"
dense
outlined
@click:append="form.name !== '' ? (form.name = '') : {}"></v-text-field>
</settings-row>
<div v-for="heater of heaters" :key="heater.name">
<v-divider class="my-2"></v-divider>
<settings-row :title="convertName(heater.name)">
<v-checkbox
v-model="form.values[heater.name].bool"
hide-details
class="shrink mt-0"></v-checkbox>
<v-text-field
v-model="form.values[heater.name].value"
hide-details="auto"
:rules="[rules.invalid]"
type="number"
suffix="°C"
dense
outlined
hide-spin-buttons
@focus="$event.target.select()"></v-text-field>
</settings-row>
</div>
<div v-for="fan of temperatureFans" :key="'temperature_fan ' + fan.name">
<v-divider class="my-2"></v-divider>
<settings-row :title="convertName(fan.name)">
<v-checkbox
v-model="form.values['temperature_fan ' + fan.name].bool"
hide-details
class="shrink mt-0"></v-checkbox>
<v-text-field
v-model="form.values['temperature_fan ' + fan.name].value"
hide-details="auto"
:rules="[rules.invalid]"
type="number"
suffix="°C"
dense
outlined
hide-spin-buttons
@focus="$event.target.select()"></v-text-field>
</settings-row>
</div>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.PresetsTab.CustomGCode').toString()">
<v-textarea v-model="form.gcode" outlined hide-details></v-textarea>
</settings-row>
</v-card-text>
<v-card-actions class="d-flex justify-end">
<v-btn text @click="form.bool = false">
{{ $t('Settings.Cancel') }}
</v-btn>
<v-btn color="primary" text type="submit" :disabled="!form.valid">
{{
form.id === null
? $t('Settings.PresetsTab.StoreButton')
: $t('Settings.PresetsTab.UpdateButton')
}}
</v-btn>
</v-card-actions>
</v-form>
</v-card>
<v-card v-else-if="cooldownForm.bool" flat>
<v-form v-model="cooldownForm.valid" @submit.prevent="saveCooldown">
<v-card-title>{{ $t('Settings.PresetsTab.EditCooldown') }}</v-card-title>
<v-card-text>
<settings-row :title="$t('Settings.PresetsTab.CustomGCode').toString()">
<v-textarea v-model="cooldownForm.gcode" outlined hide-details></v-textarea>
</settings-row>
</v-card-text>
<v-card-actions class="d-flex justify-end">
<v-btn text @click="cooldownForm.bool = false">
{{ $t('Settings.Cancel') }}
</v-btn>
<v-btn color="primary" text type="submit">
{{ $t('Settings.PresetsTab.UpdateCooldown') }}
</v-btn>
</v-card-actions>
</v-form>
</v-card>
</div>
</template>
<script lang="ts">
import { convertName } from '@/plugins/helpers'
import { Component, Mixins } from 'vue-property-decorator'
import BaseMixin from '../mixins/base'
import SettingsRow from '@/components/settings/SettingsRow.vue'
import { GuiPresetsStatePreset } from '@/store/gui/presets/types'
import { mdiDelete, mdiPencil, mdiCloseCircle } from '@mdi/js'
interface presetForm {
bool: boolean
valid: boolean
name: string
gcode: string
id: string | null
boolInvalidMin: boolean
values: {
[key: string]: {
bool: boolean
value: number
type: 'heater' | 'temperature_fan'
}
}
}
import { mdiDelete, mdiPencil } from '@mdi/js'
import PresetsEntry from '@/components/settings/Presets/PresetsEntry.vue'
import PresetsEntryCooldown from '@/components/settings/Presets/PresetsEntryCooldown.vue'
import PresetsForm from '@/components/settings/Presets/PresetsForm.vue'
@Component({
components: { SettingsRow },
components: { PresetsForm, PresetsEntryCooldown, PresetsEntry, SettingsRow },
})
export default class SettingsPresetsTab extends Mixins(BaseMixin) {
mdiPencil = mdiPencil
mdiDelete = mdiDelete
mdiCloseCircle = mdiCloseCircle
convertName = convertName
boolForm = false
boolFormCooldown = false
private form: presetForm = {
bool: false,
valid: false,
name: '',
gcode: '',
id: null,
boolInvalidMin: false,
values: {},
}
private cooldownForm = {
bool: false,
valid: false,
gcode: '',
}
private rules = {
required: (value: string) => value !== '' || this.$t('Settings.PresetsTab.ErrorNameRequired'),
unique: (value: string) => !this.existsPresetName(value) || this.$t('Settings.PresetsTab.ErrorNameNotUnique'),
invalid: (value: string) => parseFloat(value) >= 0 || this.$t('Settings.PresetsTab.ErrorInvalidValue'),
}
formPreset: GuiPresetsStatePreset = {} as GuiPresetsStatePreset
get presets() {
return this.$store.getters['gui/presets/getPresets'] ?? []
}
get heaters() {
return this.$store.getters['printer/getHeaters'] ?? []
}
get temperatureFans() {
return this.$store.getters['printer/getTemperatureFans'] ?? []
}
get cooldownGcode() {
return this.$store.getters['gui/presets/getCooldownGcode']
}
existsPresetName(name: string) {
return (
this.presets.findIndex(
(preset: GuiPresetsStatePreset) => preset.name === name && preset.id !== this.form.id
) !== -1
)
}
getSubTitle(preset: GuiPresetsStatePreset) {
let output: string[] = []
Object.keys(preset.values).forEach((key: string) => {
const values = preset.values[key]
if (values.bool) {
const name = key.indexOf(' ') ? key.slice(key.indexOf(' ') + 1) : key
output.push(this.convertName(name) + ': ' + values.value + '°C')
}
})
if (preset.gcode) output.push(this.$t('Settings.PresetsTab.CustomGCode').toString())
return output.join(', ')
}
createPreset() {
this.clearForm()
this.form.bool = true
this.formPreset.id = null
this.formPreset.name = ''
this.formPreset.values = {}
this.formPreset.gcode = ''
this.boolForm = true
}
clearForm() {
this.form.bool = false
this.form.id = null
this.form.name = ''
this.form.gcode = ''
this.form.boolInvalidMin = false
this.form.values = {}
for (const heater of this.heaters) {
this.form.values[heater.name] = {
bool: true,
value: 0,
type: 'heater',
}
}
for (const fan of this.temperatureFans) {
this.form.values['temperature_fan ' + fan.name] = {
bool: true,
value: 0,
type: 'temperature_fan',
}
}
}
editPreset(preset: GuiPresetsStatePreset) {
this.form.name = preset.name
this.form.id = preset.id ?? null
this.form.gcode = preset.gcode
this.form.values = {}
for (const heater of this.heaters) {
if (heater.name in preset.values) this.form.values[heater.name] = { ...preset.values[heater.name] }
else
this.form.values[heater.name] = {
bool: false,
value: 0,
type: 'heater',
}
}
for (const fan of this.temperatureFans) {
if ('temperature_fan ' + fan.name in preset.values)
this.form.values['temperature_fan ' + fan.name] = { ...preset.values['temperature_fan ' + fan.name] }
else
this.form.values['temperature_fan ' + fan.name] = {
bool: false,
value: 0,
type: 'temperature_fan',
}
}
this.form.bool = true
}
savePreset() {
let setValues = 0
for (const key of Object.keys(this.form.values)) {
if (this.form.values[key].bool) setValues++
}
if (this.form.gcode.length) setValues++
if (setValues === 0) this.form.boolInvalidMin = true
else if (this.form.valid) {
const preset: GuiPresetsStatePreset = {
name: this.form.name,
gcode: this.form.gcode,
values: this.form.values,
}
if (this.form.id !== null) {
this.$store.dispatch('gui/presets/update', { id: this.form.id, values: preset })
} else this.$store.dispatch('gui/presets/store', { values: preset })
this.clearForm()
}
}
editCooldown() {
this.cooldownForm.gcode = this.cooldownGcode
this.cooldownForm.bool = true
}
saveCooldown() {
if (this.cooldownForm.valid) {
this.$store.dispatch('gui/presets/saveSetting', { name: 'cooldownGcode', value: this.cooldownForm.gcode })
this.cooldownForm.bool = false
}
}
deletePreset(id: string) {
this.$store.dispatch('gui/presets/delete', id)
edit(preset: GuiPresetsStatePreset) {
this.formPreset = { ...preset }
this.boolForm = true
}
}
</script>
+5 -4
View File
@@ -3,7 +3,7 @@
<v-col :class="firstColClasses">
<v-row class="d-flex flex-row">
<v-col v-if="loading" class="col-auto d-flex justify-center align-center pr-0">
<v-progress-circular indeterminate color="primary" :size="24"></v-progress-circular>
<v-progress-circular indeterminate color="primary" :size="24" />
</v-col>
<v-col v-else-if="icon" class="col-auto d-flex justify-center align-center pr-0">
<v-icon>{{ icon }}</v-icon>
@@ -15,7 +15,7 @@
</v-row>
</v-col>
<v-col :class="secondColClasses">
<slot></slot>
<slot />
</v-col>
</v-row>
</template>
@@ -23,6 +23,7 @@
<script lang="ts">
import { Component, Mixins, Prop } from 'vue-property-decorator'
import BaseMixin from '../mixins/base'
import { TranslateResult } from 'vue-i18n'
@Component
export default class SettingsRow extends Mixins(BaseMixin) {
@@ -33,10 +34,10 @@ export default class SettingsRow extends Mixins(BaseMixin) {
declare readonly icon: string
@Prop({ required: true })
declare readonly title: string
declare readonly title: string | TranslateResult
@Prop({ required: false })
declare readonly subTitle: string
declare readonly subTitle: string | TranslateResult
@Prop({ required: false, default: false })
declare readonly dynamicSlotWidth: boolean
@@ -4,8 +4,8 @@
<v-card-text>
<h3 class="text-h5 mb-3">{{ $t('Settings.TimelapseTab.General') }}</h3>
<settings-row
:title="$t('Settings.TimelapseTab.Enabled').toString()"
:sub-title="$t('Settings.TimelapseTab.EnabledDescription').toString()"
:title="$t('Settings.TimelapseTab.Enabled')"
:sub-title="$t('Settings.TimelapseTab.EnabledDescription')"
:dynamic-slot-width="true">
<v-switch
v-model="enabled"
@@ -15,8 +15,8 @@
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.Autorender').toString()"
:sub-title="$t('Settings.TimelapseTab.AutorenderDescription').toString()"
:title="$t('Settings.TimelapseTab.Autorender')"
:sub-title="$t('Settings.TimelapseTab.AutorenderDescription')"
:dynamic-slot-width="true">
<v-switch
v-model="autorender"
@@ -26,8 +26,8 @@
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.Camera').toString()"
:sub-title="$t('Settings.TimelapseTab.CameraDescription').toString()">
:title="$t('Settings.TimelapseTab.Camera')"
:sub-title="$t('Settings.TimelapseTab.CameraDescription')">
<v-select
v-model="camera"
:items="cameraOptions"
@@ -38,8 +38,8 @@
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.Mode').toString()"
:sub-title="$t('Settings.TimelapseTab.ModeDescription').toString()">
:title="$t('Settings.TimelapseTab.Mode')"
:sub-title="$t('Settings.TimelapseTab.ModeDescription')">
<v-select
v-model="mode"
:items="modeOptions"
@@ -51,8 +51,8 @@
<template v-if="mode === 'hyperlapse'">
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.HyperlapseCycle').toString()"
:sub-title="$t('Settings.TimelapseTab.HyperlapseCycleDescription').toString()">
:title="$t('Settings.TimelapseTab.HyperlapseCycle')"
:sub-title="$t('Settings.TimelapseTab.HyperlapseCycleDescription')">
<v-text-field
v-model="hyperlapseCycle"
type="number"
@@ -66,8 +66,8 @@
</template>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.PreviewImage').toString()"
:sub-title="$t('Settings.TimelapseTab.PreviewImageDescription').toString()"
:title="$t('Settings.TimelapseTab.PreviewImage')"
:sub-title="$t('Settings.TimelapseTab.PreviewImageDescription')"
:dynamic-slot-width="true">
<v-switch
v-model="previewimage"
@@ -77,8 +77,8 @@
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.SaveFrames').toString()"
:sub-title="$t('Settings.TimelapseTab.SaveFramesDescription').toString()"
:title="$t('Settings.TimelapseTab.SaveFrames')"
:sub-title="$t('Settings.TimelapseTab.SaveFramesDescription')"
:dynamic-slot-width="true">
<v-switch
v-model="saveframes"
@@ -88,8 +88,8 @@
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.StreamDelayCompensation').toString()"
:sub-title="$t('Settings.TimelapseTab.StreamDelayCompensationDescription').toString()">
:title="$t('Settings.TimelapseTab.StreamDelayCompensation')"
:sub-title="$t('Settings.TimelapseTab.StreamDelayCompensationDescription')">
<v-text-field
v-model="stream_delay_compensation"
type="number"
@@ -102,8 +102,8 @@
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.GcodeVerbose').toString()"
:sub-title="$t('Settings.TimelapseTab.GcodeVerboseDescription').toString()"
:title="$t('Settings.TimelapseTab.GcodeVerbose')"
:sub-title="$t('Settings.TimelapseTab.GcodeVerboseDescription')"
:dynamic-slot-width="true">
<v-switch
v-model="gcode_verbose"
@@ -114,8 +114,8 @@
<v-divider class="my-2" />
<h3 class="text-h5 mt-6 mb-3">{{ $t('Settings.TimelapseTab.Parkhead') }}</h3>
<settings-row
:title="$t('Settings.TimelapseTab.Parkhead').toString()"
:sub-title="$t('Settings.TimelapseTab.ParkheadDescription').toString()"
:title="$t('Settings.TimelapseTab.Parkhead')"
:sub-title="$t('Settings.TimelapseTab.ParkheadDescription')"
:dynamic-slot-width="true">
<v-switch
v-model="parkhead"
@@ -126,8 +126,8 @@
<template v-if="parkhead">
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.Parkpos').toString()"
:sub-title="$t('Settings.TimelapseTab.ParkposDescription').toString()">
:title="$t('Settings.TimelapseTab.Parkpos')"
:sub-title="$t('Settings.TimelapseTab.ParkposDescription')">
<v-select
v-model="parkpos"
:items="parkposOptions"
@@ -139,8 +139,8 @@
<template v-if="['x_only', 'custom'].includes(parkpos)">
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.PosX').toString()"
:sub-title="$t('Settings.TimelapseTab.PosXDescription').toString()">
:title="$t('Settings.TimelapseTab.PosX')"
:sub-title="$t('Settings.TimelapseTab.PosXDescription')">
<v-text-field
v-model="park_custom_pos_x"
type="number"
@@ -155,8 +155,8 @@
<template v-if="['y_only', 'custom'].includes(parkpos)">
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.PosY').toString()"
:sub-title="$t('Settings.TimelapseTab.PosYDescription').toString()">
:title="$t('Settings.TimelapseTab.PosY')"
:sub-title="$t('Settings.TimelapseTab.PosYDescription')">
<v-text-field
v-model="park_custom_pos_y"
type="number"
@@ -171,8 +171,8 @@
<template v-if="['x_only', 'y_only', 'custom'].includes(parkpos)">
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.PosDZ').toString()"
:sub-title="$t('Settings.TimelapseTab.PosDZDescription').toString()">
:title="$t('Settings.TimelapseTab.PosDZ')"
:sub-title="$t('Settings.TimelapseTab.PosDZDescription')">
<v-text-field
v-model="park_custom_pos_dz"
type="number"
@@ -186,8 +186,8 @@
</template>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.TravelSpeed').toString()"
:sub-title="$t('Settings.TimelapseTab.TravelSpeedDescription').toString()">
:title="$t('Settings.TimelapseTab.TravelSpeed')"
:sub-title="$t('Settings.TimelapseTab.TravelSpeedDescription')">
<v-text-field
v-model="park_travel_speed"
type="number"
@@ -200,8 +200,8 @@
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.FwRetract').toString()"
:sub-title="$t('Settings.TimelapseTab.FwRetractDescription').toString()"
:title="$t('Settings.TimelapseTab.FwRetract')"
:sub-title="$t('Settings.TimelapseTab.FwRetractDescription')"
:dynamic-slot-width="true">
<v-switch
v-model="fw_retract"
@@ -212,8 +212,8 @@
<template v-if="!fw_retract">
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.RetractSpeed').toString()"
:sub-title="$t('Settings.TimelapseTab.RetractSpeedDescription').toString()">
:title="$t('Settings.TimelapseTab.RetractSpeed')"
:sub-title="$t('Settings.TimelapseTab.RetractSpeedDescription')">
<v-text-field
v-model="park_retract_speed"
type="number"
@@ -226,8 +226,8 @@
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.RetractDistance').toString()"
:sub-title="$t('Settings.TimelapseTab.RetractDistanceDescription').toString()">
:title="$t('Settings.TimelapseTab.RetractDistance')"
:sub-title="$t('Settings.TimelapseTab.RetractDistanceDescription')">
<v-text-field
v-model="park_retract_distance"
type="number"
@@ -236,12 +236,12 @@
outlined
dense
:disabled="blockedsettings.includes('park_retract_distance')"
hide-spin-buttons></v-text-field>
hide-spin-buttons />
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.UnretractSpeed').toString()"
:sub-title="$t('Settings.TimelapseTab.UnretractSpeedDescription').toString()">
:title="$t('Settings.TimelapseTab.UnretractSpeed')"
:sub-title="$t('Settings.TimelapseTab.UnretractSpeedDescription')">
<v-text-field
v-model="park_extrude_speed"
type="number"
@@ -254,8 +254,8 @@
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.UnretractDistance').toString()"
:sub-title="$t('Settings.TimelapseTab.UnretractDistanceDescription').toString()">
:title="$t('Settings.TimelapseTab.UnretractDistance')"
:sub-title="$t('Settings.TimelapseTab.UnretractDistanceDescription')">
<v-text-field
v-model="park_extrude_distance"
type="number"
@@ -269,8 +269,8 @@
</template>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.ParkTime').toString()"
:sub-title="$t('Settings.TimelapseTab.ParkTimeDescription').toString()">
:title="$t('Settings.TimelapseTab.ParkTime')"
:sub-title="$t('Settings.TimelapseTab.ParkTimeDescription')">
<v-text-field
v-model="park_time"
type="number"
@@ -285,8 +285,8 @@
<v-divider class="my-2" />
<h3 class="text-h5 mt-6 mb-3">{{ $t('Settings.TimelapseTab.RenderingOptions') }}</h3>
<settings-row
:title="$t('Settings.TimelapseTab.VariableFps').toString()"
:sub-title="$t('Settings.TimelapseTab.VariableFpsDescription').toString()"
:title="$t('Settings.TimelapseTab.VariableFps')"
:sub-title="$t('Settings.TimelapseTab.VariableFpsDescription')"
:dynamic-slot-width="true">
<v-switch
v-model="variable_fps"
@@ -297,8 +297,8 @@
<template v-if="variable_fps">
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.Targetlength').toString()"
:sub-title="$t('Settings.TimelapseTab.TargetlengthDescription').toString()">
:title="$t('Settings.TimelapseTab.Targetlength')"
:sub-title="$t('Settings.TimelapseTab.TargetlengthDescription')">
<v-text-field
v-model="targetlength"
type="number"
@@ -307,12 +307,12 @@
outlined
dense
:disabled="blockedsettings.includes('targetlength')"
hide-spin-buttons></v-text-field>
hide-spin-buttons />
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.VariableFpsMin').toString()"
:sub-title="$t('Settings.TimelapseTab.VariableFpsMinDescription').toString()">
:title="$t('Settings.TimelapseTab.VariableFpsMin')"
:sub-title="$t('Settings.TimelapseTab.VariableFpsMinDescription')">
<v-text-field
v-model="variable_fps_min"
type="number"
@@ -325,8 +325,8 @@
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.VariableFpsMax').toString()"
:sub-title="$t('Settings.TimelapseTab.VariableFpsMaxDescription').toString()">
:title="$t('Settings.TimelapseTab.VariableFpsMax')"
:sub-title="$t('Settings.TimelapseTab.VariableFpsMaxDescription')">
<v-text-field
v-model="variable_fps_max"
type="number"
@@ -341,8 +341,8 @@
<template v-else>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.OutputFramerate').toString()"
:sub-title="$t('Settings.TimelapseTab.OutputFramerateDescription').toString()">
:title="$t('Settings.TimelapseTab.OutputFramerate')"
:sub-title="$t('Settings.TimelapseTab.OutputFramerateDescription')">
<v-text-field
v-model="output_framerate"
type="number"
@@ -356,8 +356,8 @@
</template>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.duplicatelastframe').toString()"
:sub-title="$t('Settings.TimelapseTab.duplicatelastframeDescription').toString()">
:title="$t('Settings.TimelapseTab.duplicatelastframe')"
:sub-title="$t('Settings.TimelapseTab.duplicatelastframeDescription')">
<v-text-field
v-model="duplicatelastframe"
type="number"
@@ -369,8 +369,8 @@
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.ConstantRateFactor').toString()"
:sub-title="$t('Settings.TimelapseTab.ConstantRateFactorDescription').toString()">
:title="$t('Settings.TimelapseTab.ConstantRateFactor')"
:sub-title="$t('Settings.TimelapseTab.ConstantRateFactorDescription')">
<v-text-field
v-model="constant_rate_factor"
type="number"
@@ -382,8 +382,8 @@
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.Pixelformat').toString()"
:sub-title="$t('Settings.TimelapseTab.PixelformatDescription').toString()">
:title="$t('Settings.TimelapseTab.Pixelformat')"
:sub-title="$t('Settings.TimelapseTab.PixelformatDescription')">
<v-text-field
v-model="pixelformat"
type="text"
@@ -394,8 +394,8 @@
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.TimeFormatCode').toString()"
:sub-title="$t('Settings.TimelapseTab.TimeFormatCodeDescription').toString()">
:title="$t('Settings.TimelapseTab.TimeFormatCode')"
:sub-title="$t('Settings.TimelapseTab.TimeFormatCodeDescription')">
<v-text-field
v-model="time_format_code"
type="text"
@@ -406,8 +406,8 @@
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.Extraoutputparams').toString()"
:sub-title="$t('Settings.TimelapseTab.ExtraoutputparamsDescription').toString()">
:title="$t('Settings.TimelapseTab.Extraoutputparams')"
:sub-title="$t('Settings.TimelapseTab.ExtraoutputparamsDescription')">
<v-text-field
v-model="extraoutputparams"
type="text"
@@ -483,11 +483,11 @@ export default class SettingsTimelapseTab extends Mixins(BaseMixin) {
const output: any = []
webcams
.filter((webcam: GuiWebcamStateWebcam) => webcam.urlSnapshot !== '')
.filter((webcam: GuiWebcamStateWebcam) => webcam.snapshot_url !== '')
.forEach((webcam: GuiWebcamStateWebcam) => {
output.push({
text: webcam.name,
value: webcam.id,
value: webcam.name,
})
})
+122 -45
View File
@@ -2,7 +2,7 @@
<div>
<v-card flat>
<v-card-text>
<settings-row :title="$t('Settings.UiSettingsTab.Logo').toString()">
<settings-row :title="$t('Settings.UiSettingsTab.Logo')">
<v-btn
v-if="logoColor.toLowerCase() !== defaultLogoColor.toLowerCase()"
small
@@ -19,11 +19,11 @@
:value="logoColor"
hide-mode-switch
mode="rgba"
@update:color="updateLogoColor"></v-color-picker>
@update:color="updateLogoColor" />
</v-menu>
</settings-row>
<v-divider class="my-2" />
<settings-row :title="$t('Settings.UiSettingsTab.Primary').toString()">
<settings-row :title="$t('Settings.UiSettingsTab.Primary')">
<v-btn
v-if="primaryColor.toLowerCase() !== defaultPrimaryColor.toLowerCase()"
small
@@ -45,8 +45,8 @@
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.UiSettingsTab.GcodeThumbnails').toString()"
:sub-title="$t('Settings.UiSettingsTab.GcodeThumbnailsDescription').toString()"
:title="$t('Settings.UiSettingsTab.GcodeThumbnails')"
:sub-title="$t('Settings.UiSettingsTab.GcodeThumbnailsDescription')"
:dynamic-slot-width="true">
<v-btn
outlined
@@ -54,27 +54,53 @@
color="primary"
href="https://docs.mainsail.xyz/overview/features/thumbnails"
target="_blank">
{{ $t('Settings.UiSettingsTab.Guide').toString() }}
{{ $t('Settings.UiSettingsTab.Guide') }}
</v-btn>
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.UiSettingsTab.BoolBigThumbnail').toString()"
:sub-title="$t('Settings.UiSettingsTab.BoolBigThumbnailDescription').toString()"
:title="$t('Settings.UiSettingsTab.BoolBigThumbnail')"
:sub-title="$t('Settings.UiSettingsTab.BoolBigThumbnailDescription')"
:dynamic-slot-width="true">
<v-switch v-model="boolBigThumbnail" hide-details class="mt-0" />
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.UiSettingsTab.DisplayCANCEL_PRINT').toString()"
:sub-title="$t('Settings.UiSettingsTab.DisplayCANCEL_PRINTDescription').toString()"
:dynamic-slot-width="true">
<v-switch v-model="displayCancelPrint" hide-details class="mt-0"></v-switch>
<settings-row :title="$t('Settings.UiSettingsTab.BigThumbnailBackground')">
<v-btn
v-if="bigThumbnailBackground.toLowerCase() !== defaultBigThumbnailBackground.toLowerCase()"
small
text
class="minwidth-0"
@click="bigThumbnailBackground = defaultBigThumbnailBackground">
<v-icon small>{{ mdiRestart }}</v-icon>
</v-btn>
<v-menu bottom left offset-y :close-on-content-click="false">
<template #activator="{ on, attrs }">
<v-btn
v-bind="attrs"
:color="bigThumbnailBackground"
class="minwidth-0 px-5"
small
v-on="on" />
</template>
<v-color-picker
:value="bigThumbnailBackground"
hide-mode-switch
mode="rgba"
@update:color="updateBigThumbnailBackground" />
</v-menu>
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.UiSettingsTab.LockSliders').toString()"
:sub-title="$t('Settings.UiSettingsTab.LockSlidersDescription').toString()"
:title="$t('Settings.UiSettingsTab.DisplayCANCEL_PRINT')"
:sub-title="$t('Settings.UiSettingsTab.DisplayCANCEL_PRINTDescription')"
:dynamic-slot-width="true">
<v-switch v-model="displayCancelPrint" hide-details class="mt-0" />
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.UiSettingsTab.LockSliders')"
:sub-title="$t('Settings.UiSettingsTab.LockSlidersDescription')"
:dynamic-slot-width="true">
<v-switch v-model="lockSliders" hide-details class="mt-0" />
</settings-row>
@@ -82,8 +108,8 @@
<v-expand-transition>
<settings-row
v-show="lockSliders"
:title="$t('Settings.UiSettingsTab.LockSlidersDelay').toString()"
:sub-title="$t('Settings.UiSettingsTab.LockSlidersDelayDescription').toString()"
:title="$t('Settings.UiSettingsTab.LockSlidersDelay')"
:sub-title="$t('Settings.UiSettingsTab.LockSlidersDelayDescription')"
:dynamic-slot-width="true">
<v-text-field
v-model="lockSlidersDelay"
@@ -104,22 +130,22 @@
</v-expand-transition>
<v-divider v-show="lockSliders" class="my-2" />
<settings-row
:title="$t('Settings.UiSettingsTab.ConfirmOnEmergencyStop').toString()"
:sub-title="$t('Settings.UiSettingsTab.ConfirmOnEmergencyStopDescription').toString()"
:title="$t('Settings.UiSettingsTab.ConfirmOnEmergencyStop')"
:sub-title="$t('Settings.UiSettingsTab.ConfirmOnEmergencyStopDescription')"
:dynamic-slot-width="true">
<v-switch v-model="confirmOnEmergencyStop" hide-details class="mt-0" />
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.UiSettingsTab.ConfirmOnPowerDeviceChange').toString()"
:sub-title="$t('Settings.UiSettingsTab.ConfirmOnPowerDeviceChangeDescription').toString()"
:title="$t('Settings.UiSettingsTab.ConfirmOnPowerDeviceChange')"
:sub-title="$t('Settings.UiSettingsTab.ConfirmOnPowerDeviceChangeDescription')"
:dynamic-slot-width="true">
<v-switch v-model="confirmOnPowerDeviceChange" hide-details class="mt-0" />
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.UiSettingsTab.NavigationStyle').toString()"
:sub-title="$t('Settings.UiSettingsTab.NavigationStyleDescription').toString()">
:title="$t('Settings.UiSettingsTab.NavigationStyle')"
:sub-title="$t('Settings.UiSettingsTab.NavigationStyleDescription')">
<v-select
v-model="navigationStyleSetting"
:items="navigationStyles"
@@ -130,15 +156,27 @@
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.UiSettingsTab.BoolHideUploadAndPrintButton').toString()"
:sub-title="$t('Settings.UiSettingsTab.BoolHideUploadAndPrintButtonDescription').toString()"
:title="$t('Settings.UiSettingsTab.DefaultNavigationState')"
:sub-title="$t('Settings.UiSettingsTab.DefaultNavigationStateDescription')">
<v-select
v-model="defaultNavigationStateSetting"
:items="defaultNavigationStateSettings"
class="mt-0"
hide-details
outlined
dense />
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.UiSettingsTab.BoolHideUploadAndPrintButton')"
:sub-title="$t('Settings.UiSettingsTab.BoolHideUploadAndPrintButtonDescription')"
:dynamic-slot-width="true">
<v-switch v-model="boolHideUploadAndPrintButton" hide-details class="mt-0" />
</settings-row>
<v-divider class="my-2"></v-divider>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.UiSettingsTab.PowerDeviceName').toString()"
:sub-title="$t('Settings.UiSettingsTab.PowerDeviceNameDescription').toString()"
:title="$t('Settings.UiSettingsTab.PowerDeviceName')"
:sub-title="$t('Settings.UiSettingsTab.PowerDeviceNameDescription')"
:dynamic-slot-width="true">
<v-select
v-model="powerDeviceName"
@@ -150,43 +188,43 @@
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.UiSettingsTab.HideSaveConfigButtonForBedMesh').toString()"
:sub-title="$t('Settings.UiSettingsTab.HideSaveConfigButtonForBedMeshDescription').toString()"
:title="$t('Settings.UiSettingsTab.HideSaveConfigButtonForBedMesh')"
:sub-title="$t('Settings.UiSettingsTab.HideSaveConfigButtonForBedMeshDescription')"
:dynamic-slot-width="true">
<v-switch v-model="hideSaveConfigForBedMash" hide-details class="mt-0" />
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.UiSettingsTab.DisableFanAnimation').toString()"
:sub-title="$t('Settings.UiSettingsTab.DisableFanAnimationDescription').toString()"
:title="$t('Settings.UiSettingsTab.DisableFanAnimation')"
:sub-title="$t('Settings.UiSettingsTab.DisableFanAnimationDescription')"
:dynamic-slot-width="true">
<v-switch v-model="disableFanAnimation" hide-details class="mt-0" />
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.UiSettingsTab.ManualProbeDialog').toString()"
:sub-title="$t('Settings.UiSettingsTab.ManualProbeDialogDescription').toString()"
:title="$t('Settings.UiSettingsTab.ManualProbeDialog')"
:sub-title="$t('Settings.UiSettingsTab.ManualProbeDialogDescription')"
:dynamic-slot-width="true">
<v-switch v-model="boolManualProbeDialog" hide-details class="mt-0" />
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.UiSettingsTab.BedScrewsDialog').toString()"
:sub-title="$t('Settings.UiSettingsTab.BedScrewsDialogDescription').toString()"
:title="$t('Settings.UiSettingsTab.BedScrewsDialog')"
:sub-title="$t('Settings.UiSettingsTab.BedScrewsDialogDescription')"
:dynamic-slot-width="true">
<v-switch v-model="boolBedScrewsDialog" hide-details class="mt-0" />
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.UiSettingsTab.ScrewsTiltAdjustDialog').toString()"
:sub-title="$t('Settings.UiSettingsTab.ScrewsTiltAdjustDialogDescription').toString()"
:title="$t('Settings.UiSettingsTab.ScrewsTiltAdjustDialog')"
:sub-title="$t('Settings.UiSettingsTab.ScrewsTiltAdjustDialogDescription')"
:dynamic-slot-width="true">
<v-switch v-model="boolScrewsTiltAdjustDialog" hide-details class="mt-0" />
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.UiSettingsTab.TempchartHeight').toString()"
:sub-title="$t('Settings.UiSettingsTab.TempchartHeightDescription').toString()">
:title="$t('Settings.UiSettingsTab.TempchartHeight')"
:sub-title="$t('Settings.UiSettingsTab.TempchartHeightDescription')">
<v-slider
v-model.lazy="tempchartHeight"
hide-details
@@ -197,8 +235,8 @@
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.UiSettingsTab.HideUpdateWarnings').toString()"
:sub-title="$t('Settings.UiSettingsTab.HideUpdateWarningsDescription').toString()"
:title="$t('Settings.UiSettingsTab.HideUpdateWarnings')"
:sub-title="$t('Settings.UiSettingsTab.HideUpdateWarningsDescription')"
:dynamic-slot-width="true">
<v-switch v-model="hideUpdateWarnings" hide-details class="mt-0" />
</settings-row>
@@ -212,7 +250,7 @@ import Component from 'vue-class-component'
import { Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import SettingsRow from '@/components/settings/SettingsRow.vue'
import { defaultLogoColor, defaultPrimaryColor } from '@/store/variables'
import { defaultLogoColor, defaultPrimaryColor, defaultBigThumbnailBackground } from '@/store/variables'
import { Debounce } from 'vue-debounce-decorator'
import { mdiRestart, mdiTimerOutline } from '@mdi/js'
import { ServerPowerStateDevice } from '@/store/server/power/types'
@@ -224,8 +262,9 @@ export default class SettingsUiSettingsTab extends Mixins(BaseMixin) {
mdiRestart = mdiRestart
mdiTimerOutline = mdiTimerOutline
private defaultLogoColor = defaultLogoColor
private defaultPrimaryColor = defaultPrimaryColor
defaultLogoColor = defaultLogoColor
defaultPrimaryColor = defaultPrimaryColor
defaultBigThumbnailBackground = defaultBigThumbnailBackground
get logoColor() {
return this.$store.state.gui.uiSettings.logo
@@ -251,6 +290,14 @@ export default class SettingsUiSettingsTab extends Mixins(BaseMixin) {
this.$store.dispatch('gui/saveSetting', { name: 'uiSettings.boolBigThumbnail', value: newVal })
}
get bigThumbnailBackground() {
return this.$store.state.gui.uiSettings.bigThumbnailBackground
}
set bigThumbnailBackground(newVal) {
this.$store.dispatch('gui/saveSetting', { name: 'uiSettings.bigThumbnailBackground', value: newVal })
}
get displayCancelPrint() {
return this.$store.state.gui.uiSettings.displayCancelPrint
}
@@ -318,6 +365,31 @@ export default class SettingsUiSettingsTab extends Mixins(BaseMixin) {
]
}
get defaultNavigationStateSetting() {
return this.$store.state.gui.uiSettings.defaultNavigationStateSetting
}
set defaultNavigationStateSetting(newVal) {
this.$store.dispatch('gui/saveSetting', { name: 'uiSettings.defaultNavigationStateSetting', value: newVal })
}
get defaultNavigationStateSettings() {
return [
{
text: this.$t('Settings.UiSettingsTab.DefaultNavigationStateAlwaysOpen'),
value: 'alwaysOpen',
},
{
text: this.$t('Settings.UiSettingsTab.DefaultNavigationStateAlwaysClosed'),
value: 'alwaysClosed',
},
{
text: this.$t('Settings.UiSettingsTab.DefaultNavigationStateLastState'),
value: 'lastState',
},
]
}
get boolHideUploadAndPrintButton() {
return this.$store.state.gui.uiSettings.boolHideUploadAndPrintButton ?? false
}
@@ -431,5 +503,10 @@ export default class SettingsUiSettingsTab extends Mixins(BaseMixin) {
updatePrimaryColor(newVal: any) {
this.primaryColor = this.clearColorObject(newVal)
}
@Debounce(500)
updateBigThumbnailBackground(newVal: any) {
this.bigThumbnailBackground = this.clearColorObject(newVal)
}
}
</script>
@@ -102,6 +102,15 @@
:label="$t('Settings.WebcamsTab.Rotate')" />
</v-col>
</v-row>
<v-row v-if="hasFpsCounter">
<v-col class="pt-1 pb-3">
<v-checkbox
v-model="hideFps"
class="mt-1"
hide-details
:label="$t('Settings.WebcamsTab.HideFps')" />
</v-col>
</v-row>
<v-row>
<v-col class="pt-1 pb-3">
<div class="v-label v-label--active theme--dark text-subtitle-1">
@@ -250,6 +259,27 @@ export default class WebcamForm extends Mixins(BaseMixin, WebcamMixin) {
return classes
}
get hasFpsCounter() {
return ['mjpegstreamer', 'mjpegstreamer-adaptive'].includes(this.webcam.service)
}
get hideFps() {
return this.webcam.extra_data?.hideFps ?? false
}
set hideFps(newVal) {
if (!('extra_data' in this.webcam)) {
this.webcam.extra_data = {
hideFps: newVal,
}
return
}
// @ts-ignore
this.webcam.extra_data.hideFps = newVal
}
mounted() {
this.oldWebcamName = this.webcam.name
}
+48
View File
@@ -0,0 +1,48 @@
<template>
<svg
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
x="0px"
y="0px"
viewBox="0 0 487.04 487.04"
xml:space="preserve"
class="cursor-pointer"
@click="clickSpool">
<g>
<circle :style="styleCircle1" cx="243.52" cy="243.52" r="232.97" />
<circle :style="styleCircle2" cx="243.52" cy="243.52" r="112.5" />
<path
:style="styleCircle3"
d="M0,243.52c0,134.42,109.1,243.52,243.52,243.52,134.42,0,243.52-109.1,243.52-243.52S377.95,0,243.52,0C109.1,0,0,109.1,0,243.52Zm115.73,181.78c-52.4-39.5-86.52-98.59-94.52-163.72v-.09c-.68-5.43,1-10.89,4.6-15,3.6-4.12,8.79-6.51,14.26-6.57l118.36-1.33c18.99-.21,36.63,9.83,46.12,26.29,9.5,16.45,9.38,36.74-.3,53.09l-60.29,101.76c-2.8,4.73-7.48,8.03-12.87,9.1-5.39,1.06-10.98-.22-15.36-3.52ZM450.22,238.8c5.49,.06,10.7,2.46,14.31,6.59,3.62,4.13,5.3,9.61,4.63,15.06-8.01,65.13-42.12,124.22-94.52,163.72l-.07,.05c-4.37,3.29-9.93,4.57-15.3,3.51-5.37-1.06-10.03-4.36-12.82-9.06l-60.33-101.84c-9.68-16.34-9.8-36.64-.3-53.09,9.5-16.45,27.13-26.5,46.12-26.29l118.27,1.33ZM338.12,40.02c5.04,2.14,8.92,6.32,10.69,11.49,1.77,5.18,1.24,10.86-1.44,15.63l-58.03,103.17c-9.31,16.56-26.83,26.8-45.83,26.8-19,0-36.51-10.25-45.83-26.8l-57.99-103.09c-2.69-4.79-3.22-10.49-1.45-15.69,1.77-5.2,5.68-9.4,10.73-11.54,60.41-25.63,128.64-25.63,189.05,0l.08,.04Z" />
</g>
</svg>
</template>
<script lang="ts">
import Component from 'vue-class-component'
import { Mixins, Prop } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
@Component({})
export default class SpoolIcon extends Mixins(BaseMixin) {
@Prop({ required: false, default: '#ff0' })
declare readonly color: string
get styleCircle1() {
return { fill: this.color }
}
get styleCircle2() {
return { fill: '#bebebe' }
}
get styleCircle3() {
return { fill: '#343434' }
}
clickSpool() {
this.$emit('click-spool')
}
}
</script>
+5 -6
View File
@@ -36,17 +36,16 @@ export default class Hlsstreamer extends Mixins(BaseMixin, WebcamMixin) {
get webcamStyle() {
const output = {
transform: 'none',
transform: this.generateTransform(
this.camSettings.flip_horizontal ?? false,
this.camSettings.flip_vertical ?? false,
this.camSettings.rotation ?? 0
),
aspectRatio: 16 / 9,
maxHeight: window.innerHeight - 155 + 'px',
maxWidth: 'auto',
}
let transforms = ''
if ('flipX' in this.camSettings && this.camSettings.flip_horizontal) transforms += ' scaleX(-1)'
if ('flipX' in this.camSettings && this.camSettings.flip_vertical) transforms += ' scaleY(-1)'
if (transforms.trimStart().length) return { transform: transforms.trimStart() }
if (this.aspectRatio) {
output.aspectRatio = this.aspectRatio
output.maxWidth = (window.innerHeight - 155) * this.aspectRatio + 'px'
+7 -6
View File
@@ -20,12 +20,13 @@ export default class Ipstreamer extends Mixins(BaseMixin, WebcamMixin) {
}
get webcamStyle() {
let transforms = ''
if ('flipX' in this.camSettings && this.camSettings.flip_horizontal) transforms += ' scaleX(-1)'
if ('flipX' in this.camSettings && this.camSettings.flip_vertical) transforms += ' scaleY(-1)'
if (transforms.trimStart().length) return { transform: transforms.trimStart() }
return ''
return {
transform: this.generateTransform(
this.camSettings.flip_horizontal ?? false,
this.camSettings.flip_vertical ?? false,
this.camSettings.rotation ?? 0
),
}
}
visibilityChanged(isVisible: boolean) {
+7 -6
View File
@@ -34,12 +34,13 @@ export default class JMuxerStreamer extends Mixins(BaseMixin, WebcamMixin) {
}
get webcamStyle() {
let transforms = ''
if ('flipX' in this.camSettings && this.camSettings.flip_horizontal) transforms += ' scaleX(-1)'
if ('flipX' in this.camSettings && this.camSettings.flip_vertical) transforms += ' scaleY(-1)'
if (transforms.trimStart().length) return { transform: transforms.trimStart() }
return ''
return {
transform: this.generateTransform(
this.camSettings.flip_horizontal ?? false,
this.camSettings.flip_vertical ?? false,
this.camSettings.rotation ?? 0
),
}
}
mounted() {
+7 -7
View File
@@ -24,9 +24,10 @@ import { JanusJs, JanusSession, JanusStreamingPlugin } from 'typed_janus_js'
import BaseMixin from '@/components/mixins/base'
import { ConstructorOptions } from 'typed_janus_js/src/interfaces/janus'
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
import WebcamMixin from '@/components/mixins/webcam'
@Component
export default class JanusStreamer extends Mixins(BaseMixin) {
export default class JanusStreamer extends Mixins(BaseMixin, WebcamMixin) {
private janusClient: JanusJs | null = null
private session: JanusSession | null = null
private handle: JanusStreamingPlugin | null = null
@@ -60,15 +61,14 @@ export default class JanusStreamer extends Mixins(BaseMixin) {
get webcamStyle() {
const output = {
transform: 'none',
transform: this.generateTransform(
this.camSettings.flip_horizontal ?? false,
this.camSettings.flip_vertical ?? false,
this.camSettings.rotation ?? 0
),
aspectRatio: 16 / 9,
}
let transforms = ''
if ('flipX' in this.camSettings && this.camSettings.flip_horizontal) transforms += ' scaleX(-1)'
if ('flipX' in this.camSettings && this.camSettings.flip_vertical) transforms += ' scaleY(-1)'
if (transforms.trimStart().length) output.transform = transforms.trimStart()
if (this.aspectRatio) output.aspectRatio = this.aspectRatio
return output
+12 -7
View File
@@ -6,7 +6,7 @@
class="webcamImage"
:style="webcamStyle"
@load="onload" />
<span v-if="showFps" class="webcamFpsOutput">{{ $t('Panels.WebcamPanel.FPS') }}: {{ fpsOutput }}</span>
<span v-if="showFpsCounter" class="webcamFpsOutput">{{ $t('Panels.WebcamPanel.FPS') }}: {{ fpsOutput }}</span>
</div>
</template>
@@ -50,17 +50,16 @@ export default class Mjpegstreamer extends Mixins(BaseMixin, WebcamMixin) {
get webcamStyle() {
const output = {
transform: 'none',
transform: this.generateTransform(
this.camSettings.flip_horizontal ?? false,
this.camSettings.flip_vertical ?? false,
this.camSettings.rotation ?? 0
),
aspectRatio: 16 / 9,
maxHeight: window.innerHeight - 155 + 'px',
maxWidth: 'auto',
}
let transforms = ''
if ('flipX' in this.camSettings && this.camSettings.flip_horizontal) transforms += ' scaleX(-1)'
if ('flipX' in this.camSettings && this.camSettings.flip_vertical) transforms += ' scaleY(-1)'
if (transforms.trimStart().length) output.transform = transforms.trimStart()
if (this.aspectRatio) {
output.aspectRatio = this.aspectRatio
output.maxWidth = (window.innerHeight - 155) * this.aspectRatio + 'px'
@@ -73,6 +72,12 @@ export default class Mjpegstreamer extends Mixins(BaseMixin, WebcamMixin) {
return this.currentFPS < 10 ? '0' + this.currentFPS.toString() : this.currentFPS
}
get showFpsCounter() {
if (!this.showFps) return false
return !(this.camSettings.extra_data?.hideFps ?? false)
}
startStream() {
if (this.streamState) return
this.streamState = true
@@ -10,7 +10,7 @@
height="400"
:style="webcamStyle"
:class="'webcamImage ' + (isLoaded ? '' : 'hiddenWebcam')"></canvas>
<span v-if="isLoaded && showFps" class="webcamFpsOutput">
<span v-if="isLoaded && showFpsCounter" class="webcamFpsOutput">
{{ $t('Panels.WebcamPanel.FPS') }}: {{ fpsOutput }}
</span>
</div>
@@ -21,9 +21,10 @@ import Component from 'vue-class-component'
import { Mixins, Prop, Watch } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
import WebcamMixin from '@/components/mixins/webcam'
@Component
export default class MjpegstreamerAdaptive extends Mixins(BaseMixin) {
export default class MjpegstreamerAdaptive extends Mixins(BaseMixin, WebcamMixin) {
private refresh = Math.ceil(Math.random() * Math.pow(10, 12))
private isVisible = true
private isVisibleDocument = true
@@ -51,18 +52,16 @@ export default class MjpegstreamerAdaptive extends Mixins(BaseMixin) {
get webcamStyle() {
const output = {
transform: 'none',
transform: this.generateTransform(
this.camSettings.flip_horizontal ?? false,
this.camSettings.flip_vertical ?? false,
this.camSettings.rotation ?? 0
),
aspectRatio: 16 / 9,
maxHeight: window.innerHeight - 155 + 'px',
maxWidth: 'auto',
}
let transforms = ''
if (this.camSettings.flip_horizontal ?? false) transforms += ' scaleX(-1)'
if (this.camSettings.flip_vertical ?? false) transforms += ' scaleY(-1)'
if ((this.camSettings.rotation ?? 0) === 180) transforms += ' rotate(180deg)'
if (transforms.trimStart().length) output.transform = transforms.trimStart()
if (this.aspectRatio) {
output.aspectRatio = this.aspectRatio
output.maxWidth = (window.innerHeight - 155) * this.aspectRatio + 'px'
@@ -75,6 +74,12 @@ export default class MjpegstreamerAdaptive extends Mixins(BaseMixin) {
return this.currentFPS < 10 ? '0' + this.currentFPS.toString() : this.currentFPS
}
get showFpsCounter() {
if (!this.showFps) return false
return !(this.camSettings.extra_data?.hideFps ?? false)
}
get rotate() {
return [90, 270].includes(this.camSettings.rotation ?? 0)
}
+5 -6
View File
@@ -35,17 +35,16 @@ export default class Uv4lMjpeg extends Mixins(BaseMixin, WebcamMixin) {
get webcamStyle() {
const output = {
transform: 'none',
transform: this.generateTransform(
this.camSettings.flip_horizontal ?? false,
this.camSettings.flip_vertical ?? false,
this.camSettings.rotation ?? 0
),
aspectRatio: 16 / 9,
maxHeight: window.innerHeight - 155 + 'px',
maxWidth: 'auto',
}
let transforms = ''
if ('flipX' in this.camSettings && this.camSettings.flip_horizontal) transforms += ' scaleX(-1)'
if ('flipX' in this.camSettings && this.camSettings.flip_vertical) transforms += ' scaleY(-1)'
if (transforms.trimStart().length) output.transform = transforms.trimStart()
if (this.aspectRatio) {
output.aspectRatio = this.aspectRatio
output.maxWidth = (window.innerHeight - 155) * this.aspectRatio + 'px'
+34 -15
View File
@@ -21,14 +21,16 @@
import { Component, Mixins, Prop, Ref, Watch } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
import WebcamMixin from '@/components/mixins/webcam'
@Component
export default class WebrtcCameraStreamer extends Mixins(BaseMixin) {
export default class WebrtcCameraStreamer extends Mixins(BaseMixin, WebcamMixin) {
private pc: RTCPeerConnection | null = null
private useStun = false
private remote_pc_id: string | null = null
private aspectRatio: null | number = null
private status: string = 'connecting'
private restartTimer: number | null = null
@Prop({ required: true }) readonly camSettings!: GuiWebcamStateWebcam
@Prop({ default: null }) declare readonly printerUrl: string | null
@@ -37,7 +39,6 @@ export default class WebrtcCameraStreamer extends Mixins(BaseMixin) {
get url() {
const baseUrl = this.camSettings.stream_url
let url = new URL(baseUrl, this.printerUrl === null ? this.hostUrl.toString() : this.printerUrl)
url.port = this.hostPort.toString()
if (baseUrl.startsWith('http') || baseUrl.startsWith('://')) url = new URL(baseUrl)
@@ -46,15 +47,14 @@ export default class WebrtcCameraStreamer extends Mixins(BaseMixin) {
get webcamStyle() {
const output = {
transform: 'none',
transform: this.generateTransform(
this.camSettings.flip_horizontal ?? false,
this.camSettings.flip_vertical ?? false,
this.camSettings.rotation ?? 0
),
aspectRatio: 16 / 9,
}
let transforms = ''
if ('flipX' in this.camSettings && this.camSettings.flip_horizontal) transforms += ' scaleX(-1)'
if ('flipX' in this.camSettings && this.camSettings.flip_vertical) transforms += ' scaleY(-1)'
if (transforms.trimStart().length) output.transform = transforms.trimStart()
if (this.aspectRatio) output.aspectRatio = this.aspectRatio
return output
@@ -99,11 +99,15 @@ export default class WebrtcCameraStreamer extends Mixins(BaseMixin) {
)
this.pc.addEventListener('connectionstatechange', () => {
this.status = (this.pc?.connectionState ?? '').toString()
// clear restartTimer if it is set
if (this.restartTimer) window.clearTimeout(this.restartTimer)
if (['failed', 'disconnected'].includes(this.status)) {
setTimeout(async () => {
await this.pc?.close()
this.startStream()
}, 500)
// set restartTimer to restart stream after 5 seconds
this.restartTimer = window.setTimeout(() => {
this.restartStream()
}, 5000)
}
})
this.pc.addEventListener('icecandidate', (e) => {
@@ -147,8 +151,16 @@ export default class WebrtcCameraStreamer extends Mixins(BaseMixin) {
if (isFirefox) this.status = 'connected'
return response.json()
})
.catch(function (e) {
.catch((e) => {
window.console.error(e)
// clear restartTimer if it is set
if (this.restartTimer) window.clearTimeout(this.restartTimer)
// set restartTimer to restart stream after 5 seconds
this.restartTimer = window.setTimeout(() => {
this.restartStream()
}, 5000)
})
}
@@ -158,12 +170,19 @@ export default class WebrtcCameraStreamer extends Mixins(BaseMixin) {
beforeDestroy() {
this.pc?.close()
if (this.restartTimer) window.clearTimeout(this.restartTimer)
}
restartStream() {
this.pc?.close()
setTimeout(async () => {
this.startStream()
}, 500)
}
@Watch('url')
async changedUrl() {
await this.pc?.close()
this.startStream()
this.restartStream()
}
}
</script>
+229 -113
View File
@@ -23,43 +23,53 @@ import BaseMixin from '@/components/mixins/base'
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
import WebcamMixin from '@/components/mixins/webcam'
interface OfferData {
iceUfrag: string
icePwd: string
medias: string[]
}
@Component
export default class WebrtcRTSPSimpleServer extends Mixins(BaseMixin, WebcamMixin) {
export default class WebrtcMediaMTX extends Mixins(BaseMixin, WebcamMixin) {
@Prop({ required: true }) readonly camSettings!: GuiWebcamStateWebcam
@Prop({ default: null }) readonly printerUrl!: string | null
@Ref() declare video: HTMLVideoElement
// webrtc player vars
private terminated: boolean = false
private ws: WebSocket | null = null
private pc: RTCPeerConnection | null = null
private restartTimeoutTimer: any = null
private restartTimeout: any = null
private status: string = 'connecting'
private eTag: string | null = null
private queuedCandidates: RTCIceCandidate[] = []
private offerData: OfferData = {
iceUfrag: '',
icePwd: '',
medias: [],
}
private RESTART_PAUSE = 2000
// stop the video and close the streams if the component is going to be destroyed so we don't leave hanging streams
beforeDestroy() {
this.terminate()
// clear any potentially open restart timeout
if (this.restartTimeoutTimer) {
clearTimeout(this.restartTimeoutTimer)
}
if (this.restartTimeout) clearTimeout(this.restartTimeout)
}
get webcamStyle() {
let transforms = ''
if ('flipX' in this.camSettings && this.camSettings.flip_horizontal) transforms += ' scaleX(-1)'
if ('flipX' in this.camSettings && this.camSettings.flip_vertical) transforms += ' scaleY(-1)'
if (transforms.trimStart().length) return { transform: transforms.trimStart() }
return ''
return {
transform: this.generateTransform(
this.camSettings.flip_horizontal ?? false,
this.camSettings.flip_vertical ?? false,
this.camSettings.rotation ?? 0
),
}
}
get url() {
let baseUrl = this.camSettings.stream_url
if (baseUrl.startsWith('http')) {
baseUrl = baseUrl.replace('http', 'ws') + 'ws'
}
if (!baseUrl.endsWith('/')) baseUrl += '/'
baseUrl = new URL('whep', baseUrl).toString()
return this.convertUrl(baseUrl, this.printerUrl)
}
@@ -86,140 +96,246 @@ export default class WebrtcRTSPSimpleServer extends Mixins(BaseMixin, WebcamMixi
this.start()
}
// webrtc player methods
// adapated from sample player in https://github.com/mrlt8/docker-wyze-bridge
start() {
// unterminate we're starting again.
this.terminated = false
// clear any potentially open restart timeout
if (this.restartTimeoutTimer) {
clearTimeout(this.restartTimeoutTimer)
this.restartTimeoutTimer = null
}
window.console.log('[webcam-rtspsimpleserver] web socket connecting')
// test if the url is valid
try {
const url = new URL(this.url)
// break if url protocol is not ws
if (!url.protocol.startsWith('ws')) {
console.log('[webcam-rtspsimpleserver] invalid URL (no ws protocol)')
return
}
} catch (err) {
console.log('[webcam-rtspsimpleserver] invalid URL')
log(msg: string, obj?: any) {
if (obj) {
window.console.log(`[WebRTC mediamtx] ${msg}`, obj)
return
}
// open websocket connection
this.ws = new WebSocket(this.url)
this.ws.onerror = (event) => {
window.console.log('[webcam-rtspsimpleserver] websocket error', event)
this.ws?.close()
this.ws = null
}
this.ws.onclose = (event) => {
console.log('[webcam-rtspsimpleserver] websocket closed', event)
this.ws = null
this.scheduleRestart()
}
this.ws.onmessage = (msg: MessageEvent) => this.webRtcOnIceServers(msg)
window.console.log(`[WebRTC mediamtx] ${msg}`)
}
terminate() {
this.terminated = true
// webrtc player methods
// adapted from https://github.com/bluenviron/mediamtx/blob/main/internal/core/webrtc_read_index.html
try {
this.video.pause()
} catch (err) {
// ignore -- make sure we close down the sockets anyway
}
unquoteCredential = (v: any) => JSON.parse(`"${v}"`)
this.ws?.close()
this.pc?.close()
}
// eslint-disable-next-line no-undef
linkToIceServers(links: string | null): RTCIceServer[] {
if (links === null) return []
webRtcOnIceServers(msg: MessageEvent) {
if (this.ws === null) return
return links.split(', ').map((link) => {
const m: RegExpMatchArray | null = link.match(
/^<(.+?)>; rel="ice-server"(; username="(.*?)"; credential="(.*?)"; credential-type="password")?/i
)
const iceServers = JSON.parse(msg.data)
this.pc = new RTCPeerConnection({
iceServers,
// break if match is null
if (m === null) return { urls: '' }
// eslint-disable-next-line no-undef
const ret: RTCIceServer = {
urls: [m[1]],
}
if (m.length > 3) {
ret.username = this.unquoteCredential(m[3])
ret.credential = this.unquoteCredential(m[4])
ret.credentialType = 'password'
}
return ret
})
}
this.ws.onmessage = (msg: MessageEvent) => this.webRtcOnRemoteDescription(msg)
this.pc.onicecandidate = (evt: RTCPeerConnectionIceEvent) => this.webRtcOnIceCandidate(evt)
parseOffer(offer: string) {
const ret: OfferData = {
iceUfrag: '',
icePwd: '',
medias: [],
}
this.pc.oniceconnectionstatechange = () => {
if (this.pc === null) return
window.console.log('[webcam-rtspsimpleserver] peer connection state:', this.pc.iceConnectionState)
this.status = (this.pc?.iceConnectionState ?? '').toString()
if (['failed', 'disconnected'].includes(this.status)) {
this.scheduleRestart()
for (const line of offer.split('\r\n')) {
if (line.startsWith('m=')) {
ret.medias.push(line.slice('m='.length))
} else if (ret.iceUfrag === '' && line.startsWith('a=ice-ufrag:')) {
ret.iceUfrag = line.slice('a=ice-ufrag:'.length)
} else if (ret.icePwd === '' && line.startsWith('a=ice-pwd:')) {
ret.icePwd = line.slice('a=ice-pwd:'.length)
}
}
this.pc.ontrack = (evt: RTCTrackEvent) => {
window.console.log('[webcam-rtspsimpleserver] new track ' + evt.track.kind)
this.video.srcObject = evt.streams[0]
return ret
}
generateSdpFragment(offerData: OfferData, candidates: RTCIceCandidate[]) {
// I don't found a specification for this, but it seems to be the only way to make it work
const candidatesByMedia: any = {}
for (const candidate of candidates) {
const mid = candidate.sdpMLineIndex
if (mid === null) continue
// create the array if it doesn't exist
if (!(mid in candidatesByMedia)) candidatesByMedia[mid] = []
candidatesByMedia[mid].push(candidate)
}
let frag = 'a=ice-ufrag:' + offerData.iceUfrag + '\r\n' + 'a=ice-pwd:' + offerData.icePwd + '\r\n'
let mid = 0
for (const media of offerData.medias) {
if (candidatesByMedia[mid] !== undefined) {
frag += 'm=' + media + '\r\n' + 'a=mid:' + mid + '\r\n'
for (const candidate of candidatesByMedia[mid]) {
frag += 'a=' + candidate.candidate + '\r\n'
}
}
mid++
}
return frag
}
start() {
this.log('requesting ICE servers from ' + this.url)
fetch(this.url, {
method: 'OPTIONS',
})
.then((res) => this.onIceServers(res))
.catch((err) => {
this.log('error: ' + err)
this.scheduleRestart()
})
}
onIceServers(res: Response) {
const iceServers = this.linkToIceServers(res.headers.get('Link'))
this.log('ice servers:', iceServers)
this.pc = new RTCPeerConnection({
iceServers,
})
const direction = 'sendrecv'
this.pc.addTransceiver('video', { direction })
this.pc.addTransceiver('audio', { direction })
this.pc.createOffer().then((desc: any) => {
if (this.pc === null || this.ws === null) return
this.pc.onicecandidate = (evt: RTCPeerConnectionIceEvent) => this.onLocalCandidate(evt)
this.pc.oniceconnectionstatechange = () => this.onConnectionState()
this.pc.setLocalDescription(desc)
this.pc.ontrack = (evt) => {
this.log('new track:', evt.track.kind)
this.video.srcObject = evt.streams[0]
}
window.console.log('[webcam-rtspsimpleserver] sending offer')
this.ws.send(JSON.stringify(desc))
this.pc.createOffer().then((offer) => this.onLocalOffer(offer))
}
// eslint-disable-next-line no-undef
onLocalOffer(offer: RTCSessionDescriptionInit) {
this.offerData = this.parseOffer(offer.sdp ?? '')
this.pc?.setLocalDescription(offer)
fetch(this.url, {
method: 'POST',
headers: {
'Content-Type': 'application/sdp',
},
body: offer.sdp,
})
.then((res) => {
if (res.status !== 201) throw new Error('bad status code')
this.eTag = res.headers.get('ETag')
// fallback for MediaMTX v1.0.x with broken ETag header
if (res.headers.has('E-Tag')) this.eTag = res.headers.get('E-Tag')
return res.text()
})
.then((sdp) => {
this.onRemoteAnswer(
new RTCSessionDescription({
type: 'answer',
sdp,
})
)
})
.catch((err) => {
this.log(err)
this.scheduleRestart()
})
}
webRtcOnRemoteDescription(msg: any) {
if (this.pc === null || this.ws === null) return
onRemoteAnswer(answer: RTCSessionDescription) {
if (this.restartTimeout !== null) return
this.pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(msg.data)))
this.ws.onmessage = (msg: any) => this.webRtcOnRemoteCandidate(msg)
}
// this.pc.setRemoteDescription(new RTCSessionDescription(answer));
this.pc?.setRemoteDescription(answer)
webRtcOnIceCandidate(evt: RTCPeerConnectionIceEvent) {
if (this.ws === null) return
if (evt.candidate?.candidate !== '') {
this.ws.send(JSON.stringify(evt.candidate))
if (this.queuedCandidates.length !== 0) {
this.sendLocalCandidates(this.queuedCandidates)
this.queuedCandidates = []
}
}
webRtcOnRemoteCandidate(msg: any) {
if (this.pc === null) return
onConnectionState() {
if (this.restartTimeout !== null) return
this.pc.addIceCandidate(JSON.parse(msg.data))
this.status = this.pc?.iceConnectionState ?? ''
this.log('peer connection state:', this.status)
switch (this.status) {
case 'disconnected':
this.scheduleRestart()
}
}
onLocalCandidate(evt: RTCPeerConnectionIceEvent) {
if (this.restartTimeout !== null) return
if (evt.candidate !== null) {
if (this.eTag === '') {
this.queuedCandidates.push(evt.candidate)
return
}
this.sendLocalCandidates([evt.candidate])
}
}
sendLocalCandidates(candidates: RTCIceCandidate[]) {
fetch(this.url, {
method: 'PATCH',
headers: {
'Content-Type': 'application/trickle-ice-sdpfrag',
'If-Match': this.eTag,
// eslint-disable-next-line no-undef
} as HeadersInit,
body: this.generateSdpFragment(this.offerData, candidates),
})
.then((res) => {
if (res.status !== 204) throw new Error('bad status code')
})
.catch((err) => {
this.log(err)
this.scheduleRestart()
})
}
terminate() {
this.log('terminating')
if (this.pc !== null) {
this.pc.close()
this.pc = null
}
}
scheduleRestart() {
this.ws?.close()
this.ws = null
if (this.restartTimeout !== null) return
this.pc?.close()
this.pc = null
this.terminate()
if (this.terminated) return
this.restartTimeoutTimer = setTimeout(() => {
this.restartTimeout = window.setTimeout(() => {
this.log('scheduling restart')
this.restartTimeout = null
this.start()
}, 2000)
}, this.RESTART_PAUSE)
this.eTag = ''
this.queuedCandidates = []
}
}
</script>
+14 -16
View File
@@ -235,6 +235,7 @@
},
"GCodeViewer": {
"ClearLoadedFile": "Vymazat",
"CNCMode": "Režim CNC",
"ColorMode": "Režim barev",
"Downloading": "Stahování",
"ForceLineRendering": "Vynutit vykreslování čar",
@@ -248,6 +249,7 @@
"ReloadRequired": "Je nutné znovu načíst",
"Rendering": "Vykreslování",
"RenderQuality": "Kvalita vykreslování",
"ShowGCode": "Zobrazit G-Code",
"ShowObjectSelection": "Zobrazit výběr objektu",
"ShowToolhead": "Zobrazit nástrojovou hlavu",
"ShowTravelMoves": "Zobrazit přesuny",
@@ -256,9 +258,7 @@
"Tracking": "Sledování",
"Transparency": "Průhlednost",
"Ultra": "Ultra",
"VoxelMode": "Voxelový režim (ASMBL)",
"ShowGCode": "Zobrazit G-Code",
"CNCMode": "Režim CNC"
"VoxelMode": "Voxelový režim (ASMBL)"
},
"Heightmap": {
"Abort": "Zrušit",
@@ -307,8 +307,8 @@
"AllJobs": "Všechny",
"AvgPrinttime": "Průměrný čas tisku",
"Cancel": "Zrušit",
"CreateNote": "Vytvořit poznámku",
"Chart": "Graf",
"CreateNote": "Vytvořit poznámku",
"Delete": "Smazat",
"DeleteSelectedQuestion": "Opravdu chcete smazat {count} vybraných tisků?",
"Details": "Detaily",
@@ -372,8 +372,8 @@
},
"JobQueue": {
"AllJobs": "Všechny tisky",
"ChangeCount": "Změnit počet",
"Cancel": "Zrušit",
"ChangeCount": "Změnit počet",
"Count": "Počet",
"Empty": "Prázdné",
"InvalidCountEmpty": "Vstup nemůže být prázdný!",
@@ -434,8 +434,8 @@
"Logfiles": "Log soubory",
"Rollover": "Převést logy",
"RolloverDescription": "Vyberte, které logy by měly být resetovány:",
"RolloverToastSuccessful": "Log pro \"{name}\" byl úspěšně resetován.",
"RolloverToastFailed": "Chyba při převodu logu pro \"{name}\": {message}"
"RolloverToastFailed": "Chyba při převodu logu pro \"{name}\": {message}",
"RolloverToastSuccessful": "Log pro \"{name}\" byl úspěšně resetován."
},
"SystemPanel": {
"Constants": "Konstanty",
@@ -707,6 +707,12 @@
"Timelapse": "Time-lapse",
"Webcam": "Webkamera"
},
"ScrewsTiltAdjust": {
"Accept": "Přijmout",
"Base": "Základna",
"ErrorText": "Při procesu sondování došlo k chybě.",
"Headline": "Naklonění šroubů"
},
"SelectPrinterDialog": {
"AddPrinter": "Přidat tiskárnu",
"AddPrintersToJson": "Prosím, přidejte tiskárny do config.json.",
@@ -794,8 +800,6 @@
"Editor": "Editor",
"KlipperRestartMethod": "Metoda restartu Klipperu",
"KlipperRestartMethodDescription": "Vyberte metodu restartu, která se použije při editaci konfiguračních souborů Klipperu v \"Uložit a restartovat\".",
"MoonrakerRestartInstance": "Restart instance Moonrakeru",
"MoonrakerRestartInstanceDescription": "Vyberte, která služba Moonrakeru se restartuje v \"Uložit a restartovat\", když se editují konfigurační soubory Moonrakeru.",
"UseEscToClose": "Použít ESC pro zavření editoru",
"UseEscToCloseDescription": "Umožňuje použití klávesy ESC k zavření editoru"
},
@@ -1045,6 +1049,7 @@
"EditCrowsnestConf": "Upravit crowsnest.conf",
"EditWebcam": "Upravit webkameru",
"FlipWebcam": "Obrátit obrázek kamery:",
"Hlsstream": "HLS stream",
"Horizontally": "horizontálně",
"IconBed": "Postel",
"IconCam": "Kamera",
@@ -1055,7 +1060,6 @@
"IconNozzle": "Tryska",
"IconPrinter": "Tiskárna",
"Ipstream": "IP kamera",
"Hlsstream": "HLS stream",
"Mjpegstreamer": "MJPEG-Streamer",
"MjpegstreamerAdaptive": "Adaptivní MJPEG-Streamer (experimentální)",
"Name": "Jméno",
@@ -1074,12 +1078,6 @@
"WebrtcCameraStreamer": "WebRTC (streamer z kamery)"
}
},
"ScrewsTiltAdjust": {
"Accept": "Přijmout",
"Base": "Základna",
"ErrorText": "Při procesu sondování došlo k chybě.",
"Headline": "Naklonění šroubů"
},
"Timelapse": {
"AllFiles": "Všechny",
"Autorender": "Automatické vykreslování",
+15 -17
View File
@@ -234,6 +234,7 @@
},
"GCodeViewer": {
"ClearLoadedFile": "Fjern",
"CNCMode": "CNC Mode",
"ColorMode": "Farvevisning",
"Downloading": "Downloader",
"ForceLineRendering": "Gennemtving Linje Rendering",
@@ -247,6 +248,7 @@
"ReloadRequired": "Opdatering påkrævet",
"Rendering": "Rendering",
"RenderQuality": "Renderingskvalitet",
"ShowGCode": "Vis G-kode",
"ShowObjectSelection": "Vis Objekt valg",
"ShowToolhead": "Vis nozzle",
"ShowTravelMoves": "Vis Travel",
@@ -255,9 +257,7 @@
"Tracking": "Sporing",
"Transparency": "Transparens",
"Ultra": "Ultra",
"VoxelMode": "Voxel Mode (ASMBL)",
"ShowGCode": "Vis G-kode",
"CNCMode": "CNC Mode"
"VoxelMode": "Voxel Mode (ASMBL)"
},
"Heightmap": {
"Abort": "Afbryd",
@@ -306,8 +306,8 @@
"AllJobs": "Alle job",
"AvgPrinttime": "Gns. printtid",
"Cancel": "Annuller",
"CreateNote": "Gem note",
"Chart": "Skema",
"CreateNote": "Gem note",
"Delete": "Slet",
"DeleteSelectedQuestion": "Er du sikker på du vil slette alle {count} valgte jobs?",
"Details": "Detaljer",
@@ -371,8 +371,8 @@
},
"JobQueue": {
"AllJobs": "Alle Jobs",
"ChangeCount": "Ændre antal",
"Cancel": "Annuller",
"ChangeCount": "Ændre antal",
"Count": "Tæl",
"Empty": "Tom",
"InvalidCountEmpty": "Input må ikke være tom!",
@@ -433,8 +433,8 @@
"Logfiles": "Logfiler",
"Rollover": "Nulstil log-filer",
"RolloverDescription": "Vælg hvilke log-filer der skal nulstilles",
"RolloverToastSuccessful": "Filen: \"{name}\" blev nulstillet.",
"RolloverToastFailed": "Nulstillings fejl-log for \"{name}\": {message}"
"RolloverToastFailed": "Nulstillings fejl-log for \"{name}\": {message}",
"RolloverToastSuccessful": "Filen: \"{name}\" blev nulstillet."
},
"SystemPanel": {
"Constants": "Konstanter",
@@ -706,6 +706,12 @@
"Timelapse": "Timelapse",
"Webcam": "Webcam"
},
"ScrewsTiltAdjust": {
"Accept": "Acceptér",
"Base": "Udgangspunkt",
"ErrorText": "Noget gik galt under målingsprocessen",
"Headline": "Bed-skrue justering"
},
"SelectPrinterDialog": {
"AddPrinter": "Tilføj Printer",
"AddPrintersToJson": "Tilføj venligst Printere til config.json.",
@@ -793,8 +799,6 @@
"Editor": "Editor",
"KlipperRestartMethod": "Metode for genstart af Klipper",
"KlipperRestartMethodDescription": "Vælg hvilken metode der skal bruges ved brug af 'Gem & Genstart' når der redigeres i Klipper config filer.",
"MoonrakerRestartInstance": "Genstart Moonraker instans",
"MoonrakerRestartInstanceDescription": "Vælg hvilken instans af Moonraker servicen der skal genstartes ved brug af 'Gem & Genstart' når der redigeres i Moonraker config filer.",
"UseEscToClose": "Tryk ESC for at lukke Editor.",
"UseEscToCloseDescription": "Tillader at ESC lukker Editor"
},
@@ -1042,6 +1046,7 @@
"EditCrowsnestConf": "Redigér crowsnest.conf",
"EditWebcam": "Rediger Webcam",
"FlipWebcam": "Vend webcam-billedet:",
"Hlsstream": "HLS Stream",
"Horizontally": "horisontalt",
"IconBed": "Bed",
"IconCam": "Kamera",
@@ -1052,10 +1057,9 @@
"IconNozzle": "Dyse",
"IconPrinter": "Printer",
"Ipstream": "IP Kamera",
"Hlsstream": "HLS Stream",
"JMuxerStream": "Rå h264 stream (jmuxer)",
"Mjpegstreamer": "MJPEG-Streamer",
"MjpegstreamerAdaptive": "Adaptiv MJPEG-Streamer (eksperimental)",
"JMuxerStream": "Rå h264 stream (jmuxer)",
"Name": "Navn",
"NameAlreadyExists": "Navnet bruges allerede",
"Required": "Krævet",
@@ -1071,12 +1075,6 @@
"Webcams": "Webcams"
}
},
"ScrewsTiltAdjust": {
"Accept": "Acceptér",
"Base": "Udgangspunkt",
"ErrorText": "Noget gik galt under målingsprocessen",
"Headline": "Bed-skrue justering"
},
"Timelapse": {
"AllFiles": "Alle",
"Autorender": "Autorendering",
Loaded 100 of 148 files, more files were not shown because too many files have changed in this diff. Show more