Compare commits
289
Commits
v2.2.0-beta2
...
v2.5.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a199a00b6 | ||
|
|
c18a9594e6 | ||
|
|
85ea45fbe9 | ||
|
|
44f4079dac | ||
|
|
ec1b32eaaf | ||
|
|
531b75fffd | ||
|
|
7301ae986a | ||
|
|
0f01a8f994 | ||
|
|
7ad25e3851 | ||
|
|
6a7f2f56a4 | ||
|
|
47feaef671 | ||
|
|
0e4d104d20 | ||
|
|
9665fb9a38 | ||
|
|
b0cdbb48f3 | ||
|
|
52d0ea4ec5 | ||
|
|
c42f09acc9 | ||
|
|
1a6969eeea | ||
|
|
a3a71c8f15 | ||
|
|
3e49847fc3 | ||
|
|
6703721593 | ||
|
|
f3c42954f1 | ||
|
|
1bbbc0c0a8 | ||
|
|
2f868b537d | ||
|
|
c1a50180d0 | ||
|
|
3743023514 | ||
|
|
a798d8973c | ||
|
|
328530a6a3 | ||
|
|
43dc843eca | ||
|
|
92438bf8a7 | ||
|
|
e0e90bcdaf | ||
|
|
6a2a1baaab | ||
|
|
2a924bcd27 | ||
|
|
cec3a9fe33 | ||
|
|
b3ce868dec | ||
|
|
c904b7ba71 | ||
|
|
a8bf9e9559 | ||
|
|
3b5d7f146b | ||
|
|
6b9b69501a | ||
|
|
57a53b5ac3 | ||
|
|
c65527ddf2 | ||
|
|
22ccab831b | ||
|
|
0f94e80135 | ||
|
|
d29ce0a4f0 | ||
|
|
8782c89d71 | ||
|
|
b6fe84f19d | ||
|
|
051b89662b | ||
|
|
e7eb94faa1 | ||
|
|
2b7bf2a3f4 | ||
|
|
9c4fb547b5 | ||
|
|
727fc722af | ||
|
|
1a32147d68 | ||
|
|
380f3c1b6d | ||
|
|
7ac6a723b4 | ||
|
|
712d68136b | ||
|
|
034ff81e49 | ||
|
|
c2ecc845ca | ||
|
|
e21439d061 | ||
|
|
41fa1d98ca | ||
|
|
655d2fd339 | ||
|
|
0735ed37a9 | ||
|
|
d96070f336 | ||
|
|
d259abb749 | ||
|
|
3e06c5fd66 | ||
|
|
288e5110f4 | ||
|
|
41ca5244cc | ||
|
|
3d4b5451ae | ||
|
|
dc17ff1158 | ||
|
|
de23cb6243 | ||
|
|
94d7f0dc16 | ||
|
|
45c52e3571 | ||
|
|
03640e239b | ||
|
|
4c24fa7284 | ||
|
|
12483ee63b | ||
|
|
bae712540e | ||
|
|
31664b5f38 | ||
|
|
ba5aea2b88 | ||
|
|
a6e38df012 | ||
|
|
bc0018dadc | ||
|
|
1a659d30d2 | ||
|
|
d0bf0bde11 | ||
|
|
d87fe4173d | ||
|
|
f8c66af48b | ||
|
|
da14c44873 | ||
|
|
20adf79e7c | ||
|
|
2aa181c7f5 | ||
|
|
c9ab0782bf | ||
|
|
6f8cfaa276 | ||
|
|
4760b9d9f1 | ||
|
|
d6015be734 | ||
|
|
837623e0a1 | ||
|
|
7c28027189 | ||
|
|
a88c9ba083 | ||
|
|
128baea88c | ||
|
|
cca17a8822 | ||
|
|
685665bd46 | ||
|
|
d1cfe7251d | ||
|
|
05dea0c78b | ||
|
|
d05efe26c4 | ||
|
|
835c5dacd2 | ||
|
|
57bb268ea0 | ||
|
|
d5cafaaa06 | ||
|
|
8cba020fb2 | ||
|
|
a305f243da | ||
|
|
666c942b18 | ||
|
|
f01f421c1c | ||
|
|
285b8b9b6f | ||
|
|
feadc73847 | ||
|
|
ceca6ce2f7 | ||
|
|
ff37c7de32 | ||
|
|
829e7a497d | ||
|
|
37c9fa8657 | ||
|
|
6a40e6047d | ||
|
|
78b9864d11 | ||
|
|
950dea1e08 | ||
|
|
27c57eef68 | ||
|
|
f65bc9f0b9 | ||
|
|
e150a4ef32 | ||
|
|
a70bd12c19 | ||
|
|
3ec2ee2793 | ||
|
|
e411175b7f | ||
|
|
3f67d1d4c5 | ||
|
|
12dd1c9e31 | ||
|
|
2b2057648d | ||
|
|
42f7851636 | ||
|
|
175a90aae5 | ||
|
|
1e9120e709 | ||
|
|
4e8b6de72a | ||
|
|
c37ea7f0ed | ||
|
|
f22d4d09c8 | ||
|
|
4a450fc563 | ||
|
|
eb4c5678ba | ||
|
|
fe04944c79 | ||
|
|
6fefc98da6 | ||
|
|
0570568322 | ||
|
|
9a5b230ffa | ||
|
|
da569fc9f7 | ||
|
|
719b5c4b01 | ||
|
|
28e1ec384d | ||
|
|
6387431ce8 | ||
|
|
fd79316799 | ||
|
|
05672b55c1 | ||
|
|
cbb70759f5 | ||
|
|
99075fb259 | ||
|
|
14f6799489 | ||
|
|
24d5668a65 | ||
|
|
2b5ea0f66e | ||
|
|
e75f0bcee8 | ||
|
|
8e562c7bba | ||
|
|
5f2f7ddc9f | ||
|
|
349372fd64 | ||
|
|
157e099964 | ||
|
|
fe9995882a | ||
|
|
d8377ac6e5 | ||
|
|
b16c1cfdd2 | ||
|
|
8c1f09d909 | ||
|
|
1f71d2dbbc | ||
|
|
f55b58a2a9 | ||
|
|
8d7e4c1ea4 | ||
|
|
4357b8c9d6 | ||
|
|
46f0879677 | ||
|
|
1d117ed82f | ||
|
|
2eb34007e1 | ||
|
|
4c9aab5a2d | ||
|
|
98439b916b | ||
|
|
24932c088f | ||
|
|
69f30ed460 | ||
|
|
1709001c8b | ||
|
|
f277193082 | ||
|
|
8af3f92a60 | ||
|
|
79bc61780c | ||
|
|
2b626474b4 | ||
|
|
09ab1077a1 | ||
|
|
c2ddac3e2f | ||
|
|
9474ae614d | ||
|
|
fa2f07fc22 | ||
|
|
afb041a5fa | ||
|
|
f27a7770a9 | ||
|
|
5ce78fae4a | ||
|
|
6f68709f21 | ||
|
|
8ab59b642a | ||
|
|
2d7a5b5845 | ||
|
|
a4e268e543 | ||
|
|
f4ed91e515 | ||
|
|
15b12a68e5 | ||
|
|
7f57f8b9aa | ||
|
|
1f9d8e86be | ||
|
|
7536bce10d | ||
|
|
4bd2d28f4b | ||
|
|
6b6ca698e6 | ||
|
|
c514b3f130 | ||
|
|
46aa7cc7c6 | ||
|
|
d1c1b077d8 | ||
|
|
ea8e8e8caa | ||
|
|
3beeacb4ee | ||
|
|
7da894d55e | ||
|
|
d48d05bebe | ||
|
|
5f3d80dd5b | ||
|
|
e5d4e6243a | ||
|
|
1e0645be6e | ||
|
|
eb1d3c1475 | ||
|
|
1e62b5bce5 | ||
|
|
6661e031fb | ||
|
|
8a000e38a4 | ||
|
|
229a6759cf | ||
|
|
dfc91df681 | ||
|
|
38d2c883b1 | ||
|
|
b5c92cbcab | ||
|
|
642d5a0cb5 | ||
|
|
a9669ad809 | ||
|
|
753f050795 | ||
|
|
443b7f9dc8 | ||
|
|
8438c0a86b | ||
|
|
308518a25c | ||
|
|
de911d21fc | ||
|
|
911387755f | ||
|
|
8367f01bce | ||
|
|
21ad4c16e7 | ||
|
|
6b18300b5d | ||
|
|
1c84e6ec6d | ||
|
|
0d4c0149b4 | ||
|
|
5029f4d9d5 | ||
|
|
94338ba5d4 | ||
|
|
04159fc49c | ||
|
|
a30a001290 | ||
|
|
4c7ec84420 | ||
|
|
e251d3cfe0 | ||
|
|
87a98543eb | ||
|
|
8f843e42b1 | ||
|
|
ae68b490ac | ||
|
|
8adfb0fdd3 | ||
|
|
1c706b0725 | ||
|
|
a6c09bc937 | ||
|
|
76c04beb4d | ||
|
|
0f279eb60d | ||
|
|
e7b281739b | ||
|
|
5f8f0469e0 | ||
|
|
07db82a269 | ||
|
|
5c536b18ec | ||
|
|
ceb03862a5 | ||
|
|
cc5c15fc90 | ||
|
|
3d3f29223b | ||
|
|
1ed67b41ab | ||
|
|
0551ea39e7 | ||
|
|
80206d7b4a | ||
|
|
9f4fb30b98 | ||
|
|
8b4d534e86 | ||
|
|
edd97e0773 | ||
|
|
78ac2bb0d2 | ||
|
|
2113eae8fe | ||
|
|
4671935491 | ||
|
|
4be40b6457 | ||
|
|
e0fd25cd90 | ||
|
|
b6f0020d77 | ||
|
|
eb0f157fee | ||
|
|
1370e089ef | ||
|
|
02e9b2c9a1 | ||
|
|
d85a072a39 | ||
|
|
a5a7d05460 | ||
|
|
132a0d34d3 | ||
|
|
dfaccb39a5 | ||
|
|
ff0d50239c | ||
|
|
fb4bfb3f57 | ||
|
|
86638effdd | ||
|
|
6ffb771eeb | ||
|
|
bbf2832238 | ||
|
|
c7fc694fca | ||
|
|
4aec550a90 | ||
|
|
3011928ca3 | ||
|
|
d657db36d6 | ||
|
|
fd89ff7ba3 | ||
|
|
cc888a3924 | ||
|
|
5cbcebb771 | ||
|
|
bc841609ba | ||
|
|
fccd8321bb | ||
|
|
04a39361c3 | ||
|
|
090cda6350 | ||
|
|
ad6015b69f | ||
|
|
76cedb174e | ||
|
|
0da85e0e20 | ||
|
|
9e64fb139d | ||
|
|
257c31790f | ||
|
|
35716eae24 | ||
|
|
666897570a | ||
|
|
8b4465300d | ||
|
|
97912022c2 | ||
|
|
087d9b7104 | ||
|
|
8ddf13081f | ||
|
|
359b20e75d | ||
|
|
ebf74860f4 |
No files matched your search
@@ -7,8 +7,8 @@ VUE_APP_PORT=7125
|
||||
# reconnect interval in ms
|
||||
VUE_APP_RECONNECT_INTERVAL=5000
|
||||
|
||||
# remote mode
|
||||
VUE_APP_REMOTE_MODE=false
|
||||
# where should mainsail read the instances from (moonraker, browser or json)
|
||||
VUE_APP_INSTANCES_DB="moonraker"
|
||||
|
||||
# defaults for multi language tests
|
||||
VUE_APP_I18N_LOCALE=en
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"rules": {
|
||||
"vue/no-v-html": 0,
|
||||
"vue/component-tags-order": 0,
|
||||
"vue/no-v-text-v-html-on-component": 0,
|
||||
"vue/valid-v-slot": [
|
||||
"error",
|
||||
{
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
Developer Certificate of Origin
|
||||
Version 1.1
|
||||
|
||||
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
|
||||
1 Letterman Drive
|
||||
Suite D4700
|
||||
San Francisco, CA, 94129
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this
|
||||
license document, but changing it is not allowed.
|
||||
|
||||
Developer's Certificate of Origin 1.1
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
(a) The contribution was created in whole or in part by me and I
|
||||
have the right to submit it under the open source license
|
||||
indicated in the file; or
|
||||
|
||||
(b) The contribution is based upon previous work that, to the best
|
||||
of my knowledge, is covered under an appropriate open source
|
||||
license and I have the right under that license to submit that
|
||||
work with modifications, whether created in whole or in part
|
||||
by me, under the same open source license (unless I am
|
||||
permitted to submit under a different license), as indicated
|
||||
in the file; or
|
||||
|
||||
(c) The contribution was provided directly to me by some other
|
||||
person who certified (a), (b) or (c) and I have not modified
|
||||
it.
|
||||
|
||||
(d) I understand and agree that this project and the contribution
|
||||
are public and that a record of the contribution (including all
|
||||
personal information I submit with it, including my sign-off) is
|
||||
maintained indefinitely and may be redistributed consistent with
|
||||
this project or the open source license(s) involved.
|
||||
@@ -17,6 +17,14 @@ body:
|
||||
[Discord](https://discord.gg/mainsail)
|
||||
|
||||
---
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: 'Mainsail Version:'
|
||||
description: Mainsail version where the issue occurs
|
||||
placeholder: <your current mainsail version>
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: browser
|
||||
attributes:
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# Configuration for Label Actions - https://github.com/dessant/label-actions
|
||||
|
||||
not on Github:
|
||||
issues:
|
||||
comment: |
|
||||
Ahoi!
|
||||
|
||||
It looks like this ticket is a request for help (or similar).
|
||||
Many helpful people will not see your message here and you are
|
||||
unlikely to get a useful response.
|
||||
|
||||
We use github to handle bugreports, feature requests and
|
||||
planning new releases.
|
||||
|
||||
Please use our Discord-Server for help: [discord.gg/mainsail](https://discord.gg/mainsail)
|
||||
|
||||
This ticket will be automatically closed.
|
||||
|
||||
Fair wind and a following sea!
|
||||
~ Your friendly MainsailGithubBot
|
||||
|
||||
*PS: I'm just an automated script, not a real sailor.*
|
||||
close: true
|
||||
@@ -0,0 +1,38 @@
|
||||
name: 'Auto analyze if package.json was edited'
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- develop
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
auto-analyze:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
- name: Check package.json was changed
|
||||
id: changed-file-package-json
|
||||
uses: tj-actions/changed-files@v23
|
||||
with:
|
||||
sha: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
- name: Install node
|
||||
uses: actions/setup-node@v3
|
||||
if: contains(steps.changed-file-package-json.outputs.modified_files, 'package.json')
|
||||
with:
|
||||
node-version: '16'
|
||||
cache: 'npm'
|
||||
|
||||
- uses: preactjs/compressed-size-action@v2
|
||||
if: contains(steps.changed-file-package-json.outputs.modified_files, 'package.json')
|
||||
with:
|
||||
strip-hash: "\\b\\w{8}\\."
|
||||
pattern: './dist/**/*.{js,css,html,json,woff2,svg,png}'
|
||||
exclude: '{./dist/manifest.json,./dist/build.zip,**/*.map,**/node_modules/**}'
|
||||
@@ -0,0 +1,57 @@
|
||||
name: Check Translations
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [synchronize, opened]
|
||||
paths:
|
||||
- 'src/locales/**'
|
||||
|
||||
jobs:
|
||||
check_translations:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install jq
|
||||
run: sudo apt install -y jq
|
||||
|
||||
- name: Fetch repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
- name: Install node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v23
|
||||
with:
|
||||
sha: ${{ github.event.pull_request.head.sha }}
|
||||
files: 'src/locales/*.json'
|
||||
|
||||
- name: Run i18n-extract on changed locale files
|
||||
id: i18n-extract
|
||||
env:
|
||||
OUTPUT: ''
|
||||
run: |
|
||||
mkdir ./i18n-extract
|
||||
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
|
||||
npm run i18n-extract -- --languageFiles=src/locales/${file##*/} --output=i18n-extract/${file##*/}
|
||||
MISSING=$(cat i18n-extract/${file##*/} | jq '.missingKeys | length')
|
||||
UNUSED=$(cat i18n-extract/${file##*/} | jq '.unusedKeys | length')
|
||||
echo "::set-output name=$file::|${file##*/}|${MISSING}|${UNUSED}|"
|
||||
done
|
||||
- name: Comment PR
|
||||
uses: thollander/actions-comment-pull-request@v1
|
||||
with:
|
||||
message: |
|
||||
Language file analysis report:
|
||||
|File|Missing Keys|Unused Keys|
|
||||
|:---|---:|---:|
|
||||
${{join(steps.i18n-extract.outputs.*, '
|
||||
')}}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -0,0 +1,19 @@
|
||||
name: 'Label Actions'
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [labeled, unlabeled]
|
||||
pull_request:
|
||||
types: [labeled, unlabeled]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
pull-requests: write
|
||||
discussions: write
|
||||
|
||||
jobs:
|
||||
action:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: dessant/label-actions@v2
|
||||
@@ -5,6 +5,9 @@ on:
|
||||
branches: ['master', 'develop']
|
||||
tags:
|
||||
- '*'
|
||||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
@@ -37,7 +40,6 @@ jobs:
|
||||
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
|
||||
type=edge,branch=develop
|
||||
type=ref,event=tag
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
@@ -47,7 +49,7 @@ jobs:
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
@@ -0,0 +1,145 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
type: string
|
||||
description: New version number in X.Y.Z
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
push-version-number:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone develop repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.PAT }}
|
||||
ref: 'develop'
|
||||
|
||||
- name: get-npm-version
|
||||
id: package-version
|
||||
uses: martinbeentjes/npm-get-version-action@main
|
||||
|
||||
- name: Push version number
|
||||
if: steps.package-version.outputs.current-version != github.event.inputs.version
|
||||
shell: bash
|
||||
run: |
|
||||
npm version --no-git-tag-version ${{ github.event.inputs.version }}
|
||||
|
||||
- name: git add & commit & push
|
||||
if: steps.package-version.outputs.current-version != github.event.inputs.version
|
||||
uses: EndBug/add-and-commit@v9
|
||||
with:
|
||||
add: 'package.json package-lock.json'
|
||||
default_author: github_actions
|
||||
message: 'chore: push version number to v${{ github.event.inputs.version }}'
|
||||
push: true
|
||||
|
||||
update-master-branch:
|
||||
needs: ['push-version-number']
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: everlytic/branch-merge@1.1.5
|
||||
with:
|
||||
github_token: ${{ secrets.PAT }}
|
||||
source_ref: 'develop'
|
||||
target_branch: 'master'
|
||||
commit_message_template: '[Automated] Merged {source_ref} into target {target_branch}'
|
||||
|
||||
release:
|
||||
needs: ['update-master-branch']
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Fetch repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: 'master'
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
|
||||
- name: Move build out of dist
|
||||
shell: bash
|
||||
run: mv ./dist/mainsail.zip ./mainsail.zip
|
||||
|
||||
- name: Get latest tag
|
||||
id: latest_tag
|
||||
shell: bash
|
||||
run: |
|
||||
echo "TAG_NAME=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Generate a changelog
|
||||
uses: orhun/git-cliff-action@v1
|
||||
id: generate-changelog
|
||||
with:
|
||||
config: ./cliff-release.toml
|
||||
args: ${{ steps.latest_tag.outputs.TAG_NAME }}..HEAD
|
||||
|
||||
- name: Create release and upload build
|
||||
uses: softprops/action-gh-release@v1
|
||||
id: create-release
|
||||
with:
|
||||
name: v${{ github.event.inputs.version }}
|
||||
tag_name: v${{ github.event.inputs.version }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
files: ./mainsail.zip
|
||||
body: ${{ steps.generate-changelog.outputs.content }}
|
||||
|
||||
- name: Copy remote configs to dist
|
||||
shell: bash
|
||||
run: cp ./remote/* ./dist/
|
||||
|
||||
- name: Upload to remote server
|
||||
uses: SamKirkland/FTP-Deploy-Action@4.3.3
|
||||
with:
|
||||
server: ${{ secrets.REMOTEHOST }}
|
||||
username: ${{ secrets.REMOTEUSER }}
|
||||
password: ${{ secrets.REMOTEPASSWORD }}
|
||||
dangerous-clean-slate: true
|
||||
local-dir: ./dist/
|
||||
|
||||
update-changelog:
|
||||
needs: ['release']
|
||||
name: Generate changelog
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: 'develop'
|
||||
token: ${{ secrets.PAT }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get latest tag
|
||||
id: latest_tag
|
||||
shell: bash
|
||||
run: |
|
||||
echo "TAG_NAME=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Generate a changelog
|
||||
uses: orhun/git-cliff-action@v1
|
||||
id: git-cliff
|
||||
with:
|
||||
config: cliff.toml
|
||||
args: v0.0.4..${{ steps.latest_tag.outputs.TAG_NAME }}
|
||||
env:
|
||||
OUTPUT: ${{ github.workspace }}/CHANGELOG.md
|
||||
|
||||
- name: Show CHANGELOG
|
||||
run: |
|
||||
cat CHANGELOG.md
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: 'docs(changelog): update changelog'
|
||||
file_pattern: CHANGELOG.md
|
||||
@@ -0,0 +1,56 @@
|
||||
name: 'Close stale issues and PRs'
|
||||
|
||||
# Both `issue_comment` and `scheduled` event types are required for this Action
|
||||
# to work properly.
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
schedule:
|
||||
- cron: '30 1 * * *'
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
days-before-stale: 14
|
||||
days-before-close: 7
|
||||
exempt-all-milestones: true
|
||||
close-issue-reason: not_planned
|
||||
only-labels: '❔ User Input'
|
||||
labels-to-remove-when-unstale: '❔ User Input,💤 Stale'
|
||||
stale-issue-label: '💤 Stale'
|
||||
stale-pr-label: '💤 Stale'
|
||||
stale-issue-message: |
|
||||
Ahoi!
|
||||
|
||||
It looks like there hasn't been any recent updates on
|
||||
this issue. If you created this issue and no longer
|
||||
consider it to get merged, then please login to github
|
||||
and close it. Otherwise, if there is no further activity
|
||||
on this issue, it will be automatically closedwithin the
|
||||
next 7 days.
|
||||
|
||||
Fair wind and a following sea!
|
||||
~ Your friendly MainsailGithubBot
|
||||
|
||||
*PS: I'm just an automated script, not a real sailor.*
|
||||
stale-pr-message: |
|
||||
Ahoi!
|
||||
|
||||
It looks like there hasn't been any recent updates on
|
||||
this pull request. If you created this pull request and
|
||||
no longer consider it to get merged, then please login
|
||||
to github and close it. Otherwise, if there is no further
|
||||
activity on this pull request, it will be automatically
|
||||
closed within the next 7 days.
|
||||
|
||||
Fair wind and a following sea!
|
||||
~ Your friendly MainsailGithubBot
|
||||
|
||||
*PS: I'm just an automated script, not a real sailor.*
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
- name: Install node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '16'
|
||||
node-version: 18
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
@@ -28,6 +28,6 @@ jobs:
|
||||
run: npm run build
|
||||
|
||||
- name: Cypress run
|
||||
uses: cypress-io/github-action@v2
|
||||
uses: cypress-io/github-action@v4
|
||||
with:
|
||||
start: npm start
|
||||
start: npm run preview
|
||||
@@ -1,42 +0,0 @@
|
||||
name: Update changelog
|
||||
|
||||
on:
|
||||
# Update the changelog after pushing a new tag
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
# Update the changelog by invoking this workflow manually
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
changelog:
|
||||
name: Generate changelog
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Get latest tag
|
||||
run: |
|
||||
echo "::set-output name=TAG_NAME::$(git describe --tags $(git rev-list --tags --max-count=1))"
|
||||
id: latest_tag
|
||||
- name: Generate a changelog
|
||||
uses: orhun/git-cliff-action@v1
|
||||
id: git-cliff
|
||||
with:
|
||||
config: cliff.toml
|
||||
args: v0.0.4..${{ steps.latest_tag.outputs.TAG_NAME }}
|
||||
env:
|
||||
OUTPUT: CHANGELOG.md
|
||||
|
||||
- name: show CHANGELOG
|
||||
run: |
|
||||
cat CHANGELOG.md
|
||||
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: 'chore(changelog): update changelog'
|
||||
file_pattern: CHANGELOG.md
|
||||
branch: develop
|
||||
@@ -10,9 +10,11 @@ temp
|
||||
.versions
|
||||
.changelog
|
||||
.idea
|
||||
.vscode
|
||||
package-lock.json
|
||||
*.local
|
||||
.env
|
||||
|
||||
cypress/screenshots/
|
||||
cypress/videos/
|
||||
components.d.ts
|
||||
+808
-214
File diff suppressed because it is too large.
Load diff
+69
-25
@@ -1,43 +1,87 @@
|
||||
# Mainsail Contributing Guide
|
||||
# Contributing to Mainsail
|
||||
|
||||
Hi! I'm really excited that you are interested in contributing to Mainsail. Before submitting your contribution, please make sure to take a moment and read through the following guidelines:
|
||||
If you are reading this document right now, you are probably considering contributing to Mainsail and making it better
|
||||
than it is today. Thank you for taking that initiative! Before submitting your contribution, please take a moment and
|
||||
make sure to read through our contribution guidelines:
|
||||
|
||||
- [Code of Conduct](https://github.com/meteyou/mainsail/.github/CODE_OF_CONDUCT.md)
|
||||
- [Issue Reporting Guidelines](#issue-reporting-guidelines)
|
||||
- [Pull Request Guidelines](#pull-request-guidelines)
|
||||
- [Code of Conduct](https://github.com/mainsail-crew/mainsail/blob/develop/.github/CODE_OF_CONDUCT.md)
|
||||
- [Question or Problem?](#question)
|
||||
- [Issues and Bugs](#issue)
|
||||
- [Feature Requests](#feature)
|
||||
- [Submission Guidelines](#submit)
|
||||
- [Submit an Issue](#submit-issue)
|
||||
- [Submit a Pull Request](#submit-pr)
|
||||
- [Financial Contributions](#financial)
|
||||
- [Credits](https://docs.mainsail.xyz/credits)
|
||||
|
||||
## Issue Reporting Guidelines
|
||||
## <a name="question"></a> Got a Question or Problem?
|
||||
|
||||
- Use [https://github.com/meteyou/mainsail/issues](https://github.com/meteyou/mainsail/issues) to create new issues.
|
||||
Please do not open issues for general support questions. We want to keep GitHub issues for bug reports and feature
|
||||
requests. Instead, please visit us on [Discord](https://discord.gg/mainsail) to ask support-related questions.
|
||||
|
||||
## Pull Request Guidelines
|
||||
Our Discord server is a much better place to ask general support questions. We take a right to close issues that are
|
||||
requests for generic support and redirect people to Discord.
|
||||
|
||||
- The `master` branch is just a snapshot of the latest stable release. All development should be done in dedicated branches. **Do not submit PRs against the `master` branch.**
|
||||
## <a name="issue"></a> Found a Bug?
|
||||
|
||||
- Checkout a topic branch from the relevant branch, e.g. `develop`, and merge back against that branch.
|
||||
If you find a bug in the source code or think that Mainsail is behaving odd in specific situations, you can help us fix
|
||||
that issue by [submitting an issue](https://github.com/mainsail-crew/mainsail/issues/new?assignees=&labels=%E2%9A%A1+Type%3A+Bug&template=bug_report.yml).
|
||||
If you have already fixed that issue, you can [submit a Pull Request](#submit-pr) with that fix.
|
||||
|
||||
- It's OK to have multiple small commits as you work on the PR - GitHub will automatically squash it before merging.
|
||||
## <a name="feature"></a> Missing a Feature?
|
||||
|
||||
- If adding a new feature:
|
||||
You can request a new feature by [submitting a feature request](https://github.com/mainsail-crew/mainsail/issues/new?assignees=&labels=%F0%9F%92%A1+Type%3A+FR&template=feature_request.yml).
|
||||
If you would like to implement a new feature, please consider the scope of the change. For changes requiring a lot of
|
||||
work, it's best to outline a proposal first so it can be discussed. This allows us to prevent wasted time and effort and
|
||||
discuss how to bring your proposed feature into the project.
|
||||
|
||||
- Provide a convincing reason to add this feature. Ideally, you should open a suggestion issue first and have it approved before working on it.
|
||||
## <a name="submit"></a> Submission Guidelines
|
||||
|
||||
- If fixing bug:
|
||||
- If you are resolving a special issue, add `(fix #xxxx[,#xxxx])` (#xxxx is the issue id) in your PR title for a better release log, e.g. `update entities encoding/decoding (fix #3899)`.
|
||||
- Provide a detailed description of the bug in the PR. Live demo preferred.
|
||||
- Add appropriate test coverage if applicable.
|
||||
### <a name="submit-issue"></a> Submitting an Issue
|
||||
|
||||
## Committing Changes
|
||||
Before you submit an issue, please search the issue tracker if your problem may already exist. If a ticket already
|
||||
covers your case, please refrain from opening a new ticket and instead contribute to the existing ticket. If you submit
|
||||
an issue, please provide the required information and reproduction steps. We need those to be able to try and reproduce
|
||||
the bug ourselves. Without proper instructions on how to reproduce the issue you are encountering, we might be unable to
|
||||
fix a possible bug.
|
||||
|
||||
Commit messages should follow the [commit message convention](https://www.conventionalcommits.org/en/v1.0.0/) so that changelogs can be automatically generated.
|
||||
### <a name="submit-pr"></a> Submitting a Pull Request (PR)
|
||||
|
||||
## Financial Contribution
|
||||
Before you work on a PR and submit it, please pay attention to the following guidelines:
|
||||
|
||||
As a pure community-driven project without major corporate backing, we also welcome financial contributions via Patreon and OpenCollective.
|
||||
1. Search the [pull requests](https://github.com/mainsail-crew/mainsail/pulls) for an open or closed PR related to your submission.
|
||||
- You don't want to duplicate existing efforts or work on something unlikely to be merged into the project.
|
||||
2. Do not submit PRs against the `master` branch. PRs need to be submitted against the `develop` branch.
|
||||
3. Follow our [Code Standards](https://docs.mainsail.xyz/development/code-standards)
|
||||
4. If there is an issue describing the problem you're fixing or a discussion of a feature you are implementing, make sure to link it in the PRs body.
|
||||
|
||||
- [Become a supporter on Patreon](https://patreon.com/meteyou)
|
||||
- [One-time donation via Ko-Fi](https://ko-fi.com/mainsail)
|
||||
- You can also add `fix #<id>` or `fixes #<id>` in the PR body where `<id>` is the issue id.
|
||||
- Example PR title, body and sign-off:
|
||||
|
||||
## Credits
|
||||
```
|
||||
fix: incorrect handling of click event
|
||||
|
||||
Thank you to all the people who have already contributed to Mainsail!
|
||||
This PR will fix #123.
|
||||
Fixes correct handling of click event when button [X] is clicked.
|
||||
|
||||
Signed-off-by: James Smith <james.smith@myvalidemail.com>
|
||||
```
|
||||
|
||||
5. If there is no issue describing the problem, create an issue first or provide a sufficient description of the bug/feature.
|
||||
- Screenshots of your changes are welcome if you worked on UI-related code.
|
||||
6. The title of the PR should follow the [commit message convention](https://www.conventionalcommits.org/en/v1.0.0/).
|
||||
- If the PR consists of multiple commits, it's good practice to follow the convention, although that is not necessarily required.
|
||||
- Upon merging, we will squash all commits of the PR into a single commit for a clean history and release changelogs.
|
||||
7. Please sign off each commit and your PR. It must contain your real name and a current email address (see example in item 4).
|
||||
- The sign-off should follow this pattern: `Signed-off-by: My Name <myemail@example.org>`
|
||||
- The sign-off certifies that you agree with the [developer certificate of origin](https://github.com/mainsail-crew/mainsail/blob/develop/.github/DEVELOPER_CERTIFICATE_OF_ORIGIN.md).
|
||||
- If you provide a translation, a sign-off is not necessarily required.
|
||||
8. When opening a pull request, keep `Allow edits and access to secrets by maintainers` **enabled**.
|
||||
|
||||
## <a name="financial"></a> Financial Contribution
|
||||
|
||||
As a community-driven project without primary corporate backing, we always welcome financial contributions. A list of
|
||||
options we offer to support us financially can be seen below.
|
||||
|
||||
- [Become a supporter on Patreon](https://patreon.com/meteyou) (monthly recurring)
|
||||
- [Donation via Ko-Fi](https://ko-fi.com/mainsail) (one time / monthly recurring)
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Builder stage, builds the application in node
|
||||
#
|
||||
FROM node:16-alpine as builder
|
||||
FROM --platform=$BUILDPLATFORM node:18-alpine as builder
|
||||
|
||||
RUN apk add zip
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ You can find the latest release notes [here](https://github.com/mainsail-crew/ma
|
||||
- **Power Control:** _Control power devices such as relays, TP-Link and Tasmota devices, and more_
|
||||
- **Powerful Macro-Management:** _Manage your macros on a micro level_
|
||||
- **[Configurable Dashboard](https://docs.mainsail.xyz/features/dashboard-organisation):** _Create your own personal dashboard_
|
||||
- **[Theming Support](https://docs.mainsail.xyz/features/theming/):** _Customizable user interface including logos, backgrounds, and custom CSS_
|
||||
- **[Theming Support](https://docs.mainsail.xyz/features/theming):** _Customizable user interface including logos, backgrounds, and custom CSS_
|
||||
- **[Additional Sensors](https://docs.mainsail.xyz/quicktips/additional-sensors):** _Add extra sensors to the temperature graph_
|
||||
- **Exclude Objects:** _Exclude parts of your print <sup>(not officially supported by Klipper yet)</sup>_
|
||||
|
||||
@@ -84,6 +84,14 @@ Do you need help or just want to talk? Join our active community on [Discord](ht
|
||||
Did you find a bug or did you thought of a feature?
|
||||
Please create an [Issue](https://github.com/mainsail-crew/mainsail/issues) in GitHub and let us know.
|
||||
|
||||
## Official Sponsors
|
||||
|
||||
<p align='center'>
|
||||
<img src="https://raw.githubusercontent.com/mainsail-crew/docs/master/assets/img/logo-bigtreetech.png" alt='Mainsail logo' width="150">
|
||||
</p>
|
||||
|
||||
**BIGTREETECH** is the official mainboard partner of Mainsail. BIGTREETECH is committed to developing innovative and competitive products to better serve the 3D printing community.
|
||||
|
||||
## Support Mainsail
|
||||
|
||||
Mainsail is primarily developed and maintained by meteyou. To keep the project going he invests his free time, almost
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
# configuration file for git-cliff (0.1.0)
|
||||
|
||||
[changelog]
|
||||
# changelog header
|
||||
header = """
|
||||
# What's Changed
|
||||
"""
|
||||
# template for the changelog body
|
||||
# https://tera.netlify.app/docs/#introduction
|
||||
body = """
|
||||
{% for group, commits in commits | group_by(attribute="group") %}\
|
||||
### {{ group | split(pat="$") | last | upper_first }}
|
||||
{% for commit in commits
|
||||
| filter(attribute="scope")
|
||||
| sort(attribute="scope") %}
|
||||
- **{{commit.scope}}**: {{ commit.message | upper_first | trim }} | [{{ commit.id | truncate(length=7, end="") }}]({{ commit.id }})\
|
||||
{%- if commit.breaking %}
|
||||
{% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}}
|
||||
{%- endif -%}
|
||||
|
||||
{%- endfor -%}
|
||||
{%- for commit in commits %}
|
||||
{%- if commit.scope -%}
|
||||
{% else -%}
|
||||
{% raw %}\n{% endraw %}\
|
||||
- {{ commit.message | upper_first | trim }} | [{{ commit.id | truncate(length=7, end="") }}]({{ commit.id }})\
|
||||
{%- if commit.breaking %}
|
||||
{% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}}
|
||||
{%- endif -%}
|
||||
|
||||
{% endif -%}
|
||||
{% endfor -%}
|
||||
{% raw %}\n{% endraw %}
|
||||
{% endfor %}\n\
|
||||
"""
|
||||
# remove the leading and trailing whitespaces from the template
|
||||
trim = true
|
||||
# changelog footer
|
||||
footer = """
|
||||
"""
|
||||
|
||||
[git]
|
||||
# allow only conventional commits
|
||||
# https://www.conventionalcommits.org
|
||||
conventional_commits = true
|
||||
filter_unconventional = true
|
||||
# regex for parsing and grouping commits
|
||||
commit_parsers = [
|
||||
{ message = "^docs\\(changelog\\):", group = "Changelog", skip = true}, # Old redundant commits
|
||||
{ message = "^chore\\(changelog\\): update changelog", group = "Changelog", skip = true}, # Old redundant commits
|
||||
{ message = "^chore: push version number to", group = "9$Other", skip = true}, # Old redundant commits
|
||||
{ message = "^feat(\\(.*\\))?:", group = "1$Features"},
|
||||
{ message = "^feature(\\(.*\\))?:", group = "1$Features"},
|
||||
{ message = "^fix(\\(.*\\))?:", group = "2$Bug Fixes and Improvements"},
|
||||
{ message = "^docs(\\(.*\\))?:", group = "7$Documentation"},
|
||||
{ message = "^perf(\\(.*\\))?:", group = "3$Performance"},
|
||||
{ message = "^refactor(\\(.*\\))?:", group = "4$Refactor"},
|
||||
{ message = "^style(\\(.*\\))?:", group = "5$Styling"},
|
||||
{ message = "^test(\\(.*\\))?:", group = "9$Other"},
|
||||
{ message = "^locale(\\(.*\\))?:", group = "6$Localization"},
|
||||
{ message = "^chore(\\(.*\\))?:", group = "9$Other"},
|
||||
{ body = ".*security", group = "Security"},
|
||||
]
|
||||
# filter out the commits that are not matched by commit parsers
|
||||
filter_commits = true
|
||||
ignore_tags="v*-(beta|rc)*"
|
||||
# glob pattern for matching git tags
|
||||
tag_pattern = "v[0-9]*"
|
||||
+14
-14
@@ -17,7 +17,7 @@ body = """
|
||||
## [unreleased]
|
||||
{% endif %}\
|
||||
{% for group, commits in commits | group_by(attribute="group") %}\
|
||||
### {{ group | upper_first }}
|
||||
### {{ group | split(pat="$") | last | upper_first }}
|
||||
{% for commit in commits
|
||||
| filter(attribute="scope")
|
||||
| sort(attribute="scope") %}
|
||||
@@ -25,7 +25,6 @@ body = """
|
||||
{%- if commit.breaking %}
|
||||
{% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}}
|
||||
{%- endif -%}
|
||||
|
||||
{%- endfor -%}
|
||||
{%- for commit in commits %}
|
||||
{%- if commit.scope -%}
|
||||
@@ -35,7 +34,6 @@ body = """
|
||||
{%- if commit.breaking %}
|
||||
{% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}}
|
||||
{%- endif -%}
|
||||
|
||||
{% endif -%}
|
||||
{% endfor -%}
|
||||
{% raw %}\n{% endraw %}
|
||||
@@ -55,16 +53,18 @@ filter_unconventional = false
|
||||
# regex for parsing and grouping commits
|
||||
commit_parsers = [
|
||||
{ message = "^docs\\(changelog\\):", group = "Changelog", skip = true}, # Old redundant commits
|
||||
{ message = "^feat(\\(.*\\))?:", group = "Features"},
|
||||
{ message = "^feature(\\(.*\\))?:", group = "Features"},
|
||||
{ message = "^fix(\\(.*\\))?:", group = "Bug Fixes"},
|
||||
{ message = "^docs(\\(.*\\))?:", group = "Documentation"},
|
||||
{ message = "^perf(\\(.*\\))?:", group = "Performance"},
|
||||
{ message = "^refactor(\\(.*\\))?:", group = "Refactor"},
|
||||
{ message = "^style(\\(.*\\))?:", group = "Styling"},
|
||||
{ message = "^test(\\(.*\\))?:", group = "Testing"},
|
||||
{ message = "^locale(\\(.*\\))?:", group = "Localization"},
|
||||
{ message = "^chore(\\(.*\\))?:", group = "Miscellaneous Tasks", skip = true}, # chore tasks are not relevant for the changelog
|
||||
{ message = "^chore\\(changelog\\): update changelog", group = "Changelog", skip = true}, # Old redundant commits
|
||||
{ message = "^chore: push version number to", group = "9$Other", skip = true}, # Old redundant commits
|
||||
{ message = "^feat(\\(.*\\))?:", group = "1$Features"},
|
||||
{ message = "^feature(\\(.*\\))?:", group = "1$Features"},
|
||||
{ message = "^fix(\\(.*\\))?:", group = "2$Bug Fixes and Improvements"},
|
||||
{ message = "^docs(\\(.*\\))?:", group = "7$Documentation"},
|
||||
{ message = "^perf(\\(.*\\))?:", group = "3$Performance"},
|
||||
{ message = "^refactor(\\(.*\\))?:", group = "4$Refactor"},
|
||||
{ message = "^style(\\(.*\\))?:", group = "5$Styling"},
|
||||
{ message = "^test(\\(.*\\))?:", group = "9$Other"},
|
||||
{ message = "^locale(\\(.*\\))?:", group = "6$Localization"},
|
||||
{ message = "^chore(\\(.*\\))?:", group = "9$Other"},
|
||||
{ body = ".*security", group = "Security"},
|
||||
{ message = "release v2.1.2", group = "Release"}, # workaround for v2.1.2 release
|
||||
]
|
||||
@@ -72,4 +72,4 @@ commit_parsers = [
|
||||
filter_commits = true
|
||||
ignore_tags="v*-(beta|rc)*"
|
||||
# glob pattern for matching git tags
|
||||
tag_pattern = "v[0-9]*"
|
||||
tag_pattern = "v[0-9]*"
|
||||
@@ -0,0 +1,13 @@
|
||||
import { defineConfig } from 'cypress'
|
||||
|
||||
export default defineConfig({
|
||||
e2e: {
|
||||
// We've imported your old cypress plugins here.
|
||||
// You may want to clean this up later by importing these.
|
||||
setupNodeEvents(on, config) {
|
||||
// @ts-ignore
|
||||
return require('./cypress/plugins/index.js')(on, config)
|
||||
},
|
||||
baseUrl: 'http://localhost:4173',
|
||||
},
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"baseUrl": "http://localhost:4173"
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
+1
-1
@@ -21,7 +21,7 @@
|
||||
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</head>
|
||||
<body>
|
||||
<body style="background-color: #121212">
|
||||
<noscript>
|
||||
<strong>
|
||||
We're sorry but Mainsail doesn't work properly without JavaScript enabled. Please enable it to continue.
|
||||
|
||||
Generated
+4756
-3800
File diff suppressed because it is too large.
Load diff
+37
-32
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mainsail",
|
||||
"version": "2.2.0-beta2",
|
||||
"version": "2.5.1",
|
||||
"private": true,
|
||||
"decription": "a klipper web interface",
|
||||
"author": {
|
||||
@@ -14,31 +14,34 @@
|
||||
"format:check": "npm run format:base -- --check",
|
||||
"lint": "eslint --ignore-path .gitignore src",
|
||||
"lint:fix": "npm run lint -- --fix",
|
||||
"build.zip": "cd ./dist && zip -r mainsail.zip ./ && cd ..",
|
||||
"build.zip": "cd ./dist && zip -r mainsail.zip ./ -x '**.DS_Store' ./ && cd ..",
|
||||
"i18n-extract": "vue-i18n-extract use-config",
|
||||
"start": "vite preview",
|
||||
"test": "npm run build && cypress run",
|
||||
"preview": "vite preview",
|
||||
"start": "vite build && vite preview",
|
||||
"test": "start-server-and-test preview http://127.0.0.1:4173/ 'cypress run'",
|
||||
"test:ui": "cypress open",
|
||||
"changelog": "git cliff v0.0.4..$(git describe --tags $(git rev-list --tags --max-count=1)) --output CHANGELOG.md"
|
||||
},
|
||||
"dependencies": {
|
||||
"@codemirror/basic-setup": "^0.19.0",
|
||||
"@codemirror/highlight": "^0.19.6",
|
||||
"@codemirror/lang-javascript": "^0.19.3",
|
||||
"@codemirror/lang-json": "^0.19.1",
|
||||
"@codemirror/language": "^0.19.7",
|
||||
"@codemirror/legacy-modes": "^0.19.0",
|
||||
"@codemirror/search": "^0.19.4",
|
||||
"@codemirror/state": "^0.19.6",
|
||||
"@codemirror/stream-parser": "^0.19.2",
|
||||
"@codemirror/view": "^0.19.28",
|
||||
"@sindarius/gcodeviewer": "^2.1.17",
|
||||
"@types/node": "^16.11.22",
|
||||
"@codemirror/commands": "^6.0.1",
|
||||
"@codemirror/lang-css": "^6.0.0",
|
||||
"@codemirror/lang-json": "^6.0.0",
|
||||
"@codemirror/language": "^6.2.0",
|
||||
"@codemirror/legacy-modes": "^6.1.0",
|
||||
"@codemirror/search": "^6.0.0",
|
||||
"@codemirror/state": "^6.1.0",
|
||||
"@codemirror/view": "^6.0.3",
|
||||
"@jaames/iro": "^5.5.2",
|
||||
"@lezer/highlight": "^1.0.0",
|
||||
"@sindarius/gcodeviewer": "^3.2.2",
|
||||
"@types/node": "^18.0.0",
|
||||
"@types/overlayscrollbars": "^1.12.1",
|
||||
"axios": "^0.26.0",
|
||||
"axios": "^0.27.0",
|
||||
"codemirror": "^6.0.1",
|
||||
"core-js": "^3.16.0",
|
||||
"echarts": "^5.2.2",
|
||||
"echarts-gl": "^2.0.8",
|
||||
"hls.js": "^1.3.3",
|
||||
"js-sha256": "^0.9.0",
|
||||
"lodash.kebabcase": "^4.1.1",
|
||||
"lodash.throttle": "^4.1.1",
|
||||
@@ -47,8 +50,8 @@
|
||||
"regenerator-runtime": "^0.13.9",
|
||||
"resize-observer-polyfill": "^1.5.1",
|
||||
"semver": "^7.3.5",
|
||||
"uuid": "^8.3.2",
|
||||
"vue": "^2.6.14",
|
||||
"uuid": "^9.0.0",
|
||||
"vue": "^2.7.10",
|
||||
"vue-class-component": "^7.2.6",
|
||||
"vue-echarts": "^6.0.2",
|
||||
"vue-i18n": "^8.25.0",
|
||||
@@ -56,39 +59,41 @@
|
||||
"vue-meta": "^2.4.0",
|
||||
"vue-observe-visibility": "^1.0.0",
|
||||
"vue-property-decorator": "^9.1.2",
|
||||
"vue-resize": "^1.0.1",
|
||||
"vue-toast-notification": "^0.6.1",
|
||||
"vuedraggable": "^2.24.3",
|
||||
"vuetify": "^2.6.1",
|
||||
"vuetify": "^2.6.10",
|
||||
"vuex": "^3.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@intlify/vite-plugin-vue-i18n": "^2.5.0",
|
||||
"@mdi/js": "^6.5.95",
|
||||
"@mdi/js": "^7.0.0",
|
||||
"@types/file-saver": "^2.0.5",
|
||||
"@types/lodash.kebabcase": "^4.1.6",
|
||||
"@types/lodash.throttle": "^4.1.6",
|
||||
"@types/semver": "^7.3.8",
|
||||
"@types/uuid": "^8.3.1",
|
||||
"@typescript-eslint/eslint-plugin": "^5.11.0",
|
||||
"@typescript-eslint/parser": "^5.11.0",
|
||||
"@vue/composition-api": "^1.4.6",
|
||||
"@vue/eslint-config-typescript": "^10.0.0",
|
||||
"@vue/eslint-config-typescript": "^11.0.0",
|
||||
"autoprefixer": "^10.4.2",
|
||||
"cypress": "^9.5.0",
|
||||
"cypress": "^10.0.0",
|
||||
"eslint": "^8.9.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-jsonc": "^2.2.1",
|
||||
"eslint-plugin-vue": "^8.4.1",
|
||||
"eslint-plugin-vue": "^9.0.0",
|
||||
"prettier": "^2.5.1",
|
||||
"sass": "~1.32",
|
||||
"start-server-and-test": "^1.14.0",
|
||||
"typescript": "^4.5.5",
|
||||
"unplugin-vue-components": "^0.18.0",
|
||||
"vite": "^2.7.13",
|
||||
"vite-plugin-checker": "^0.4.2",
|
||||
"unplugin-vue-components": "^0.22.0",
|
||||
"vite": "^3.0.0",
|
||||
"vite-plugin-checker": "^0.5.0",
|
||||
"vite-plugin-package-version": "^1.0.2",
|
||||
"vite-plugin-pwa": "^0.11.13",
|
||||
"vite-plugin-vue2": "^1.9.3",
|
||||
"vite-plugin-pwa": "^0.13.0",
|
||||
"vite-plugin-vue2": "^2.0.1",
|
||||
"vue-debounce-decorator": "^1.0.1",
|
||||
"vue-i18n-extract": "^1.2.3",
|
||||
"vue-i18n-extract": "^2.0.7",
|
||||
"vue-router": "^3.5.2",
|
||||
"vue-template-compiler": "^2.6.14",
|
||||
"workbox-core": "^6.4.2"
|
||||
@@ -109,6 +114,6 @@
|
||||
"last 2 edge major versions"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^16"
|
||||
"node": "^16 || ^18"
|
||||
}
|
||||
}
|
||||
+5
-1
@@ -1,3 +1,7 @@
|
||||
{
|
||||
|
||||
"defaultLocale": "en",
|
||||
"hostname": null,
|
||||
"port": null,
|
||||
"instancesDB": "moonraker",
|
||||
"instances": []
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteBase /
|
||||
RewriteRule ^index\.html$ - [L]
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule . /index.html [L]
|
||||
</IfModule>
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"defaultLocale": "en",
|
||||
"hostname": null,
|
||||
"port": null,
|
||||
"instancesDB": "browser",
|
||||
"instances": []
|
||||
}
|
||||
+34
-22
@@ -21,31 +21,30 @@
|
||||
/*noinspection CssUnresolvedCustomProperty*/
|
||||
color: var(--v-btn-text-primary);
|
||||
}
|
||||
|
||||
.main-content-scrollbar {
|
||||
height: calc(var(--app-height) - 48px);
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-app dark :style="cssVars">
|
||||
<the-sidebar></the-sidebar>
|
||||
<the-topbar></the-topbar>
|
||||
<template v-if="socketIsConnected && guiIsReady">
|
||||
<the-sidebar></the-sidebar>
|
||||
<the-topbar></the-topbar>
|
||||
|
||||
<v-main id="content" :style="mainStyle">
|
||||
<overlay-scrollbars class="main-content-scrollbar">
|
||||
<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>
|
||||
</v-container>
|
||||
</overlay-scrollbars>
|
||||
</v-main>
|
||||
<the-select-printer-dialog v-if="remoteMode"></the-select-printer-dialog>
|
||||
</v-main>
|
||||
<the-update-dialog></the-update-dialog>
|
||||
<the-editor></the-editor>
|
||||
<the-timelapse-rendering-snackbar></the-timelapse-rendering-snackbar>
|
||||
<the-fullscreen-upload></the-fullscreen-upload>
|
||||
<the-upload-snackbar></the-upload-snackbar>
|
||||
<the-manual-probe-dialog />
|
||||
<the-bed-screws-dialog />
|
||||
<the-screws-tilt-adjust-dialog />
|
||||
</template>
|
||||
<the-select-printer-dialog v-else-if="instancesDB !== 'moonraker'"></the-select-printer-dialog>
|
||||
<the-connecting-dialog v-else></the-connecting-dialog>
|
||||
<the-update-dialog></the-update-dialog>
|
||||
<the-editor></the-editor>
|
||||
<the-timelapse-rendering-snackbar></the-timelapse-rendering-snackbar>
|
||||
<the-fullscreen-upload></the-fullscreen-upload>
|
||||
<the-upload-snackbar></the-upload-snackbar>
|
||||
</v-app>
|
||||
</template>
|
||||
|
||||
@@ -63,6 +62,11 @@ import { panelToolbarHeight, topbarHeight, navigationItemHeight } from '@/store/
|
||||
import TheTimelapseRenderingSnackbar from '@/components/TheTimelapseRenderingSnackbar.vue'
|
||||
import TheFullscreenUpload from '@/components/TheFullscreenUpload.vue'
|
||||
import TheUploadSnackbar from '@/components/TheUploadSnackbar.vue'
|
||||
import TheManualProbeDialog from '@/components/dialogs/TheManualProbeDialog.vue'
|
||||
import TheBedScrewsDialog from '@/components/dialogs/TheBedScrewsDialog.vue'
|
||||
import TheScrewsTiltAdjustDialog from '@/components/dialogs/TheScrewsTiltAdjustDialog.vue'
|
||||
|
||||
Component.registerHooks(['metaInfo'])
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
@@ -75,15 +79,23 @@ import TheUploadSnackbar from '@/components/TheUploadSnackbar.vue'
|
||||
TheSidebar,
|
||||
TheFullscreenUpload,
|
||||
TheUploadSnackbar,
|
||||
},
|
||||
metaInfo() {
|
||||
const title = this.$store.getters['getTitle']
|
||||
return {
|
||||
titleTemplate: () => title,
|
||||
}
|
||||
TheManualProbeDialog,
|
||||
TheBedScrewsDialog,
|
||||
TheScrewsTiltAdjustDialog,
|
||||
},
|
||||
})
|
||||
export default class App extends Mixins(BaseMixin) {
|
||||
public metaInfo(): any {
|
||||
let title = this.$store.getters['getTitle']
|
||||
|
||||
if (this.isPrinterPowerOff) title = this.$t('App.Titles.PrinterOff')
|
||||
|
||||
return {
|
||||
title,
|
||||
titleTemplate: '%s',
|
||||
}
|
||||
}
|
||||
|
||||
get title(): string {
|
||||
return this.$store.getters['getTitle']
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
html {
|
||||
overflow: auto;
|
||||
scrollbar-color: #6b6b6b #272727;
|
||||
}
|
||||
|
||||
body {
|
||||
@@ -58,3 +59,21 @@ body {
|
||||
.settings-tabs .v-window {
|
||||
overflow-y: auto !important;
|
||||
}
|
||||
|
||||
.editor-dialog .cm-editor {
|
||||
height: calc(100vh - 48px);
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
background-color: #272727;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background-color: #6b6b6b;
|
||||
border-radius: 7px;
|
||||
border: 4px solid #272727;
|
||||
min-width: 100px;
|
||||
min-height: 100px;
|
||||
}
|
||||
@@ -31,4 +31,5 @@ $t('App.TopCornerMenu.ConfirmationDialog.Description.ServiceStart')
|
||||
$t('App.TopCornerMenu.ConfirmationDialog.Description.ServiceRestart')
|
||||
$t('App.TopCornerMenu.ConfirmationDialog.Description.ServiceStop')
|
||||
$t('App.TopCornerMenu.ConfirmationDialog.Description.HostReboot')
|
||||
$t('App.TopCornerMenu.ConfirmationDialog.Description.HostShutdown')
|
||||
$t('App.TopCornerMenu.ConfirmationDialog.Description.HostShutdown')
|
||||
$t('Editor.Uploading')
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<v-dialog v-model="isOpen" transition="dialog-bottom-transition" max-width="600" scrollable :fullscreen="isMobile">
|
||||
<v-dialog v-model="isOpen" transition="dialog-bottom-transition" max-width="600" :fullscreen="isMobile">
|
||||
<template #activator="{ on, attrs }">
|
||||
<template v-if="inToolbar">
|
||||
<v-btn icon tile v-bind="attrs" v-on="on">
|
||||
@@ -42,7 +42,7 @@
|
||||
</v-row>
|
||||
</v-card-title>
|
||||
<v-divider></v-divider>
|
||||
<overlay-scrollbars :class="'command-help-content ' + (isMobile ? '' : 'height300')">
|
||||
<overlay-scrollbars class="command-help-content" :class="isMobile ? 'mobileHeight' : 'height300'">
|
||||
<v-card-text class="pt-0">
|
||||
<v-row>
|
||||
<v-col>
|
||||
@@ -131,5 +131,9 @@ export default class CommandHelpModal extends Mixins(BaseMixin) {
|
||||
&.height300 {
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
&.mobileHeight {
|
||||
height: calc(var(--app-height) - 48px - 73px);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -7,20 +7,11 @@
|
||||
<v-toolbar-title>
|
||||
<span class="subheading">
|
||||
<v-icon left>{{ mdiConnection }}</v-icon>
|
||||
<template v-if="connectingFailed">
|
||||
{{ $t('ConnectionDialog.Failed', { host: formatHostname }) }}
|
||||
</template>
|
||||
<template v-else-if="isConnecting">
|
||||
{{ $t('ConnectionDialog.Connecting', { host: formatHostname }) }}
|
||||
</template>
|
||||
<template v-else>{{ formatHostname }}</template>
|
||||
{{ titleText }}
|
||||
</span>
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
<v-card-text v-if="isConnecting" class="pt-5">
|
||||
<v-progress-linear color="white" indeterminate></v-progress-linear>
|
||||
</v-card-text>
|
||||
<v-card-text v-if="!isConnecting && connectingFailed" class="pt-5">
|
||||
<v-card-text v-if="connectingFailed" class="pt-5">
|
||||
<connection-status :moonraker="false"></connection-status>
|
||||
<p class="text-center mt-3">{{ $t('ConnectionDialog.CannotConnectTo', { host: formatHostname }) }}</p>
|
||||
<template v-if="counter > 2">
|
||||
@@ -36,6 +27,9 @@
|
||||
<v-btn class="primary--text" @click="reconnect">{{ $t('ConnectionDialog.TryAgain') }}</v-btn>
|
||||
</div>
|
||||
</v-card-text>
|
||||
<v-card-text v-else class="pt-5">
|
||||
<v-progress-linear color="white" indeterminate></v-progress-linear>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
@@ -73,10 +67,6 @@ export default class TheConnectingDialog extends Mixins(BaseMixin) {
|
||||
return parseInt(this.port) !== 80 && this.port !== '' ? this.hostname + ':' + this.port : this.hostname
|
||||
}
|
||||
|
||||
get isConnected() {
|
||||
return this.$store.state.socket.isConnected
|
||||
}
|
||||
|
||||
get isConnecting() {
|
||||
return this.$store.state.socket.isConnecting
|
||||
}
|
||||
@@ -86,7 +76,15 @@ export default class TheConnectingDialog extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get showDialog() {
|
||||
return !this.isConnected
|
||||
return true
|
||||
}
|
||||
|
||||
get titleText() {
|
||||
if (this.connectingFailed) return this.$t('ConnectionDialog.Failed', { host: this.formatHostname })
|
||||
if (this.isConnecting) return this.$t('ConnectionDialog.Connecting', { host: this.formatHostname })
|
||||
if (!this.guiIsReady) return this.$t('ConnectionDialog.Initializing')
|
||||
|
||||
return this.formatHostname
|
||||
}
|
||||
|
||||
reconnect() {
|
||||
|
||||
+107
-26
@@ -1,5 +1,3 @@
|
||||
<style scoped></style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<v-dialog
|
||||
@@ -19,7 +17,7 @@
|
||||
v-if="restartServiceName === 'klipper'"
|
||||
text
|
||||
tile
|
||||
href="https://www.klipper3d.org/Config_Reference.html"
|
||||
:href="klipperConfigReference"
|
||||
target="_blank"
|
||||
class="d-none d-md-flex">
|
||||
<v-icon small class="mr-1">{{ mdiHelp }}</v-icon>
|
||||
@@ -35,7 +33,7 @@
|
||||
<span class="d-none d-sm-inline">{{ $t('Editor.SaveClose') }}</span>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
v-if="restartServiceName !== null"
|
||||
v-if="restartServiceNameExists"
|
||||
color="primary"
|
||||
text
|
||||
tile
|
||||
@@ -49,14 +47,12 @@
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text class="pa-0">
|
||||
<overlay-scrollbars style="height: calc(var(--app-height) - 48px)" :options="scrollbarOptions">
|
||||
<codemirror-async
|
||||
v-if="show"
|
||||
ref="editor"
|
||||
v-model="sourcecode"
|
||||
:name="filename"
|
||||
:file-extension="fileExtension"></codemirror-async>
|
||||
</overlay-scrollbars>
|
||||
<codemirror-async
|
||||
v-if="show"
|
||||
ref="editor"
|
||||
v-model="sourcecode"
|
||||
:name="filename"
|
||||
:file-extension="fileExtension"></codemirror-async>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
@@ -112,7 +108,7 @@
|
||||
<v-btn text color="primary" @click="save">
|
||||
{{ $t('Editor.SaveClose') }}
|
||||
</v-btn>
|
||||
<template v-if="restartServiceName != null">
|
||||
<template v-if="restartServiceNameExists">
|
||||
<v-btn text color="primary" @click="save(restartServiceName)">
|
||||
{{ $t('Editor.SaveRestart') }}
|
||||
</v-btn>
|
||||
@@ -126,8 +122,9 @@
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Watch } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { formatFilesize, windowBeforeUnloadFunction } from '@/plugins/helpers'
|
||||
import { capitalize, formatFilesize, windowBeforeUnloadFunction } from '@/plugins/helpers'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import { availableKlipperConfigReferenceTranslations } from '@/store/variables'
|
||||
import CodemirrorAsync from '@/components/inputs/CodemirrorAsync'
|
||||
import {
|
||||
mdiClose,
|
||||
@@ -187,6 +184,12 @@ export default class TheEditor extends Mixins(BaseMixin) {
|
||||
return this.$store.state.editor.filename ?? ''
|
||||
}
|
||||
|
||||
get filenameWithoutExtension(): string {
|
||||
if (this.filename.lastIndexOf('.')) return this.filename.slice(0, this.filename.lastIndexOf('.'))
|
||||
|
||||
return this.filename
|
||||
}
|
||||
|
||||
get fileExtension() {
|
||||
if (this.filename.lastIndexOf('.')) return this.filename.slice(this.filename.lastIndexOf('.') + 1)
|
||||
|
||||
@@ -222,28 +225,41 @@ export default class TheEditor extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get snackbarHeadline() {
|
||||
let directionUppercase = this.$t('Files.Downloading')
|
||||
if (this.loaderProgress.direction) {
|
||||
directionUppercase =
|
||||
this.loaderProgress.direction?.charAt(0).toUpperCase() + this.loaderProgress.direction?.slice(1)
|
||||
}
|
||||
let directionUppercase = this.$t('Editor.Downloading')
|
||||
if (this.loaderProgress.direction) directionUppercase = capitalize(this.loaderProgress.direction)
|
||||
|
||||
return this.$t('Editor.' + directionUppercase)
|
||||
return this.$t(`Editor.${directionUppercase}`)
|
||||
}
|
||||
|
||||
get availableServices() {
|
||||
return this.$store.state.server.system_info?.available_services ?? []
|
||||
}
|
||||
|
||||
get restartServiceName() {
|
||||
if (!this.isWriteable) return null
|
||||
if (['printing', 'paused'].includes(this.printer_state)) return null
|
||||
|
||||
if (this.filename === 'moonraker.conf') return 'moonraker'
|
||||
else if (this.filename === 'webcam.conf') return 'webcamd'
|
||||
else if (this.filename.startsWith('webcam') && this.filename.endsWith('.txt')) return 'webcamd'
|
||||
else if (this.filename.startsWith('mooncord') && this.filename.endsWith('.json')) return 'mooncord'
|
||||
else if (this.filename.endsWith('.cfg')) return 'klipper'
|
||||
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'
|
||||
|
||||
if (this.fileExtension === 'cfg') return 'klipper'
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
get restartServiceNameExists() {
|
||||
if (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
|
||||
}
|
||||
@@ -253,13 +269,29 @@ export default class TheEditor extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get title() {
|
||||
const title = `${this.filepath}/${this.filename}`
|
||||
const title = this.filepath ? `${this.filepath}/${this.filename}` : this.filename
|
||||
|
||||
if (!this.isWriteable) return `${title} (${this.$t('Editor.FileReadOnly')})`
|
||||
|
||||
return `${title} ${this.changedOutput}`
|
||||
}
|
||||
|
||||
get currentLanguage() {
|
||||
return this.$store.state.gui.general.language
|
||||
}
|
||||
|
||||
get klipperConfigReference(): string {
|
||||
const currentLanguage = this.currentLanguage
|
||||
const translations = availableKlipperConfigReferenceTranslations
|
||||
let url = 'https://www.klipper3d.org/Config_Reference.html'
|
||||
|
||||
if (translations.includes(currentLanguage)) {
|
||||
url = `https://www.klipper3d.org/${currentLanguage}/Config_Reference.html`
|
||||
}
|
||||
|
||||
return url
|
||||
}
|
||||
|
||||
cancelDownload() {
|
||||
this.$store.dispatch('editor/cancelLoad')
|
||||
}
|
||||
@@ -301,3 +333,52 @@ export default class TheEditor extends Mixins(BaseMixin) {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .ͼ1 .cm-panel.cm-search *:focus:not(.focus-visible) {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
::v-deep .ͼ1 .cm-panel.cm-search input[type='checkbox'] {
|
||||
width: 2.2em;
|
||||
height: 2.2em;
|
||||
color: dodgerblue;
|
||||
vertical-align: middle;
|
||||
-webkit-appearance: none;
|
||||
border: 10px;
|
||||
outline: 0;
|
||||
flex-grow: 0;
|
||||
border-radius: 4px;
|
||||
background: var(--v-toolbar-base);
|
||||
transition: background 300ms;
|
||||
cursor: pointer;
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
|
||||
/* Pseudo element for check styling */
|
||||
|
||||
::v-deep .ͼ1 .cm-panel.cm-search input[type='checkbox']::before {
|
||||
content: '';
|
||||
color: transparent;
|
||||
display: block;
|
||||
width: inherit;
|
||||
height: inherit;
|
||||
border-radius: inherit;
|
||||
border: 2px;
|
||||
background-color: transparent;
|
||||
background-size: contain;
|
||||
box-shadow: inset 0 0 0 1px #ccd3d8;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
/* Checked */
|
||||
|
||||
::v-deep .ͼ1 .cm-panel.cm-search input[type='checkbox']:checked {
|
||||
background-color: var(--color-primary);
|
||||
}
|
||||
|
||||
::v-deep .ͼ1 .cm-panel.cm-search input[type='checkbox']:checked::before {
|
||||
box-shadow: none;
|
||||
background-color: var(--color-primary);
|
||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E %3Cpath d='M15.88 8.29L10 14.17l-1.88-1.88a.996.996 0 1 0-1.41 1.41l2.59 2.59c.39.39 1.02.39 1.41 0L17.3 9.7a.996.996 0 0 0 0-1.41c-.39-.39-1.03-.39-1.42 0z' fill='%23fffff'/%3E %3C/svg%3E");
|
||||
}
|
||||
</style>
|
||||
@@ -32,12 +32,12 @@
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
<template v-if="isConnecting">
|
||||
<template v-if="isConnecting || (isConnected && !guiIsReady)">
|
||||
<v-card-text>
|
||||
<v-progress-linear color="primary" indeterminate></v-progress-linear>
|
||||
</v-card-text>
|
||||
</template>
|
||||
<template v-else-if="!isConnecting && connectingFailed">
|
||||
<template v-else-if="connectingFailed">
|
||||
<v-card-text>
|
||||
<p>
|
||||
{{
|
||||
@@ -54,7 +54,7 @@
|
||||
</div>
|
||||
</v-card-text>
|
||||
</template>
|
||||
<template v-else-if="!isConnecting && dialogAddPrinter.bool">
|
||||
<template v-else-if="dialogAddPrinter.bool">
|
||||
<v-form v-model="addPrinterValid" @submit.prevent="addPrinter">
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
@@ -92,7 +92,7 @@
|
||||
</v-card-actions>
|
||||
</v-form>
|
||||
</template>
|
||||
<template v-else-if="!isConnecting && dialogEditPrinter.bool">
|
||||
<template v-else-if="dialogEditPrinter.bool">
|
||||
<v-form v-model="editPrinterValid" @submit.prevent="updatePrinter">
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
@@ -173,29 +173,38 @@
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-if="showCorsInfo">
|
||||
<v-col>
|
||||
<p v-if="printers.length === 0" class="text-center">
|
||||
{{ $t('SelectPrinterDialog.Hello') }}
|
||||
</p>
|
||||
<p class="text-center">
|
||||
{{ $t('SelectPrinterDialog.RememberToAdd', { cors: currentUrl }) }}
|
||||
</p>
|
||||
<p class="text-center mb-0">
|
||||
{{ $t('SelectPrinterDialog.YouCanFindMore') }}
|
||||
<br />
|
||||
<a href="https://docs.mainsail.xyz/remotemode" target="_blank">
|
||||
https://docs.mainsail.xyz/remotemode
|
||||
</a>
|
||||
.
|
||||
</p>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-if="canAddPrinters">
|
||||
<template v-if="instancesDB === 'browser'">
|
||||
<v-row v-if="showCorsInfo">
|
||||
<v-col>
|
||||
<p v-if="printers.length === 0" class="text-center">
|
||||
{{ $t('SelectPrinterDialog.Hello') }}
|
||||
</p>
|
||||
<p class="text-center">
|
||||
{{ $t('SelectPrinterDialog.RememberToAdd', { cors: currentUrl }) }}
|
||||
</p>
|
||||
<p class="text-center mb-0">
|
||||
{{ $t('SelectPrinterDialog.YouCanFindMore') }}
|
||||
<br />
|
||||
<a href="https://docs.mainsail.xyz/remotemode" target="_blank">
|
||||
https://docs.mainsail.xyz/remotemode
|
||||
</a>
|
||||
.
|
||||
</p>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="text-center mt-0">
|
||||
<v-btn text color="primary" @click="createPrinter">
|
||||
{{ $t('SelectPrinterDialog.AddPrinter') }}
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
<v-row v-else-if="instancesDB === 'json' && printers.length === 0">
|
||||
<v-col class="text-center mt-0">
|
||||
<v-btn text color="primary" @click="createPrinter">
|
||||
{{ $t('SelectPrinterDialog.AddPrinter') }}
|
||||
</v-btn>
|
||||
<p class="text-center">
|
||||
{{ $t('SelectPrinterDialog.AddPrintersToJson') }}
|
||||
</p>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
@@ -254,7 +263,7 @@ export default class TheSelectPrinterDialog extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get canAddPrinters() {
|
||||
return this.$store.state.configInstances.length === 0
|
||||
return this.instancesDB !== 'json'
|
||||
}
|
||||
|
||||
get protocol() {
|
||||
@@ -290,7 +299,7 @@ export default class TheSelectPrinterDialog extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get showDialog() {
|
||||
return !this.isConnected
|
||||
return !this.isConnected || (this.isConnected && !this.guiIsReady)
|
||||
}
|
||||
|
||||
get currentUrl() {
|
||||
@@ -316,6 +325,7 @@ export default class TheSelectPrinterDialog extends Mixins(BaseMixin) {
|
||||
if (this.dialogAddPrinter.bool) return this.$t('SelectPrinterDialog.AddPrinter')
|
||||
else if (this.dialogEditPrinter.bool) return this.$t('SelectPrinterDialog.EditPrinter')
|
||||
else if (this.isConnecting) return this.$t('SelectPrinterDialog.Connecting', { host: this.formatHostname })
|
||||
else if (this.isConnected && !this.guiIsReady) return this.$t('ConnectionDialog.Initializing')
|
||||
else if (this.connectingFailed)
|
||||
return this.$t('SelectPrinterDialog.ConnectionFailed', { host: this.formatHostname })
|
||||
else return this.$t('SelectPrinterDialog.SelectPrinter')
|
||||
|
||||
@@ -97,7 +97,9 @@ import {
|
||||
mdiTune,
|
||||
mdiVideo3d,
|
||||
mdiWebcam,
|
||||
mdiDipSwitch,
|
||||
} from '@mdi/js'
|
||||
import SettingsMiscellaneousTab from '@/components/settings/SettingsMiscellaneousTab.vue'
|
||||
@Component({
|
||||
components: {
|
||||
Panel,
|
||||
@@ -113,6 +115,7 @@ import {
|
||||
SettingsGCodeViewerTab,
|
||||
SettingsEditorTab,
|
||||
SettingsTimelapseTab,
|
||||
SettingsMiscellaneousTab,
|
||||
},
|
||||
})
|
||||
export default class TheSettingsMenu extends Mixins(BaseMixin) {
|
||||
@@ -186,6 +189,11 @@ export default class TheSettingsMenu extends Mixins(BaseMixin) {
|
||||
name: 'editor',
|
||||
title: this.$t('Settings.EditorTab.Editor'),
|
||||
},
|
||||
{
|
||||
icon: mdiDipSwitch,
|
||||
name: 'miscellaneous',
|
||||
title: this.$t('Settings.MiscellaneousTab.Miscellaneous'),
|
||||
},
|
||||
]
|
||||
|
||||
if (this.moonrakerComponents.includes('timelapse')) {
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
<template #append>
|
||||
<v-list-item class="small-list-item mb-2">
|
||||
<v-list-item-icon class="menu-item-icon">
|
||||
<about-modal></about-modal>
|
||||
<about-dialog></about-dialog>
|
||||
</v-list-item-icon>
|
||||
</v-list-item>
|
||||
</template>
|
||||
@@ -144,7 +144,7 @@ import { Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { PrinterStateKlipperConfig } from '@/store/printer/types'
|
||||
import TheSelectPrinterDialog from '@/components/TheSelectPrinterDialog.vue'
|
||||
import AboutModal from '@/components/modals/AboutModal.vue'
|
||||
import AboutDialog from '@/components/dialogs/AboutDialog.vue'
|
||||
import { navigationWidth, topbarHeight } from '@/store/variables'
|
||||
import MainsailLogo from '@/components/ui/MainsailLogo.vue'
|
||||
import { mdiViewDashboardOutline } from '@mdi/js'
|
||||
@@ -152,7 +152,7 @@ import { mdiViewDashboardOutline } from '@mdi/js'
|
||||
@Component({
|
||||
components: {
|
||||
TheSelectPrinterDialog,
|
||||
AboutModal,
|
||||
AboutDialog,
|
||||
MainsailLogo,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1,27 +1,3 @@
|
||||
<style>
|
||||
.topbar .v-toolbar__content {
|
||||
padding-top: 0 !important;
|
||||
padding-bottom: 0 !important;
|
||||
}
|
||||
</style>
|
||||
<style scoped>
|
||||
.button-min-width-auto {
|
||||
min-width: auto !important;
|
||||
}
|
||||
.topbar .v-btn {
|
||||
height: 100% !important;
|
||||
max-height: none;
|
||||
}
|
||||
.topbar .v-btn.v-btn--icon {
|
||||
width: var(--topbar-icon-btn-width) !important;
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
header.topbar {
|
||||
z-index: 8 !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<v-app-bar app elevate-on-scroll :height="topbarHeight" class="topbar pa-0" clipped-left>
|
||||
@@ -50,11 +26,11 @@
|
||||
<input
|
||||
ref="fileUploadAndStart"
|
||||
type="file"
|
||||
:accept="validGcodeExtensions.join(', ')"
|
||||
:accept="gcodeInputFileAccept.join(', ')"
|
||||
style="display: none"
|
||||
@change="uploadAndStart" />
|
||||
<v-btn
|
||||
v-if="klippyIsConnected && saveConfigPending"
|
||||
v-if="showSaveConfigButton"
|
||||
tile
|
||||
:icon="$vuetify.breakpoint.smAndDown"
|
||||
:text="$vuetify.breakpoint.mdAndUp"
|
||||
@@ -67,11 +43,7 @@
|
||||
<span class="d-none d-md-inline">{{ $t('App.TopBar.SAVE_CONFIG') }}</span>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
v-if="
|
||||
klippyIsConnected &&
|
||||
['standby', 'complete', 'cancelled'].includes(printer_state) &&
|
||||
!boolHideUploadAndPrintButton
|
||||
"
|
||||
v-if="boolShowUploadAndPrint"
|
||||
tile
|
||||
:icon="$vuetify.breakpoint.smAndDown"
|
||||
:text="$vuetify.breakpoint.mdAndUp"
|
||||
@@ -91,7 +63,7 @@
|
||||
class="button-min-width-auto px-3 emergency-button"
|
||||
:loading="loadings.includes('topbarEmergencyStop')"
|
||||
@click="btnEmergencyStop">
|
||||
<v-icon class="mr-md-2">{{ mdiAlertCircleOutline }}</v-icon>
|
||||
<v-icon class="mr-md-2">{{ mdiAlertOctagonOutline }}</v-icon>
|
||||
<span class="d-none d-md-inline">{{ $t('App.TopBar.EmergencyStop') }}</span>
|
||||
</v-btn>
|
||||
<the-notification-menu></the-notification-menu>
|
||||
@@ -112,10 +84,10 @@
|
||||
</v-snackbar>
|
||||
<v-dialog v-model="showEmergencyStopDialog" width="400" :fullscreen="isMobile">
|
||||
<panel
|
||||
:title="$t('EmergencyStopDialog.EmergencyStop')"
|
||||
:title="$t('EmergencyStopDialog.EmergencyStop').toString()"
|
||||
toolbar-color="error"
|
||||
card-class="emergency-stop-dialog"
|
||||
:icon="mdiAlertCircleOutline"
|
||||
:icon="mdiAlertOctagonOutline"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="showEmergencyStopDialog = false">
|
||||
@@ -147,7 +119,7 @@ import PrinterSelector from '@/components/ui/PrinterSelector.vue'
|
||||
import MainsailLogo from '@/components/ui/MainsailLogo.vue'
|
||||
import TheNotificationMenu from '@/components/notifications/TheNotificationMenu.vue'
|
||||
import { topbarHeight } from '@/store/variables'
|
||||
import { mdiAlertCircleOutline, mdiContentSave, mdiFileUpload, mdiClose, mdiCloseThick } from '@mdi/js'
|
||||
import { mdiAlertOctagonOutline, mdiContentSave, mdiFileUpload, mdiClose, mdiCloseThick } from '@mdi/js'
|
||||
|
||||
type uploadSnackbar = {
|
||||
status: boolean
|
||||
@@ -173,7 +145,7 @@ type uploadSnackbar = {
|
||||
},
|
||||
})
|
||||
export default class TheTopbar extends Mixins(BaseMixin) {
|
||||
mdiAlertCircleOutline = mdiAlertCircleOutline
|
||||
mdiAlertOctagonOutline = mdiAlertOctagonOutline
|
||||
mdiContentSave = mdiContentSave
|
||||
mdiFileUpload = mdiFileUpload
|
||||
mdiClose = mdiClose
|
||||
@@ -202,6 +174,12 @@ export default class TheTopbar extends Mixins(BaseMixin) {
|
||||
fileUploadAndStart: HTMLFormElement
|
||||
}
|
||||
|
||||
get gcodeInputFileAccept() {
|
||||
if (this.isIOS) return []
|
||||
|
||||
return validGcodeExtensions
|
||||
}
|
||||
|
||||
get naviDrawer() {
|
||||
return this.$store.state.naviDrawer
|
||||
}
|
||||
@@ -210,10 +188,6 @@ export default class TheTopbar extends Mixins(BaseMixin) {
|
||||
this.$store.dispatch('setNaviDrawer', newVal)
|
||||
}
|
||||
|
||||
get validGcodeExtensions() {
|
||||
return validGcodeExtensions
|
||||
}
|
||||
|
||||
get currentPage() {
|
||||
return this.$route.fullPath
|
||||
}
|
||||
@@ -222,6 +196,20 @@ export default class TheTopbar extends Mixins(BaseMixin) {
|
||||
return this.$store.state.printer.configfile?.save_config_pending ?? false
|
||||
}
|
||||
|
||||
get hideSaveConfigForBedMash() {
|
||||
return this.$store.state.gui.uiSettings.hideSaveConfigForBedMash ?? false
|
||||
}
|
||||
|
||||
get showSaveConfigButton() {
|
||||
if (!this.klipperReadyForGui) return false
|
||||
if (!this.hideSaveConfigForBedMash) return this.saveConfigPending
|
||||
|
||||
let pendingKeys = Object.keys(this.$store.state.printer.configfile?.save_config_pending_items ?? {})
|
||||
pendingKeys = pendingKeys.filter((key: string) => !key.startsWith('bed_mesh '))
|
||||
|
||||
return pendingKeys.length > 0
|
||||
}
|
||||
|
||||
get printerName(): string {
|
||||
if (this.$store.state.gui.general.printername.length) return this.$store.state.gui.general.printername
|
||||
|
||||
@@ -248,6 +236,15 @@ export default class TheTopbar extends Mixins(BaseMixin) {
|
||||
return this.$store.state.gui.uiSettings.logo
|
||||
}
|
||||
|
||||
get boolShowUploadAndPrint() {
|
||||
return (
|
||||
this.klippyIsConnected &&
|
||||
this.existGcodesRootDirectory &&
|
||||
['standby', 'complete', 'cancelled'].includes(this.printer_state) &&
|
||||
!this.boolHideUploadAndPrintButton
|
||||
)
|
||||
}
|
||||
|
||||
btnEmergencyStop() {
|
||||
const confirmOnEmergencyStop = this.$store.state.gui.uiSettings.confirmOnEmergencyStop
|
||||
if (confirmOnEmergencyStop) {
|
||||
@@ -273,14 +270,14 @@ export default class TheTopbar extends Mixins(BaseMixin) {
|
||||
|
||||
async uploadAndStart() {
|
||||
if (this.$refs.fileUploadAndStart?.files.length) {
|
||||
this.$store.dispatch('socket/addLoading', { name: 'btnUploadAndStart' })
|
||||
await this.$store.dispatch('socket/addLoading', { name: 'btnUploadAndStart' })
|
||||
let successFiles = []
|
||||
for (const file of this.$refs.fileUploadAndStart?.files || []) {
|
||||
const result = await this.doUploadAndStart(file)
|
||||
successFiles.push(result)
|
||||
}
|
||||
|
||||
this.$store.dispatch('socket/removeLoading', { name: 'btnUploadAndStart' })
|
||||
await this.$store.dispatch('socket/removeLoading', { name: 'btnUploadAndStart' })
|
||||
for (const file of successFiles) {
|
||||
const text = this.$t('App.TopBar.UploadOfFileSuccessful', { file: file }).toString()
|
||||
this.$toast.success(text)
|
||||
@@ -344,3 +341,32 @@ export default class TheTopbar extends Mixins(BaseMixin) {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/*noinspection CssUnusedSymbol*/
|
||||
.topbar .v-toolbar__content {
|
||||
padding-top: 0 !important;
|
||||
padding-bottom: 0 !important;
|
||||
}
|
||||
</style>
|
||||
<style scoped>
|
||||
.button-min-width-auto {
|
||||
min-width: auto !important;
|
||||
}
|
||||
/*noinspection CssUnusedSymbol*/
|
||||
.topbar .v-btn {
|
||||
height: 100% !important;
|
||||
max-height: none;
|
||||
}
|
||||
/*noinspection CssUnusedSymbol*/
|
||||
.topbar .v-btn.v-btn--icon {
|
||||
/*noinspection CssUnresolvedCustomProperty*/
|
||||
width: var(--topbar-icon-btn-width) !important;
|
||||
}
|
||||
/*noinspection CssUnusedSymbol*/
|
||||
@media (min-width: 768px) {
|
||||
header.topbar {
|
||||
z-index: 8 !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<v-snackbar v-if="show" :timeout="-1" :value="true" fixed right bottom dark>
|
||||
<span v-if="maxNumber > 1" class="mr-1">({{ currentNumber }}/{{ maxNumber }})</span>
|
||||
<strong>{{ $t('Files.Uploading') + ' ' + filename }}</strong>
|
||||
<strong>{{ $t('Editor.Uploading') + ' ' + filename }}</strong>
|
||||
<br />
|
||||
{{ percent }} % @ {{ speed }}/s
|
||||
<br />
|
||||
|
||||
+5
-14
@@ -3,8 +3,9 @@
|
||||
ref="historyAllPrintStatus"
|
||||
v-observe-visibility="visibilityChanged"
|
||||
:option="chartOptions"
|
||||
:autoresize="true"
|
||||
:init-options="{ renderer: 'svg' }"
|
||||
style="height: 250px; width: 100%"></e-chart>
|
||||
style="height: 200px; width: 100%"></e-chart>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -12,13 +13,13 @@ import Component from 'vue-class-component'
|
||||
import { Mixins, Watch } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import type { ECharts } from 'echarts/core'
|
||||
import { ECBasicOption } from 'echarts/types/dist/shared'
|
||||
import { ECBasicOption } from 'echarts/types/dist/shared.d'
|
||||
import { ServerHistoryStateAllPrintStatusEntry } from '@/store/server/history/types'
|
||||
|
||||
@Component({
|
||||
components: {},
|
||||
})
|
||||
export default class HistoryAllPrintStatus extends Mixins(BaseMixin) {
|
||||
export default class HistoryAllPrintStatusChart extends Mixins(BaseMixin) {
|
||||
declare $refs: {
|
||||
historyAllPrintStatus: any
|
||||
}
|
||||
@@ -79,18 +80,12 @@ export default class HistoryAllPrintStatus extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get chart(): ECharts | null {
|
||||
return this.$refs.historyAllPrintStatus ?? null
|
||||
return this.$refs.historyAllPrintStatus?.chart ?? null
|
||||
}
|
||||
|
||||
mounted() {
|
||||
this.chartOptions.series[0].data = this.printStatusArray
|
||||
this.chart?.setOption(this.chartOptions)
|
||||
|
||||
window.addEventListener('resize', this.eventListenerResize)
|
||||
}
|
||||
|
||||
destroyed() {
|
||||
window.removeEventListener('resize', this.eventListenerResize)
|
||||
}
|
||||
|
||||
beforeDestroy() {
|
||||
@@ -114,9 +109,5 @@ export default class HistoryAllPrintStatus extends Mixins(BaseMixin) {
|
||||
visibilityChanged(isVisible: boolean) {
|
||||
if (isVisible) this.chart?.resize()
|
||||
}
|
||||
|
||||
eventListenerResize() {
|
||||
this.chart?.resize()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<v-simple-table>
|
||||
<tbody>
|
||||
<tr v-for="status in printStatusArray" :key="status.name">
|
||||
<td>{{ status.displayName }}</td>
|
||||
<td class="text-right">{{ status.value }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</v-simple-table>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Component from 'vue-class-component'
|
||||
import { Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { ServerHistoryStateAllPrintStatusEntry } from '@/store/server/history/types'
|
||||
|
||||
@Component({
|
||||
components: {},
|
||||
})
|
||||
export default class HistoryAllPrintStatusTable extends Mixins(BaseMixin) {
|
||||
get selectedJobs() {
|
||||
return this.$store.state.gui.view.history.selectedJobs ?? []
|
||||
}
|
||||
|
||||
get allPrintStatusArray() {
|
||||
return this.$store.getters['server/history/getAllPrintStatusArrayAll']
|
||||
}
|
||||
|
||||
get selectedPrintStatusArray() {
|
||||
return this.$store.getters['server/history/getSelectedPrintStatusArray']
|
||||
}
|
||||
|
||||
get printStatusArray() {
|
||||
const output: ServerHistoryStateAllPrintStatusEntry[] = []
|
||||
const orgArray = this.selectedJobs.length ? this.selectedPrintStatusArray : this.allPrintStatusArray
|
||||
|
||||
orgArray.forEach((status: ServerHistoryStateAllPrintStatusEntry) => {
|
||||
const tmp = { ...status }
|
||||
tmp.name = status.displayName
|
||||
output.push(tmp)
|
||||
})
|
||||
|
||||
return output
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -3,6 +3,7 @@
|
||||
ref="historyFilamentUsage"
|
||||
v-observe-visibility="visibilityChanged"
|
||||
:option="chartOptions"
|
||||
:autoresize="true"
|
||||
:init-options="{ renderer: 'svg' }"
|
||||
style="height: 175px; width: 100%"></e-chart>
|
||||
</template>
|
||||
@@ -109,18 +110,12 @@ export default class HistoryPrinttimeAvg extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get chart(): ECharts | null {
|
||||
return this.$refs.historyFilamentUsage ?? null
|
||||
return this.$refs.historyFilamentUsage?.chart ?? null
|
||||
}
|
||||
|
||||
mounted() {
|
||||
this.chartOptions.series[0].data = this.filamentUsageArray
|
||||
this.chart?.setOption(this.chartOptions)
|
||||
|
||||
window.addEventListener('resize', this.eventListenerResize)
|
||||
}
|
||||
|
||||
destroyed() {
|
||||
window.removeEventListener('resize', this.eventListenerResize)
|
||||
}
|
||||
|
||||
beforeDestroy() {
|
||||
@@ -144,9 +139,5 @@ export default class HistoryPrinttimeAvg extends Mixins(BaseMixin) {
|
||||
visibilityChanged(isVisible: boolean) {
|
||||
if (isVisible) this.chart?.resize()
|
||||
}
|
||||
|
||||
eventListenerResize() {
|
||||
this.chart?.resize()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -95,18 +95,12 @@ export default class HistoryPrinttimeAvg extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get chart(): ECharts | null {
|
||||
return this.$refs.historyPrinttimeAvg ?? null
|
||||
return this.$refs.historyPrinttimeAvg?.chart ?? null
|
||||
}
|
||||
|
||||
mounted() {
|
||||
this.chartOptions.series[0].data = this.printtimeAvgArray
|
||||
this.chart?.setOption(this.chartOptions)
|
||||
|
||||
window.addEventListener('resize', this.eventListenerResize)
|
||||
}
|
||||
|
||||
destroyed() {
|
||||
window.removeEventListener('resize', this.eventListenerResize)
|
||||
}
|
||||
|
||||
beforeDestroy() {
|
||||
@@ -130,9 +124,5 @@ export default class HistoryPrinttimeAvg extends Mixins(BaseMixin) {
|
||||
visibilityChanged(isVisible: boolean) {
|
||||
if (isVisible) this.chart?.resize()
|
||||
}
|
||||
|
||||
eventListenerResize() {
|
||||
this.chart?.resize()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -4,6 +4,7 @@
|
||||
v-observe-visibility="visibilityChanged"
|
||||
:option="chartOptions"
|
||||
:init-options="{ renderer: 'svg' }"
|
||||
:autoresize="true"
|
||||
style="height: 250px; width: 100%"></e-chart>
|
||||
</template>
|
||||
|
||||
@@ -15,7 +16,7 @@ import BaseMixin from '../mixins/base'
|
||||
import { PrinterTempHistoryStateSerie, PrinterTempHistoryStateSourceEntry } from '@/store/printer/tempHistory/types'
|
||||
|
||||
import type { ECharts } from 'echarts/core'
|
||||
import type { ECBasicOption } from 'echarts/types/dist/shared'
|
||||
import type { ECBasicOption } from 'echarts/types/dist/shared.d'
|
||||
import { mdiClock } from '@mdi/js'
|
||||
|
||||
interface echartsTooltipObj {
|
||||
@@ -26,8 +27,6 @@ interface echartsTooltipObj {
|
||||
components: {},
|
||||
})
|
||||
export default class TempChart extends Mixins(BaseMixin) {
|
||||
convertName = convertName
|
||||
|
||||
declare $refs: {
|
||||
tempchart: any
|
||||
}
|
||||
@@ -47,7 +46,7 @@ export default class TempChart extends Mixins(BaseMixin) {
|
||||
fontSize: '14px',
|
||||
},
|
||||
padding: 15,
|
||||
formatter: this.tooltipFormater,
|
||||
formatter: this.tooltipFormatter,
|
||||
confine: true,
|
||||
className: 'echarts-tooltip',
|
||||
position: function (pos: any, params: any, dom: any, rect: any, size: any) {
|
||||
@@ -85,6 +84,7 @@ export default class TempChart extends Mixins(BaseMixin) {
|
||||
axisLabel: {
|
||||
color: 'rgba(255, 255, 255, 0.24)',
|
||||
margin: 10,
|
||||
formatter: this.timeFormat,
|
||||
},
|
||||
},
|
||||
yAxis: [
|
||||
@@ -195,7 +195,7 @@ export default class TempChart extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get chart(): ECharts | null {
|
||||
return this.$refs.tempchart ?? null
|
||||
return this.$refs.tempchart?.chart ?? null
|
||||
}
|
||||
|
||||
get maxHistory() {
|
||||
@@ -226,21 +226,18 @@ export default class TempChart extends Mixins(BaseMixin) {
|
||||
return this.$store.getters['printer/tempHistory/getSelectedLegends']
|
||||
}
|
||||
|
||||
get timeFormat() {
|
||||
return this.hours12Format ? '{hh}:{mm}' : '{HH}:{mm}'
|
||||
}
|
||||
|
||||
mounted() {
|
||||
this.initChart()
|
||||
|
||||
window.addEventListener('resize', this.eventListenerResize)
|
||||
this.chartOptions.xAxis.axisLabel.formatter = this.timeFormat
|
||||
}
|
||||
|
||||
beforeDestroy() {
|
||||
if (typeof window === 'undefined') return
|
||||
if (this.chart) this.chart.dispose()
|
||||
|
||||
window.removeEventListener('resize', this.eventListenerResize)
|
||||
}
|
||||
|
||||
eventListenerResize() {
|
||||
this.chart?.resize()
|
||||
}
|
||||
|
||||
initChart() {
|
||||
@@ -297,21 +294,17 @@ export default class TempChart extends Mixins(BaseMixin) {
|
||||
}
|
||||
}
|
||||
|
||||
tooltipFormater(datasets: any) {
|
||||
tooltipFormatter(datasets: any) {
|
||||
let output = ''
|
||||
|
||||
const mainDatasets = datasets.filter((dataset: any) => {
|
||||
if (dataset.seriesName === 'date') return false
|
||||
if (dataset.seriesName.includes('-')) {
|
||||
if (dataset.seriesName.lastIndexOf('-') > -1) {
|
||||
const suffix = dataset.seriesName.slice(dataset.seriesName.lastIndexOf('-') + 1)
|
||||
return !['target', 'power'].includes(suffix)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
const lastIndex = dataset.seriesName.lastIndexOf('-')
|
||||
if (lastIndex === -1) return true
|
||||
|
||||
return true
|
||||
const suffix = dataset.seriesName.slice(lastIndex + 1)
|
||||
return !['target', 'power', 'speed'].includes(suffix)
|
||||
})
|
||||
if (datasets.length) {
|
||||
let outputTime = datasets[0]['axisValueLabel']
|
||||
@@ -396,5 +389,10 @@ export default class TempChart extends Mixins(BaseMixin) {
|
||||
boolDisplayPwmAxisChanged() {
|
||||
this.updateChartPwmAxis()
|
||||
}
|
||||
|
||||
@Watch('hours12Format')
|
||||
hours12FormatChanged() {
|
||||
this.chartOptions.xAxis.axisLabel.formatter = this.timeFormat
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
<template>
|
||||
<v-row :class="'ma-0 ' + entryStyle">
|
||||
<v-col class="col-auto pr-0 text--disabled console-time">{{ event.formatTime }}</v-col>
|
||||
<v-col class="col-auto pr-0 text--disabled console-time">{{ entryFormatTime }}</v-col>
|
||||
<v-col
|
||||
:class="colorConsoleMessage(event) + ' ' + 'console-message'"
|
||||
@click.capture="commandClick"
|
||||
@@ -35,12 +35,12 @@
|
||||
|
||||
<script lang="ts">
|
||||
import Component from 'vue-class-component'
|
||||
import Vue from 'vue'
|
||||
import { Prop } from 'vue-property-decorator'
|
||||
import { Mixins, Prop } from 'vue-property-decorator'
|
||||
import { ServerStateEvent } from '@/store/server/types'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
|
||||
@Component
|
||||
export default class ConsoleTableEntry extends Vue {
|
||||
export default class ConsoleTableEntry extends Mixins(BaseMixin) {
|
||||
@Prop({ required: true })
|
||||
declare readonly event: ServerStateEvent
|
||||
|
||||
@@ -48,6 +48,10 @@ export default class ConsoleTableEntry extends Vue {
|
||||
return this.$store.state.gui.console.entryStyle ?? 'default'
|
||||
}
|
||||
|
||||
get entryFormatTime() {
|
||||
return this.formatTime(this.event.date.getTime(), true)
|
||||
}
|
||||
|
||||
colorConsoleMessage(item: ServerStateEvent): string {
|
||||
if (item.message.startsWith('!! ')) return 'error--text'
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
<template>
|
||||
<v-tooltip right color="panel">
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-icon v-bind="attrs" v-on="on">
|
||||
{{ mdiHelpCircleOutline }}
|
||||
</v-icon>
|
||||
</template>
|
||||
<v-container class="version-container pa-0">
|
||||
<div><img height="12" src="/img/logo.svg" alt="mainsail-logo" /></div>
|
||||
<div>v{{ mainsailVersion }}</div>
|
||||
<div>
|
||||
<v-icon small class="moonraker-logo">{{ mdiMoonWaningCrescent }}</v-icon>
|
||||
</div>
|
||||
<div>{{ moonrakerVersion }}</div>
|
||||
<div><img height="12" src="/img/klipper.svg" class="klipper-logo" alt="klipper-logo" /></div>
|
||||
<div>{{ klipperVersion }}</div>
|
||||
</v-container>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import BaseMixin from '../mixins/base'
|
||||
import { Mixins } from 'vue-property-decorator'
|
||||
import Component from 'vue-class-component'
|
||||
import { mdiCloseThick, mdiHelpCircleOutline, mdiMoonWaningCrescent } from '@mdi/js'
|
||||
|
||||
@Component({})
|
||||
export default class AboutDialog extends Mixins(BaseMixin) {
|
||||
mdiHelpCircleOutline = mdiHelpCircleOutline
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiMoonWaningCrescent = mdiMoonWaningCrescent
|
||||
|
||||
get mainsailVersion(): string {
|
||||
return this.$store.state.packageVersion
|
||||
}
|
||||
|
||||
get klipperVersion(): string {
|
||||
return this.$store.state.printer?.software_version ?? ''
|
||||
}
|
||||
|
||||
get moonrakerVersion(): string {
|
||||
return this.$store.state.server?.moonraker_version ?? ''
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.klipper-logo {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
.moonraker-logo {
|
||||
transform: rotate(45deg);
|
||||
color: #ebc815;
|
||||
}
|
||||
.version-container {
|
||||
display: grid;
|
||||
grid-template-columns: 20px auto;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,170 @@
|
||||
<template>
|
||||
<v-dialog :value="showDialog" width="400" persistent :fullscreen="isMobile">
|
||||
<panel
|
||||
:title="$t('BedScrews.Headline').toString()"
|
||||
:icon="mdiArrowCollapseDown"
|
||||
card-class="manual_probe-dialog"
|
||||
:margin-bottom="false"
|
||||
style="overflow: hidden"
|
||||
:height="isMobile ? 0 : 548">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="sendAbort">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-text-field
|
||||
v-model="currentScrewName"
|
||||
:label="$t('BedScrews.ScrewName')"
|
||||
outlined
|
||||
dense
|
||||
clearable
|
||||
hide-details></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col cols="6">
|
||||
<v-text-field
|
||||
v-model="currentScrewOutput"
|
||||
:label="$t('BedScrews.ScrewIndex')"
|
||||
outlined
|
||||
dense
|
||||
clearable
|
||||
hide-details></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="6">
|
||||
<v-text-field
|
||||
v-model="acceptedScrewOutput"
|
||||
:label="$t('BedScrews.ScrewAccepted')"
|
||||
outlined
|
||||
dense
|
||||
clearable
|
||||
hide-details></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col>
|
||||
<p class="text-center mb-0" v-html="$t('BedScrews.Description')" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn text :loading="loadingAbort" @click="sendAbort">
|
||||
{{ $t('BedScrews.Abort') }}
|
||||
</v-btn>
|
||||
<v-btn color="primary" text :loading="loadingAdjusted" @click="sendAdjusted">
|
||||
{{ $t('BedScrews.Adjusted') }}
|
||||
</v-btn>
|
||||
<v-btn color="primary" text :loading="loadingAccept" @click="sendAccept">
|
||||
{{ $t('BedScrews.Accept') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import Responsive from '@/components/ui/Responsive.vue'
|
||||
|
||||
import { mdiArrowCollapseDown, mdiInformation, mdiCloseThick } from '@mdi/js'
|
||||
import ControlMixin from '@/components/mixins/control'
|
||||
@Component({
|
||||
components: { Panel, Responsive },
|
||||
})
|
||||
export default class TheBedScrewsDialog extends Mixins(BaseMixin, ControlMixin) {
|
||||
mdiArrowCollapseDown = mdiArrowCollapseDown
|
||||
mdiInformation = mdiInformation
|
||||
mdiCloseThick = mdiCloseThick
|
||||
|
||||
get showDialog() {
|
||||
const is_active = this.$store.state.printer.bed_screws?.is_active ?? false
|
||||
|
||||
return is_active && this.homedAxes.includes('xyz')
|
||||
}
|
||||
|
||||
get config() {
|
||||
return this.$store.state.printer.configfile?.settings?.bed_screws ?? {}
|
||||
}
|
||||
|
||||
get bed_screws_state() {
|
||||
return this.$store.state.printer.bed_screws?.state
|
||||
}
|
||||
|
||||
get current_screw() {
|
||||
return this.$store.state.printer.bed_screws?.current_screw
|
||||
}
|
||||
|
||||
get accepted_screws() {
|
||||
return this.$store.state.printer.bed_screws?.accepted_screws
|
||||
}
|
||||
|
||||
get loadingAbort() {
|
||||
return this.loadings.includes('bedScrewsAbort')
|
||||
}
|
||||
|
||||
get loadingAccept() {
|
||||
return this.loadings.includes('bedScrewsAccept')
|
||||
}
|
||||
|
||||
get loadingAdjusted() {
|
||||
return this.loadings.includes('bedScrewsAdjusted')
|
||||
}
|
||||
|
||||
get screwNames() {
|
||||
const configKeys = Object.keys(this.config)
|
||||
const screwNameKeys = configKeys.filter((name: string) => name.startsWith('screw') && name.endsWith('_name'))
|
||||
|
||||
const output: string[] = []
|
||||
screwNameKeys?.forEach((fullName: string) => {
|
||||
const index = fullName.indexOf('_')
|
||||
const number = parseInt(fullName.slice(5, index))
|
||||
|
||||
output[number - 1] = this.config[`screw${number}_name`] ?? ''
|
||||
})
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
get countScrews() {
|
||||
return this.screwNames.length
|
||||
}
|
||||
|
||||
get currentScrewName() {
|
||||
return this.screwNames[this.current_screw] ?? 'UNKNOWN'
|
||||
}
|
||||
|
||||
get currentScrewOutput() {
|
||||
return this.$t('BedScrews.ScrewOutput', { current: this.current_screw, max: this.countScrews })
|
||||
}
|
||||
|
||||
get acceptedScrewOutput() {
|
||||
return this.$t('BedScrews.ScrewOutput', { current: this.accepted_screws, max: this.countScrews })
|
||||
}
|
||||
|
||||
sendAbort() {
|
||||
const gcode = `ABORT`
|
||||
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'manualProbeAbort' })
|
||||
}
|
||||
|
||||
sendAccept() {
|
||||
const gcode = `ACCEPT`
|
||||
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'manualProbeAccept' })
|
||||
}
|
||||
|
||||
sendAdjusted() {
|
||||
const gcode = `ADJUSTED`
|
||||
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'manualProbeAccept' })
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -0,0 +1,222 @@
|
||||
<template>
|
||||
<v-dialog :value="showDialog" width="400" persistent :fullscreen="isMobile">
|
||||
<panel
|
||||
:title="$t('ManualProbe.Headline').toString()"
|
||||
:icon="mdiArrowCollapseDown"
|
||||
card-class="manual_probe-dialog"
|
||||
:margin-bottom="false"
|
||||
style="overflow: hidden"
|
||||
:height="isMobile ? 0 : 548">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="sendAbort">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-container>
|
||||
<v-row>
|
||||
<v-col class="d-flex align-center justify-center">
|
||||
<span class="text-h5">{{ z_position_lower }}</span>
|
||||
<v-icon class="mx-2">{{ mdiChevronTripleRight }}</v-icon>
|
||||
<span class="text-h4">{{ z_position }}</span>
|
||||
<v-icon class="mx-2">{{ mdiChevronTripleLeft }}</v-icon>
|
||||
<span class="text-h5">{{ z_position_upper }}</span>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="text-left">
|
||||
<v-btn class="" color="primary" @click="sendTestZ('--')">
|
||||
<v-icon small>{{ mdiMinusThick }}</v-icon>
|
||||
<v-icon small>{{ mdiMinusThick }}</v-icon>
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col class="text-left">
|
||||
<v-btn class="" color="primary" @click="sendTestZ('-')">
|
||||
<v-icon small>{{ mdiMinusThick }}</v-icon>
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col class="text-right">
|
||||
<v-btn class="" color="primary" @click="sendTestZ('+')">
|
||||
<v-icon small>{{ mdiPlusThick }}</v-icon>
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col class="text-right">
|
||||
<v-btn class="" color="primary" @click="sendTestZ('++')">
|
||||
<v-icon small>{{ mdiPlusThick }}</v-icon>
|
||||
<v-icon small>{{ mdiPlusThick }}</v-icon>
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
<sub-panel :title="$t('ManualProbe.Advanced')" sub-panel-class="manual-probe-dialog-advanced" class="mb-n2">
|
||||
<v-container>
|
||||
<v-item-group class="_btn-group">
|
||||
<v-btn
|
||||
v-for="(offset, index) in offsetsZ"
|
||||
:key="`offsetsUp-${index}`"
|
||||
small
|
||||
class="_btn-qs flex-grow-1 px-1"
|
||||
@click="sendTestZ(offset.toString())">
|
||||
<v-icon v-if="index === 0" left small class="mr-1 ml-n1">
|
||||
{{ mdiArrowExpandUp }}
|
||||
</v-icon>
|
||||
<span>+{{ offset }}</span>
|
||||
</v-btn>
|
||||
</v-item-group>
|
||||
<v-item-group class="_btn-group mt-6 mt-sm-3">
|
||||
<v-btn
|
||||
v-for="(offset, index) in offsetsZ"
|
||||
:key="`offsetsDown-${index}`"
|
||||
small
|
||||
class="_btn-qs flex-grow-1 px-1"
|
||||
@click="sendTestZ((offset * -1).toString())">
|
||||
<v-icon v-if="index === 0" left small class="mr-1 ml-n1">
|
||||
{{ mdiArrowCollapseDown }}
|
||||
</v-icon>
|
||||
<span>−{{ offset }}</span>
|
||||
</v-btn>
|
||||
</v-item-group>
|
||||
</v-container>
|
||||
</sub-panel>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn text :loading="loadingAbort" @click="sendAbort">
|
||||
{{ $t('ManualProbe.Abort') }}
|
||||
</v-btn>
|
||||
<v-btn color="primary" text :loading="loadingAccept" @click="sendAccept">
|
||||
{{ $t('ManualProbe.Accept') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import Responsive from '@/components/ui/Responsive.vue'
|
||||
|
||||
import {
|
||||
mdiArrowCollapseDown,
|
||||
mdiArrowExpandUp,
|
||||
mdiInformation,
|
||||
mdiPlusThick,
|
||||
mdiMinusThick,
|
||||
mdiChevronTripleLeft,
|
||||
mdiChevronTripleRight,
|
||||
mdiCloseThick,
|
||||
} from '@mdi/js'
|
||||
@Component({
|
||||
components: { Panel, Responsive },
|
||||
})
|
||||
export default class TheManualProbeDialog extends Mixins(BaseMixin) {
|
||||
mdiArrowCollapseDown = mdiArrowCollapseDown
|
||||
mdiArrowExpandUp = mdiArrowExpandUp
|
||||
mdiInformation = mdiInformation
|
||||
mdiPlusThick = mdiPlusThick
|
||||
mdiMinusThick = mdiMinusThick
|
||||
mdiChevronTripleLeft = mdiChevronTripleLeft
|
||||
mdiChevronTripleRight = mdiChevronTripleRight
|
||||
mdiCloseThick = mdiCloseThick
|
||||
|
||||
get showDialog() {
|
||||
return this.$store.state.printer.manual_probe?.is_active ?? false
|
||||
}
|
||||
|
||||
get offsetsZ() {
|
||||
const offsets = [1, 0.1, 0.05, 0.01, 0.005]
|
||||
|
||||
return offsets.sort()
|
||||
}
|
||||
|
||||
get z_position() {
|
||||
return (this.$store.state.printer.manual_probe?.z_position ?? 0).toFixed(3)
|
||||
}
|
||||
|
||||
get z_position_lower() {
|
||||
const value = this.$store.state.printer.manual_probe?.z_position_lower ?? null
|
||||
if (value === null) return '??????'
|
||||
|
||||
return value.toFixed(3)
|
||||
}
|
||||
|
||||
get z_position_upper() {
|
||||
const value = this.$store.state.printer.manual_probe?.z_position_upper ?? null
|
||||
if (value === null) return '??????'
|
||||
|
||||
return value.toFixed(3)
|
||||
}
|
||||
|
||||
get loadingAbort() {
|
||||
return this.loadings.includes('manualProbeAbort')
|
||||
}
|
||||
|
||||
get loadingAccept() {
|
||||
return this.loadings.includes('manualProbeAccept')
|
||||
}
|
||||
|
||||
sendTestZ(offset: string) {
|
||||
const gcode = `TESTZ Z=${offset}`
|
||||
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: gcode })
|
||||
}
|
||||
|
||||
sendAbort() {
|
||||
const gcode = `ABORT`
|
||||
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'manualProbeAbort' })
|
||||
}
|
||||
|
||||
sendAccept() {
|
||||
const gcode = `ACCEPT`
|
||||
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'manualProbeAccept' })
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.v-btn-toggle {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
._btn-group {
|
||||
border-radius: 4px;
|
||||
display: inline-flex;
|
||||
flex-wrap: nowrap;
|
||||
max-width: 100%;
|
||||
min-width: 100%;
|
||||
width: 100%;
|
||||
|
||||
.v-btn {
|
||||
border-radius: 0;
|
||||
border-color: rgba(255, 255, 255, 0.12) !important;
|
||||
border-style: solid;
|
||||
border-width: thin;
|
||||
box-shadow: none;
|
||||
height: 28px;
|
||||
opacity: 0.8;
|
||||
min-width: auto !important;
|
||||
}
|
||||
|
||||
.v-btn:first-child {
|
||||
border-top-left-radius: inherit;
|
||||
border-bottom-left-radius: inherit;
|
||||
}
|
||||
|
||||
.v-btn:last-child {
|
||||
border-top-right-radius: inherit;
|
||||
border-bottom-right-radius: inherit;
|
||||
}
|
||||
|
||||
.v-btn:not(:first-child) {
|
||||
border-left-width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
._btn-qs {
|
||||
font-size: 0.8rem !important;
|
||||
font-weight: 400;
|
||||
max-height: 28px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,69 @@
|
||||
<template>
|
||||
<v-dialog :value="showDialog" width="400" persistent :fullscreen="isMobile">
|
||||
<panel
|
||||
:title="$t('ScrewsTiltAdjust.Headline').toString()"
|
||||
:icon="mdiArrowCollapseDown"
|
||||
card-class="manual_probe-dialog"
|
||||
:margin-bottom="false"
|
||||
style="overflow: hidden"
|
||||
:height="isMobile ? 0 : 548">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="clearScrewsTiltAdjust">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text v-if="error">
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-alert border="left" text type="error">{{ $t('ScrewsTiltAdjust.ErrorText') }}</v-alert>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
<v-card-text v-if="Object.keys(results).length">
|
||||
<template v-for="(result, name, index) of results">
|
||||
<v-divider v-if="index" :key="`result-divider-${name}`" class="my-1" />
|
||||
<the-screws-tilt-adjust-dialog-entry
|
||||
:key="`result-${name}-${name}`"
|
||||
:name="name"
|
||||
:result="result" />
|
||||
</template>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="primary" text @click="clearScrewsTiltAdjust">
|
||||
{{ $t('ScrewsTiltAdjust.Accept') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import Responsive from '@/components/ui/Responsive.vue'
|
||||
import SettingsRow from '@/components/settings/SettingsRow.vue'
|
||||
import { mdiArrowCollapseDown, mdiCloseThick } from '@mdi/js'
|
||||
import ControlMixin from '@/components/mixins/control'
|
||||
import TheScrewsTiltAdjustDialogEntry from '@/components/dialogs/TheScrewsTiltAdjustDialogEntry.vue'
|
||||
@Component({
|
||||
components: { TheScrewsTiltAdjustDialogEntry, Panel, Responsive, SettingsRow },
|
||||
})
|
||||
export default class TheScrewsTiltAdjustDialog extends Mixins(BaseMixin, ControlMixin) {
|
||||
mdiArrowCollapseDown = mdiArrowCollapseDown
|
||||
mdiCloseThick = mdiCloseThick
|
||||
get error() {
|
||||
return this.$store.state.printer.screws_tilt_adjust?.error ?? false
|
||||
}
|
||||
get results() {
|
||||
return this.$store.state.printer.screws_tilt_adjust?.results ?? {}
|
||||
}
|
||||
get showDialog() {
|
||||
return this.error || Object.keys(this.results).length
|
||||
}
|
||||
clearScrewsTiltAdjust() {
|
||||
this.$store.dispatch('printer/clearScrewsTiltAdjust')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,65 @@
|
||||
<template>
|
||||
<settings-row :title="outputName" :sub-title="subTitle">
|
||||
<v-chip v-if="!(is_base ?? false)" label small>
|
||||
<v-icon v-if="sign === 'CCW'" small left>{{ mdiRotateLeft }}</v-icon>
|
||||
<v-icon v-if="sign === 'CW'" small left>{{ mdiRotateRight }}</v-icon>
|
||||
{{ adjust }}
|
||||
</v-chip>
|
||||
<v-chip v-else label small>{{ $t('ScrewsTiltAdjust.Base') }}</v-chip>
|
||||
</settings-row>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import Responsive from '@/components/ui/Responsive.vue'
|
||||
import SettingsRow from '@/components/settings/SettingsRow.vue'
|
||||
import { mdiRotateLeft, mdiRotateRight, mdiCloseThick } from '@mdi/js'
|
||||
import ControlMixin from '@/components/mixins/control'
|
||||
interface ScrewsTiltAdjustResult {
|
||||
z: number
|
||||
sign?: string
|
||||
adjust?: string
|
||||
is_base: boolean
|
||||
}
|
||||
@Component({
|
||||
components: { Panel, Responsive, SettingsRow },
|
||||
})
|
||||
export default class TheScrewsTiltAdjustDialogEntry extends Mixins(BaseMixin, ControlMixin) {
|
||||
mdiRotateLeft = mdiRotateLeft
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiRotateRight = mdiRotateRight
|
||||
@Prop({ required: true }) declare readonly name: string
|
||||
@Prop({ required: true }) declare readonly result: ScrewsTiltAdjustResult
|
||||
get settings() {
|
||||
return this.$store.state.printer.configfile?.settings?.screws_tilt_adjust ?? {}
|
||||
}
|
||||
get outputName() {
|
||||
return this.settings[this.name + '_name'] ?? 'Unknown'
|
||||
}
|
||||
get coordinates() {
|
||||
return this.settings[this.name] ?? [0, 0]
|
||||
}
|
||||
get x() {
|
||||
return this.coordinates[0] ?? 0
|
||||
}
|
||||
get y() {
|
||||
return this.coordinates[1] ?? 0
|
||||
}
|
||||
get z() {
|
||||
return this.result.z.toFixed(3)
|
||||
}
|
||||
get subTitle() {
|
||||
return `(X: ${this.x}, Y: ${this.y}, Z: ${this.z})`
|
||||
}
|
||||
get sign() {
|
||||
return this.result.sign ?? ''
|
||||
}
|
||||
get adjust() {
|
||||
return this.result.adjust ?? '00:00'
|
||||
}
|
||||
get is_base() {
|
||||
return this.result.is_base ?? false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,82 @@
|
||||
<template>
|
||||
<div ref="view" class="codeview" @mouseup="mouseUp" @keydown="keyPress"></div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, PropSync, Prop, Vue, Watch } from 'vue-property-decorator'
|
||||
import { EditorView, basicSetup } from 'codemirror'
|
||||
import { EditorState } from '@codemirror/state'
|
||||
|
||||
@Component({})
|
||||
export default class CodeStream extends Vue {
|
||||
@PropSync('currentline') currentLineNumber!: number
|
||||
@Prop({ type: String, default: '' }) declare document: string
|
||||
@Prop({ type: Boolean, default: false }) declare isSimulating: boolean
|
||||
@Prop({ type: Boolean, default: false }) declare shown: boolean
|
||||
|
||||
view: EditorView | undefined = undefined
|
||||
|
||||
private mounted() {
|
||||
this.view = new EditorView({
|
||||
doc: this.document,
|
||||
extensions: [basicSetup, EditorState.readOnly.of(true)],
|
||||
parent: this.$refs['view'] as HTMLElement,
|
||||
})
|
||||
}
|
||||
|
||||
mouseUp() {
|
||||
if (this.view) {
|
||||
let line = this.view.state.doc.lineAt(this.view.state.selection.ranges[0].from)
|
||||
this.$emit('update:currentline', line.to)
|
||||
this.view.contentDOM.blur()
|
||||
this.$emit('got-focus')
|
||||
}
|
||||
}
|
||||
|
||||
keyPress() {
|
||||
if (this.view) {
|
||||
let line = this.view.state.doc.lineAt(this.view.state.selection.ranges[0].from)
|
||||
this.$emit('update:currentline', line.to)
|
||||
this.$emit('got-focus')
|
||||
}
|
||||
}
|
||||
|
||||
@Watch('document')
|
||||
documentUpdated() {
|
||||
if (this.view && this.shown) {
|
||||
this.view.dispatch({
|
||||
changes: {
|
||||
from: 0,
|
||||
to: this.view.state.doc.length,
|
||||
insert: this.document,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@Watch('currentLineNumber')
|
||||
currentlineUpdated(to: number) {
|
||||
if (this.view && this.shown) {
|
||||
let line = this.view.state.doc.lineAt(to)
|
||||
this.view.dispatch({
|
||||
selection: {
|
||||
anchor: line.from,
|
||||
head: line.from,
|
||||
},
|
||||
scrollIntoView: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/deep/ .cm-activeLine {
|
||||
background-color: #333 !important;
|
||||
}
|
||||
|
||||
.codeview {
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
@@ -1,63 +1,6 @@
|
||||
<!-- Because the viewer lives outside of the components DOM it can't be scoped -->
|
||||
<style>
|
||||
.viewer {
|
||||
width: 100%;
|
||||
height: calc(var(--app-height) - 266px);
|
||||
border: 1px solid #3f3f3f;
|
||||
}
|
||||
|
||||
.slider-autoheight,
|
||||
.slider-autoheight .v-slider {
|
||||
height: calc(var(--app-height) - 286px);
|
||||
}
|
||||
|
||||
@media (min-width: 600px) and (max-width: 959px) {
|
||||
.viewer {
|
||||
height: calc(var(--app-height) - 318px);
|
||||
}
|
||||
.slider-autoheight,
|
||||
.slider-autoheight .v-slider {
|
||||
height: calc(var(--app-height) - 338px);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 599px) {
|
||||
.viewer {
|
||||
height: calc(var(--app-height) - 356px);
|
||||
}
|
||||
.slider-autoheight,
|
||||
.slider-autoheight .v-slider {
|
||||
height: calc(var(--app-height) - 376px);
|
||||
}
|
||||
}
|
||||
|
||||
.slider-autoheight .v-slider {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.slider-autoheight .v-input__slot {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style scoped>
|
||||
.progress-text {
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
.progress-container {
|
||||
position: absolute;
|
||||
width: 80.5%;
|
||||
}
|
||||
|
||||
.disable-transition {
|
||||
transition: none !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<panel :title="$t('GCodeViewer.Title')" :icon="mdiVideo3d" card-class="gcode-viewer-panel">
|
||||
<panel :title="panelTitle" :icon="mdiVideo3d" card-class="gcode-viewer-panel" :margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn
|
||||
v-show="reloadRequired"
|
||||
@@ -75,19 +18,46 @@
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-row :class="showScrubber ? 'withScrubber' : ''">
|
||||
<v-col :cols="showGCode ? 8 : 12">
|
||||
<div ref="viewerCanvasContainer"></div>
|
||||
</v-col>
|
||||
<v-col class="col-auto pr-6">
|
||||
<v-col v-show="showGCode" cols="4">
|
||||
<div class="viewer">
|
||||
<CodeStream
|
||||
ref="gcodestream"
|
||||
:shown="showGCode"
|
||||
:currentline.sync="scrubPosition"
|
||||
:document="fileData"
|
||||
:is-simulating="!printerIsPrinting" />
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-show="showScrubber" class="scrubber">
|
||||
<v-col class="pt-0">
|
||||
<v-slider
|
||||
vertical
|
||||
:disabled="loading || !loadedFile"
|
||||
:max="maxZSlider"
|
||||
:min="0"
|
||||
:value="zSlider"
|
||||
class="slider-autoheight mt-3"
|
||||
@input="updateZSlider"></v-slider>
|
||||
v-model="scrubPosition"
|
||||
:hint="scrubPosition + '/' + scrubFileSize"
|
||||
:max="scrubFileSize"
|
||||
dense
|
||||
min="0"
|
||||
persistent-hint></v-slider>
|
||||
</v-col>
|
||||
<v-col class="col-auto pt-0 text-center">
|
||||
<v-btn class="px-2 minwidth-0" color="primary" @click="scrubPlaying = !scrubPlaying">
|
||||
<v-icon v-if="scrubPlaying">{{ mdiPause }}</v-icon>
|
||||
<v-icon v-else>{{ mdiPlay }}</v-icon>
|
||||
</v-btn>
|
||||
<v-btn class="px-2 minwidth-0 mx-3" color="primary" @click="fastForward">
|
||||
<v-icon>{{ mdiFastForward }}</v-icon>
|
||||
</v-btn>
|
||||
<v-btn-toggle v-model="scrubSpeed" class="mt-3 mt-sm-0" dense mandatory rounded>
|
||||
<v-btn :value="1">1x</v-btn>
|
||||
<v-btn :value="2">2x</v-btn>
|
||||
<v-btn :value="5">5x</v-btn>
|
||||
<v-btn :value="10">10x</v-btn>
|
||||
<v-btn :value="20">20x</v-btn>
|
||||
</v-btn-toggle>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="mt-0 d-flex align-top">
|
||||
@@ -112,7 +82,10 @@
|
||||
v-html="tracking ? mdiToggleSwitch : mdiToggleSwitchOffOutline"></v-icon>
|
||||
{{ $t('GCodeViewer.Tracking') }}
|
||||
</v-btn>
|
||||
<v-btn @click="clearLoadedFile">{{ $t('GCodeViewer.ClearLoadedFile') }}</v-btn>
|
||||
<v-btn @click="clearLoadedFile">
|
||||
<v-icon left>{{ mdiBroom }}</v-icon>
|
||||
{{ $t('GCodeViewer.ClearLoadedFile') }}
|
||||
</v-btn>
|
||||
</template>
|
||||
</v-col>
|
||||
<v-col class="col-12 col-sm-6 col-md-4">
|
||||
@@ -125,7 +98,7 @@
|
||||
hide-details
|
||||
outlined></v-select>
|
||||
</v-col>
|
||||
<v-col order-md="3" class="col-12 col-sm-6 col-md-4">
|
||||
<v-col order-md="3" class="col-12 col-sm-6 col-md-4 d-flex">
|
||||
<v-select
|
||||
v-model="renderQuality"
|
||||
:items="renderQualities"
|
||||
@@ -134,82 +107,97 @@
|
||||
dense
|
||||
hide-details
|
||||
outlined></v-select>
|
||||
<v-menu
|
||||
:offset-y="true"
|
||||
:offset-x="true"
|
||||
top
|
||||
:close-on-content-click="false"
|
||||
:title="$t('Files.SetupCurrentList')">
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-btn class="minwidth-0 px-2 ml-3" v-bind="attrs" v-on="on">
|
||||
<v-icon>{{ mdiCog }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-list>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox
|
||||
v-model="showCursor"
|
||||
class="mt-0"
|
||||
hide-details
|
||||
:label="$t('GCodeViewer.ShowToolhead')"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox
|
||||
v-model="showTravelMoves"
|
||||
class="mt-0"
|
||||
hide-details
|
||||
:label="$t('GCodeViewer.ShowTravelMoves')"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox
|
||||
v-model="showGCode"
|
||||
class="mt-0"
|
||||
hide-details
|
||||
:label="$t('GCodeViewer.ShowGCode')"></v-checkbox>
|
||||
</v-list-item>
|
||||
|
||||
<v-list-item
|
||||
v-if="loadedFile === sdCardFilePath && printing_objects.length"
|
||||
class="minHeight36">
|
||||
<v-checkbox
|
||||
v-model="showObjectSelection"
|
||||
class="mt-0"
|
||||
hide-details
|
||||
:label="$t('GCodeViewer.ShowObjectSelection')"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-divider></v-divider>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox
|
||||
v-model="hdRendering"
|
||||
class="mt-0"
|
||||
hide-details
|
||||
:label="$t('GCodeViewer.HDRendering')"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox
|
||||
v-model="forceLineRendering"
|
||||
class="mt-0"
|
||||
hide-details
|
||||
:label="$t('GCodeViewer.ForceLineRendering')"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox
|
||||
v-model="transparency"
|
||||
class="mt-0"
|
||||
hide-details
|
||||
:label="$t('GCodeViewer.Transparency')"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox
|
||||
v-model="voxelMode"
|
||||
class="mt-0"
|
||||
hide-details
|
||||
:label="$t('GCodeViewer.VoxelMode')"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox
|
||||
v-model="specularLighting"
|
||||
class="mt-0"
|
||||
hide-details
|
||||
:label="$t('GCodeViewer.SpecularLighting')"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox
|
||||
v-model="cncMode"
|
||||
class="mt-0"
|
||||
hide-details
|
||||
:label="$t('GCodeViewer.CNCMode')"></v-checkbox>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
<v-menu
|
||||
:offset-y="true"
|
||||
:offset-x="true"
|
||||
top
|
||||
:close-on-content-click="false"
|
||||
:title="$t('Files.SetupCurrentList')">
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-btn class="minwidth-0 px-2 mr-3 mt-3" v-bind="attrs" v-on="on">
|
||||
<v-icon>{{ mdiCog }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-list>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox
|
||||
v-model="showCursor"
|
||||
class="mt-0"
|
||||
hide-details
|
||||
:label="$t('GCodeViewer.ShowToolhead')"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox
|
||||
v-model="showTravelMoves"
|
||||
class="mt-0"
|
||||
hide-details
|
||||
:label="$t('GCodeViewer.ShowTravelMoves')"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
v-if="loadedFile === sdCardFilePath && printing_objects.length > 1"
|
||||
class="minHeight36">
|
||||
<v-checkbox
|
||||
v-model="showObjectSelection"
|
||||
class="mt-0"
|
||||
hide-details
|
||||
:label="$t('GCodeViewer.ShowObjectSelection')"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-divider></v-divider>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox
|
||||
v-model="hdRendering"
|
||||
class="mt-0"
|
||||
hide-details
|
||||
:label="$t('GCodeViewer.HDRendering')"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox
|
||||
v-model="forceLineRendering"
|
||||
class="mt-0"
|
||||
hide-details
|
||||
:label="$t('GCodeViewer.ForceLineRendering')"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox
|
||||
v-model="transparency"
|
||||
class="mt-0"
|
||||
hide-details
|
||||
:label="$t('GCodeViewer.Transparency')"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox
|
||||
v-model="voxelMode"
|
||||
class="mt-0"
|
||||
hide-details
|
||||
:label="$t('GCodeViewer.VoxelMode')"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox
|
||||
v-model="specularLighting"
|
||||
class="mt-0"
|
||||
hide-details
|
||||
:label="$t('GCodeViewer.SpecularLighting')"></v-checkbox>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</v-row>
|
||||
<input
|
||||
ref="fileInput"
|
||||
@@ -219,6 +207,7 @@
|
||||
type="file"
|
||||
@change="fileSelected" />
|
||||
</v-card-text>
|
||||
<resize-observer @notify="handleResize" />
|
||||
</panel>
|
||||
<v-snackbar v-model="loading" :timeout="-1" :value="true" fixed right bottom dark>
|
||||
<div>
|
||||
@@ -257,6 +246,30 @@
|
||||
</v-btn>
|
||||
</template>
|
||||
</v-snackbar>
|
||||
<v-dialog v-model="excludeObject.bool" max-width="400">
|
||||
<v-card>
|
||||
<v-toolbar flat dense>
|
||||
<v-toolbar-title>
|
||||
<span class="subheading">
|
||||
<v-icon left>{{ mdiSelectionRemove }}</v-icon>
|
||||
{{ $t('Panels.StatusPanel.ExcludeObject.ExcludeObjectHeadline') }}
|
||||
</span>
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
<v-card-text class="mt-3">
|
||||
{{ $t('Panels.StatusPanel.ExcludeObject.ExcludeObjectText', { name: excludeObject.name }) }}
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn text @click="excludeObject.bool = false">
|
||||
{{ $t('Panels.StatusPanel.ExcludeObject.Cancel') }}
|
||||
</v-btn>
|
||||
<v-btn color="primary" text @click="cancelObject">
|
||||
{{ $t('Panels.StatusPanel.ExcludeObject.ExcludeObject') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -267,6 +280,7 @@ import GCodeViewer from '@sindarius/gcodeviewer'
|
||||
import axios from 'axios'
|
||||
import { formatFilesize } from '@/plugins/helpers'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import CodeStream from '@/components/gcodeviewer/CodeStream.vue'
|
||||
import {
|
||||
mdiCameraRetake,
|
||||
mdiCog,
|
||||
@@ -275,7 +289,13 @@ import {
|
||||
mdiToggleSwitch,
|
||||
mdiToggleSwitchOffOutline,
|
||||
mdiVideo3d,
|
||||
mdiPlay,
|
||||
mdiPause,
|
||||
mdiFastForward,
|
||||
mdiBroom,
|
||||
mdiSelectionRemove,
|
||||
} from '@mdi/js'
|
||||
import { Debounce } from 'vue-debounce-decorator'
|
||||
|
||||
interface downloadSnackbar {
|
||||
status: boolean
|
||||
@@ -292,7 +312,7 @@ interface downloadSnackbar {
|
||||
|
||||
let viewer: any = null
|
||||
@Component({
|
||||
components: { Panel },
|
||||
components: { Panel, CodeStream },
|
||||
})
|
||||
export default class Viewer extends Mixins(BaseMixin) {
|
||||
/**
|
||||
@@ -305,6 +325,11 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
mdiClose = mdiClose
|
||||
mdiCog = mdiCog
|
||||
mdiVideo3d = mdiVideo3d
|
||||
mdiPlay = mdiPlay
|
||||
mdiPause = mdiPause
|
||||
mdiFastForward = mdiFastForward
|
||||
mdiBroom = mdiBroom
|
||||
mdiSelectionRemove = mdiSelectionRemove
|
||||
|
||||
formatFilesize = formatFilesize
|
||||
|
||||
@@ -317,11 +342,14 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
|
||||
private reloadRequired = false
|
||||
private fileSize = 0
|
||||
private maxZSlider = 100000
|
||||
private zSlider = this.maxZSlider
|
||||
private zSlicerHeight = 100
|
||||
private renderQuality = this.renderQualities[2]
|
||||
|
||||
private scrubPosition = 0
|
||||
private scrubPlaying = false
|
||||
private scrubSpeed = 1
|
||||
private scrubInterval: ReturnType<typeof setInterval> | undefined = undefined
|
||||
private scrubFileSize = 0
|
||||
|
||||
private downloadSnackbar: downloadSnackbar = {
|
||||
status: false,
|
||||
filename: '',
|
||||
@@ -335,6 +363,13 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
},
|
||||
}
|
||||
|
||||
private excludeObject = {
|
||||
bool: false,
|
||||
name: '',
|
||||
}
|
||||
|
||||
private fileData: string = ''
|
||||
|
||||
@Prop({ type: String, default: '', required: false }) declare filename: string
|
||||
@Ref('fileInput') declare fileInput: HTMLInputElement
|
||||
@Ref('viewerCanvasContainer') declare viewerCanvasContainer: HTMLElement
|
||||
@@ -356,10 +391,12 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
async mounted() {
|
||||
this.loadedFile = this.$store.state.gcodeviewer?.loadedFileBackup ?? null
|
||||
viewer = this.$store.state.gcodeviewer?.viewerBackup ?? null
|
||||
|
||||
await this.init()
|
||||
|
||||
window.addEventListener('resize', this.eventListenerResize)
|
||||
if (this.loadedFile !== null) this.scrubFileSize = viewer.fileSize
|
||||
if (viewer) {
|
||||
this.fileData = viewer.fileData
|
||||
}
|
||||
}
|
||||
|
||||
beforeDestroy() {
|
||||
@@ -369,11 +406,26 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
this.$store.dispatch('gcodeviewer/setViewerBackup', viewer)
|
||||
}
|
||||
|
||||
window.removeEventListener('resize', this.eventListenerResize)
|
||||
this.scrubPlaying = false
|
||||
if (this.scrubInterval) {
|
||||
clearInterval(this.scrubInterval)
|
||||
this.scrubInterval = undefined
|
||||
}
|
||||
}
|
||||
|
||||
eventListenerResize() {
|
||||
viewer?.resize()
|
||||
@Debounce(200)
|
||||
handleResize() {
|
||||
this.$nextTick(() => {
|
||||
viewer?.resize()
|
||||
})
|
||||
}
|
||||
|
||||
get panelTitle() {
|
||||
let title = this.$t('GCodeViewer.Title').toString()
|
||||
|
||||
if (this.loadedFile) title += `: ${this.loadedFile}`
|
||||
|
||||
return title
|
||||
}
|
||||
|
||||
get filePosition() {
|
||||
@@ -396,10 +448,20 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
return this.$store.state.printer.exclude_object?.objects ?? []
|
||||
}
|
||||
|
||||
@Watch('printing_objects')
|
||||
printing_objectsChanged() {
|
||||
this.refreshPrintingObjects()
|
||||
}
|
||||
|
||||
get excluded_objects() {
|
||||
return this.$store.state.printer.exclude_object?.excluded_objects ?? []
|
||||
}
|
||||
|
||||
@Watch('excluded_objects')
|
||||
excluded_objectsChanged() {
|
||||
this.refreshPrintingObjects()
|
||||
}
|
||||
|
||||
get nozzle_diameter() {
|
||||
return this.$store.state.printer.configfile?.settings?.extruder?.nozzle_diameter ?? 0.4
|
||||
}
|
||||
@@ -419,22 +481,20 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
}
|
||||
}
|
||||
|
||||
if (viewer === null) {
|
||||
await this.viewerInit(canvasElement)
|
||||
}
|
||||
if (viewer === null) await this.viewerInit(canvasElement)
|
||||
|
||||
this.registerProgressCallback()
|
||||
|
||||
if (this.$route.query?.filename && this.loadedFile !== this.$route.query?.filename?.toString()) {
|
||||
//TODO: test without sleep
|
||||
await this.sleep(1000) //Give the store a chance to initializ before loading the file.
|
||||
await this.sleep(1000) //Give the store a chance to initialize before loading the file.
|
||||
await this.loadFile(this.$route.query.filename.toString())
|
||||
}
|
||||
}
|
||||
|
||||
viewerInit(element: HTMLCanvasElement) {
|
||||
async viewerInit(element: HTMLCanvasElement) {
|
||||
viewer = new GCodeViewer(element)
|
||||
viewer.init()
|
||||
await viewer.init()
|
||||
viewer.setBackgroundColor(this.backgroundColor)
|
||||
viewer.bed.setBedColor(this.gridColor)
|
||||
viewer.setCursorVisiblity(this.showCursor)
|
||||
@@ -455,13 +515,15 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
viewer.gcodeProcessor.useHighQualityExtrusion(this.hdRendering)
|
||||
viewer.gcodeProcessor.updateForceWireMode(this.forceLineRendering)
|
||||
viewer.gcodeProcessor.updateForceWireMode(this.forceLineRendering || this.cncMode)
|
||||
viewer.gcodeProcessor.setAlpha(this.transparency)
|
||||
viewer.gcodeProcessor.setVoxelMode(this.voxelMode)
|
||||
viewer.gcodeProcessor.voxelWidth = this.voxelWidth
|
||||
viewer.gcodeProcessor.voxelHeight = this.voxelHeight
|
||||
viewer.gcodeProcessor.useSpecularColor(this.specularLighting)
|
||||
viewer.gcodeProcessor.setLiveTracking(false)
|
||||
viewer.gcodeProcessor.g1AsExtrusion = this.cncMode
|
||||
viewer.buildObjects.objectCallback = this.objectCallback
|
||||
|
||||
this.loadToolColors(this.extruderColors)
|
||||
|
||||
@@ -490,6 +552,8 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
|
||||
clearLoadedFile() {
|
||||
if (viewer) {
|
||||
this.scrubPlaying = false
|
||||
this.scrubFileSize = 0
|
||||
viewer.clearScene(true)
|
||||
this.loadedFile = null
|
||||
this.tracking = false
|
||||
@@ -503,14 +567,19 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
finishLoad() {
|
||||
this.maxZSlider = viewer.getMaxHeight() + 1
|
||||
this.zSlider = this.maxZSlider
|
||||
this.loading = false
|
||||
viewer.setCursorVisiblity(this.showCursor)
|
||||
|
||||
if (this.loadedFile === this.sdCardFilePath && this.printing_objects.length) {
|
||||
let objects: any = []
|
||||
this.refreshPrintingObjects()
|
||||
this.scrubFileSize = viewer.fileSize
|
||||
|
||||
viewer.gcodeProcessor.updateFilePosition(viewer.fileSize)
|
||||
}
|
||||
|
||||
refreshPrintingObjects() {
|
||||
let objects: any = []
|
||||
|
||||
if (this.loadedFile === this.sdCardFilePath && this.printing_objects.length) {
|
||||
this.printing_objects.forEach((object: any) => {
|
||||
const xValues = object.polygon.map((point: number[]) => point[0])
|
||||
const yValues = object.polygon.map((point: number[]) => point[1])
|
||||
@@ -522,12 +591,10 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
y: [Math.min(...yValues), Math.max(...yValues)],
|
||||
})
|
||||
})
|
||||
|
||||
viewer.buildObjects.loadObjectBoundaries(objects)
|
||||
viewer.buildObjects.showObjectSelection(this.showObjectSelection)
|
||||
}
|
||||
|
||||
viewer.gcodeProcessor.updateFilePosition(viewer.fileSize)
|
||||
viewer.buildObjects.loadObjectBoundaries(objects)
|
||||
viewer.buildObjects.showObjectSelection(this.showObjectSelection)
|
||||
}
|
||||
|
||||
async fileSelected(e: any) {
|
||||
@@ -539,6 +606,7 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
this.fileSize = blob.length
|
||||
// Do something with result
|
||||
await viewer.processFile(blob)
|
||||
this.fileData = viewer.fileData
|
||||
}
|
||||
this.finishLoad()
|
||||
})
|
||||
@@ -586,8 +654,10 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
|
||||
viewer.updateRenderQuality(this.renderQuality.value)
|
||||
await viewer.processFile(text)
|
||||
this.fileData = viewer.fileData
|
||||
this.loadingPercent = 100
|
||||
this.finishLoad()
|
||||
this.scrubFileSize = viewer.fileSize
|
||||
}
|
||||
|
||||
cancelDownload() {
|
||||
@@ -616,6 +686,7 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
this.loading = true
|
||||
this.loadingPercent = 0
|
||||
await viewer.reload()
|
||||
this.fileData = viewer.fileData
|
||||
this.loadingPercent = 100
|
||||
this.finishLoad()
|
||||
}
|
||||
@@ -658,6 +729,7 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
const offset = 350
|
||||
if (newVal > 0 && this.printerIsPrinting && this.tracking && newVal > offset) {
|
||||
viewer.gcodeProcessor.updateFilePosition(newVal - offset)
|
||||
this.scrubPosition = newVal - offset
|
||||
} else {
|
||||
viewer.gcodeProcessor.updateFilePosition(viewer.fileSize)
|
||||
}
|
||||
@@ -667,8 +739,7 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
async trackingChanged(newVal: boolean) {
|
||||
if (!viewer) return
|
||||
if (newVal) {
|
||||
//Set zSlider to max value
|
||||
this.zSlider = this.maxZSlider
|
||||
this.scrubPlaying = false
|
||||
//Force renderers reload.
|
||||
viewer.gcodeProcessor.updateFilePosition(0)
|
||||
viewer?.forceRender()
|
||||
@@ -704,6 +775,18 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'gcodeViewer.showTravelMoves', value: newVal })
|
||||
}
|
||||
|
||||
get showGCode(): boolean {
|
||||
return this.$store.state.gui.gcodeViewer.showGCode ?? false
|
||||
}
|
||||
|
||||
set showGCode(newVal: boolean) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'gcodeViewer.showGCode', value: newVal })
|
||||
if (newVal && viewer) {
|
||||
this.fileData = viewer.fileData
|
||||
}
|
||||
this.handleResize()
|
||||
}
|
||||
|
||||
@Watch('showTravelMoves')
|
||||
showTravelMovesChanged(newVal: boolean) {
|
||||
viewer?.toggleTravels(newVal)
|
||||
@@ -749,7 +832,7 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
@Watch('forceLineRendering')
|
||||
async forceLineRenderingChanged(newVal: boolean) {
|
||||
if (viewer) {
|
||||
viewer.gcodeProcessor.updateForceWireMode(newVal)
|
||||
viewer.gcodeProcessor.updateForceWireMode(newVal || this.cncMode)
|
||||
await this.reloadViewer()
|
||||
}
|
||||
}
|
||||
@@ -820,6 +903,17 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
}
|
||||
}
|
||||
|
||||
get cncMode() {
|
||||
return this.$store.state.gui.gcodeViewer.cncMode
|
||||
}
|
||||
|
||||
set cncMode(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'gcodeViewer.cncMode', value: newVal })
|
||||
viewer.gcodeProcessor.g1AsExtrusion = newVal
|
||||
viewer.gcodeProcessor.updateForceWireMode(this.forceLineRendering || newVal)
|
||||
this.reloadViewer()
|
||||
}
|
||||
|
||||
get extruderColors() {
|
||||
return this.$store.state.gui.gcodeViewer?.extruderColors ?? false
|
||||
}
|
||||
@@ -984,12 +1078,6 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
}
|
||||
}
|
||||
|
||||
@Watch('zSlider')
|
||||
zSliderChanged(newVal: number) {
|
||||
viewer?.setZClipPlane(newVal, -1)
|
||||
viewer?.forceRender()
|
||||
}
|
||||
|
||||
get progressColor() {
|
||||
return this.$store.state.gui.gcodeViewer?.progressColor ?? '#FFFFFF'
|
||||
}
|
||||
@@ -999,8 +1087,104 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
viewer?.setProgressColor(newVal)
|
||||
}
|
||||
|
||||
updateZSlider(newVal: any) {
|
||||
this.zSlider = newVal
|
||||
@Watch('scrubPlaying')
|
||||
scrubPlayingChanged(to: boolean): void {
|
||||
if (to) {
|
||||
if (this.scrubInterval) {
|
||||
clearInterval(this.scrubInterval)
|
||||
this.scrubInterval = undefined
|
||||
}
|
||||
this.scrubPlaying = true
|
||||
if (this.scrubPosition >= this.scrubFileSize) {
|
||||
this.scrubPosition = 0
|
||||
}
|
||||
|
||||
viewer.gcodeProcessor.updateFilePosition(this.scrubPosition - 30000)
|
||||
this.scrubInterval = setInterval(() => {
|
||||
this.scrubPosition += 100 * this.scrubSpeed
|
||||
viewer.gcodeProcessor.updateFilePosition(this.scrubPosition)
|
||||
viewer.simulateToolPosition()
|
||||
if (this.tracking || this.scrubPosition >= this.scrubFileSize) {
|
||||
this.scrubPlaying = false
|
||||
}
|
||||
}, 200)
|
||||
} else {
|
||||
if (this.scrubInterval) clearInterval(this.scrubInterval)
|
||||
this.scrubPlaying = false
|
||||
this.scrubInterval = undefined
|
||||
}
|
||||
}
|
||||
|
||||
get showScrubber() {
|
||||
return !this.tracking && this.scrubFileSize > 0
|
||||
}
|
||||
|
||||
@Debounce(200)
|
||||
@Watch('scrubPosition')
|
||||
updateScrubPosition(to: number): void {
|
||||
if (!this.tracking) {
|
||||
viewer.gcodeProcessor.updateFilePosition(to)
|
||||
viewer.simulateToolPosition()
|
||||
}
|
||||
}
|
||||
|
||||
fastForward(): void {
|
||||
this.scrubPosition = this.scrubFileSize
|
||||
viewer.gcodeProcessor.updateFilePosition(this.scrubPosition)
|
||||
}
|
||||
|
||||
objectCallback(metadata: any) {
|
||||
if (metadata?.cancelled === false) {
|
||||
this.excludeObject.name = metadata.name ?? 'UNKNOWN'
|
||||
this.excludeObject.bool = true
|
||||
}
|
||||
}
|
||||
|
||||
cancelObject() {
|
||||
this.$socket.emit('printer.gcode.script', { script: 'EXCLUDE_OBJECT NAME=' + this.excludeObject.name })
|
||||
this.excludeObject.bool = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Because the viewer lives outside of the components DOM it can't be scoped -->
|
||||
<style>
|
||||
.viewer {
|
||||
width: 100%;
|
||||
height: calc(var(--app-height) - 240px);
|
||||
border: 1px solid #3f3f3f;
|
||||
}
|
||||
|
||||
.withScrubber .viewer {
|
||||
height: calc(var(--app-height) - 300px);
|
||||
}
|
||||
|
||||
@media (min-width: 600px) and (max-width: 959px) {
|
||||
.viewer {
|
||||
height: calc(var(--app-height) - 295px);
|
||||
}
|
||||
|
||||
.withScrubber .viewer {
|
||||
height: calc(var(--app-height) - 360px);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 599px) {
|
||||
.viewer {
|
||||
height: calc(var(--app-height) - 340px);
|
||||
}
|
||||
|
||||
.withScrubber .viewer {
|
||||
height: calc(var(--app-height) - 340px);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style scoped>
|
||||
.scrubber {
|
||||
position: relative;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 5px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,8 +1,3 @@
|
||||
<style>
|
||||
.vue-codemirror .cm-editor {
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div class="vue-codemirror">
|
||||
<div ref="codemirror" v-observe-visibility="visibilityChanged"></div>
|
||||
@@ -14,14 +9,16 @@
|
||||
|
||||
import { Component, Mixins, Prop, Watch } from 'vue-property-decorator'
|
||||
import BaseMixin from '../mixins/base'
|
||||
import { basicSetup, EditorState } from '@codemirror/basic-setup'
|
||||
import { basicSetup } from 'codemirror'
|
||||
import { EditorView, keymap } from '@codemirror/view'
|
||||
import { EditorState } from '@codemirror/state'
|
||||
import { mainsailTheme } from '@/plugins/codemirrorTheme'
|
||||
import { StreamLanguage } from '@codemirror/stream-parser'
|
||||
import { StreamLanguage } from '@codemirror/language'
|
||||
import { klipper_config } from '@/plugins/StreamParserKlipperConfig'
|
||||
import { gcode } from '@/plugins/StreamParserGcode'
|
||||
import { EditorView, keymap } from '@codemirror/view'
|
||||
import { indentWithTab } from '@codemirror/commands'
|
||||
import { json } from '@codemirror/lang-json'
|
||||
import { css } from '@codemirror/lang-css'
|
||||
|
||||
@Component
|
||||
export default class Codemirror extends Mixins(BaseMixin) {
|
||||
@@ -98,6 +95,7 @@ export default class Codemirror extends Mixins(BaseMixin) {
|
||||
if (['cfg', 'conf'].includes(this.fileExtension)) extensions.push(StreamLanguage.define(klipper_config))
|
||||
else if (['gcode'].includes(this.fileExtension)) extensions.push(StreamLanguage.define(gcode))
|
||||
else if (['json'].includes(this.fileExtension)) extensions.push(json())
|
||||
else if (['css', 'scss', 'sass'].includes(this.fileExtension)) extensions.push(css())
|
||||
|
||||
return extensions
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
<template>
|
||||
<div>
|
||||
<div ref="picker"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop, Ref, Watch } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import iro from '@jaames/iro'
|
||||
import { IroColor } from '@irojs/iro-core'
|
||||
import { ColorPickerProps, IroColorPicker as IroCP } from '@jaames/iro/dist/ColorPicker.d'
|
||||
|
||||
@Component
|
||||
export default class ColorPicker extends Mixins(BaseMixin) {
|
||||
colorPicker: IroCP | null = null
|
||||
|
||||
@Ref('picker')
|
||||
readonly picker!: HTMLElement
|
||||
|
||||
@Prop({ type: [Object, String], default: '#ffffff' })
|
||||
readonly color!: IroColor
|
||||
|
||||
@Prop({ type: Object, default: () => ({}) })
|
||||
readonly options!: ColorPickerProps
|
||||
|
||||
@Watch('color', { deep: true })
|
||||
colorChanged(value: string) {
|
||||
if (this.colorPicker && this.colorPicker.color.rgbString !== value) {
|
||||
this.colorPicker.color.rgbString = value
|
||||
}
|
||||
}
|
||||
|
||||
get internalOptions(): ColorPickerProps {
|
||||
return {
|
||||
...this.options,
|
||||
color: this.color,
|
||||
borderWidth: 2,
|
||||
sliderSize: 16,
|
||||
}
|
||||
}
|
||||
|
||||
emitColorChange(color: IroColor) {
|
||||
this.$emit('change', color)
|
||||
this.$emit('update:color', color)
|
||||
}
|
||||
|
||||
onColorChange(color: IroColor) {
|
||||
this.emitColorChange(color)
|
||||
}
|
||||
|
||||
mounted() {
|
||||
this.colorPicker = iro.ColorPicker(this.picker, this.internalOptions)
|
||||
this.colorPicker.on('color:change', this.onColorChange)
|
||||
}
|
||||
|
||||
beforeDestroy() {
|
||||
this.colorPicker?.off('color:change', this.onColorChange)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
@@ -1,15 +1,3 @@
|
||||
<style scoped>
|
||||
.btnMacroMenu {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
|
||||
.macroWithParameters {
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-item-group class="d-inline-block">
|
||||
<v-btn
|
||||
@@ -17,20 +5,27 @@
|
||||
:color="color"
|
||||
:class="paramArray.length ? 'macroWithParameters' : ''"
|
||||
:loading="loadings.includes('macro_' + macro.name)"
|
||||
:disabled="disabled"
|
||||
@click="doSendMacro(macro.name)">
|
||||
{{ macro.name.replace(/_/g, ' ') }}
|
||||
{{ alias ? alias : macro.name.replace(/_/g, ' ') }}
|
||||
</v-btn>
|
||||
<template v-if="paramArray.length">
|
||||
<v-menu offset-y :close-on-content-click="false">
|
||||
<v-menu v-if="!isMobile" offset-y :close-on-content-click="false">
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-btn small :color="color" v-bind="attrs" class="minwidth-0 px-1 btnMacroMenu" v-on="on">
|
||||
<v-btn
|
||||
:disabled="disabled"
|
||||
:color="color"
|
||||
v-bind="attrs"
|
||||
class="minwidth-0 px-1 btnMacroMenu"
|
||||
small
|
||||
v-on="on">
|
||||
<v-icon>{{ mdiMenuDown }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card max-width="200">
|
||||
<v-card :max-width="paramsOverlayWidth">
|
||||
<v-card-text class="py-2">
|
||||
<v-row v-for="(name, key) in paramArray" :key="'param_' + key" class="my-2">
|
||||
<v-col class="py-0">
|
||||
<v-row class="my-2">
|
||||
<v-col v-for="(name, key) in paramArray" :key="'param_' + key" :cols="paramCssCols">
|
||||
<v-text-field
|
||||
v-model="params[name].value"
|
||||
:label="name"
|
||||
@@ -54,6 +49,47 @@
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-menu>
|
||||
<template v-else>
|
||||
<v-btn
|
||||
:disabled="disabled"
|
||||
:color="color"
|
||||
class="minwidth-0 px-1 btnMacroMenu"
|
||||
small
|
||||
@click="paramsDialog = true">
|
||||
<v-icon>{{ mdiMenuDown }}</v-icon>
|
||||
</v-btn>
|
||||
<v-dialog v-model="paramsDialog">
|
||||
<panel :title="macro.name" :card-class="`macro-params-mobile-${macro.name}`" :margin-bottom="0">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="paramsDialog = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col v-for="(name, key) in paramArray" :key="'param_mobile_' + key" :cols="6">
|
||||
<v-text-field
|
||||
v-model="params[name].value"
|
||||
:label="name"
|
||||
:placeholder="params[name].default"
|
||||
:persistent-placeholder="true"
|
||||
hide-details
|
||||
outlined
|
||||
dense
|
||||
clearable
|
||||
:clear-icon="mdiRefresh"
|
||||
@keyup.enter="sendWithParams"></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
<v-card-actions class="px-4 pb-4">
|
||||
<v-btn color="primary" class="text-uppercase" block @click="sendWithParams">
|
||||
{{ $t('Panels.MacrosPanel.Send') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</template>
|
||||
</template>
|
||||
</v-item-group>
|
||||
</template>
|
||||
@@ -63,7 +99,8 @@ import Component from 'vue-class-component'
|
||||
import { Mixins, Prop, Watch } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { GuiMacrosStateMacrogroupMacro } from '@/store/gui/macros/types'
|
||||
import { mdiMenuDown, mdiRefresh } from '@mdi/js'
|
||||
import { mdiCloseThick, mdiMenuDown, mdiRefresh } from '@mdi/js'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
|
||||
interface param {
|
||||
type: 'int' | 'double' | 'string' | null
|
||||
@@ -75,25 +112,59 @@ interface params {
|
||||
[key: string]: param
|
||||
}
|
||||
|
||||
@Component
|
||||
@Component({
|
||||
components: { Panel },
|
||||
})
|
||||
export default class MacroButton extends Mixins(BaseMixin) {
|
||||
/**
|
||||
* Icons
|
||||
*/
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiMenuDown = mdiMenuDown
|
||||
mdiRefresh = mdiRefresh
|
||||
|
||||
private paramArray: string[] = []
|
||||
private params: params = {}
|
||||
private paramsDialog = false
|
||||
|
||||
@Prop({ required: true })
|
||||
declare readonly macro: GuiMacrosStateMacrogroupMacro
|
||||
@Prop({ default: 'primary' }) declare readonly color: string
|
||||
|
||||
@Prop({ default: 'primary' })
|
||||
declare readonly color: string
|
||||
|
||||
@Prop({ default: null })
|
||||
declare readonly alias: string
|
||||
|
||||
@Prop({ default: false })
|
||||
declare readonly disabled: boolean
|
||||
|
||||
get klipperMacro() {
|
||||
return this.$store.getters['printer/getMacro'](this.macro.name)
|
||||
}
|
||||
|
||||
get isGcodeStyle() {
|
||||
return this.macro.name.match(/[G|M]\d{1,3}/gm)
|
||||
}
|
||||
|
||||
get paramCols() {
|
||||
if (this.isMobile) return 1
|
||||
|
||||
const cols = Math.ceil(this.paramArray.length / 5)
|
||||
|
||||
if (cols > 4) return 4
|
||||
|
||||
return cols
|
||||
}
|
||||
|
||||
get paramCssCols() {
|
||||
return 12 / this.paramCols
|
||||
}
|
||||
|
||||
get paramsOverlayWidth() {
|
||||
return 200 * this.paramCols
|
||||
}
|
||||
|
||||
@Watch('klipperMacro')
|
||||
klipperMacroChange() {
|
||||
this.refreshParams()
|
||||
@@ -103,7 +174,7 @@ export default class MacroButton extends Mixins(BaseMixin) {
|
||||
this.paramArray.splice(0, this.paramArray.length)
|
||||
this.params = {}
|
||||
|
||||
if (this.klipperMacro.params !== null) {
|
||||
if (this.klipperMacro?.params !== null) {
|
||||
Object.keys(this.klipperMacro.params).forEach((name: string) => {
|
||||
if (!name.startsWith('_')) {
|
||||
this.paramArray.push(name)
|
||||
@@ -130,8 +201,7 @@ export default class MacroButton extends Mixins(BaseMixin) {
|
||||
this.paramArray.forEach((paramname: string) => {
|
||||
if (this.params[paramname].value !== null && this.params[paramname].value !== '') {
|
||||
let tmp: string = paramname
|
||||
if (paramname.length === 1) tmp += this.params[paramname].value
|
||||
else tmp += '=' + this.params[paramname].value
|
||||
tmp += this.isGcodeStyle ? this.params[paramname].value : `=${this.params[paramname].value}`
|
||||
|
||||
params.push(tmp)
|
||||
}
|
||||
@@ -146,3 +216,15 @@ export default class MacroButton extends Mixins(BaseMixin) {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.btnMacroMenu {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
|
||||
.macroWithParameters {
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,519 @@
|
||||
<template>
|
||||
<v-container :class="containerClass">
|
||||
<v-row>
|
||||
<v-col class="pb-3">
|
||||
<v-subheader class="_light-subheader">
|
||||
<v-icon v-if="(!root || groups.length === 0) && isOn" small left @click="off">
|
||||
{{ mdiLightbulbOnOutline }}
|
||||
</v-icon>
|
||||
<v-icon v-else-if="!root || groups.length === 0" small left @click="on">
|
||||
{{ mdiLightbulbOutline }}
|
||||
</v-icon>
|
||||
<span>{{ name }}</span>
|
||||
<v-spacer></v-spacer>
|
||||
<span
|
||||
v-if="!root || groups.length === 0"
|
||||
class="_currentState"
|
||||
:style="currentStateStyle"
|
||||
@click="boolDialog = true"></span>
|
||||
</v-subheader>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<template v-if="root && groups.length">
|
||||
<miscellaneous-light v-for="group in groups" :key="group.id" :object="object" :group="group" />
|
||||
</template>
|
||||
<v-dialog v-model="boolDialog" persistent :width="400">
|
||||
<panel
|
||||
:title="name"
|
||||
:icon="mdiLightbulbOutline"
|
||||
card-class="temperature-edit-heater-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="boolDialog = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text class="pt-6">
|
||||
<template v-if="presets.length">
|
||||
<v-row>
|
||||
<v-col class="light-presets-container pt-0 d-flex flex-wrap flex-row justify-center">
|
||||
<v-tooltip v-for="preset in presets" :key="preset.id" top>
|
||||
<template #activator="{ on, attrs }">
|
||||
<div
|
||||
:style="presetStyle(preset)"
|
||||
v-bind="attrs"
|
||||
v-on="on"
|
||||
@click="usePreset(preset)"></div>
|
||||
</template>
|
||||
<span>{{ preset.name }}</span>
|
||||
</v-tooltip>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-divider class="my-3"></v-divider>
|
||||
</template>
|
||||
<v-row>
|
||||
<v-col class="text-center">
|
||||
<color-picker
|
||||
:color="colorRGB"
|
||||
:options="colorPickerOptions"
|
||||
@update:color="onColorRGBChanged" />
|
||||
<color-picker
|
||||
v-if="existWhite"
|
||||
:color="colorRGBW"
|
||||
:options="colorPickerWhiteOptions"
|
||||
class="mt-3"
|
||||
@update:color="onColorWhiteChanged" />
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-row v-if="existRed">
|
||||
<v-col>
|
||||
<number-input
|
||||
:label="$t('Panels.MiscellaneousPanel.Light.Red')"
|
||||
param="red"
|
||||
:target="redInt"
|
||||
:default-value="Math.round(object.initialRed * 255)"
|
||||
:min="0"
|
||||
:max="255"
|
||||
:dec="1"
|
||||
:step="1"
|
||||
:output-error-msg="true"
|
||||
:has-spinner="true"
|
||||
@submit="onColorInput" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-if="existGreen">
|
||||
<v-col>
|
||||
<number-input
|
||||
:label="$t('Panels.MiscellaneousPanel.Light.Green')"
|
||||
param="green"
|
||||
:target="greenInt"
|
||||
:default-value="Math.round(object.initialGreen * 255)"
|
||||
:min="0"
|
||||
:max="255"
|
||||
:dec="1"
|
||||
:step="1"
|
||||
:has-spinner="true"
|
||||
@submit="onColorInput" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-if="existBlue">
|
||||
<v-col>
|
||||
<number-input
|
||||
:label="$t('Panels.MiscellaneousPanel.Light.Blue')"
|
||||
param="blue"
|
||||
:target="blueInt"
|
||||
:default-value="Math.round(object.initialBlue * 255)"
|
||||
:min="0"
|
||||
:max="255"
|
||||
:dec="1"
|
||||
:step="1"
|
||||
:has-spinner="true"
|
||||
@submit="onColorInput" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-if="existWhite">
|
||||
<v-col>
|
||||
<number-input
|
||||
:label="$t('Panels.MiscellaneousPanel.Light.White')"
|
||||
param="white"
|
||||
:target="whiteInt"
|
||||
:default-value="Math.round(object.initialWhite * 255)"
|
||||
:min="0"
|
||||
:max="255"
|
||||
:dec="1"
|
||||
:step="1"
|
||||
:has-spinner="true"
|
||||
@submit="onColorInput" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { convertName } from '@/plugins/helpers'
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { mdiCloseThick, mdiLightbulbOutline, mdiLightbulbOnOutline } from '@mdi/js'
|
||||
import { PrinterStateLight } from '@/store/printer/types'
|
||||
import ColorPicker from '@/components/inputs/ColorPicker.vue'
|
||||
import { ColorPickerProps } from '@jaames/iro/dist/ColorPicker.d'
|
||||
import { Debounce } from 'vue-debounce-decorator'
|
||||
import iro from '@jaames/iro'
|
||||
import { IroColor } from '@irojs/iro-core'
|
||||
import { GuiMiscellaneousStateEntryLightgroup, GuiMiscellaneousStateEntryPreset } from '@/store/gui/miscellaneous/types'
|
||||
|
||||
interface ColorData {
|
||||
red: number | null
|
||||
green: number | null
|
||||
blue: number | null
|
||||
white: number | null
|
||||
}
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
ColorPicker,
|
||||
},
|
||||
})
|
||||
export default class MiscellaneousLight extends Mixins(BaseMixin) {
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiLightbulbOutline = mdiLightbulbOutline
|
||||
mdiLightbulbOnOutline = mdiLightbulbOnOutline
|
||||
|
||||
@Prop({ type: Object, required: true })
|
||||
declare object: PrinterStateLight
|
||||
|
||||
@Prop({ type: Boolean, default: false }) readonly root!: boolean
|
||||
@Prop(Object) readonly group!: GuiMiscellaneousStateEntryLightgroup | undefined
|
||||
|
||||
private boolDialog = false
|
||||
private inputValue = 0
|
||||
|
||||
get name() {
|
||||
if (this.group) return convertName(this.group.name)
|
||||
|
||||
return convertName(this.object.name)
|
||||
}
|
||||
|
||||
get colorPickerOptions() {
|
||||
let options: ColorPickerProps = {
|
||||
width: 200,
|
||||
margin: 15,
|
||||
layout: [],
|
||||
}
|
||||
|
||||
if (this.existRed) {
|
||||
// @ts-ignore
|
||||
options?.layout.push({
|
||||
component: iro.ui.Slider,
|
||||
options: {
|
||||
sliderType: 'red',
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
if (this.existGreen) {
|
||||
// @ts-ignore
|
||||
options?.layout.push({
|
||||
component: iro.ui.Slider,
|
||||
options: {
|
||||
sliderType: 'green',
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
if (this.existBlue) {
|
||||
// @ts-ignore
|
||||
options?.layout.push({
|
||||
component: iro.ui.Slider,
|
||||
options: {
|
||||
sliderType: 'blue',
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
if (this.existRed && this.existGreen && this.existBlue) {
|
||||
options.layout = [
|
||||
{
|
||||
component: iro.ui.Wheel,
|
||||
},
|
||||
{
|
||||
component: iro.ui.Slider,
|
||||
options: {
|
||||
sliderType: 'value',
|
||||
},
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
return options
|
||||
}
|
||||
|
||||
get colorPickerWhiteOptions() {
|
||||
let options: ColorPickerProps = {
|
||||
width: 200,
|
||||
margin: 15,
|
||||
layout: [
|
||||
{
|
||||
component: iro.ui.Slider,
|
||||
options: {
|
||||
sliderType: 'alpha',
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
return options
|
||||
}
|
||||
|
||||
get optionsColors() {
|
||||
let output: string[] = []
|
||||
|
||||
this.presets.forEach((preset: GuiMiscellaneousStateEntryPreset) => {
|
||||
output.push(`rgb(${preset.red}%, ${preset.green}%, ${preset.blue}%)`)
|
||||
})
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
get current() {
|
||||
const color: ColorData = {
|
||||
red: 0,
|
||||
green: 0,
|
||||
blue: 0,
|
||||
white: null,
|
||||
}
|
||||
|
||||
if (this.existWhite) color.white = 0
|
||||
if (this.object.colorData.length === 0) return color
|
||||
|
||||
const firstColorData = this.object.colorData[(this.group?.start ?? 1) - 1]
|
||||
color.red = firstColorData[0] * 255
|
||||
color.green = firstColorData[1] * 255
|
||||
color.blue = firstColorData[2] * 255
|
||||
if (this.object.colorOrder.indexOf('W') !== -1) color.white = firstColorData[3] * 255
|
||||
|
||||
return color
|
||||
}
|
||||
|
||||
get isOn() {
|
||||
return (
|
||||
(this.current.red ?? 0) +
|
||||
(this.current?.green ?? 0) +
|
||||
(this.current.blue ?? 0) +
|
||||
(this.current.white ?? 0) >
|
||||
0
|
||||
)
|
||||
}
|
||||
|
||||
get existRed() {
|
||||
return this.object.colorOrder.indexOf('R') !== -1
|
||||
}
|
||||
|
||||
get existGreen() {
|
||||
return this.object.colorOrder.indexOf('G') !== -1
|
||||
}
|
||||
|
||||
get existBlue() {
|
||||
return this.object.colorOrder.indexOf('B') !== -1
|
||||
}
|
||||
|
||||
get existWhite() {
|
||||
return this.object.colorOrder.indexOf('W') !== -1
|
||||
}
|
||||
|
||||
get currentStateStyle() {
|
||||
let output = this.colorRGB
|
||||
|
||||
if (this.current.white !== null && this.current.red == 0 && this.current.green == 0 && this.current.blue == 0)
|
||||
output = `rgb(${this.current.white * 255}, ${this.current.white * 255}, ${this.current.white * 255})`
|
||||
|
||||
return {
|
||||
'background-color': output,
|
||||
}
|
||||
}
|
||||
|
||||
get colorRGB() {
|
||||
return `rgb(${Math.round(this.current.red ?? 0)}, ${Math.round(this.current.green ?? 0)}, ${Math.round(
|
||||
this.current.blue ?? 0
|
||||
)})`
|
||||
}
|
||||
|
||||
get colorRGBW() {
|
||||
return `rgba(255, 255, 255, ${(this.current.white ?? 0) / 255})`
|
||||
}
|
||||
|
||||
get redInt() {
|
||||
return Math.round(this.current.red ?? 0)
|
||||
}
|
||||
|
||||
get greenInt() {
|
||||
return Math.round(this.current.green ?? 0)
|
||||
}
|
||||
|
||||
get blueInt() {
|
||||
return Math.round(this.current.blue ?? 0)
|
||||
}
|
||||
|
||||
get whiteInt() {
|
||||
return Math.round(this.current.white ?? 0)
|
||||
}
|
||||
|
||||
get groups() {
|
||||
return (
|
||||
this.$store.getters['gui/miscellaneous/getEntryLightgroups']({
|
||||
type: this.object.type,
|
||||
name: this.object.name,
|
||||
}) ?? []
|
||||
)
|
||||
}
|
||||
|
||||
get presets() {
|
||||
return (
|
||||
this.$store.getters['gui/miscellaneous/getEntryPresets']({
|
||||
type: this.object.type,
|
||||
name: this.object.name,
|
||||
}) ?? []
|
||||
)
|
||||
}
|
||||
|
||||
get containerClass() {
|
||||
let output = ['px-0']
|
||||
|
||||
output.push(this.root ? 'py-2' : 'pt-2 pb-0')
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
colorChanged(color: ColorData) {
|
||||
if (
|
||||
Math.round(color.red ?? 0) === Math.round(this.current.red ?? 0) &&
|
||||
Math.round(color.green ?? 0) === Math.round(this.current.green ?? 0) &&
|
||||
Math.round(color.blue ?? 0) === Math.round(this.current.blue ?? 0) &&
|
||||
Math.round(color.white ?? 0) === Math.round(this.current.white ?? 0)
|
||||
)
|
||||
return
|
||||
|
||||
const red = Math.round(((color.red ?? 0) / 255) * 10000) / 10000
|
||||
const green = Math.round(((color.green ?? 0) / 255) * 10000) / 10000
|
||||
const blue = Math.round(((color.blue ?? 0) / 255) * 10000) / 10000
|
||||
const white = Math.round(((color.white ?? 0) / 255) * 10000) / 10000
|
||||
|
||||
let gcode = `SET_LED LED="${this.object.name}" RED=${red} GREEN=${green} BLUE=${blue}`
|
||||
if (this.existWhite) gcode += ` WHITE=${white}`
|
||||
gcode += ` SYNC=0`
|
||||
|
||||
if (this.group) {
|
||||
const tmp = gcode
|
||||
|
||||
for (let i = this.group.start; i <= this.group.end; i++) {
|
||||
if (i === this.group.start) {
|
||||
gcode += ` INDEX=${i}`
|
||||
continue
|
||||
}
|
||||
|
||||
gcode += `\n${tmp} INDEX=${i}`
|
||||
}
|
||||
}
|
||||
|
||||
gcode += ` TRANSMIT=1`
|
||||
|
||||
this.$store.dispatch('server/addEvent', {
|
||||
message: gcode,
|
||||
type: 'command',
|
||||
})
|
||||
this.$socket.emit('printer.gcode.script', { script: gcode })
|
||||
}
|
||||
|
||||
@Debounce({ time: 500 })
|
||||
onColorRGBChanged(payload: IroColor) {
|
||||
const color: ColorData = {
|
||||
red: payload.red,
|
||||
green: payload.green,
|
||||
blue: payload.blue,
|
||||
white: this.current.white,
|
||||
}
|
||||
|
||||
this.colorChanged(color)
|
||||
}
|
||||
|
||||
@Debounce({ time: 500 })
|
||||
onColorWhiteChanged(payload: IroColor) {
|
||||
const color: ColorData = {
|
||||
red: this.current.red,
|
||||
green: this.current.green,
|
||||
blue: this.current.blue,
|
||||
white: this.current.white,
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
color.white = payload.alpha * 255
|
||||
|
||||
this.colorChanged(color)
|
||||
}
|
||||
|
||||
@Debounce({ time: 500 })
|
||||
onColorInput(payload: { name: string; value: number }) {
|
||||
const color: ColorData = {
|
||||
red: this.current.red,
|
||||
green: this.current.green,
|
||||
blue: this.current.blue,
|
||||
white: this.current.white,
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
color[payload.name] = payload.value
|
||||
|
||||
this.colorChanged(color)
|
||||
}
|
||||
|
||||
off() {
|
||||
const color: ColorData = {
|
||||
red: 0,
|
||||
green: 0,
|
||||
blue: 0,
|
||||
white: 0,
|
||||
}
|
||||
|
||||
this.colorChanged(color)
|
||||
}
|
||||
|
||||
on() {
|
||||
const color: ColorData = {
|
||||
red: 255,
|
||||
green: 255,
|
||||
blue: 255,
|
||||
white: 255,
|
||||
}
|
||||
|
||||
this.colorChanged(color)
|
||||
}
|
||||
|
||||
presetStyle(preset: GuiMiscellaneousStateEntryPreset) {
|
||||
if ((preset?.red ?? 0) + (preset?.green ?? 0) + (preset?.blue ?? 0) === 0 && (preset?.white ?? 0) > 0) {
|
||||
return {
|
||||
backgroundColor: `rgb(${preset.white}%, ${preset.white}%, ${preset.white}%)`,
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
backgroundColor: `rgb(${preset.red}%, ${preset.green}%, ${preset.blue}%)`,
|
||||
}
|
||||
}
|
||||
|
||||
usePreset(preset: GuiMiscellaneousStateEntryPreset) {
|
||||
const color: ColorData = { ...preset }
|
||||
|
||||
this.colorChanged(color)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
._light-subheader {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
._currentState {
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
border-radius: 50%;
|
||||
border: 1px solid lightgray;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.light-presets-container {
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.light-presets-container > div {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
@@ -1,99 +1,50 @@
|
||||
<style scoped>
|
||||
._fan-slider-subheader {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
._lock-button {
|
||||
margin-left: -6px;
|
||||
}
|
||||
|
||||
._rpm {
|
||||
padding-top: 0.2rem !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
._error-msg {
|
||||
color: #ff5252;
|
||||
font-size: 12px;
|
||||
padding: 4px 16px 2px 0;
|
||||
}
|
||||
|
||||
.fade-enter-active {
|
||||
animation: slide-in 0.15s reverse;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.fade-leave-active {
|
||||
animation: slide-in 0.15s;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
@keyframes slide-in {
|
||||
100% {
|
||||
transform: translateY(-5px);
|
||||
}
|
||||
}
|
||||
|
||||
._slider-input {
|
||||
font-size: 0.875rem;
|
||||
max-width: 5.4rem;
|
||||
margin-left: 12px;
|
||||
}
|
||||
|
||||
._slider-input >>> .v-input__slot {
|
||||
min-height: 1rem !important;
|
||||
}
|
||||
|
||||
._slider-input >>> .v-text-field__slot input {
|
||||
padding: 4px 0 4px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-container class="px-0 py-2">
|
||||
<v-row>
|
||||
<v-col :class="pwm ? 'pb-1' : 'pb-3'">
|
||||
<v-subheader class="_fan-slider-subheader">
|
||||
<v-icon
|
||||
v-if="type !== 'output_pin'"
|
||||
v-if="type === 'led' && target > 0"
|
||||
class="mr-2"
|
||||
small
|
||||
:class="'mr-2 ' + (value >= off_below && value > 0 ? 'icon-rotate' : '')">
|
||||
{{ mdiFan }}
|
||||
:retain-focus-on-click="true"
|
||||
@click="ledOff">
|
||||
{{ mdiLightbulbOnOutline }}
|
||||
</v-icon>
|
||||
<v-icon v-else-if="type === 'led'" class="mr-2" small :retain-focus-on-click="true" @click="ledOn">
|
||||
{{ mdiLightbulbOutline }}
|
||||
</v-icon>
|
||||
<v-icon v-else-if="type !== 'output_pin'" small :class="fanClasses">{{ mdiFan }}</v-icon>
|
||||
<span>{{ convertName(name) }}</span>
|
||||
<v-spacer></v-spacer>
|
||||
<small
|
||||
v-if="rpm || rpm === 0"
|
||||
:class="`mr-3 ${controllable && pwm ? '_rpm' : ''}
|
||||
${rpm === 0 && value > 0 ? 'red--text' : ''}`">
|
||||
{{ Math.round(rpm) }} RPM
|
||||
</small>
|
||||
<small v-if="rpm !== null" :class="rpmClasses">{{ Math.round(rpm ?? 0) }} RPM</small>
|
||||
<span v-if="!controllable" class="font-weight-bold">
|
||||
{{ Math.round(parseFloat(value) * 100) }} %
|
||||
</span>
|
||||
<v-icon v-if="controllable && !pwm" @click="switchOutputPin">
|
||||
{{ value ? mdiToggleSwitch : mdiToggleSwitchOffOutline }}
|
||||
</v-icon>
|
||||
<v-text-field
|
||||
v-if="controllable && pwm"
|
||||
v-model="inputValue"
|
||||
:error="errors().length > 0"
|
||||
suffix="%"
|
||||
type="number"
|
||||
hide-spin-buttons
|
||||
hide-details
|
||||
outlined
|
||||
dense
|
||||
class="_slider-input pt-1"
|
||||
@blur="inputValue = Math.round(parseFloat(sliderValue) * 100)"
|
||||
@focus="$event.target.select()"
|
||||
@keydown="checkInvalidChars"
|
||||
@keyup.enter="submitInput"></v-text-field>
|
||||
<form @submit.prevent="submitInput">
|
||||
<v-text-field
|
||||
v-if="controllable && pwm"
|
||||
v-model="inputValue"
|
||||
:error="errors.length > 0"
|
||||
suffix="%"
|
||||
type="number"
|
||||
hide-spin-buttons
|
||||
hide-details
|
||||
outlined
|
||||
dense
|
||||
class="_slider-input pt-1"
|
||||
@blur="inputValue = Math.round(parseFloat(sliderValue) * 100)"
|
||||
@focus="$event.target.select()"
|
||||
@keydown="checkInvalidChars" />
|
||||
</form>
|
||||
</v-subheader>
|
||||
<transition name="fade">
|
||||
<transition v-if="controllable && pwm" name="fade">
|
||||
<!-- display errors -->
|
||||
<div v-show="errors().length > 0 && controllable && pwm" class="_error-msg d-flex justify-end">
|
||||
{{ errors()[0] }}
|
||||
<div v-show="errors.length > 0" class="_error-msg d-flex justify-end">
|
||||
{{ errors[0] ?? '' }}
|
||||
</div>
|
||||
</transition>
|
||||
<v-card-text v-if="controllable && pwm" class="py-0 pb-2 d-flex align-center">
|
||||
@@ -147,6 +98,8 @@ import {
|
||||
mdiPlus,
|
||||
mdiToggleSwitch,
|
||||
mdiToggleSwitchOffOutline,
|
||||
mdiLightbulbOutline,
|
||||
mdiLightbulbOnOutline,
|
||||
} from '@mdi/js'
|
||||
|
||||
@Component
|
||||
@@ -158,6 +111,8 @@ export default class MiscellaneousSlider extends Mixins(BaseMixin) {
|
||||
mdiLockOpenVariantOutline = mdiLockOpenVariantOutline
|
||||
mdiMinus = mdiMinus
|
||||
mdiPlus = mdiPlus
|
||||
mdiLightbulbOutline = mdiLightbulbOutline
|
||||
mdiLightbulbOnOutline = mdiLightbulbOnOutline
|
||||
|
||||
convertName = convertName
|
||||
private declare timeout: ReturnType<typeof setTimeout>
|
||||
@@ -165,19 +120,42 @@ export default class MiscellaneousSlider extends Mixins(BaseMixin) {
|
||||
private invalidChars: string[] = ['e', 'E', '+']
|
||||
|
||||
private min = 0
|
||||
private value = 0
|
||||
private inputValue = 0
|
||||
private sliderValue = 0
|
||||
|
||||
@Prop({ type: Number, required: true }) declare target: number
|
||||
@Prop({ type: Number, default: 1 }) declare max: number
|
||||
@Prop({ type: String, default: '' }) declare name: string
|
||||
@Prop({ type: String, default: '' }) declare type: string
|
||||
@Prop({ type: Boolean, default: false }) declare controllable: boolean
|
||||
@Prop({ type: Boolean, default: false }) declare pwm: boolean
|
||||
@Prop({ type: [Number, Boolean], default: false }) declare rpm: number | boolean
|
||||
@Prop({ type: Number, default: 1 }) declare multi: number
|
||||
@Prop({ type: Number, default: 0 }) declare off_below: number
|
||||
@Prop({ type: Number, required: true })
|
||||
declare target: number
|
||||
|
||||
@Prop({ type: Number, default: 1 })
|
||||
declare max: number
|
||||
|
||||
@Prop({ type: String, default: '' })
|
||||
declare name: string
|
||||
|
||||
@Prop({ type: String, default: '' })
|
||||
declare type: string
|
||||
|
||||
@Prop({ type: Boolean, default: false })
|
||||
declare controllable: boolean
|
||||
|
||||
@Prop({ type: Boolean, default: false })
|
||||
declare pwm: boolean
|
||||
|
||||
@Prop({ type: [Number, Boolean], default: false })
|
||||
declare rpm: number | boolean
|
||||
|
||||
@Prop({ type: Number, default: 1 })
|
||||
declare multi: number
|
||||
|
||||
@Prop({ type: Number, default: 0 })
|
||||
declare off_below: number
|
||||
|
||||
@Prop({ type: String, default: '' })
|
||||
declare colorOrder: string
|
||||
|
||||
get value(): number {
|
||||
return Math.round((this.target / this.max) * 100) / 100
|
||||
}
|
||||
|
||||
@Watch('lockSliders', { immediate: true })
|
||||
lockSlidersChanged(): void {
|
||||
@@ -214,19 +192,21 @@ export default class MiscellaneousSlider extends Mixins(BaseMixin) {
|
||||
} else if (this.sliderValue > this.value && this.sliderValue < this.off_below) {
|
||||
this.sliderValue = this.off_below
|
||||
}
|
||||
this.value = this.sliderValue
|
||||
this.sendCmd()
|
||||
|
||||
this.sendCmd(this.sliderValue)
|
||||
}
|
||||
|
||||
sendCmd(): void {
|
||||
if (this.target === this.value) return
|
||||
sendCmd(newVal: number): void {
|
||||
if (this.value === newVal) return
|
||||
|
||||
let gcode = ''
|
||||
if (this.value < this.min) this.value = 0
|
||||
const l_value = this.value * this.multi
|
||||
if (this.type === 'fan') gcode = `M106 S${l_value.toFixed(0)}`
|
||||
if (this.type === 'fan_generic') gcode = `SET_FAN_SPEED FAN=${this.name} SPEED=${l_value}`
|
||||
if (this.type === 'output_pin') gcode = `SET_PIN PIN=${this.name} VALUE=${l_value.toFixed(2)}`
|
||||
if (newVal < this.min) newVal = 0
|
||||
newVal = newVal * this.multi
|
||||
if (this.type === 'fan') gcode = `M106 S${newVal.toFixed(0)}`
|
||||
if (this.type === 'fan_generic') gcode = `SET_FAN_SPEED FAN=${this.name} SPEED=${newVal}`
|
||||
if (this.type === 'output_pin') gcode = `SET_PIN PIN=${this.name} VALUE=${newVal.toFixed(2)}`
|
||||
if (this.type === 'led')
|
||||
gcode = `SET_LED LED=${this.name} ${this.ledChannelName}=${newVal.toFixed(2)} SYNC=0 TRANSMIT=1`
|
||||
|
||||
if (gcode !== '') {
|
||||
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
|
||||
@@ -236,32 +216,35 @@ export default class MiscellaneousSlider extends Mixins(BaseMixin) {
|
||||
this.startLockTimer()
|
||||
}
|
||||
|
||||
ledOff() {
|
||||
this.sendCmd(0)
|
||||
}
|
||||
|
||||
ledOn() {
|
||||
this.sendCmd(1)
|
||||
}
|
||||
|
||||
switchOutputPin(): void {
|
||||
this.value = this.value ? 0 : 1
|
||||
const gcode = `SET_PIN PIN=${this.name} VALUE=${(this.value * this.multi).toFixed(2)}`
|
||||
const newVal = this.value ? 0 : 1
|
||||
const gcode = `SET_PIN PIN=${this.name} VALUE=${(newVal * this.multi).toFixed(2)}`
|
||||
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: gcode })
|
||||
}
|
||||
|
||||
decrement(): void {
|
||||
this.value = this.value > 0 ? Math.round((this.value - 0.01) * 100) / 100 : 0
|
||||
if (this.value < this.off_below) this.value = 0
|
||||
this.sendCmd()
|
||||
let newVal = this.value > 0 ? Math.round((this.value - 0.01) * 100) / 100 : 0
|
||||
if (this.value < this.off_below) newVal = 0
|
||||
this.sendCmd(newVal)
|
||||
}
|
||||
|
||||
increment(): void {
|
||||
this.value = this.value < 1.0 ? Math.round((this.value + 0.01) * 100) / 100 : 1.0
|
||||
if (this.value < this.off_below) this.value = this.off_below
|
||||
this.sendCmd()
|
||||
let newVal = this.value < 1.0 ? Math.round((this.value + 0.01) * 100) / 100 : 1.0
|
||||
if (this.value < this.off_below) newVal = this.off_below
|
||||
this.sendCmd(newVal)
|
||||
}
|
||||
|
||||
mounted(): void {
|
||||
this.value = this.target
|
||||
}
|
||||
|
||||
@Watch('target')
|
||||
targetChanged(newVal: number): void {
|
||||
this.value = newVal / this.max
|
||||
mounted() {
|
||||
this.sliderValue = this.value
|
||||
}
|
||||
|
||||
@Watch('value')
|
||||
@@ -281,7 +264,7 @@ export default class MiscellaneousSlider extends Mixins(BaseMixin) {
|
||||
if (this.invalidChars.includes(event.key)) event.preventDefault()
|
||||
}
|
||||
|
||||
errors() {
|
||||
get errors() {
|
||||
const errors = []
|
||||
const input = this.inputValue / 100
|
||||
if (this.inputValue.toString() === '') {
|
||||
@@ -292,24 +275,94 @@ export default class MiscellaneousSlider extends Mixins(BaseMixin) {
|
||||
// "Must be grater or equal than {min}!"
|
||||
errors.push(this.$t('App.NumberInput.GreaterOrEqualError', { min: this.min * 100 }))
|
||||
}
|
||||
if (input > this.max || input < this.min) {
|
||||
// "Must be between {min} and {max}!"
|
||||
errors.push(this.$t('App.NumberInput.MustBeBetweenError', { min: this.min * 100, max: this.max * 100 }))
|
||||
}
|
||||
return errors
|
||||
}
|
||||
|
||||
get disableFanAnimation() {
|
||||
return this.$store.state.gui.uiSettings.disableFanAnimation ?? false
|
||||
}
|
||||
|
||||
get fanClasses() {
|
||||
const output = ['mr-2']
|
||||
if (!this.disableFanAnimation && this.value >= this.off_below && this.value > 0) output.push('icon-rotate')
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
get rpmClasses() {
|
||||
const output = []
|
||||
if (!this.controllable) output.push(['mr-3', 'mt-1'])
|
||||
else output.push(['mt-2'])
|
||||
if (this.rpm === 0 && this.value > 0) output.push('red--text')
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
get ledChannelName() {
|
||||
if (this.colorOrder === 'R') return 'RED'
|
||||
if (this.colorOrder === 'G') return 'GREEN'
|
||||
if (this.colorOrder === 'B') return 'BLUE'
|
||||
|
||||
return 'WHITE'
|
||||
}
|
||||
|
||||
submitInput(): void {
|
||||
if (this.errors().length > 0) return
|
||||
if (this.errors.length > 0) return
|
||||
|
||||
const input = this.inputValue / 100
|
||||
if (this.value === 0 && input < this.off_below) {
|
||||
this.value = this.off_below
|
||||
} else if (this.value >= this.off_below && input < this.off_below) {
|
||||
this.value = 0
|
||||
} else this.value = input
|
||||
let newVal = this.inputValue / 100
|
||||
if (this.value === 0 && newVal < this.off_below) {
|
||||
newVal = this.off_below
|
||||
} else if (this.value >= this.off_below && newVal < this.off_below) {
|
||||
newVal = 0
|
||||
}
|
||||
|
||||
this.sendCmd()
|
||||
this.sendCmd(newVal)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
._fan-slider-subheader {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
._lock-button {
|
||||
margin-left: -6px;
|
||||
}
|
||||
|
||||
._error-msg {
|
||||
color: #ff5252;
|
||||
font-size: 12px;
|
||||
padding: 4px 16px 2px 0;
|
||||
}
|
||||
|
||||
.fade-enter-active {
|
||||
animation: slide-in 0.15s reverse;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.fade-leave-active {
|
||||
animation: slide-in 0.15s;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
@keyframes slide-in {
|
||||
100% {
|
||||
transform: translateY(-5px);
|
||||
}
|
||||
}
|
||||
|
||||
._slider-input {
|
||||
min-width: 4.2rem;
|
||||
max-width: 5rem;
|
||||
margin-left: 12px;
|
||||
}
|
||||
|
||||
._slider-input >>> .v-input__slot {
|
||||
min-height: 1rem !important;
|
||||
}
|
||||
|
||||
._slider-input >>> .v-text-field__slot input {
|
||||
padding: 4px 0 4px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,41 +1,31 @@
|
||||
<template>
|
||||
<v-text-field
|
||||
v-model="position"
|
||||
:label="`[ ${label} ]`"
|
||||
:suffix="suffix"
|
||||
:disabled="disabled"
|
||||
:readonly="readonly"
|
||||
:error="!validate"
|
||||
hide-details="auto"
|
||||
type="number"
|
||||
hide-spin-buttons
|
||||
outlined
|
||||
reverse
|
||||
dense
|
||||
@blur="onBlur"
|
||||
@focus="!readonly ? $event.target.select() : {}">
|
||||
<template v-if="errorMsg.length" #append>
|
||||
<v-tooltip top>
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-icon color="error" v-bind="attrs" v-on="on">{{ mdiAlert }}</v-icon>
|
||||
</template>
|
||||
<span>{{ errorMsg.join(', ') }}</span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
</v-text-field>
|
||||
<form @submit.prevent="submit">
|
||||
<v-text-field
|
||||
v-model="position"
|
||||
:label="`[ ${label} ]`"
|
||||
:suffix="suffix"
|
||||
:disabled="disabled"
|
||||
:step="step"
|
||||
:readonly="readonly"
|
||||
hide-details="auto"
|
||||
type="number"
|
||||
hide-spin-buttons
|
||||
outlined
|
||||
reverse
|
||||
dense
|
||||
@blur="onBlur"
|
||||
@focus="!readonly ? $event.target.select() : {}"></v-text-field>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop, VModel } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { mdiAlert } from '@mdi/js'
|
||||
|
||||
@Component({
|
||||
components: {},
|
||||
})
|
||||
export default class MoveToInput extends Mixins(BaseMixin) {
|
||||
mdiAlert = mdiAlert
|
||||
|
||||
@VModel({ type: String })
|
||||
declare position: string
|
||||
|
||||
@@ -48,11 +38,8 @@ export default class MoveToInput extends Mixins(BaseMixin) {
|
||||
@Prop({ type: String, required: false })
|
||||
declare readonly suffix: string
|
||||
|
||||
@Prop({ type: Number, required: true })
|
||||
declare readonly positionMax: number
|
||||
|
||||
@Prop({ type: Number, required: true })
|
||||
declare readonly positionMin: number
|
||||
@Prop({ type: Number, required: false, default: 1 })
|
||||
declare readonly step: number
|
||||
|
||||
@Prop({ type: Boolean, required: false })
|
||||
declare readonly disabled: boolean
|
||||
@@ -61,43 +48,13 @@ export default class MoveToInput extends Mixins(BaseMixin) {
|
||||
declare readonly readonly: boolean
|
||||
|
||||
onBlur() {
|
||||
if (!this.validate && this.position !== this.currentPos) {
|
||||
if (this.position !== this.currentPos) {
|
||||
this.position = this.currentPos
|
||||
this.$emit('validate', { axis: this.suffix.toLowerCase(), valid: true })
|
||||
}
|
||||
}
|
||||
|
||||
get validate(): boolean {
|
||||
const isValid =
|
||||
this.position !== '' &&
|
||||
parseFloat(this.position) <= this.positionMax &&
|
||||
parseFloat(this.position) >= this.positionMin
|
||||
this.$emit('validate', { axis: this.suffix.toLowerCase(), valid: isValid })
|
||||
return isValid
|
||||
}
|
||||
|
||||
get errorMsg() {
|
||||
const errors = []
|
||||
if (this.position === '') errors.push(this.$t('Panels.ToolheadControlPanel.Invalid'))
|
||||
if (parseFloat(this.position) > this.positionMax || parseFloat(this.position) < this.positionMin)
|
||||
errors.push(this.$t('Panels.ToolheadControlPanel.OutOfRange'))
|
||||
|
||||
return errors
|
||||
submit(): void {
|
||||
this.$emit('submit')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
label {
|
||||
font-size: 14px !important;
|
||||
color: rgba(255, 255, 255, 0.5) !important;
|
||||
}
|
||||
|
||||
.v-input.error--text .v-input__slot {
|
||||
padding-left: 3px !important;
|
||||
}
|
||||
|
||||
.v-input.error--text .v-input__append-inner {
|
||||
margin-right: 5px !important;
|
||||
}
|
||||
</style>
|
||||
@@ -1,40 +1,26 @@
|
||||
<style scoped>
|
||||
._spin_button_group {
|
||||
width: 24px;
|
||||
margin-top: -6px;
|
||||
margin-left: -6px;
|
||||
margin-bottom: -6px;
|
||||
}
|
||||
|
||||
.v-input--has-state {
|
||||
margin-bottom: -18px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<form @submit.prevent="submit">
|
||||
<v-text-field
|
||||
v-model.number="value"
|
||||
v-model="value"
|
||||
:label="label"
|
||||
:suffix="unit"
|
||||
:error="invalidInput()"
|
||||
:error-messages="inputErrors()"
|
||||
:error="invalidInput"
|
||||
:error-messages="inputErrors"
|
||||
:disabled="disabled"
|
||||
:step="step"
|
||||
:min="min"
|
||||
:max="max"
|
||||
:dec="dec"
|
||||
type="number"
|
||||
hide-spin-buttons
|
||||
hide-details="auto"
|
||||
outlined
|
||||
dense
|
||||
class="d-flex align-top"
|
||||
@blur="value = target"
|
||||
@blur="value = target.toString()"
|
||||
@focus="$event.target.select()"
|
||||
@keydown="checkInvalidChars">
|
||||
<template v-if="defaultValue" #append>
|
||||
<v-icon @click="resetToDefault">{{ value !== defaultValue ? mdiRestart : '' }}</v-icon>
|
||||
<v-icon @click="resetToDefault">{{ value !== defaultValue.toString() ? mdiRestart : '' }}</v-icon>
|
||||
</template>
|
||||
<template v-if="hasSpinner" #append-outer>
|
||||
<div class="_spin_button_group">
|
||||
@@ -74,7 +60,7 @@ export default class NumberInput extends Mixins(BaseMixin) {
|
||||
mdiChevronUp = mdiChevronUp
|
||||
mdiChevronDown = mdiChevronDown
|
||||
|
||||
private value: number = 0
|
||||
private value: string = '0'
|
||||
private error: boolean = false
|
||||
private invalidChars: string[] = ['e', 'E', '+']
|
||||
|
||||
@@ -123,40 +109,44 @@ export default class NumberInput extends Mixins(BaseMixin) {
|
||||
declare readonly outputErrorMsg: boolean
|
||||
|
||||
created(): void {
|
||||
this.value = this.target
|
||||
this.value = this.target.toString()
|
||||
}
|
||||
|
||||
@Watch('target')
|
||||
updateTarget(): void {
|
||||
this.value = this.target
|
||||
this.value = this.target.toString()
|
||||
}
|
||||
|
||||
incrementValue(): void {
|
||||
if (this.value + this.step * this.spinnerFactor < this.max! || this.max === null) {
|
||||
this.value = Math.round((this.value + this.step * this.spinnerFactor) * 10 ** this.dec) / 10 ** this.dec
|
||||
} else {
|
||||
this.value = this.max
|
||||
}
|
||||
if (this.inputValue + this.step * this.spinnerFactor < this.max! || this.max === null) {
|
||||
this.value = (
|
||||
Math.round((this.inputValue + this.step * this.spinnerFactor) * 10 ** this.dec) /
|
||||
10 ** this.dec
|
||||
).toString()
|
||||
} else this.value = this.max.toString()
|
||||
|
||||
this.submit()
|
||||
}
|
||||
|
||||
decrementValue(): void {
|
||||
if (this.value - this.step * this.spinnerFactor > this.min) {
|
||||
this.value = Math.round((this.value - this.step * this.spinnerFactor) * 10 ** this.dec) / 10 ** this.dec
|
||||
} else {
|
||||
this.value = this.min
|
||||
}
|
||||
if (this.inputValue - this.step * this.spinnerFactor > this.min) {
|
||||
this.value = (
|
||||
Math.round((this.inputValue - this.step * this.spinnerFactor) * 10 ** this.dec) /
|
||||
10 ** this.dec
|
||||
).toString()
|
||||
} else this.value = this.min.toString()
|
||||
|
||||
this.submit()
|
||||
}
|
||||
|
||||
resetToDefault(): void {
|
||||
this.value = this.defaultValue
|
||||
this.value = this.defaultValue.toString()
|
||||
this.submit()
|
||||
}
|
||||
|
||||
submit(): void {
|
||||
if (this.invalidInput()) return
|
||||
this.$emit('submit', { name: this.param, value: this.value })
|
||||
if (this.invalidInput) return
|
||||
this.$emit('submit', { name: this.param, value: this.inputValue })
|
||||
}
|
||||
|
||||
// input validation //
|
||||
@@ -166,27 +156,44 @@ export default class NumberInput extends Mixins(BaseMixin) {
|
||||
if (this.invalidChars.includes(event.key)) event.preventDefault()
|
||||
}
|
||||
|
||||
invalidInput(): boolean {
|
||||
return this.value.toString() === '' || this.value < this.min || (this.value > this.max! && this.max !== null)
|
||||
// this function only parse this.value, to escape an empty input
|
||||
get inputValue(): number {
|
||||
if (this.value.toString() === '') return 0
|
||||
|
||||
return parseFloat(this.value.replace(',', '.'))
|
||||
}
|
||||
|
||||
inputErrors() {
|
||||
get invalidInput(): boolean {
|
||||
return this.inputErrors.length > 0
|
||||
}
|
||||
|
||||
get inputErrors() {
|
||||
if (!this.outputErrorMsg) return []
|
||||
|
||||
const errors = []
|
||||
if (this.value.toString() === '') {
|
||||
// "Input must not be empty!"
|
||||
errors.push(this.$t('App.NumberInput.NoEmptyAllowedError'))
|
||||
}
|
||||
if (this.max === null && this.value < this.min) {
|
||||
if (this.max === null && this.inputValue < this.min) {
|
||||
// "Must be grater or equal than {min}!"
|
||||
errors.push(this.$t('App.NumberInput.GreaterOrEqualError', { min: this.min }))
|
||||
}
|
||||
if (this.max !== null && (this.value > this.max! || this.value < this.min)) {
|
||||
if (this.max !== null && (this.inputValue > this.max! || this.inputValue < this.min)) {
|
||||
// "Must be between {min} and {max}!"
|
||||
errors.push(this.$t('App.NumberInput.MustBeBetweenError', { min: this.min, max: this.max }))
|
||||
}
|
||||
|
||||
return errors
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
._spin_button_group {
|
||||
width: 24px;
|
||||
margin-top: -6px;
|
||||
margin-left: -6px;
|
||||
margin-bottom: -6px;
|
||||
}
|
||||
|
||||
.v-input--has-state {
|
||||
margin-bottom: -18px !important;
|
||||
}
|
||||
</style>
|
||||
@@ -1,40 +1,18 @@
|
||||
<style scoped>
|
||||
._temp-input {
|
||||
font-size: 0.875rem;
|
||||
min-width: 4rem;
|
||||
max-width: 5rem;
|
||||
}
|
||||
|
||||
._temp-input >>> .v-input__slot {
|
||||
min-height: 1rem !important;
|
||||
padding-left: 8px !important;
|
||||
padding-right: 8px !important;
|
||||
}
|
||||
|
||||
._temp-input >>> .v-text-field__slot input {
|
||||
padding: 4px 0 4px;
|
||||
}
|
||||
|
||||
._preset {
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div class="d-flex align-center">
|
||||
<v-text-field
|
||||
v-model="value"
|
||||
suffix="°C"
|
||||
type="number"
|
||||
dense
|
||||
outlined
|
||||
hide-details
|
||||
hide-spin-buttons
|
||||
class="_temp-input pr-1"
|
||||
@blur="value = target"
|
||||
@focus="$event.target.select()"
|
||||
@keyup.enter="setTemps"></v-text-field>
|
||||
<form @submit.prevent="setTemps">
|
||||
<v-text-field
|
||||
v-model="value"
|
||||
suffix="°C"
|
||||
type="number"
|
||||
dense
|
||||
outlined
|
||||
hide-details
|
||||
hide-spin-buttons
|
||||
class="_temp-input pr-1"
|
||||
@blur="value = target"
|
||||
@focus="$event.target.select()"></v-text-field>
|
||||
</form>
|
||||
<v-menu v-if="presets" :offset-y="true" left title="Preheat">
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-btn
|
||||
@@ -56,11 +34,11 @@
|
||||
link
|
||||
style="min-height: 32px"
|
||||
@click="doSend(`${command} ${attributeName}=${name} TARGET=${preset.value}`)">
|
||||
<div class="d-flex align-center _preset">
|
||||
<v-icon v-if="preset.value === 0" else color="primary" small class="mr-1">
|
||||
<div class="_preset">
|
||||
<v-icon v-if="preset.value === 0" else color="primary" small class="_preset-icon">
|
||||
{{ mdiSnowflake }}
|
||||
</v-icon>
|
||||
<v-icon v-else small class="mr-1">{{ mdiFire }}</v-icon>
|
||||
<v-icon v-else small class="_preset-icon">{{ mdiFire }}</v-icon>
|
||||
<span style="padding-top: 2px">{{ preset.value }}°C</span>
|
||||
</div>
|
||||
</v-list-item>
|
||||
@@ -123,3 +101,30 @@ export default class TemperatureInput extends Mixins(BaseMixin, ControlMixin) {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
._temp-input {
|
||||
min-width: 4.2rem;
|
||||
max-width: 5rem;
|
||||
}
|
||||
|
||||
._temp-input >>> .v-input__slot {
|
||||
min-height: 1rem !important;
|
||||
padding-left: 8px !important;
|
||||
padding-right: 8px !important;
|
||||
}
|
||||
|
||||
._temp-input >>> .v-text-field__slot input {
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
|
||||
._preset {
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
._preset-icon {
|
||||
margin-top: -1px;
|
||||
margin-right: 4px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,53 +1,3 @@
|
||||
<style scoped>
|
||||
._tool-slider-subheader {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
._lock-button {
|
||||
margin-left: -6px;
|
||||
}
|
||||
|
||||
._error-msg {
|
||||
color: #ff5252;
|
||||
font-size: 12px;
|
||||
padding: 4px 16px 2px 0;
|
||||
}
|
||||
|
||||
.fade-enter-active {
|
||||
animation: slide-in 0.15s reverse;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.fade-leave-active {
|
||||
animation: slide-in 0.15s;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
@keyframes slide-in {
|
||||
100% {
|
||||
transform: translateY(-5px);
|
||||
}
|
||||
}
|
||||
|
||||
._slider-input {
|
||||
font-size: 0.875rem;
|
||||
max-width: 5.4rem;
|
||||
margin-left: 12px;
|
||||
}
|
||||
|
||||
._slider-input >>> .v-input__slot {
|
||||
min-height: 1rem !important;
|
||||
}
|
||||
|
||||
._slider-input >>> .v-text-field__slot input {
|
||||
padding: 4px 0 4px;
|
||||
}
|
||||
|
||||
._slider-input >>> .v-input__append-inner {
|
||||
margin: auto -5px auto 0 !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-row dense>
|
||||
<v-col class="pa-0">
|
||||
@@ -67,25 +17,26 @@
|
||||
</v-btn>
|
||||
<v-spacer></v-spacer>
|
||||
<span v-if="!hasInputField" class="font-weight-bold">{{ value }} {{ unit }}</span>
|
||||
<v-text-field
|
||||
v-if="hasInputField"
|
||||
v-model="numInput"
|
||||
:error="errors().length > 0"
|
||||
:suffix="unit"
|
||||
type="number"
|
||||
hide-spin-buttons
|
||||
hide-details
|
||||
outlined
|
||||
dense
|
||||
class="_slider-input d-flex align-center pt-1"
|
||||
@blur="numInput = value"
|
||||
@focus="$event.target.select()"
|
||||
@keydown="checkInvalidChars"
|
||||
@keyup.enter="submitInput">
|
||||
<template v-if="value !== defaultValue || value !== numInput" #append>
|
||||
<v-icon small @click="resetSlider">{{ mdiRestart }}</v-icon>
|
||||
</template>
|
||||
</v-text-field>
|
||||
<form @submit.prevent="submitInput">
|
||||
<v-text-field
|
||||
v-if="hasInputField"
|
||||
v-model="numInput"
|
||||
:error="errors().length > 0"
|
||||
:suffix="unit"
|
||||
type="number"
|
||||
hide-spin-buttons
|
||||
hide-details
|
||||
outlined
|
||||
dense
|
||||
class="_slider-input d-flex align-center pt-1"
|
||||
@blur="numInput = value"
|
||||
@focus="$event.target.select()"
|
||||
@keydown="checkInvalidChars">
|
||||
<template v-if="value !== defaultValue || value !== numInput" #append>
|
||||
<v-icon small @click="resetSlider">{{ mdiRestart }}</v-icon>
|
||||
</template>
|
||||
</v-text-field>
|
||||
</form>
|
||||
</v-subheader>
|
||||
<transition name="fade">
|
||||
<!-- display errors-->
|
||||
@@ -300,3 +251,54 @@ export default class ToolSlider extends Mixins(BaseMixin) {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
._tool-slider-subheader {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
._lock-button {
|
||||
margin-left: -6px;
|
||||
}
|
||||
|
||||
._error-msg {
|
||||
color: #ff5252;
|
||||
font-size: 12px;
|
||||
padding: 4px 16px 2px 0;
|
||||
}
|
||||
|
||||
.fade-enter-active {
|
||||
animation: slide-in 0.15s reverse;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.fade-leave-active {
|
||||
animation: slide-in 0.15s;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
@keyframes slide-in {
|
||||
100% {
|
||||
transform: translateY(-5px);
|
||||
}
|
||||
}
|
||||
|
||||
._slider-input {
|
||||
min-width: 4.2rem;
|
||||
max-width: 5rem;
|
||||
margin-left: 12px;
|
||||
}
|
||||
|
||||
._slider-input >>> .v-input__slot {
|
||||
min-height: 1rem !important;
|
||||
}
|
||||
|
||||
._slider-input >>> .v-text-field__slot input {
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
|
||||
._slider-input >>> .v-input__append-inner {
|
||||
margin: auto -5px auto 0 !important;
|
||||
}
|
||||
</style>
|
||||
@@ -1,5 +1,7 @@
|
||||
import Vue from 'vue'
|
||||
import Component from 'vue-class-component'
|
||||
import { DateTimeFormatOptions } from 'vue-i18n'
|
||||
import { ServerPowerStateDevice } from '@/store/server/power/types'
|
||||
|
||||
@Component
|
||||
export default class BaseMixin extends Vue {
|
||||
@@ -11,19 +13,29 @@ export default class BaseMixin extends Vue {
|
||||
return this.$store.getters['socket/getHostUrl']
|
||||
}
|
||||
|
||||
get remoteMode() {
|
||||
return this.$store.state.remoteMode
|
||||
get hostPort(): boolean {
|
||||
return this.$store.state.socket.port ?? 80
|
||||
}
|
||||
|
||||
get instancesDB() {
|
||||
return this.$store.state.instancesDB ?? 'moonraker'
|
||||
}
|
||||
|
||||
get socketIsConnected(): boolean {
|
||||
return this.$store.state.socket.isConnected ?? false
|
||||
}
|
||||
|
||||
get guiIsReady() {
|
||||
return this.$store.state.socket.initializationList.length === 0
|
||||
}
|
||||
|
||||
get klippyIsConnected(): boolean {
|
||||
return this.$store.state.server.klippy_connected ?? false
|
||||
}
|
||||
|
||||
get klipperState(): string {
|
||||
if (!this.klippyIsConnected) return 'disconnected'
|
||||
|
||||
return this.$store.state.server.klippy_state ?? ''
|
||||
}
|
||||
|
||||
@@ -35,6 +47,31 @@ export default class BaseMixin extends Vue {
|
||||
return this.klipperReadyForGui && ['printing', 'paused'].includes(this.printer_state)
|
||||
}
|
||||
|
||||
get printerPowerDevice(): string {
|
||||
let deviceName = this.$store.state.gui.uiSettings.powerDeviceName ?? null
|
||||
if (deviceName === null) deviceName = 'printer'
|
||||
|
||||
return deviceName
|
||||
}
|
||||
|
||||
get isPrinterPowerOff() {
|
||||
const devices = this.$store.getters['server/power/getDevices'] ?? []
|
||||
if (devices.length === 0) return false
|
||||
|
||||
const deviceIndex = devices.findIndex(
|
||||
(device: ServerPowerStateDevice) => device.device === this.printerPowerDevice
|
||||
)
|
||||
// stop if device is not found
|
||||
if (deviceIndex === -1) return false
|
||||
|
||||
const device = devices[deviceIndex]
|
||||
// Printer is on, if device status is "on" or "error"
|
||||
if (device.status !== 'off') return false
|
||||
|
||||
// if klippy is not connected (service shutdown) and device.status === off
|
||||
return !this.klippyIsConnected
|
||||
}
|
||||
|
||||
get loadings(): string[] {
|
||||
return this.$store.state.socket.loadings ?? []
|
||||
}
|
||||
@@ -74,7 +111,113 @@ export default class BaseMixin extends Vue {
|
||||
return 'ontouchstart' in window || (navigator.maxTouchPoints > 0 && navigator.maxTouchPoints !== 256)
|
||||
}
|
||||
|
||||
get isIOS() {
|
||||
return !!(
|
||||
navigator.userAgent.match(/(iPad|iPhone|iPod)/) ||
|
||||
// @ts-ignore
|
||||
(navigator.platform === 'MacIntel' && typeof navigator.standalone !== 'undefined')
|
||||
)
|
||||
}
|
||||
|
||||
get moonrakerComponents() {
|
||||
return this.$store.state.server?.components ?? []
|
||||
}
|
||||
|
||||
get existGcodesRootDirectory() {
|
||||
const roots = this.$store.state.server.registered_directories
|
||||
|
||||
return roots.findIndex((root: string) => root === 'gcodes') >= 0
|
||||
}
|
||||
|
||||
get formatDateOptions(): DateTimeFormatOptions {
|
||||
const format = this.$store.state.gui.general.dateFormat
|
||||
|
||||
switch (format) {
|
||||
case '2-digits':
|
||||
return { day: '2-digit', month: '2-digit', year: 'numeric' }
|
||||
|
||||
case 'short':
|
||||
return { day: '2-digit', month: 'short', year: 'numeric' }
|
||||
|
||||
default:
|
||||
return { dateStyle: 'medium' }
|
||||
}
|
||||
}
|
||||
|
||||
get formatTimeOptions(): DateTimeFormatOptions {
|
||||
const format = this.$store.state.gui.general.timeFormat
|
||||
|
||||
switch (format) {
|
||||
case '24hours':
|
||||
return { hour: '2-digit', minute: '2-digit', hourCycle: 'h23' }
|
||||
|
||||
case '12hours':
|
||||
return { hour: '2-digit', minute: '2-digit', hourCycle: 'h12' }
|
||||
|
||||
default:
|
||||
return { timeStyle: 'short' }
|
||||
}
|
||||
}
|
||||
|
||||
get formatTimeWithSecondsOptions(): DateTimeFormatOptions {
|
||||
const format = this.$store.state.gui.general.timeFormat
|
||||
|
||||
switch (format) {
|
||||
case '24hours':
|
||||
return { hour: '2-digit', minute: '2-digit', second: '2-digit', hourCycle: 'h23' }
|
||||
|
||||
case '12hours':
|
||||
return { hour: '2-digit', minute: '2-digit', second: '2-digit', hourCycle: 'h12' }
|
||||
|
||||
default:
|
||||
return { timeStyle: 'short' }
|
||||
}
|
||||
}
|
||||
|
||||
get browserLocale() {
|
||||
return navigator.languages && navigator.languages.length ? navigator.languages[0] : navigator.language
|
||||
}
|
||||
|
||||
get hours12Format() {
|
||||
const setting = this.$store.state.gui.general.timeFormat
|
||||
if (setting === '12hours') return true
|
||||
if (setting === null && this.browserLocale === 'en_us') return true
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
formatDate(value: number | Date): string {
|
||||
let tmp = null
|
||||
|
||||
try {
|
||||
// @ts-ignore
|
||||
tmp = (typeof value.getMonth === 'function' ? value : new Date(value)) as Date
|
||||
} catch (_) {
|
||||
return 'UNKNOWN'
|
||||
}
|
||||
|
||||
return tmp.toLocaleDateString(this.browserLocale, this.formatDateOptions)
|
||||
}
|
||||
|
||||
formatTime(value: number | Date, boolSeconds = false): string {
|
||||
let tmp = null
|
||||
|
||||
try {
|
||||
// @ts-ignore
|
||||
tmp = (typeof value.getMonth === 'function' ? value : new Date(value)) as Date
|
||||
} catch (_) {
|
||||
return 'UNKNOWN'
|
||||
}
|
||||
|
||||
if (boolSeconds) return tmp.toLocaleTimeString(this.browserLocale, this.formatTimeWithSecondsOptions)
|
||||
|
||||
return tmp.toLocaleTimeString(this.browserLocale, this.formatTimeOptions)
|
||||
}
|
||||
|
||||
formatDateTime(value: number, boolSeconds = false): string {
|
||||
const date = this.formatDate(value)
|
||||
const time = this.formatTime(value, boolSeconds)
|
||||
|
||||
return `${date} ${time}`
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,6 @@ export default class ControlMixin extends Vue {
|
||||
return this.$store.state.printer?.gcode_move?.absolute_coordinates ?? true
|
||||
}
|
||||
|
||||
get homedAxes(): string {
|
||||
return this.$store.state.printer?.toolhead?.homed_axes ?? ''
|
||||
}
|
||||
|
||||
get enableXYHoming(): boolean {
|
||||
return this.$store.state.gui.control.enableXYHoming
|
||||
}
|
||||
@@ -47,6 +43,10 @@ export default class ControlMixin extends Vue {
|
||||
return this.$store.getters['printer/existsScrewsTilt']
|
||||
}
|
||||
|
||||
get existsFirmwareRetraction(): boolean {
|
||||
return this.$store.getters['printer/existsFirmwareRetraction']
|
||||
}
|
||||
|
||||
get colorQuadGantryLevel() {
|
||||
const status = this.$store.state.printer.quad_gantry_level?.applied ?? true
|
||||
|
||||
@@ -63,6 +63,26 @@ export default class ControlMixin extends Vue {
|
||||
return this.$store.getters['gui/getDefaultControlActionButton']
|
||||
}
|
||||
|
||||
/**
|
||||
* Axes home states
|
||||
*/
|
||||
|
||||
get homedAxes(): string {
|
||||
return this.$store.state.printer?.toolhead?.homed_axes ?? ''
|
||||
}
|
||||
|
||||
get xAxisHomed(): boolean {
|
||||
return this.homedAxes.includes('x')
|
||||
}
|
||||
|
||||
get yAxisHomed(): boolean {
|
||||
return this.homedAxes.includes('y')
|
||||
}
|
||||
|
||||
get zAxisHomed(): boolean {
|
||||
return this.homedAxes.includes('z')
|
||||
}
|
||||
|
||||
doHome() {
|
||||
this.$store.dispatch('server/addEvent', { message: 'G28', type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: 'G28' }, { loading: 'homeAll' })
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
import Component from 'vue-class-component'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { allDashboardPanels } from '@/store/variables'
|
||||
import { capitalize } from '@/plugins/helpers'
|
||||
import { GuiMacrosStateMacrogroup } from '@/store/gui/macros/types'
|
||||
import kebabCase from 'lodash.kebabcase'
|
||||
import Vue from 'vue'
|
||||
import {
|
||||
mdiArrowCollapseVertical,
|
||||
mdiCodeTags,
|
||||
mdiConsoleLine,
|
||||
mdiDipSwitch,
|
||||
mdiEngine,
|
||||
mdiGamepad,
|
||||
mdiInformation,
|
||||
mdiPrinter3dNozzle,
|
||||
mdiThermometerLines,
|
||||
mdiWebcam,
|
||||
} from '@mdi/js'
|
||||
|
||||
@Component
|
||||
export default class DashboardMixin extends BaseMixin {
|
||||
get macroMode() {
|
||||
return this.$store.state.gui.macros.mode ?? 'simple'
|
||||
}
|
||||
|
||||
get macrogroups() {
|
||||
return this.$store.getters['gui/macros/getAllMacrogroups'] ?? []
|
||||
}
|
||||
@@ -20,74 +25,6 @@ export default class DashboardMixin extends BaseMixin {
|
||||
return this.$store.getters['gui/webcams/getWebcams'] ?? []
|
||||
}
|
||||
|
||||
get missingPanelsMobile() {
|
||||
const panels = [...this.$store.state.gui.dashboard.mobileLayout]
|
||||
|
||||
return this.checkMissingPanels(panels)
|
||||
}
|
||||
|
||||
get missingPanelsTablet() {
|
||||
const panels = [
|
||||
...this.$store.state.gui.dashboard.tabletLayout1,
|
||||
...this.$store.state.gui.dashboard.tabletLayout2,
|
||||
]
|
||||
|
||||
return this.checkMissingPanels(panels)
|
||||
}
|
||||
|
||||
get missingPanelsDesktop() {
|
||||
const panels = [
|
||||
...this.$store.state.gui.dashboard.desktopLayout1,
|
||||
...this.$store.state.gui.dashboard.desktopLayout2,
|
||||
]
|
||||
|
||||
return this.checkMissingPanels(panels)
|
||||
}
|
||||
|
||||
get missingPanelsWidescreen() {
|
||||
const panels = [
|
||||
...this.$store.state.gui.dashboard.widescreenLayout1,
|
||||
...this.$store.state.gui.dashboard.widescreenLayout2,
|
||||
...this.$store.state.gui.dashboard.widescreenLayout3,
|
||||
]
|
||||
|
||||
return this.checkMissingPanels(panels)
|
||||
}
|
||||
|
||||
get allPossiblePanels() {
|
||||
let allPanels = [...allDashboardPanels]
|
||||
|
||||
// remove macros panel and add macrogroups panels if macroMode === expert
|
||||
if (this.macroMode === 'expert') {
|
||||
this.macrogroups.forEach((group: GuiMacrosStateMacrogroup) => {
|
||||
allPanels.push('macrogroup_' + group.id)
|
||||
})
|
||||
|
||||
allPanels = allPanels.filter((name) => name !== 'macros')
|
||||
}
|
||||
|
||||
// remove webcam panel, if no webcam exists
|
||||
if (this.webcams.length === 0) {
|
||||
allPanels = allPanels.filter((name) => name !== 'webcam')
|
||||
}
|
||||
|
||||
return allPanels
|
||||
}
|
||||
|
||||
checkMissingPanels(panels: any[]) {
|
||||
const missingPanels: any[] = []
|
||||
|
||||
this.allPossiblePanels.forEach((panelname) => {
|
||||
if (!panels.find((panel) => panel.name === panelname))
|
||||
missingPanels.push({
|
||||
name: panelname,
|
||||
visible: true,
|
||||
})
|
||||
})
|
||||
|
||||
return missingPanels
|
||||
}
|
||||
|
||||
getPanelName(name: string) {
|
||||
if (name.startsWith('macrogroup_')) {
|
||||
const groupId = name.split('_')[1] ?? ''
|
||||
@@ -102,9 +39,37 @@ export default class DashboardMixin extends BaseMixin {
|
||||
subStrings.forEach((subStr) => {
|
||||
panelName += capitalize(subStr)
|
||||
})
|
||||
return this.$t('Panels.' + panelName + 'Panel.Headline')
|
||||
return this.$t(`Panels.${panelName}Panel.Headline`)
|
||||
}
|
||||
|
||||
return this.$t('Panels.' + capitalize(name) + 'Panel.Headline')
|
||||
return this.$t(`Panels.${capitalize(name)}Panel.Headline`)
|
||||
}
|
||||
|
||||
convertPanelnameToIcon(name: string): string {
|
||||
if (name.startsWith('macrogroup_')) return mdiCodeTags
|
||||
|
||||
switch (name) {
|
||||
case 'webcam':
|
||||
return mdiWebcam
|
||||
case 'zoffset':
|
||||
return mdiArrowCollapseVertical
|
||||
case 'toolhead-control':
|
||||
return mdiGamepad
|
||||
case 'macros':
|
||||
return mdiCodeTags
|
||||
case 'miscellaneous':
|
||||
return mdiDipSwitch
|
||||
case 'temperature':
|
||||
return mdiThermometerLines
|
||||
case 'miniconsole':
|
||||
return mdiConsoleLine
|
||||
case 'machine-settings':
|
||||
return mdiEngine
|
||||
case 'extruder-control':
|
||||
return mdiPrinter3dNozzle
|
||||
|
||||
default:
|
||||
return mdiInformation
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import Vue from 'vue'
|
||||
import Component from 'vue-class-component'
|
||||
import {
|
||||
mdiAlbum,
|
||||
mdiCampfire,
|
||||
mdiDoor,
|
||||
mdiRadiatorDisabled,
|
||||
mdiPrinter3d,
|
||||
mdiPrinter3dNozzle,
|
||||
mdiRaspberryPi,
|
||||
mdiWebcam,
|
||||
} from '@mdi/js'
|
||||
|
||||
@Component
|
||||
export default class WebcamMixin extends Vue {
|
||||
convertWebcamIcon(iconName: string): string {
|
||||
switch (iconName) {
|
||||
case 'mdiAlbum':
|
||||
return mdiAlbum
|
||||
case 'mdiCampfire':
|
||||
return mdiCampfire
|
||||
case 'mdiDoor':
|
||||
return mdiDoor
|
||||
case 'mdiRadiatorDisabled':
|
||||
return mdiRadiatorDisabled
|
||||
case 'mdiPrinter3d':
|
||||
return mdiPrinter3d
|
||||
case 'mdiPrinter3dNozzle':
|
||||
return mdiPrinter3dNozzle
|
||||
case 'mdiRaspberryPi':
|
||||
return mdiRaspberryPi
|
||||
|
||||
default:
|
||||
return mdiWebcam
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
<style scoped>
|
||||
.klipper-logo {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
.moonraker-logo {
|
||||
transform: rotate(45deg);
|
||||
color: #ebc815;
|
||||
}
|
||||
.version-container {
|
||||
display: grid;
|
||||
grid-template-columns: 20px auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-dialog v-model="isOpen" transition="dialog-bottom-transition" max-width="600" scrollable>
|
||||
<template #activator="{ an }">
|
||||
<v-tooltip right color="panel">
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-icon v-bind="attrs" v-on="an" @mouseenter="on.mouseenter" @mouseleave="on.mouseleave">
|
||||
{{ mdiHelpCircleOutline }}
|
||||
</v-icon>
|
||||
</template>
|
||||
<span class="dark version-container">
|
||||
<div><img height="12" src="/img/logo.svg" /></div>
|
||||
<div>v{{ mainsailVersion }}</div>
|
||||
<div>
|
||||
<v-icon small class="moonraker-logo">{{ mdiMoonWaningCrescent }}</v-icon>
|
||||
</div>
|
||||
<div>{{ moonrakerVersion }}</div>
|
||||
<div><img height="12" src="/img/klipper.svg" class="klipper-logo" /></div>
|
||||
<div>{{ klipperVersion }}</div>
|
||||
</span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
<template #default>
|
||||
<panel title="About" :margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="isOpen = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<v-container fliud class="align-self-start">
|
||||
<v-row tag="logo">
|
||||
<v-col cols="auto">
|
||||
<v-img
|
||||
height="80"
|
||||
contain
|
||||
src="https://docs.mainsail.xyz/assets/img/logo-mainsail.png"></v-img>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row tag="data1" justify="center">
|
||||
<v-col class="pr-3 text-right">Version</v-col>
|
||||
<v-col>v2.1.0-alpha</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
</template>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import BaseMixin from '../mixins/base'
|
||||
import { Mixins } from 'vue-property-decorator'
|
||||
import Component from 'vue-class-component'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import { mdiCloseThick, mdiHelpCircleOutline, mdiMoonWaningCrescent } from '@mdi/js'
|
||||
|
||||
@Component({
|
||||
components: { Panel },
|
||||
})
|
||||
export default class AboutModal extends Mixins(BaseMixin) {
|
||||
mdiHelpCircleOutline = mdiHelpCircleOutline
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiMoonWaningCrescent = mdiMoonWaningCrescent
|
||||
|
||||
private isOpen = false
|
||||
|
||||
get mainsailVersion(): string {
|
||||
return this.$store.state.packageVersion
|
||||
}
|
||||
|
||||
get klipperVersion(): string {
|
||||
return this.$store.state.printer?.software_version ?? ''
|
||||
}
|
||||
|
||||
get moonrakerVersion(): string {
|
||||
return this.$store.state.server?.moonraker_version ?? ''
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<v-alert text :color="alertColor" border="left">
|
||||
<v-alert :class="`notification-menu-entry--priority-${entry.priority}`" text :color="alertColor" border="left">
|
||||
<v-row align="start">
|
||||
<v-col class="grow">
|
||||
<div class="notification-menu-entry__headline mb-1 text-subtitle-1">
|
||||
@@ -15,7 +15,9 @@
|
||||
<span :class="`${alertColor}--text`">{{ entry.title }}</span>
|
||||
</template>
|
||||
</div>
|
||||
<p class="text-body-2 mb-0 text--disabled font-weight-light" v-html="formatedText"></p>
|
||||
<p
|
||||
class="notification-menu-entry__description text-body-2 mb-0 text--disabled font-weight-light"
|
||||
v-html="formatedText"></p>
|
||||
</v-col>
|
||||
<v-col
|
||||
v-if="entry.priority !== 'critical'"
|
||||
@@ -117,7 +119,10 @@ export default class NotificationMenuEntry extends Mixins(BaseMixin) {
|
||||
declare readonly parentState: boolean
|
||||
|
||||
get formatedText() {
|
||||
return this.entry.description.replace(/\[([^\]]+)\]\(([^)]+)\)/, '<a href="$2" target="_blank">$1</a>')
|
||||
return this.entry.description.replace(
|
||||
/(\bhttps?:\/\/[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|])/gim,
|
||||
'<a href="$1" target="_blank" class="' + this.alertColor + '--text">$1</a>'
|
||||
)
|
||||
}
|
||||
|
||||
get alertColor() {
|
||||
@@ -153,4 +158,12 @@ export default class NotificationMenuEntry extends Mixins(BaseMixin) {
|
||||
.notification-menu-entry__headline {
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.notification-menu-entry__description {
|
||||
max-width: 292px;
|
||||
}
|
||||
|
||||
.notification-menu-entry--priority-critical .notification-menu-entry__description {
|
||||
max-width: 336px;
|
||||
}
|
||||
</style>
|
||||
@@ -4,4 +4,8 @@ $t('History.StatusValues.error')
|
||||
$t('History.StatusValues.in_progress')
|
||||
$t('History.StatusValues.klippy_disconnect')
|
||||
$t('History.StatusValues.klippy_shutdown')
|
||||
$t('History.StatusValues.server_exit')
|
||||
$t('History.StatusValues.server_exit')
|
||||
$t('Panels.TemperaturePanel.Dataset.Power')
|
||||
$t('Panels.TemperaturePanel.Dataset.Speed')
|
||||
$t('Panels.TemperaturePanel.Dataset.Target')
|
||||
$t('Panels.TemperaturePanel.Dataset.Temperature')
|
||||
Whitespace-only changes.
@@ -1,48 +1,3 @@
|
||||
<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>
|
||||
|
||||
<template>
|
||||
<panel
|
||||
v-if="klipperReadyForGui && extruders.length"
|
||||
@@ -52,31 +7,23 @@
|
||||
card-class="extruder-control-panel">
|
||||
<!-- PANEL-HEADER 3-DOT-MENU -->
|
||||
<template #buttons>
|
||||
<v-menu v-if="filamentChangeMacros" left :offset-y="true" :close-on-content-click="false" class="pa-0">
|
||||
<v-menu v-if="showFilamentMacros" :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>
|
||||
<!-- FILAMENT UNLOAD -->
|
||||
<v-tooltip top :disabled="extrudePossible" color="secondary">
|
||||
<!-- FILAMENT UNLOAD -->
|
||||
<v-list-item v-if="unloadFilamentMacro">
|
||||
<v-tooltip top :disabled="canExecuteUnloadMacro" color="secondary">
|
||||
<template #activator="{ on }">
|
||||
<div style="width: 100%" v-on="on">
|
||||
<v-btn
|
||||
:loading="loadings.includes('btnUnloadFilament')"
|
||||
:disabled="!extrudePossible || isPrinting"
|
||||
small
|
||||
style="width: 100%"
|
||||
@click="sendUnloadFilament()">
|
||||
<span class="d-flex align-center">
|
||||
<v-icon left small style="transform: rotate(270deg)" class="mr-1">
|
||||
{{ mdiLocationExit }}
|
||||
</v-icon>
|
||||
{{ $t('Panels.ExtruderControlPanel.UnloadFilament') }}
|
||||
</span>
|
||||
</v-btn>
|
||||
<div v-on="on">
|
||||
<macro-button
|
||||
:macro="unloadFilamentMacro"
|
||||
:alias="$t('Panels.ExtruderControlPanel.UnloadFilament').toString()"
|
||||
:disabled="!canExecuteUnloadMacro || isPrinting"
|
||||
color="#272727" />
|
||||
</div>
|
||||
</template>
|
||||
<span>
|
||||
@@ -85,24 +32,16 @@
|
||||
</span>
|
||||
</v-tooltip>
|
||||
</v-list-item>
|
||||
<v-list-item>
|
||||
<!-- FILAMENT LOAD -->
|
||||
<v-tooltip top :disabled="extrudePossible" color="secondary">
|
||||
<!-- FILAMENT LOAD -->
|
||||
<v-list-item v-if="loadFilamentMacro">
|
||||
<v-tooltip top :disabled="canExecuteLoadMacro" color="secondary">
|
||||
<template #activator="{ on }">
|
||||
<div style="width: 100%" v-on="on">
|
||||
<v-btn
|
||||
:loading="loadings.includes('btnLoadFilament')"
|
||||
:disabled="!extrudePossible || isPrinting"
|
||||
small
|
||||
style="width: 100%"
|
||||
@click="sendLoadFilament()">
|
||||
<span class="d-flex align-center">
|
||||
<v-icon left small style="transform: rotate(90deg)" class="mr-1">
|
||||
{{ mdiLocationEnter }}
|
||||
</v-icon>
|
||||
{{ $t('Panels.ExtruderControlPanel.LoadFilament') }}
|
||||
</span>
|
||||
</v-btn>
|
||||
<div v-on="on">
|
||||
<macro-button
|
||||
:macro="loadFilamentMacro"
|
||||
:alias="$t('Panels.ExtruderControlPanel.LoadFilament').toString()"
|
||||
:disabled="!canExecuteLoadMacro || isPrinting"
|
||||
color="#272727" />
|
||||
</div>
|
||||
</template>
|
||||
<span>
|
||||
@@ -117,22 +56,18 @@
|
||||
<responsive :breakpoints="{ large: (el) => el.width >= 640 }">
|
||||
<template #default="{ el }">
|
||||
<!-- TOOL SELECTOR BUTTONS -->
|
||||
<v-container v-if="extruders.length > 1" class="pb-1">
|
||||
<v-container v-if="toolchangeMacros.length > 1" class="pb-1">
|
||||
<v-item-group class="_btn-group py-0">
|
||||
<v-btn
|
||||
v-for="extruder in extruders"
|
||||
:key="extruder.key"
|
||||
:class="extruder.key === activeExtruder ? 'primary--text' : {}"
|
||||
:value="extruder.key"
|
||||
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="activateExtruder(extruder.key)">
|
||||
{{
|
||||
toolchangeMacros.length === extruders.length
|
||||
? toolchangeMacros[extruders.indexOf(extruder)]
|
||||
: extruder.name
|
||||
}}
|
||||
@click="doSend(tool.name)">
|
||||
{{ tool.name }}
|
||||
</v-btn>
|
||||
</v-item-group>
|
||||
</v-container>
|
||||
@@ -151,8 +86,15 @@
|
||||
attribute-name="S"></tool-slider>
|
||||
</v-container>
|
||||
<!-- PRESSURE ADVANCE SETTINGS -->
|
||||
<v-divider></v-divider>
|
||||
<pressure-advance-settings></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>
|
||||
@@ -347,8 +289,14 @@
|
||||
v-if="filamentDiameter && nozzleDiameter"
|
||||
style="font-size: 0.8em"
|
||||
class="text--disabled text-caption font-weight-light d-flex justify-center">
|
||||
{{ $t('Panels.ExtruderControlPanel.EstimatedExtrusion') }} ~ {{ extrudedLength }} mm @
|
||||
{{ volumetricFlow }} mm³/s
|
||||
<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>
|
||||
@@ -362,16 +310,22 @@ import {
|
||||
mdiArrowUpBold,
|
||||
mdiPrinter3dNozzle,
|
||||
mdiPrinter3dNozzleOutline,
|
||||
mdiLocationEnter,
|
||||
mdiLocationExit,
|
||||
mdiDotsVertical,
|
||||
mdiDiameterVariant,
|
||||
} from '@mdi/js'
|
||||
import { Component, Mixins, Watch } from 'vue-property-decorator'
|
||||
import { PrinterStateExtruder } from '@/store/printer/types'
|
||||
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 Panel from '@/components/ui/Panel.vue'
|
||||
import PressureAdvanceSettings from '@/components/panels/MachineSettings/PressureAdvanceSettings.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'
|
||||
|
||||
@@ -379,47 +333,70 @@ import ToolSlider from '@/components/inputs/ToolSlider.vue'
|
||||
components: {
|
||||
Panel,
|
||||
PressureAdvanceSettings,
|
||||
FirmwareRetractionSettings,
|
||||
NumberInput,
|
||||
Responsive,
|
||||
ToolSlider,
|
||||
},
|
||||
})
|
||||
export default class ExtruderControlPanel extends Mixins(BaseMixin) {
|
||||
export default class ExtruderControlPanel extends Mixins(BaseMixin, ControlMixin) {
|
||||
mdiArrowUpBold = mdiArrowUpBold
|
||||
mdiArrowDownBold = mdiArrowDownBold
|
||||
mdiPrinter3dNozzle = mdiPrinter3dNozzle
|
||||
mdiPrinter3dNozzleOutline = mdiPrinter3dNozzleOutline
|
||||
mdiLocationEnter = mdiLocationEnter
|
||||
mdiLocationExit = mdiLocationExit
|
||||
mdiDotsVertical = mdiDotsVertical
|
||||
mdiDiameterVariant = mdiDiameterVariant
|
||||
|
||||
private heatWaitGcodes = ['printer.extruder.can_extrude', 'TEMPERATURE_WAIT', 'M109']
|
||||
|
||||
get isPrinting(): boolean {
|
||||
return ['printing'].includes(this.printer_state)
|
||||
}
|
||||
|
||||
get toolchangeMacros(): string[] {
|
||||
let tools: string[] = []
|
||||
for (let i = 0; i < this.extruders.length; i++) {
|
||||
this.$store.getters['printer/getMacros'].forEach((m: any) => {
|
||||
if (`T${i}`.includes(m.name.toUpperCase())) tools.push(`T${i}`)
|
||||
})
|
||||
}
|
||||
return tools
|
||||
get macros() {
|
||||
return this.$store.getters['printer/getMacros']
|
||||
}
|
||||
|
||||
get filamentChangeMacros(): boolean {
|
||||
let macros: string[] = []
|
||||
this.$store.getters['printer/getMacros'].forEach((m: any) => {
|
||||
if (m.name.toUpperCase().startsWith('LOAD_FILAMENT')) macros.push(m.name)
|
||||
if (m.name.toUpperCase().startsWith('UNLOAD_FILAMENT')) macros.push(m.name)
|
||||
})
|
||||
return macros.length === 2
|
||||
get toolchangeMacros(): PrinterStateToolchangeMacro[] {
|
||||
return this.$store.getters['printer/getToolchangeMacros']
|
||||
}
|
||||
|
||||
get loadFilamentMacro() {
|
||||
return this.macros.find((macro: PrinterStateMacro) => macro.name === 'LOAD_FILAMENT')
|
||||
}
|
||||
|
||||
get unloadFilamentMacro() {
|
||||
return this.macros.find((macro: PrinterStateMacro) => macro.name === 'UNLOAD_FILAMENT')
|
||||
}
|
||||
|
||||
/**
|
||||
* test if the load and unload macro include specific keywords. if true, we allow
|
||||
* execution of that macro even if at the current time extrudePossible === false
|
||||
*/
|
||||
get canExecuteLoadMacro(): boolean {
|
||||
if (this.extrudePossible) return true
|
||||
|
||||
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))
|
||||
}
|
||||
|
||||
get showFilamentMacros(): boolean {
|
||||
return this.loadFilamentMacro !== undefined || this.unloadFilamentMacro !== undefined
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
@@ -485,7 +462,11 @@ export default class ExtruderControlPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get extrudedLength(): number {
|
||||
return Math.round(this.feedamount * this.extrudeFactor * (this.filamentDiameter / this.nozzleDiameter))
|
||||
return Math.round(
|
||||
this.feedamount *
|
||||
this.extrudeFactor *
|
||||
(Math.pow(this.filamentDiameter, 2) / Math.pow(this.nozzleDiameter, 2))
|
||||
)
|
||||
}
|
||||
|
||||
get volumetricFlow(): number {
|
||||
@@ -512,22 +493,6 @@ export default class ExtruderControlPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
}
|
||||
|
||||
activateExtruder(extruder: string): void {
|
||||
/**
|
||||
* If toolchange macros in the form of T{n} are found, use those
|
||||
* otherwise use the regular 'ACTIVATE_EXTRUDER' Klipper command
|
||||
*/
|
||||
let gcode: string
|
||||
if (this.toolchangeMacros.length === this.extruders.length) {
|
||||
gcode = `T${this.extruders.findIndex((ex: any) => ex.key === extruder)}`
|
||||
} else {
|
||||
gcode = `ACTIVATE_EXTRUDER EXTRUDER=${extruder}`
|
||||
}
|
||||
|
||||
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: gcode })
|
||||
}
|
||||
|
||||
sendRetract(): void {
|
||||
const gcode = `M83\nG1 E-${this.feedamount} F${this.feedrate * 60}`
|
||||
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
|
||||
@@ -539,17 +504,50 @@ export default class ExtruderControlPanel extends Mixins(BaseMixin) {
|
||||
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'btnDetract' })
|
||||
}
|
||||
|
||||
sendUnloadFilament(): void {
|
||||
const gcode = 'UNLOAD_FILAMENT'
|
||||
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'btnUnloadFilament' })
|
||||
}
|
||||
|
||||
sendLoadFilament(): void {
|
||||
const gcode = 'LOAD_FILAMENT'
|
||||
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'btnLoadFilament' })
|
||||
}
|
||||
}
|
||||
</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,152 @@
|
||||
<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>
|
||||
+4
-4
@@ -14,7 +14,7 @@
|
||||
</v-btn>
|
||||
<v-select
|
||||
v-model="selectedExtruder"
|
||||
:label="$t('Panels.MachineSettingsPanel.PressureAdvanceSettings.Extruder').toString()"
|
||||
:label="$t('Panels.ExtruderControlPanel.PressureAdvanceSettings.Extruder').toString()"
|
||||
:items="allExtruders"
|
||||
:value="activeExtruder"
|
||||
hide-details
|
||||
@@ -24,7 +24,7 @@
|
||||
</v-col>
|
||||
<v-col :class="{ 'col-12': el.is.small }">
|
||||
<number-input
|
||||
:label="$t('Panels.MachineSettingsPanel.PressureAdvanceSettings.Advance').toString()"
|
||||
:label="$t('Panels.ExtruderControlPanel.PressureAdvanceSettings.Advance').toString()"
|
||||
param="ADVANCE"
|
||||
:target="pressureAdvance"
|
||||
:default-value="defaultPressureAdvance"
|
||||
@@ -35,12 +35,12 @@
|
||||
:max="null"
|
||||
:step="0.001"
|
||||
:dec="3"
|
||||
unit="mm/s"
|
||||
unit="s"
|
||||
@submit="sendCmd"></number-input>
|
||||
</v-col>
|
||||
<v-col :class="{ 'col-12': el.is.small }">
|
||||
<number-input
|
||||
:label="$t('Panels.MachineSettingsPanel.PressureAdvanceSettings.SmoothTime').toString()"
|
||||
:label="$t('Panels.ExtruderControlPanel.PressureAdvanceSettings.SmoothTime').toString()"
|
||||
param="SMOOTH_TIME"
|
||||
:target="smoothTime"
|
||||
:default-value="defaultSmoothTime"
|
||||
@@ -1,33 +1,3 @@
|
||||
<style scoped>
|
||||
.v-card.disabledPrinter {
|
||||
opacity: 0.6;
|
||||
filter: grayscale(70%);
|
||||
}
|
||||
|
||||
.webcamContainer,
|
||||
.webcamContainer .vue-load-image,
|
||||
.webcamContainer > div,
|
||||
.webcamContainer img {
|
||||
position: absolute !important;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.webcamContainer img {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.webcamContainer .webcamFpsOutput {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.v-overlay {
|
||||
top: 48px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<panel
|
||||
:icon="mdiPrinter3d"
|
||||
@@ -48,20 +18,20 @@
|
||||
</template>
|
||||
<v-list dense class="py-0">
|
||||
<v-list-item link @click="currentCamId = 'off'">
|
||||
<v-list-item-icon class="mr-0">
|
||||
<v-icon small>{{ mdiWebcamOff }}</v-icon>
|
||||
<v-list-item-icon class="mr-2">
|
||||
<v-icon small class="mt-1">{{ mdiWebcamOff }}</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title>{{ $t('Panels.FarmPrinterPanel.WebcamOff') }}</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
v-for="webcam of printer_webcams"
|
||||
v-for="webcam of supportedPrinterWebcams"
|
||||
:key="webcam.index"
|
||||
link
|
||||
@click="currentCamId = webcam.id">
|
||||
<v-list-item-icon class="mr-0">
|
||||
<v-icon small>{{ webcam.icon }}</v-icon>
|
||||
<v-list-item-icon class="mr-2">
|
||||
<v-icon small class="mt-1">{{ convertWebcamIcon(webcam.icon) }}</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title v-text="webcam.name"></v-list-item-title>
|
||||
@@ -75,21 +45,28 @@
|
||||
<div>
|
||||
<v-img ref="imageDiv" :height="imageHeight" :src="printer_image" class="d-flex align-end">
|
||||
<div
|
||||
v-if="printer.socket.isConnected && currentCamId !== 'off' && currentWebcam"
|
||||
v-if="
|
||||
printer.socket.isConnected &&
|
||||
currentCamId !== 'off' &&
|
||||
currentWebcam &&
|
||||
'service' in currentWebcam
|
||||
"
|
||||
class="webcamContainer">
|
||||
<template v-if="'service' in currentWebcam && currentWebcam.service === 'mjpegstreamer'">
|
||||
<webcam-mjpegstreamer
|
||||
:cam-settings="currentWebcam"
|
||||
:printer-url="printerUrl"
|
||||
:show-fps="false"></webcam-mjpegstreamer>
|
||||
</template>
|
||||
<template
|
||||
v-if="'service' in currentWebcam && currentWebcam.service === 'mjpegstreamer-adaptive'">
|
||||
<webcam-mjpegstreamer-adaptive
|
||||
:cam-settings="currentWebcam"
|
||||
:printer-url="printerUrl"
|
||||
:show-fps="false"></webcam-mjpegstreamer-adaptive>
|
||||
</template>
|
||||
<webcam-mjpegstreamer
|
||||
v-if="currentWebcam.service === 'mjpegstreamer'"
|
||||
:cam-settings="currentWebcam"
|
||||
:printer-url="printerUrl"
|
||||
:show-fps="false"></webcam-mjpegstreamer>
|
||||
<webcam-mjpegstreamer-adaptive
|
||||
v-else-if="currentWebcam.service === 'mjpegstreamer-adaptive'"
|
||||
:cam-settings="currentWebcam"
|
||||
:printer-url="printerUrl"
|
||||
:show-fps="false"></webcam-mjpegstreamer-adaptive>
|
||||
<webcam-uv4l-mjpeg
|
||||
v-else-if="currentWebcam.service === 'uv4l-mjpeg'"
|
||||
:cam-settings="currentWebcam"
|
||||
:printer-url="printerUrl"
|
||||
:show-fps="false"></webcam-uv4l-mjpeg>
|
||||
</div>
|
||||
<v-card-title
|
||||
class="white--text py-2"
|
||||
@@ -145,6 +122,7 @@
|
||||
</div>
|
||||
</template>
|
||||
</v-hover>
|
||||
<resize-observer @notify="handleResize" />
|
||||
</panel>
|
||||
</template>
|
||||
|
||||
@@ -154,19 +132,24 @@ import BaseMixin from '@/components/mixins/base'
|
||||
import { FarmPrinterState } from '@/store/farm/printer/types'
|
||||
import Mjpegstreamer from '@/components/webcams/Mjpegstreamer.vue'
|
||||
import MjpegstreamerAdaptive from '@/components/webcams/MjpegstreamerAdaptive.vue'
|
||||
import Uv4lMjpeg from '@/components/webcams/Uv4lMjpeg.vue'
|
||||
import MainsailLogo from '@/components/ui/MainsailLogo.vue'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import { mdiPrinter3d, mdiWebcam, mdiMenuDown, mdiWebcamOff, mdiFileOutline } from '@mdi/js'
|
||||
import { Debounce } from 'vue-debounce-decorator'
|
||||
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
|
||||
import WebcamMixin from '@/components/mixins/webcam'
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
Panel,
|
||||
'webcam-mjpegstreamer': Mjpegstreamer,
|
||||
'webcam-mjpegstreamer-adaptive': MjpegstreamerAdaptive,
|
||||
'webcam-uv4l-mjpeg': Uv4lMjpeg,
|
||||
'mainsail-logo': MainsailLogo,
|
||||
},
|
||||
})
|
||||
export default class FarmPrinterPanel extends Mixins(BaseMixin) {
|
||||
export default class FarmPrinterPanel extends Mixins(BaseMixin, WebcamMixin) {
|
||||
mdiPrinter3d = mdiPrinter3d
|
||||
mdiWebcam = mdiWebcam
|
||||
mdiMenuDown = mdiMenuDown
|
||||
@@ -235,13 +218,19 @@ export default class FarmPrinterPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get showWebcamSwitch() {
|
||||
return this.printer.socket.isConnected && this.printer_webcams.length > 0
|
||||
return this.printer.socket.isConnected && this.supportedPrinterWebcams.length > 0
|
||||
}
|
||||
|
||||
get printer_webcams() {
|
||||
return this.$store.getters['farm/' + this.printer._namespace + '/getPrinterWebcams']
|
||||
}
|
||||
|
||||
get supportedPrinterWebcams() {
|
||||
return this.printer_webcams.filter((webcam: GuiWebcamStateWebcam) =>
|
||||
['mjpegstreamer', 'mjpegstreamer-adaptive', 'uv4l-mjpeg'].includes(webcam.service)
|
||||
)
|
||||
}
|
||||
|
||||
get currentWebcam() {
|
||||
const currentCam = this.printer_webcams.find((webcam: any) => webcam.id === this.currentCamId)
|
||||
if (currentCam) return currentCam
|
||||
@@ -255,18 +244,59 @@ export default class FarmPrinterPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
mounted() {
|
||||
window.addEventListener('resize', this.resize)
|
||||
this.resize()
|
||||
this.calcImageHeight()
|
||||
}
|
||||
|
||||
beforeDestroy() {
|
||||
window.removeEventListener('resize', this.resize)
|
||||
}
|
||||
|
||||
resize() {
|
||||
calcImageHeight() {
|
||||
if (this.imageDiv?.$el?.clientWidth) {
|
||||
this.imageHeight = Math.round((this.imageDiv.$el.clientWidth / 3) * 2)
|
||||
} else this.imageHeight = 200
|
||||
return
|
||||
}
|
||||
|
||||
this.imageHeight = 200
|
||||
}
|
||||
|
||||
@Debounce(200)
|
||||
handleResize() {
|
||||
this.$nextTick(() => {
|
||||
this.calcImageHeight()
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.v-card.disabledPrinter {
|
||||
opacity: 0.6;
|
||||
filter: grayscale(70%);
|
||||
}
|
||||
|
||||
.webcamContainer,
|
||||
.webcamContainer .vue-load-image,
|
||||
.webcamContainer > div,
|
||||
.webcamContainer img {
|
||||
position: absolute !important;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.webcamContainer img {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.webcamContainer .webcamFpsOutput {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.v-overlay {
|
||||
top: 48px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
.farmprinter-panel {
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
@@ -1,41 +1,3 @@
|
||||
<style>
|
||||
/*noinspection CssUnusedSymbol*/
|
||||
.files-table .v-data-table-header__icon {
|
||||
margin-left: 7px;
|
||||
}
|
||||
|
||||
.files-table .file-list-cursor:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/*noinspection CssUnusedSymbol*/
|
||||
.file-list--select-td {
|
||||
width: 20px;
|
||||
}
|
||||
|
||||
/*noinspection CssUnusedSymbol*/
|
||||
.files-table th.text-start {
|
||||
padding-right: 0 !important;
|
||||
}
|
||||
|
||||
/*noinspection CssUnusedSymbol*/
|
||||
.v-chip.minimum-chip {
|
||||
padding: 0;
|
||||
min-width: 24px;
|
||||
}
|
||||
|
||||
/*noinspection CssUnusedSymbol*/
|
||||
.v-chip.minimum-chip .v-chip__content {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/*noinspection CssUnusedSymbol*/
|
||||
.file-list__count_printed {
|
||||
position: relative;
|
||||
top: 1px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<panel
|
||||
@@ -56,6 +18,15 @@
|
||||
dense
|
||||
style="max-width: 300px"></v-text-field>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn
|
||||
v-if="selectedFiles.length"
|
||||
:title="$t('Files.Download')"
|
||||
color="primary"
|
||||
class="px-2 minwidth-0 ml-3"
|
||||
:loading="loadings.includes('gcodeDownloadZip')"
|
||||
@click="downloadSelectedFiles">
|
||||
<v-icon>{{ mdiCloudDownload }}</v-icon>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
v-if="selectedFiles.length"
|
||||
:title="$t('Files.Delete')"
|
||||
@@ -67,7 +38,7 @@
|
||||
<input
|
||||
ref="fileUpload"
|
||||
type="file"
|
||||
:accept="validGcodeExtensions.join(', ')"
|
||||
:accept="gcodeInputFileAccept.join(', ')"
|
||||
style="display: none"
|
||||
multiple
|
||||
@change="uploadFile" />
|
||||
@@ -143,11 +114,10 @@
|
||||
<v-list-item
|
||||
v-for="header of configurableHeaders"
|
||||
:key="header.value"
|
||||
class="minHeight36"
|
||||
link>
|
||||
class="minHeight36">
|
||||
<v-row>
|
||||
<v-col class="col-auto pr-0">
|
||||
<v-icon class="handle">{{ mdiArrowUpDown }}</v-icon>
|
||||
<v-icon class="handle">{{ mdiDragVertical }}</v-icon>
|
||||
</v-col>
|
||||
<v-col>
|
||||
{{ header.text }}
|
||||
@@ -269,50 +239,36 @@
|
||||
<template v-if="item.isDirectory">
|
||||
<v-icon>{{ mdiFolder }}</v-icon>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="item.small_thumbnail && item.big_thumbnail">
|
||||
<v-tooltip
|
||||
v-if="!item.isDirectory && item.small_thumbnail && item.big_thumbnail"
|
||||
top
|
||||
content-class="tooltip__content-opacity1">
|
||||
<template #activator="{ on, attrs }">
|
||||
<vue-load-image>
|
||||
<img
|
||||
slot="image"
|
||||
:src="item.small_thumbnail"
|
||||
width="32"
|
||||
height="32"
|
||||
:alt="item.filename"
|
||||
v-bind="attrs"
|
||||
v-on="on" />
|
||||
<template v-else-if="item.small_thumbnail">
|
||||
<v-tooltip
|
||||
top
|
||||
content-class="tooltip__content-opacity1"
|
||||
:disabled="!item.big_thumbnail">
|
||||
<template #activator="{ on, attrs }">
|
||||
<vue-load-image>
|
||||
<img
|
||||
slot="image"
|
||||
:src="item.small_thumbnail"
|
||||
width="32"
|
||||
height="32"
|
||||
:alt="item.filename"
|
||||
v-bind="attrs"
|
||||
v-on="on" />
|
||||
<div slot="preloader">
|
||||
<v-progress-circular
|
||||
slot="preloader"
|
||||
indeterminate
|
||||
color="primary"></v-progress-circular>
|
||||
<v-icon slot="error">{{ mdiFile }}</v-icon>
|
||||
</vue-load-image>
|
||||
</template>
|
||||
<span><img :src="item.big_thumbnail" width="250" :alt="item.filename" /></span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
<template v-else-if="item.small_thumbnail">
|
||||
<vue-load-image>
|
||||
<img
|
||||
slot="image"
|
||||
:src="item.small_thumbnail"
|
||||
width="32"
|
||||
height="32"
|
||||
:alt="item.filename" />
|
||||
<v-progress-circular
|
||||
slot="preloader"
|
||||
indeterminate
|
||||
color="primary"></v-progress-circular>
|
||||
<v-icon slot="error">{{ mdiFile }}</v-icon>
|
||||
</vue-load-image>
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-icon>{{ mdiFile }}</v-icon>
|
||||
</template>
|
||||
</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>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-icon>{{ mdiFile }}</v-icon>
|
||||
</template>
|
||||
</td>
|
||||
<td class=" ">{{ item.filename }}</td>
|
||||
@@ -369,14 +325,16 @@
|
||||
{{ $t('Files.AddToQueue') }}
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
v-if="
|
||||
'first_layer_extr_temp' in contextMenu.item &&
|
||||
contextMenu.item.first_layer_extr_temp > 0 &&
|
||||
'first_layer_bed_temp' in contextMenu.item &&
|
||||
contextMenu.item.first_layer_bed_temp > 0
|
||||
"
|
||||
v-if="!contextMenu.item.isDirectory && moonrakerComponents.includes('job_queue')"
|
||||
:disabled="!isGcodeFile(contextMenu.item)"
|
||||
@click="openAddBatchToQueueDialog(contextMenu.item)">
|
||||
<v-icon class="mr-1">{{ mdiPlaylistPlus }}</v-icon>
|
||||
{{ $t('Files.AddBatchToQueue') }}
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
v-if="contextMenu.item.preheat_gcode !== null"
|
||||
:disabled="['error', 'printing', 'paused'].includes(printer_state)"
|
||||
@click="preheat">
|
||||
@click="doSend(contextMenu.item.preheat_gcode)">
|
||||
<v-icon class="mr-1">{{ mdiFire }}</v-icon>
|
||||
{{ $t('Files.Preheat') }}
|
||||
</v-list-item>
|
||||
@@ -418,7 +376,7 @@
|
||||
</v-menu>
|
||||
<v-dialog v-model="dialogCreateDirectory.show" :max-width="400">
|
||||
<panel
|
||||
:title="$t('Files.NewDirectory')"
|
||||
:title="$t('Files.NewDirectory').toString()"
|
||||
card-class="gcode-files-new-directory-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -431,19 +389,25 @@
|
||||
ref="inputFieldCreateDirectory"
|
||||
v-model="dialogCreateDirectory.name"
|
||||
:label="$t('Files.Name')"
|
||||
:rules="input_rules"
|
||||
required
|
||||
:rules="nameInputRules"
|
||||
@update:error="(bool) => (isInvalidName = bool)"
|
||||
@keypress.enter="createDirectoryAction"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="" text @click="dialogCreateDirectory.show = false">{{ $t('Files.Cancel') }}</v-btn>
|
||||
<v-btn color="primary" text @click="createDirectoryAction">{{ $t('Files.Create') }}</v-btn>
|
||||
<v-btn :disabled="isInvalidName" color="primary" text @click="createDirectoryAction">
|
||||
{{ $t('Files.Create') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogRenameFile.show" :max-width="400">
|
||||
<panel :title="$t('Files.RenameFile')" card-class="gcode-files-rename-file-dialog" :margin-bottom="false">
|
||||
<panel
|
||||
:title="$t('Files.RenameFile').toString()"
|
||||
card-class="gcode-files-rename-file-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="dialogRenameFile.show = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
@@ -453,20 +417,24 @@
|
||||
<v-text-field
|
||||
ref="inputFieldRenameFile"
|
||||
v-model="dialogRenameFile.newName"
|
||||
:label="$t('Files.Name')"
|
||||
:label="$t('Files.Name').toString()"
|
||||
required
|
||||
:rules="nameInputRules"
|
||||
@update:error="(bool) => (isInvalidName = bool)"
|
||||
@keyup.enter="renameFileAction"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="" text @click="dialogRenameFile.show = false">{{ $t('Files.Cancel') }}</v-btn>
|
||||
<v-btn color="primary" text @click="renameFileAction">{{ $t('Files.Rename') }}</v-btn>
|
||||
<v-btn :disabled="isInvalidName" color="primary" text @click="renameFileAction">
|
||||
{{ $t('Files.Rename') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogRenameDirectory.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Files.RenameDirectory')"
|
||||
:title="$t('Files.RenameDirectory').toString()"
|
||||
card-class="gcode-files-rename-directory-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -480,18 +448,22 @@
|
||||
v-model="dialogRenameDirectory.newName"
|
||||
:label="$t('Files.Name')"
|
||||
required
|
||||
:rules="nameInputRules"
|
||||
@update:error="(bool) => (isInvalidName = bool)"
|
||||
@keyup.enter="renameDirectoryAction"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="" text @click="dialogRenameDirectory.show = false">{{ $t('Files.Cancel') }}</v-btn>
|
||||
<v-btn color="primary" text @click="renameDirectoryAction">{{ $t('Files.Rename') }}</v-btn>
|
||||
<v-btn :disabled="isInvalidName" color="primary" text @click="renameDirectoryAction">
|
||||
{{ $t('Files.Rename') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogDeleteDirectory.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Files.DeleteDirectory')"
|
||||
:title="$t('Files.DeleteDirectory').toString()"
|
||||
card-class="gcode-files-delete-directory-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -512,7 +484,10 @@
|
||||
</panel>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="deleteSelectedDialog" max-width="400">
|
||||
<panel :title="$t('Files.Delete')" card-class="gcode-files-delete-selected-dialog" :margin-bottom="false">
|
||||
<panel
|
||||
:title="$t('Files.Delete').toString()"
|
||||
card-class="gcode-files-delete-selected-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="deleteSelectedDialog = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
@@ -528,6 +503,53 @@
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogAddBatchToQueue.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Files.AddToQueue').toString()"
|
||||
card-class="gcode-files-add-to-queue-dialog"
|
||||
:icon="mdiPlaylistPlus"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="dialogAddBatchToQueue.show = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
<v-card-text>
|
||||
<v-text-field
|
||||
ref="inputFieldAddToQueueCount"
|
||||
v-model="dialogAddBatchToQueue.count"
|
||||
:label="$t('Files.Count')"
|
||||
required
|
||||
hide-spin-buttons
|
||||
type="number"
|
||||
:rules="countInputRules"
|
||||
@keyup.enter="addBatchToQueueAction">
|
||||
<template #append-outer>
|
||||
<div class="_spin_button_group">
|
||||
<v-btn class="mt-n3" icon plain small @click="dialogAddBatchToQueue.count++">
|
||||
<v-icon>{{ mdiChevronUp }}</v-icon>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
:disabled="dialogAddBatchToQueue.count <= 1"
|
||||
class="mb-n3"
|
||||
icon
|
||||
plain
|
||||
small
|
||||
@click="dialogAddBatchToQueue.count--">
|
||||
<v-icon>{{ mdiChevronDown }}</v-icon>
|
||||
</v-btn>
|
||||
</div>
|
||||
</template>
|
||||
</v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="" text @click="dialogAddBatchToQueue.show = false">{{ $t('Files.Cancel') }}</v-btn>
|
||||
<v-btn color="primary" text @click="addBatchToQueueAction">{{ $t('Files.AddToQueue') }}</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -535,13 +557,15 @@
|
||||
import { Component, Mixins, Watch } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { validGcodeExtensions } from '@/store/variables'
|
||||
import { formatDate, formatFilesize, formatPrintTime, sortFiles } from '@/plugins/helpers'
|
||||
import { formatFilesize, formatPrintTime, sortFiles } from '@/plugins/helpers'
|
||||
import { FileStateFile, FileStateGcodefile } from '@/store/files/types'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import SettingsRow from '@/components/settings/SettingsRow.vue'
|
||||
import draggable from 'vuedraggable'
|
||||
import {
|
||||
mdiArrowUpDown,
|
||||
mdiChevronDown,
|
||||
mdiChevronUp,
|
||||
mdiDragVertical,
|
||||
mdiCheckboxBlankOutline,
|
||||
mdiCheckboxMarked,
|
||||
mdiCloseThick,
|
||||
@@ -564,6 +588,16 @@ import {
|
||||
mdiFileDocumentEditOutline,
|
||||
} from '@mdi/js'
|
||||
import StartPrintDialog from '@/components/dialogs/StartPrintDialog.vue'
|
||||
import ControlMixin from '@/components/mixins/control'
|
||||
|
||||
interface contextMenu {
|
||||
shown: boolean
|
||||
isDirectory: boolean
|
||||
touchTimer?: number | null
|
||||
x: number
|
||||
y: number
|
||||
item: FileStateGcodefile
|
||||
}
|
||||
|
||||
interface draggingFile {
|
||||
item: FileStateGcodefile
|
||||
@@ -574,6 +608,12 @@ interface dialogPrintFile {
|
||||
item: FileStateGcodefile
|
||||
}
|
||||
|
||||
interface dialogAddBatchToQueue {
|
||||
show: boolean
|
||||
count: number
|
||||
item: FileStateGcodefile
|
||||
}
|
||||
|
||||
interface dialogRenameObject {
|
||||
show: boolean
|
||||
newName: string
|
||||
@@ -587,13 +627,15 @@ interface tableColumnSetting {
|
||||
sortable?: boolean
|
||||
class?: string
|
||||
pos?: number
|
||||
outputType?: 'string' | 'date' | 'length' | 'weight' | 'filesize' | 'time'
|
||||
outputType?: 'string' | 'date' | 'length' | 'weight' | 'filesize' | 'temp' | 'time'
|
||||
}
|
||||
|
||||
@Component({
|
||||
components: { StartPrintDialog, Panel, SettingsRow, draggable },
|
||||
})
|
||||
export default class GcodefilesPanel extends Mixins(BaseMixin) {
|
||||
export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
|
||||
mdiChevronDown = mdiChevronDown
|
||||
mdiChevronUp = mdiChevronUp
|
||||
mdiFile = mdiFile
|
||||
mdiFileDocumentMultipleOutline = mdiFileDocumentMultipleOutline
|
||||
mdiMagnify = mdiMagnify
|
||||
@@ -614,10 +656,8 @@ export default class GcodefilesPanel extends Mixins(BaseMixin) {
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiCheckboxBlankOutline = mdiCheckboxBlankOutline
|
||||
mdiCheckboxMarked = mdiCheckboxMarked
|
||||
mdiArrowUpDown = mdiArrowUpDown
|
||||
mdiDragVertical = mdiDragVertical
|
||||
|
||||
validGcodeExtensions = validGcodeExtensions
|
||||
formatDate = formatDate
|
||||
formatFilesize = formatFilesize
|
||||
formatPrintTime = formatPrintTime
|
||||
sortFiles = sortFiles
|
||||
@@ -630,29 +670,13 @@ export default class GcodefilesPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
private search = ''
|
||||
private draggingFile: draggingFile = {
|
||||
item: {
|
||||
isDirectory: false,
|
||||
filename: '',
|
||||
permissions: '',
|
||||
modified: new Date(),
|
||||
small_thumbnail: null,
|
||||
big_thumbnail: null,
|
||||
big_thumbnail_width: null,
|
||||
count_printed: 0,
|
||||
last_filament_used: null,
|
||||
last_start_time: null,
|
||||
last_end_time: null,
|
||||
last_print_duration: null,
|
||||
last_status: null,
|
||||
last_total_duration: null,
|
||||
},
|
||||
}
|
||||
|
||||
private dialogCreateDirectory = {
|
||||
show: false,
|
||||
name: '',
|
||||
}
|
||||
private contextMenu = {
|
||||
|
||||
private contextMenu: contextMenu = {
|
||||
shown: false,
|
||||
isDirectory: false,
|
||||
touchTimer: undefined,
|
||||
@@ -663,16 +687,7 @@ export default class GcodefilesPanel extends Mixins(BaseMixin) {
|
||||
filename: '',
|
||||
permissions: '',
|
||||
modified: new Date(),
|
||||
},
|
||||
}
|
||||
|
||||
private dialogPrintFile: dialogPrintFile = {
|
||||
show: false,
|
||||
item: {
|
||||
isDirectory: false,
|
||||
filename: '',
|
||||
permissions: '',
|
||||
modified: new Date(),
|
||||
preheat_gcode: null,
|
||||
small_thumbnail: null,
|
||||
big_thumbnail: null,
|
||||
big_thumbnail_width: null,
|
||||
@@ -686,72 +701,60 @@ export default class GcodefilesPanel extends Mixins(BaseMixin) {
|
||||
},
|
||||
}
|
||||
|
||||
private draggingFile: draggingFile = {
|
||||
item: { ...this.contextMenu.item },
|
||||
}
|
||||
|
||||
private dialogPrintFile: dialogPrintFile = {
|
||||
show: false,
|
||||
item: { ...this.contextMenu.item },
|
||||
}
|
||||
|
||||
private dialogAddBatchToQueue: dialogAddBatchToQueue = {
|
||||
show: false,
|
||||
count: 1,
|
||||
item: { ...this.contextMenu.item },
|
||||
}
|
||||
|
||||
private dialogRenameFile: dialogRenameObject = {
|
||||
show: false,
|
||||
newName: '',
|
||||
item: {
|
||||
isDirectory: false,
|
||||
filename: '',
|
||||
permissions: '',
|
||||
modified: new Date(),
|
||||
small_thumbnail: null,
|
||||
big_thumbnail: null,
|
||||
big_thumbnail_width: null,
|
||||
count_printed: 0,
|
||||
last_filament_used: null,
|
||||
last_start_time: null,
|
||||
last_end_time: null,
|
||||
last_print_duration: null,
|
||||
last_status: null,
|
||||
last_total_duration: null,
|
||||
},
|
||||
item: { ...this.contextMenu.item },
|
||||
}
|
||||
|
||||
private dialogRenameDirectory: dialogRenameObject = {
|
||||
show: false,
|
||||
newName: '',
|
||||
item: {
|
||||
isDirectory: false,
|
||||
filename: '',
|
||||
permissions: '',
|
||||
modified: new Date(),
|
||||
small_thumbnail: null,
|
||||
big_thumbnail: null,
|
||||
big_thumbnail_width: null,
|
||||
count_printed: 0,
|
||||
last_filament_used: null,
|
||||
last_start_time: null,
|
||||
last_end_time: null,
|
||||
last_print_duration: null,
|
||||
last_status: null,
|
||||
last_total_duration: null,
|
||||
},
|
||||
item: { ...this.contextMenu.item },
|
||||
}
|
||||
|
||||
private dialogDeleteDirectory: dialogRenameObject = {
|
||||
show: false,
|
||||
newName: '',
|
||||
item: {
|
||||
isDirectory: false,
|
||||
filename: '',
|
||||
permissions: '',
|
||||
modified: new Date(),
|
||||
small_thumbnail: null,
|
||||
big_thumbnail: null,
|
||||
big_thumbnail_width: null,
|
||||
count_printed: 0,
|
||||
last_filament_used: null,
|
||||
last_start_time: null,
|
||||
last_end_time: null,
|
||||
last_print_duration: null,
|
||||
last_status: null,
|
||||
last_total_duration: null,
|
||||
},
|
||||
item: { ...this.contextMenu.item },
|
||||
}
|
||||
|
||||
private deleteSelectedDialog = false
|
||||
|
||||
private input_rules = [(value: string) => value.indexOf(' ') === -1 || 'Name contains spaces!']
|
||||
private isInvalidName = true
|
||||
private nameInputRules = [
|
||||
(value: string) => !!value || this.$t('Files.InvalidNameEmpty'),
|
||||
(value: string) => !this.existsFilename(value) || this.$t('Files.InvalidNameAlreadyExists'),
|
||||
]
|
||||
private countInputRules = [
|
||||
(value: string) => !!value || this.$t('JobQueue.InvalidCountEmpty'),
|
||||
(value: string) => parseInt(value) > 0 || this.$t('JobQueue.InvalidCountGreaterZero'),
|
||||
]
|
||||
|
||||
existsFilename(name: string) {
|
||||
return this.files.findIndex((file: FileStateFile) => file.filename === name) >= 0
|
||||
}
|
||||
|
||||
get gcodeInputFileAccept() {
|
||||
if (this.isIOS) return []
|
||||
|
||||
return validGcodeExtensions
|
||||
}
|
||||
|
||||
get currentPath() {
|
||||
const path = this.$store.state.gui.view.gcodefiles.currentPath
|
||||
@@ -822,6 +825,27 @@ export default class GcodefilesPanel extends Mixins(BaseMixin) {
|
||||
class: 'text-no-wrap',
|
||||
outputType: 'length',
|
||||
},
|
||||
{
|
||||
text: this.$t('Files.ExtruderTemp').toString(),
|
||||
value: 'first_layer_extr_temp',
|
||||
visible: true,
|
||||
class: 'text-no-wrap',
|
||||
outputType: 'temp',
|
||||
},
|
||||
{
|
||||
text: this.$t('Files.BedTemp').toString(),
|
||||
value: 'first_layer_bed_temp',
|
||||
visible: true,
|
||||
class: 'text-no-wrap',
|
||||
outputType: 'temp',
|
||||
},
|
||||
{
|
||||
text: this.$t('Files.ChamberTemp').toString(),
|
||||
value: 'chamber_temp',
|
||||
visible: true,
|
||||
class: 'text-no-wrap',
|
||||
outputType: 'temp',
|
||||
},
|
||||
{
|
||||
text: this.$t('Files.FilamentName').toString(),
|
||||
value: 'filament_name',
|
||||
@@ -1035,7 +1059,7 @@ export default class GcodefilesPanel extends Mixins(BaseMixin) {
|
||||
e.preventDefault()
|
||||
e.target.parentElement.style.backgroundColor = 'transparent'
|
||||
|
||||
let dest = ''
|
||||
let dest: string
|
||||
if (row.filename === '..') {
|
||||
dest =
|
||||
this.currentPath.substring(0, this.currentPath.lastIndexOf('/') + 1) + this.draggingFile.item.filename
|
||||
@@ -1090,7 +1114,7 @@ export default class GcodefilesPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
createDirectoryAction() {
|
||||
if (this.dialogCreateDirectory.name.length && this.dialogCreateDirectory.name.indexOf(' ') === -1) {
|
||||
if (this.dialogCreateDirectory.name.length) {
|
||||
this.dialogCreateDirectory.show = false
|
||||
this.$socket.emit(
|
||||
'server.files.post_directory',
|
||||
@@ -1108,13 +1132,17 @@ export default class GcodefilesPanel extends Mixins(BaseMixin) {
|
||||
)
|
||||
}
|
||||
|
||||
advancedSearch(value: string | number, search: string) {
|
||||
return (
|
||||
value != null &&
|
||||
search != null &&
|
||||
typeof value === 'string' &&
|
||||
value.toString().toLowerCase().indexOf(search.toLowerCase()) !== -1
|
||||
)
|
||||
advancedSearch(value: any, search: string | null) {
|
||||
if (search === null) return false
|
||||
if (typeof value !== 'string') return false
|
||||
|
||||
value = value.toString().toLowerCase()
|
||||
const searchSplits = search.toLowerCase().split(' ')
|
||||
for (const searchWord of searchSplits) {
|
||||
if (!value.includes(searchWord)) return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
refreshMetadata(data: FileStateGcodefile[]) {
|
||||
@@ -1126,14 +1154,6 @@ export default class GcodefilesPanel extends Mixins(BaseMixin) {
|
||||
})
|
||||
}
|
||||
|
||||
created() {
|
||||
this.$socket.emit(
|
||||
'server.files.get_directory',
|
||||
{ path: 'gcodes/' + this.currentPath },
|
||||
{ action: 'files/getDirectory' }
|
||||
)
|
||||
}
|
||||
|
||||
clickRow(item: FileStateGcodefile, force = false) {
|
||||
if (!this.contextMenu.shown || force) {
|
||||
if (force) this.contextMenu.shown = false
|
||||
@@ -1148,22 +1168,41 @@ export default class GcodefilesPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
clickRowGoBack() {
|
||||
this.currentPath = this.currentPath.substr(0, this.currentPath.lastIndexOf('/'))
|
||||
this.currentPath = this.currentPath.slice(0, this.currentPath.lastIndexOf('/'))
|
||||
}
|
||||
|
||||
addToQueue(item: FileStateGcodefile | FileStateFile) {
|
||||
let path = this.currentPath.slice(7)
|
||||
if (path != '') path += '/'
|
||||
const filename = path + item.filename
|
||||
async addToQueue(item: FileStateGcodefile) {
|
||||
let filename = [this.currentPath, item.filename].join('/')
|
||||
if (filename.startsWith('/')) filename = filename.slice(1)
|
||||
|
||||
this.$store.dispatch('server/jobQueue/addToQueue', [filename])
|
||||
await this.$store.dispatch('server/jobQueue/addToQueue', [filename])
|
||||
}
|
||||
|
||||
openAddBatchToQueueDialog(item: FileStateGcodefile) {
|
||||
this.dialogAddBatchToQueue.show = true
|
||||
this.dialogAddBatchToQueue.count = 1
|
||||
this.dialogAddBatchToQueue.item = item
|
||||
}
|
||||
|
||||
async addBatchToQueueAction() {
|
||||
let filename = [this.currentPath, this.dialogAddBatchToQueue.item.filename].join('/')
|
||||
if (filename.startsWith('/')) filename = filename.slice(1)
|
||||
|
||||
const array: string[] = []
|
||||
for (let i = 0; i < this.dialogAddBatchToQueue.count; i++) {
|
||||
array.push(filename)
|
||||
}
|
||||
|
||||
await this.$store.dispatch('server/jobQueue/addToQueue', array)
|
||||
|
||||
this.dialogAddBatchToQueue.show = false
|
||||
}
|
||||
|
||||
changeMetadataVisible(name: string, value: boolean) {
|
||||
this.$store.dispatch('gui/setGcodefilesMetadata', { name: name, value: value })
|
||||
}
|
||||
|
||||
showContextMenu(e: any, item: FileStateGcodefile | FileStateFile) {
|
||||
showContextMenu(e: any, item: FileStateGcodefile) {
|
||||
if (!this.contextMenu.shown) {
|
||||
e?.preventDefault()
|
||||
this.contextMenu.shown = true
|
||||
@@ -1176,29 +1215,6 @@ export default class GcodefilesPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
}
|
||||
|
||||
preheat() {
|
||||
const file: any = this.contextMenu.item
|
||||
|
||||
if (
|
||||
'first_layer_extr_temp' in file &&
|
||||
'first_layer_bed_temp' in file &&
|
||||
!['error', 'printing', 'paused'].includes(this.printer_state)
|
||||
) {
|
||||
let gcode = ''
|
||||
if (file.first_layer_extr_temp > 0) {
|
||||
gcode = 'M104 S' + file.first_layer_extr_temp
|
||||
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: gcode })
|
||||
}
|
||||
|
||||
if (file.first_layer_bed_temp > 0) {
|
||||
gcode = 'M140 S' + file.first_layer_bed_temp
|
||||
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: gcode })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
editFile(item: FileStateGcodefile) {
|
||||
this.$store.dispatch('editor/openFile', {
|
||||
root: 'gcodes',
|
||||
@@ -1216,6 +1232,36 @@ export default class GcodefilesPanel extends Mixins(BaseMixin) {
|
||||
window.open(href)
|
||||
}
|
||||
|
||||
async downloadSelectedFiles() {
|
||||
let items: string[] = []
|
||||
|
||||
const addElementToItems = async (absolutPath: string, directory: FileStateFile[]) => {
|
||||
for (const file of directory) {
|
||||
const filePath = `${absolutPath}/${file.filename}`
|
||||
|
||||
if (file.isDirectory && file.childrens) {
|
||||
await addElementToItems(filePath, file.childrens)
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
items.push(filePath)
|
||||
}
|
||||
}
|
||||
|
||||
await addElementToItems('gcodes/' + this.currentPath, this.selectedFiles)
|
||||
const date = new Date()
|
||||
const timestamp = `${date.getFullYear()}${date.getMonth()}${date.getDay()}-${date.getHours()}${date.getMinutes()}${date.getSeconds()}`
|
||||
|
||||
this.$socket.emit(
|
||||
'server.files.zip',
|
||||
{ items, dest: `config/gcodes-${timestamp}.zip` },
|
||||
{ action: 'files/downloadZip', loading: 'gcodeDownloadZip' }
|
||||
)
|
||||
|
||||
this.selectedFiles = []
|
||||
}
|
||||
|
||||
renameFile(item: FileStateGcodefile) {
|
||||
this.dialogRenameFile.item = item
|
||||
this.dialogRenameFile.newName = item.filename
|
||||
@@ -1299,6 +1345,7 @@ export default class GcodefilesPanel extends Mixins(BaseMixin) {
|
||||
permissions: '',
|
||||
modified: new Date(),
|
||||
count_printed: 0,
|
||||
preheat_gcode: null,
|
||||
small_thumbnail: null,
|
||||
big_thumbnail: null,
|
||||
big_thumbnail_width: null,
|
||||
@@ -1326,7 +1373,7 @@ export default class GcodefilesPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
view3D(item: FileStateFile) {
|
||||
this.$router.push({ path: '/viewer', query: { filename: this.currentPath + '/' + item.filename } })
|
||||
this.$router.push({ path: '/viewer', query: { filename: 'gcodes' + this.currentPath + '/' + item.filename } })
|
||||
}
|
||||
|
||||
deleteSelectedFiles() {
|
||||
@@ -1359,7 +1406,7 @@ export default class GcodefilesPanel extends Mixins(BaseMixin) {
|
||||
return formatFilesize(value)
|
||||
|
||||
case 'date':
|
||||
return this.formatDate(value)
|
||||
return this.formatDateTime(value)
|
||||
|
||||
case 'time':
|
||||
return this.formatPrintTime(value)
|
||||
@@ -1382,3 +1429,54 @@ export default class GcodefilesPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
._spin_button_group {
|
||||
width: 24px;
|
||||
margin-top: -6px;
|
||||
margin-left: -6px;
|
||||
margin-bottom: -6px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
/*noinspection CssUnusedSymbol*/
|
||||
.files-table .v-data-table-header__icon {
|
||||
margin-left: 7px;
|
||||
}
|
||||
|
||||
.files-table .file-list-cursor:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/*noinspection CssUnusedSymbol*/
|
||||
.file-list--select-td {
|
||||
width: 20px;
|
||||
}
|
||||
|
||||
/*noinspection CssUnusedSymbol*/
|
||||
.files-table th.text-start {
|
||||
padding-right: 0 !important;
|
||||
}
|
||||
|
||||
/*noinspection CssUnusedSymbol*/
|
||||
.v-chip.minimum-chip {
|
||||
padding: 0;
|
||||
min-width: 24px;
|
||||
}
|
||||
|
||||
/*noinspection CssUnusedSymbol*/
|
||||
.v-chip.minimum-chip .v-chip__content {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/*noinspection CssUnusedSymbol*/
|
||||
.file-list__count_printed {
|
||||
position: relative;
|
||||
top: 1px;
|
||||
}
|
||||
|
||||
.handle {
|
||||
cursor: move;
|
||||
}
|
||||
</style>
|
||||
@@ -12,7 +12,7 @@
|
||||
<div>
|
||||
<panel
|
||||
:icon="mdiFileDocumentMultipleOutline"
|
||||
:title="$t('History.PrintHistory')"
|
||||
:title="$t('History.PrintHistory').toString()"
|
||||
card-class="history-list-panel">
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
@@ -246,7 +246,7 @@
|
||||
persistent
|
||||
@keydown.esc="detailsDialog.boolShow = false">
|
||||
<panel
|
||||
:title="$t('History.JobDetails')"
|
||||
:title="$t('History.JobDetails').toString()"
|
||||
:icon="mdiUpdate"
|
||||
card-class="history-detail-dialog"
|
||||
:margin-bottom="false">
|
||||
@@ -272,7 +272,9 @@
|
||||
<v-divider class="my-3"></v-divider>
|
||||
<v-row>
|
||||
<v-col>{{ $t('History.LastModified') }}</v-col>
|
||||
<v-col class="text-right">{{ formatDate(detailsDialog.item.metadata.modified) }}</v-col>
|
||||
<v-col class="text-right">
|
||||
{{ formatDateTime(detailsDialog.item.metadata.modified * 1000) }}
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
<v-divider class="my-3"></v-divider>
|
||||
@@ -289,13 +291,15 @@
|
||||
<v-divider class="my-3"></v-divider>
|
||||
<v-row>
|
||||
<v-col>{{ $t('History.StartTime') }}</v-col>
|
||||
<v-col class="text-right">{{ formatDate(detailsDialog.item.start_time) }}</v-col>
|
||||
<v-col class="text-right">{{ formatDateTime(detailsDialog.item.start_time * 1000) }}</v-col>
|
||||
</v-row>
|
||||
<template v-if="'end_time' in detailsDialog.item && detailsDialog.item.end_time > 0">
|
||||
<v-divider class="my-3"></v-divider>
|
||||
<v-row>
|
||||
<v-col>{{ $t('History.EndTime') }}</v-col>
|
||||
<v-col class="text-right">{{ formatDate(detailsDialog.item.end_time) }}</v-col>
|
||||
<v-col class="text-right">
|
||||
{{ formatDateTime(detailsDialog.item.end_time * 1000) }}
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
<template
|
||||
@@ -427,7 +431,10 @@
|
||||
</panel>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="deleteSelectedDialog" max-width="400">
|
||||
<panel :title="$t('History.Delete')" card-class="history-delete-selected-dialog" :margin-bottom="false">
|
||||
<panel
|
||||
:title="$t('History.Delete').toString()"
|
||||
card-class="history-delete-selected-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="deleteSelectedDialog = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
@@ -761,12 +768,6 @@ export default class HistoryListPanel extends Mixins(BaseMixin) {
|
||||
this.$socket.emit('server.history.list', { start: 0, limit: 50 }, { action: 'server/history/getHistory' })
|
||||
}
|
||||
|
||||
formatDate(date: number) {
|
||||
const tmp2 = new Date(date * 1000)
|
||||
|
||||
return tmp2.toLocaleString().replace(',', '')
|
||||
}
|
||||
|
||||
formatPrintTime(totalSeconds: number) {
|
||||
if (totalSeconds) {
|
||||
let output = ''
|
||||
@@ -948,14 +949,24 @@ export default class HistoryListPanel extends Mixins(BaseMixin) {
|
||||
|
||||
row.push('filename')
|
||||
row.push('status')
|
||||
|
||||
this.tableFields.forEach((col) => {
|
||||
row.push(col.value)
|
||||
})
|
||||
|
||||
if (this.headers.find((header) => header.value === 'slicer')?.visible) {
|
||||
row.push('slicer')
|
||||
}
|
||||
|
||||
content.push(row)
|
||||
|
||||
if (this.jobs.length) {
|
||||
this.jobs.forEach((job: ServerHistoryStateJob) => {
|
||||
let jobs = [...this.jobs]
|
||||
if (this.selectedJobs.length) {
|
||||
jobs = [...this.selectedJobs]
|
||||
}
|
||||
|
||||
if (jobs.length) {
|
||||
jobs.forEach((job: ServerHistoryStateJob) => {
|
||||
const row: string[] = []
|
||||
|
||||
let filename = job.filename
|
||||
@@ -1003,15 +1014,15 @@ export default class HistoryListPanel extends Mixins(BaseMixin) {
|
||||
if (!format) {
|
||||
switch (col.outputType) {
|
||||
case 'date':
|
||||
return this.formatDate(value)
|
||||
return this.formatDateTime(value * 1000)
|
||||
|
||||
case 'time':
|
||||
return value.toFixed()
|
||||
return value?.toFixed() ?? ''
|
||||
|
||||
default:
|
||||
switch (typeof value) {
|
||||
case 'number':
|
||||
return value.toLocaleString()
|
||||
return value?.toLocaleString(undefined, { useGrouping: false }) ?? 0
|
||||
|
||||
case 'string':
|
||||
if (escapeChar !== null && value.includes(escapeChar)) value = '"' + value + '"'
|
||||
@@ -1028,18 +1039,18 @@ export default class HistoryListPanel extends Mixins(BaseMixin) {
|
||||
return formatFilesize(value)
|
||||
|
||||
case 'date':
|
||||
return this.formatDate(value)
|
||||
return this.formatDateTime(value * 1000)
|
||||
|
||||
case 'time':
|
||||
return this.formatPrintTime(value)
|
||||
|
||||
case 'temp':
|
||||
return value.toFixed() + ' °C'
|
||||
return value?.toFixed() + ' °C'
|
||||
|
||||
case 'length':
|
||||
if (value > 1000) return (value / 1000).toFixed(2) + ' m'
|
||||
|
||||
return value.toFixed(2) + ' mm'
|
||||
return value?.toFixed(2) + ' mm'
|
||||
|
||||
default:
|
||||
return value
|
||||
|
||||
@@ -57,11 +57,23 @@
|
||||
</v-simple-table>
|
||||
</v-col>
|
||||
<v-col class="col-12 col-sm-6 col-md-4">
|
||||
<history-all-print-status></history-all-print-status>
|
||||
<history-all-print-status-chart
|
||||
v-if="togglePrintStatus === 'chart'"></history-all-print-status-chart>
|
||||
<history-all-print-status-table v-else></history-all-print-status-table>
|
||||
<div class="text-center mb-3">
|
||||
<v-btn-toggle v-model="togglePrintStatus" small mandatory>
|
||||
<v-btn small value="chart">
|
||||
{{ $t('History.Chart') }}
|
||||
</v-btn>
|
||||
<v-btn small value="table">
|
||||
{{ $t('History.Table') }}
|
||||
</v-btn>
|
||||
</v-btn-toggle>
|
||||
</div>
|
||||
</v-col>
|
||||
<v-col class="col-12 col-sm-12 col-md-4">
|
||||
<history-filament-usage v-if="toggleChart === 'filament_usage'"></history-filament-usage>
|
||||
<history-printtime-avg v-if="toggleChart === 'printtime_avg'"></history-printtime-avg>
|
||||
<history-printtime-avg v-else-if="toggleChart === 'printtime_avg'"></history-printtime-avg>
|
||||
<div class="text-center mt-3">
|
||||
<v-btn-toggle v-model="toggleChart" small mandatory>
|
||||
<v-btn small value="filament_usage">
|
||||
@@ -84,11 +96,11 @@ import BaseMixin from '@/components/mixins/base'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import HistoryFilamentUsage from '@/components/charts/HistoryFilamentUsage.vue'
|
||||
import HistoryPrinttimeAvg from '@/components/charts/HistoryPrinttimeAvg.vue'
|
||||
import HistoryAllPrintStatus from '@/components/charts/HistoryAllPrintStatus.vue'
|
||||
import HistoryAllPrintStatusChart from '@/components/charts/HistoryAllPrintStatusChart.vue'
|
||||
import { ServerHistoryStateJob } from '@/store/server/history/types'
|
||||
import { mdiChartAreaspline } from '@mdi/js'
|
||||
@Component({
|
||||
components: { Panel, HistoryFilamentUsage, HistoryPrinttimeAvg, HistoryAllPrintStatus },
|
||||
components: { Panel, HistoryFilamentUsage, HistoryPrinttimeAvg, HistoryAllPrintStatusChart },
|
||||
})
|
||||
export default class HistoryStatisticsPanel extends Mixins(BaseMixin) {
|
||||
mdiChartAreaspline = mdiChartAreaspline
|
||||
@@ -177,6 +189,14 @@ export default class HistoryStatisticsPanel extends Mixins(BaseMixin) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'view.history.toggleChartCol3', value: newVal })
|
||||
}
|
||||
|
||||
get togglePrintStatus() {
|
||||
return this.$store.state.gui.view.history.toggleChartCol2
|
||||
}
|
||||
|
||||
set togglePrintStatus(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'view.history.toggleChartCol2', value: newVal })
|
||||
}
|
||||
|
||||
formatPrintTime(totalSeconds: number) {
|
||||
if (totalSeconds) {
|
||||
let output = ''
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<template>
|
||||
<div>
|
||||
<panel ref="jobqueuePanel" :icon="mdiTrayFull" :title="$t('JobQueue.JobQueue')" card-class="jobqueue-panel">
|
||||
<panel
|
||||
ref="jobqueuePanel"
|
||||
:icon="mdiTrayFull"
|
||||
:title="$t('JobQueue.JobQueue').toString()"
|
||||
card-class="jobqueue-panel">
|
||||
<template #buttons>
|
||||
<v-btn
|
||||
v-if="queueState === 'paused'"
|
||||
@@ -48,97 +52,29 @@
|
||||
</template>
|
||||
|
||||
<template #item="{ item }">
|
||||
<tr
|
||||
:key="item.job_id"
|
||||
v-longpress:600="(e) => showContextMenu(e, item)"
|
||||
class="file-list-cursor user-select-none"
|
||||
@contextmenu="showContextMenu($event, item)">
|
||||
<td class="pr-0 text-center" style="width: 32px">
|
||||
<template v-if="getSmallThumbnail(item) && getBigThumbnail(item)">
|
||||
<v-tooltip
|
||||
v-if="!item.isDirectory && getSmallThumbnail(item) && getBigThumbnail(item)"
|
||||
top
|
||||
content-class="tooltip__content-opacity1">
|
||||
<template #activator="{ on, attrs }">
|
||||
<vue-load-image>
|
||||
<img
|
||||
slot="image"
|
||||
:src="getSmallThumbnail(item)"
|
||||
width="32"
|
||||
height="32"
|
||||
v-bind="attrs"
|
||||
v-on="on" />
|
||||
<v-progress-circular
|
||||
slot="preloader"
|
||||
indeterminate
|
||||
color="primary"></v-progress-circular>
|
||||
<v-icon slot="error">{{ mdiFile }}</v-icon>
|
||||
</vue-load-image>
|
||||
</template>
|
||||
<span><img :src="getBigThumbnail(item)" width="250" /></span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
<template v-else-if="getSmallThumbnail(item)">
|
||||
<vue-load-image>
|
||||
<img slot="image" :src="getSmallThumbnail(item)" width="32" height="32" />
|
||||
<v-progress-circular
|
||||
slot="preloader"
|
||||
indeterminate
|
||||
color="primary"></v-progress-circular>
|
||||
<v-icon slot="error">{{ mdiFile }}</v-icon>
|
||||
</vue-load-image>
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-icon>{{ mdiFile }}</v-icon>
|
||||
</template>
|
||||
</td>
|
||||
<td class=" ">
|
||||
<div class="d-block text-truncate" :style="styleContentTdWidth">{{ item.filename }}</div>
|
||||
<small v-if="existMetadata(item)">{{ getDescription(item) }}</small>
|
||||
</td>
|
||||
</tr>
|
||||
<jobqueue-entry :key="item.job_id" :item="item" :content-td-width="contentTdWidth" />
|
||||
</template>
|
||||
</v-data-table>
|
||||
<resize-observer @notify="handleResize" />
|
||||
</panel>
|
||||
<v-menu v-model="contextMenu.shown" :position-x="contextMenu.x" :position-y="contextMenu.y" absolute offset-y>
|
||||
<v-list>
|
||||
<v-list-item @click="deleteJob(contextMenu.item)">
|
||||
<v-icon class="mr-1">{{ mdiPlaylistRemove }}</v-icon>
|
||||
{{ $t('JobQueue.RemoveFromQueue') }}
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { ServerHistoryStateJob } from '@/store/server/history/types'
|
||||
import { formatFilesize, formatPrintTime } from '@/plugins/helpers'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import { ServerJobQueueStateJob } from '@/store/server/jobQueue/types'
|
||||
import { mdiPlay, mdiPause, mdiFile, mdiPlaylistRemove, mdiTrayFull } from '@mdi/js'
|
||||
import { mdiPlay, mdiPause, mdiTrayFull } from '@mdi/js'
|
||||
import JobqueueEntry from '@/components/panels/Status/JobqueueEntry.vue'
|
||||
@Component({
|
||||
components: { Panel },
|
||||
components: { JobqueueEntry, Panel },
|
||||
})
|
||||
export default class JobqueuePanel extends Mixins(BaseMixin) {
|
||||
mdiPlay = mdiPlay
|
||||
mdiPause = mdiPause
|
||||
mdiFile = mdiFile
|
||||
mdiPlaylistRemove = mdiPlaylistRemove
|
||||
mdiTrayFull = mdiTrayFull
|
||||
|
||||
formatFilesize = formatFilesize
|
||||
|
||||
private contentTdWidth = 100
|
||||
private contextMenu = {
|
||||
shown: false,
|
||||
touchTimer: undefined,
|
||||
x: 0,
|
||||
y: 0,
|
||||
item: {},
|
||||
}
|
||||
|
||||
declare $refs: {
|
||||
jobqueuePanel: any
|
||||
@@ -160,27 +96,6 @@ export default class JobqueuePanel extends Mixins(BaseMixin) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'view.jobqueue.countPerPage', value: newVal })
|
||||
}
|
||||
|
||||
get styleContentTdWidth() {
|
||||
return `width: ${this.contentTdWidth}px;`
|
||||
}
|
||||
|
||||
showContextMenu(e: any, item: ServerHistoryStateJob) {
|
||||
if (!this.contextMenu.shown) {
|
||||
e?.preventDefault()
|
||||
this.contextMenu.shown = true
|
||||
this.contextMenu.x = e?.clientX || e?.pageX || window.screenX / 2
|
||||
this.contextMenu.y = e?.clientY || e?.pageY || window.screenY / 2
|
||||
this.contextMenu.item = item
|
||||
this.$nextTick(() => {
|
||||
this.contextMenu.shown = true
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
deleteJob(item: ServerJobQueueStateJob) {
|
||||
this.$store.dispatch('server/jobQueue/deleteFromQueue', [item.job_id])
|
||||
}
|
||||
|
||||
startJobqueue() {
|
||||
this.$store.dispatch('server/jobQueue/start')
|
||||
}
|
||||
@@ -189,46 +104,24 @@ export default class JobqueuePanel extends Mixins(BaseMixin) {
|
||||
this.$store.dispatch('server/jobQueue/pause')
|
||||
}
|
||||
|
||||
getSmallThumbnail(item: ServerJobQueueStateJob) {
|
||||
return this.$store.getters['server/jobQueue/getSmallThumbnail'](item)
|
||||
}
|
||||
|
||||
getBigThumbnail(item: ServerJobQueueStateJob) {
|
||||
return this.$store.getters['server/jobQueue/getBigThumbnail'](item)
|
||||
}
|
||||
|
||||
getDescription(item: ServerJobQueueStateJob) {
|
||||
let output = ''
|
||||
|
||||
output += this.$t('Files.Filament') + ': '
|
||||
if (item.metadata?.filament_total || item.metadata.filament_weight_total) {
|
||||
if (item.metadata?.filament_total) output += item.metadata.filament_total.toFixed() + ' mm'
|
||||
if (item.metadata?.filament_total && item.metadata.filament_weight_total) output += ' / '
|
||||
if (item.metadata?.filament_weight_total) output += item.metadata.filament_weight_total.toFixed(2) + ' g'
|
||||
} else output += '--'
|
||||
|
||||
output += ', ' + this.$t('Files.PrintTime') + ': '
|
||||
if (item.metadata?.estimated_time) output += formatPrintTime(item.metadata.estimated_time)
|
||||
else output += '--'
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
existMetadata(item: ServerJobQueueStateJob) {
|
||||
return item?.metadata?.metadataPulled
|
||||
}
|
||||
|
||||
mounted() {
|
||||
window.addEventListener('resize', this.eventListenerResize)
|
||||
this.eventListenerResize()
|
||||
this.calcContentTdWidth()
|
||||
}
|
||||
|
||||
destroyed() {
|
||||
window.removeEventListener('resize', this.eventListenerResize)
|
||||
}
|
||||
|
||||
eventListenerResize() {
|
||||
calcContentTdWidth() {
|
||||
this.contentTdWidth = this.$refs.jobqueuePanel?.$el?.clientWidth - 48 - 32
|
||||
}
|
||||
|
||||
handleResize() {
|
||||
this.$nextTick(() => {
|
||||
this.calcContentTdWidth()
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.jobqueue-panel {
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
@@ -1,37 +1,106 @@
|
||||
<template>
|
||||
<panel
|
||||
v-if="klipperState !== 'ready' && socketIsConnected"
|
||||
:icon="mdiAlertCircle"
|
||||
:title="$t('Panels.KlippyStatePanel.KlippyState') + ': ' + klipperState"
|
||||
card-class="klippy-state-panel">
|
||||
<div v-if="klipperState !== 'ready' && socketIsConnected">
|
||||
<template v-if="klippyIsConnected">
|
||||
<v-card-text v-if="klippy_message !== null" class="py-1 mt-2">
|
||||
<pre style="white-space: pre-wrap">{{ klippy_message }}</pre>
|
||||
</v-card-text>
|
||||
<v-card-text v-else class="text-center py-3">
|
||||
<v-progress-circular indeterminate color="primary"></v-progress-circular>
|
||||
</v-card-text>
|
||||
<v-divider class="mt-2"></v-divider>
|
||||
<v-card-actions class="justify-start">
|
||||
<v-btn small class="ml-2 error--text" @click="restart">
|
||||
<v-icon class="mr-sm-2">{{ mdiRestart }}</v-icon>
|
||||
{{ $t('Panels.KlippyStatePanel.Restart') }}
|
||||
</v-btn>
|
||||
<v-btn small class="ml-4 error--text" @click="firmwareRestart">
|
||||
<v-icon class="mr-sm-2">{{ mdiRestart }}</v-icon>
|
||||
{{ $t('Panels.KlippyStatePanel.FirmwareRestart') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
<v-alert :color="messageType.color" dense text border="left" class="mb-0 mb-6">
|
||||
<!-- KLIPPER MESSAGE TITLE -->
|
||||
<p class="font-weight-medium d-flex align-center">
|
||||
<v-icon :color="messageType.color" class="pr-2">{{ messageType.icon }}</v-icon>
|
||||
{{ $t('Panels.KlippyStatePanel.ServiceReports', { service: 'Klipper' }) }}:
|
||||
{{ klipperState.toUpperCase() }}
|
||||
</p>
|
||||
<!-- KLIPPER MESSAGE -->
|
||||
<div v-if="klippy_message !== null">
|
||||
<pre style="white-space: pre-wrap">{{ klippy_message.trim() }}</pre>
|
||||
<v-divider class="mt-2 pb-3"></v-divider>
|
||||
<v-row>
|
||||
<!-- RESTART BUTTONS -->
|
||||
<v-col>
|
||||
<v-btn
|
||||
small
|
||||
outlined
|
||||
text
|
||||
:class="`${messageType.color}--text my-1`"
|
||||
style="width: 100%"
|
||||
@click="restart">
|
||||
<v-icon class="mr-sm-2">{{ mdiRestart }}</v-icon>
|
||||
{{ $t('Panels.KlippyStatePanel.Restart') }}
|
||||
</v-btn>
|
||||
<v-btn
|
||||
small
|
||||
outlined
|
||||
text
|
||||
:class="`${messageType.color}--text my-1`"
|
||||
style="width: 100%"
|
||||
@click="firmwareRestart">
|
||||
<v-icon class="mr-sm-2">{{ mdiRestart }}</v-icon>
|
||||
{{ $t('Panels.KlippyStatePanel.FirmwareRestart') }}
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<!-- LOG DOWNLOAD BUTTONS -->
|
||||
<v-col>
|
||||
<v-btn
|
||||
:href="apiUrl + '/server/files/klippy.log'"
|
||||
small
|
||||
outlined
|
||||
text
|
||||
:class="`${messageType.color}--text my-1`"
|
||||
style="width: 100%"
|
||||
@click="downloadLog">
|
||||
<v-icon class="mr-2">{{ mdiDownload }}</v-icon>
|
||||
Klipper Log
|
||||
</v-btn>
|
||||
<v-btn
|
||||
:href="apiUrl + '/server/files/moonraker.log'"
|
||||
small
|
||||
outlined
|
||||
text
|
||||
:class="`${messageType.color}--text my-1`"
|
||||
style="width: 100%"
|
||||
@click="downloadLog">
|
||||
<v-icon class="mr-2">{{ mdiDownload }}</v-icon>
|
||||
Moonraker Log
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
<!-- LOADER -->
|
||||
<v-card-text v-else class="text-center py-3">
|
||||
<v-progress-circular indeterminate :color="messageType.color"></v-progress-circular>
|
||||
</v-card-text>
|
||||
</v-alert>
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-card-text class="pt-5 pb-1">
|
||||
<!-- Power OFF panel -->
|
||||
<template v-else-if="isPrinterPowerOff">
|
||||
<v-alert dense text border="left" class="mb-6">
|
||||
<p class="font-weight-medium d-flex align-center">
|
||||
<v-icon class="pr-2">{{ messageType.icon }}</v-icon>
|
||||
{{ $t('Panels.KlippyStatePanel.PrinterSwitchedOff') }}
|
||||
</p>
|
||||
<p>{{ $t('Panels.KlippyStatePanel.PrinterSwitchedOffDescription') }}</p>
|
||||
<v-row>
|
||||
<v-col class="text-center">
|
||||
<v-btn small outlined text :class="`${messageType.color}--text my-1`" @click="powerOn">
|
||||
<v-icon class="mr-sm-2">{{ mdiPower }}</v-icon>
|
||||
{{ $t('Panels.KlippyStatePanel.PowerOn') }}
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-alert>
|
||||
</template>
|
||||
<!-- DISCONNECTED INFOGRAPHIC -->
|
||||
<template v-else-if="klipperState === 'disconnected'">
|
||||
<v-alert dense text border="left" class="mb-6">
|
||||
<p class="font-weight-medium d-flex align-center">
|
||||
<v-icon class="pr-2">{{ messageType.icon }}</v-icon>
|
||||
{{ $t('Panels.KlippyStatePanel.ServiceReports', { service: 'Moonraker' }) }}:
|
||||
{{ klipperState.toUpperCase() }}
|
||||
</p>
|
||||
<connection-status :moonraker="true" :klipper="false"></connection-status>
|
||||
<p class="mt-2 mb-0 text-center">{{ $t('Panels.KlippyStatePanel.MoonrakerCannotConnect') }}</p>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<p class="mt-2">{{ $t('Panels.KlippyStatePanel.KlipperCheck') }}</p>
|
||||
</v-card-text>
|
||||
<p class="mb-0 text-center">{{ $t('Panels.KlippyStatePanel.CheckKlippyAndUdsAddress') }}</p>
|
||||
</v-alert>
|
||||
</template>
|
||||
</panel>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -40,21 +109,45 @@ import { Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '../mixins/base'
|
||||
import ConnectionStatus from '../ui/ConnectionStatus.vue'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import { mdiAlertCircle, mdiRestart } from '@mdi/js'
|
||||
import {
|
||||
mdiRestart,
|
||||
mdiDownload,
|
||||
mdiMessageOutline,
|
||||
mdiAlertOutline,
|
||||
mdiRocketLaunch,
|
||||
mdiConnection,
|
||||
mdiPrinter3d,
|
||||
mdiPower,
|
||||
} from '@mdi/js'
|
||||
|
||||
@Component({
|
||||
components: { Panel, ConnectionStatus },
|
||||
})
|
||||
export default class KlippyStatePanel extends Mixins(BaseMixin) {
|
||||
//private timer: number | null = null
|
||||
|
||||
mdiAlertCircle = mdiAlertCircle
|
||||
mdiPrinter3d = mdiPrinter3d
|
||||
mdiRestart = mdiRestart
|
||||
mdiDownload = mdiDownload
|
||||
mdiPower = mdiPower
|
||||
|
||||
get klippy_message() {
|
||||
return this.$store.state.server.klippy_message ?? null
|
||||
}
|
||||
|
||||
get messageType(): { color: string; icon: string } {
|
||||
switch (this.klipperState) {
|
||||
case 'startup':
|
||||
return { color: 'info', icon: mdiRocketLaunch }
|
||||
case 'shutdown':
|
||||
return { color: 'warning', icon: mdiAlertOutline }
|
||||
case 'error':
|
||||
return { color: 'error', icon: mdiAlertOutline }
|
||||
case 'disconnected':
|
||||
return { color: '', icon: mdiConnection }
|
||||
default:
|
||||
return { color: '', icon: mdiMessageOutline }
|
||||
}
|
||||
}
|
||||
|
||||
restart() {
|
||||
this.$socket.emit('printer.restart', {}, { loading: 'restart' })
|
||||
}
|
||||
@@ -63,22 +156,24 @@ export default class KlippyStatePanel extends Mixins(BaseMixin) {
|
||||
this.$socket.emit('printer.firmware_restart', {}, { loading: 'firmwareRestart' })
|
||||
}
|
||||
|
||||
/*requestKlippyState() {
|
||||
this.$socket.emit('printer.info', {}, { action: 'printer/getInfo' })
|
||||
downloadLog(event: any) {
|
||||
event.preventDefault()
|
||||
let href = ''
|
||||
if ('href' in event.target.attributes) href = event.target.attributes.href.value
|
||||
if ('href' in event.target.parentElement.attributes) href = event.target.parentElement.attributes.href.value
|
||||
|
||||
window.open(href)
|
||||
}
|
||||
|
||||
@Watch('klipperState')
|
||||
klipperStateChanged(newVal: string) {
|
||||
if (['ready', 'disconnected'].includes(newVal)) {
|
||||
if (this.timer) {
|
||||
clearInterval(this.timer)
|
||||
this.timer = null
|
||||
}
|
||||
} else if (this.timer === null) {
|
||||
this.timer = setInterval(() => {
|
||||
this.requestKlippyState()
|
||||
}, 2000)
|
||||
}
|
||||
}*/
|
||||
powerOn() {
|
||||
this.$socket.emit(
|
||||
'machine.device_power.post_device',
|
||||
{
|
||||
device: this.printerPowerDevice,
|
||||
action: 'on',
|
||||
},
|
||||
{ action: 'server/power/responseToggle' }
|
||||
)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -3,16 +3,17 @@
|
||||
<template>
|
||||
<div>
|
||||
<panel
|
||||
:title="$t('Machine.ConfigFilesPanel.ConfigFiles')"
|
||||
:title="$t('Machine.ConfigFilesPanel.ConfigFiles').toString()"
|
||||
card-class="machine-configfiles-panel"
|
||||
:icon="mdiInformation">
|
||||
:icon="mdiInformation"
|
||||
:collapsible="true">
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col class="col-12 col-lg pr-lg-0">
|
||||
<v-select
|
||||
v-model="root"
|
||||
class="machine-configfiles-panel__root-select"
|
||||
:items="registeredDirectories"
|
||||
:items="registeredDirectoriesSelectItems"
|
||||
:label="$t('Machine.ConfigFilesPanel.Root')"
|
||||
outlined
|
||||
hide-details
|
||||
@@ -70,7 +71,7 @@
|
||||
{{ absolutePath }}
|
||||
</span>
|
||||
<v-spacer></v-spacer>
|
||||
<template v-if="disk_usage !== null">
|
||||
<template v-if="disk_usage !== null && !showMissingConfigRootWarning">
|
||||
<v-tooltip top>
|
||||
<template #activator="{ on, attrs }">
|
||||
<span v-bind="attrs" v-on="on">
|
||||
@@ -83,7 +84,8 @@
|
||||
<br />
|
||||
{{ $t('Machine.ConfigFilesPanel.Free') }}: {{ formatFilesize(disk_usage.free) }}
|
||||
<br />
|
||||
{{ $t('Machine.ConfigFilesPanel.Total') }}: {{ formatFilesize(disk_usage.total) }}
|
||||
{{ $t('Machine.ConfigFilesPanel.Total') }}:
|
||||
{{ formatFilesize(disk_usage.total) }}
|
||||
</span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
@@ -92,6 +94,7 @@
|
||||
</v-card-text>
|
||||
<v-divider></v-divider>
|
||||
<v-data-table
|
||||
v-if="!showMissingConfigRootWarning"
|
||||
v-model="selectedFiles"
|
||||
:items="files"
|
||||
class="files-table"
|
||||
@@ -159,10 +162,26 @@
|
||||
<td class="text-no-wrap text-right">
|
||||
{{ item.isDirectory ? '--' : formatFilesize(item.size) }}
|
||||
</td>
|
||||
<td class="text-right">{{ formatDate(item.modified) }}</td>
|
||||
<td class="text-right">{{ formatDateTime(item.modified) }}</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
<v-card-text v-else>
|
||||
<v-row>
|
||||
<v-col class="col-12 col-lg pr-lg-0">
|
||||
<v-alert
|
||||
dense
|
||||
text
|
||||
type="warning"
|
||||
elevation="2"
|
||||
class="mx-auto mt-6"
|
||||
max-width="500"
|
||||
:icon="mdiLockOutline">
|
||||
{{ $t('Machine.ConfigFilesPanel.ConfigRootDirectoryDoesntExists') }}
|
||||
</v-alert>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
<v-menu v-model="contextMenu.shown" :position-x="contextMenu.x" :position-y="contextMenu.y" absolute offset-y>
|
||||
<v-list>
|
||||
@@ -244,7 +263,7 @@
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogCreateFile.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Machine.ConfigFilesPanel.CreateFile')"
|
||||
:title="$t('Machine.ConfigFilesPanel.CreateFile').toString()"
|
||||
card-class="maschine-configfiles-create-file-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -258,6 +277,8 @@
|
||||
v-model="dialogCreateFile.name"
|
||||
:label="$t('Machine.ConfigFilesPanel.Name')"
|
||||
required
|
||||
:rules="nameInputRules"
|
||||
@update:error="(bool) => (isInvalidName = bool)"
|
||||
@keyup.enter="createFileAction"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
@@ -265,7 +286,7 @@
|
||||
<v-btn color="" text @click="dialogCreateFile.show = false">
|
||||
{{ $t('Machine.ConfigFilesPanel.Cancel') }}
|
||||
</v-btn>
|
||||
<v-btn color="primary" text @click="createFileAction">
|
||||
<v-btn :disabled="isInvalidName" color="primary" text @click="createFileAction">
|
||||
{{ $t('Machine.ConfigFilesPanel.Create') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
@@ -273,7 +294,7 @@
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogRenameFile.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Machine.ConfigFilesPanel.RenameFile')"
|
||||
:title="$t('Machine.ConfigFilesPanel.RenameFile').toString()"
|
||||
card-class="maschine-configfiles-rename-file-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -287,6 +308,8 @@
|
||||
v-model="dialogRenameFile.newName"
|
||||
:label="$t('Machine.ConfigFilesPanel.Name')"
|
||||
required
|
||||
:rules="nameInputRules"
|
||||
@update:error="(bool) => (isInvalidName = bool)"
|
||||
@keyup.enter="renameFileAction"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
@@ -294,7 +317,7 @@
|
||||
<v-btn color="" text @click="dialogRenameFile.show = false">
|
||||
{{ $t('Machine.ConfigFilesPanel.Cancel') }}
|
||||
</v-btn>
|
||||
<v-btn color="primary" text @click="renameFileAction">
|
||||
<v-btn :disabled="isInvalidName" color="primary" text @click="renameFileAction">
|
||||
{{ $t('Machine.ConfigFilesPanel.Rename') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
@@ -302,7 +325,7 @@
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogCreateDirectory.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Machine.ConfigFilesPanel.CreateDirectory')"
|
||||
:title="$t('Machine.ConfigFilesPanel.CreateDirectory').toString()"
|
||||
card-class="maschine-configfiles-create-directory-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -316,6 +339,8 @@
|
||||
v-model="dialogCreateDirectory.name"
|
||||
:label="$t('Machine.ConfigFilesPanel.Name')"
|
||||
required
|
||||
:rules="nameInputRules"
|
||||
@update:error="(bool) => (isInvalidName = bool)"
|
||||
@keyup.enter="createDirectoryAction"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
@@ -323,7 +348,7 @@
|
||||
<v-btn color="" text @click="dialogCreateDirectory.show = false">
|
||||
{{ $t('Machine.ConfigFilesPanel.Cancel') }}
|
||||
</v-btn>
|
||||
<v-btn color="primary" text @click="createDirectoryAction">
|
||||
<v-btn :disabled="isInvalidName" color="primary" text @click="createDirectoryAction">
|
||||
{{ $t('Machine.ConfigFilesPanel.Create') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
@@ -331,7 +356,7 @@
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogRenameDirectory.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Machine.ConfigFilesPanel.RenameDirectory')"
|
||||
:title="$t('Machine.ConfigFilesPanel.RenameDirectory').toString()"
|
||||
card-class="maschine-configfiles-rename-directory-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -345,6 +370,8 @@
|
||||
v-model="dialogRenameDirectory.newName"
|
||||
:label="$t('Machine.ConfigFilesPanel.Name')"
|
||||
required
|
||||
:rules="nameInputRules"
|
||||
@update:error="(bool) => (isInvalidName = bool)"
|
||||
@keyup.enter="renameDirectoryAction"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
@@ -352,7 +379,7 @@
|
||||
<v-btn color="" text @click="dialogRenameDirectory.show = false">
|
||||
{{ $t('Machine.ConfigFilesPanel.Cancel') }}
|
||||
</v-btn>
|
||||
<v-btn color="primary" text @click="renameDirectoryAction">
|
||||
<v-btn :disabled="isInvalidName" color="primary" text @click="renameDirectoryAction">
|
||||
{{ $t('Machine.ConfigFilesPanel.Rename') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
@@ -360,7 +387,7 @@
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogDeleteDirectory.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Machine.ConfigFilesPanel.DeleteDirectory')"
|
||||
:title="$t('Machine.ConfigFilesPanel.DeleteDirectory').toString()"
|
||||
card-class="maschine-configfiles-delete-directory-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -390,7 +417,7 @@
|
||||
</v-dialog>
|
||||
<v-dialog v-model="deleteSelectedDialog" max-width="400">
|
||||
<panel
|
||||
:title="$t('Machine.ConfigFilesPanel.Delete')"
|
||||
:title="$t('Machine.ConfigFilesPanel.Delete').toString()"
|
||||
card-class="gcode-files-delete-selected-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -435,7 +462,7 @@
|
||||
<script lang="ts">
|
||||
import { Component, Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { formatDate, formatFilesize, sortFiles } from '@/plugins/helpers'
|
||||
import { formatFilesize, sortFiles } from '@/plugins/helpers'
|
||||
import { FileStateFile, FileStateGcodefile } from '@/store/files/types'
|
||||
import axios from 'axios'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
@@ -456,6 +483,7 @@ import {
|
||||
mdiRenameBox,
|
||||
mdiDelete,
|
||||
mdiCloseThick,
|
||||
mdiLockOutline,
|
||||
} from '@mdi/js'
|
||||
|
||||
interface contextMenu {
|
||||
@@ -521,10 +549,10 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
|
||||
mdiRenameBox = mdiRenameBox
|
||||
mdiDelete = mdiDelete
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiLockOutline = mdiLockOutline
|
||||
|
||||
sortFiles = sortFiles
|
||||
formatFilesize = formatFilesize
|
||||
formatDate = formatDate
|
||||
|
||||
declare $refs: {
|
||||
fileUpload: HTMLInputElement
|
||||
@@ -618,6 +646,16 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
|
||||
|
||||
private deleteSelectedDialog = false
|
||||
|
||||
private isInvalidName = true
|
||||
private nameInputRules = [
|
||||
(value: string) => !!value || this.$t('Files.InvalidNameEmpty'),
|
||||
(value: string) => !this.existsFilename(value) || this.$t('Files.InvalidNameAlreadyExists'),
|
||||
]
|
||||
|
||||
existsFilename(name: string) {
|
||||
return this.files.findIndex((file) => file.filename === name) >= 0
|
||||
}
|
||||
|
||||
get blockFileUpload() {
|
||||
return this.$store.state.gui.view.blockFileUpload ?? false
|
||||
}
|
||||
@@ -628,6 +666,17 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
|
||||
|
||||
get toolbarButtons() {
|
||||
return [
|
||||
{
|
||||
text: this.$t('Machine.ConfigFilesPanel.Download'),
|
||||
color: 'primary',
|
||||
icon: mdiCloudDownload,
|
||||
loadingName: 'configDownloadZip',
|
||||
onlyWriteable: false,
|
||||
condition: this.selectedFiles.length > 0,
|
||||
click: () => {
|
||||
this.downloadSelectedFiles()
|
||||
},
|
||||
},
|
||||
{
|
||||
text: this.$t('Machine.ConfigFilesPanel.Delete'),
|
||||
color: 'error',
|
||||
@@ -664,7 +713,7 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
|
||||
loadingName: null,
|
||||
onlyWriteable: true,
|
||||
condition: true,
|
||||
click: this.createDirecotry,
|
||||
click: this.createDirectory,
|
||||
},
|
||||
{
|
||||
text: this.$t('Machine.ConfigFilesPanel.RefreshDirectory'),
|
||||
@@ -707,7 +756,7 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
|
||||
let files = [...(this.directory?.childrens ?? [])]
|
||||
|
||||
if (!this.showHiddenFiles) {
|
||||
files = files.filter((file) => file.filename.substr(0, 1) !== '.')
|
||||
files = files.filter((file) => file.filename.slice(0, 1) !== '.')
|
||||
}
|
||||
|
||||
if (this.hideBackupFiles) {
|
||||
@@ -780,9 +829,26 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get registeredDirectories() {
|
||||
return this.$store.state.server.registered_directories
|
||||
.filter((dir: string) => !hiddenRootDirectories.includes(dir))
|
||||
.sort()
|
||||
return this.$store.state.server.registered_directories ?? []
|
||||
}
|
||||
|
||||
get existConfigRoot() {
|
||||
return this.registeredDirectories.findIndex((root: string) => root === 'config') !== -1
|
||||
}
|
||||
|
||||
get showMissingConfigRootWarning() {
|
||||
return (
|
||||
this.absolutePath.startsWith('/config') &&
|
||||
!this.absolutePath.startsWith('/config_example') &&
|
||||
!this.existConfigRoot
|
||||
)
|
||||
}
|
||||
|
||||
get registeredDirectoriesSelectItems() {
|
||||
const items = this.registeredDirectories.filter((dir: string) => !hiddenRootDirectories.includes(dir)).sort()
|
||||
if (!this.existConfigRoot) items.push('config')
|
||||
|
||||
return items
|
||||
}
|
||||
|
||||
get root() {
|
||||
@@ -798,6 +864,8 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
set currentPath(newVal) {
|
||||
this.selectedFiles = []
|
||||
|
||||
this.$store.dispatch('gui/saveSettingWithoutUpload', { name: 'view.configfiles.currentPath', value: newVal })
|
||||
}
|
||||
|
||||
@@ -853,7 +921,7 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
clickRowGoBack() {
|
||||
this.currentPath = this.currentPath.substr(0, this.currentPath.lastIndexOf('/'))
|
||||
this.currentPath = this.currentPath.slice(0, this.currentPath.lastIndexOf('/'))
|
||||
}
|
||||
|
||||
showContextMenu(e: any, item: FileStateFile) {
|
||||
@@ -876,7 +944,37 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
|
||||
window.open(href)
|
||||
}
|
||||
|
||||
createDirecotry() {
|
||||
async downloadSelectedFiles() {
|
||||
let items: string[] = []
|
||||
|
||||
const addElementToItems = async (absolutPath: string, directory: FileStateFile[]) => {
|
||||
for (const file of directory) {
|
||||
const filePath = `${absolutPath}/${file.filename}`
|
||||
|
||||
if (file.isDirectory && file.childrens) {
|
||||
await addElementToItems(filePath, file.childrens)
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
items.push(filePath)
|
||||
}
|
||||
}
|
||||
|
||||
await addElementToItems(this.absolutePath, this.selectedFiles)
|
||||
const date = new Date()
|
||||
const timestamp = `${date.getFullYear()}${date.getMonth()}${date.getDay()}-${date.getHours()}${date.getMinutes()}${date.getSeconds()}`
|
||||
|
||||
this.$socket.emit(
|
||||
'server.files.zip',
|
||||
{ items, dest: `config/${this.root}-${timestamp}.zip` },
|
||||
{ action: 'files/downloadZip', loading: 'configDownloadZip' }
|
||||
)
|
||||
|
||||
this.selectedFiles = []
|
||||
}
|
||||
|
||||
createDirectory() {
|
||||
this.dialogCreateDirectory.name = ''
|
||||
this.dialogCreateDirectory.show = true
|
||||
|
||||
|
||||
@@ -1,11 +1,30 @@
|
||||
<template>
|
||||
<panel
|
||||
:title="$t('Machine.LogfilesPanel.Logfiles')"
|
||||
:icon="mdiFileDocumentEdit"
|
||||
card-class="machine-logfiles-panel"
|
||||
:collapsible="true">
|
||||
<v-card-text :class="'text-center text-lg-left py-0'">
|
||||
<v-container pb-0 px-0>
|
||||
<div>
|
||||
<panel
|
||||
:title="$t('Machine.LogfilesPanel.Logfiles').toString()"
|
||||
:icon="mdiFileDocumentEdit"
|
||||
card-class="machine-logfiles-panel"
|
||||
:collapsible="true">
|
||||
<template #buttons>
|
||||
<v-tooltip top>
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-btn
|
||||
icon
|
||||
tile
|
||||
color="primary"
|
||||
:ripple="true"
|
||||
:loading="loadings.includes('loadingBtnRolloverLogs')"
|
||||
:disabled="['printing', 'paused'].includes(printer_state)"
|
||||
v-bind="attrs"
|
||||
v-on="on"
|
||||
@click="showRolloverDialog = true">
|
||||
<v-icon>{{ mdiFileSyncOutline }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<span>{{ $t('Machine.LogfilesPanel.Rollover') }}</span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
<v-card-text :class="'text-center text-lg-left'">
|
||||
<v-row>
|
||||
<v-col :class="'col-12' + (klipperState !== 'ready' ? 'col-md-6' : 'col-md-12') + ''">
|
||||
<v-btn
|
||||
@@ -28,23 +47,117 @@
|
||||
Moonraker
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col
|
||||
v-if="existsCrowsnestLog"
|
||||
:class="'col-12 pt-0 ' + (klipperState !== 'ready' ? 'col-md-6 mt-md-3 ' : 'col-md-12') + ''">
|
||||
<v-btn
|
||||
:href="apiUrl + '/server/files/logs/crowsnest.log'"
|
||||
block
|
||||
class="primary--text"
|
||||
@click="downloadLog">
|
||||
<v-icon class="mr-2">{{ mdiDownload }}</v-icon>
|
||||
Crowsnest
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col
|
||||
v-if="existsSonarLog"
|
||||
:class="'col-12 pt-0 ' + (klipperState !== 'ready' ? 'col-md-6 mt-md-3 ' : 'col-md-12') + ''">
|
||||
<v-btn
|
||||
:href="apiUrl + '/server/files/logs/sonar.log'"
|
||||
block
|
||||
class="primary--text"
|
||||
@click="downloadLog">
|
||||
<v-icon class="mr-2">{{ mdiDownload }}</v-icon>
|
||||
Sonar
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
<v-dialog :value="showRolloverDialog" persistent width="400" :fullscreen="isMobile">
|
||||
<panel
|
||||
:title="$t('Machine.LogfilesPanel.Rollover').toString()"
|
||||
card-class="machine_rollover_logfiles-dialog"
|
||||
:icon="mdiFileSyncOutline"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="showRolloverDialog = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col>
|
||||
<p class="mb-0">{{ $t('Machine.LogfilesPanel.RolloverDescription') }}</p>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="mt-0">
|
||||
<v-col>
|
||||
<v-checkbox
|
||||
v-for="log in rolloverLogfiles"
|
||||
:key="log"
|
||||
v-model="selectedRolloverLogs"
|
||||
:label="capitalize(log)"
|
||||
:value="log"
|
||||
hide-details
|
||||
class="mt-0" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer />
|
||||
<v-btn text @click="showRolloverDialog = false">
|
||||
{{ $t('Machine.LogfilesPanel.Cancel') }}
|
||||
</v-btn>
|
||||
<v-btn color="primary" text @click="btnRolloverLogs">
|
||||
{{ $t('Machine.LogfilesPanel.Accept') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins } from 'vue-property-decorator'
|
||||
import { Component, Mixins, Watch } from 'vue-property-decorator'
|
||||
import BaseMixin from '../../mixins/base'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import { mdiDownload, mdiFileDocumentEdit } from '@mdi/js'
|
||||
import { FileStateFile } from '@/store/files/types'
|
||||
import { mdiDownload, mdiFileDocumentEdit, mdiCloseThick, mdiFileSyncOutline } from '@mdi/js'
|
||||
import { rolloverLogfiles } from '@/store/variables'
|
||||
import { capitalize } from '@/plugins/helpers'
|
||||
@Component({
|
||||
components: { Panel },
|
||||
})
|
||||
export default class LogfilesPanel extends Mixins(BaseMixin) {
|
||||
mdiFileDocumentEdit = mdiFileDocumentEdit
|
||||
mdiDownload = mdiDownload
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiFileSyncOutline = mdiFileSyncOutline
|
||||
|
||||
rolloverLogfiles = rolloverLogfiles
|
||||
capitalize = capitalize
|
||||
|
||||
private showRolloverDialog = false
|
||||
private selectedRolloverLogs: string[] = []
|
||||
|
||||
get logfiles() {
|
||||
return this.$store.getters['files/getDirectory']('logs')?.childrens ?? []
|
||||
}
|
||||
|
||||
get existsCrowsnestLog(): boolean {
|
||||
return this.logfiles.findIndex((log: FileStateFile) => log.filename === 'crowsnest.log') !== -1
|
||||
}
|
||||
|
||||
get existsSonarLog(): boolean {
|
||||
const sonarLog = this.logfiles.find((log: FileStateFile) => log.filename === 'sonar.log')
|
||||
|
||||
return sonarLog?.size > 0
|
||||
}
|
||||
|
||||
get loadingRolloverLogs() {
|
||||
return this.loadings.filter((log) => log.startsWith('rolloverLog_')).length > 0
|
||||
}
|
||||
|
||||
downloadLog(event: any) {
|
||||
event.preventDefault()
|
||||
@@ -54,5 +167,24 @@ export default class LogfilesPanel extends Mixins(BaseMixin) {
|
||||
|
||||
window.open(href)
|
||||
}
|
||||
|
||||
btnRolloverLogs() {
|
||||
if (this.selectedRolloverLogs.length === 0) return
|
||||
|
||||
this.selectedRolloverLogs.forEach((name) => {
|
||||
this.$socket.emit(
|
||||
'server.logs.rollover',
|
||||
{ application: name },
|
||||
{ loading: 'rolloverLog_' + name, action: 'files/rolloverLog' }
|
||||
)
|
||||
})
|
||||
|
||||
this.selectedRolloverLogs = []
|
||||
}
|
||||
|
||||
@Watch('loadingRolloverLogs')
|
||||
loadingRolloverLogsChanged(newVal: boolean) {
|
||||
if (newVal) this.showRolloverDialog = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -9,16 +9,12 @@
|
||||
<v-row class="py-0 pr-4">
|
||||
<v-col class="pl-6">
|
||||
<strong style="cursor: pointer" @click="hostDetailsDialog = true">Host</strong>
|
||||
<template v-if="hostStats.cpuDesc">
|
||||
<v-tooltip top>
|
||||
<template #activator="{ on, attrs }">
|
||||
<small v-if="hostStats.cpuName" class="ml-2" v-bind="attrs" v-on="on">
|
||||
({{ hostStats.cpuName }})
|
||||
</small>
|
||||
</template>
|
||||
<span>{{ hostStats.cpuDesc }}</span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
<v-tooltip top>
|
||||
<template #activator="{ on, attrs }">
|
||||
<small v-if="hostStats.cpuName" class="ml-2" v-bind="attrs" v-on="on">({{ cpuName }})</small>
|
||||
</template>
|
||||
<span>{{ cpuDesc }}</span>
|
||||
</v-tooltip>
|
||||
<br />
|
||||
<div class="text-body-2">
|
||||
<div v-if="hostStats.version">
|
||||
@@ -27,16 +23,10 @@
|
||||
<div v-if="hostStats.os">
|
||||
{{ $t('Machine.SystemPanel.Values.Os', { os: hostStats.os }) }}
|
||||
</div>
|
||||
<div
|
||||
v-if="
|
||||
hostStats.release_info &&
|
||||
'name' in hostStats.release_info &&
|
||||
hostStats.release_info.name !== '0.'
|
||||
"
|
||||
class="text-no-wrap">
|
||||
<div v-if="releaseName" class="text-no-wrap">
|
||||
{{
|
||||
$t('Machine.SystemPanel.Values.Distro', {
|
||||
name: hostStats.release_info.name,
|
||||
name: releaseName,
|
||||
version_id: hostStats.release_info.version_id,
|
||||
})
|
||||
}}
|
||||
@@ -96,7 +86,11 @@
|
||||
<template v-if="networkInterfaces">
|
||||
<div v-for="(interfaceStats, interfaceName) in networkInterfaces" :key="interfaceName">
|
||||
<span class="text-no-wrap">
|
||||
{{ interfaceName }}{{ getIpAddress(interfaceStats.details.ip_addresses) }}:
|
||||
{{ interfaceName }}
|
||||
<template v-if="'details' in interfaceStats">
|
||||
{{ getIpAddress(interfaceStats.details.ip_addresses) }}
|
||||
</template>
|
||||
:
|
||||
</span>
|
||||
<span class="text-no-wrap">
|
||||
{{
|
||||
@@ -225,6 +219,15 @@ export default class SystemPanelHost extends Mixins(BaseMixin) {
|
||||
return this.$store.state.server?.system_info ?? {}
|
||||
}
|
||||
|
||||
get releaseName() {
|
||||
let name = this.hostStats.release_info?.name ?? ''
|
||||
|
||||
if (name.startsWith('#')) return this.hostStats.release_info?.id ?? null
|
||||
if (name.startsWith('0.')) return null
|
||||
|
||||
return name
|
||||
}
|
||||
|
||||
get directory() {
|
||||
return this.$store.getters['files/getDirectory']('gcodes')
|
||||
}
|
||||
@@ -258,5 +261,21 @@ export default class SystemPanelHost extends Mixins(BaseMixin) {
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
get cpuDesc() {
|
||||
let output = this.hostStats.cpuDesc
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
get cpuName() {
|
||||
let output = this.hostStats.cpuName
|
||||
|
||||
if (this.hostStats.bits) {
|
||||
output += `, ${this.hostStats.bits}`
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -557,7 +557,9 @@ export default class UpdatePanel extends Mixins(BaseMixin) {
|
||||
output +=
|
||||
local_version +
|
||||
' > ' +
|
||||
this.$tc('Machine.UpdatePanel.CommitsAvailabe', commits_behind.length, { count: commits_behind.length })
|
||||
this.$tc('Machine.UpdatePanel.CommitsAvailable', commits_behind.length, {
|
||||
count: commits_behind.length,
|
||||
})
|
||||
else if ('full_version_string' in object && object.full_version_string !== '?')
|
||||
output += object.full_version_string
|
||||
else output += local_version
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
<template>
|
||||
<v-container>
|
||||
<v-row>
|
||||
<v-col class="col-12 col-md-6">
|
||||
<number-input
|
||||
:label="$t('Panels.MachineSettingsPanel.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 col-md-6">
|
||||
<number-input
|
||||
:label="$t('Panels.MachineSettingsPanel.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 col-md-6">
|
||||
<number-input
|
||||
:label="
|
||||
$t('Panels.MachineSettingsPanel.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 col-md-6">
|
||||
<number-input
|
||||
:label="$t('Panels.MachineSettingsPanel.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>
|
||||
</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'
|
||||
|
||||
@Component({
|
||||
components: { Panel, NumberInput },
|
||||
})
|
||||
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>
|
||||
@@ -6,21 +6,7 @@
|
||||
:collapsible="true"
|
||||
card-class="machine-settings-panel">
|
||||
<div>
|
||||
<template v-if="existsFirmwareRetraction">
|
||||
<sub-panel
|
||||
:title="$t('Panels.MachineSettingsPanel.MotionSettings.Motion').toString()"
|
||||
sub-panel-class="motion-settings-subpanel"
|
||||
class="py-3">
|
||||
<motion-settings class="pb-0"></motion-settings>
|
||||
</sub-panel>
|
||||
<sub-panel
|
||||
:title="$t('Panels.MachineSettingsPanel.FirmwareRetractionSettings.FirmwareRetraction').toString()"
|
||||
sub-panel-class="firmware-retraction-settings-subpanel"
|
||||
class="pb-3">
|
||||
<firmware-retraction-settings class="pb-0"></firmware-retraction-settings>
|
||||
</sub-panel>
|
||||
</template>
|
||||
<motion-settings v-else></motion-settings>
|
||||
<motion-settings></motion-settings>
|
||||
</div>
|
||||
</panel>
|
||||
</template>
|
||||
@@ -31,8 +17,6 @@ import BaseMixin from '@/components/mixins/base'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import SubPanel from '@/components/ui/SubPanel.vue'
|
||||
import MotionSettings from '@/components/panels/MachineSettings/MotionSettings.vue'
|
||||
import PressureAdvanceSettings from '@/components/panels/MachineSettings/PressureAdvanceSettings.vue'
|
||||
import FirmwareRetractionSettings from '@/components/panels/MachineSettings/FirmwareRetractionSettings.vue'
|
||||
import { mdiEngine } from '@mdi/js'
|
||||
|
||||
@Component({
|
||||
@@ -40,18 +24,9 @@ import { mdiEngine } from '@mdi/js'
|
||||
Panel,
|
||||
SubPanel,
|
||||
MotionSettings,
|
||||
PressureAdvanceSettings,
|
||||
FirmwareRetractionSettings,
|
||||
},
|
||||
})
|
||||
export default class MachineSettingsPanel extends Mixins(BaseMixin) {
|
||||
/**
|
||||
* Icons
|
||||
*/
|
||||
mdiEngine = mdiEngine
|
||||
|
||||
get existsFirmwareRetraction() {
|
||||
return this.$store.state.printer.configfile?.settings?.firmware_retraction ?? false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -43,7 +43,7 @@ export default class MacrogroupPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get allMacros() {
|
||||
return this.$store.getters['printer/getAllMacros'] ?? []
|
||||
return this.$store.getters['printer/getMacros'] ?? []
|
||||
}
|
||||
|
||||
get macros() {
|
||||
|
||||
@@ -26,14 +26,21 @@ import BaseMixin from '../mixins/base'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import MacroButton from '@/components/inputs/MacroButton.vue'
|
||||
import { mdiCodeTags } from '@mdi/js'
|
||||
import { PrinterStateMacro } from '@/store/printer/types'
|
||||
@Component({
|
||||
components: { MacroButton, Panel },
|
||||
})
|
||||
export default class MacrosPanel extends Mixins(BaseMixin) {
|
||||
mdiCodeTags = mdiCodeTags
|
||||
|
||||
get hiddenMacros() {
|
||||
return (this.$store.state.gui?.macros?.hiddenMacros ?? []).map((name: string) => name.toLowerCase())
|
||||
}
|
||||
|
||||
get macros() {
|
||||
return this.$store.getters['printer/getMacros']
|
||||
const macros = this.$store.getters['printer/getMacros']
|
||||
|
||||
return macros.filter((macro: PrinterStateMacro) => !this.hiddenMacros.includes(macro.name.toLowerCase()))
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<template>
|
||||
<panel
|
||||
v-if="klipperReadyForGui && (miscellaneous.length || filamentSensors.length)"
|
||||
v-if="showMiscellaneousPanel"
|
||||
:icon="mdiDipSwitch"
|
||||
:title="$t('Panels.MiscellaneousPanel.Headline')"
|
||||
:collapsible="true"
|
||||
@@ -20,8 +20,21 @@
|
||||
:max="object.max_power"
|
||||
:multi="parseInt(object.scale)"></miscellaneous-slider>
|
||||
</div>
|
||||
<div v-for="(sensor, index) of filamentSensors" :key="'sensor_' + index">
|
||||
<div v-for="(light, index) of lights" :key="'light_' + light.name">
|
||||
<v-divider v-if="index || miscellaneous.length"></v-divider>
|
||||
<miscellaneous-slider
|
||||
v-if="light.type === 'led' && light.colorOrder.length === 1"
|
||||
:name="light.name"
|
||||
type="led"
|
||||
:rpm="null"
|
||||
:controllable="true"
|
||||
:pwm="true"
|
||||
:target="light.singleChannelTarget"
|
||||
:color-order="light.colorOrder" />
|
||||
<miscellaneous-light v-else :object="light" :root="true" />
|
||||
</div>
|
||||
<div v-for="(sensor, index) of filamentSensors" :key="'sensor_' + index">
|
||||
<v-divider v-if="index || miscellaneous.length || lights.length"></v-divider>
|
||||
<filament-sensor
|
||||
:name="sensor.name"
|
||||
:enabled="sensor.enabled"
|
||||
@@ -34,21 +47,32 @@
|
||||
import { Component, Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import MiscellaneousSlider from '@/components/inputs/MiscellaneousSlider.vue'
|
||||
import MiscellaneousLight from '@/components/inputs/MiscellaneousLight.vue'
|
||||
import FilamentSensor from '@/components/inputs/FilamentSensor.vue'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import { mdiDipSwitch } from '@mdi/js'
|
||||
@Component({
|
||||
components: { Panel, FilamentSensor, MiscellaneousSlider },
|
||||
components: { Panel, FilamentSensor, MiscellaneousSlider, MiscellaneousLight },
|
||||
})
|
||||
export default class MiscellaneousPanel extends Mixins(BaseMixin) {
|
||||
mdiDipSwitch = mdiDipSwitch
|
||||
|
||||
get filamentSensors() {
|
||||
return this.$store.getters['printer/getFilamentSensors'] ?? []
|
||||
}
|
||||
|
||||
get miscellaneous() {
|
||||
return this.$store.getters['printer/getMiscellaneous'] ?? []
|
||||
}
|
||||
|
||||
get filamentSensors() {
|
||||
return this.$store.getters['printer/getFilamentSensors'] ?? []
|
||||
get lights() {
|
||||
return this.$store.getters['printer/getLights'] ?? []
|
||||
}
|
||||
|
||||
get showMiscellaneousPanel() {
|
||||
return (
|
||||
this.klipperReadyForGui && (this.miscellaneous.length || this.filamentSensors.length || this.lights.length)
|
||||
)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -81,7 +81,7 @@ svg {
|
||||
stroke-width="1" />
|
||||
</g>
|
||||
|
||||
<g v-for="(object, index) in printing_objects" :key="index">
|
||||
<g v-for="(object, index) in printing_objects_with_polygons" :key="index">
|
||||
<polygon
|
||||
:points="object.polygon.map((point) => convertX(point[0]) + ',' + convertY(point[1])).join(' ')"
|
||||
style="cursor: pointer"
|
||||
@@ -124,6 +124,10 @@ export default class StatusPanelObjectsDialogMap extends Mixins(BaseMixin) {
|
||||
return this.$store.state.printer.exclude_object?.objects ?? []
|
||||
}
|
||||
|
||||
get printing_objects_with_polygons() {
|
||||
return this.printing_objects.filter((eobject: any) => 'polygon' in eobject)
|
||||
}
|
||||
|
||||
get current_object() {
|
||||
return this.$store.state.printer.exclude_object?.current_object ?? null
|
||||
}
|
||||
@@ -144,20 +148,32 @@ export default class StatusPanelObjectsDialogMap extends Mixins(BaseMixin) {
|
||||
)
|
||||
}
|
||||
|
||||
get toolhead() {
|
||||
return this.$store.state.printer.toolhead ?? {}
|
||||
}
|
||||
|
||||
get axis_minimum() {
|
||||
return this.toolhead.axis_minimum ?? []
|
||||
}
|
||||
|
||||
get axis_maximum() {
|
||||
return this.toolhead.axis_maximum ?? []
|
||||
}
|
||||
|
||||
get stepperXmin() {
|
||||
return this.$store.state.printer.configfile?.settings?.stepper_x?.position_min ?? 0
|
||||
return this.axis_minimum[0] ?? 0
|
||||
}
|
||||
|
||||
get stepperXmax() {
|
||||
return this.$store.state.printer.configfile?.settings?.stepper_x?.position_max ?? 0
|
||||
return this.axis_maximum[0] ?? 200
|
||||
}
|
||||
|
||||
get stepperYmin() {
|
||||
return this.$store.state.printer.configfile?.settings?.stepper_y?.position_min ?? 200
|
||||
return this.axis_minimum[1] ?? 0
|
||||
}
|
||||
|
||||
get stepperYmax() {
|
||||
return this.$store.state.printer.configfile?.settings?.stepper_y?.position_max ?? 200
|
||||
return this.axis_maximum[1] ?? 200
|
||||
}
|
||||
|
||||
get absoluteX() {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
<template>
|
||||
<v-card ref="filesGcodeCard" flat>
|
||||
<v-card ref="filesGcodeCard" class="filesGcodeCard" flat>
|
||||
<v-data-table
|
||||
:items="gcodeFiles"
|
||||
hide-default-footer
|
||||
@@ -21,37 +19,29 @@
|
||||
@contextmenu="showContextMenu($event, item)"
|
||||
@click="showDialog(item)">
|
||||
<td class="pr-0 text-center" style="width: 32px">
|
||||
<template v-if="item.small_thumbnail && item.big_thumbnail">
|
||||
<v-tooltip top content-class="tooltip__content-opacity1">
|
||||
<template v-if="item.small_thumbnail">
|
||||
<v-tooltip top content-class="tooltip__content-opacity1" :disabled="!item.big_thumbnail">
|
||||
<template #activator="{ on, attrs }">
|
||||
<vue-load-image class="d-flex">
|
||||
<img
|
||||
slot="image"
|
||||
:src="item.small_thumbnail"
|
||||
:alt="item.filename"
|
||||
width="32"
|
||||
height="32"
|
||||
v-bind="attrs"
|
||||
v-on="on" />
|
||||
<v-progress-circular
|
||||
slot="preloader"
|
||||
indeterminate
|
||||
color="primary"></v-progress-circular>
|
||||
<v-icon slot="error">{{ mdiFile }}</v-icon>
|
||||
<div slot="preloader">
|
||||
<v-progress-circular indeterminate color="primary"></v-progress-circular>
|
||||
</div>
|
||||
<div slot="error">
|
||||
<v-icon>{{ mdiFile }}</v-icon>
|
||||
</div>
|
||||
</vue-load-image>
|
||||
</template>
|
||||
<span><img :src="item.big_thumbnail" width="250" /></span>
|
||||
<span><img :src="item.big_thumbnail" :alt="item.filename" width="250" /></span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
<template v-else-if="item.small_thumbnail">
|
||||
<vue-load-image>
|
||||
<img slot="image" :src="item.small_thumbnail" width="32" height="32" />
|
||||
<v-progress-circular
|
||||
slot="preloader"
|
||||
indeterminate
|
||||
color="primary"></v-progress-circular>
|
||||
<v-icon slot="error">{{ mdiFile }}</v-icon>
|
||||
</vue-load-image>
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-icon>{{ mdiFile }}</v-icon>
|
||||
</template>
|
||||
@@ -77,6 +67,7 @@
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
<resize-observer @notify="handleResize" />
|
||||
<start-print-dialog
|
||||
:bool="showDialogBool"
|
||||
:file="dialogFile"
|
||||
@@ -93,14 +84,15 @@
|
||||
{{ $t('Files.AddToQueue') }}
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
v-if="
|
||||
'first_layer_extr_temp' in contextMenu.item &&
|
||||
contextMenu.item.first_layer_extr_temp > 0 &&
|
||||
'first_layer_bed_temp' in contextMenu.item &&
|
||||
contextMenu.item.first_layer_bed_temp > 0
|
||||
"
|
||||
v-if="moonrakerComponents.includes('job_queue')"
|
||||
@click="openAddBatchToQueueDialog(contextMenu.item)">
|
||||
<v-icon class="mr-1">{{ mdiPlaylistPlus }}</v-icon>
|
||||
{{ $t('Files.AddBatchToQueue') }}
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
v-if="contextMenu.item.preheat_gcode !== null"
|
||||
:disabled="['error', 'printing', 'paused'].includes(printer_state)"
|
||||
@click="preheat(contextMenu.item)">
|
||||
@click="doSend(contextMenu.item.preheat_gcode)">
|
||||
<v-icon class="mr-1">{{ mdiFire }}</v-icon>
|
||||
{{ $t('Files.Preheat') }}
|
||||
</v-list-item>
|
||||
@@ -128,7 +120,7 @@
|
||||
</v-menu>
|
||||
<v-dialog v-model="dialogRenameFile.show" :max-width="400">
|
||||
<panel
|
||||
:title="$t('Files.RenameFile')"
|
||||
:title="$t('Files.RenameFile').toString()"
|
||||
card-class="dashboard-files-rename-file-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -151,6 +143,53 @@
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogAddBatchToQueue.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Files.AddToQueue').toString()"
|
||||
card-class="gcode-files-add-to-queue-dialog"
|
||||
:icon="mdiPlaylistPlus"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="dialogAddBatchToQueue.show = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
<v-card-text>
|
||||
<v-text-field
|
||||
ref="inputFieldAddToQueueCount"
|
||||
v-model="dialogAddBatchToQueue.count"
|
||||
:label="$t('Files.Count')"
|
||||
required
|
||||
hide-spin-buttons
|
||||
type="number"
|
||||
:rules="countInputRules"
|
||||
@keyup.enter="addBatchToQueueAction">
|
||||
<template #append-outer>
|
||||
<div class="_spin_button_group">
|
||||
<v-btn class="mt-n3" icon plain small @click="dialogAddBatchToQueue.count++">
|
||||
<v-icon>{{ mdiChevronUp }}</v-icon>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
:disabled="dialogAddBatchToQueue.count <= 1"
|
||||
class="mb-n3"
|
||||
icon
|
||||
plain
|
||||
small
|
||||
@click="dialogAddBatchToQueue.count--">
|
||||
<v-icon>{{ mdiChevronDown }}</v-icon>
|
||||
</v-btn>
|
||||
</div>
|
||||
</template>
|
||||
</v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="" text @click="dialogAddBatchToQueue.show = false">{{ $t('Files.Cancel') }}</v-btn>
|
||||
<v-btn color="primary" text @click="addBatchToQueueAction">{{ $t('Files.AddToQueue') }}</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
@@ -158,9 +197,12 @@
|
||||
import Component from 'vue-class-component'
|
||||
import { Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { FileStateFile, FileStateGcodefile } from '@/store/files/types'
|
||||
import ControlMixin from '@/components/mixins/control'
|
||||
import { FileStateGcodefile } from '@/store/files/types'
|
||||
import StartPrintDialog from '@/components/dialogs/StartPrintDialog.vue'
|
||||
import {
|
||||
mdiChevronDown,
|
||||
mdiChevronUp,
|
||||
mdiFile,
|
||||
mdiPlay,
|
||||
mdiPlaylistPlus,
|
||||
@@ -179,12 +221,20 @@ interface dialogRenameObject {
|
||||
item: FileStateGcodefile
|
||||
}
|
||||
|
||||
interface dialogAddBatchToQueue {
|
||||
show: boolean
|
||||
count: number
|
||||
item: FileStateGcodefile
|
||||
}
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
StartPrintDialog,
|
||||
},
|
||||
})
|
||||
export default class StatusPanelGcodefiles extends Mixins(BaseMixin) {
|
||||
export default class StatusPanelGcodefiles extends Mixins(BaseMixin, ControlMixin) {
|
||||
mdiChevronDown = mdiChevronDown
|
||||
mdiChevronUp = mdiChevronUp
|
||||
mdiFile = mdiFile
|
||||
mdiPlay = mdiPlay
|
||||
mdiPlaylistPlus = mdiPlaylistPlus
|
||||
@@ -212,6 +262,7 @@ export default class StatusPanelGcodefiles extends Mixins(BaseMixin) {
|
||||
last_status: null,
|
||||
last_start_time: null,
|
||||
last_total_duration: null,
|
||||
preheat_gcode: null,
|
||||
}
|
||||
private currentPath = ''
|
||||
private contentTdWidth = 100
|
||||
@@ -226,34 +277,26 @@ export default class StatusPanelGcodefiles extends Mixins(BaseMixin) {
|
||||
touchTimer: undefined,
|
||||
x: 0,
|
||||
y: 0,
|
||||
item: {
|
||||
filename: '',
|
||||
permissions: '',
|
||||
modified: new Date(),
|
||||
},
|
||||
item: { ...this.dialogFile },
|
||||
}
|
||||
|
||||
private dialogRenameFile: dialogRenameObject = {
|
||||
show: false,
|
||||
newName: '',
|
||||
item: {
|
||||
isDirectory: false,
|
||||
filename: '',
|
||||
permissions: '',
|
||||
modified: new Date(),
|
||||
small_thumbnail: null,
|
||||
big_thumbnail: null,
|
||||
big_thumbnail_width: null,
|
||||
count_printed: 0,
|
||||
last_filament_used: null,
|
||||
last_start_time: null,
|
||||
last_end_time: null,
|
||||
last_print_duration: null,
|
||||
last_status: null,
|
||||
last_total_duration: null,
|
||||
},
|
||||
item: { ...this.dialogFile },
|
||||
}
|
||||
|
||||
private dialogAddBatchToQueue: dialogAddBatchToQueue = {
|
||||
show: false,
|
||||
count: 1,
|
||||
item: { ...this.contextMenu.item },
|
||||
}
|
||||
|
||||
private countInputRules = [
|
||||
(value: string) => !!value || this.$t('JobQueue.InvalidCountEmpty'),
|
||||
(value: string) => parseInt(value) > 0 || this.$t('JobQueue.InvalidCountGreaterZero'),
|
||||
]
|
||||
|
||||
get gcodeFiles() {
|
||||
let gcodes = this.$store.getters['files/getAllGcodes'] ?? []
|
||||
gcodes = gcodes
|
||||
@@ -279,7 +322,7 @@ export default class StatusPanelGcodefiles extends Mixins(BaseMixin) {
|
||||
return `width: ${this.contentTdWidth}px;`
|
||||
}
|
||||
|
||||
showContextMenu(e: any, item: FileStateFile) {
|
||||
showContextMenu(e: any, item: FileStateGcodefile) {
|
||||
if (!this.contextMenu.shown) {
|
||||
e?.preventDefault()
|
||||
this.contextMenu.shown = true
|
||||
@@ -349,10 +392,6 @@ export default class StatusPanelGcodefiles extends Mixins(BaseMixin) {
|
||||
return '--'
|
||||
}
|
||||
|
||||
getJobStatus(item: FileStateGcodefile) {
|
||||
return item.last_status
|
||||
}
|
||||
|
||||
getStatusIcon(status: string) {
|
||||
return this.$store.getters['server/history/getPrintStatusIcon'](status)
|
||||
}
|
||||
@@ -379,24 +418,24 @@ export default class StatusPanelGcodefiles extends Mixins(BaseMixin) {
|
||||
this.$store.dispatch('server/jobQueue/addToQueue', [item.filename])
|
||||
}
|
||||
|
||||
preheat(item: FileStateGcodefile) {
|
||||
if (
|
||||
'first_layer_extr_temp' in item &&
|
||||
'first_layer_bed_temp' in item &&
|
||||
!['error', 'printing', 'paused'].includes(this.printer_state)
|
||||
) {
|
||||
if (item.first_layer_extr_temp && item.first_layer_extr_temp > 0) {
|
||||
const gcode = 'M104 S' + item.first_layer_extr_temp
|
||||
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: gcode })
|
||||
}
|
||||
openAddBatchToQueueDialog(item: FileStateGcodefile) {
|
||||
this.dialogAddBatchToQueue.show = true
|
||||
this.dialogAddBatchToQueue.count = 1
|
||||
this.dialogAddBatchToQueue.item = item
|
||||
}
|
||||
|
||||
if (item.first_layer_bed_temp && item.first_layer_bed_temp > 0) {
|
||||
const gcode = 'M140 S' + item.first_layer_bed_temp
|
||||
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: gcode })
|
||||
}
|
||||
async addBatchToQueueAction() {
|
||||
let filename = [this.currentPath, this.dialogAddBatchToQueue.item.filename].join('/')
|
||||
if (filename.startsWith('/')) filename = filename.slice(1)
|
||||
|
||||
const array: string[] = []
|
||||
for (let i = 0; i < this.dialogAddBatchToQueue.count; i++) {
|
||||
array.push(filename)
|
||||
}
|
||||
|
||||
await this.$store.dispatch('server/jobQueue/addToQueue', array)
|
||||
|
||||
this.dialogAddBatchToQueue.show = false
|
||||
}
|
||||
|
||||
view3D(item: FileStateGcodefile) {
|
||||
@@ -458,16 +497,32 @@ export default class StatusPanelGcodefiles extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
mounted() {
|
||||
window.addEventListener('resize', this.eventListenerResize)
|
||||
this.eventListenerResize()
|
||||
setTimeout(() => {
|
||||
this.calcContentTdWidth()
|
||||
}, 200)
|
||||
}
|
||||
|
||||
destroyed() {
|
||||
window.removeEventListener('resize', this.eventListenerResize)
|
||||
}
|
||||
|
||||
eventListenerResize() {
|
||||
calcContentTdWidth() {
|
||||
this.contentTdWidth = this.$refs.filesGcodeCard?.$el?.clientWidth - 48 - 48 - 32
|
||||
}
|
||||
|
||||
handleResize() {
|
||||
this.$nextTick(() => {
|
||||
this.calcContentTdWidth()
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.filesGcodeCard {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
._spin_button_group {
|
||||
width: 24px;
|
||||
margin-top: -6px;
|
||||
margin-left: -6px;
|
||||
margin-bottom: -6px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,83 +1,31 @@
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
<template>
|
||||
<v-card ref="filesJobqueue" flat>
|
||||
<v-card ref="filesJobqueue" class="filesJobqueue" flat>
|
||||
<v-data-table
|
||||
:items="jobsTable"
|
||||
hide-default-footer
|
||||
class="dashboard-jobqueue-table"
|
||||
sort-by="time_added"
|
||||
mobile-breakpoint="0"
|
||||
@current-items="setFirst">
|
||||
mobile-breakpoint="0">
|
||||
<template #no-data>
|
||||
<div class="text-center">{{ $t('Panels.StatusPanel.EmptyJobqueue') }}</div>
|
||||
</template>
|
||||
|
||||
<template #item="{ item }">
|
||||
<tr
|
||||
<template #item="{ item, index }">
|
||||
<jobqueue-entry
|
||||
:key="item.job_id"
|
||||
v-longpress:600="(e) => showContextMenu(e, item)"
|
||||
class="cursor-pointer"
|
||||
@contextmenu="showContextMenu($event, item)">
|
||||
<td class="pr-0 text-center" style="width: 32px">
|
||||
<template v-if="getSmallThumbnail(item) && getBigThumbnail(item)">
|
||||
<v-tooltip
|
||||
v-if="!item.isDirectory && getSmallThumbnail(item) && getBigThumbnail(item)"
|
||||
top
|
||||
content-class="tooltip__content-opacity1">
|
||||
<template #activator="{ on, attrs }">
|
||||
<vue-load-image>
|
||||
<img
|
||||
slot="image"
|
||||
:src="getSmallThumbnail(item)"
|
||||
width="32"
|
||||
height="32"
|
||||
v-bind="attrs"
|
||||
v-on="on" />
|
||||
<v-progress-circular
|
||||
slot="preloader"
|
||||
indeterminate
|
||||
color="primary"></v-progress-circular>
|
||||
<v-icon slot="error">{{ mdiFile }}</v-icon>
|
||||
</vue-load-image>
|
||||
</template>
|
||||
<span><img :src="getBigThumbnail(item)" width="250" /></span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
<template v-else-if="getSmallThumbnail(item)">
|
||||
<vue-load-image>
|
||||
<img slot="image" :src="getSmallThumbnail(item)" width="32" height="32" />
|
||||
<v-progress-circular
|
||||
slot="preloader"
|
||||
indeterminate
|
||||
color="primary"></v-progress-circular>
|
||||
<v-icon slot="error">{{ mdiFile }}</v-icon>
|
||||
</vue-load-image>
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-icon>{{ mdiFile }}</v-icon>
|
||||
</template>
|
||||
</td>
|
||||
<td class="pr-2">
|
||||
<template v-if="item.isFirst">
|
||||
<v-btn icon color="success" class="float-right minwidth-0 mt-1" @click="startJobqueue">
|
||||
<v-icon>{{ mdiPlay }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<div class="d-block text-truncate" :style="styleContentTdWidth">{{ item.filename }}</div>
|
||||
<small v-if="existMetadata(item)">{{ getDescription(item) }}</small>
|
||||
</td>
|
||||
</tr>
|
||||
:item="item"
|
||||
:is-first="index === 0"
|
||||
:content-td-width="contentTdWidth" />
|
||||
</template>
|
||||
<template v-if="jobs.length > jobsTable.length" #body.append>
|
||||
<template v-if="jobsRest.length" #body.append>
|
||||
<tr>
|
||||
<td class="pr-0 text-center" style="width: 32px">
|
||||
<v-icon>{{ mdiFileMultiple }}</v-icon>
|
||||
</td>
|
||||
<td class="pr-2">
|
||||
{{
|
||||
$tc('Panels.StatusPanel.JobqueueMoreFiles', jobs.length - jobsTable.length, {
|
||||
count: jobs.length - jobsTable.length,
|
||||
$tc('Panels.StatusPanel.JobqueueMoreFiles', restJobsLength, {
|
||||
count: restJobsLength,
|
||||
})
|
||||
}}
|
||||
<br />
|
||||
@@ -86,14 +34,7 @@
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
<v-menu v-model="contextMenu.shown" :position-x="contextMenu.x" :position-y="contextMenu.y" absolute offset-y>
|
||||
<v-list>
|
||||
<v-list-item @click="removeFromJobqueue(contextMenu.item)">
|
||||
<v-icon class="mr-1">{{ mdiPlaylistRemove }}</v-icon>
|
||||
{{ $t('JobQueue.RemoveFromQueue') }}
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
<resize-observer @notify="handleResize" />
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
@@ -102,24 +43,15 @@ import Component from 'vue-class-component'
|
||||
import { Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { ServerJobQueueStateJob } from '@/store/server/jobQueue/types'
|
||||
import { mdiFile, mdiPlay, mdiFileMultiple, mdiPlaylistRemove } from '@mdi/js'
|
||||
import { mdiFileMultiple } from '@mdi/js'
|
||||
import JobqueueEntry from '@/components/panels/Status/JobqueueEntry.vue'
|
||||
@Component({
|
||||
components: {},
|
||||
components: { JobqueueEntry },
|
||||
})
|
||||
export default class StatusPanelJobqueue extends Mixins(BaseMixin) {
|
||||
mdiFile = mdiFile
|
||||
mdiPlay = mdiPlay
|
||||
mdiFileMultiple = mdiFileMultiple
|
||||
mdiPlaylistRemove = mdiPlaylistRemove
|
||||
|
||||
private contentTdWidth = 100
|
||||
private contextMenu = {
|
||||
shown: false,
|
||||
touchTimer: undefined,
|
||||
x: 0,
|
||||
y: 0,
|
||||
item: {},
|
||||
}
|
||||
|
||||
declare $refs: {
|
||||
filesJobqueue: any
|
||||
@@ -137,15 +69,27 @@ export default class StatusPanelJobqueue extends Mixins(BaseMixin) {
|
||||
return this.jobs.slice(5)
|
||||
}
|
||||
|
||||
get restJobsLength() {
|
||||
let count = 0
|
||||
|
||||
this.jobsRest.forEach((item: ServerJobQueueStateJob) => {
|
||||
count += (item.combinedIds?.length ?? 0) + 1
|
||||
})
|
||||
|
||||
return count
|
||||
}
|
||||
|
||||
get descriptionRestJobs() {
|
||||
let filamentLength = 0
|
||||
let filamentWeight = 0
|
||||
let printTime = 0
|
||||
|
||||
this.jobsRest.forEach((item: ServerJobQueueStateJob) => {
|
||||
if (item.metadata?.filament_total) filamentLength += item.metadata?.filament_total
|
||||
if (item.metadata?.filament_weight_total) filamentWeight += item.metadata?.filament_weight_total
|
||||
if (item.metadata?.estimated_time) printTime = item.metadata.estimated_time
|
||||
const count = (item.combinedIds?.length ?? 0) + 1
|
||||
|
||||
if (item.metadata?.filament_total) filamentLength += item.metadata?.filament_total * count
|
||||
if (item.metadata?.filament_weight_total) filamentWeight += item.metadata?.filament_weight_total * count
|
||||
if (item.metadata?.estimated_time) printTime = item.metadata.estimated_time * count
|
||||
})
|
||||
|
||||
let output = ''
|
||||
@@ -164,49 +108,6 @@ export default class StatusPanelJobqueue extends Mixins(BaseMixin) {
|
||||
return output
|
||||
}
|
||||
|
||||
get styleContentTdWidth() {
|
||||
return `width: ${this.contentTdWidth}px;`
|
||||
}
|
||||
|
||||
getSmallThumbnail(item: ServerJobQueueStateJob) {
|
||||
return this.$store.getters['server/jobQueue/getSmallThumbnail'](item)
|
||||
}
|
||||
|
||||
getBigThumbnail(item: ServerJobQueueStateJob) {
|
||||
return this.$store.getters['server/jobQueue/getBigThumbnail'](item)
|
||||
}
|
||||
|
||||
getDescription(item: ServerJobQueueStateJob) {
|
||||
let output = ''
|
||||
|
||||
output += this.$t('Panels.StatusPanel.Filament') + ': '
|
||||
if (item.metadata?.filament_total || item.metadata.filament_weight_total) {
|
||||
if (item.metadata?.filament_total) output += item.metadata.filament_total.toFixed() + ' mm'
|
||||
if (item.metadata?.filament_total && item.metadata.filament_weight_total) output += ' / '
|
||||
if (item.metadata?.filament_weight_total) output += item.metadata.filament_weight_total.toFixed(2) + ' g'
|
||||
} else output += '--'
|
||||
|
||||
output += ', ' + this.$t('Panels.StatusPanel.PrintTime') + ': '
|
||||
if (item.metadata?.estimated_time) output += this.formatPrintTime(item.metadata.estimated_time)
|
||||
else output += '--'
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
existMetadata(item: ServerJobQueueStateJob) {
|
||||
return item?.metadata?.metadataPulled
|
||||
}
|
||||
|
||||
setFirst(currItems: ServerJobQueueStateJob[]) {
|
||||
// first check that actually exists values
|
||||
if (currItems.length) {
|
||||
// toggle all to false
|
||||
currItems.forEach((x: ServerJobQueueStateJob) => (x.isFirst = false))
|
||||
// just set first to true
|
||||
currItems[0].isFirst = true
|
||||
}
|
||||
}
|
||||
|
||||
formatPrintTime(totalSeconds: number) {
|
||||
if (totalSeconds) {
|
||||
let output = ''
|
||||
@@ -233,38 +134,30 @@ export default class StatusPanelJobqueue extends Mixins(BaseMixin) {
|
||||
return '--'
|
||||
}
|
||||
|
||||
showContextMenu(e: any, item: ServerJobQueueStateJob) {
|
||||
if (!this.contextMenu.shown) {
|
||||
e?.preventDefault()
|
||||
this.contextMenu.shown = true
|
||||
this.contextMenu.x = e?.clientX || e?.pageX || window.screenX / 2
|
||||
this.contextMenu.y = e?.clientY || e?.pageY || window.screenY / 2
|
||||
this.contextMenu.item = item
|
||||
this.$nextTick(() => {
|
||||
this.contextMenu.shown = true
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
startJobqueue() {
|
||||
this.$store.dispatch('server/jobQueue/start')
|
||||
}
|
||||
|
||||
removeFromJobqueue(item: ServerJobQueueStateJob) {
|
||||
this.$store.dispatch('server/jobQueue/deleteFromQueue', [item.job_id])
|
||||
}
|
||||
|
||||
mounted() {
|
||||
window.addEventListener('resize', this.eventListenerResize)
|
||||
this.eventListenerResize()
|
||||
setTimeout(() => {
|
||||
this.calcContentTdWidth()
|
||||
}, 200)
|
||||
}
|
||||
|
||||
destroyed() {
|
||||
window.removeEventListener('resize', this.eventListenerResize)
|
||||
}
|
||||
|
||||
eventListenerResize() {
|
||||
calcContentTdWidth() {
|
||||
this.contentTdWidth = this.$refs.filesJobqueue?.$el?.clientWidth - 48 - 48 - 32
|
||||
}
|
||||
|
||||
handleResize() {
|
||||
this.$nextTick(() => {
|
||||
this.calcContentTdWidth()
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.filesJobqueue {
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,271 @@
|
||||
<template>
|
||||
<tr
|
||||
v-longpress:600="(e) => showContextMenu(e, item)"
|
||||
class="cursor-pointer"
|
||||
@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">
|
||||
<template #activator="{ on, attrs }">
|
||||
<vue-load-image>
|
||||
<img slot="image" :src="smallThumbnail" width="32" height="32" v-bind="attrs" v-on="on" />
|
||||
<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="bigThumbnail" width="250" /></span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
<template v-else-if="smallThumbnail">
|
||||
<vue-load-image>
|
||||
<img slot="image" :src="smallThumbnail" width="32" height="32" />
|
||||
<div slot="preloader">
|
||||
<v-progress-circular indeterminate color="primary" />
|
||||
</div>
|
||||
<div slot="error">
|
||||
<v-icon>{{ mdiFile }}</v-icon>
|
||||
</div>
|
||||
</vue-load-image>
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-icon>{{ mdiFile }}</v-icon>
|
||||
</template>
|
||||
</td>
|
||||
<td class="pr-2">
|
||||
<template v-if="isFirst && !printerIsPrinting">
|
||||
<v-btn icon color="success" class="float-right minwidth-0 mt-1" @click="startJobqueue">
|
||||
<v-icon>{{ mdiPlay }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<div class="d-block text-truncate" :style="styleContentTdWidth">
|
||||
<strong v-if="item.combinedIds.length">{{ item.combinedIds.length + 1 }}x</strong>
|
||||
{{ item.filename }}
|
||||
</div>
|
||||
<small v-if="item?.metadata?.metadataPulled">{{ description }}</small>
|
||||
</td>
|
||||
<v-menu v-model="contextMenu.shown" :position-x="contextMenu.x" :position-y="contextMenu.y" absolute offset-y>
|
||||
<v-list>
|
||||
<v-list-item @click="openChangeCountDialog(contextMenu.item)">
|
||||
<v-icon class="mr-1">{{ mdiCounter }}</v-icon>
|
||||
{{ $t('JobQueue.ChangeCount') }}
|
||||
</v-list-item>
|
||||
<v-list-item @click="removeFromJobqueue(contextMenu.item)">
|
||||
<v-icon class="mr-1">{{ mdiPlaylistRemove }}</v-icon>
|
||||
{{ $t('JobQueue.RemoveFromQueue') }}
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
<v-dialog v-model="dialogChangeCount.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('JobQueue.ChangeCount').toString()"
|
||||
:icon="mdiCounter"
|
||||
card-class="jobqueue-change-count-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="dialogChangeCount.show = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
<v-card-text>
|
||||
<v-text-field
|
||||
ref="inputFieldAddToQueueCount"
|
||||
v-model="dialogChangeCount.count"
|
||||
:label="$t('JobQueue.Count')"
|
||||
required
|
||||
:rules="countInputRules"
|
||||
hide-spin-buttons
|
||||
type="number"
|
||||
@keyup.enter="changeCountAction">
|
||||
<template #append-outer>
|
||||
<div class="_spin_button_group">
|
||||
<v-btn class="mt-n3" icon plain small @click="dialogChangeCount.count++">
|
||||
<v-icon>{{ mdiChevronUp }}</v-icon>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
:disabled="dialogChangeCount.count <= 1"
|
||||
class="mb-n3"
|
||||
icon
|
||||
plain
|
||||
small
|
||||
@click="dialogChangeCount.count--">
|
||||
<v-icon>{{ mdiChevronDown }}</v-icon>
|
||||
</v-btn>
|
||||
</div>
|
||||
</template>
|
||||
</v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer />
|
||||
<v-btn color="" text @click="dialogChangeCount.show = false">{{ $t('JobQueue.Cancel') }}</v-btn>
|
||||
<v-btn color="primary" text @click="changeCountAction">{{ $t('JobQueue.ChangeCount') }}</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</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 { ServerJobQueueStateJob } from '@/store/server/jobQueue/types'
|
||||
import { mdiChevronDown, mdiChevronUp, mdiCloseThick, mdiCounter, mdiFile, mdiPlay, mdiPlaylistRemove } from '@mdi/js'
|
||||
import NumberInput from '@/components/inputs/NumberInput.vue'
|
||||
@Component({
|
||||
components: { NumberInput },
|
||||
})
|
||||
export default class StatusPanelJobqueueEntry extends Mixins(BaseMixin) {
|
||||
mdiChevronDown = mdiChevronDown
|
||||
mdiChevronUp = mdiChevronUp
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiCounter = mdiCounter
|
||||
mdiFile = mdiFile
|
||||
mdiPlay = mdiPlay
|
||||
mdiPlaylistRemove = mdiPlaylistRemove
|
||||
|
||||
@Prop({ type: Object, required: true }) declare item: ServerJobQueueStateJob
|
||||
@Prop({ type: Number, required: true }) declare contentTdWidth: number
|
||||
@Prop({ type: Boolean, default: false }) declare isFirst: boolean
|
||||
private contextMenu: {
|
||||
shown: boolean
|
||||
x: number
|
||||
y: number
|
||||
item: ServerJobQueueStateJob | any
|
||||
} = {
|
||||
shown: false,
|
||||
x: 0,
|
||||
y: 0,
|
||||
item: {},
|
||||
}
|
||||
|
||||
private dialogChangeCount: {
|
||||
show: boolean
|
||||
count: number
|
||||
item: ServerJobQueueStateJob | any
|
||||
} = {
|
||||
show: false,
|
||||
count: 1,
|
||||
item: {},
|
||||
}
|
||||
|
||||
private countInputRules = [
|
||||
(value: string) => !!value || this.$t('JobQueue.InvalidCountEmpty'),
|
||||
(value: string) => parseInt(value) > 0 || this.$t('JobQueue.InvalidCountGreaterZero'),
|
||||
]
|
||||
|
||||
declare $refs: {
|
||||
filesJobqueue: any
|
||||
}
|
||||
|
||||
get styleContentTdWidth() {
|
||||
return `width: ${this.contentTdWidth}px;`
|
||||
}
|
||||
|
||||
get smallThumbnail() {
|
||||
return this.$store.getters['server/jobQueue/getSmallThumbnail'](this.item)
|
||||
}
|
||||
|
||||
get bigThumbnail() {
|
||||
return this.$store.getters['server/jobQueue/getBigThumbnail'](this.item)
|
||||
}
|
||||
|
||||
get description() {
|
||||
let output = ''
|
||||
|
||||
output += this.$t('Panels.StatusPanel.Filament') + ': '
|
||||
if (this.item.metadata?.filament_total || this.item.metadata.filament_weight_total) {
|
||||
if (this.item.metadata?.filament_total) output += this.item.metadata.filament_total.toFixed() + ' mm'
|
||||
if (this.item.metadata?.filament_total && this.item.metadata.filament_weight_total) output += ' / '
|
||||
if (this.item.metadata?.filament_weight_total)
|
||||
output += this.item.metadata.filament_weight_total.toFixed(2) + ' g'
|
||||
} else output += '--'
|
||||
|
||||
output += ', ' + this.$t('Panels.StatusPanel.PrintTime') + ': '
|
||||
if (this.item.metadata?.estimated_time) output += this.formatPrintTime(this.item.metadata.estimated_time)
|
||||
else output += '--'
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
formatPrintTime(totalSeconds: number) {
|
||||
if (totalSeconds) {
|
||||
let output = ''
|
||||
|
||||
const days = Math.floor(totalSeconds / (3600 * 24))
|
||||
if (days) {
|
||||
totalSeconds %= 3600 * 24
|
||||
output += days + 'd'
|
||||
}
|
||||
|
||||
const hours = Math.floor(totalSeconds / 3600)
|
||||
totalSeconds %= 3600
|
||||
if (hours) output += ' ' + hours + 'h'
|
||||
|
||||
const minutes = Math.floor(totalSeconds / 60)
|
||||
if (minutes) output += ' ' + minutes + 'm'
|
||||
|
||||
const seconds = totalSeconds % 60
|
||||
if (seconds) output += ' ' + seconds.toFixed(0) + 's'
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
return '--'
|
||||
}
|
||||
|
||||
showContextMenu(e: any, item: ServerJobQueueStateJob) {
|
||||
if (!this.contextMenu.shown) {
|
||||
e?.preventDefault()
|
||||
this.contextMenu.shown = true
|
||||
this.contextMenu.x = e?.clientX || e?.pageX || window.screenX / 2
|
||||
this.contextMenu.y = e?.clientY || e?.pageY || window.screenY / 2
|
||||
this.contextMenu.item = item
|
||||
this.$nextTick(() => {
|
||||
this.contextMenu.shown = true
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
startJobqueue() {
|
||||
this.$store.dispatch('server/jobQueue/start')
|
||||
}
|
||||
|
||||
removeFromJobqueue(item: ServerJobQueueStateJob) {
|
||||
const ids = [...(item.combinedIds ?? [])]
|
||||
ids.push(item.job_id)
|
||||
|
||||
this.$store.dispatch('server/jobQueue/deleteFromQueue', ids)
|
||||
}
|
||||
|
||||
openChangeCountDialog(item: ServerJobQueueStateJob) {
|
||||
this.dialogChangeCount.show = true
|
||||
this.dialogChangeCount.count = (item.combinedIds?.length ?? 0) + 1
|
||||
this.dialogChangeCount.item = item
|
||||
}
|
||||
|
||||
changeCountAction() {
|
||||
this.$store.dispatch('server/jobQueue/changeCount', {
|
||||
job_id: this.dialogChangeCount.item.job_id,
|
||||
count: this.dialogChangeCount.count,
|
||||
})
|
||||
this.dialogChangeCount.show = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.filesJobqueue {
|
||||
position: relative;
|
||||
}
|
||||
._spin_button_group {
|
||||
width: 24px;
|
||||
margin-top: -6px;
|
||||
margin-left: -6px;
|
||||
margin-bottom: -6px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,225 @@
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<v-dialog v-model="showDialog" width="400" persistent :fullscreen="isMobile">
|
||||
<panel
|
||||
:title="$t('Panels.StatusPanel.PauseAtLayer.PauseAtLayer').toString()"
|
||||
:icon="mdiLayersPlus"
|
||||
card-class="pause-at-layer-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="hideDialog">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<v-row v-if="type === 'atLayer' && macroSettingsPauseAtLayerEnable">
|
||||
<v-col>
|
||||
<v-alert text type="warning" border="left">
|
||||
{{
|
||||
$t('Panels.StatusPanel.PauseAtLayer.DescriptionPauseAtLayerActive', {
|
||||
layer: macroSettingsPauseAtLayerLayer,
|
||||
call: macroSettingsPauseAtLayerCall,
|
||||
})
|
||||
}}
|
||||
</v-alert>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-if="type === 'nextLayer' && macroSettingsPauseNextLayerEnable">
|
||||
<v-col>
|
||||
<v-alert text type="warning" border="left">
|
||||
{{
|
||||
$t('Panels.StatusPanel.PauseAtLayer.DescriptionPauseNextLayerActive', {
|
||||
call: macroSettingsPauseAtLayerCall,
|
||||
})
|
||||
}}
|
||||
</v-alert>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-select
|
||||
v-model="type"
|
||||
:items="itemsFiltered"
|
||||
:label="$t('Panels.StatusPanel.PauseAtLayer.Type')"
|
||||
outlined
|
||||
hide-details />
|
||||
</v-col>
|
||||
<v-col v-if="type === 'atLayer'">
|
||||
<v-text-field
|
||||
v-model="layer"
|
||||
:label="$t('Panels.StatusPanel.PauseAtLayer.Layer')"
|
||||
outlined
|
||||
hide-details />
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="mt-0">
|
||||
<v-col>
|
||||
<v-select
|
||||
v-model="call"
|
||||
:items="itemsCall"
|
||||
:label="$t('Panels.StatusPanel.PauseAtLayer.Call')"
|
||||
outlined
|
||||
hide-details />
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer />
|
||||
<v-btn text @click="hideDialog">{{ $t('Panels.StatusPanel.PauseAtLayer.Abort') }}</v-btn>
|
||||
<v-btn color="primary" text @click="sendCommand">
|
||||
{{ $t('Panels.StatusPanel.PauseAtLayer.Accept') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</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 StatusPanelExcludeObjectDialogMap from '@/components/panels/Status/ExcludeObjectDialogMap.vue'
|
||||
import StatusPanelExcludeObjectDialogList from '@/components/panels/Status/ExcludeObjectDialogList.vue'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import { mdiCloseThick, mdiLayersPlus } from '@mdi/js'
|
||||
import { PrinterStateMacro } from '@/store/printer/types'
|
||||
@Component({
|
||||
components: { Panel, StatusPanelExcludeObjectDialogList, StatusPanelExcludeObjectDialogMap },
|
||||
})
|
||||
export default class StatusPanelPauseAtLayerDialog extends Mixins(BaseMixin) {
|
||||
mdiLayersPlus = mdiLayersPlus
|
||||
mdiCloseThick = mdiCloseThick
|
||||
|
||||
@Prop({ required: true }) declare readonly showDialog: boolean
|
||||
|
||||
private type: 'nextLayer' | 'atLayer' = 'atLayer'
|
||||
private layer: number = 0
|
||||
private call: 'PAUSE' | 'M600' = 'PAUSE'
|
||||
|
||||
hideDialog() {
|
||||
this.$emit('update:showDialog', false)
|
||||
}
|
||||
|
||||
get items() {
|
||||
return [
|
||||
{
|
||||
text: this.$t('Panels.StatusPanel.PauseAtLayer.AtLayer'),
|
||||
value: 'atLayer',
|
||||
status: this.existsSetPauseAtLayer,
|
||||
},
|
||||
{
|
||||
text: this.$t('Panels.StatusPanel.PauseAtLayer.NextLayer'),
|
||||
value: 'nextLayer',
|
||||
status: this.existsSetPauseNextLayer,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
get itemsFiltered() {
|
||||
return this.items.filter((entry) => entry.status)
|
||||
}
|
||||
|
||||
get itemsCall() {
|
||||
return [
|
||||
{
|
||||
text: 'PAUSE',
|
||||
value: 'PAUSE',
|
||||
},
|
||||
{
|
||||
text: 'M600',
|
||||
value: 'M600',
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
get current_layer() {
|
||||
return this.$store.state.printer.print_stats?.info?.current_layer ?? 0
|
||||
}
|
||||
|
||||
get total_layer() {
|
||||
return this.$store.state.printer.print_stats?.info?.total_layer ?? 0
|
||||
}
|
||||
|
||||
get macros() {
|
||||
return this.$store.getters['printer/getMacros'] ?? []
|
||||
}
|
||||
|
||||
get existsSetPauseAtLayer() {
|
||||
return this.macros.findIndex((macro: PrinterStateMacro) => macro.name === 'SET_PAUSE_AT_LAYER') !== -1
|
||||
}
|
||||
|
||||
get existsSetPauseNextLayer() {
|
||||
return this.macros.findIndex((macro: PrinterStateMacro) => macro.name === 'SET_PAUSE_NEXT_LAYER') !== -1
|
||||
}
|
||||
|
||||
get macroSetPrintStatsInfo() {
|
||||
return this.$store.state.printer['gcode_macro SET_PRINT_STATS_INFO'] ?? {}
|
||||
}
|
||||
|
||||
get macroSettingsPauseAtLayer() {
|
||||
return this.macroSetPrintStatsInfo.pause_at_layer ?? {}
|
||||
}
|
||||
|
||||
get macroSettingsPauseAtLayerEnable() {
|
||||
return this.macroSettingsPauseAtLayer.enable ?? false
|
||||
}
|
||||
|
||||
get macroSettingsPauseAtLayerCall() {
|
||||
return this.macroSettingsPauseAtLayer.call ?? 'PAUSE'
|
||||
}
|
||||
|
||||
get macroSettingsPauseAtLayerLayer() {
|
||||
return this.macroSettingsPauseAtLayer.layer ?? 0
|
||||
}
|
||||
|
||||
get macroSettingsPauseNextLayer() {
|
||||
return this.macroSetPrintStatsInfo.pause_next_layer ?? {}
|
||||
}
|
||||
|
||||
get macroSettingsPauseNextLayerEnable() {
|
||||
return this.macroSettingsPauseNextLayer.enable ?? false
|
||||
}
|
||||
|
||||
get macroSettingsPauseNextLayerCall() {
|
||||
return this.macroSettingsPauseNextLayer.call ?? 'PAUSE'
|
||||
}
|
||||
|
||||
sendCommand() {
|
||||
if (this.type === 'atLayer') {
|
||||
this.doSend(`SET_PAUSE_AT_LAYER ENABLE=1 LAYER=${this.layer} MACRO=${this.call}`)
|
||||
this.hideDialog()
|
||||
return
|
||||
}
|
||||
|
||||
this.doSend(`SET_PAUSE_NEXT_LAYER ENABLE=1 MACRO=${this.call}`)
|
||||
this.hideDialog()
|
||||
}
|
||||
|
||||
doSend(gcode: string) {
|
||||
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: gcode })
|
||||
}
|
||||
|
||||
@Watch('showDialog')
|
||||
showDialogChanged(newVal: boolean) {
|
||||
if (newVal) {
|
||||
this.layer = this.current_layer + 1
|
||||
this.type = 'atLayer'
|
||||
|
||||
if (!this.existsSetPauseAtLayer) this.type = 'nextLayer'
|
||||
}
|
||||
}
|
||||
|
||||
@Watch('type')
|
||||
typeChanged(newVal: string) {
|
||||
if (newVal === 'atLayer') {
|
||||
this.call = this.macroSettingsPauseAtLayerCall
|
||||
} else if (newVal === 'nextLayer') {
|
||||
this.call = this.macroSettingsPauseNextLayerCall
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -81,16 +81,16 @@
|
||||
<strong>{{ $t('Panels.StatusPanel.Estimate') }}</strong>
|
||||
<br />
|
||||
<span class="text-no-wrap">
|
||||
{{ estimated_time_avg ? formatTime(estimated_time_avg) : '--' }}
|
||||
{{ estimated_time_avg ? formatDuration(estimated_time_avg) : '--' }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<div class="text-right">
|
||||
{{ $t('Panels.StatusPanel.File') }}:
|
||||
{{ estimated_time_file ? formatTime(estimated_time_file) : '--' }}
|
||||
{{ estimated_time_file ? formatDuration(estimated_time_file) : '--' }}
|
||||
<br />
|
||||
{{ $t('Panels.StatusPanel.Filament') }}:
|
||||
{{ estimated_time_filament ? formatTime(estimated_time_filament) : '--' }}
|
||||
{{ estimated_time_filament ? formatDuration(estimated_time_filament) : '--' }}
|
||||
</div>
|
||||
</v-tooltip>
|
||||
</v-col>
|
||||
@@ -98,7 +98,7 @@
|
||||
<strong>{{ $t('Panels.StatusPanel.Slicer') }}</strong>
|
||||
<br />
|
||||
<span class="text-no-wrap">
|
||||
{{ estimated_time_slicer ? formatTime(estimated_time_slicer) : '--' }}
|
||||
{{ estimated_time_slicer ? formatDuration(estimated_time_slicer) : '--' }}
|
||||
</span>
|
||||
</v-col>
|
||||
<v-col class="col-3 pa-0">
|
||||
@@ -108,23 +108,23 @@
|
||||
<strong>{{ $t('Panels.StatusPanel.Total') }}</strong>
|
||||
<br />
|
||||
<span class="text-no-wrap">
|
||||
{{ print_time_total ? formatTime(print_time_total) : '--' }}
|
||||
{{ print_time_total ? formatDuration(print_time_total) : '--' }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<div class="text-right">
|
||||
{{ $t('Panels.StatusPanel.Print') }}:
|
||||
{{ print_time ? formatTime(print_time) : '--' }}
|
||||
{{ print_time ? formatDuration(print_time) : '--' }}
|
||||
<br />
|
||||
{{ $t('Panels.StatusPanel.Difference') }}:
|
||||
{{ print_time && print_time_total ? formatTime(print_time_total - print_time) : '--' }}
|
||||
{{ print_time && print_time_total ? formatDuration(print_time_total - print_time) : '--' }}
|
||||
</div>
|
||||
</v-tooltip>
|
||||
</v-col>
|
||||
<v-col class="col-3 pa-0">
|
||||
<strong>{{ $t('Panels.StatusPanel.ETA') }}</strong>
|
||||
<br />
|
||||
<span class="text-no-wrap">{{ outputEta }}</span>
|
||||
<span class="text-no-wrap">{{ eta }}</span>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
@@ -189,34 +189,11 @@ export default class StatusPanelPrintstatusPrinting extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get max_layers() {
|
||||
if (
|
||||
'first_layer_height' in this.current_file &&
|
||||
'layer_height' in this.current_file &&
|
||||
'object_height' in this.current_file
|
||||
) {
|
||||
const max = Math.ceil(
|
||||
(this.current_file.object_height - this.current_file.first_layer_height) /
|
||||
this.current_file.layer_height +
|
||||
1
|
||||
)
|
||||
return max > 0 ? max : 0
|
||||
}
|
||||
|
||||
return 0
|
||||
return this.$store.getters['printer/getPrintMaxLayers'] ?? 0
|
||||
}
|
||||
|
||||
get current_layer() {
|
||||
if (this.print_time > 0 && 'first_layer_height' in this.current_file && 'layer_height' in this.current_file) {
|
||||
const gcodePositionZ = this.$store.state.printer.gcode_move?.gcode_position[2] ?? 0
|
||||
let current_layer = Math.ceil(
|
||||
(gcodePositionZ - this.current_file.first_layer_height) / this.current_file.layer_height + 1
|
||||
)
|
||||
current_layer = current_layer <= this.max_layers ? current_layer : this.max_layers
|
||||
|
||||
return current_layer > 0 ? current_layer : 0
|
||||
}
|
||||
|
||||
return 0
|
||||
return this.$store.getters['printer/getPrintCurrentLayer'] ?? 0
|
||||
}
|
||||
|
||||
get estimated_time_file() {
|
||||
@@ -236,11 +213,7 @@ export default class StatusPanelPrintstatusPrinting extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get eta() {
|
||||
return this.$store.getters['printer/getEstimatedTimeETA']
|
||||
}
|
||||
|
||||
get outputEta() {
|
||||
return this.eta ? this.formatDateTime(this.eta) : '--'
|
||||
return this.$store.getters['printer/getEstimatedTimeETAFormat']
|
||||
}
|
||||
|
||||
get filament_diameter() {
|
||||
@@ -265,7 +238,7 @@ export default class StatusPanelPrintstatusPrinting extends Mixins(BaseMixin) {
|
||||
: this.filament_used.toFixed(2) + ' mm'
|
||||
}
|
||||
|
||||
formatTime(seconds: number) {
|
||||
formatDuration(seconds: number) {
|
||||
let h = Math.floor(seconds / 3600)
|
||||
seconds %= 3600
|
||||
let m = ('0' + Math.floor(seconds / 60)).slice(-2)
|
||||
@@ -273,14 +246,5 @@ export default class StatusPanelPrintstatusPrinting extends Mixins(BaseMixin) {
|
||||
|
||||
return h + ':' + m + ':' + s
|
||||
}
|
||||
|
||||
formatDateTime(msec: number) {
|
||||
const date = new Date(msec)
|
||||
const h = date.getHours() >= 10 ? date.getHours() : '0' + date.getHours()
|
||||
const m = date.getMinutes() >= 10 ? date.getMinutes() : '0' + date.getMinutes()
|
||||
|
||||
const diff = msec - new Date().getTime()
|
||||
return h + ':' + m + (diff > 60 * 60 * 24 * 1000 ? '+' + Math.round(diff / (60 * 60 * 24 * 1000)) : '')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,11 +1,5 @@
|
||||
<style lang="scss" scoped>
|
||||
.statusPanel-big-thumbnail {
|
||||
transition: height 0.25s ease-out;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div v-if="current_filename">
|
||||
<div v-if="current_filename" class="statusPanel-printstatus-thumbnail">
|
||||
<v-img
|
||||
v-if="boolBigThumbnail"
|
||||
ref="bigThumbnail"
|
||||
@@ -75,6 +69,7 @@
|
||||
</v-row>
|
||||
</v-container>
|
||||
</template>
|
||||
<resize-observer @notify="handleResize" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -84,6 +79,7 @@ import { Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { thumbnailBigMin, thumbnailSmallMax, thumbnailSmallMin } from '@/store/variables'
|
||||
import { mdiFileOutline, mdiFile } from '@mdi/js'
|
||||
import { Debounce } from 'vue-debounce-decorator'
|
||||
|
||||
@Component({
|
||||
components: {},
|
||||
@@ -198,17 +194,22 @@ export default class StatusPanelPrintstatusThumbnail extends Mixins(BaseMixin) {
|
||||
}
|
||||
}
|
||||
|
||||
created() {
|
||||
window.addEventListener('resize', this.onResize)
|
||||
}
|
||||
|
||||
destroyed() {
|
||||
window.removeEventListener('resize', this.onResize)
|
||||
}
|
||||
|
||||
onResize() {
|
||||
const isFocused = document.activeElement === this.$refs.bigThumbnail?.$el
|
||||
if (isFocused) this.focusBigThumbnail()
|
||||
@Debounce(200)
|
||||
handleResize() {
|
||||
this.$nextTick(() => {
|
||||
const isFocused = document.activeElement === this.$refs.bigThumbnail?.$el
|
||||
if (isFocused) this.focusBigThumbnail()
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.statusPanel-big-thumbnail {
|
||||
transition: height 0.25s ease-out;
|
||||
}
|
||||
|
||||
.statusPanel-printstatus-thumbnail {
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
@@ -1,5 +1,3 @@
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<min-settings-panel></min-settings-panel>
|
||||
@@ -36,18 +34,49 @@
|
||||
<span>{{ button.text }}</span>
|
||||
</v-tooltip>
|
||||
</v-btn>
|
||||
<v-menu v-if="multiFunctionButton" left offset-y :close-on-content-click="false" class="pa-0">
|
||||
<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-for="(entry, index) in multiFunctionMenuButtonsFiltered"
|
||||
:key="'multiFunction_' + index">
|
||||
<v-btn small style="width: 100%" @click="entry.click()">
|
||||
<v-icon left small>{{ entry.icon }}</v-icon>
|
||||
{{ entry.text }}
|
||||
</v-btn>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</template>
|
||||
<status-panel-printstatus-thumbnail></status-panel-printstatus-thumbnail>
|
||||
<status-panel-exclude-object
|
||||
:show-dialog.sync="boolShowObjects"
|
||||
@update:showDialog="updateShowDialog"></status-panel-exclude-object>
|
||||
<template v-if="display_message || print_stats_message">
|
||||
<status-panel-pause-at-layer-dialog :show-dialog.sync="boolShowPauseAtLayer" />
|
||||
<template v-if="print_stats_message">
|
||||
<v-container>
|
||||
<v-row>
|
||||
<v-col class="py-2">
|
||||
<span class="subtitle-2 d-block px-0 text--disabled">
|
||||
<v-icon class="mr-2" color="warning" small>{{ mdiAlertOutline }}</v-icon>
|
||||
{{ print_stats_message }}
|
||||
</span>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
<v-divider class="mt-0 mb-0"></v-divider>
|
||||
</template>
|
||||
<template v-if="display_message">
|
||||
<v-container>
|
||||
<v-row>
|
||||
<v-col class="py-2">
|
||||
<span class="subtitle-2 d-block px-0 text--disabled">
|
||||
<v-icon class="mr-2" small>{{ mdiMessageProcessingOutline }}</v-icon>
|
||||
{{ print_stats_message ? print_stats_message : display_message }}
|
||||
{{ display_message }}
|
||||
</span>
|
||||
</v-col>
|
||||
<v-col class="col-auto py-2">
|
||||
@@ -65,15 +94,15 @@
|
||||
<v-tab href="#jobqueue">{{ $t('Panels.StatusPanel.Jobqueue', { count: jobsCount }) }}</v-tab>
|
||||
</v-tabs>
|
||||
<v-divider class="my-0"></v-divider>
|
||||
<v-tabs-items v-model="activeTab">
|
||||
<v-tabs-items v-model="activeTab" class="_border-radius">
|
||||
<v-tab-item v-if="current_filename" value="status">
|
||||
<status-panel-printstatus></status-panel-printstatus>
|
||||
<status-panel-printstatus />
|
||||
</v-tab-item>
|
||||
<v-tab-item value="files">
|
||||
<status-panel-gcodefiles></status-panel-gcodefiles>
|
||||
<status-panel-gcodefiles />
|
||||
</v-tab-item>
|
||||
<v-tab-item value="jobqueue">
|
||||
<status-panel-jobqueue></status-panel-jobqueue>
|
||||
<status-panel-jobqueue />
|
||||
</v-tab-item>
|
||||
</v-tabs-items>
|
||||
</panel>
|
||||
@@ -91,8 +120,10 @@ import StatusPanelGcodefiles from '@/components/panels/Status/Gcodefiles.vue'
|
||||
import StatusPanelJobqueue from '@/components/panels/Status/Jobqueue.vue'
|
||||
import StatusPanelExcludeObject from '@/components/panels/Status/ExcludeObject.vue'
|
||||
import StatusPanelPrintstatusThumbnail from '@/components/panels/Status/PrintstatusThumbnail.vue'
|
||||
import StatusPanelPauseAtLayerDialog from '@/components/panels/Status/PauseAtLayerDialog.vue'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import {
|
||||
mdiAlertOutline,
|
||||
mdiBroom,
|
||||
mdiInformation,
|
||||
mdiPause,
|
||||
@@ -102,7 +133,10 @@ import {
|
||||
mdiStop,
|
||||
mdiMessageProcessingOutline,
|
||||
mdiCloseCircle,
|
||||
mdiLayersPlus,
|
||||
mdiDotsVertical,
|
||||
} from '@mdi/js'
|
||||
import { PrinterStateMacro } from '@/store/printer/types'
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
@@ -114,28 +148,32 @@ import {
|
||||
StatusPanelJobqueue,
|
||||
StatusPanelPrintstatus,
|
||||
StatusPanelPrintstatusThumbnail,
|
||||
StatusPanelPauseAtLayerDialog,
|
||||
},
|
||||
})
|
||||
export default class StatusPanel extends Mixins(BaseMixin) {
|
||||
mdiInformation = mdiInformation
|
||||
mdiMessageProcessingOutline = mdiMessageProcessingOutline
|
||||
mdiCloseCircle = mdiCloseCircle
|
||||
mdiDotsVertical = mdiDotsVertical
|
||||
mdiAlertOutline = mdiAlertOutline
|
||||
|
||||
private boolShowObjects = false
|
||||
private boolFirstLoad = true
|
||||
private boolShowPauseAtLayer = false
|
||||
|
||||
declare $refs: {
|
||||
bigThumbnail: any
|
||||
}
|
||||
|
||||
private activeTab = 'files'
|
||||
private lastFilename = ''
|
||||
|
||||
get jobs() {
|
||||
return this.$store.getters['server/jobQueue/getJobs']
|
||||
}
|
||||
|
||||
get jobsCount() {
|
||||
return this.jobs?.length ?? 0
|
||||
return this.$store.getters['server/jobQueue/getJobsCount'] ?? 0
|
||||
}
|
||||
|
||||
get current_filename() {
|
||||
@@ -175,7 +213,7 @@ export default class StatusPanel extends Mixins(BaseMixin) {
|
||||
color: 'warning',
|
||||
icon: mdiPause,
|
||||
loadingName: 'statusPrintPause',
|
||||
status: ['printing'],
|
||||
status: () => ['printing'].includes(this.printer_state),
|
||||
click: this.btnPauseJob,
|
||||
},
|
||||
{
|
||||
@@ -183,7 +221,7 @@ export default class StatusPanel extends Mixins(BaseMixin) {
|
||||
color: 'success',
|
||||
icon: mdiPlay,
|
||||
loadingName: 'statusPrintResume',
|
||||
status: ['paused'],
|
||||
status: () => ['paused'].includes(this.printer_state),
|
||||
click: this.btnResumeJob,
|
||||
},
|
||||
{
|
||||
@@ -191,23 +229,44 @@ export default class StatusPanel extends Mixins(BaseMixin) {
|
||||
color: 'error',
|
||||
icon: mdiStop,
|
||||
loadingName: 'statusPrintCancel',
|
||||
status: this.$store.state.gui.uiSettings.displayCancelPrint ? ['paused', 'printing'] : ['paused'],
|
||||
status: () => {
|
||||
if (this.$store.state.gui.uiSettings.displayCancelPrint)
|
||||
return ['paused', 'printing'].includes(this.printer_state)
|
||||
|
||||
return ['paused'].includes(this.printer_state)
|
||||
},
|
||||
click: this.btnCancelJob,
|
||||
},
|
||||
{
|
||||
text: this.$t('Panels.StatusPanel.ExcludeObject.ExcludeObject'),
|
||||
color: 'warning',
|
||||
icon: mdiSelectionRemove,
|
||||
loadingName: '',
|
||||
status: this.printing_objects.length ? ['paused', 'printing'] : [],
|
||||
loadingName: 'excludeObjectButton',
|
||||
status: () => {
|
||||
if (this.multiFunctionButton || this.printing_objects.length < 2) return false
|
||||
|
||||
return ['paused', 'printing'].includes(this.printer_state)
|
||||
},
|
||||
click: this.btnExcludeObject,
|
||||
},
|
||||
{
|
||||
text: this.$t('Panels.StatusPanel.PauseAtLayer.PauseAtLayer'),
|
||||
color: 'warning',
|
||||
icon: mdiLayersPlus,
|
||||
loadingName: 'pauseAtLayer',
|
||||
status: () => {
|
||||
if (this.multiFunctionButton || this.layer_count === null) return false
|
||||
|
||||
return ['paused', 'printing'].includes(this.printer_state)
|
||||
},
|
||||
click: this.btnPauseAtLayer,
|
||||
},
|
||||
{
|
||||
text: this.$t('Panels.StatusPanel.ClearPrintStats'),
|
||||
color: 'primary',
|
||||
icon: mdiBroom,
|
||||
loadingName: 'statusPrintClear',
|
||||
status: ['error', 'complete', 'cancelled'],
|
||||
status: () => ['error', 'complete', 'cancelled'].includes(this.printer_state),
|
||||
click: this.btnClearJob,
|
||||
},
|
||||
{
|
||||
@@ -215,16 +274,14 @@ export default class StatusPanel extends Mixins(BaseMixin) {
|
||||
color: 'primary',
|
||||
icon: mdiPrinter,
|
||||
loadingName: 'statusPrintReprint',
|
||||
status: ['error', 'complete', 'cancelled'],
|
||||
status: () => ['error', 'complete', 'cancelled'].includes(this.printer_state),
|
||||
click: this.btnReprintJob,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
get filteredToolbarButtons() {
|
||||
return this.toolbarButtons.filter((button) => {
|
||||
return button.status.includes(this.printer_state)
|
||||
})
|
||||
return this.toolbarButtons.filter((button) => button.status())
|
||||
}
|
||||
|
||||
get printing_objects() {
|
||||
@@ -232,20 +289,74 @@ export default class StatusPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get display_message() {
|
||||
return this.$store.state.printer.display_status?.message ?? ''
|
||||
return this.$store.state.printer.display_status?.message ?? null
|
||||
}
|
||||
|
||||
get print_stats_message() {
|
||||
return this.$store.state.printer.print_stats?.message ?? ''
|
||||
return this.$store.state.printer.print_stats?.message ?? null
|
||||
}
|
||||
|
||||
get layer_count() {
|
||||
return this.$store.state.printer.print_stats?.info?.total_layer ?? null
|
||||
}
|
||||
|
||||
get multiFunctionMenuButtons() {
|
||||
return [
|
||||
{
|
||||
text: this.$t('Panels.StatusPanel.ExcludeObject.ExcludeObject'),
|
||||
loadingName: 'excludeObjectButton',
|
||||
icon: mdiSelectionRemove,
|
||||
status: () => this.printing_objects.length > 1,
|
||||
disabled: () => ['paused', 'printing'].includes(this.printer_state),
|
||||
click: this.btnExcludeObject,
|
||||
},
|
||||
{
|
||||
text: this.$t('Panels.StatusPanel.PauseAtLayer.PauseAtLayer') + ' - ' + this.displayPauseAtLayerButton,
|
||||
loadingName: 'pauseAtLayer',
|
||||
icon: mdiLayersPlus,
|
||||
status: () => this.displayPauseAtLayerButton,
|
||||
disabled: () => ['paused', 'printing'].includes(this.printer_state),
|
||||
click: this.btnPauseAtLayer,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
get multiFunctionMenuButtonsFiltered() {
|
||||
return this.multiFunctionMenuButtons.filter((button) => button.status())
|
||||
}
|
||||
|
||||
get multiFunctionButton() {
|
||||
if (!['paused', 'printing'].includes(this.printer_state)) return false
|
||||
|
||||
return this.multiFunctionMenuButtonsFiltered.length > 1
|
||||
}
|
||||
|
||||
get macros() {
|
||||
return this.$store.getters['printer/getMacros'] ?? []
|
||||
}
|
||||
|
||||
get existsSetPauseAtLayer() {
|
||||
return this.macros.findIndex((macro: PrinterStateMacro) => macro.name === 'SET_PAUSE_AT_LAYER') !== -1
|
||||
}
|
||||
|
||||
get existsSetPauseNextLayer() {
|
||||
return this.macros.findIndex((macro: PrinterStateMacro) => macro.name === 'SET_PAUSE_NEXT_LAYER') !== -1
|
||||
}
|
||||
|
||||
get displayPauseAtLayerButton() {
|
||||
return this.layer_count !== null && (this.existsSetPauseAtLayer || this.existsSetPauseNextLayer)
|
||||
}
|
||||
|
||||
mounted() {
|
||||
if (this.current_filename !== '') this.activeTab = 'status'
|
||||
}
|
||||
|
||||
@Watch('current_filename')
|
||||
current_filenameChanged(newVal: string) {
|
||||
if (this.current_filename === '' && newVal !== '') this.activeTab = 'status'
|
||||
if (this.boolFirstLoad && newVal !== '') {
|
||||
this.boolFirstLoad = false
|
||||
this.activeTab = 'status'
|
||||
}
|
||||
if (newVal === '') this.activeTab = 'files'
|
||||
else if (this.lastFilename !== newVal) this.activeTab = 'status'
|
||||
|
||||
this.lastFilename = newVal
|
||||
}
|
||||
|
||||
clearDisplayMessage() {
|
||||
@@ -268,6 +379,10 @@ export default class StatusPanel extends Mixins(BaseMixin) {
|
||||
this.boolShowObjects = true
|
||||
}
|
||||
|
||||
btnPauseAtLayer() {
|
||||
this.boolShowPauseAtLayer = true
|
||||
}
|
||||
|
||||
btnCancelJob() {
|
||||
this.$socket.emit('printer.print.cancel', {}, { loading: 'statusPrintCancel' })
|
||||
}
|
||||
@@ -281,3 +396,10 @@ export default class StatusPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
._border-radius {
|
||||
border-bottom-left-radius: inherit;
|
||||
border-bottom-right-radius: inherit;
|
||||
}
|
||||
</style>
|
||||
@@ -31,7 +31,7 @@
|
||||
</div>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
<v-divider></v-divider>
|
||||
<v-divider class="_fix_transparency"></v-divider>
|
||||
<v-list dense class="py-0">
|
||||
<v-list-item link @click="cooldown()">
|
||||
<div class="d-flex align-center _preset-title">
|
||||
@@ -81,7 +81,7 @@
|
||||
<v-card-text class="pa-0">
|
||||
<responsive
|
||||
:breakpoints="{
|
||||
mobile: (el) => el.width <= 390,
|
||||
mobile: (el) => el.width <= 395,
|
||||
}">
|
||||
<template #default="{ el }">
|
||||
<v-simple-table class="temperature-panel-table">
|
||||
@@ -120,9 +120,9 @@
|
||||
<td v-if="!el.is.mobile" class="state">
|
||||
<v-tooltip v-if="object.state !== null" top>
|
||||
<template #activator="{ on, attrs }">
|
||||
<small v-bind="attrs" v-on="on">
|
||||
<div v-bind="attrs" v-on="on">
|
||||
{{ object.state }}
|
||||
</small>
|
||||
</div>
|
||||
</template>
|
||||
<span>{{ $t('Panels.TemperaturePanel.Avg') }}: {{ object.avgState }}</span>
|
||||
</v-tooltip>
|
||||
@@ -149,13 +149,13 @@
|
||||
{{ object.measured_min_temp }}°C
|
||||
</span>
|
||||
</v-tooltip>
|
||||
<div v-for="(values, key) of object.additionSensors" :key="key">
|
||||
<div v-for="(values, key) of object.additionalSensors" :key="key">
|
||||
<span v-if="values.bool" class="d-block">
|
||||
<small>{{ values.value }} {{ values.unit }}</small>
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="object.rpm !== null">
|
||||
<small :class="object.rpmClass">{{ object.rpm }}</small>
|
||||
<small :class="object.rpmClass">{{ object.rpm }} RPM</small>
|
||||
</div>
|
||||
</td>
|
||||
<td class="target">
|
||||
@@ -203,11 +203,7 @@
|
||||
v-model="editHeater['bool' + dataset.charAt(0).toUpperCase() + dataset.slice(1)]"
|
||||
:label="
|
||||
$t('Panels.TemperaturePanel.ShowNameInChart', {
|
||||
name: $t(
|
||||
'Panels.TemperaturePanel.Dataset.' +
|
||||
dataset.charAt(0).toUpperCase() +
|
||||
dataset.slice(1)
|
||||
),
|
||||
name: $t(`Panels.TemperaturePanel.Dataset.${capitalize(dataset)}`),
|
||||
})
|
||||
"
|
||||
hide-details
|
||||
@@ -215,14 +211,14 @@
|
||||
@change="setVisible(dataset)"></v-checkbox>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-for="key in Object.keys(editHeater.additionSensors)" :key="key">
|
||||
<v-row v-for="additionalSensor in editHeater.additionalSensors" :key="additionalSensor.name">
|
||||
<v-col class="col-12 py-1">
|
||||
<v-checkbox
|
||||
v-model="editHeater.additionSensors[key]['bool']"
|
||||
:label="$t('Panels.TemperaturePanel.ShowNameInList', { name: key })"
|
||||
v-model="additionalSensor.bool"
|
||||
:label="$t('Panels.TemperaturePanel.ShowNameInList', { name: additionalSensor.name })"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
@change="setVisibleAdditionalSensor(key)"></v-checkbox>
|
||||
@change="setVisibleAdditionalSensor(additionalSensor)"></v-checkbox>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
@@ -244,24 +240,22 @@
|
||||
<script lang="ts">
|
||||
import Component from 'vue-class-component'
|
||||
import { Mixins } from 'vue-property-decorator'
|
||||
import { convertName } from '@/plugins/helpers'
|
||||
import { capitalize, convertName } from '@/plugins/helpers'
|
||||
import { Debounce } from 'vue-debounce-decorator'
|
||||
import { GuiPresetsStatePreset } from '@/store/gui/presets/types'
|
||||
import { PrinterStateTemperatureObject } from '@/store/printer/types'
|
||||
import { PrinterStateAdditionalSensor, PrinterStateTemperatureObject } from '@/store/printer/types'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import ControlMixin from '@/components/mixins/control'
|
||||
import TempChart from '@/components/charts/TempChart.vue'
|
||||
import TemperatureInput from '@/components/inputs/TemperatureInput.vue'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import Responsive from '@/components/ui/Responsive.vue'
|
||||
import { datasetTypes } from '@/store/variables'
|
||||
import { mdiCloseThick, mdiCog, mdiFan, mdiSnowflake, mdiFire, mdiMenuDown, mdiThermometerLines } from '@mdi/js'
|
||||
import { mdiCloseThick, mdiCog, mdiSnowflake, mdiFire, mdiMenuDown, mdiThermometerLines } from '@mdi/js'
|
||||
|
||||
@Component({
|
||||
components: { Panel, TempChart, TemperatureInput, Responsive },
|
||||
})
|
||||
export default class TemperaturePanel extends Mixins(BaseMixin, ControlMixin) {
|
||||
mdiFan = mdiFan
|
||||
mdiSnowflake = mdiSnowflake
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiCog = mdiCog
|
||||
@@ -270,7 +264,7 @@ export default class TemperaturePanel extends Mixins(BaseMixin, ControlMixin) {
|
||||
mdiThermometerLines = mdiThermometerLines
|
||||
|
||||
convertName = convertName
|
||||
datasetTypes = datasetTypes
|
||||
capitalize = capitalize
|
||||
|
||||
private editHeater: any = {
|
||||
bool: false,
|
||||
@@ -280,7 +274,7 @@ export default class TemperaturePanel extends Mixins(BaseMixin, ControlMixin) {
|
||||
boolTarget: false,
|
||||
boolPower: false,
|
||||
boolSpeed: false,
|
||||
additionSensors: {},
|
||||
additionalSensors: {},
|
||||
color: '',
|
||||
}
|
||||
|
||||
@@ -309,7 +303,9 @@ export default class TemperaturePanel extends Mixins(BaseMixin, ControlMixin) {
|
||||
}
|
||||
|
||||
get temperatureObjects() {
|
||||
return this.$store.getters['printer/getTemperatureObjects'] ?? []
|
||||
const sensors = this.$store.getters['printer/getTemperatureObjects'] ?? []
|
||||
|
||||
return sensors.filter((sensor: PrinterStateTemperatureObject) => !sensor.name.startsWith('_'))
|
||||
}
|
||||
|
||||
preheat(preset: GuiPresetsStatePreset): void {
|
||||
@@ -353,7 +349,7 @@ export default class TemperaturePanel extends Mixins(BaseMixin, ControlMixin) {
|
||||
this.editHeater.boolTarget = this.$store.getters['gui/getDatasetValue']({ name: object.name, type: 'target' })
|
||||
this.editHeater.boolPower = this.$store.getters['gui/getDatasetValue']({ name: object.name, type: 'power' })
|
||||
this.editHeater.boolSpeed = this.$store.getters['gui/getDatasetValue']({ name: object.name, type: 'speed' })
|
||||
this.editHeater.additionSensors = object.additionSensors
|
||||
this.editHeater.additionalSensors = object.additionalSensors
|
||||
|
||||
this.editHeater.bool = true
|
||||
}
|
||||
@@ -366,9 +362,9 @@ export default class TemperaturePanel extends Mixins(BaseMixin, ControlMixin) {
|
||||
this.$store.dispatch('gui/saveSetting', { name, value })
|
||||
}
|
||||
|
||||
setVisibleAdditionalSensor(sensor: string): void {
|
||||
const name = 'view.tempchart.datasetSettings.' + this.editHeater.name + '.additionalSensors.' + sensor
|
||||
this.$store.dispatch('gui/saveSetting', { name, value: this.editHeater.additionSensors[sensor].bool })
|
||||
setVisibleAdditionalSensor(sensor: PrinterStateAdditionalSensor): void {
|
||||
const name = 'view.tempchart.datasetSettings.' + this.editHeater.name + '.additionalSensors.' + sensor.name
|
||||
this.$store.dispatch('gui/saveSetting', { name, value: sensor.bool })
|
||||
}
|
||||
|
||||
@Debounce(500)
|
||||
@@ -426,4 +422,12 @@ export default class TemperaturePanel extends Mixins(BaseMixin, ControlMixin) {
|
||||
.temperature-panel-table .target {
|
||||
width: 140px;
|
||||
}
|
||||
|
||||
/*
|
||||
workaround for fixing a transparency issue
|
||||
which is assumingly a vuetify bug
|
||||
*/
|
||||
._fix_transparency {
|
||||
background-color: #1e1e1e;
|
||||
}
|
||||
</style>
|
||||
@@ -15,7 +15,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<panel
|
||||
:title="$t('Timelapse.TimelapseFiles')"
|
||||
:title="$t('Timelapse.TimelapseFiles').toString()"
|
||||
:icon="mdiFileDocumentMultipleOutline"
|
||||
card-class="timelapse-files-panel">
|
||||
<v-card-text>
|
||||
@@ -32,6 +32,23 @@
|
||||
dense
|
||||
style="max-width: 300px"></v-text-field>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn
|
||||
v-if="selectedFiles.length"
|
||||
:title="$t('Timelapse.Download')"
|
||||
color="primary"
|
||||
class="px-2 minwidth-0 ml-3"
|
||||
:loading="loadings.includes('timelapseDownloadZip')"
|
||||
@click="downloadSelectedFiles">
|
||||
<v-icon>{{ mdiCloudDownload }}</v-icon>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
v-if="selectedFiles.length"
|
||||
:title="$t('Timelapse.Delete')"
|
||||
color="error"
|
||||
class="px-2 minwidth-0 ml-3"
|
||||
@click="deleteSelectedDialog = true">
|
||||
<v-icon>{{ mdiDelete }}</v-icon>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
v-if="directoryPermissions.includes('w')"
|
||||
:title="$t('Timelapse.CreateNewDirectory')"
|
||||
@@ -78,6 +95,7 @@
|
||||
</v-card-text>
|
||||
<v-divider class="mb-3"></v-divider>
|
||||
<v-data-table
|
||||
v-model="selectedFiles"
|
||||
:items="displayFiles"
|
||||
class="files-table"
|
||||
:headers="headers"
|
||||
@@ -90,10 +108,11 @@
|
||||
itemsPerPageAllText: $t('Timelapse.AllFiles'),
|
||||
itemsPerPageOptions: [10, 25, 50, 100, -1],
|
||||
}"
|
||||
item-key="name"
|
||||
item-key="filename"
|
||||
:search="search"
|
||||
:custom-filter="advancedSearch"
|
||||
mobile-breakpoint="0">
|
||||
mobile-breakpoint="0"
|
||||
show-select>
|
||||
<template slot="items">
|
||||
<td v-for="header in headers" :key="header.value">{{ header.text }}</td>
|
||||
</template>
|
||||
@@ -111,19 +130,26 @@
|
||||
</tr>
|
||||
</template>
|
||||
|
||||
<template #item="{ index, item }">
|
||||
<template #item="{ index, item, isSelected, select }">
|
||||
<tr
|
||||
:key="`${index} ${item.filename}`"
|
||||
v-longpress:600="(e) => showContextMenu(e, item)"
|
||||
class="file-list-cursor user-select-none"
|
||||
@contextmenu="showContextMenu($event, item)"
|
||||
@click="clickRow(item)">
|
||||
<td class="pr-0 text-center" style="width: 32px">
|
||||
<td class="file-list__select-td pr-0">
|
||||
<v-simple-checkbox
|
||||
v-ripple
|
||||
:value="isSelected"
|
||||
class="pa-0 mr-0"
|
||||
@click.stop="select(!isSelected)"></v-simple-checkbox>
|
||||
</td>
|
||||
<td class="px-0 text-center" style="width: 32px">
|
||||
<template v-if="item.isDirectory">
|
||||
<v-icon>{{ mdiFolder }}</v-icon>
|
||||
<v-icon width="32">{{ mdiFolder }}</v-icon>
|
||||
</template>
|
||||
<template v-else-if="item.filename.endsWith('zip')">
|
||||
<v-icon>{{ mdiFolderZipOutline }}</v-icon>
|
||||
<v-icon width="32">{{ mdiFolderZipOutline }}</v-icon>
|
||||
</template>
|
||||
<template v-else-if="getThumbnail(item)">
|
||||
<v-tooltip
|
||||
@@ -139,11 +165,15 @@
|
||||
width="32"
|
||||
v-bind="attrs"
|
||||
v-on="on" />
|
||||
<v-progress-circular
|
||||
slot="preloader"
|
||||
indeterminate
|
||||
color="primary"></v-progress-circular>
|
||||
<v-icon slot="error">{{ mdiFile }}</v-icon>
|
||||
<div slot="preloader">
|
||||
<v-progress-circular
|
||||
slot="preloader"
|
||||
indeterminate
|
||||
color="primary"></v-progress-circular>
|
||||
</div>
|
||||
<div slot="error">
|
||||
<v-icon>{{ mdiFile }}</v-icon>
|
||||
</div>
|
||||
</vue-load-image>
|
||||
</template>
|
||||
<span><img :src="getThumbnail(item)" :alt="item.filename" width="250" /></span>
|
||||
@@ -160,7 +190,7 @@
|
||||
{{ item.isDirectory ? '--' : formatFilesize(item.size) }}
|
||||
</td>
|
||||
<td v-if="headers.find((header) => header.value === 'modified').visible" class="text-right">
|
||||
{{ formatDate(item.modified) }}
|
||||
{{ formatDateTime(item.modified) }}
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
@@ -169,38 +199,40 @@
|
||||
<v-menu v-model="contextMenu.shown" :position-x="contextMenu.x" :position-y="contextMenu.y" absolute offset-y>
|
||||
<v-list>
|
||||
<v-list-item v-if="!contextMenu.item.isDirectory" @click="downloadFile(contextMenu.item.filename)">
|
||||
<v-icon left>{{ mdiCloudDownload }}</v-icon>
|
||||
<v-icon class="mr-1">{{ mdiCloudDownload }}</v-icon>
|
||||
{{ $t('Timelapse.Download') }}
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
v-if="contextMenu.item.isDirectory && contextMenu.item.permissions.includes('w')"
|
||||
@click="renameDirectory(contextMenu.item)">
|
||||
<v-icon left>{{ mdiRenameBox }}</v-icon>
|
||||
<v-icon class="mr-1">{{ mdiRenameBox }}</v-icon>
|
||||
{{ $t('Timelapse.Rename') }}
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
v-if="!contextMenu.item.isDirectory && contextMenu.item.permissions.includes('w')"
|
||||
@click="renameFile(contextMenu.item)">
|
||||
<v-icon left>{{ mdiRenameBox }}</v-icon>
|
||||
<v-icon class="mr-1">{{ mdiRenameBox }}</v-icon>
|
||||
{{ $t('Timelapse.Rename') }}
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
v-if="!contextMenu.item.isDirectory && contextMenu.item.permissions.includes('w')"
|
||||
class="red--text"
|
||||
@click="removeFile">
|
||||
<v-icon left>{{ mdiDelete }}</v-icon>
|
||||
<v-icon class="mr-1" color="error">{{ mdiDelete }}</v-icon>
|
||||
{{ $t('Timelapse.Delete') }}
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
v-if="contextMenu.item.isDirectory && contextMenu.item.permissions.includes('w')"
|
||||
class="red--text"
|
||||
@click="deleteDirectory(contextMenu.item)">
|
||||
<v-icon left>{{ mdiDelete }}</v-icon>
|
||||
<v-icon class="mr-1" color="error">{{ mdiDelete }}</v-icon>
|
||||
{{ $t('Timelapse.Delete') }}
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
<v-dialog v-model="dialogRenameFile.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Timelapse.RenameFile')"
|
||||
:title="$t('Timelapse.RenameFile').toString()"
|
||||
card-class="gcode-files-rename-file-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -214,18 +246,22 @@
|
||||
v-model="dialogRenameFile.newName"
|
||||
:label="$t('Timelapse.Name')"
|
||||
required
|
||||
:rules="nameInputRules"
|
||||
@update:error="(bool) => (isInvalidName = bool)"
|
||||
@keypress.enter="renameFileAction"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="" text @click="dialogRenameFile.show = false">{{ $t('Timelapse.Cancel') }}</v-btn>
|
||||
<v-btn color="primary" text @click="renameFileAction">{{ $t('Timelapse.Rename') }}</v-btn>
|
||||
<v-btn :disabled="isInvalidName" color="primary" text @click="renameFileAction">
|
||||
{{ $t('Timelapse.Rename') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogCreateDirectory.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Timelapse.NewDirectory')"
|
||||
:title="$t('Timelapse.NewDirectory').toString()"
|
||||
card-class="gcode-files-new-directory-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -238,8 +274,9 @@
|
||||
ref="inputFieldCreateDirectory"
|
||||
v-model="dialogCreateDirectory.name"
|
||||
:label="$t('Timelapse.Name')"
|
||||
:rules="input_rules"
|
||||
required
|
||||
:rules="nameInputRules"
|
||||
@update:error="(bool) => (isInvalidName = bool)"
|
||||
@keypress.enter="createDirectoryAction"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
@@ -247,13 +284,15 @@
|
||||
<v-btn color="" text @click="dialogCreateDirectory.show = false">
|
||||
{{ $t('Timelapse.Cancel') }}
|
||||
</v-btn>
|
||||
<v-btn color="primary" text @click="createDirectoryAction">{{ $t('Timelapse.Create') }}</v-btn>
|
||||
<v-btn :disabled="isInvalidName" color="primary" text @click="createDirectoryAction">
|
||||
{{ $t('Timelapse.Create') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogRenameDirectory.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Timelapse.RenameDirectory')"
|
||||
:title="$t('Timelapse.RenameDirectory').toString()"
|
||||
card-class="gcode-files-rename-directory-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -267,6 +306,8 @@
|
||||
v-model="dialogRenameDirectory.newName"
|
||||
:label="$t('Timelapse.Name')"
|
||||
required
|
||||
:rules="nameInputRules"
|
||||
@update:error="(bool) => (isInvalidName = bool)"
|
||||
@keyup.enter="renameDirectoryAction"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
@@ -274,13 +315,15 @@
|
||||
<v-btn color="" text @click="dialogRenameDirectory.show = false">
|
||||
{{ $t('Timelapse.Cancel') }}
|
||||
</v-btn>
|
||||
<v-btn color="primary" text @click="renameDirectoryAction">{{ $t('Timelapse.Rename') }}</v-btn>
|
||||
<v-btn :disabled="isInvalidName" color="primary" text @click="renameDirectoryAction">
|
||||
{{ $t('Timelapse.Rename') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogDeleteDirectory.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Timelapse.DeleteDirectory')"
|
||||
:title="$t('Timelapse.DeleteDirectory').toString()"
|
||||
card-class="gcode-files-delete-directory-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -304,7 +347,7 @@
|
||||
</v-dialog>
|
||||
<v-dialog v-model="boolVideoDialog" :max-width="700">
|
||||
<panel
|
||||
:title="$t('Timelapse.Video')"
|
||||
:title="$t('Timelapse.Video').toString()"
|
||||
:icon="mdiFileVideo"
|
||||
card-class="timelapse-video-dialog"
|
||||
:margin-bottom="false">
|
||||
@@ -337,13 +380,33 @@
|
||||
</v-card-text>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="deleteSelectedDialog" max-width="400">
|
||||
<panel
|
||||
:title="$t('Timelapse.Delete').toString()"
|
||||
card-class="timelapse-delete-selected-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="deleteSelectedDialog = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<p class="mb-0">{{ $t('Timelapse.DeleteSelectedQuestion', { count: selectedFiles.length }) }}</p>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="" text @click="deleteSelectedDialog = false">{{ $t('Timelapse.Cancel') }}</v-btn>
|
||||
<v-btn color="error" text @click="deleteSelectedFiles">{{ $t('Timelapse.Delete') }}</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { Component, Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { formatFilesize, formatDate, sortFiles } from '@/plugins/helpers'
|
||||
import { FileStateFile } from '@/store/files/types'
|
||||
import { formatFilesize, sortFiles } from '@/plugins/helpers'
|
||||
import { FileStateFile, FileStateGcodefile } from '@/store/files/types'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import {
|
||||
mdiFolderPlus,
|
||||
@@ -371,7 +434,6 @@ interface dialogRenameObject {
|
||||
components: { Panel },
|
||||
})
|
||||
export default class TimelapseFilesPanel extends Mixins(BaseMixin) {
|
||||
formatDate = formatDate
|
||||
formatFilesize = formatFilesize
|
||||
sortFiles = sortFiles
|
||||
|
||||
@@ -451,11 +513,21 @@ export default class TimelapseFilesPanel extends Mixins(BaseMixin) {
|
||||
},
|
||||
}
|
||||
|
||||
private input_rules = [(value: string) => value.indexOf(' ') === -1 || 'Name contains spaces!']
|
||||
private deleteSelectedDialog = false
|
||||
|
||||
private isInvalidName = true
|
||||
private nameInputRules = [
|
||||
(value: string) => !!value || this.$t('Files.InvalidNameEmpty'),
|
||||
(value: string) => !this.existsFilename(value) || this.$t('Files.InvalidNameAlreadyExists'),
|
||||
]
|
||||
|
||||
existsFilename(name: string) {
|
||||
return this.files.findIndex((file) => file.filename === name) >= 0
|
||||
}
|
||||
|
||||
get headers() {
|
||||
return [
|
||||
{ text: '', value: '', align: 'left', configable: false, visible: true, filterable: false },
|
||||
{ text: '', value: '', align: 'left', configable: false, visible: true, sortable: false },
|
||||
{ text: this.$t('Timelapse.Name'), value: 'filename', align: 'left', configable: false, visible: true },
|
||||
{ text: this.$t('Timelapse.Filesize'), value: 'size', align: 'right', configable: true, visible: true },
|
||||
{
|
||||
@@ -530,6 +602,14 @@ export default class TimelapseFilesPanel extends Mixins(BaseMixin) {
|
||||
this.$store.dispatch('gui/saveSettingWithoutUpload', { name: 'view.timelapse.currentPath', value: newVal })
|
||||
}
|
||||
|
||||
get selectedFiles() {
|
||||
return this.$store.state.gui.view.timelapse.selectedFiles ?? []
|
||||
}
|
||||
|
||||
set selectedFiles(newVal) {
|
||||
this.$store.dispatch('gui/saveSettingWithoutUpload', { name: 'view.timelapse.selectedFiles', value: newVal })
|
||||
}
|
||||
|
||||
createDirectory() {
|
||||
this.dialogCreateDirectory.name = ''
|
||||
this.dialogCreateDirectory.show = true
|
||||
@@ -540,14 +620,15 @@ export default class TimelapseFilesPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
createDirectoryAction() {
|
||||
if (this.dialogCreateDirectory.name.length && this.dialogCreateDirectory.name.indexOf(' ') === -1) {
|
||||
this.dialogCreateDirectory.show = false
|
||||
this.$socket.emit(
|
||||
'server.files.post_directory',
|
||||
{ path: this.currentPath + '/' + this.dialogCreateDirectory.name },
|
||||
{ action: 'files/getCreateDir' }
|
||||
)
|
||||
}
|
||||
this.dialogCreateDirectory.show = false
|
||||
|
||||
this.$socket.emit(
|
||||
'server.files.post_directory',
|
||||
{
|
||||
path: this.currentPath + '/' + this.dialogCreateDirectory.name,
|
||||
},
|
||||
{ action: 'files/getCreateDir' }
|
||||
)
|
||||
}
|
||||
|
||||
refreshFileList() {
|
||||
@@ -590,7 +671,7 @@ export default class TimelapseFilesPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
clickRowGoBack() {
|
||||
this.currentPath = this.currentPath.substr(0, this.currentPath.lastIndexOf('/'))
|
||||
this.currentPath = this.currentPath.slice(0, this.currentPath.lastIndexOf('/'))
|
||||
}
|
||||
|
||||
showContextMenu(e: any, item: FileStateFile) {
|
||||
@@ -608,7 +689,7 @@ export default class TimelapseFilesPanel extends Mixins(BaseMixin) {
|
||||
|
||||
existsFramesZip(item: FileStateFile) {
|
||||
const posLastPoint = item.filename.lastIndexOf('.')
|
||||
const zipFilename = item.filename.substr(0, posLastPoint) + '.zip'
|
||||
const zipFilename = item.filename.slice(0, posLastPoint) + '.zip'
|
||||
|
||||
return this.files.findIndex((file) => file.filename === zipFilename) !== -1
|
||||
}
|
||||
@@ -620,9 +701,49 @@ export default class TimelapseFilesPanel extends Mixins(BaseMixin) {
|
||||
window.open(href)
|
||||
}
|
||||
|
||||
async downloadSelectedFiles() {
|
||||
let items: string[] = []
|
||||
|
||||
const addElementToItems = async (absolutPath: string, directory: FileStateFile[]) => {
|
||||
for (const file of directory) {
|
||||
const filePath = `${absolutPath}/${file.filename}`
|
||||
|
||||
if (file.isDirectory && file.childrens) {
|
||||
await addElementToItems(filePath, file.childrens)
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
items.push(filePath)
|
||||
|
||||
if (file.filename.endsWith('.mp4')) {
|
||||
const indexLastPoint = file.filename.lastIndexOf('.')
|
||||
const filenameWithoutExtension = file.filename.slice(0, indexLastPoint)
|
||||
const filenamePng = `${filenameWithoutExtension}.jpg`
|
||||
|
||||
if (this.files.indexOf((file: FileStateFile) => file.filename === filenamePng) !== -1) {
|
||||
items.push(`${absolutPath}/${filenamePng}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await addElementToItems(this.currentPath, this.selectedFiles)
|
||||
const date = new Date()
|
||||
const timestamp = `${date.getFullYear()}${date.getMonth()}${date.getDay()}-${date.getHours()}${date.getMinutes()}${date.getSeconds()}`
|
||||
|
||||
this.$socket.emit(
|
||||
'server.files.zip',
|
||||
{ items, dest: `timelapse/timelapse-${timestamp}.zip` },
|
||||
{ action: 'files/downloadZip', loading: 'timelapseDownloadZip' }
|
||||
)
|
||||
|
||||
this.selectedFiles = []
|
||||
}
|
||||
|
||||
renameFile(item: FileStateFile) {
|
||||
const posLastPoint = item.filename.lastIndexOf('.')
|
||||
this.dialogRenameFile.newName = item.filename.substr(0, posLastPoint)
|
||||
this.dialogRenameFile.newName = item.filename.slice(0, posLastPoint)
|
||||
|
||||
this.dialogRenameFile.item = item
|
||||
this.dialogRenameFile.show = true
|
||||
@@ -634,23 +755,35 @@ export default class TimelapseFilesPanel extends Mixins(BaseMixin) {
|
||||
|
||||
renameFileAction() {
|
||||
const posLastPoint = this.dialogRenameFile.item.filename.lastIndexOf('.')
|
||||
const oldNameWithoutExtension = this.dialogRenameFile.item.filename.substr(0, posLastPoint)
|
||||
const oldNameWithoutExtension = this.dialogRenameFile.item.filename.slice(0, posLastPoint)
|
||||
const fileExtension = this.dialogRenameFile.item.filename.split('.').pop()
|
||||
|
||||
this.dialogRenameFile.show = false
|
||||
|
||||
/**
|
||||
* rename the file regardless of its file-extension
|
||||
*/
|
||||
this.$socket.emit(
|
||||
'server.files.move',
|
||||
{
|
||||
source: this.currentPath + '/' + this.dialogRenameFile.item.filename,
|
||||
dest: this.currentPath + '/' + this.dialogRenameFile.newName + '.mp4',
|
||||
source: `${this.currentPath}/${this.dialogRenameFile.item.filename}`,
|
||||
dest: `${this.currentPath}/${this.dialogRenameFile.newName}.${fileExtension}`,
|
||||
},
|
||||
{ action: 'files/getMove' }
|
||||
)
|
||||
|
||||
const fileJpg = this.files.find((file) => file.filename === oldNameWithoutExtension + '.jpg')
|
||||
if (fileExtension !== 'mp4') return
|
||||
|
||||
/**
|
||||
* mp4 and jpg always require to have the same name as the
|
||||
* jpg is used as a mp4-thumbnail in the timelapse file-browser
|
||||
*/
|
||||
const fileJpg = this.files.find((file) => file.filename === `${oldNameWithoutExtension}.jpg`)
|
||||
|
||||
if (fileJpg) {
|
||||
this.$socket.emit('server.files.move', {
|
||||
source: this.currentPath + '/' + oldNameWithoutExtension + '.jpg',
|
||||
dest: this.currentPath + '/' + this.dialogRenameFile.newName + '.jpg',
|
||||
source: `${this.currentPath}/${oldNameWithoutExtension}.jpg`,
|
||||
dest: `${this.currentPath}/${this.dialogRenameFile.newName}.jpg`,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -679,6 +812,22 @@ export default class TimelapseFilesPanel extends Mixins(BaseMixin) {
|
||||
|
||||
removeFile() {
|
||||
const filename = this.contextMenu.item.filename.slice(0, this.contextMenu.item.filename.lastIndexOf('.'))
|
||||
const fileExtension = this.contextMenu.item.filename.split('.').pop()
|
||||
|
||||
/**
|
||||
* delete the file regardless of its file-extension
|
||||
*/
|
||||
this.$socket.emit(
|
||||
'server.files.delete_file',
|
||||
{ path: this.currentPath + '/' + this.contextMenu.item.filename },
|
||||
{ action: 'files/getDeleteFile' }
|
||||
)
|
||||
|
||||
if (fileExtension !== 'mp4') return
|
||||
|
||||
/**
|
||||
* if file-extension is mp4, also delete its corresponding thumbnail jpg
|
||||
*/
|
||||
const previewFilename = filename + '.jpg'
|
||||
const previewExists = this.files.findIndex((file) => file.filename === previewFilename) !== -1
|
||||
|
||||
@@ -688,11 +837,6 @@ export default class TimelapseFilesPanel extends Mixins(BaseMixin) {
|
||||
{ path: this.currentPath + '/' + previewFilename },
|
||||
{ action: 'files/getDeleteFile' }
|
||||
)
|
||||
this.$socket.emit(
|
||||
'server.files.delete_file',
|
||||
{ path: this.currentPath + '/' + this.contextMenu.item.filename },
|
||||
{ action: 'files/getDeleteFile' }
|
||||
)
|
||||
}
|
||||
|
||||
deleteDirectory(item: FileStateFile) {
|
||||
@@ -708,5 +852,44 @@ export default class TimelapseFilesPanel extends Mixins(BaseMixin) {
|
||||
{ action: 'files/getDeleteDir' }
|
||||
)
|
||||
}
|
||||
|
||||
deleteSelectedFiles() {
|
||||
this.selectedFiles.forEach((item: FileStateGcodefile) => {
|
||||
if (item.isDirectory) {
|
||||
this.$socket.emit(
|
||||
'server.files.delete_directory',
|
||||
{ path: this.currentPath + '/' + item.filename, force: true },
|
||||
{ action: 'files/getDeleteDir' }
|
||||
)
|
||||
} else {
|
||||
const filename = item.filename.slice(0, item.filename.lastIndexOf('.'))
|
||||
const fileExtension = item.filename.split('.').pop()
|
||||
|
||||
this.$socket.emit(
|
||||
'server.files.delete_file',
|
||||
{ path: this.currentPath + '/' + item.filename },
|
||||
{ action: 'files/getDeleteFile' }
|
||||
)
|
||||
|
||||
if (fileExtension !== 'mp4') return
|
||||
|
||||
/**
|
||||
* if file-extension is mp4, also delete its corresponding thumbnail jpg
|
||||
*/
|
||||
const previewFilename = filename + '.jpg'
|
||||
const previewExists = this.files.findIndex((file) => file.filename === previewFilename) !== -1
|
||||
|
||||
if (previewExists)
|
||||
this.$socket.emit(
|
||||
'server.files.delete_file',
|
||||
{ path: this.currentPath + '/' + previewFilename },
|
||||
{ action: 'files/getDeleteFile' }
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
this.selectedFiles = []
|
||||
this.deleteSelectedDialog = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -18,16 +18,19 @@
|
||||
<v-col>
|
||||
<vue-load-image>
|
||||
<img
|
||||
ref="timelapsePreview"
|
||||
slot="image"
|
||||
:src="frameUrl"
|
||||
:alt="$t('Timelapse.Preview')"
|
||||
class="w-100"
|
||||
:style="webcamStyle" />
|
||||
<v-progress-circular
|
||||
slot="preloader"
|
||||
indeterminate
|
||||
color="primary"></v-progress-circular>
|
||||
<v-icon slot="error">{{ mdiFile }}</v-icon>
|
||||
:style="webcamStyle"
|
||||
@load="calcRatio" />
|
||||
<div slot="preloader">
|
||||
<v-progress-circular indeterminate color="primary"></v-progress-circular>
|
||||
</div>
|
||||
<div slot="error">
|
||||
<v-icon>{{ mdiFile }}</v-icon>
|
||||
</div>
|
||||
</vue-load-image>
|
||||
</v-col>
|
||||
</v-row>
|
||||
@@ -39,22 +42,24 @@
|
||||
align-self="center">
|
||||
<v-card-text :class="framesCount ? 'pt-0' : ''">
|
||||
<template v-if="framesCount > 0">
|
||||
<settings-row :title="$t('Timelapse.Frames')">
|
||||
<settings-row :title="$t('Timelapse.Frames').toString()">
|
||||
{{ framesCount }}
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<settings-row :title="$t('Timelapse.EstimatedLength')" :dynamic-slot-width="true">
|
||||
<settings-row
|
||||
:title="$t('Timelapse.EstimatedLength').toString()"
|
||||
:dynamic-slot-width="true">
|
||||
{{ estimatedVideoLength }}
|
||||
</settings-row>
|
||||
</template>
|
||||
<template v-if="['printing', 'paused'].includes(printer_state)">
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<settings-row :title="$t('Timelapse.Enabled')" :dynamic-slot-width="true">
|
||||
<settings-row :title="$t('Timelapse.Enabled').toString()" :dynamic-slot-width="true">
|
||||
<v-switch v-model="enabled" hide-details class="mt-0"></v-switch>
|
||||
</settings-row>
|
||||
<template v-if="enabled">
|
||||
<v-divider v-if="framesCount > 0" class="my-2"></v-divider>
|
||||
<settings-row :title="$t('Timelapse.Autorender')" :dynamic-slot-width="true">
|
||||
<settings-row :title="$t('Timelapse.Autorender').toString()" :dynamic-slot-width="true">
|
||||
<v-switch v-model="autorender" hide-details class="mt-0"></v-switch>
|
||||
</settings-row>
|
||||
</template>
|
||||
@@ -91,7 +96,7 @@
|
||||
</v-card>
|
||||
<v-dialog v-model="boolDialogRendersettings" :max-width="700" :max-height="500">
|
||||
<panel
|
||||
:title="$t('Timelapse.RenderSettings')"
|
||||
:title="$t('Timelapse.RenderSettings').toString()"
|
||||
:icon="mdiTextBoxSearchOutline"
|
||||
card-class="timelapse-rendersettings-dialog"
|
||||
:margin-bottom="false">
|
||||
@@ -109,8 +114,7 @@
|
||||
:items="framerateTypeOptions"
|
||||
outlined
|
||||
dense
|
||||
hide-details
|
||||
attach></v-select>
|
||||
hide-details></v-select>
|
||||
</v-col>
|
||||
<v-col class="col-4">
|
||||
<template v-if="variable_fps">
|
||||
@@ -197,16 +201,22 @@ import { Component, 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 { mdiFile, mdiInformation, mdiTextBoxSearchOutline } from '@mdi/js'
|
||||
import { mdiFile, mdiInformation, mdiTextBoxSearchOutline, mdiCloseThick } from '@mdi/js'
|
||||
@Component({
|
||||
components: { Panel, SettingsRow },
|
||||
})
|
||||
export default class TimelapseStatusPanel extends Mixins(BaseMixin) {
|
||||
mdiInformation = mdiInformation
|
||||
mdiFile = mdiFile
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiTextBoxSearchOutline = mdiTextBoxSearchOutline
|
||||
|
||||
private boolDialogRendersettings = false
|
||||
private scale = 1
|
||||
|
||||
declare $refs: {
|
||||
timelapsePreview: HTMLImageElement
|
||||
}
|
||||
|
||||
get frameUrl() {
|
||||
const frame = this.$store.state.server.timelapse?.lastFrame?.file ?? null
|
||||
@@ -308,12 +318,12 @@ export default class TimelapseStatusPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get estimatedVideoLength() {
|
||||
let seconds = 0
|
||||
let seconds = Math.round((this.framesCount + this.duplicatelastframe) / this.output_framerate)
|
||||
|
||||
if (this.variable_fps) {
|
||||
seconds = Math.round((this.framesCount + this.duplicatelastframe) / this.variableTargetFps)
|
||||
if (seconds < this.targetlength) seconds = this.targetlength
|
||||
} else seconds = Math.round((this.framesCount + this.duplicatelastframe) / this.output_framerate)
|
||||
}
|
||||
|
||||
return seconds > 60
|
||||
? Math.floor(seconds / 60) + 'm ' + (seconds - Math.floor(seconds / 60) * 60) + 's'
|
||||
@@ -341,14 +351,14 @@ export default class TimelapseStatusPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get webcamStyle() {
|
||||
if (this.camSettings === undefined) return ''
|
||||
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(' ') }
|
||||
|
||||
let transforms = ''
|
||||
if ('flipX' in this.camSettings && this.camSettings.flipX) transforms += ' scaleX(-1)'
|
||||
if ('flipX' in this.camSettings && this.camSettings.flipY) transforms += ' scaleY(-1)'
|
||||
if (transforms.trimLeft().length) return { transform: transforms.trimLeft() }
|
||||
|
||||
return ''
|
||||
return {}
|
||||
}
|
||||
|
||||
startRender() {
|
||||
@@ -360,5 +370,14 @@ export default class TimelapseStatusPanel extends Mixins(BaseMixin) {
|
||||
saveFrames() {
|
||||
this.$socket.emit('machine.timelapse.saveframes', {}, { loading: 'timelapse_saveframes' })
|
||||
}
|
||||
|
||||
calcRatio() {
|
||||
if (this.$refs.timelapsePreview) {
|
||||
this.scale = this.$refs.timelapsePreview.naturalHeight / this.$refs.timelapsePreview.naturalWidth
|
||||
if (this.scale > 1) {
|
||||
this.scale = this.$refs.timelapsePreview.naturalWidth / this.$refs.timelapsePreview.naturalHeight
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Loaded 100 of 221 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user