Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a12554821 | ||
|
|
7251a8c6ba | ||
|
|
cda3098c9e | ||
|
|
9eb133bd85 | ||
|
|
6a4cca751c | ||
|
|
d67ef3aa90 | ||
|
|
aeee198239 | ||
|
|
5c40820108 | ||
|
|
e929c7cc0f | ||
|
|
0b47a80b13 | ||
|
|
8447be2ece | ||
|
|
0c5aca8baf | ||
|
|
eceb442a4c | ||
|
|
98160e1368 | ||
|
|
f52b94c459 | ||
|
|
0cefa24e76 | ||
|
|
be253165a0 | ||
|
|
5b2bea51aa | ||
|
|
db09bbe043 | ||
|
|
6758049d29 | ||
|
|
a58bef2a03 | ||
|
|
a1d3dc9118 | ||
|
|
1895d2d905 | ||
|
|
7c81690c1e | ||
|
|
039a446944 | ||
|
|
bcbef2f19a | ||
|
|
39590004da | ||
|
|
ef2d17cadd | ||
|
|
a7e70c75d0 | ||
|
|
21d3d39503 | ||
|
|
d8441254db | ||
|
|
6e7ef6554e | ||
|
|
98a750922a | ||
|
|
7da33523d1 | ||
|
|
2962df21e5 | ||
|
|
73e503fc64 | ||
|
|
705065d65e | ||
|
|
7966270ea7 | ||
|
|
f5aee3e20d | ||
|
|
8fc275086a | ||
|
|
2752cfc975 | ||
|
|
6ce0f4f074 | ||
|
|
5abf417303 | ||
|
|
5b55727485 | ||
|
|
4a41430f40 | ||
|
|
8682dd7855 | ||
|
|
cff7b32f02 | ||
|
|
8a34656e82 | ||
|
|
30efd6496e | ||
|
|
2b4b881c55 | ||
|
|
7468f882c1 | ||
|
|
f9556e27b3 | ||
|
|
630d67efc5 | ||
|
|
a85ec9d0d7 | ||
|
|
b94840736f | ||
|
|
9c3c56bd56 | ||
|
|
23cc6b18e5 | ||
|
|
d4f1bf209d | ||
|
|
8481408029 | ||
|
|
d578c2a107 | ||
|
|
080a713f4c | ||
|
|
140d796f51 | ||
|
|
23da8818c3 | ||
|
|
34e3e69e5e | ||
|
|
ea274c6d4a | ||
|
|
a08f9ac9a5 | ||
|
|
8bbd5bdb0f | ||
|
|
74816c5c21 | ||
|
|
40e8f9cd63 | ||
|
|
4d7ffbe090 | ||
|
|
ec53b974fd | ||
|
|
a3316eb23b | ||
|
|
e6505fe55a | ||
|
|
6484a41eca | ||
|
|
0e86652d1c | ||
|
|
bb710794d2 | ||
|
|
f701dfbcf8 | ||
|
|
301e8386b8 | ||
|
|
ab777d5e04 | ||
|
|
c598d6260d | ||
|
|
370d7d4142 | ||
|
|
faf09f24f9 | ||
|
|
dd262f74b0 | ||
|
|
ad8d8efb6a | ||
|
|
df83c9d8cc | ||
|
|
6b68be1121 | ||
|
|
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 |
No files matched your search
@@ -0,0 +1,51 @@
|
||||
<!--
|
||||
For Work In Progress Pull Requests, please use the Draft PR feature,
|
||||
see https://github.blog/2019-02-14-introducing-draft-pull-requests/ for further details.
|
||||
|
||||
For a timely review/response, please avoid force-pushing additional
|
||||
commits if your PR already received reviews or comments.
|
||||
|
||||
We use squash-merge to merge PRs, so the commit history is clean, but we use the PR title as the commit message.
|
||||
So we recommend you to use the PR title with conventional commits type prefixes. We use the following prefixes for the PR title:
|
||||
- feat: A new feature
|
||||
- fix: A bug fix
|
||||
- docs: Documentation only changes
|
||||
- style: Changes that do not affect the meaning of the code (white-space, formatting, etc)
|
||||
- refactor: A code change that neither fixes a bug nor adds a feature
|
||||
- perf: A code change that improves performance
|
||||
- test: Adding missing tests or correcting existing tests
|
||||
- chore: Changes to the build process or auxiliary tools and libraries such as documentation generation
|
||||
- locale: Changes to the translations
|
||||
|
||||
You can found more information about Conventional Commits here: https://www.conventionalcommits.org/en/v1.0.0/.
|
||||
|
||||
Before submitting a Pull Request, please ensure you've done the following:
|
||||
- 📖 Read the Mainsail Contributing Guidelines: https://github.com/mainsail-crew/mainsail/blob/HEAD/CONTRIBUTING.md#-submitting-a-pull-request-pr.
|
||||
- 📖 Read the Mainsail Code of Conduct: https://github.com/mainsail-crew/mainsail/blob/HEAD/.github/CODE_OF_CONDUCT.md.
|
||||
- 👷♀️ Create small PRs. In most cases, this will be possible.
|
||||
- ✅ Provide tests for your changes.
|
||||
- 📝 Use descriptive commit messages.
|
||||
- 📗 Update any related documentation and include any relevant screenshots.
|
||||
-->
|
||||
|
||||
## Description
|
||||
|
||||
<!--
|
||||
Please do not leave this blank
|
||||
This PR [adds/removes/fixes/replaces] the [feature/bug/etc].
|
||||
-->
|
||||
|
||||
## Related Tickets & Documents
|
||||
|
||||
<!--
|
||||
Please use this format link issue numbers: Fixes #123
|
||||
https://docs.github.com/en/free-pro-team@latest/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword
|
||||
-->
|
||||
|
||||
## Mobile & Desktop Screenshots/Recordings
|
||||
|
||||
<!-- Visual changes require screenshots -->
|
||||
|
||||
## [optional] Are there any post-deployment tasks we need to perform?
|
||||
|
||||
<!-- note: PRs with deleted sections will be marked invalid -->
|
||||
@@ -49,7 +49,7 @@ jobs:
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
@@ -101,12 +101,13 @@ jobs:
|
||||
run: cp ./remote/* ./dist/
|
||||
|
||||
- name: Upload to remote server
|
||||
uses: SamKirkland/FTP-Deploy-Action@4.3.3
|
||||
uses: SamKirkland/FTP-Deploy-Action@v4.3.4
|
||||
with:
|
||||
server: ${{ secrets.REMOTEHOST }}
|
||||
username: ${{ secrets.REMOTEUSER }}
|
||||
password: ${{ secrets.REMOTEPASSWORD }}
|
||||
dangerous-clean-slate: true
|
||||
exclude: .htaccess
|
||||
local-dir: ./dist/
|
||||
|
||||
update-changelog:
|
||||
|
||||
@@ -4,15 +4,18 @@ design
|
||||
*.log
|
||||
packages/test
|
||||
dist
|
||||
dev-dist
|
||||
temp
|
||||
.vuerc
|
||||
.version
|
||||
.versions
|
||||
.changelog
|
||||
.idea
|
||||
.vscode
|
||||
package-lock.json
|
||||
*.local
|
||||
.env
|
||||
.vscode
|
||||
|
||||
cypress/screenshots/
|
||||
cypress/videos/
|
||||
|
||||
+924
-214
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -52,7 +52,7 @@ Before you work on a PR and submit it, please pay attention to the following gui
|
||||
1. Search the [pull requests](https://github.com/mainsail-crew/mainsail/pulls) for an open or closed PR related to your submission.
|
||||
- You don't want to duplicate existing efforts or work on something unlikely to be merged into the project.
|
||||
2. Do not submit PRs against the `master` branch. PRs need to be submitted against the `develop` branch.
|
||||
3. Follow our [Code Standards](https://docs.mainsail.xyz/development/code-standards)
|
||||
3. Follow our [Code Standards](https://docs.mainsail.xyz/overview/developement/code-standards)
|
||||
4. If there is an issue describing the problem you're fixing or a discussion of a feature you are implementing, make sure to link it in the PRs body.
|
||||
|
||||
- You can also add `fix #<id>` or `fixes #<id>` in the PR body where `<id>` is the issue id.
|
||||
|
||||
@@ -100,6 +100,19 @@ every day. To motivate him (☕🍺😜) there are several ways to support him:
|
||||
[](https://www.patreon.com/meteyou)
|
||||
[](https://ko-fi.com/mainsail)
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions to Mainsail are always welcome!
|
||||
|
||||
- 📥 Pull requests and 🌟 Stars are always welcome.
|
||||
- Read our [contributing guidelines](CONTRIBUTING.md) to get started,
|
||||
or find us on [Discord](https://discord.gg/mainsail), we will take the time to guide you.
|
||||
|
||||
Looking for a first issue to tackle?
|
||||
|
||||
- We tag issues with [](https://github.com/mainsail-crew/mainsail/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) when we think they are well suited for people who are new to the codebase or OSS in general.
|
||||
- [Talk to us](https://discord.gg/mainsail), we'll find something that suits your skills and learning interest.
|
||||
|
||||
## Credit, sources and inspiration
|
||||
|
||||
- [Kevin O'Connor](https://github.com/KevinOConnor) for the awesome 3D printer firmware [Klipper](https://github.com/KevinOConnor/klipper)
|
||||
|
||||
Generated
+2776
-1787
File diff suppressed because it is too large.
Load diff
+13
-7
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mainsail",
|
||||
"version": "2.4.1",
|
||||
"version": "2.6.2",
|
||||
"private": true,
|
||||
"decription": "a klipper web interface",
|
||||
"author": {
|
||||
@@ -33,14 +33,17 @@
|
||||
"@codemirror/view": "^6.0.3",
|
||||
"@jaames/iro": "^5.5.2",
|
||||
"@lezer/highlight": "^1.0.0",
|
||||
"@sindarius/gcodeviewer": "^3.1.4",
|
||||
"@sindarius/gcodeviewer": "^3.2.2",
|
||||
"@types/node": "^18.0.0",
|
||||
"@types/overlayscrollbars": "^1.12.1",
|
||||
"@uiw/codemirror-theme-vscode": "^4.19.11",
|
||||
"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",
|
||||
"jmuxer": "^2.0.5",
|
||||
"js-sha256": "^0.9.0",
|
||||
"lodash.kebabcase": "^4.1.1",
|
||||
"lodash.throttle": "^4.1.1",
|
||||
@@ -48,7 +51,8 @@
|
||||
"overlayscrollbars-vue": "^0.2.2",
|
||||
"regenerator-runtime": "^0.13.9",
|
||||
"resize-observer-polyfill": "^1.5.1",
|
||||
"semver": "^7.3.5",
|
||||
"semver": "^7.5.2",
|
||||
"typed_janus_js": "^1.0.14",
|
||||
"uuid": "^9.0.0",
|
||||
"vue": "^2.7.10",
|
||||
"vue-class-component": "^7.2.6",
|
||||
@@ -67,6 +71,8 @@
|
||||
"devDependencies": {
|
||||
"@intlify/vite-plugin-vue-i18n": "^2.5.0",
|
||||
"@mdi/js": "^7.0.0",
|
||||
"@types/file-saver": "^2.0.5",
|
||||
"@types/jmuxer": "^2.0.3",
|
||||
"@types/lodash.kebabcase": "^4.1.6",
|
||||
"@types/lodash.throttle": "^4.1.6",
|
||||
"@types/semver": "^7.3.8",
|
||||
@@ -84,17 +90,17 @@
|
||||
"sass": "~1.32",
|
||||
"start-server-and-test": "^1.14.0",
|
||||
"typescript": "^4.5.5",
|
||||
"unplugin-vue-components": "^0.22.0",
|
||||
"vite": "^3.0.0",
|
||||
"unplugin-vue-components": "^0.22.12",
|
||||
"vite": "^3.2.7",
|
||||
"vite-plugin-checker": "^0.5.0",
|
||||
"vite-plugin-package-version": "^1.0.2",
|
||||
"vite-plugin-pwa": "^0.13.0",
|
||||
"vite-plugin-pwa": "^0.16.4",
|
||||
"vite-plugin-vue2": "^2.0.1",
|
||||
"vue-debounce-decorator": "^1.0.1",
|
||||
"vue-i18n-extract": "^2.0.7",
|
||||
"vue-router": "^3.5.2",
|
||||
"vue-template-compiler": "^2.6.14",
|
||||
"workbox-core": "^6.4.2"
|
||||
"workbox-core": "^7.0.0"
|
||||
},
|
||||
"postcss": {
|
||||
"plugins": {
|
||||
|
||||
+26
-14
@@ -34,13 +34,15 @@
|
||||
<router-view></router-view>
|
||||
</v-container>
|
||||
</v-main>
|
||||
<the-update-dialog></the-update-dialog>
|
||||
<the-editor></the-editor>
|
||||
<the-timelapse-rendering-snackbar></the-timelapse-rendering-snackbar>
|
||||
<the-fullscreen-upload></the-fullscreen-upload>
|
||||
<the-upload-snackbar></the-upload-snackbar>
|
||||
<the-service-worker />
|
||||
<the-update-dialog />
|
||||
<the-editor />
|
||||
<the-timelapse-rendering-snackbar />
|
||||
<the-fullscreen-upload />
|
||||
<the-upload-snackbar />
|
||||
<the-manual-probe-dialog />
|
||||
<the-bed-screws-dialog />
|
||||
<the-screws-tilt-adjust-dialog />
|
||||
</template>
|
||||
<the-select-printer-dialog v-else-if="instancesDB !== 'moonraker'"></the-select-printer-dialog>
|
||||
<the-connecting-dialog v-else></the-connecting-dialog>
|
||||
@@ -63,6 +65,9 @@ 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: {
|
||||
@@ -77,15 +82,21 @@ import TheBedScrewsDialog from '@/components/dialogs/TheBedScrewsDialog.vue'
|
||||
TheUploadSnackbar,
|
||||
TheManualProbeDialog,
|
||||
TheBedScrewsDialog,
|
||||
},
|
||||
metaInfo() {
|
||||
const title = this.$store.getters['getTitle']
|
||||
return {
|
||||
titleTemplate: () => title,
|
||||
}
|
||||
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']
|
||||
}
|
||||
@@ -159,7 +170,7 @@ export default class App extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get print_percent(): number {
|
||||
return Math.round(this.$store.getters['printer/getPrintPercent'] * 100)
|
||||
return Math.floor(this.$store.getters['printer/getPrintPercent'] * 100)
|
||||
}
|
||||
|
||||
@Watch('language')
|
||||
@@ -184,8 +195,9 @@ export default class App extends Mixins(BaseMixin) {
|
||||
|
||||
@Watch('current_file')
|
||||
current_fileChanged(newVal: string): void {
|
||||
if (newVal !== '')
|
||||
this.$socket.emit('server.files.metadata', { filename: newVal }, { action: 'files/getMetadataCurrentFile' })
|
||||
if (newVal === '') return
|
||||
|
||||
this.$socket.emit('server.files.metadata', { filename: newVal }, { action: 'files/getMetadataCurrentFile' })
|
||||
}
|
||||
|
||||
@Watch('primaryColor')
|
||||
|
||||
@@ -239,27 +239,35 @@ export default class TheEditor extends Mixins(BaseMixin) {
|
||||
if (!this.isWriteable) return null
|
||||
if (['printing', 'paused'].includes(this.printer_state)) return null
|
||||
|
||||
// check for generic services <service>.conf (like moonraker.conf, crowsnest.conf, sonar.conf)
|
||||
if (this.availableServices.includes(this.filenameWithoutExtension) && this.fileExtension === 'conf')
|
||||
return this.filenameWithoutExtension
|
||||
if (this.filename.startsWith('webcam') && ['conf', 'txt'].includes(this.fileExtension)) return 'webcamd'
|
||||
if (this.filename.startsWith('mooncord') && this.fileExtension === 'json') return 'mooncord'
|
||||
if (this.filename === 'moonraker.conf') return this.moonrakerRestartInstance ?? 'moonraker'
|
||||
|
||||
// old webcam service DEPRECATED
|
||||
if (this.filename.startsWith('webcam') && ['conf', 'txt'].includes(this.fileExtension)) return 'webcamd'
|
||||
|
||||
// check for mooncord config files
|
||||
if (this.filename.startsWith('mooncord') && this.fileExtension === 'json') return 'mooncord'
|
||||
|
||||
// fallback for moonraker with multi instances
|
||||
if (this.filename === 'moonraker.conf') return 'moonraker'
|
||||
|
||||
// all .cfg files will be klipper config files
|
||||
if (this.fileExtension === 'cfg') return 'klipper'
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
get restartServiceNameExists() {
|
||||
if (this.restartServiceName) return true
|
||||
// hide the button, if there is no service found
|
||||
if (this.restartServiceName === null) return false
|
||||
|
||||
// klipper and moonraker uses specific api calls instead of generic service restart
|
||||
if (['klipper', 'moonraker'].includes(this.restartServiceName)) return true
|
||||
|
||||
return this.availableServices.includes(this.restartServiceName)
|
||||
}
|
||||
|
||||
get moonrakerRestartInstance() {
|
||||
return this.$store.state.gui.editor.moonrakerRestartInstance
|
||||
}
|
||||
|
||||
get confirmUnsavedChanges() {
|
||||
return this.$store.state.gui.editor.confirmUnsavedChanges ?? false
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
<template>
|
||||
<v-dialog v-model="showDialog" persistent max-width="400" class="mx-0">
|
||||
<panel
|
||||
:title="$t('App.TheServiceWorker.TitleNeedUpdate')"
|
||||
card-class="service-worker-dialog"
|
||||
:margin-bottom="false">
|
||||
<v-card-text>
|
||||
<p>{{ $t('App.TheServiceWorker.DescriptionNeedUpdate') }}</p>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer />
|
||||
<v-btn text color="primary" @click="update">{{ $t('App.TheServiceWorker.Update') }}</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import Component from 'vue-class-component'
|
||||
import { Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
|
||||
@Component
|
||||
export default class TheServiceWorker extends Mixins(BaseMixin) {
|
||||
showDialog = false
|
||||
updateSW: ((reloadPage?: boolean | undefined) => Promise<void>) | null = null
|
||||
|
||||
onOfflineReady() {
|
||||
window.console.info('PWA is offline ready')
|
||||
}
|
||||
|
||||
onNeedRefresh() {
|
||||
window.console.warn('PWA needs to refresh')
|
||||
this.showDialog = true
|
||||
}
|
||||
|
||||
onRegistered() {
|
||||
window.console.debug('PWA is registered')
|
||||
}
|
||||
|
||||
onRegisterError(error: any) {
|
||||
window.console.error('PWA registration error:', error)
|
||||
}
|
||||
|
||||
update() {
|
||||
this.updateSW?.(true)
|
||||
this.showDialog = false
|
||||
}
|
||||
|
||||
async mounted() {
|
||||
const { registerSW } = await import('virtual:pwa-register')
|
||||
this.updateSW = registerSW({
|
||||
immediate: true,
|
||||
onOfflineReady: this.onOfflineReady,
|
||||
onNeedRefresh: this.onNeedRefresh,
|
||||
onRegistered: this.onRegistered,
|
||||
onRegisterError: this.onRegisterError,
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -55,7 +55,7 @@
|
||||
ref="settingsScroll"
|
||||
:class="'settings-tabs ' + (isMobile ? '' : 'height500')"
|
||||
:options="{ overflowBehavior: { x: 'hidden' } }">
|
||||
<component :is="'settings-' + activeTab + '-tab'" @scrollToTop="scrollToTop"></component>
|
||||
<component :is="'settings-' + activeTab + '-tab'" @scrollToTop="scrollToTop" />
|
||||
</overlay-scrollbars>
|
||||
</v-col>
|
||||
</v-row>
|
||||
@@ -80,6 +80,7 @@ import SettingsDashboardTab from '@/components/settings/SettingsDashboardTab.vue
|
||||
import SettingsGCodeViewerTab from '@/components/settings/SettingsGCodeViewerTab.vue'
|
||||
import SettingsEditorTab from '@/components/settings/SettingsEditorTab.vue'
|
||||
import SettingsTimelapseTab from '@/components/settings/SettingsTimelapseTab.vue'
|
||||
import SettingsNavigationTab from '@/components/settings/SettingsNavigationTab.vue'
|
||||
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import {
|
||||
@@ -98,6 +99,7 @@ import {
|
||||
mdiVideo3d,
|
||||
mdiWebcam,
|
||||
mdiDipSwitch,
|
||||
mdiMenu,
|
||||
} from '@mdi/js'
|
||||
import SettingsMiscellaneousTab from '@/components/settings/SettingsMiscellaneousTab.vue'
|
||||
@Component({
|
||||
@@ -116,6 +118,7 @@ import SettingsMiscellaneousTab from '@/components/settings/SettingsMiscellaneou
|
||||
SettingsEditorTab,
|
||||
SettingsTimelapseTab,
|
||||
SettingsMiscellaneousTab,
|
||||
SettingsNavigationTab,
|
||||
},
|
||||
})
|
||||
export default class TheSettingsMenu extends Mixins(BaseMixin) {
|
||||
@@ -194,6 +197,11 @@ export default class TheSettingsMenu extends Mixins(BaseMixin) {
|
||||
name: 'miscellaneous',
|
||||
title: this.$t('Settings.MiscellaneousTab.Miscellaneous'),
|
||||
},
|
||||
{
|
||||
icon: mdiMenu,
|
||||
name: 'navigation',
|
||||
title: this.$t('Settings.NavigationTab.Navigation'),
|
||||
},
|
||||
]
|
||||
|
||||
if (this.moonrakerComponents.includes('timelapse')) {
|
||||
|
||||
+44
-150
@@ -1,46 +1,3 @@
|
||||
<style>
|
||||
.nav-logo {
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.small-list-item {
|
||||
height: var(--sidebar-menu-item-height);
|
||||
}
|
||||
|
||||
.no-text-decoration {
|
||||
text-decoration: none;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.no-background:before {
|
||||
background-color: rgba(255, 255, 255, 0) !important;
|
||||
}
|
||||
|
||||
.no-border {
|
||||
border: 0 !important;
|
||||
}
|
||||
</style>
|
||||
<style scoped>
|
||||
.active-nav-item {
|
||||
border-right: 4px solid var(--v-primary-base);
|
||||
}
|
||||
|
||||
.menu-item-icon {
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.menu-item-title {
|
||||
line-height: 30px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.nav-scrollbar {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<v-navigation-drawer
|
||||
:key="navigationStyle"
|
||||
@@ -59,78 +16,27 @@
|
||||
v-if="isMobile"
|
||||
router
|
||||
to="/"
|
||||
:class="
|
||||
'sidebar-logo no-text-decoration no-background no-border ' +
|
||||
(navigationStyle === 'iconsOnly' ? 'pa-0 justify-center' : '')
|
||||
"
|
||||
:class="mobileLogoClass"
|
||||
:style="'height: ' + topbarHeight + 'px'"
|
||||
:ripple="false">
|
||||
<template v-if="sidebarLogo">
|
||||
<img :src="sidebarLogo" :style="logoCssVars" class="nav-logo" alt="Logo" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<mainsail-logo
|
||||
:color="logoColor"
|
||||
:style="logoCssVars"
|
||||
class="nav-logo"
|
||||
:ripple="false"></mainsail-logo>
|
||||
<mainsail-logo :color="logoColor" :style="logoCssVars" class="nav-logo" :ripple="false" />
|
||||
</template>
|
||||
<template v-if="navigationStyle !== 'iconsOnly'">
|
||||
<span class="text-h6 font-weight-regular text-truncate">{{ printerName }}</span>
|
||||
</template>
|
||||
</v-list-item>
|
||||
<template v-if="countPrinters">
|
||||
<v-tooltip right :open-delay="500" :disabled="navigationStyle !== 'iconsOnly'">
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-list-item
|
||||
router
|
||||
to="/allPrinters"
|
||||
class="small-list-item mt-1"
|
||||
v-bind="attrs"
|
||||
v-on="on">
|
||||
<v-list-item-icon class="my-3 mr-3 menu-item-icon">
|
||||
<v-icon>{{ mdiViewDashboardOutline }}</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title tile class="menu-item-title">
|
||||
{{ $t('App.Printers') }}
|
||||
</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
</template>
|
||||
<span>{{ $t('App.Printers') }}</span>
|
||||
</v-tooltip>
|
||||
<v-divider class="my-1"></v-divider>
|
||||
</template>
|
||||
<div v-for="(category, index) in naviPoints" :key="index">
|
||||
<v-tooltip right :open-delay="500" :disabled="navigationStyle !== 'iconsOnly'">
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-list-item
|
||||
router
|
||||
:to="category.path"
|
||||
class="small-list-item"
|
||||
v-bind="attrs"
|
||||
v-on="on">
|
||||
<v-list-item-icon class="my-3 mr-3 menu-item-icon">
|
||||
<v-icon>{{ category.icon }}</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title tile class="menu-item-title">
|
||||
{{ $t(`Router.${category.title}`) }}
|
||||
</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
</template>
|
||||
<span>{{ $t(`Router.${category.title}`) }}</span>
|
||||
</v-tooltip>
|
||||
</div>
|
||||
<sidebar-item v-for="(category, index) in visibleNaviPoints" :key="index" :item="category" />
|
||||
</v-list-item-group>
|
||||
</v-list>
|
||||
</overlay-scrollbars>
|
||||
<template #append>
|
||||
<v-list-item class="small-list-item mb-2">
|
||||
<v-list-item-icon class="menu-item-icon">
|
||||
<about-dialog></about-dialog>
|
||||
<about-dialog />
|
||||
</v-list-item-icon>
|
||||
</v-list-item>
|
||||
</template>
|
||||
@@ -139,32 +45,27 @@
|
||||
|
||||
<script lang="ts">
|
||||
import Component from 'vue-class-component'
|
||||
import routes, { AppRoute } from '@/routes'
|
||||
import { Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { PrinterStateKlipperConfig } from '@/store/printer/types'
|
||||
import TheSelectPrinterDialog from '@/components/TheSelectPrinterDialog.vue'
|
||||
import AboutDialog from '@/components/dialogs/AboutDialog.vue'
|
||||
import { navigationWidth, topbarHeight } from '@/store/variables'
|
||||
import MainsailLogo from '@/components/ui/MainsailLogo.vue'
|
||||
import { mdiViewDashboardOutline } from '@mdi/js'
|
||||
import SidebarItem from '@/components/ui/SidebarItem.vue'
|
||||
import NavigationMixin from '@/components/mixins/navigation'
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
SidebarItem,
|
||||
TheSelectPrinterDialog,
|
||||
AboutDialog,
|
||||
MainsailLogo,
|
||||
},
|
||||
})
|
||||
export default class TheSidebar extends Mixins(BaseMixin) {
|
||||
export default class TheSidebar extends Mixins(NavigationMixin, BaseMixin) {
|
||||
navigationWidth = navigationWidth
|
||||
topbarHeight = topbarHeight
|
||||
|
||||
/**
|
||||
* Icons
|
||||
*/
|
||||
mdiViewDashboardOutline = mdiViewDashboardOutline
|
||||
|
||||
get naviDrawer(): boolean {
|
||||
return this.$store.state.naviDrawer
|
||||
}
|
||||
@@ -181,45 +82,12 @@ export default class TheSidebar extends Mixins(BaseMixin) {
|
||||
return this.$store.getters['files/getSidebarBackground']
|
||||
}
|
||||
|
||||
get naviPoints(): AppRoute[] {
|
||||
return routes.filter((element) => {
|
||||
return element.showInNavi && this.showInNavi(element)
|
||||
})
|
||||
}
|
||||
|
||||
get klippy_state(): string {
|
||||
return this.$store.state.server.klippy_state
|
||||
}
|
||||
|
||||
get boolNaviWebcam(): boolean {
|
||||
return this.$store.state.gui.uiSettings.boolWebcamNavi
|
||||
}
|
||||
|
||||
get moonrakerComponents(): string[] {
|
||||
return this.$store.state.server.components
|
||||
}
|
||||
|
||||
get registeredDirectories(): string[] {
|
||||
return this.$store.state.server.registered_directories
|
||||
}
|
||||
|
||||
get klipperConfigfileSettings(): PrinterStateKlipperConfig[] {
|
||||
return this.$store.state.printer.configfile?.settings ?? {}
|
||||
}
|
||||
|
||||
get currentPage(): string {
|
||||
return this.$route.fullPath
|
||||
}
|
||||
|
||||
get countPrinters() {
|
||||
return this.$store.getters['farm/countPrinters']
|
||||
}
|
||||
|
||||
get boolNaviTemp(): boolean {
|
||||
if (!this.isMobile && this.$vuetify.breakpoint.mdAndDown) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
return !this.isMobile && this.$vuetify.breakpoint.mdAndDown
|
||||
}
|
||||
|
||||
get sidebarCssVars(): any {
|
||||
@@ -255,16 +123,15 @@ export default class TheSidebar extends Mixins(BaseMixin) {
|
||||
return {}
|
||||
}
|
||||
|
||||
showInNavi(route: AppRoute): boolean {
|
||||
if (['shutdown', 'error', 'disconnected'].includes(this.klippy_state) && !route.alwaysShow) return false
|
||||
else if (route.title === 'Webcam' && !this.boolNaviWebcam) return false
|
||||
else if (route.moonrakerComponent && !this.moonrakerComponents.includes(route.moonrakerComponent)) return false
|
||||
else if (route.registeredDirectory && !this.registeredDirectories.includes(route.registeredDirectory))
|
||||
return false
|
||||
else if (route.klipperComponent && !(route.klipperComponent in this.klipperConfigfileSettings)) return false
|
||||
else if (route.klipperIsConnected && !this.klippyIsConnected) return false
|
||||
get mobileLogoClass() {
|
||||
const output = ['sidebar-logo', 'no-text-decoration', 'no-background', 'no-border']
|
||||
|
||||
return true
|
||||
if (this.navigationStyle === 'iconsOnly') {
|
||||
output.push('pa-0')
|
||||
output.push('justify-center')
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
mounted() {
|
||||
@@ -272,3 +139,30 @@ export default class TheSidebar extends Mixins(BaseMixin) {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.no-text-decoration {
|
||||
text-decoration: none;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.no-background:before {
|
||||
background-color: rgba(255, 255, 255, 0) !important;
|
||||
}
|
||||
|
||||
.no-border {
|
||||
border: 0 !important;
|
||||
}
|
||||
|
||||
.nav-logo {
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.menu-item-icon {
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.nav-scrollbar {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -30,7 +30,7 @@
|
||||
style="display: none"
|
||||
@change="uploadAndStart" />
|
||||
<v-btn
|
||||
v-if="klippyIsConnected && saveConfigPending"
|
||||
v-if="showSaveConfigButton"
|
||||
tile
|
||||
:icon="$vuetify.breakpoint.smAndDown"
|
||||
:text="$vuetify.breakpoint.mdAndUp"
|
||||
@@ -196,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
|
||||
|
||||
|
||||
@@ -161,10 +161,14 @@ export default class TheUpdateDialog extends Mixins(BaseMixin) {
|
||||
this.complete &&
|
||||
['client', 'mainsail', 'full'].includes(this.application.toLowerCase())
|
||||
)
|
||||
window.location.reload(true)
|
||||
window.location.reload()
|
||||
else {
|
||||
this.$store.commit('server/updateManager/resetUpdateResponse')
|
||||
this.$socket.emit('machine.update.status', { refresh: false }, { action: 'server/updateManager/getStatus' })
|
||||
this.$socket.emit(
|
||||
'machine.update.status',
|
||||
{ refresh: false },
|
||||
{ action: 'server/updateManager/onUpdateStatus' }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@
|
||||
:option="chartOptions"
|
||||
:autoresize="true"
|
||||
:init-options="{ renderer: 'svg' }"
|
||||
style="height: 250px; width: 100%"></e-chart>
|
||||
style="height: 200px; width: 100%"></e-chart>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -19,7 +19,7 @@ import { ServerHistoryStateAllPrintStatusEntry } from '@/store/server/history/ty
|
||||
@Component({
|
||||
components: {},
|
||||
})
|
||||
export default class HistoryAllPrintStatus extends Mixins(BaseMixin) {
|
||||
export default class HistoryAllPrintStatusChart extends Mixins(BaseMixin) {
|
||||
declare $refs: {
|
||||
historyAllPrintStatus: any
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<v-simple-table>
|
||||
<tbody>
|
||||
<tr v-for="status in printStatusArray" :key="status.name">
|
||||
<td>{{ status.displayName }}</td>
|
||||
<td class="text-right">{{ status.value }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</v-simple-table>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Component from 'vue-class-component'
|
||||
import { Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { ServerHistoryStateAllPrintStatusEntry } from '@/store/server/history/types'
|
||||
|
||||
@Component({
|
||||
components: {},
|
||||
})
|
||||
export default class HistoryAllPrintStatusTable extends Mixins(BaseMixin) {
|
||||
get selectedJobs() {
|
||||
return this.$store.state.gui.view.history.selectedJobs ?? []
|
||||
}
|
||||
|
||||
get allPrintStatusArray() {
|
||||
return this.$store.getters['server/history/getAllPrintStatusArrayAll']
|
||||
}
|
||||
|
||||
get selectedPrintStatusArray() {
|
||||
return this.$store.getters['server/history/getSelectedPrintStatusArray']
|
||||
}
|
||||
|
||||
get printStatusArray() {
|
||||
const output: ServerHistoryStateAllPrintStatusEntry[] = []
|
||||
const orgArray = this.selectedJobs.length ? this.selectedPrintStatusArray : this.allPrintStatusArray
|
||||
|
||||
orgArray.forEach((status: ServerHistoryStateAllPrintStatusEntry) => {
|
||||
const tmp = { ...status }
|
||||
tmp.name = status.displayName
|
||||
output.push(tmp)
|
||||
})
|
||||
|
||||
return output
|
||||
}
|
||||
}
|
||||
</script>
|
||||
+116
-145
@@ -5,7 +5,8 @@
|
||||
:option="chartOptions"
|
||||
:init-options="{ renderer: 'svg' }"
|
||||
:autoresize="true"
|
||||
style="height: 250px; width: 100%"></e-chart>
|
||||
:style="tempchartStyle"
|
||||
class="tempchart" />
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -13,11 +14,12 @@ import { convertName } from '@/plugins/helpers'
|
||||
import Component from 'vue-class-component'
|
||||
import { Mixins, Watch } from 'vue-property-decorator'
|
||||
import BaseMixin from '../mixins/base'
|
||||
import { PrinterTempHistoryStateSerie, PrinterTempHistoryStateSourceEntry } from '@/store/printer/tempHistory/types'
|
||||
import { PrinterTempHistoryStateSourceEntry } from '@/store/printer/tempHistory/types'
|
||||
|
||||
import type { ECharts } from 'echarts/core'
|
||||
import type { ECBasicOption } from 'echarts/types/dist/shared.d'
|
||||
import { mdiClock } from '@mdi/js'
|
||||
import { datasetTypesInPercents } from '@/store/variables'
|
||||
|
||||
interface echartsTooltipObj {
|
||||
[key: string]: any
|
||||
@@ -32,11 +34,48 @@ export default class TempChart extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
private isVisible = true
|
||||
public chartOptions: ECBasicOption = {
|
||||
darkMode: true,
|
||||
renderer: 'svg',
|
||||
animation: false,
|
||||
tooltip: {
|
||||
get chartOptions(): ECBasicOption {
|
||||
return {
|
||||
darkMode: true,
|
||||
renderer: 'svg',
|
||||
animation: false,
|
||||
tooltip: this.tooltip,
|
||||
grid: {
|
||||
top: 35,
|
||||
right: this.gridRight,
|
||||
bottom: 30,
|
||||
left: 25,
|
||||
},
|
||||
legend: {
|
||||
animation: false,
|
||||
show: false,
|
||||
selected: this.selectedLegends,
|
||||
},
|
||||
xAxis: {
|
||||
type: 'time',
|
||||
splitNumber: 5,
|
||||
minInterval: 60 * 1000,
|
||||
splitLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: 'rgba(255, 255, 255, 0.06)',
|
||||
},
|
||||
},
|
||||
axisLabel: {
|
||||
color: 'rgba(255, 255, 255, 0.24)',
|
||||
margin: 10,
|
||||
formatter: this.timeFormat,
|
||||
},
|
||||
},
|
||||
yAxis: this.yAxis,
|
||||
media: this.media,
|
||||
dataset: { source: this.source },
|
||||
series: this.series,
|
||||
}
|
||||
}
|
||||
|
||||
get tooltip() {
|
||||
return {
|
||||
animation: false,
|
||||
trigger: 'axis',
|
||||
backgroundColor: 'rgba(0,0,0,0.9)',
|
||||
@@ -56,38 +95,11 @@ export default class TempChart extends Mixins(BaseMixin) {
|
||||
obj[['left', 'right'][+(pos[0] < size.viewSize[0] / 2)]] = 5
|
||||
return obj
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
top: 35,
|
||||
right: 15,
|
||||
bottom: 30,
|
||||
left: 25,
|
||||
},
|
||||
legend: {
|
||||
animation: false,
|
||||
show: false,
|
||||
selected: {},
|
||||
},
|
||||
/*dataZoom: [{
|
||||
type: 'inside',
|
||||
}],*/
|
||||
xAxis: {
|
||||
type: 'time',
|
||||
splitNumber: 5,
|
||||
minInterval: 60 * 1000,
|
||||
splitLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: 'rgba(255, 255, 255, 0.06)',
|
||||
},
|
||||
},
|
||||
axisLabel: {
|
||||
color: 'rgba(255, 255, 255, 0.24)',
|
||||
margin: 10,
|
||||
formatter: this.timeFormat,
|
||||
},
|
||||
},
|
||||
yAxis: [
|
||||
}
|
||||
}
|
||||
|
||||
get yAxis() {
|
||||
return [
|
||||
{
|
||||
name: this.$t('Panels.TemperaturePanel.TemperaturesInChart'),
|
||||
type: 'value',
|
||||
@@ -157,15 +169,18 @@ export default class TempChart extends Mixins(BaseMixin) {
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
media: [
|
||||
]
|
||||
}
|
||||
|
||||
get media() {
|
||||
return [
|
||||
{
|
||||
query: {
|
||||
minWidth: 500,
|
||||
},
|
||||
option: {
|
||||
grid: {
|
||||
right: 15,
|
||||
right: this.optionGridRight,
|
||||
left: 40,
|
||||
},
|
||||
yAxis: [
|
||||
@@ -187,11 +202,7 @@ export default class TempChart extends Mixins(BaseMixin) {
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
dataset: {
|
||||
source: [],
|
||||
},
|
||||
series: [],
|
||||
]
|
||||
}
|
||||
|
||||
get chart(): ECharts | null {
|
||||
@@ -230,9 +241,24 @@ export default class TempChart extends Mixins(BaseMixin) {
|
||||
return this.hours12Format ? '{hh}:{mm}' : '{HH}:{mm}'
|
||||
}
|
||||
|
||||
mounted() {
|
||||
this.initChart()
|
||||
this.chartOptions.xAxis.axisLabel.formatter = this.timeFormat
|
||||
get tempchartHeight() {
|
||||
return this.$store.state.gui.uiSettings.tempchartHeight ?? 250
|
||||
}
|
||||
|
||||
get tempchartStyle() {
|
||||
return {
|
||||
height: this.tempchartHeight + 'px',
|
||||
}
|
||||
}
|
||||
|
||||
get gridRight() {
|
||||
return this.boolDisplayPwmAxis ? 25 : 15
|
||||
}
|
||||
|
||||
get optionGridRight() {
|
||||
if (this.boolDisplayPwmAxis) return 35
|
||||
|
||||
return 15
|
||||
}
|
||||
|
||||
beforeDestroy() {
|
||||
@@ -240,75 +266,17 @@ export default class TempChart extends Mixins(BaseMixin) {
|
||||
if (this.chart) this.chart.dispose()
|
||||
}
|
||||
|
||||
initChart() {
|
||||
this.chartOptions.series = this.series
|
||||
this.chartOptions.legend.selected = this.selectedLegends
|
||||
this.updateChartPwmAxis()
|
||||
}
|
||||
|
||||
updateChart() {
|
||||
if (this.chart && this.isVisible) {
|
||||
//const t0 = performance.now()
|
||||
const limitDate = new Date(Date.now() - this.maxHistory * 1000)
|
||||
let newSource = [...this.source].filter((entry: PrinterTempHistoryStateSourceEntry) => {
|
||||
return entry.date >= limitDate
|
||||
})
|
||||
|
||||
this.chart?.setOption(
|
||||
{
|
||||
dataset: {
|
||||
source: newSource,
|
||||
},
|
||||
},
|
||||
false,
|
||||
true
|
||||
)
|
||||
|
||||
//const t1 = performance.now()
|
||||
//window.console.debug('calc chart', (t1-t0).toFixed(), newSource.length, this.source.length)
|
||||
|
||||
// reset tempHistory if working sources are smaller than 80%
|
||||
if (this.source.length > 0 && newSource.length < this.maxHistory * 0.8) {
|
||||
this.$socket.emit('server.temperature_store', {}, { action: 'printer/tempHistory/init' })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateChartPwmAxis() {
|
||||
if (this.boolDisplayPwmAxis) {
|
||||
this.chartOptions.yAxis[1].show = true
|
||||
this.chartOptions.grid.right = 25
|
||||
this.chartOptions.media[0].option.grid.right = 35
|
||||
} else {
|
||||
this.chartOptions.yAxis[1].show = false
|
||||
this.chartOptions.grid.right = 15
|
||||
this.chartOptions.media[0].option.grid.right = 15
|
||||
}
|
||||
}
|
||||
|
||||
visibilityChanged(isVisible: boolean) {
|
||||
this.isVisible = isVisible
|
||||
|
||||
if (isVisible) {
|
||||
this.initChart()
|
||||
}
|
||||
}
|
||||
|
||||
tooltipFormatter(datasets: any) {
|
||||
let output = ''
|
||||
|
||||
const mainDatasets = datasets.filter((dataset: any) => {
|
||||
if (dataset.seriesName === 'date') return false
|
||||
|
||||
const lastIndex = dataset.seriesName.lastIndexOf('-')
|
||||
if (lastIndex === -1) return true
|
||||
|
||||
const suffix = dataset.seriesName.slice(lastIndex + 1)
|
||||
return !['target', 'power', 'speed'].includes(suffix)
|
||||
})
|
||||
const mainDatasets = datasets.filter((dataset: any) => dataset.seriesName.endsWith('-temperature'))
|
||||
if (datasets.length) {
|
||||
let outputTime = datasets[0]['axisValueLabel']
|
||||
outputTime = outputTime.substr(outputTime.indexOf(' '))
|
||||
outputTime = outputTime.substring(outputTime.indexOf(' '))
|
||||
|
||||
output +=
|
||||
'<div class="row">' +
|
||||
@@ -327,24 +295,35 @@ export default class TempChart extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
mainDatasets.forEach((dataset: any) => {
|
||||
const baseSeriesName = dataset.seriesName.substring(0, dataset.seriesName.lastIndexOf('-'))
|
||||
let displayName = baseSeriesName
|
||||
if (displayName.indexOf(' ') !== -1) {
|
||||
displayName = displayName.substring(displayName.indexOf(' ') + 1)
|
||||
}
|
||||
|
||||
output += '<div class="row">'
|
||||
|
||||
output += '<div class="col-auto py-0">'
|
||||
output += dataset.marker
|
||||
output += "<span class='ml-2'>" + convertName(dataset.seriesName) + ':</span>'
|
||||
output += "<span class='ml-2'>" + convertName(displayName) + ':</span>'
|
||||
output += '</div>'
|
||||
|
||||
output += '<div class="col text-right py-0 font-weight-bold">'
|
||||
|
||||
if (dataset.seriesName in dataset.value) output += dataset.value[dataset.seriesName].toFixed(1)
|
||||
if (dataset.seriesName + '-target' in dataset.value)
|
||||
output += ' / ' + dataset.value[dataset.seriesName + '-target'].toFixed(1)
|
||||
const seriesNameTemperature = `${baseSeriesName}-temperature`
|
||||
const seriesNameTarget = `${baseSeriesName}-target`
|
||||
|
||||
if (seriesNameTemperature in dataset.value) output += dataset.value[seriesNameTemperature].toFixed(1)
|
||||
if (seriesNameTarget in dataset.value) output += ' / ' + dataset.value[seriesNameTarget].toFixed(1)
|
||||
output += '°C'
|
||||
|
||||
if (dataset.seriesName + '-power' in dataset.value)
|
||||
output += ' [ ' + (dataset.value[dataset.seriesName + '-power'] * 100).toFixed(0) + '% ]'
|
||||
if (dataset.seriesName + '-speed' in dataset.value)
|
||||
output += ' [ ' + (dataset.value[dataset.seriesName + '-speed'] * 100).toFixed(0) + '% ]'
|
||||
datasetTypesInPercents.forEach((attrKey) => {
|
||||
const seriesName = `${baseSeriesName}-${attrKey}`
|
||||
if (!(seriesName in dataset.value)) return
|
||||
|
||||
const value = (dataset.value[seriesName] * 100).toFixed(0)
|
||||
output += ` [ ${value}% ]`
|
||||
})
|
||||
|
||||
output += '</div>'
|
||||
output += '</div>'
|
||||
@@ -353,26 +332,6 @@ export default class TempChart extends Mixins(BaseMixin) {
|
||||
return output
|
||||
}
|
||||
|
||||
@Watch('series', { deep: true })
|
||||
seriesChanged(newVal: PrinterTempHistoryStateSerie[]) {
|
||||
if (this.chart && this.chart?.isDisposed() !== true) {
|
||||
this.chart.setOption(
|
||||
{
|
||||
series: newVal,
|
||||
},
|
||||
false,
|
||||
true
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Watch('source')
|
||||
sourceChanged() {
|
||||
if (this.chart?.isDisposed() !== true) {
|
||||
this.updateChart()
|
||||
}
|
||||
}
|
||||
|
||||
@Watch('selectedLegends')
|
||||
selectedLegendsChanged(newVal: any, oldVal: any) {
|
||||
if (this.chart?.isDisposed() !== true) {
|
||||
@@ -385,14 +344,26 @@ export default class TempChart extends Mixins(BaseMixin) {
|
||||
}
|
||||
}
|
||||
|
||||
@Watch('boolDisplayPwmAxis')
|
||||
boolDisplayPwmAxisChanged() {
|
||||
this.updateChartPwmAxis()
|
||||
}
|
||||
@Watch('source')
|
||||
sourceChanged(newVal: PrinterTempHistoryStateSourceEntry[]) {
|
||||
// break if chart isn't initialized or not visible
|
||||
if (!this.chart || !this.isVisible) return
|
||||
|
||||
@Watch('hours12Format')
|
||||
hours12FormatChanged() {
|
||||
this.chartOptions.xAxis.axisLabel.formatter = this.timeFormat
|
||||
const limitDate = new Date(Date.now() - this.maxHistory * 1000)
|
||||
let newSource = newVal.filter((entry: PrinterTempHistoryStateSourceEntry) => {
|
||||
return entry.date >= limitDate
|
||||
})
|
||||
|
||||
// reset tempHistory if working sources are smaller than 80%
|
||||
if (newVal.length > 0 && newSource.length < this.maxHistory * 0.8) {
|
||||
this.$socket.emit('server.temperature_store', {}, { action: 'printer/tempHistory/init' })
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.tempchart {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -83,11 +83,17 @@ export default class TheBedScrewsDialog extends Mixins(BaseMixin, ControlMixin)
|
||||
mdiCloseThick = mdiCloseThick
|
||||
|
||||
get showDialog() {
|
||||
if (!this.boolBedScrewsDialog) return false
|
||||
|
||||
const is_active = this.$store.state.printer.bed_screws?.is_active ?? false
|
||||
|
||||
return is_active && this.homedAxes.includes('xyz')
|
||||
}
|
||||
|
||||
get boolBedScrewsDialog() {
|
||||
return this.$store.state.gui.uiSettings.boolBedScrewsDialog ?? true
|
||||
}
|
||||
|
||||
get config() {
|
||||
return this.$store.state.printer.configfile?.settings?.bed_screws ?? {}
|
||||
}
|
||||
|
||||
@@ -120,9 +120,15 @@ export default class TheManualProbeDialog extends Mixins(BaseMixin) {
|
||||
mdiCloseThick = mdiCloseThick
|
||||
|
||||
get showDialog() {
|
||||
if (!this.boolManualProbeDialog) return false
|
||||
|
||||
return this.$store.state.printer.manual_probe?.is_active ?? false
|
||||
}
|
||||
|
||||
get boolManualProbeDialog() {
|
||||
return this.$store.state.gui.uiSettings.boolManualProbeDialog ?? true
|
||||
}
|
||||
|
||||
get offsetsZ() {
|
||||
const offsets = [1, 0.1, 0.05, 0.01, 0.005]
|
||||
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
<template>
|
||||
<v-dialog :value="showDialog" width="400" persistent :fullscreen="isMobile">
|
||||
<panel
|
||||
:title="$t('ScrewsTiltAdjust.Headline')"
|
||||
:icon="mdiArrowCollapseDown"
|
||||
card-class="manual_probe-dialog"
|
||||
:margin-bottom="false"
|
||||
style="overflow: hidden"
|
||||
:height="isMobile ? 0 : 548">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="clearScrewsTiltAdjust">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text v-if="error">
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-alert border="left" text type="error">{{ $t('ScrewsTiltAdjust.ErrorText') }}</v-alert>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
<v-card-text v-if="Object.keys(results).length">
|
||||
<template v-for="(result, name, index) of results">
|
||||
<v-divider v-if="index" :key="`result-divider-${name}`" class="my-1" />
|
||||
<the-screws-tilt-adjust-dialog-entry
|
||||
:key="`result-${name}-${name}`"
|
||||
:name="name.toString()"
|
||||
:result="result" />
|
||||
</template>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer />
|
||||
<v-btn text @click="retryScrewsTiltAdjust">
|
||||
{{ $t('ScrewsTiltAdjust.Retry') }}
|
||||
</v-btn>
|
||||
<v-btn color="primary" text @click="clearScrewsTiltAdjust">
|
||||
{{ $t('ScrewsTiltAdjust.Accept') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import Responsive from '@/components/ui/Responsive.vue'
|
||||
import SettingsRow from '@/components/settings/SettingsRow.vue'
|
||||
import { mdiArrowCollapseDown, mdiCloseThick } from '@mdi/js'
|
||||
import ControlMixin from '@/components/mixins/control'
|
||||
import TheScrewsTiltAdjustDialogEntry from '@/components/dialogs/TheScrewsTiltAdjustDialogEntry.vue'
|
||||
@Component({
|
||||
components: { TheScrewsTiltAdjustDialogEntry, Panel, Responsive, SettingsRow },
|
||||
})
|
||||
export default class TheScrewsTiltAdjustDialog extends Mixins(BaseMixin, ControlMixin) {
|
||||
mdiArrowCollapseDown = mdiArrowCollapseDown
|
||||
mdiCloseThick = mdiCloseThick
|
||||
|
||||
get state() {
|
||||
return this.$store.state.printer.screws_tilt_adjust ?? {}
|
||||
}
|
||||
|
||||
get error() {
|
||||
return this.$store.state.printer.screws_tilt_adjust?.error ?? false
|
||||
}
|
||||
|
||||
get results() {
|
||||
return this.$store.state.printer.screws_tilt_adjust?.results ?? {}
|
||||
}
|
||||
|
||||
get showDialog() {
|
||||
if (!this.boolScrewsTiltAdjustDialog) return false
|
||||
|
||||
return this.error || Object.keys(this.results).length
|
||||
}
|
||||
|
||||
get boolScrewsTiltAdjustDialog() {
|
||||
return this.$store.state.gui.uiSettings.boolScrewsTiltAdjustDialog ?? true
|
||||
}
|
||||
|
||||
clearScrewsTiltAdjust() {
|
||||
this.$store.dispatch('printer/clearScrewsTiltAdjust')
|
||||
}
|
||||
|
||||
async retryScrewsTiltAdjust() {
|
||||
await this.$store.dispatch('printer/clearScrewsTiltAdjust')
|
||||
|
||||
this.doSend('SCREWS_TILT_CALCULATE')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,65 @@
|
||||
<template>
|
||||
<settings-row :title="outputName" :sub-title="subTitle">
|
||||
<v-chip v-if="!(is_base ?? false)" label small>
|
||||
<v-icon v-if="sign === 'CCW'" small left>{{ mdiRotateLeft }}</v-icon>
|
||||
<v-icon v-if="sign === 'CW'" small left>{{ mdiRotateRight }}</v-icon>
|
||||
{{ adjust }}
|
||||
</v-chip>
|
||||
<v-chip v-else label small>{{ $t('ScrewsTiltAdjust.Base') }}</v-chip>
|
||||
</settings-row>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import Responsive from '@/components/ui/Responsive.vue'
|
||||
import SettingsRow from '@/components/settings/SettingsRow.vue'
|
||||
import { mdiRotateLeft, mdiRotateRight, mdiCloseThick } from '@mdi/js'
|
||||
import ControlMixin from '@/components/mixins/control'
|
||||
interface ScrewsTiltAdjustResult {
|
||||
z: number
|
||||
sign?: string
|
||||
adjust?: string
|
||||
is_base: boolean
|
||||
}
|
||||
@Component({
|
||||
components: { Panel, Responsive, SettingsRow },
|
||||
})
|
||||
export default class TheScrewsTiltAdjustDialogEntry extends Mixins(BaseMixin, ControlMixin) {
|
||||
mdiRotateLeft = mdiRotateLeft
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiRotateRight = mdiRotateRight
|
||||
@Prop({ required: true }) declare readonly name: string
|
||||
@Prop({ required: true }) declare readonly result: ScrewsTiltAdjustResult
|
||||
get settings() {
|
||||
return this.$store.state.printer.configfile?.settings?.screws_tilt_adjust ?? {}
|
||||
}
|
||||
get outputName() {
|
||||
return this.settings[this.name + '_name'] ?? 'Unknown'
|
||||
}
|
||||
get coordinates() {
|
||||
return this.settings[this.name] ?? [0, 0]
|
||||
}
|
||||
get x() {
|
||||
return this.coordinates[0] ?? 0
|
||||
}
|
||||
get y() {
|
||||
return this.coordinates[1] ?? 0
|
||||
}
|
||||
get z() {
|
||||
return this.result.z.toFixed(3)
|
||||
}
|
||||
get subTitle() {
|
||||
return `(X: ${this.x}, Y: ${this.y}, Z: ${this.z})`
|
||||
}
|
||||
get sign() {
|
||||
return this.result.sign ?? ''
|
||||
}
|
||||
get adjust() {
|
||||
return this.result.adjust ?? '00:00'
|
||||
}
|
||||
get is_base() {
|
||||
return this.result.is_base ?? false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -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>
|
||||
@@ -19,9 +19,19 @@
|
||||
</template>
|
||||
<v-card-text>
|
||||
<v-row :class="showScrubber ? 'withScrubber' : ''">
|
||||
<v-col>
|
||||
<v-col :cols="showGCode ? 8 : 12">
|
||||
<div ref="viewerCanvasContainer"></div>
|
||||
</v-col>
|
||||
<v-col v-show="showGCode" cols="4">
|
||||
<div class="viewer">
|
||||
<CodeStream
|
||||
ref="gcodestream"
|
||||
:shown="showGCode"
|
||||
:currentline.sync="scrubPosition"
|
||||
:document="fileData"
|
||||
:is-simulating="!printerIsPrinting" />
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-show="showScrubber" class="scrubber">
|
||||
<v-col class="pt-0">
|
||||
@@ -123,6 +133,14 @@
|
||||
hide-details
|
||||
:label="$t('GCodeViewer.ShowTravelMoves')"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox
|
||||
v-model="showGCode"
|
||||
class="mt-0"
|
||||
hide-details
|
||||
:label="$t('GCodeViewer.ShowGCode')"></v-checkbox>
|
||||
</v-list-item>
|
||||
|
||||
<v-list-item
|
||||
v-if="loadedFile === sdCardFilePath && printing_objects.length"
|
||||
class="minHeight36">
|
||||
@@ -168,6 +186,13 @@
|
||||
hide-details
|
||||
:label="$t('GCodeViewer.SpecularLighting')"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox
|
||||
v-model="cncMode"
|
||||
class="mt-0"
|
||||
hide-details
|
||||
:label="$t('GCodeViewer.CNCMode')"></v-checkbox>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</v-col>
|
||||
@@ -255,6 +280,7 @@ import GCodeViewer from '@sindarius/gcodeviewer'
|
||||
import axios from 'axios'
|
||||
import { formatFilesize } from '@/plugins/helpers'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import CodeStream from '@/components/gcodeviewer/CodeStream.vue'
|
||||
import {
|
||||
mdiCameraRetake,
|
||||
mdiCog,
|
||||
@@ -286,7 +312,7 @@ interface downloadSnackbar {
|
||||
|
||||
let viewer: any = null
|
||||
@Component({
|
||||
components: { Panel },
|
||||
components: { Panel, CodeStream },
|
||||
})
|
||||
export default class Viewer extends Mixins(BaseMixin) {
|
||||
/**
|
||||
@@ -342,6 +368,8 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
name: '',
|
||||
}
|
||||
|
||||
private fileData: string = ''
|
||||
|
||||
@Prop({ type: String, default: '', required: false }) declare filename: string
|
||||
@Ref('fileInput') declare fileInput: HTMLInputElement
|
||||
@Ref('viewerCanvasContainer') declare viewerCanvasContainer: HTMLElement
|
||||
@@ -366,6 +394,9 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
await this.init()
|
||||
|
||||
if (this.loadedFile !== null) this.scrubFileSize = viewer.fileSize
|
||||
if (viewer) {
|
||||
this.fileData = viewer.fileData
|
||||
}
|
||||
}
|
||||
|
||||
beforeDestroy() {
|
||||
@@ -405,10 +436,23 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
return this.$store.state.printer.print_stats?.filename ?? ''
|
||||
}
|
||||
|
||||
get currentPosition() {
|
||||
get livePosition() {
|
||||
return this.$store.state.printer.motion_report?.live_position ?? [0, 0, 0, 0]
|
||||
}
|
||||
|
||||
get gcodeOffset() {
|
||||
return this.$store.state.printer?.gcode_move?.homing_origin ?? [0, 0, 0]
|
||||
}
|
||||
|
||||
get currentPosition() {
|
||||
return [
|
||||
this.livePosition[0] - this.gcodeOffset[0],
|
||||
this.livePosition[1] - this.gcodeOffset[1],
|
||||
this.livePosition[2] - this.gcodeOffset[2],
|
||||
this.livePosition[3],
|
||||
]
|
||||
}
|
||||
|
||||
get showTrackingButton() {
|
||||
return this.printerIsPrinting && this.sdCardFilePath === this.loadedFile
|
||||
}
|
||||
@@ -484,13 +528,14 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
viewer.gcodeProcessor.useHighQualityExtrusion(this.hdRendering)
|
||||
viewer.gcodeProcessor.updateForceWireMode(this.forceLineRendering)
|
||||
viewer.gcodeProcessor.updateForceWireMode(this.forceLineRendering || this.cncMode)
|
||||
viewer.gcodeProcessor.setAlpha(this.transparency)
|
||||
viewer.gcodeProcessor.setVoxelMode(this.voxelMode)
|
||||
viewer.gcodeProcessor.voxelWidth = this.voxelWidth
|
||||
viewer.gcodeProcessor.voxelHeight = this.voxelHeight
|
||||
viewer.gcodeProcessor.useSpecularColor(this.specularLighting)
|
||||
viewer.gcodeProcessor.setLiveTracking(false)
|
||||
viewer.gcodeProcessor.g1AsExtrusion = this.cncMode
|
||||
viewer.buildObjects.objectCallback = this.objectCallback
|
||||
|
||||
this.loadToolColors(this.extruderColors)
|
||||
@@ -574,6 +619,7 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
this.fileSize = blob.length
|
||||
// Do something with result
|
||||
await viewer.processFile(blob)
|
||||
this.fileData = viewer.fileData
|
||||
}
|
||||
this.finishLoad()
|
||||
})
|
||||
@@ -621,6 +667,7 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
|
||||
viewer.updateRenderQuality(this.renderQuality.value)
|
||||
await viewer.processFile(text)
|
||||
this.fileData = viewer.fileData
|
||||
this.loadingPercent = 100
|
||||
this.finishLoad()
|
||||
this.scrubFileSize = viewer.fileSize
|
||||
@@ -652,6 +699,7 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
this.loading = true
|
||||
this.loadingPercent = 0
|
||||
await viewer.reload()
|
||||
this.fileData = viewer.fileData
|
||||
this.loadingPercent = 100
|
||||
this.finishLoad()
|
||||
}
|
||||
@@ -694,6 +742,7 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
const offset = 350
|
||||
if (newVal > 0 && this.printerIsPrinting && this.tracking && newVal > offset) {
|
||||
viewer.gcodeProcessor.updateFilePosition(newVal - offset)
|
||||
this.scrubPosition = newVal - offset
|
||||
} else {
|
||||
viewer.gcodeProcessor.updateFilePosition(viewer.fileSize)
|
||||
}
|
||||
@@ -739,6 +788,18 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'gcodeViewer.showTravelMoves', value: newVal })
|
||||
}
|
||||
|
||||
get showGCode(): boolean {
|
||||
return this.$store.state.gui.gcodeViewer.showGCode ?? false
|
||||
}
|
||||
|
||||
set showGCode(newVal: boolean) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'gcodeViewer.showGCode', value: newVal })
|
||||
if (newVal && viewer) {
|
||||
this.fileData = viewer.fileData
|
||||
}
|
||||
this.handleResize()
|
||||
}
|
||||
|
||||
@Watch('showTravelMoves')
|
||||
showTravelMovesChanged(newVal: boolean) {
|
||||
viewer?.toggleTravels(newVal)
|
||||
@@ -784,7 +845,7 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
@Watch('forceLineRendering')
|
||||
async forceLineRenderingChanged(newVal: boolean) {
|
||||
if (viewer) {
|
||||
viewer.gcodeProcessor.updateForceWireMode(newVal)
|
||||
viewer.gcodeProcessor.updateForceWireMode(newVal || this.cncMode)
|
||||
await this.reloadViewer()
|
||||
}
|
||||
}
|
||||
@@ -855,6 +916,17 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
}
|
||||
}
|
||||
|
||||
get cncMode() {
|
||||
return this.$store.state.gui.gcodeViewer.cncMode
|
||||
}
|
||||
|
||||
set cncMode(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'gcodeViewer.cncMode', value: newVal })
|
||||
viewer.gcodeProcessor.g1AsExtrusion = newVal
|
||||
viewer.gcodeProcessor.updateForceWireMode(this.forceLineRendering || newVal)
|
||||
this.reloadViewer()
|
||||
}
|
||||
|
||||
get extruderColors() {
|
||||
return this.$store.state.gui.gcodeViewer?.extruderColors ?? false
|
||||
}
|
||||
@@ -1044,6 +1116,7 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
this.scrubInterval = setInterval(() => {
|
||||
this.scrubPosition += 100 * this.scrubSpeed
|
||||
viewer.gcodeProcessor.updateFilePosition(this.scrubPosition)
|
||||
viewer.simulateToolPosition()
|
||||
if (this.tracking || this.scrubPosition >= this.scrubFileSize) {
|
||||
this.scrubPlaying = false
|
||||
}
|
||||
@@ -1062,7 +1135,10 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
@Debounce(200)
|
||||
@Watch('scrubPosition')
|
||||
updateScrubPosition(to: number): void {
|
||||
if (!this.tracking) viewer.gcodeProcessor.updateFilePosition(to)
|
||||
if (!this.tracking) {
|
||||
viewer.gcodeProcessor.updateFilePosition(to)
|
||||
viewer.simulateToolPosition()
|
||||
}
|
||||
}
|
||||
|
||||
fastForward(): void {
|
||||
|
||||
@@ -12,13 +12,14 @@ import BaseMixin from '../mixins/base'
|
||||
import { basicSetup } from 'codemirror'
|
||||
import { EditorView, keymap } from '@codemirror/view'
|
||||
import { EditorState } from '@codemirror/state'
|
||||
import { mainsailTheme } from '@/plugins/codemirrorTheme'
|
||||
import { vscodeDark } from '@uiw/codemirror-theme-vscode'
|
||||
import { StreamLanguage } from '@codemirror/language'
|
||||
import { klipper_config } from '@/plugins/StreamParserKlipperConfig'
|
||||
import { gcode } from '@/plugins/StreamParserGcode'
|
||||
import { indentWithTab } from '@codemirror/commands'
|
||||
import { json } from '@codemirror/lang-json'
|
||||
import { css } from '@codemirror/lang-css'
|
||||
import { indentUnit } from '@codemirror/language'
|
||||
|
||||
@Component
|
||||
export default class Codemirror extends Mixins(BaseMixin) {
|
||||
@@ -81,8 +82,10 @@ export default class Codemirror extends Mixins(BaseMixin) {
|
||||
|
||||
get cmExtensions() {
|
||||
const extensions = [
|
||||
EditorView.theme({}, { dark: true }),
|
||||
basicSetup,
|
||||
mainsailTheme,
|
||||
vscodeDark,
|
||||
indentUnit.of(' '.repeat(this.tabSize)),
|
||||
keymap.of([indentWithTab]),
|
||||
EditorView.updateListener.of((update) => {
|
||||
this.content = update.state?.doc.toString()
|
||||
@@ -103,5 +106,9 @@ export default class Codemirror extends Mixins(BaseMixin) {
|
||||
visibilityChanged(isVisible: boolean) {
|
||||
if (isVisible) this.cminstance?.focus()
|
||||
}
|
||||
|
||||
get tabSize() {
|
||||
return this.$store.state.gui.editor.tabSize || 2
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -76,7 +76,7 @@
|
||||
</template>
|
||||
|
||||
<template #append>
|
||||
<v-icon :disabled="isLocked || sliderValue >= max" @click="increment">{{ mdiPlus }}</v-icon>
|
||||
<v-icon :disabled="isLocked || sliderValue >= 1" @click="increment">{{ mdiPlus }}</v-icon>
|
||||
</template>
|
||||
</v-slider>
|
||||
</v-card-text>
|
||||
@@ -278,9 +278,13 @@ export default class MiscellaneousSlider extends Mixins(BaseMixin) {
|
||||
return errors
|
||||
}
|
||||
|
||||
get disableFanAnimation() {
|
||||
return this.$store.state.gui.uiSettings.disableFanAnimation ?? false
|
||||
}
|
||||
|
||||
get fanClasses() {
|
||||
const output = ['mr-2']
|
||||
if (this.value >= this.off_below && this.value > 0) output.push('icon-rotate')
|
||||
if (!this.disableFanAnimation && this.value >= this.off_below && this.value > 0) output.push('icon-rotate')
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
@@ -1,6 +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 {
|
||||
@@ -33,6 +34,8 @@ export default class BaseMixin extends Vue {
|
||||
}
|
||||
|
||||
get klipperState(): string {
|
||||
if (!this.klippyIsConnected) return 'disconnected'
|
||||
|
||||
return this.$store.state.server.klippy_state ?? ''
|
||||
}
|
||||
|
||||
@@ -44,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 ?? []
|
||||
}
|
||||
@@ -147,13 +175,13 @@ export default class BaseMixin extends Vue {
|
||||
}
|
||||
|
||||
get browserLocale() {
|
||||
return navigator.languages && navigator.languages.length ? navigator.languages[0] : navigator.language
|
||||
return navigator.language
|
||||
}
|
||||
|
||||
get hours12Format() {
|
||||
const setting = this.$store.state.gui.general.timeFormat
|
||||
if (setting === '12hours') return true
|
||||
if (setting === null && this.browserLocale === 'en_us') return true
|
||||
if (setting === null && this.browserLocale === 'en-US') return true
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
import Component from 'vue-class-component'
|
||||
import routes, { AppRoute } from '@/routes'
|
||||
import { Mixins, Watch } from 'vue-property-decorator'
|
||||
import { mdiLinkVariant, mdiViewDashboardOutline } from '@mdi/js'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { PrinterStateKlipperConfig } from '@/store/printer/types'
|
||||
import { GuiNavigationStateEntry } from '@/store/gui/navigation/types'
|
||||
|
||||
export interface NaviPoint {
|
||||
type: 'link' | 'route'
|
||||
title: string
|
||||
to?: string
|
||||
href?: string
|
||||
target?: string
|
||||
icon: string
|
||||
position: number
|
||||
visible: boolean
|
||||
}
|
||||
|
||||
@Component
|
||||
export default class NavigationMixin extends Mixins(BaseMixin) {
|
||||
private customNaviLinks: NaviPoint[] = []
|
||||
|
||||
get countPrinters() {
|
||||
return this.$store.getters['farm/countPrinters']
|
||||
}
|
||||
|
||||
get routesNaviPoints(): NaviPoint[] {
|
||||
const points: NaviPoint[] = []
|
||||
|
||||
if (this.countPrinters) {
|
||||
points.push({
|
||||
title: this.$t('App.Printers'),
|
||||
icon: mdiViewDashboardOutline,
|
||||
to: '/allPrinters',
|
||||
position: 0,
|
||||
visible: true,
|
||||
} as NaviPoint)
|
||||
}
|
||||
|
||||
routes
|
||||
.filter((element) => {
|
||||
return element.showInNavi && this.showInNavi(element)
|
||||
})
|
||||
.forEach((element) => {
|
||||
const [position, visible] = this.getUiSettings({
|
||||
type: 'route',
|
||||
title: element.title ?? 'unknown',
|
||||
visible: true,
|
||||
position: element.position ?? 999,
|
||||
})
|
||||
|
||||
points.push({
|
||||
type: 'route',
|
||||
title: this.$t(`Router.${element.title}`),
|
||||
icon: element.icon,
|
||||
to: element.path,
|
||||
position,
|
||||
visible,
|
||||
} as NaviPoint)
|
||||
})
|
||||
|
||||
if (this.customNaviLinks.length) {
|
||||
this.customNaviLinks.forEach((element) => {
|
||||
const [position, visible] = this.getUiSettings({
|
||||
type: 'link',
|
||||
title: element.title ?? 'unknown',
|
||||
visible: element.visible ?? true,
|
||||
position: element.position ?? 999,
|
||||
})
|
||||
|
||||
points.push({
|
||||
type: 'link',
|
||||
title: element.title,
|
||||
icon: element.icon,
|
||||
href: element.href,
|
||||
target: element.target,
|
||||
position,
|
||||
visible,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
return points
|
||||
}
|
||||
|
||||
get naviPoints(): NaviPoint[] {
|
||||
return this.routesNaviPoints.sort((a, b) => a.position - b.position)
|
||||
}
|
||||
|
||||
get visibleNaviPoints(): NaviPoint[] {
|
||||
return this.naviPoints.filter((entry) => entry.visible)
|
||||
}
|
||||
|
||||
get uiSettings(): GuiNavigationStateEntry[] {
|
||||
return this.$store.state.gui.navigation.entries
|
||||
}
|
||||
|
||||
get klippy_state(): string {
|
||||
return this.$store.state.server.klippy_state
|
||||
}
|
||||
|
||||
get boolNaviWebcam(): boolean {
|
||||
return this.$store.state.gui.uiSettings.boolWebcamNavi
|
||||
}
|
||||
|
||||
get moonrakerComponents(): string[] {
|
||||
return this.$store.state.server.components
|
||||
}
|
||||
|
||||
get registeredDirectories(): string[] {
|
||||
return this.$store.state.server.registered_directories
|
||||
}
|
||||
|
||||
get klipperConfigfileSettings(): PrinterStateKlipperConfig[] {
|
||||
return this.$store.state.printer.configfile?.settings ?? {}
|
||||
}
|
||||
|
||||
get sidebarNaviFile(): string {
|
||||
return this.$store.getters['files/getCustomNaviPoints']
|
||||
}
|
||||
|
||||
get webcamCount(): number {
|
||||
return this.$store.getters['gui/webcams/getWebcams'].length
|
||||
}
|
||||
|
||||
@Watch('sidebarNaviFile', { immediate: true })
|
||||
async sidebarNaviFileChanged(newVal: string) {
|
||||
this.customNaviLinks = []
|
||||
|
||||
// stop if no file is set
|
||||
if (!newVal) return
|
||||
|
||||
const content = await fetch(newVal)
|
||||
.then((res) => res.json())
|
||||
.catch((err) => {
|
||||
window.console.error('Unable to parse .theme/navi.json.')
|
||||
throw err
|
||||
})
|
||||
|
||||
content.forEach((item: NaviPoint) => {
|
||||
this.customNaviLinks.push({
|
||||
title: item.title ?? 'Unknown',
|
||||
icon: item.icon ?? mdiLinkVariant,
|
||||
href: item.href ?? '#',
|
||||
target: item.target ?? undefined,
|
||||
position: item.position ?? 999,
|
||||
} as NaviPoint)
|
||||
})
|
||||
}
|
||||
|
||||
showInNavi(route: AppRoute): boolean {
|
||||
if (['shutdown', 'error', 'disconnected'].includes(this.klippy_state) && !route.alwaysShow) return false
|
||||
else if (route.title === 'Webcam' && this.webcamCount === 0) return false
|
||||
else if (route.moonrakerComponent && !this.moonrakerComponents.includes(route.moonrakerComponent)) return false
|
||||
else if (route.registeredDirectory && !this.registeredDirectories.includes(route.registeredDirectory))
|
||||
return false
|
||||
else if (route.klipperComponent && !(route.klipperComponent in this.klipperConfigfileSettings)) return false
|
||||
else if (route.klipperIsConnected && !this.klippyIsConnected) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
getUiSettings(entry: GuiNavigationStateEntry): [number, boolean] {
|
||||
const index = this.uiSettings.findIndex((point) => {
|
||||
return point.title === entry.title && point.type === entry.type
|
||||
})
|
||||
|
||||
if (index === -1) return [entry.position, entry.visible]
|
||||
|
||||
return [this.uiSettings[index].position, this.uiSettings[index].visible]
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
import Vue from 'vue'
|
||||
import Component from 'vue-class-component'
|
||||
import {
|
||||
mdiAlbum,
|
||||
@@ -10,9 +9,23 @@ import {
|
||||
mdiRaspberryPi,
|
||||
mdiWebcam,
|
||||
} from '@mdi/js'
|
||||
import { Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
|
||||
@Component
|
||||
export default class WebcamMixin extends Vue {
|
||||
export default class WebcamMixin extends Mixins(BaseMixin) {
|
||||
convertUrl(baseUrl: string, printerUrl: string | null) {
|
||||
let url = new URL(baseUrl, this.hostUrl.toString())
|
||||
|
||||
// use printerURL if it exists
|
||||
if (printerUrl !== null) url = new URL(baseUrl, printerUrl)
|
||||
|
||||
// overwrite url to baseUrl, if it is an absolute URL
|
||||
if (baseUrl.startsWith('http') || baseUrl.startsWith('://')) url = new URL(baseUrl)
|
||||
|
||||
return decodeURIComponent(url.toString())
|
||||
}
|
||||
|
||||
convertWebcamIcon(iconName: string): string {
|
||||
switch (iconName) {
|
||||
case 'mdiAlbum':
|
||||
@@ -34,4 +47,17 @@ export default class WebcamMixin extends Vue {
|
||||
return mdiWebcam
|
||||
}
|
||||
}
|
||||
|
||||
generateTransform(flip_horizontal: boolean, flip_vertical: boolean, rotation: number) {
|
||||
let transforms = ''
|
||||
if (flip_horizontal) transforms += ' scaleX(-1)'
|
||||
if (flip_vertical) transforms += ' scaleY(-1)'
|
||||
if (rotation === 180) transforms += ' rotate(180deg)'
|
||||
|
||||
// return transform when exist
|
||||
if (transforms.trimStart().length) return transforms.trimStart()
|
||||
|
||||
// return none as fallback
|
||||
return 'none'
|
||||
}
|
||||
}
|
||||
@@ -63,6 +63,7 @@
|
||||
:key="tool.name"
|
||||
:class="tool.active ? 'primary--text' : {}"
|
||||
:disabled="isPrinting"
|
||||
:style="{ 'background-color': '#' + tool.color }"
|
||||
dense
|
||||
class="flex-grow-1 px-0"
|
||||
@click="doSend(tool.name)">
|
||||
@@ -85,7 +86,7 @@
|
||||
attribute-name="S"></tool-slider>
|
||||
</v-container>
|
||||
<!-- PRESSURE ADVANCE SETTINGS -->
|
||||
<template v-if="!extruderSteppers.length > 0">
|
||||
<template v-if="!(extruderSteppers.length > 0)">
|
||||
<v-divider></v-divider>
|
||||
<pressure-advance-settings></pressure-advance-settings>
|
||||
</template>
|
||||
@@ -361,11 +362,11 @@ export default class ExtruderControlPanel extends Mixins(BaseMixin, ControlMixin
|
||||
}
|
||||
|
||||
get loadFilamentMacro() {
|
||||
return this.macros.find((macro: PrinterStateMacro) => macro.name === 'LOAD_FILAMENT')
|
||||
return this.macros.find((macro: PrinterStateMacro) => macro.name.toUpperCase() === 'LOAD_FILAMENT')
|
||||
}
|
||||
|
||||
get unloadFilamentMacro() {
|
||||
return this.macros.find((macro: PrinterStateMacro) => macro.name === 'UNLOAD_FILAMENT')
|
||||
return this.macros.find((macro: PrinterStateMacro) => macro.name.toUpperCase() === 'UNLOAD_FILAMENT')
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
<panel
|
||||
:icon="mdiPrinter3d"
|
||||
:title="printer_name"
|
||||
:card-class="
|
||||
'farmprinter-panel ' +
|
||||
(!printer.socket.isConnected && !printer.socket.isConnecting ? 'disabledPrinter' : '')
|
||||
"
|
||||
card-class="farmprinter-panel"
|
||||
:class="panelClass"
|
||||
:loading="printer.socket.isConnecting"
|
||||
:toolbar-color="isCurrentPrinter ? 'primary' : ''">
|
||||
<template #buttons>
|
||||
@@ -17,7 +15,7 @@
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-list dense class="py-0">
|
||||
<v-list-item link @click="currentCamId = 'off'">
|
||||
<v-list-item link @click="currentCamName = 'off'">
|
||||
<v-list-item-icon class="mr-2">
|
||||
<v-icon small class="mt-1">{{ mdiWebcamOff }}</v-icon>
|
||||
</v-list-item-icon>
|
||||
@@ -26,15 +24,15 @@
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
v-for="webcam of supportedPrinterWebcams"
|
||||
:key="webcam.index"
|
||||
v-for="webcam of printer_webcams"
|
||||
:key="webcam.name"
|
||||
link
|
||||
@click="currentCamId = webcam.id">
|
||||
@click="currentCamName = webcam.name">
|
||||
<v-list-item-icon class="mr-2">
|
||||
<v-icon small class="mt-1">{{ convertWebcamIcon(webcam.icon) }}</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title v-text="webcam.name"></v-list-item-title>
|
||||
<v-list-item-title v-text="webcam.name" />
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
@@ -47,26 +45,12 @@
|
||||
<div
|
||||
v-if="
|
||||
printer.socket.isConnected &&
|
||||
currentCamId !== 'off' &&
|
||||
currentCamName !== 'off' &&
|
||||
currentWebcam &&
|
||||
'service' in currentWebcam
|
||||
"
|
||||
class="webcamContainer">
|
||||
<webcam-mjpegstreamer
|
||||
v-if="currentWebcam.service === 'mjpegstreamer'"
|
||||
:cam-settings="currentWebcam"
|
||||
:printer-url="printerUrl"
|
||||
:show-fps="false"></webcam-mjpegstreamer>
|
||||
<webcam-mjpegstreamer-adaptive
|
||||
v-else-if="currentWebcam.service === 'mjpegstreamer-adaptive'"
|
||||
:cam-settings="currentWebcam"
|
||||
:printer-url="printerUrl"
|
||||
:show-fps="false"></webcam-mjpegstreamer-adaptive>
|
||||
<webcam-uv4l-mjpeg
|
||||
v-else-if="currentWebcam.service === 'uv4l-mjpeg'"
|
||||
:cam-settings="currentWebcam"
|
||||
:printer-url="printerUrl"
|
||||
:show-fps="false"></webcam-uv4l-mjpeg>
|
||||
<webcam-wrapper :webcam="currentWebcam" :printer-url="printerUrl" :show-fps="false" />
|
||||
</div>
|
||||
<v-card-title
|
||||
class="white--text py-2"
|
||||
@@ -130,22 +114,18 @@
|
||||
import { Component, Mixins, Prop, Ref, Vue } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { FarmPrinterState } from '@/store/farm/printer/types'
|
||||
import Mjpegstreamer from '@/components/webcams/Mjpegstreamer.vue'
|
||||
import MjpegstreamerAdaptive from '@/components/webcams/MjpegstreamerAdaptive.vue'
|
||||
import Uv4lMjpeg from '@/components/webcams/Uv4lMjpeg.vue'
|
||||
import MainsailLogo from '@/components/ui/MainsailLogo.vue'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import { mdiPrinter3d, mdiWebcam, mdiMenuDown, mdiWebcamOff, mdiFileOutline } from '@mdi/js'
|
||||
import { Debounce } from 'vue-debounce-decorator'
|
||||
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
|
||||
import WebcamMixin from '@/components/mixins/webcam'
|
||||
import WebcamWrapper from '@/components/webcams/WebcamWrapper.vue'
|
||||
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
Panel,
|
||||
'webcam-mjpegstreamer': Mjpegstreamer,
|
||||
'webcam-mjpegstreamer-adaptive': MjpegstreamerAdaptive,
|
||||
'webcam-uv4l-mjpeg': Uv4lMjpeg,
|
||||
'webcam-wrapper': WebcamWrapper,
|
||||
'mainsail-logo': MainsailLogo,
|
||||
},
|
||||
})
|
||||
@@ -175,12 +155,12 @@ export default class FarmPrinterPanel extends Mixins(BaseMixin, WebcamMixin) {
|
||||
return this.$store.getters['farm/' + this.printer._namespace + '/isCurrentPrinter']
|
||||
}
|
||||
|
||||
get currentCamId() {
|
||||
return this.$store.getters['farm/' + this.printer._namespace + '/getSetting']('currentCamId', 'off')
|
||||
get currentCamName() {
|
||||
return this.$store.getters['farm/' + this.printer._namespace + '/getSetting']('currentCamName', 'off')
|
||||
}
|
||||
|
||||
set currentCamId(newVal) {
|
||||
this.$store.dispatch('farm/' + this.printer._namespace + '/setSettings', { currentCamId: newVal })
|
||||
set currentCamName(newVal) {
|
||||
this.$store.dispatch('farm/' + this.printer._namespace + '/setSettings', { currentCamName: newVal })
|
||||
}
|
||||
|
||||
get printer_name() {
|
||||
@@ -218,24 +198,30 @@ export default class FarmPrinterPanel extends Mixins(BaseMixin, WebcamMixin) {
|
||||
}
|
||||
|
||||
get showWebcamSwitch() {
|
||||
return this.printer.socket.isConnected && this.supportedPrinterWebcams.length > 0
|
||||
if (this.printer_webcams.length == 0) return false
|
||||
|
||||
return this.printer.socket.isConnected
|
||||
}
|
||||
|
||||
get printer_webcams() {
|
||||
get printer_webcams(): GuiWebcamStateWebcam[] {
|
||||
return this.$store.getters['farm/' + this.printer._namespace + '/getPrinterWebcams']
|
||||
}
|
||||
|
||||
get supportedPrinterWebcams() {
|
||||
return this.printer_webcams.filter((webcam: GuiWebcamStateWebcam) =>
|
||||
['mjpegstreamer', 'mjpegstreamer-adaptive', 'uv4l-mjpeg'].includes(webcam.service)
|
||||
get currentWebcam(): GuiWebcamStateWebcam | null {
|
||||
const currentCam = this.printer_webcams?.find(
|
||||
(webcam: GuiWebcamStateWebcam) => webcam.name === this.currentCamName
|
||||
)
|
||||
}
|
||||
|
||||
get currentWebcam() {
|
||||
const currentCam = this.printer_webcams.find((webcam: any) => webcam.id === this.currentCamId)
|
||||
if (currentCam) return currentCam
|
||||
|
||||
return false
|
||||
return null
|
||||
}
|
||||
|
||||
get panelClass(): string[] {
|
||||
let output = []
|
||||
|
||||
if (!this.printer.socket.isConnected && !this.printer.socket.isConnecting) output.push('disabledPrinter')
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
clickPrinter() {
|
||||
@@ -293,10 +279,8 @@ export default class FarmPrinterPanel extends Mixins(BaseMixin, WebcamMixin) {
|
||||
.v-overlay {
|
||||
top: 48px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
.farmprinter-panel {
|
||||
::v-deep .farmprinter-panel {
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
@@ -1,9 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<panel
|
||||
:title="$t('Files.GCodeFiles').toString()"
|
||||
:icon="mdiFileDocumentMultipleOutline"
|
||||
card-class="gcode-files-panel">
|
||||
<panel :title="$t('Files.GCodeFiles')" :icon="mdiFileDocumentMultipleOutline" card-class="gcode-files-panel">
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col class="col-12 d-flex align-center">
|
||||
@@ -18,6 +15,15 @@
|
||||
dense
|
||||
style="max-width: 300px"></v-text-field>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn
|
||||
v-if="selectedFiles.length"
|
||||
:title="$t('Files.Download')"
|
||||
color="primary"
|
||||
class="px-2 minwidth-0 ml-3"
|
||||
:loading="loadings.includes('gcodeDownloadZip')"
|
||||
@click="downloadSelectedFiles">
|
||||
<v-icon>{{ mdiCloudDownload }}</v-icon>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
v-if="selectedFiles.length"
|
||||
:title="$t('Files.Delete')"
|
||||
@@ -315,6 +321,13 @@
|
||||
<v-icon class="mr-1">{{ mdiPlaylistPlus }}</v-icon>
|
||||
{{ $t('Files.AddToQueue') }}
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
v-if="!contextMenu.item.isDirectory && moonrakerComponents.includes('job_queue')"
|
||||
:disabled="!isGcodeFile(contextMenu.item)"
|
||||
@click="openAddBatchToQueueDialog(contextMenu.item)">
|
||||
<v-icon class="mr-1">{{ mdiPlaylistPlus }}</v-icon>
|
||||
{{ $t('Files.AddBatchToQueue') }}
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
v-if="contextMenu.item.preheat_gcode !== null"
|
||||
:disabled="['error', 'printing', 'paused'].includes(printer_state)"
|
||||
@@ -329,6 +342,13 @@
|
||||
<v-icon class="mr-1">{{ mdiVideo3d }}</v-icon>
|
||||
{{ $t('Files.View3D') }}
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
v-if="!contextMenu.item.isDirectory"
|
||||
:disabled="!isGcodeFile(contextMenu.item)"
|
||||
@click="scanMeta(contextMenu.item)">
|
||||
<v-icon class="mr-1">{{ mdiMagnify }}</v-icon>
|
||||
{{ $t('Files.ScanMeta') }}
|
||||
</v-list-item>
|
||||
<v-list-item v-if="!contextMenu.item.isDirectory" @click="downloadFile">
|
||||
<v-icon class="mr-1">{{ mdiCloudDownload }}</v-icon>
|
||||
{{ $t('Files.Download') }}
|
||||
@@ -345,7 +365,11 @@
|
||||
<v-icon class="mr-1">{{ mdiRenameBox }}</v-icon>
|
||||
{{ $t('Files.Rename') }}
|
||||
</v-list-item>
|
||||
<v-list-item v-if="!contextMenu.item.isDirectory" class="red--text" @click="removeFile">
|
||||
<v-list-item v-if="!contextMenu.item.isDirectory" @click="duplicateFile(contextMenu.item)">
|
||||
<v-icon class="mr-1">{{ mdiContentCopy }}</v-icon>
|
||||
{{ $t('Files.Duplicate') }}
|
||||
</v-list-item>
|
||||
<v-list-item v-if="!contextMenu.item.isDirectory" class="red--text" @click="deleteDialog = true">
|
||||
<v-icon class="mr-1" color="error">{{ mdiDelete }}</v-icon>
|
||||
{{ $t('Files.Delete') }}
|
||||
</v-list-item>
|
||||
@@ -360,7 +384,7 @@
|
||||
</v-menu>
|
||||
<v-dialog v-model="dialogCreateDirectory.show" :max-width="400">
|
||||
<panel
|
||||
:title="$t('Files.NewDirectory').toString()"
|
||||
:title="$t('Files.NewDirectory')"
|
||||
card-class="gcode-files-new-directory-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -375,7 +399,7 @@
|
||||
:label="$t('Files.Name')"
|
||||
required
|
||||
:rules="nameInputRules"
|
||||
@update:error="isInvalidName = !isInvalidName"
|
||||
@update:error="(bool) => (isInvalidName = bool)"
|
||||
@keypress.enter="createDirectoryAction"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
@@ -388,10 +412,7 @@
|
||||
</panel>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogRenameFile.show" :max-width="400">
|
||||
<panel
|
||||
:title="$t('Files.RenameFile').toString()"
|
||||
card-class="gcode-files-rename-file-dialog"
|
||||
:margin-bottom="false">
|
||||
<panel :title="$t('Files.RenameFile')" card-class="gcode-files-rename-file-dialog" :margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="dialogRenameFile.show = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
@@ -401,10 +422,10 @@
|
||||
<v-text-field
|
||||
ref="inputFieldRenameFile"
|
||||
v-model="dialogRenameFile.newName"
|
||||
:label="$t('Files.Name').toString()"
|
||||
:label="$t('Files.Name')"
|
||||
required
|
||||
:rules="nameInputRules"
|
||||
@update:error="isInvalidName = !isInvalidName"
|
||||
@update:error="(bool) => (isInvalidName = bool)"
|
||||
@keyup.enter="renameFileAction"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
@@ -416,9 +437,38 @@
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogDuplicateFile.show" :max-width="400">
|
||||
<panel
|
||||
:title="$t('Files.DuplicateFile')"
|
||||
card-class="gcode-files-duplicate-file-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="dialogDuplicateFile.show = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<v-text-field
|
||||
ref="inputFieldDuplicateFile"
|
||||
v-model="dialogDuplicateFile.newName"
|
||||
:label="$t('Files.Name')"
|
||||
required
|
||||
:rules="nameInputRules"
|
||||
@update:error="(bool) => (isInvalidName = bool)"
|
||||
@keyup.enter="duplicateFileAction"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="" text @click="dialogDuplicateFile.show = false">{{ $t('Files.Cancel') }}</v-btn>
|
||||
<v-btn :disabled="isInvalidName" color="primary" text @click="duplicateFileAction">
|
||||
{{ $t('Files.Duplicate') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogRenameDirectory.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Files.RenameDirectory').toString()"
|
||||
:title="$t('Files.RenameDirectory')"
|
||||
card-class="gcode-files-rename-directory-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -433,7 +483,7 @@
|
||||
:label="$t('Files.Name')"
|
||||
required
|
||||
:rules="nameInputRules"
|
||||
@update:error="isInvalidName = !isInvalidName"
|
||||
@update:error="(bool) => (isInvalidName = bool)"
|
||||
@keyup.enter="renameDirectoryAction"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
@@ -447,7 +497,7 @@
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogDeleteDirectory.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Files.DeleteDirectory').toString()"
|
||||
:title="$t('Files.DeleteDirectory')"
|
||||
card-class="gcode-files-delete-directory-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -467,18 +517,45 @@
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
|
||||
<!-- CONFIRM DELETE SINGLE FILE DIALOG -->
|
||||
<v-dialog v-model="deleteDialog" max-width="400">
|
||||
<panel :title="$t('Files.Delete')" card-class="gcode-files-delete-dialog" :margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="deleteDialog = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<p class="mb-0">
|
||||
{{ $t('Files.DeleteSingleFileQuestion', { name: contextMenu.item.filename }) }}
|
||||
</p>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="" text @click="deleteDialog = false">
|
||||
{{ $t('Files.Cancel') }}
|
||||
</v-btn>
|
||||
<v-btn color="error" text @click="removeFile">
|
||||
{{ $t('Files.Delete') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
|
||||
<!-- CONFIRM DELETE MULTIPLE FILES DIALOG -->
|
||||
<v-dialog v-model="deleteSelectedDialog" max-width="400">
|
||||
<panel
|
||||
:title="$t('Files.Delete').toString()"
|
||||
card-class="gcode-files-delete-selected-dialog"
|
||||
:margin-bottom="false">
|
||||
<panel :title="$t('Files.Delete')" card-class="gcode-files-delete-selected-dialog" :margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="deleteSelectedDialog = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<p class="mb-0">{{ $t('Files.DeleteSelectedQuestion', { count: selectedFiles.length }) }}</p>
|
||||
<p v-if="selectedFiles.length === 1" class="mb-0">
|
||||
{{ $t('Files.DeleteSingleFileQuestion', { name: selectedFiles[0].filename }) }}
|
||||
</p>
|
||||
<p v-else class="mb-0">{{ $t('Files.DeleteSelectedQuestion', { count: selectedFiles.length }) }}</p>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
@@ -487,6 +564,53 @@
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogAddBatchToQueue.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Files.AddToQueue')"
|
||||
card-class="gcode-files-add-to-queue-dialog"
|
||||
:icon="mdiPlaylistPlus"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="dialogAddBatchToQueue.show = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
<v-card-text>
|
||||
<v-text-field
|
||||
ref="inputFieldAddToQueueCount"
|
||||
v-model="dialogAddBatchToQueue.count"
|
||||
:label="$t('Files.Count')"
|
||||
required
|
||||
hide-spin-buttons
|
||||
type="number"
|
||||
:rules="countInputRules"
|
||||
@keyup.enter="addBatchToQueueAction">
|
||||
<template #append-outer>
|
||||
<div class="_spin_button_group">
|
||||
<v-btn class="mt-n3" icon plain small @click="dialogAddBatchToQueue.count++">
|
||||
<v-icon>{{ mdiChevronUp }}</v-icon>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
:disabled="dialogAddBatchToQueue.count <= 1"
|
||||
class="mb-n3"
|
||||
icon
|
||||
plain
|
||||
small
|
||||
@click="dialogAddBatchToQueue.count--">
|
||||
<v-icon>{{ mdiChevronDown }}</v-icon>
|
||||
</v-btn>
|
||||
</div>
|
||||
</template>
|
||||
</v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="" text @click="dialogAddBatchToQueue.show = false">{{ $t('Files.Cancel') }}</v-btn>
|
||||
<v-btn color="primary" text @click="addBatchToQueueAction">{{ $t('Files.AddToQueue') }}</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -500,6 +624,8 @@ import Panel from '@/components/ui/Panel.vue'
|
||||
import SettingsRow from '@/components/settings/SettingsRow.vue'
|
||||
import draggable from 'vuedraggable'
|
||||
import {
|
||||
mdiChevronDown,
|
||||
mdiChevronUp,
|
||||
mdiDragVertical,
|
||||
mdiCheckboxBlankOutline,
|
||||
mdiCheckboxMarked,
|
||||
@@ -521,6 +647,7 @@ import {
|
||||
mdiUpload,
|
||||
mdiVideo3d,
|
||||
mdiFileDocumentEditOutline,
|
||||
mdiContentCopy,
|
||||
} from '@mdi/js'
|
||||
import StartPrintDialog from '@/components/dialogs/StartPrintDialog.vue'
|
||||
import ControlMixin from '@/components/mixins/control'
|
||||
@@ -543,6 +670,12 @@ interface dialogPrintFile {
|
||||
item: FileStateGcodefile
|
||||
}
|
||||
|
||||
interface dialogAddBatchToQueue {
|
||||
show: boolean
|
||||
count: number
|
||||
item: FileStateGcodefile
|
||||
}
|
||||
|
||||
interface dialogRenameObject {
|
||||
show: boolean
|
||||
newName: string
|
||||
@@ -563,6 +696,9 @@ interface tableColumnSetting {
|
||||
components: { StartPrintDialog, Panel, SettingsRow, draggable },
|
||||
})
|
||||
export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
|
||||
mdiChevronDown = mdiChevronDown
|
||||
mdiChevronUp = mdiChevronUp
|
||||
mdiContentCopy = mdiContentCopy
|
||||
mdiFile = mdiFile
|
||||
mdiFileDocumentMultipleOutline = mdiFileDocumentMultipleOutline
|
||||
mdiMagnify = mdiMagnify
|
||||
@@ -592,6 +728,7 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
|
||||
declare $refs: {
|
||||
fileUpload: HTMLInputElement
|
||||
inputFieldRenameFile: HTMLInputElement
|
||||
inputFieldDuplicateFile: HTMLInputElement
|
||||
inputFieldCreateDirectory: HTMLInputElement
|
||||
inputFieldRenameDirectory: HTMLInputElement
|
||||
}
|
||||
@@ -637,12 +774,24 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
|
||||
item: { ...this.contextMenu.item },
|
||||
}
|
||||
|
||||
private dialogAddBatchToQueue: dialogAddBatchToQueue = {
|
||||
show: false,
|
||||
count: 1,
|
||||
item: { ...this.contextMenu.item },
|
||||
}
|
||||
|
||||
private dialogRenameFile: dialogRenameObject = {
|
||||
show: false,
|
||||
newName: '',
|
||||
item: { ...this.contextMenu.item },
|
||||
}
|
||||
|
||||
private dialogDuplicateFile: dialogRenameObject = {
|
||||
show: false,
|
||||
newName: '',
|
||||
item: { ...this.contextMenu.item },
|
||||
}
|
||||
|
||||
private dialogRenameDirectory: dialogRenameObject = {
|
||||
show: false,
|
||||
newName: '',
|
||||
@@ -655,6 +804,7 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
|
||||
item: { ...this.contextMenu.item },
|
||||
}
|
||||
|
||||
private deleteDialog = false
|
||||
private deleteSelectedDialog = false
|
||||
|
||||
private isInvalidName = true
|
||||
@@ -662,9 +812,13 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
|
||||
(value: string) => !!value || this.$t('Files.InvalidNameEmpty'),
|
||||
(value: string) => !this.existsFilename(value) || this.$t('Files.InvalidNameAlreadyExists'),
|
||||
]
|
||||
private countInputRules = [
|
||||
(value: string) => !!value || this.$t('JobQueue.InvalidCountEmpty'),
|
||||
(value: string) => parseInt(value) > 0 || this.$t('JobQueue.InvalidCountGreaterZero'),
|
||||
]
|
||||
|
||||
existsFilename(name: string) {
|
||||
return this.files.findIndex((file) => file.filename === name) >= 0
|
||||
return this.files.findIndex((file: FileStateFile) => file.filename === name) >= 0
|
||||
}
|
||||
|
||||
get gcodeInputFileAccept() {
|
||||
@@ -1088,11 +1242,31 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
|
||||
this.currentPath = this.currentPath.slice(0, this.currentPath.lastIndexOf('/'))
|
||||
}
|
||||
|
||||
addToQueue(item: FileStateGcodefile | FileStateFile) {
|
||||
async addToQueue(item: FileStateGcodefile) {
|
||||
let filename = [this.currentPath, item.filename].join('/')
|
||||
if (filename.startsWith('/')) filename = filename.slice(1)
|
||||
|
||||
this.$store.dispatch('server/jobQueue/addToQueue', [filename])
|
||||
await this.$store.dispatch('server/jobQueue/addToQueue', [filename])
|
||||
}
|
||||
|
||||
openAddBatchToQueueDialog(item: FileStateGcodefile) {
|
||||
this.dialogAddBatchToQueue.show = true
|
||||
this.dialogAddBatchToQueue.count = 1
|
||||
this.dialogAddBatchToQueue.item = item
|
||||
}
|
||||
|
||||
async addBatchToQueueAction() {
|
||||
let filename = [this.currentPath, this.dialogAddBatchToQueue.item.filename].join('/')
|
||||
if (filename.startsWith('/')) filename = filename.slice(1)
|
||||
|
||||
const array: string[] = []
|
||||
for (let i = 0; i < this.dialogAddBatchToQueue.count; i++) {
|
||||
array.push(filename)
|
||||
}
|
||||
|
||||
await this.$store.dispatch('server/jobQueue/addToQueue', array)
|
||||
|
||||
this.dialogAddBatchToQueue.show = false
|
||||
}
|
||||
|
||||
changeMetadataVisible(name: string, value: boolean) {
|
||||
@@ -1129,6 +1303,36 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
|
||||
window.open(href)
|
||||
}
|
||||
|
||||
async downloadSelectedFiles() {
|
||||
let items: string[] = []
|
||||
|
||||
const addElementToItems = async (absolutPath: string, directory: FileStateFile[]) => {
|
||||
for (const file of directory) {
|
||||
const filePath = `${absolutPath}/${file.filename}`
|
||||
|
||||
if (file.isDirectory && file.childrens) {
|
||||
await addElementToItems(filePath, file.childrens)
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
items.push(filePath)
|
||||
}
|
||||
}
|
||||
|
||||
await addElementToItems('gcodes/' + this.currentPath, this.selectedFiles)
|
||||
const date = new Date()
|
||||
const timestamp = `${date.getFullYear()}${date.getMonth()}${date.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
|
||||
@@ -1151,6 +1355,24 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
|
||||
)
|
||||
}
|
||||
|
||||
duplicateFile(item: FileStateGcodefile) {
|
||||
this.dialogDuplicateFile.item = item
|
||||
this.dialogDuplicateFile.newName = item.filename
|
||||
this.dialogDuplicateFile.show = true
|
||||
|
||||
setTimeout(() => {
|
||||
this.$refs.inputFieldDuplicateFile?.focus()
|
||||
}, 200)
|
||||
}
|
||||
|
||||
duplicateFileAction() {
|
||||
this.dialogDuplicateFile.show = false
|
||||
this.$socket.emit('server.files.copy', {
|
||||
source: 'gcodes' + this.currentPath + '/' + this.dialogDuplicateFile.item.filename,
|
||||
dest: 'gcodes' + this.currentPath + '/' + this.dialogDuplicateFile.newName,
|
||||
})
|
||||
}
|
||||
|
||||
renameDirectory(item: FileStateGcodefile) {
|
||||
this.dialogRenameDirectory.item = item
|
||||
this.dialogRenameDirectory.newName = item.filename
|
||||
@@ -1179,6 +1401,8 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
|
||||
{ path: 'gcodes' + this.currentPath + '/' + this.contextMenu.item.filename },
|
||||
{ action: 'files/getDeleteFile' }
|
||||
)
|
||||
|
||||
this.deleteDialog = false
|
||||
}
|
||||
|
||||
deleteDirectory(item: FileStateGcodefile) {
|
||||
@@ -1243,6 +1467,12 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
|
||||
this.$router.push({ path: '/viewer', query: { filename: 'gcodes' + this.currentPath + '/' + item.filename } })
|
||||
}
|
||||
|
||||
scanMeta(item: FileStateFile) {
|
||||
this.$store.dispatch('files/scanMetadata', {
|
||||
filename: 'gcodes' + this.currentPath + '/' + item.filename,
|
||||
})
|
||||
}
|
||||
|
||||
deleteSelectedFiles() {
|
||||
this.selectedFiles.forEach((item: FileStateGcodefile) => {
|
||||
if (item.isDirectory) {
|
||||
@@ -1297,6 +1527,15 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
._spin_button_group {
|
||||
width: 24px;
|
||||
margin-top: -6px;
|
||||
margin-left: -6px;
|
||||
margin-bottom: -6px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
/*noinspection CssUnusedSymbol*/
|
||||
.files-table .v-data-table-header__icon {
|
||||
|
||||
@@ -1,13 +1,3 @@
|
||||
<style>
|
||||
.history-jobs-table th {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.history-jobs-table th.text-start {
|
||||
padding-right: 0 !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<panel
|
||||
@@ -234,7 +224,7 @@
|
||||
<v-icon class="mr-1">{{ mdiPrinter }}</v-icon>
|
||||
{{ $t('History.Reprint') }}
|
||||
</v-list-item>
|
||||
<v-list-item class="red--text" @click="deleteJob(contextMenu.item)">
|
||||
<v-list-item class="red--text" @click="deleteDialog = true">
|
||||
<v-icon class="mr-1" color="error">{{ mdiDelete }}</v-icon>
|
||||
{{ $t('History.Delete') }}
|
||||
</v-list-item>
|
||||
@@ -273,7 +263,7 @@
|
||||
<v-row>
|
||||
<v-col>{{ $t('History.LastModified') }}</v-col>
|
||||
<v-col class="text-right">
|
||||
{{ formatDateTime(detailsDialog.item.metadata.modified) }}
|
||||
{{ formatDateTime(detailsDialog.item.metadata.modified * 1000) }}
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
@@ -291,13 +281,15 @@
|
||||
<v-divider class="my-3"></v-divider>
|
||||
<v-row>
|
||||
<v-col>{{ $t('History.StartTime') }}</v-col>
|
||||
<v-col class="text-right">{{ formatDateTime(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">{{ formatDateTime(detailsDialog.item.end_time) }}</v-col>
|
||||
<v-col class="text-right">
|
||||
{{ formatDateTime(detailsDialog.item.end_time * 1000) }}
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
<template
|
||||
@@ -428,6 +420,33 @@
|
||||
</v-card-text>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
|
||||
<!-- CONFIRM DELETE SINGLE FILE DIALOG -->
|
||||
<v-dialog v-model="deleteDialog" max-width="400">
|
||||
<panel :title="$t('History.Delete')" card-class="history-delete-dialog" :margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="deleteDialog = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<p class="mb-0">
|
||||
{{ $t('History.DeleteSingleJobQuestion') }}
|
||||
</p>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="" text @click="deleteDialog = false">
|
||||
{{ $t('History.Cancel') }}
|
||||
</v-btn>
|
||||
<v-btn color="error" text @click="deleteJob">
|
||||
{{ $t('History.Delete') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
|
||||
<!-- CONFIRM DELETE MULTIPLE FILES DIALOG -->
|
||||
<v-dialog v-model="deleteSelectedDialog" max-width="400">
|
||||
<panel :title="$t('History.Delete')" card-class="history-delete-selected-dialog" :margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -436,7 +455,12 @@
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<p class="mb-0">{{ $t('History.DeleteSelectedQuestion', { count: selectedJobs.length }) }}</p>
|
||||
<p v-if="selectedJobs.length === 1" class="mb-0">
|
||||
{{ $t('History.DeleteSingleJobQuestion') }}
|
||||
</p>
|
||||
<p v-else class="mb-0">
|
||||
{{ $t('History.DeleteSelectedQuestion', { count: selectedJobs.length }) }}
|
||||
</p>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
@@ -550,6 +574,7 @@ export default class HistoryListPanel extends Mixins(BaseMixin) {
|
||||
type: 'create',
|
||||
}
|
||||
|
||||
private deleteDialog = false
|
||||
private deleteSelectedDialog = false
|
||||
|
||||
get jobs() {
|
||||
@@ -913,12 +938,14 @@ export default class HistoryListPanel extends Mixins(BaseMixin) {
|
||||
this.$socket.emit('printer.print.start', { filename: item.filename }, { action: 'switchToDashboard' })
|
||||
}
|
||||
|
||||
deleteJob(item: ServerHistoryStateJob) {
|
||||
deleteJob() {
|
||||
this.$socket.emit(
|
||||
'server.history.delete_job',
|
||||
{ uid: item.job_id },
|
||||
{ uid: this.contextMenu.item.job_id },
|
||||
{ action: 'server/history/getDeletedJobs' }
|
||||
)
|
||||
|
||||
this.deleteDialog = false
|
||||
}
|
||||
|
||||
deleteSelectedJobs() {
|
||||
@@ -935,7 +962,7 @@ export default class HistoryListPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
exportHistory() {
|
||||
const checkString = parseFloat('1.23').toLocaleString()
|
||||
const checkString = parseFloat('1.23').toLocaleString(this.browserLocale)
|
||||
const decimalSeparator = checkString.indexOf(',') >= 0 ? ',' : '.'
|
||||
const csvSeperator = decimalSeparator === ',' ? ';' : ','
|
||||
|
||||
@@ -984,7 +1011,14 @@ export default class HistoryListPanel extends Mixins(BaseMixin) {
|
||||
})
|
||||
}
|
||||
|
||||
const csvContent = 'data:text/csv;charset=utf-8,' + content.map((e) => e.join(csvSeperator)).join('\n')
|
||||
// escape fields with the csvSeperator in the content
|
||||
// prettier-ignore
|
||||
const csvContent =
|
||||
'data:text/csv;charset=utf-8,' +
|
||||
content.map((entry) =>
|
||||
entry.map((field) => (field.indexOf(csvSeperator) === -1 ? field : `"${field}"`)).join(csvSeperator)
|
||||
).join('\n')
|
||||
|
||||
const link = document.createElement('a')
|
||||
link.setAttribute('href', encodeURI(csvContent))
|
||||
link.setAttribute('download', 'print_history.csv')
|
||||
@@ -1017,7 +1051,7 @@ export default class HistoryListPanel extends Mixins(BaseMixin) {
|
||||
default:
|
||||
switch (typeof value) {
|
||||
case 'number':
|
||||
return value?.toLocaleString(undefined, { useGrouping: false }) ?? 0
|
||||
return value?.toLocaleString(this.browserLocale, { useGrouping: false }) ?? 0
|
||||
|
||||
case 'string':
|
||||
if (escapeChar !== null && value.includes(escapeChar)) value = '"' + value + '"'
|
||||
@@ -1077,3 +1111,13 @@ export default class HistoryListPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
::v-deep .history-jobs-table th {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
::v-deep .history-jobs-table th.text-start {
|
||||
padding-right: 0 !important;
|
||||
}
|
||||
</style>
|
||||
@@ -57,11 +57,23 @@
|
||||
</v-simple-table>
|
||||
</v-col>
|
||||
<v-col class="col-12 col-sm-6 col-md-4">
|
||||
<history-all-print-status></history-all-print-status>
|
||||
<history-all-print-status-chart
|
||||
v-if="togglePrintStatus === 'chart'"></history-all-print-status-chart>
|
||||
<history-all-print-status-table v-else></history-all-print-status-table>
|
||||
<div class="text-center mb-3">
|
||||
<v-btn-toggle v-model="togglePrintStatus" small mandatory>
|
||||
<v-btn small value="chart">
|
||||
{{ $t('History.Chart') }}
|
||||
</v-btn>
|
||||
<v-btn small value="table">
|
||||
{{ $t('History.Table') }}
|
||||
</v-btn>
|
||||
</v-btn-toggle>
|
||||
</div>
|
||||
</v-col>
|
||||
<v-col class="col-12 col-sm-12 col-md-4">
|
||||
<history-filament-usage v-if="toggleChart === 'filament_usage'"></history-filament-usage>
|
||||
<history-printtime-avg v-if="toggleChart === 'printtime_avg'"></history-printtime-avg>
|
||||
<history-printtime-avg v-else-if="toggleChart === 'printtime_avg'"></history-printtime-avg>
|
||||
<div class="text-center mt-3">
|
||||
<v-btn-toggle v-model="toggleChart" small mandatory>
|
||||
<v-btn small value="filament_usage">
|
||||
@@ -84,11 +96,11 @@ import BaseMixin from '@/components/mixins/base'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import HistoryFilamentUsage from '@/components/charts/HistoryFilamentUsage.vue'
|
||||
import HistoryPrinttimeAvg from '@/components/charts/HistoryPrinttimeAvg.vue'
|
||||
import HistoryAllPrintStatus from '@/components/charts/HistoryAllPrintStatus.vue'
|
||||
import HistoryAllPrintStatusChart from '@/components/charts/HistoryAllPrintStatusChart.vue'
|
||||
import { ServerHistoryStateJob } from '@/store/server/history/types'
|
||||
import { mdiChartAreaspline } from '@mdi/js'
|
||||
@Component({
|
||||
components: { Panel, HistoryFilamentUsage, HistoryPrinttimeAvg, HistoryAllPrintStatus },
|
||||
components: { Panel, HistoryFilamentUsage, HistoryPrinttimeAvg, HistoryAllPrintStatusChart },
|
||||
})
|
||||
export default class HistoryStatisticsPanel extends Mixins(BaseMixin) {
|
||||
mdiChartAreaspline = mdiChartAreaspline
|
||||
@@ -177,6 +189,14 @@ export default class HistoryStatisticsPanel extends Mixins(BaseMixin) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'view.history.toggleChartCol3', value: newVal })
|
||||
}
|
||||
|
||||
get togglePrintStatus() {
|
||||
return this.$store.state.gui.view.history.toggleChartCol2
|
||||
}
|
||||
|
||||
set togglePrintStatus(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'view.history.toggleChartCol2', value: newVal })
|
||||
}
|
||||
|
||||
formatPrintTime(totalSeconds: number) {
|
||||
if (totalSeconds) {
|
||||
let output = ''
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<template>
|
||||
<div>
|
||||
<panel ref="jobqueuePanel" :icon="mdiTrayFull" :title="$t('JobQueue.JobQueue')" card-class="jobqueue-panel">
|
||||
<panel
|
||||
ref="jobqueuePanel"
|
||||
:icon="mdiTrayFull"
|
||||
:title="$t('JobQueue.JobQueue').toString()"
|
||||
card-class="jobqueue-panel">
|
||||
<template #buttons>
|
||||
<v-btn
|
||||
v-if="queueState === 'paused'"
|
||||
@@ -48,98 +52,29 @@
|
||||
</template>
|
||||
|
||||
<template #item="{ item }">
|
||||
<tr
|
||||
:key="item.job_id"
|
||||
v-longpress:600="(e) => showContextMenu(e, item)"
|
||||
class="file-list-cursor user-select-none"
|
||||
@contextmenu="showContextMenu($event, item)">
|
||||
<td class="pr-0 text-center" style="width: 32px">
|
||||
<template v-if="getSmallThumbnail(item) && getBigThumbnail(item)">
|
||||
<v-tooltip
|
||||
v-if="!item.isDirectory && getSmallThumbnail(item) && getBigThumbnail(item)"
|
||||
top
|
||||
content-class="tooltip__content-opacity1">
|
||||
<template #activator="{ on, attrs }">
|
||||
<vue-load-image>
|
||||
<img
|
||||
slot="image"
|
||||
:src="getSmallThumbnail(item)"
|
||||
width="32"
|
||||
height="32"
|
||||
v-bind="attrs"
|
||||
v-on="on" />
|
||||
<v-progress-circular
|
||||
slot="preloader"
|
||||
indeterminate
|
||||
color="primary"></v-progress-circular>
|
||||
<v-icon slot="error">{{ mdiFile }}</v-icon>
|
||||
</vue-load-image>
|
||||
</template>
|
||||
<span><img :src="getBigThumbnail(item)" width="250" /></span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
<template v-else-if="getSmallThumbnail(item)">
|
||||
<vue-load-image>
|
||||
<img slot="image" :src="getSmallThumbnail(item)" width="32" height="32" />
|
||||
<v-progress-circular
|
||||
slot="preloader"
|
||||
indeterminate
|
||||
color="primary"></v-progress-circular>
|
||||
<v-icon slot="error">{{ mdiFile }}</v-icon>
|
||||
</vue-load-image>
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-icon>{{ mdiFile }}</v-icon>
|
||||
</template>
|
||||
</td>
|
||||
<td class=" ">
|
||||
<div class="d-block text-truncate" :style="styleContentTdWidth">{{ item.filename }}</div>
|
||||
<small v-if="existMetadata(item)">{{ getDescription(item) }}</small>
|
||||
</td>
|
||||
</tr>
|
||||
<jobqueue-entry :key="item.job_id" :item="item" :content-td-width="contentTdWidth" />
|
||||
</template>
|
||||
</v-data-table>
|
||||
<resize-observer @notify="handleResize" />
|
||||
</panel>
|
||||
<v-menu v-model="contextMenu.shown" :position-x="contextMenu.x" :position-y="contextMenu.y" absolute offset-y>
|
||||
<v-list>
|
||||
<v-list-item @click="deleteJob(contextMenu.item)">
|
||||
<v-icon class="mr-1">{{ mdiPlaylistRemove }}</v-icon>
|
||||
{{ $t('JobQueue.RemoveFromQueue') }}
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { ServerHistoryStateJob } from '@/store/server/history/types'
|
||||
import { formatFilesize, formatPrintTime } from '@/plugins/helpers'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import { ServerJobQueueStateJob } from '@/store/server/jobQueue/types'
|
||||
import { mdiPlay, mdiPause, mdiFile, mdiPlaylistRemove, mdiTrayFull } from '@mdi/js'
|
||||
import { mdiPlay, mdiPause, mdiTrayFull } from '@mdi/js'
|
||||
import JobqueueEntry from '@/components/panels/Status/JobqueueEntry.vue'
|
||||
@Component({
|
||||
components: { Panel },
|
||||
components: { JobqueueEntry, Panel },
|
||||
})
|
||||
export default class JobqueuePanel extends Mixins(BaseMixin) {
|
||||
mdiPlay = mdiPlay
|
||||
mdiPause = mdiPause
|
||||
mdiFile = mdiFile
|
||||
mdiPlaylistRemove = mdiPlaylistRemove
|
||||
mdiTrayFull = mdiTrayFull
|
||||
|
||||
formatFilesize = formatFilesize
|
||||
|
||||
private contentTdWidth = 100
|
||||
private contextMenu = {
|
||||
shown: false,
|
||||
touchTimer: undefined,
|
||||
x: 0,
|
||||
y: 0,
|
||||
item: {},
|
||||
}
|
||||
|
||||
declare $refs: {
|
||||
jobqueuePanel: any
|
||||
@@ -161,27 +96,6 @@ export default class JobqueuePanel extends Mixins(BaseMixin) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'view.jobqueue.countPerPage', value: newVal })
|
||||
}
|
||||
|
||||
get styleContentTdWidth() {
|
||||
return `width: ${this.contentTdWidth}px;`
|
||||
}
|
||||
|
||||
showContextMenu(e: any, item: ServerHistoryStateJob) {
|
||||
if (!this.contextMenu.shown) {
|
||||
e?.preventDefault()
|
||||
this.contextMenu.shown = true
|
||||
this.contextMenu.x = e?.clientX || e?.pageX || window.screenX / 2
|
||||
this.contextMenu.y = e?.clientY || e?.pageY || window.screenY / 2
|
||||
this.contextMenu.item = item
|
||||
this.$nextTick(() => {
|
||||
this.contextMenu.shown = true
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
deleteJob(item: ServerJobQueueStateJob) {
|
||||
this.$store.dispatch('server/jobQueue/deleteFromQueue', [item.job_id])
|
||||
}
|
||||
|
||||
startJobqueue() {
|
||||
this.$store.dispatch('server/jobQueue/start')
|
||||
}
|
||||
@@ -190,35 +104,6 @@ export default class JobqueuePanel extends Mixins(BaseMixin) {
|
||||
this.$store.dispatch('server/jobQueue/pause')
|
||||
}
|
||||
|
||||
getSmallThumbnail(item: ServerJobQueueStateJob) {
|
||||
return this.$store.getters['server/jobQueue/getSmallThumbnail'](item)
|
||||
}
|
||||
|
||||
getBigThumbnail(item: ServerJobQueueStateJob) {
|
||||
return this.$store.getters['server/jobQueue/getBigThumbnail'](item)
|
||||
}
|
||||
|
||||
getDescription(item: ServerJobQueueStateJob) {
|
||||
let output = ''
|
||||
|
||||
output += this.$t('Files.Filament') + ': '
|
||||
if (item.metadata?.filament_total || item.metadata.filament_weight_total) {
|
||||
if (item.metadata?.filament_total) output += item.metadata.filament_total.toFixed() + ' mm'
|
||||
if (item.metadata?.filament_total && item.metadata.filament_weight_total) output += ' / '
|
||||
if (item.metadata?.filament_weight_total) output += item.metadata.filament_weight_total.toFixed(2) + ' g'
|
||||
} else output += '--'
|
||||
|
||||
output += ', ' + this.$t('Files.PrintTime') + ': '
|
||||
if (item.metadata?.estimated_time) output += formatPrintTime(item.metadata.estimated_time)
|
||||
else output += '--'
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
existMetadata(item: ServerJobQueueStateJob) {
|
||||
return item?.metadata?.metadataPulled
|
||||
}
|
||||
|
||||
mounted() {
|
||||
this.calcContentTdWidth()
|
||||
}
|
||||
@@ -235,7 +120,7 @@ export default class JobqueuePanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
<style scoped>
|
||||
.jobqueue-panel {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div v-if="klipperState !== 'ready' && socketIsConnected">
|
||||
<v-container v-if="klippyIsConnected" class="pa-0 pb-6">
|
||||
<v-alert :color="messageType.color" dense text border="left" class="mb-0">
|
||||
<template v-if="klippyIsConnected">
|
||||
<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>
|
||||
@@ -68,10 +68,28 @@
|
||||
<v-progress-circular indeterminate :color="messageType.color"></v-progress-circular>
|
||||
</v-card-text>
|
||||
</v-alert>
|
||||
</v-container>
|
||||
</template>
|
||||
<!-- 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 -->
|
||||
<v-container v-if="klipperState === 'disconnected'" class="pa-0">
|
||||
<v-alert dense text border="left">
|
||||
<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' }) }}:
|
||||
@@ -79,9 +97,9 @@
|
||||
</p>
|
||||
<connection-status :moonraker="true" :klipper="false"></connection-status>
|
||||
<p class="mt-2 mb-0 text-center">{{ $t('Panels.KlippyStatePanel.MoonrakerCannotConnect') }}</p>
|
||||
<p class="mb-0 text-center">{{ $t('Panels.KlippyStatePanel.KlipperCheck') }}</p>
|
||||
<p class="mb-0 text-center">{{ $t('Panels.KlippyStatePanel.CheckKlippyAndUdsAddress') }}</p>
|
||||
</v-alert>
|
||||
</v-container>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -99,6 +117,7 @@ import {
|
||||
mdiRocketLaunch,
|
||||
mdiConnection,
|
||||
mdiPrinter3d,
|
||||
mdiPower,
|
||||
} from '@mdi/js'
|
||||
|
||||
@Component({
|
||||
@@ -108,6 +127,7 @@ export default class KlippyStatePanel extends Mixins(BaseMixin) {
|
||||
mdiPrinter3d = mdiPrinter3d
|
||||
mdiRestart = mdiRestart
|
||||
mdiDownload = mdiDownload
|
||||
mdiPower = mdiPower
|
||||
|
||||
get klippy_message() {
|
||||
return this.$store.state.server.klippy_message ?? null
|
||||
@@ -144,5 +164,16 @@ export default class KlippyStatePanel extends Mixins(BaseMixin) {
|
||||
|
||||
window.open(href)
|
||||
}
|
||||
|
||||
powerOn() {
|
||||
this.$socket.emit(
|
||||
'machine.device_power.post_device',
|
||||
{
|
||||
device: this.printerPowerDevice,
|
||||
action: 'on',
|
||||
},
|
||||
{ action: 'server/power/responseToggle' }
|
||||
)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,9 +1,7 @@
|
||||
<style scoped></style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<panel
|
||||
:title="$t('Machine.ConfigFilesPanel.ConfigFiles').toString()"
|
||||
:title="$t('Machine.ConfigFilesPanel.ConfigFiles')"
|
||||
card-class="machine-configfiles-panel"
|
||||
:icon="mdiInformation"
|
||||
:collapsible="true">
|
||||
@@ -203,6 +201,10 @@
|
||||
<v-icon class="mr-1">{{ mdiRenameBox }}</v-icon>
|
||||
{{ $t('Machine.ConfigFilesPanel.Rename') }}
|
||||
</v-list-item>
|
||||
<v-list-item v-if="!contextMenu.item.isDirectory" @click="duplicateFile(contextMenu.item)">
|
||||
<v-icon class="mr-1">{{ mdiContentCopy }}</v-icon>
|
||||
{{ $t('Machine.ConfigFilesPanel.Duplicate') }}
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
v-if="contextMenu.item.isDirectory && contextMenu.item.permissions.includes('w')"
|
||||
@click="renameDirectory(contextMenu.item)">
|
||||
@@ -212,7 +214,7 @@
|
||||
<v-list-item
|
||||
v-if="!contextMenu.item.isDirectory && contextMenu.item.permissions.includes('w')"
|
||||
class="red--text"
|
||||
@click="removeFile">
|
||||
@click="deleteDialog = true">
|
||||
<v-icon class="mr-1" color="error">{{ mdiDelete }}</v-icon>
|
||||
{{ $t('Machine.ConfigFilesPanel.Delete') }}
|
||||
</v-list-item>
|
||||
@@ -236,7 +238,7 @@
|
||||
dialogImage.item.svg = null
|
||||
">
|
||||
<panel
|
||||
:title="dialogImage.item.name"
|
||||
:title="dialogImage.item.name ?? ''"
|
||||
card-class="maschine-configfiles-imageviewer-dialog"
|
||||
style="position: relative">
|
||||
<template #buttons>
|
||||
@@ -263,7 +265,7 @@
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogCreateFile.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Machine.ConfigFilesPanel.CreateFile').toString()"
|
||||
:title="$t('Machine.ConfigFilesPanel.CreateFile')"
|
||||
card-class="maschine-configfiles-create-file-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -278,7 +280,7 @@
|
||||
:label="$t('Machine.ConfigFilesPanel.Name')"
|
||||
required
|
||||
:rules="nameInputRules"
|
||||
@update:error="isInvalidName = !isInvalidName"
|
||||
@update:error="(bool) => (isInvalidName = bool)"
|
||||
@keyup.enter="createFileAction"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
@@ -294,7 +296,7 @@
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogRenameFile.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Machine.ConfigFilesPanel.RenameFile').toString()"
|
||||
:title="$t('Machine.ConfigFilesPanel.RenameFile')"
|
||||
card-class="maschine-configfiles-rename-file-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -309,7 +311,7 @@
|
||||
:label="$t('Machine.ConfigFilesPanel.Name')"
|
||||
required
|
||||
:rules="nameInputRules"
|
||||
@update:error="isInvalidName = !isInvalidName"
|
||||
@update:error="(bool) => (isInvalidName = bool)"
|
||||
@keyup.enter="renameFileAction"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
@@ -323,9 +325,40 @@
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogDuplicateFile.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Machine.ConfigFilesPanel.DuplicateFile')"
|
||||
card-class="maschine-configfiles-duplicate-file-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="dialogDuplicateFile.show = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<v-text-field
|
||||
ref="inputDialoDuplicateFileName"
|
||||
v-model="dialogDuplicateFile.newName"
|
||||
:label="$t('Machine.ConfigFilesPanel.Name')"
|
||||
required
|
||||
:rules="nameInputRules"
|
||||
@update:error="(bool) => (isInvalidName = bool)"
|
||||
@keyup.enter="duplicateFileAction" />
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer />
|
||||
<v-btn color="" text @click="dialogDuplicateFile.show = false">
|
||||
{{ $t('Machine.ConfigFilesPanel.Cancel') }}
|
||||
</v-btn>
|
||||
<v-btn :disabled="isInvalidName" color="primary" text @click="duplicateFileAction">
|
||||
{{ $t('Machine.ConfigFilesPanel.Duplicate') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogCreateDirectory.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Machine.ConfigFilesPanel.CreateDirectory').toString()"
|
||||
:title="$t('Machine.ConfigFilesPanel.CreateDirectory')"
|
||||
card-class="maschine-configfiles-create-directory-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -340,7 +373,7 @@
|
||||
:label="$t('Machine.ConfigFilesPanel.Name')"
|
||||
required
|
||||
:rules="nameInputRules"
|
||||
@update:error="isInvalidName = !isInvalidName"
|
||||
@update:error="(bool) => (isInvalidName = bool)"
|
||||
@keyup.enter="createDirectoryAction"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
@@ -356,7 +389,7 @@
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogRenameDirectory.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Machine.ConfigFilesPanel.RenameDirectory').toString()"
|
||||
:title="$t('Machine.ConfigFilesPanel.RenameDirectory')"
|
||||
card-class="maschine-configfiles-rename-directory-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -371,7 +404,7 @@
|
||||
:label="$t('Machine.ConfigFilesPanel.Name')"
|
||||
required
|
||||
:rules="nameInputRules"
|
||||
@update:error="isInvalidName = !isInvalidName"
|
||||
@update:error="(bool) => (isInvalidName = bool)"
|
||||
@keyup.enter="renameDirectoryAction"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
@@ -387,7 +420,7 @@
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogDeleteDirectory.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Machine.ConfigFilesPanel.DeleteDirectory').toString()"
|
||||
:title="$t('Machine.ConfigFilesPanel.DeleteDirectory')"
|
||||
card-class="maschine-configfiles-delete-directory-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -415,10 +448,42 @@
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
|
||||
<!-- CONFIRM DELETE SINGLE FILE DIALOG -->
|
||||
<v-dialog v-model="deleteDialog" max-width="400">
|
||||
<panel
|
||||
:title="$t('Machine.ConfigFilesPanel.Delete')"
|
||||
card-class="maschine-configfiles-delete-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="deleteDialog = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<p class="mb-0">
|
||||
{{
|
||||
$t('Machine.ConfigFilesPanel.DeleteSingleFileQuestion', { name: contextMenu.item.filename })
|
||||
}}
|
||||
</p>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="" text @click="deleteDialog = false">
|
||||
{{ $t('Machine.ConfigFilesPanel.Cancel') }}
|
||||
</v-btn>
|
||||
<v-btn color="error" text @click="removeFile">
|
||||
{{ $t('Machine.ConfigFilesPanel.Delete') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
|
||||
<!-- CONFIRM DELETE MULTIPLE FILES DIALOG -->
|
||||
<v-dialog v-model="deleteSelectedDialog" max-width="400">
|
||||
<panel
|
||||
:title="$t('Machine.ConfigFilesPanel.Delete').toString()"
|
||||
card-class="gcode-files-delete-selected-dialog"
|
||||
:title="$t('Machine.ConfigFilesPanel.Delete')"
|
||||
card-class="maschine-configfiles-delete-selected-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="deleteSelectedDialog = false">
|
||||
@@ -426,7 +491,12 @@
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<p class="mb-0">
|
||||
<p v-if="selectedFiles.length === 1" class="mb-0">
|
||||
{{
|
||||
$t('Machine.ConfigFilesPanel.DeleteSingleFileQuestion', { name: selectedFiles[0].filename })
|
||||
}}
|
||||
</p>
|
||||
<p v-else class="mb-0">
|
||||
{{ $t('Machine.ConfigFilesPanel.DeleteSelectedQuestion', { count: selectedFiles.length }) }}
|
||||
</p>
|
||||
</v-card-text>
|
||||
@@ -441,6 +511,7 @@
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
|
||||
<v-snackbar v-model="uploadSnackbar.status" :timeout="-1" :value="true" fixed right bottom dark>
|
||||
<span v-if="uploadSnackbar.max > 1" class="mr-1">
|
||||
({{ uploadSnackbar.number }}/{{ uploadSnackbar.max }})
|
||||
@@ -484,6 +555,7 @@ import {
|
||||
mdiDelete,
|
||||
mdiCloseThick,
|
||||
mdiLockOutline,
|
||||
mdiContentCopy,
|
||||
} from '@mdi/js'
|
||||
|
||||
interface contextMenu {
|
||||
@@ -550,6 +622,7 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
|
||||
mdiDelete = mdiDelete
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiLockOutline = mdiLockOutline
|
||||
mdiContentCopy = mdiContentCopy
|
||||
|
||||
sortFiles = sortFiles
|
||||
formatFilesize = formatFilesize
|
||||
@@ -558,6 +631,7 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
|
||||
fileUpload: HTMLInputElement
|
||||
inputDialogCreateFileName: HTMLInputElement
|
||||
inputDialogRenameFileName: HTMLInputElement
|
||||
inputDialogDuplicateFileName: HTMLInputElement
|
||||
inputDialogCreateDirectoryName: HTMLInputElement
|
||||
inputDialogRenameDirectoryName: HTMLInputElement
|
||||
}
|
||||
@@ -598,6 +672,16 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
|
||||
modified: new Date(),
|
||||
},
|
||||
}
|
||||
private dialogDuplicateFile: dialogRenameObject = {
|
||||
show: false,
|
||||
newName: '',
|
||||
item: {
|
||||
isDirectory: false,
|
||||
filename: '',
|
||||
permissions: '',
|
||||
modified: new Date(),
|
||||
},
|
||||
}
|
||||
private dialogCreateDirectory = {
|
||||
show: false,
|
||||
name: '',
|
||||
@@ -644,6 +728,7 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
|
||||
},
|
||||
}
|
||||
|
||||
private deleteDialog = false
|
||||
private deleteSelectedDialog = false
|
||||
|
||||
private isInvalidName = true
|
||||
@@ -666,6 +751,17 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
|
||||
|
||||
get toolbarButtons() {
|
||||
return [
|
||||
{
|
||||
text: this.$t('Machine.ConfigFilesPanel.Download'),
|
||||
color: 'primary',
|
||||
icon: mdiCloudDownload,
|
||||
loadingName: 'configDownloadZip',
|
||||
onlyWriteable: false,
|
||||
condition: this.selectedFiles.length > 0,
|
||||
click: () => {
|
||||
this.downloadSelectedFiles()
|
||||
},
|
||||
},
|
||||
{
|
||||
text: this.$t('Machine.ConfigFilesPanel.Delete'),
|
||||
color: 'error',
|
||||
@@ -702,7 +798,7 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
|
||||
loadingName: null,
|
||||
onlyWriteable: true,
|
||||
condition: true,
|
||||
click: this.createDirecotry,
|
||||
click: this.createDirectory,
|
||||
},
|
||||
{
|
||||
text: this.$t('Machine.ConfigFilesPanel.RefreshDirectory'),
|
||||
@@ -853,6 +949,8 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
set currentPath(newVal) {
|
||||
this.selectedFiles = []
|
||||
|
||||
this.$store.dispatch('gui/saveSettingWithoutUpload', { name: 'view.configfiles.currentPath', value: newVal })
|
||||
}
|
||||
|
||||
@@ -931,7 +1029,43 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
|
||||
window.open(href)
|
||||
}
|
||||
|
||||
createDirecotry() {
|
||||
async downloadSelectedFiles() {
|
||||
let items: string[] = []
|
||||
|
||||
const addElementToItems = async (absolutPath: string, directory: FileStateFile[]) => {
|
||||
for (const file of directory) {
|
||||
const filePath = `${absolutPath}/${file.filename}`
|
||||
|
||||
if (file.isDirectory && file.childrens) {
|
||||
await addElementToItems(filePath, file.childrens)
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
items.push(filePath)
|
||||
}
|
||||
}
|
||||
|
||||
await addElementToItems(this.absolutePath, this.selectedFiles)
|
||||
|
||||
const date = new Date()
|
||||
const month = (date.getMonth() + 1).toString().padStart(2, '0')
|
||||
const day = date.getDay().toString().padStart(2, '0')
|
||||
const hours = date.getHours().toString().padStart(2, '0')
|
||||
const minutes = date.getMinutes().toString().padStart(2, '0')
|
||||
const seconds = date.getSeconds().toString().padStart(2, '0')
|
||||
const timestamp = `${date.getFullYear()}${month}${day}-${hours}${minutes}${seconds}`
|
||||
|
||||
this.$socket.emit(
|
||||
'server.files.zip',
|
||||
{ items, dest: `config/${this.root}-${timestamp}.zip` },
|
||||
{ action: 'files/downloadZip', loading: 'configDownloadZip' }
|
||||
)
|
||||
|
||||
this.selectedFiles = []
|
||||
}
|
||||
|
||||
createDirectory() {
|
||||
this.dialogCreateDirectory.name = ''
|
||||
this.dialogCreateDirectory.show = true
|
||||
|
||||
@@ -1043,12 +1177,32 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
|
||||
)
|
||||
}
|
||||
|
||||
duplicateFile(item: FileStateFile) {
|
||||
this.dialogDuplicateFile.item = item
|
||||
this.dialogDuplicateFile.newName = item.filename
|
||||
this.dialogDuplicateFile.show = true
|
||||
|
||||
setTimeout(() => {
|
||||
this.$refs.inputDialogDuplicateFileName?.focus()
|
||||
}, 200)
|
||||
}
|
||||
|
||||
duplicateFileAction() {
|
||||
this.dialogDuplicateFile.show = false
|
||||
this.$socket.emit('server.files.copy', {
|
||||
source: (this.absolutePath + '/' + this.dialogDuplicateFile.item.filename).slice(1),
|
||||
dest: (this.absolutePath + '/' + this.dialogDuplicateFile.newName).slice(1),
|
||||
})
|
||||
}
|
||||
|
||||
removeFile() {
|
||||
this.$socket.emit(
|
||||
'server.files.delete_file',
|
||||
{ path: this.absolutePath + '/' + this.contextMenu.item.filename },
|
||||
{ action: 'files/getDeleteFile' }
|
||||
)
|
||||
|
||||
this.deleteDialog = false
|
||||
}
|
||||
|
||||
deleteSelectedFiles() {
|
||||
|
||||
@@ -1,11 +1,30 @@
|
||||
<template>
|
||||
<panel
|
||||
:title="$t('Machine.LogfilesPanel.Logfiles').toString()"
|
||||
:icon="mdiFileDocumentEdit"
|
||||
card-class="machine-logfiles-panel"
|
||||
:collapsible="true">
|
||||
<v-card-text :class="'text-center text-lg-left py-0'">
|
||||
<v-container pb-0 px-0>
|
||||
<div>
|
||||
<panel
|
||||
:title="$t('Machine.LogfilesPanel.Logfiles').toString()"
|
||||
:icon="mdiFileDocumentEdit"
|
||||
card-class="machine-logfiles-panel"
|
||||
:collapsible="true">
|
||||
<template #buttons>
|
||||
<v-tooltip top>
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-btn
|
||||
icon
|
||||
tile
|
||||
color="primary"
|
||||
:ripple="true"
|
||||
:loading="loadings.includes('loadingBtnRolloverLogs')"
|
||||
:disabled="['printing', 'paused'].includes(printer_state)"
|
||||
v-bind="attrs"
|
||||
v-on="on"
|
||||
@click="showRolloverDialog = true">
|
||||
<v-icon>{{ mdiFileSyncOutline }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<span>{{ $t('Machine.LogfilesPanel.Rollover') }}</span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
<v-card-text :class="'text-center text-lg-left'">
|
||||
<v-row>
|
||||
<v-col :class="'col-12' + (klipperState !== 'ready' ? 'col-md-6' : 'col-md-12') + ''">
|
||||
<v-btn
|
||||
@@ -53,23 +72,74 @@
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
<v-dialog :value="showRolloverDialog" persistent width="400" :fullscreen="isMobile">
|
||||
<panel
|
||||
:title="$t('Machine.LogfilesPanel.Rollover').toString()"
|
||||
card-class="machine_rollover_logfiles-dialog"
|
||||
:icon="mdiFileSyncOutline"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="showRolloverDialog = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col>
|
||||
<p class="mb-0">{{ $t('Machine.LogfilesPanel.RolloverDescription') }}</p>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="mt-0">
|
||||
<v-col>
|
||||
<v-checkbox
|
||||
v-for="log in rolloverLogfiles"
|
||||
:key="log"
|
||||
v-model="selectedRolloverLogs"
|
||||
:label="capitalize(log)"
|
||||
:value="log"
|
||||
hide-details
|
||||
class="mt-0" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer />
|
||||
<v-btn text @click="showRolloverDialog = false">
|
||||
{{ $t('Machine.LogfilesPanel.Cancel') }}
|
||||
</v-btn>
|
||||
<v-btn color="primary" text @click="btnRolloverLogs">
|
||||
{{ $t('Machine.LogfilesPanel.Accept') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins } from 'vue-property-decorator'
|
||||
import { Component, Mixins, Watch } from 'vue-property-decorator'
|
||||
import BaseMixin from '../../mixins/base'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import { FileStateFile } from '@/store/files/types'
|
||||
import { mdiDownload, mdiFileDocumentEdit } from '@mdi/js'
|
||||
import { mdiDownload, mdiFileDocumentEdit, mdiCloseThick, mdiFileSyncOutline } from '@mdi/js'
|
||||
import { rolloverLogfiles } from '@/store/variables'
|
||||
import { capitalize } from '@/plugins/helpers'
|
||||
@Component({
|
||||
components: { Panel },
|
||||
})
|
||||
export default class LogfilesPanel extends Mixins(BaseMixin) {
|
||||
mdiFileDocumentEdit = mdiFileDocumentEdit
|
||||
mdiDownload = mdiDownload
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiFileSyncOutline = mdiFileSyncOutline
|
||||
|
||||
rolloverLogfiles = rolloverLogfiles
|
||||
capitalize = capitalize
|
||||
|
||||
private showRolloverDialog = false
|
||||
private selectedRolloverLogs: string[] = []
|
||||
|
||||
get logfiles() {
|
||||
return this.$store.getters['files/getDirectory']('logs')?.childrens ?? []
|
||||
@@ -85,6 +155,10 @@ export default class LogfilesPanel extends Mixins(BaseMixin) {
|
||||
return sonarLog?.size > 0
|
||||
}
|
||||
|
||||
get loadingRolloverLogs() {
|
||||
return this.loadings.filter((log) => log.startsWith('rolloverLog_')).length > 0
|
||||
}
|
||||
|
||||
downloadLog(event: any) {
|
||||
event.preventDefault()
|
||||
let href = ''
|
||||
@@ -93,5 +167,24 @@ export default class LogfilesPanel extends Mixins(BaseMixin) {
|
||||
|
||||
window.open(href)
|
||||
}
|
||||
|
||||
btnRolloverLogs() {
|
||||
if (this.selectedRolloverLogs.length === 0) return
|
||||
|
||||
this.selectedRolloverLogs.forEach((name) => {
|
||||
this.$socket.emit(
|
||||
'server.logs.rollover',
|
||||
{ application: name },
|
||||
{ loading: 'rolloverLog_' + name, action: 'files/rolloverLog' }
|
||||
)
|
||||
})
|
||||
|
||||
this.selectedRolloverLogs = []
|
||||
}
|
||||
|
||||
@Watch('loadingRolloverLogs')
|
||||
loadingRolloverLogsChanged(newVal: boolean) {
|
||||
if (newVal) this.showRolloverDialog = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,63 +1,3 @@
|
||||
<style lang="scss" scoped>
|
||||
.cursor--pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
ul.commits {
|
||||
list-style: none;
|
||||
|
||||
li {
|
||||
border-color: rgb(48, 54, 61);
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-bottom-width: 0;
|
||||
|
||||
&:first-child {
|
||||
border-top-left-radius: 6px;
|
||||
border-top-right-radius: 6px;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-left-radius: 6px;
|
||||
border-bottom-right-radius: 6px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
.v-timeline.groupedCommits {
|
||||
.v-timeline-item__dot--small {
|
||||
width: 18px;
|
||||
height: 15px;
|
||||
margin-top: 2px;
|
||||
|
||||
&:before {
|
||||
display: block;
|
||||
content: ' ';
|
||||
position: relative;
|
||||
width: 18px;
|
||||
height: 2px;
|
||||
top: 7px;
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
z-index: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.v-timeline-item__inner-dot {
|
||||
background-color: #1e1e1e !important;
|
||||
border: 2px solid rgba(255, 255, 255, 0.5) !important;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
margin-left: 5px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<panel
|
||||
@@ -85,578 +25,119 @@ ul.commits {
|
||||
<span>{{ $t('Machine.UpdatePanel.CheckForUpdates') }}</span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
<v-card-text class="px-0 py-0">
|
||||
<v-container py-0 px-0>
|
||||
<div v-for="(value, key, index) of updateableSoftwares" :key="key">
|
||||
<v-divider v-if="index" class="my-0"></v-divider>
|
||||
<v-row class="py-2">
|
||||
<v-col class="pl-6">
|
||||
<strong>{{ 'name' in value ? value.name : key }}</strong>
|
||||
<br />
|
||||
<span
|
||||
:class="getVersionClickable(value) ? 'primary--text cursor--pointer' : ''"
|
||||
@click="openCommitsOverlay(key, value)">
|
||||
<v-icon v-if="getVersionClickable(value)" small color="primary" class="mr-1">
|
||||
{{ mdiInformation }}
|
||||
</v-icon>
|
||||
{{ getVersionOutput(value) }}
|
||||
</span>
|
||||
</v-col>
|
||||
<v-col class="col-auto pr-6 text-right" align-self="center">
|
||||
<template v-if="getRecoveryOptions(value)">
|
||||
<v-menu :offset-y="true" title="Webcam">
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-chip
|
||||
small
|
||||
label
|
||||
outlined
|
||||
:color="getBtnColor(value)"
|
||||
:disabled="getBtnDisabled(value)"
|
||||
class="minwidth-0 px-2 text-uppercase"
|
||||
v-bind="attrs"
|
||||
v-on="on">
|
||||
<v-icon small class="mr-1">{{ getBtnIcon(value) }}</v-icon>
|
||||
{{ getBtnText(value) }}
|
||||
<v-icon small>{{ mdiMenuDown }}</v-icon>
|
||||
</v-chip>
|
||||
</template>
|
||||
<v-list dense class="py-0">
|
||||
<v-list-item @click="recovery(key, false)">
|
||||
<v-list-item-icon class="mr-0">
|
||||
<v-icon small>{{ mdiReload }}</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title>Soft Recovery</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
<v-list-item @click="recovery(key, true)">
|
||||
<v-list-item-icon class="mr-0">
|
||||
<v-icon small>{{ mdiReload }}</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title>Hard Recovery</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-chip
|
||||
small
|
||||
label
|
||||
outlined
|
||||
:color="getBtnColor(value)"
|
||||
:disabled="getBtnDisabled(value)"
|
||||
class="minwidth-0 px-2 text-uppercase"
|
||||
@click="updateModule(key)">
|
||||
<v-icon small class="mr-1">{{ getBtnIcon(value) }}</v-icon>
|
||||
{{ getBtnText(value) }}
|
||||
</v-chip>
|
||||
</template>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
<template v-if="'system' in version_info">
|
||||
<v-divider class="my-0 border-top-2"></v-divider>
|
||||
<v-row class="pt-2">
|
||||
<v-col class="col-auto pl-6 text-no-wrap">
|
||||
<strong>{{ $t('Machine.UpdatePanel.System') }}</strong>
|
||||
<br />
|
||||
<v-tooltip v-if="version_info.system.package_count > 0" top :max-width="300">
|
||||
<template #activator="{ on, attrs }">
|
||||
<span v-bind="attrs" v-on="on">
|
||||
{{ version_info.system.package_count }}
|
||||
{{ $t('Machine.UpdatePanel.PackagesCanBeUpgraded') }}
|
||||
</span>
|
||||
</template>
|
||||
<span>{{ version_info.system.package_list.join(', ') }}</span>
|
||||
</v-tooltip>
|
||||
<span v-if="version_info.system.package_count === 0">
|
||||
{{ $t('Machine.UpdatePanel.OSPackages') }}
|
||||
</span>
|
||||
</v-col>
|
||||
<v-col class="pr-6 text-right" align-self="center">
|
||||
<v-chip
|
||||
small
|
||||
label
|
||||
outlined
|
||||
:color="version_info.system.package_count ? 'primary' : 'green'"
|
||||
:disabled="!version_info.system.package_count || printer_state === 'printing'"
|
||||
class="minwidth-0 px-2 text-uppercase"
|
||||
@click="updateSystem">
|
||||
<v-icon small class="mr-1">
|
||||
{{ version_info.system.package_count ? mdiProgressUpload : mdiCheck }}
|
||||
</v-icon>
|
||||
{{
|
||||
version_info.system.package_count
|
||||
? $t('Machine.UpdatePanel.Upgrade')
|
||||
: $t('Machine.UpdatePanel.UpToDate')
|
||||
}}
|
||||
</v-chip>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-card-text class="px-0 py-0 update-manager-list">
|
||||
<template v-if="checkInitState">
|
||||
<template v-for="(module, index) in modules">
|
||||
<v-divider v-if="index" :key="'divider_' + module.name" class="my-0" />
|
||||
<update-panel-entry :key="module.name" :repo="module.data" />
|
||||
</template>
|
||||
<template v-if="existsSystemModul">
|
||||
<v-divider v-if="modules.length" class="my-0" />
|
||||
<update-panel-entry-system />
|
||||
</template>
|
||||
<template v-if="showUpdateAll">
|
||||
<v-divider class="mb-0 mt-2 border-top-2"></v-divider>
|
||||
<v-row class="pt-3">
|
||||
<v-col class="text-center">
|
||||
<v-btn
|
||||
text
|
||||
color="primary"
|
||||
small
|
||||
:disabled="['printing', 'paused'].includes(printer_state)"
|
||||
@click="updateAll">
|
||||
<v-icon left>{{ mdiProgressUpload }}</v-icon>
|
||||
{{ $t('Machine.UpdatePanel.UpdateAll') }}
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-divider class="mb-0 mt-2 border-top-2" />
|
||||
<update-panel-entry-all />
|
||||
</template>
|
||||
</v-container>
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-row class="mt-0 mb-0">
|
||||
<v-col class="px-6">
|
||||
<v-alert class="mb-0" text dense type="info" border="left">
|
||||
{{ $t('Machine.UpdatePanel.InitUpdateManager') }}
|
||||
</v-alert>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
<v-dialog v-model="commitsOverlay.bool" persistent max-width="800">
|
||||
<panel
|
||||
:title="$t('Machine.UpdatePanel.Commits')"
|
||||
:icon="mdiUpdate"
|
||||
:margin-bottom="false"
|
||||
card-class="machine-update-commits-dialog">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="commitsOverlay.bool = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text class="py-0 px-0">
|
||||
<overlay-scrollbars style="max-height: 400px" :options="{ overflowBehavior: { x: 'hidden' } }">
|
||||
<v-row>
|
||||
<v-col class="pt-3 pl-0">
|
||||
<v-timeline class="groupedCommits" align-top dense>
|
||||
<v-timeline-item
|
||||
v-for="group of commitsOverlay.groupedCommits"
|
||||
:key="group.date.getTime()"
|
||||
small>
|
||||
<v-row class="pt-0">
|
||||
<v-col class="pr-12">
|
||||
<h3 class="caption">
|
||||
{{
|
||||
$t('Machine.UpdatePanel.CommitsOnDate', {
|
||||
date: new Date(group.date).toLocaleDateString(
|
||||
language,
|
||||
dateOptions
|
||||
),
|
||||
})
|
||||
}}
|
||||
</h3>
|
||||
<ul class="commits mt-3 pl-0">
|
||||
<li
|
||||
v-for="commit of group.commits"
|
||||
:key="commit.sha"
|
||||
class="commit px-3 py-2">
|
||||
<v-row>
|
||||
<v-col>
|
||||
<h4 class="subtitle-2 text--white mb-0">
|
||||
{{ commit.subject }}
|
||||
<v-chip
|
||||
v-if="!openCommits.includes(commit.sha)"
|
||||
outlined
|
||||
label
|
||||
x-small
|
||||
class="ml-2 px-2"
|
||||
@click="openCommits.push(commit.sha)">
|
||||
<v-icon small>{{ mdiDotsHorizontal }}</v-icon>
|
||||
</v-chip>
|
||||
</h4>
|
||||
<p
|
||||
v-if="openCommits.includes(commit.sha)"
|
||||
class="caption text--secondary mb-2"
|
||||
style="white-space: pre-line"
|
||||
v-html="commit.message"></p>
|
||||
<p class="caption mb-0">
|
||||
<span
|
||||
class="font-weight-bold text-decoration-none white--text">
|
||||
{{ commit.author }}
|
||||
</span>
|
||||
<span>{{ convertCommitDate(commit.date) }}</span>
|
||||
</p>
|
||||
</v-col>
|
||||
<v-col class="col-auto pt-4">
|
||||
<v-chip
|
||||
outlined
|
||||
label
|
||||
small
|
||||
:href="
|
||||
'https://github.com/' +
|
||||
commitsOverlay.owner +
|
||||
'/' +
|
||||
commitsOverlay.repoName +
|
||||
'/commit/' +
|
||||
commit.sha
|
||||
"
|
||||
target="_blank">
|
||||
{{ commit.sha.substr(0, 6) }}
|
||||
</v-chip>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</li>
|
||||
</ul>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-timeline-item>
|
||||
</v-timeline>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</overlay-scrollbars>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '../../mixins/base'
|
||||
import semver from 'semver'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import { ServerUpdateMangerStateVersionInfoGitRepoCommits } from '@/store/server/updateManager/types'
|
||||
import VueI18n from 'vue-i18n'
|
||||
import DateTimeFormatOptions = VueI18n.DateTimeFormatOptions
|
||||
import {
|
||||
mdiRefresh,
|
||||
mdiAlertCircle,
|
||||
mdiCheck,
|
||||
mdiHelpCircleOutline,
|
||||
mdiInformation,
|
||||
mdiMenuDown,
|
||||
mdiProgressUpload,
|
||||
mdiReload,
|
||||
mdiDotsHorizontal,
|
||||
mdiCloseThick,
|
||||
mdiUpdate,
|
||||
} from '@mdi/js'
|
||||
|
||||
interface groupedCommit {
|
||||
date: Date
|
||||
commits: ServerUpdateMangerStateVersionInfoGitRepoCommits[]
|
||||
}
|
||||
|
||||
interface commitsOverlay {
|
||||
bool: boolean
|
||||
owner: string
|
||||
modul: string
|
||||
repoName: string
|
||||
commits: ServerUpdateMangerStateVersionInfoGitRepoCommits[]
|
||||
groupedCommits: groupedCommit[]
|
||||
}
|
||||
import UpdatePanelEntry from '@/components/panels/Machine/UpdatePanel/Entry.vue'
|
||||
import UpdatePanelEntrySystem from '@/components/panels/Machine/UpdatePanel/EntrySystem.vue'
|
||||
import UpdatePanelEntryAll from '@/components/panels/Machine/UpdatePanel/EntryAll.vue'
|
||||
import { mdiRefresh, mdiInformation, mdiCloseThick, mdiUpdate } from '@mdi/js'
|
||||
import { ServerUpdateManagerStateGuiList } from '@/store/server/updateManager/types'
|
||||
import semver from 'semver'
|
||||
|
||||
@Component({
|
||||
components: { Panel },
|
||||
components: { Panel, UpdatePanelEntry, UpdatePanelEntrySystem, UpdatePanelEntryAll },
|
||||
})
|
||||
export default class UpdatePanel extends Mixins(BaseMixin) {
|
||||
mdiCheck = mdiCheck
|
||||
mdiRefresh = mdiRefresh
|
||||
mdiInformation = mdiInformation
|
||||
mdiMenuDown = mdiMenuDown
|
||||
mdiReload = mdiReload
|
||||
mdiProgressUpload = mdiProgressUpload
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiDotsHorizontal = mdiDotsHorizontal
|
||||
mdiUpdate = mdiUpdate
|
||||
|
||||
private openCommits: string[] = []
|
||||
|
||||
private dateOptions: DateTimeFormatOptions = {
|
||||
year: 'numeric',
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
}
|
||||
|
||||
private commitsOverlay: commitsOverlay = {
|
||||
bool: false,
|
||||
owner: '',
|
||||
modul: '',
|
||||
repoName: '',
|
||||
commits: [],
|
||||
groupedCommits: [],
|
||||
}
|
||||
|
||||
get language() {
|
||||
return this.$store.state.gui.general.language ?? 'en'
|
||||
}
|
||||
|
||||
get enableUpdateManager() {
|
||||
return this.$store.state.server.components.includes('update_manager')
|
||||
}
|
||||
|
||||
get version_info() {
|
||||
return this.$store.state.server.updateManager.version_info
|
||||
get modules() {
|
||||
return this.$store.getters['server/updateManager/getUpdateManagerList'] ?? []
|
||||
}
|
||||
|
||||
get updateableSoftwares() {
|
||||
return this.$store.getters['server/updateManager/getUpdateableSoftwares']
|
||||
get existsSystemModul() {
|
||||
return 'system' in this.$store.state.server.updateManager
|
||||
}
|
||||
|
||||
get systemPackagesCount() {
|
||||
return this.$store.state.server.updateManager?.system?.package_count ?? 0
|
||||
}
|
||||
|
||||
get checkInitState() {
|
||||
const initModules = this.modules.filter(
|
||||
(module: ServerUpdateManagerStateGuiList) => module.data.remote_version !== '?'
|
||||
)
|
||||
|
||||
return initModules.length > 0
|
||||
}
|
||||
|
||||
get showUpdateAll() {
|
||||
let updateableModuls = 0
|
||||
let count = 0
|
||||
|
||||
Object.keys(this.updateableSoftwares).forEach((modulename) => {
|
||||
const module = this.updateableSoftwares[modulename]
|
||||
this.modules.forEach((module: ServerUpdateManagerStateGuiList) => {
|
||||
// check git repos for updates
|
||||
if (module.type === 'git' && module.data?.commits_behind?.length) {
|
||||
count++
|
||||
return
|
||||
}
|
||||
|
||||
// check client web for updates
|
||||
if (
|
||||
'version' in module &&
|
||||
'remote_version' in module &&
|
||||
semver.valid(module.remote_version) &&
|
||||
semver.valid(module.version) &&
|
||||
semver.gt(module.remote_version, module.version)
|
||||
)
|
||||
updateableModuls++
|
||||
module.type === 'web' &&
|
||||
semver.valid(module.data?.remote_version) &&
|
||||
semver.valid(module.data?.version) &&
|
||||
semver.gt(module.data?.remote_version, module.data?.version)
|
||||
) {
|
||||
count++
|
||||
return
|
||||
}
|
||||
})
|
||||
|
||||
if (this.version_info?.system?.package_count > 0) updateableModuls++
|
||||
return updateableModuls > 1
|
||||
// check system packages for upgrades
|
||||
if (this.systemPackagesCount > 0) count++
|
||||
|
||||
return count > 1
|
||||
}
|
||||
|
||||
btnSync() {
|
||||
this.$socket.emit(
|
||||
'machine.update.status',
|
||||
{ refresh: true },
|
||||
{ action: 'server/updateManager/getStatus', loading: 'loadingBtnSyncUpdateManager' }
|
||||
{ action: 'server/updateManager/onUpdateStatus', loading: 'loadingBtnSyncUpdateManager' }
|
||||
)
|
||||
}
|
||||
|
||||
getBtnColor(object: any) {
|
||||
if (typeof object === 'object' && object !== false) {
|
||||
if ('debug_enabled' in object && !object.debug_enabled && 'detached' in object && object.detached)
|
||||
return 'orange'
|
||||
if ('is_dirty' in object && object.is_dirty) return 'orange'
|
||||
if ('is_valid' in object && !object.is_valid) return 'red'
|
||||
|
||||
if (
|
||||
'version' in object &&
|
||||
'remote_version' in object &&
|
||||
semver.valid(object.remote_version) &&
|
||||
semver.valid(object.version) &&
|
||||
semver.gt(object.remote_version, object.version)
|
||||
)
|
||||
return 'primary'
|
||||
|
||||
if ((object.commits_behind ?? []).length) return 'primary'
|
||||
|
||||
if (
|
||||
'version' in object &&
|
||||
'remote_version' in object &&
|
||||
(object.version === '?' || object.remote_version === '?')
|
||||
)
|
||||
return 'gray'
|
||||
|
||||
return 'green'
|
||||
}
|
||||
|
||||
return 'red'
|
||||
}
|
||||
|
||||
getBtnText(object: any) {
|
||||
if (typeof object === 'object' && object !== false) {
|
||||
if ('debug_enabled' in object && !object.debug_enabled && 'detached' in object && object.detached)
|
||||
return this.$t('Machine.UpdatePanel.Detached')
|
||||
if ('is_valid' in object && !object.is_valid) return this.$t('Machine.UpdatePanel.Invalid')
|
||||
if ('is_dirty' in object && object.is_dirty) return this.$t('Machine.UpdatePanel.Dirty')
|
||||
|
||||
if (
|
||||
'version' in object &&
|
||||
'remote_version' in object &&
|
||||
semver.valid(object.remote_version) &&
|
||||
semver.valid(object.version) &&
|
||||
semver.gt(object.remote_version, object.version)
|
||||
)
|
||||
return this.$t('Machine.UpdatePanel.Update')
|
||||
|
||||
if ((object.commits_behind ?? []).length) return this.$t('Machine.UpdatePanel.Update')
|
||||
|
||||
if (
|
||||
'version' in object &&
|
||||
'remote_version' in object &&
|
||||
(object.version === '?' || object.remote_version === '?')
|
||||
)
|
||||
return this.$t('Machine.UpdatePanel.Unknown')
|
||||
|
||||
return this.$t('Machine.UpdatePanel.UpToDate')
|
||||
}
|
||||
|
||||
return this.$t('Machine.UpdatePanel.ERROR')
|
||||
}
|
||||
|
||||
getBtnIcon(object: any) {
|
||||
if (typeof object === 'object' && object !== false) {
|
||||
if ('debug_enabled' in object && !object.debug_enabled && 'detached' in object && object.detached)
|
||||
return mdiAlertCircle
|
||||
if ('is_valid' in object && !object.is_valid) return mdiAlertCircle
|
||||
if ('is_dirty' in object && object.is_dirty) return mdiAlertCircle
|
||||
|
||||
if (
|
||||
'version' in object &&
|
||||
'remote_version' in object &&
|
||||
semver.valid(object.remote_version) &&
|
||||
semver.valid(object.version) &&
|
||||
semver.gt(object.remote_version, object.version)
|
||||
)
|
||||
return mdiProgressUpload
|
||||
|
||||
if ((object.commits_behind ?? []).length) return mdiProgressUpload
|
||||
|
||||
if (
|
||||
'version' in object &&
|
||||
'remote_version' in object &&
|
||||
(object.version === '?' || object.remote_version === '?')
|
||||
)
|
||||
return mdiHelpCircleOutline
|
||||
|
||||
return mdiCheck
|
||||
}
|
||||
|
||||
return 'ERROR'
|
||||
}
|
||||
|
||||
getBtnDisabled(object: any) {
|
||||
if (['printing', 'paused'].includes(this.printer_state)) return true
|
||||
|
||||
if ('is_valid' in object && !object.is_valid) return false
|
||||
if ('is_dirty' in object && object.is_dirty) return false
|
||||
|
||||
if (typeof object === 'object' && object !== false) {
|
||||
if ((object.commits_behind ?? []).length) return false
|
||||
|
||||
if (
|
||||
'version' in object &&
|
||||
'remote_version' in object &&
|
||||
semver.valid(object.remote_version) &&
|
||||
semver.valid(object.version) &&
|
||||
semver.gt(object.remote_version, object.version)
|
||||
)
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
getVersionOutput(object: any) {
|
||||
const local_version = object.version ?? '?'
|
||||
const remote_version = object.remote_version ?? '?'
|
||||
const commits_behind = object.commits_behind ?? []
|
||||
|
||||
let output = ''
|
||||
if ('remote_alias' in object && object.remote_alias !== 'origin') output += object.remote_alias
|
||||
if ('branch' in object && !['master', 'main'].includes(object.branch)) {
|
||||
if (output !== '') output += '/'
|
||||
|
||||
output += object.branch
|
||||
}
|
||||
if (output !== '') output += ': '
|
||||
|
||||
if (semver.valid(remote_version) && semver.valid(local_version) && semver.gt(remote_version, local_version))
|
||||
output += local_version + ' > ' + remote_version
|
||||
else if (commits_behind.length)
|
||||
output +=
|
||||
local_version +
|
||||
' > ' +
|
||||
this.$tc('Machine.UpdatePanel.CommitsAvailable', commits_behind.length, {
|
||||
count: commits_behind.length,
|
||||
})
|
||||
else if ('full_version_string' in object && object.full_version_string !== '?')
|
||||
output += object.full_version_string
|
||||
else output += local_version
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
getVersionClickable(object: any) {
|
||||
return 'commits_behind' in object && object.commits_behind.length
|
||||
}
|
||||
|
||||
getRecoveryOptions(object: any) {
|
||||
if ('is_valid' in object && !object.is_valid) return true
|
||||
else if ('is_dirty' in object && object.is_dirty) return true
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
updateAll() {
|
||||
this.$socket.emit('machine.update.full', {})
|
||||
}
|
||||
|
||||
updateModule(key: string) {
|
||||
if (['klipper', 'moonraker'].includes(key)) this.$socket.emit('machine.update.' + key, {})
|
||||
else this.$socket.emit('machine.update.client', { name: key })
|
||||
}
|
||||
|
||||
recovery(name: string, hard: boolean) {
|
||||
this.$socket.emit('machine.update.recover', { name: name, hard: hard })
|
||||
}
|
||||
|
||||
updateSystem() {
|
||||
this.$socket.emit('machine.update.system', {})
|
||||
}
|
||||
|
||||
openCommitsOverlay(key: string, object: any) {
|
||||
if ('commits_behind' in object && 'owner' in object && object.commits_behind.length) {
|
||||
this.openCommits = []
|
||||
this.commitsOverlay.owner = object.owner
|
||||
this.commitsOverlay.modul = key
|
||||
this.commitsOverlay.repoName = object.repo_name ?? key
|
||||
this.commitsOverlay.commits = object.commits_behind
|
||||
this.commitsOverlay.groupedCommits = []
|
||||
|
||||
let lastDate: null | Date = null
|
||||
let tmpCommits: ServerUpdateMangerStateVersionInfoGitRepoCommits[] = []
|
||||
|
||||
object.commits_behind.forEach((commit: any) => {
|
||||
const commitDate = new Date(commit.date * 1000)
|
||||
if (
|
||||
lastDate === null ||
|
||||
commitDate.getFullYear() !== lastDate.getFullYear() ||
|
||||
commitDate.getMonth() !== lastDate.getMonth() ||
|
||||
commitDate.getDay() !== lastDate.getDay()
|
||||
) {
|
||||
if (tmpCommits.length && lastDate !== null) {
|
||||
this.commitsOverlay.groupedCommits.push({
|
||||
date: lastDate,
|
||||
commits: [...tmpCommits],
|
||||
})
|
||||
}
|
||||
|
||||
lastDate = commitDate
|
||||
tmpCommits = []
|
||||
}
|
||||
|
||||
tmpCommits.push(commit)
|
||||
})
|
||||
|
||||
if (lastDate && tmpCommits.length) {
|
||||
this.commitsOverlay.groupedCommits.push({
|
||||
date: lastDate,
|
||||
commits: [...tmpCommits],
|
||||
})
|
||||
}
|
||||
|
||||
this.commitsOverlay.bool = true
|
||||
}
|
||||
}
|
||||
|
||||
convertCommitDate(timestamp: number) {
|
||||
const commitDay = new Date(timestamp * 1000)
|
||||
commitDay.setHours(0, 0, 0, 0)
|
||||
const todayDay = new Date()
|
||||
todayDay.setHours(0, 0, 0, 0)
|
||||
const diff = Math.floor(todayDay.getTime() - commitDay.getTime()) / (1000 * 60 * 60 * 24)
|
||||
|
||||
if (diff === 0) {
|
||||
const diffHours = Math.floor((new Date().getTime() - timestamp * 1000) / (1000 * 60 * 60))
|
||||
|
||||
return this.$t('Machine.UpdatePanel.CommittedHoursAgo', { hours: diffHours })
|
||||
} else if (diff === 1) return this.$t('Machine.UpdatePanel.CommittedYesterday')
|
||||
else if (diff < 29) return this.$t('Machine.UpdatePanel.CommittedDaysAgo', { days: diff })
|
||||
else
|
||||
return this.$t('Machine.UpdatePanel.CommittedOnDate', {
|
||||
date: commitDay.toLocaleDateString(this.language, this.dateOptions),
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
::v-deep .update-manager-list > div:last-child > div.row {
|
||||
padding-bottom: 0 !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,367 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-row class="py-2">
|
||||
<v-col class="pl-6">
|
||||
<strong>{{ repo.name }}</strong>
|
||||
<br />
|
||||
<template v-if="type === 'git_repo' && commitsBehind.length">
|
||||
<a class="primary--text cursor--pointer" @click="boolShowCommitList = true">
|
||||
<v-icon small color="primary" class="mr-1">{{ mdiInformation }}</v-icon>
|
||||
{{ versionOutput }}
|
||||
</a>
|
||||
</template>
|
||||
<template v-else-if="type === 'web' && webUpdatable">
|
||||
<a class="primary--text text-decoration-none" :href="webLinkRelease" target="_blank">
|
||||
<v-icon small color="primary" class="mr-1">{{ mdiInformation }}</v-icon>
|
||||
{{ versionOutput }}
|
||||
</a>
|
||||
</template>
|
||||
<span v-else>{{ versionOutput }}</span>
|
||||
</v-col>
|
||||
<v-col class="col-auto pr-6 text-right" align-self="center">
|
||||
<v-chip
|
||||
v-if="anomalies.length > 0"
|
||||
small
|
||||
label
|
||||
outlined
|
||||
color="primary"
|
||||
class="minwidth-0 px-1 mr-2"
|
||||
@click="toggleAnomalies = !toggleAnomalies">
|
||||
<v-icon small>{{ mdiInformation }}</v-icon>
|
||||
</v-chip>
|
||||
<template v-if="!isValid">
|
||||
<v-menu :offset-y="true">
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-chip
|
||||
small
|
||||
label
|
||||
outlined
|
||||
:color="btnColor"
|
||||
:disabled="btnDisabled"
|
||||
class="minwidth-0 px-2 text-uppercase"
|
||||
v-bind="attrs"
|
||||
v-on="on">
|
||||
<v-icon small class="mr-1">{{ btnIcon }}</v-icon>
|
||||
{{ btnText }}
|
||||
<v-icon small>{{ mdiMenuDown }}</v-icon>
|
||||
</v-chip>
|
||||
</template>
|
||||
<v-list dense class="py-0">
|
||||
<v-list-item v-if="!isCorrupt" @click="doRecovery(false)">
|
||||
<v-list-item-icon class="mr-0 pt-1">
|
||||
<v-icon small>{{ mdiReload }}</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title>{{ $t('Machine.UpdatePanel.SoftRecovery') }}</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
<v-list-item :disabled="!existsRecoveryUrl" @click="doRecovery(true)">
|
||||
<v-list-item-icon class="mr-0 pt-1">
|
||||
<v-icon small>{{ mdiReload }}</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title>{{ $t('Machine.UpdatePanel.HardRecovery') }}</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</template>
|
||||
<v-chip
|
||||
v-else
|
||||
small
|
||||
label
|
||||
outlined
|
||||
:color="btnColor"
|
||||
:disabled="btnDisabled"
|
||||
class="minwidth-0 px-2 text-uppercase"
|
||||
@click="clickUpdate">
|
||||
<v-icon small class="mr-1">{{ btnIcon }}</v-icon>
|
||||
{{ btnText }}
|
||||
</v-chip>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-if="warnings.length" class="mt-0">
|
||||
<v-col class="px-6 pt-0">
|
||||
<v-alert
|
||||
v-for="(message, index) in warnings"
|
||||
:key="'warnings_' + index"
|
||||
text
|
||||
dense
|
||||
border="left"
|
||||
color="orange"
|
||||
:icon="mdiCloseCircle">
|
||||
{{ message }}
|
||||
</v-alert>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-show="toggleAnomalies" class="mt-0">
|
||||
<v-col class="px-6 pt-0">
|
||||
<v-alert
|
||||
v-for="(message, index) in anomalies"
|
||||
:key="'anomalies_' + index"
|
||||
text
|
||||
dense
|
||||
border="left"
|
||||
color="info"
|
||||
:icon="mdiInformation">
|
||||
{{ message }}
|
||||
</v-alert>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<git-commits-list
|
||||
v-if="type === 'git_repo'"
|
||||
:bool-show-dialog="boolShowCommitList"
|
||||
:repo="repo"
|
||||
@close-dialog="closeCommitList" />
|
||||
<update-hint
|
||||
:bool-show-dialog="boolShowUpdateHint"
|
||||
:repo="repo"
|
||||
@open-commit-history="boolShowCommitList = true"
|
||||
@do-update="doUpdate"
|
||||
@close-dialog="closeShowUpdateHint" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { ServerUpdateManagerStateGitRepo } from '@/store/server/updateManager/types'
|
||||
import {
|
||||
mdiCloseCircle,
|
||||
mdiCheck,
|
||||
mdiHelpCircleOutline,
|
||||
mdiInformation,
|
||||
mdiMenuDown,
|
||||
mdiProgressUpload,
|
||||
mdiReload,
|
||||
} from '@mdi/js'
|
||||
import semver from 'semver'
|
||||
import GitCommitsList from '@/components/panels/Machine/UpdatePanel/GitCommitsList.vue'
|
||||
import UpdateHint from '@/components/panels/Machine/UpdatePanel/UpdateHint.vue'
|
||||
@Component({
|
||||
components: { GitCommitsList, UpdateHint },
|
||||
})
|
||||
export default class UpdatePanelEntry extends Mixins(BaseMixin) {
|
||||
mdiInformation = mdiInformation
|
||||
mdiMenuDown = mdiMenuDown
|
||||
mdiReload = mdiReload
|
||||
mdiCloseCircle = mdiCloseCircle
|
||||
|
||||
boolShowCommitList = false
|
||||
boolShowUpdateHint = false
|
||||
|
||||
toggleAnomalies = false
|
||||
|
||||
@Prop({ required: true }) readonly repo!: ServerUpdateManagerStateGitRepo
|
||||
|
||||
get name() {
|
||||
return this.repo.name ?? 'UNKNOWN'
|
||||
}
|
||||
|
||||
get type() {
|
||||
return this.repo.configured_type
|
||||
}
|
||||
|
||||
get localVersion() {
|
||||
const version = this.repo.version ?? '?'
|
||||
|
||||
if (!semver.valid(version)) return null
|
||||
|
||||
return version
|
||||
}
|
||||
|
||||
get remoteVersion() {
|
||||
const version = this.repo.remote_version ?? '?'
|
||||
|
||||
if (!semver.valid(version)) return null
|
||||
|
||||
return version
|
||||
}
|
||||
|
||||
get branch() {
|
||||
return this.repo.branch ?? 'master'
|
||||
}
|
||||
|
||||
get remoteAlias() {
|
||||
return this.repo.remote_alias ?? 'origin'
|
||||
}
|
||||
|
||||
get branchOutput() {
|
||||
if (this.remoteAlias !== 'origin') return `${this.remoteAlias}/${this.branch}`
|
||||
if (!['master', 'main'].includes(this.branch)) return this.branch
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
get commitsBehind() {
|
||||
return this.repo.commits_behind ?? []
|
||||
}
|
||||
|
||||
get fullVersionString() {
|
||||
return this.repo.full_version_string ?? null
|
||||
}
|
||||
|
||||
get versionOutput() {
|
||||
let output = this.branchOutput ? `${this.branchOutput}: ` : ''
|
||||
|
||||
if (this.localVersion && this.remoteVersion && semver.gt(this.remoteVersion, this.localVersion)) {
|
||||
return `${output}${this.localVersion} > ${this.remoteVersion}`
|
||||
}
|
||||
|
||||
if (this.commitsBehind.length) {
|
||||
const tmp = this.$tc('Machine.UpdatePanel.CommitsAvailable', this.commitsBehind.length, {
|
||||
count: this.commitsBehind.length,
|
||||
}).toString()
|
||||
|
||||
if (this.localVersion) return `${output}${this.localVersion} > ${tmp}`
|
||||
|
||||
return `${output}${tmp}`
|
||||
}
|
||||
|
||||
if (this.fullVersionString) return this.fullVersionString
|
||||
if (this.localVersion) return this.localVersion
|
||||
|
||||
return 'UNKNOWN'
|
||||
}
|
||||
|
||||
get configuredType() {
|
||||
return this.repo.configured_type ?? 'git_repo'
|
||||
}
|
||||
|
||||
get isValid() {
|
||||
return this.repo.is_valid ?? true
|
||||
}
|
||||
|
||||
get isDirty() {
|
||||
return this.repo.is_dirty ?? false
|
||||
}
|
||||
|
||||
get isCorrupt() {
|
||||
return this.repo.corrupt ?? false
|
||||
}
|
||||
|
||||
get debugEnabled() {
|
||||
return this.repo.debug_enabled ?? false
|
||||
}
|
||||
|
||||
get isDetached() {
|
||||
if (this.configuredType !== 'git_repo') return false
|
||||
|
||||
return !this.debugEnabled && (this.repo.detached ?? false)
|
||||
}
|
||||
|
||||
get existsRecoveryUrl() {
|
||||
const url = this.repo.recovery_url ?? '?'
|
||||
|
||||
return url !== '?'
|
||||
}
|
||||
|
||||
get btnDisabled() {
|
||||
if (['printing', 'paused'].includes(this.printer_state)) return true
|
||||
if (!this.isValid || this.isCorrupt || this.isDirty || this.commitsBehind.length) return false
|
||||
|
||||
return !(this.localVersion && this.remoteVersion && semver.gt(this.remoteVersion, this.localVersion))
|
||||
}
|
||||
|
||||
get btnIcon() {
|
||||
if (this.isDetached || !this.isValid || this.isCorrupt || this.isDirty) return mdiCloseCircle
|
||||
|
||||
if (
|
||||
this.commitsBehind.length ||
|
||||
(this.localVersion && this.remoteVersion && semver.gt(this.remoteVersion, this.localVersion))
|
||||
)
|
||||
return mdiProgressUpload
|
||||
|
||||
if (this.localVersion === null || this.remoteVersion === null) return mdiHelpCircleOutline
|
||||
|
||||
return mdiCheck
|
||||
}
|
||||
|
||||
get btnColor() {
|
||||
if (this.isCorrupt || this.isDetached || this.isDirty || !this.isValid) return 'orange'
|
||||
|
||||
if (
|
||||
this.commitsBehind.length ||
|
||||
(this.localVersion && this.remoteVersion && semver.gt(this.remoteVersion, this.localVersion))
|
||||
)
|
||||
return 'primary'
|
||||
|
||||
return 'green'
|
||||
}
|
||||
|
||||
get btnText() {
|
||||
if (this.isCorrupt) return this.$t('Machine.UpdatePanel.Corrupt')
|
||||
if (this.isDetached) return this.$t('Machine.UpdatePanel.Detached')
|
||||
if (this.isDirty) return this.$t('Machine.UpdatePanel.Dirty')
|
||||
if (!this.isValid) return this.$t('Machine.UpdatePanel.Invalid')
|
||||
if (
|
||||
this.commitsBehind.length ||
|
||||
(this.localVersion && this.remoteVersion && semver.gt(this.remoteVersion, this.localVersion))
|
||||
)
|
||||
return this.$t('Machine.UpdatePanel.Update')
|
||||
|
||||
if (this.localVersion === null || this.remoteVersion === null) return this.$t('Machine.UpdatePanel.Unknown')
|
||||
|
||||
return this.$t('Machine.UpdatePanel.UpToDate')
|
||||
}
|
||||
|
||||
get anomalies() {
|
||||
return this.repo.anomalies ?? []
|
||||
}
|
||||
|
||||
get warnings() {
|
||||
return this.repo.warnings ?? []
|
||||
}
|
||||
|
||||
get webUpdatable() {
|
||||
if (!this.localVersion) return false
|
||||
if (!this.remoteVersion) return false
|
||||
|
||||
return semver.gt(this.remoteVersion, this.localVersion)
|
||||
}
|
||||
|
||||
get repo_name() {
|
||||
return this.repo.repo_name ?? this.repo.name ?? ''
|
||||
}
|
||||
|
||||
get webLinkRelease() {
|
||||
return `https://github.com/${this.repo.owner}/${this.repo_name}/releases/tag/${this.repo.remote_version}`
|
||||
}
|
||||
|
||||
get hideUpdateWarning() {
|
||||
return this.$store.state.gui.uiSettings.hideUpdateWarnings ?? false
|
||||
}
|
||||
|
||||
clickUpdate() {
|
||||
if (this.hideUpdateWarning) {
|
||||
this.doUpdate()
|
||||
return
|
||||
}
|
||||
|
||||
this.boolShowUpdateHint = true
|
||||
}
|
||||
|
||||
doUpdate() {
|
||||
if (['klipper', 'moonraker'].includes(this.repo.name)) {
|
||||
this.$socket.emit('machine.update.' + this.repo.name, {})
|
||||
return
|
||||
}
|
||||
|
||||
this.$socket.emit('machine.update.client', { name: this.repo.name })
|
||||
}
|
||||
|
||||
doRecovery(hard: boolean) {
|
||||
this.$socket.emit('machine.update.recover', { name: this.repo.name, hard: hard })
|
||||
}
|
||||
|
||||
closeCommitList() {
|
||||
this.boolShowCommitList = false
|
||||
}
|
||||
|
||||
closeShowUpdateHint() {
|
||||
this.boolShowUpdateHint = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
@@ -0,0 +1,55 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-row class="pt-3">
|
||||
<v-col class="text-center">
|
||||
<v-btn
|
||||
text
|
||||
color="primary"
|
||||
small
|
||||
:disabled="['printing', 'paused'].includes(printer_state)"
|
||||
@click="clickUpdate">
|
||||
<v-icon left>{{ mdiProgressUpload }}</v-icon>
|
||||
{{ $t('Machine.UpdatePanel.UpdateAll') }}
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<update-hint-all
|
||||
:bool-show-dialog="boolShowDialog"
|
||||
@close-dialog="boolShowDialog = false"
|
||||
@update-all="updateAll" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { mdiProgressUpload } from '@mdi/js'
|
||||
import UpdateHintAll from '@/components/panels/Machine/UpdatePanel/UpdateHintAll.vue'
|
||||
@Component({
|
||||
components: { UpdateHintAll },
|
||||
})
|
||||
export default class UpdatePanelEntryAll extends Mixins(BaseMixin) {
|
||||
mdiProgressUpload = mdiProgressUpload
|
||||
|
||||
boolShowDialog = false
|
||||
|
||||
get hideUpdateWarning() {
|
||||
return this.$store.state.gui.uiSettings.hideUpdateWarnings ?? false
|
||||
}
|
||||
|
||||
clickUpdate() {
|
||||
if (this.hideUpdateWarning) {
|
||||
this.updateAll()
|
||||
return
|
||||
}
|
||||
|
||||
this.boolShowDialog = true
|
||||
}
|
||||
|
||||
updateAll() {
|
||||
this.$socket.emit('machine.update.full', {})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
@@ -0,0 +1,92 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-row class="py-2">
|
||||
<v-col class="pl-6">
|
||||
<strong>{{ $t('Machine.UpdatePanel.System') }}</strong>
|
||||
<br />
|
||||
<template v-if="package_count">
|
||||
<a class="primary--text cursor--pointer" @click="boolShowPackageList = true">
|
||||
<v-icon small color="primary" class="mr-1">{{ mdiInformation }}</v-icon>
|
||||
{{ $t('Machine.UpdatePanel.CountPackagesCanBeUpgraded', { count: package_count }) }}
|
||||
</a>
|
||||
</template>
|
||||
<span v-else>{{ $t('Machine.UpdatePanel.OSPackages') }}</span>
|
||||
</v-col>
|
||||
<v-col class="col-auto pr-6 text-right" align-self="center">
|
||||
<v-chip
|
||||
small
|
||||
label
|
||||
outlined
|
||||
:color="btnColor"
|
||||
:disabled="btnDisabled"
|
||||
class="minwidth-0 px-2 text-uppercase"
|
||||
@click="doUpdate">
|
||||
<v-icon small class="mr-1">{{ btnIcon }}</v-icon>
|
||||
{{ btnText }}
|
||||
</v-chip>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<system-packages-list
|
||||
:bool-show-dialog="boolShowPackageList"
|
||||
:packages-list="package_list"
|
||||
@close-dialog="closePackagesList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { mdiCheck, mdiInformation, mdiProgressUpload } from '@mdi/js'
|
||||
@Component
|
||||
export default class UpdatePanelEntrySystem extends Mixins(BaseMixin) {
|
||||
mdiInformation = mdiInformation
|
||||
|
||||
// to display the dialog for packages
|
||||
boolShowPackageList = false
|
||||
|
||||
get package_count() {
|
||||
return this.$store.state.server.updateManager?.system?.package_count ?? 0
|
||||
}
|
||||
|
||||
get package_list() {
|
||||
return this.$store.state.server.updateManager?.system?.package_list ?? []
|
||||
}
|
||||
|
||||
get btnDisabled() {
|
||||
// disable button if the printer is printing
|
||||
if (['printing', 'paused'].includes(this.printer_state)) return true
|
||||
|
||||
// disable button if no package is available to update
|
||||
return this.package_count === 0
|
||||
}
|
||||
|
||||
get btnIcon() {
|
||||
if (this.package_count) return mdiProgressUpload
|
||||
|
||||
return mdiCheck
|
||||
}
|
||||
|
||||
get btnColor() {
|
||||
// set button to primary, if updates are available
|
||||
if (this.package_count) return 'primary'
|
||||
|
||||
return 'green'
|
||||
}
|
||||
|
||||
get btnText() {
|
||||
if (this.package_count) return this.$t('Machine.UpdatePanel.Upgrade')
|
||||
|
||||
return this.$t('Machine.UpdatePanel.UpToDate')
|
||||
}
|
||||
|
||||
doUpdate() {
|
||||
this.$socket.emit('machine.update.system', {})
|
||||
}
|
||||
|
||||
closePackagesList() {
|
||||
this.boolShowPackageList = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
@@ -0,0 +1,164 @@
|
||||
<template>
|
||||
<v-dialog v-model="boolShowDialog" persistent max-width="800">
|
||||
<panel
|
||||
:title="$t('Machine.UpdatePanel.Commits')"
|
||||
:icon="mdiUpdate"
|
||||
:margin-bottom="false"
|
||||
card-class="machine-update-commits-dialog">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="closeDialog">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text class="py-0 px-0">
|
||||
<overlay-scrollbars style="max-height: 400px" :options="{ overflowBehavior: { x: 'hidden' } }">
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-timeline class="groupedCommits" align-top dense>
|
||||
<git-commits-list-day
|
||||
v-for="group of groupedCommits"
|
||||
:key="group.date.getTime()"
|
||||
:repo="repo"
|
||||
:grouped-commits="group" />
|
||||
<v-timeline-item
|
||||
v-if="displayFullHistoryWaring"
|
||||
small
|
||||
class="git-commit-list-day git-commit-list-warning">
|
||||
<v-row class="pt-0">
|
||||
<v-col class="pr-12">
|
||||
<v-alert dense text type="info">
|
||||
<p>{{ $t('Machine.UpdatePanel.MoreCommitsInfo') }}</p>
|
||||
<div class="text-center mb-3">
|
||||
<v-btn :href="linkToGithub" target="_blank">
|
||||
{{ $t('Machine.UpdatePanel.LinkToGithub') }}
|
||||
</v-btn>
|
||||
</div>
|
||||
</v-alert>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-timeline-item>
|
||||
</v-timeline>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</overlay-scrollbars>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import {
|
||||
ServerUpdateManagerStateGitRepo,
|
||||
ServerUpdateManagerStateGitRepoCommit,
|
||||
ServerUpdateManagerStateGitRepoGroupedCommits,
|
||||
} from '@/store/server/updateManager/types'
|
||||
import { mdiUpdate, mdiCloseThick } from '@mdi/js'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import GitCommitsListDay from '@/components/panels/Machine/UpdatePanel/GitCommitsListDay.vue'
|
||||
|
||||
@Component({
|
||||
components: { GitCommitsListDay, Panel },
|
||||
})
|
||||
export default class GitCommitsList extends Mixins(BaseMixin) {
|
||||
mdiUpdate = mdiUpdate
|
||||
mdiCloseThick = mdiCloseThick
|
||||
|
||||
@Prop({ required: true }) readonly boolShowDialog!: boolean
|
||||
@Prop({ required: true }) readonly repo!: ServerUpdateManagerStateGitRepo | null
|
||||
|
||||
get commitsBehind(): ServerUpdateManagerStateGitRepoCommit[] {
|
||||
return this.repo?.commits_behind ?? []
|
||||
}
|
||||
|
||||
get groupedCommits() {
|
||||
let output: ServerUpdateManagerStateGitRepoGroupedCommits[] = []
|
||||
let lastCommit: ServerUpdateManagerStateGitRepoCommit | null = null
|
||||
|
||||
this.commitsBehind.forEach((commit: any) => {
|
||||
const lastCommitDate = new Date((lastCommit?.date ?? 0) * 1000)
|
||||
const commitDate = new Date(commit.date * 1000)
|
||||
|
||||
if (
|
||||
commitDate.getFullYear() !== lastCommitDate.getFullYear() ||
|
||||
commitDate.getMonth() !== lastCommitDate.getMonth() ||
|
||||
commitDate.getDay() !== lastCommitDate.getDay()
|
||||
) {
|
||||
output.push({
|
||||
date: commitDate,
|
||||
commits: [],
|
||||
})
|
||||
}
|
||||
|
||||
output[output.length - 1].commits.push(commit)
|
||||
lastCommit = commit
|
||||
})
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
get displayFullHistoryWaring() {
|
||||
return this.commitsBehind.length >= 30
|
||||
}
|
||||
|
||||
get lastCommit() {
|
||||
return this.commitsBehind.slice(-1)[0]
|
||||
}
|
||||
|
||||
get linkToGithub() {
|
||||
return `https://github.com/${this.repo?.owner}/${this.repo?.name}/commits/${this.repo?.branch}/?after=${this.lastCommit?.sha}+0`
|
||||
}
|
||||
|
||||
closeDialog() {
|
||||
this.$emit('close-dialog')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.groupedCommits {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
::v-deep {
|
||||
.git-commit-list-day {
|
||||
padding-top: 24px;
|
||||
padding-bottom: 0;
|
||||
|
||||
.v-timeline-item__dot--small {
|
||||
width: 18px;
|
||||
height: 15px;
|
||||
margin-top: 2px;
|
||||
|
||||
&:before {
|
||||
display: block;
|
||||
content: ' ';
|
||||
position: relative;
|
||||
width: 18px;
|
||||
height: 2px;
|
||||
top: 7px;
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
z-index: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.v-timeline-item__inner-dot {
|
||||
background-color: #1e1e1e !important;
|
||||
border: 2px solid rgba(255, 255, 255, 0.5) !important;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
margin-left: 5px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
&.git-commit-list-warning {
|
||||
.v-timeline-item__dot--small {
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-timeline-item small class="git-commit-list-day">
|
||||
<v-row class="pt-0">
|
||||
<v-col class="pr-12">
|
||||
<h3 class="caption">
|
||||
{{ $t('Machine.UpdatePanel.CommitsOnDate', { date: groupedCommitsDate }) }}
|
||||
</h3>
|
||||
<ul class="commits mt-3 pl-0">
|
||||
<git-commits-list-day-commit
|
||||
v-for="commit of groupedCommits.commits"
|
||||
:key="commit.sha"
|
||||
:commit="commit"
|
||||
:repo="repo" />
|
||||
</ul>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-timeline-item>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import {
|
||||
ServerUpdateManagerStateGitRepo,
|
||||
ServerUpdateManagerStateGitRepoGroupedCommits,
|
||||
} from '@/store/server/updateManager/types'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import GitCommitsListDayCommit from '@/components/panels/Machine/UpdatePanel/GitCommitsListDayCommit.vue'
|
||||
|
||||
@Component({
|
||||
components: { Panel, GitCommitsListDayCommit },
|
||||
})
|
||||
export default class GitCommitsListDay extends Mixins(BaseMixin) {
|
||||
@Prop({ required: true }) readonly groupedCommits!: ServerUpdateManagerStateGitRepoGroupedCommits
|
||||
@Prop({ required: true }) readonly repo!: ServerUpdateManagerStateGitRepo
|
||||
|
||||
get groupedCommitsDate() {
|
||||
return new Date(this.groupedCommits.date).toLocaleDateString(this.browserLocale, {
|
||||
year: 'numeric',
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
ul.commits {
|
||||
list-style: none;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,120 @@
|
||||
<template>
|
||||
<li class="commit px-3 py-2">
|
||||
<v-row>
|
||||
<v-col>
|
||||
<h4 class="subtitle-2 text--white mb-0">
|
||||
{{ title }}
|
||||
<v-chip outlined label x-small class="ml-2 px-2" @click="showDetails = !showDetails">
|
||||
<v-icon small>{{ mdiDotsHorizontal }}</v-icon>
|
||||
</v-chip>
|
||||
</h4>
|
||||
<p
|
||||
v-if="showDetails"
|
||||
class="caption text--secondary mb-2"
|
||||
style="white-space: pre-line"
|
||||
v-html="message"></p>
|
||||
<p class="caption mb-0">
|
||||
<span class="font-weight-bold text-decoration-none white--text">
|
||||
{{ author }}
|
||||
</span>
|
||||
<span>{{ commitFormatDate }}</span>
|
||||
</p>
|
||||
</v-col>
|
||||
<v-col class="col-auto pt-4">
|
||||
<v-chip outlined label small :href="commitHref" target="_blank">
|
||||
{{ commitShortSha }}
|
||||
</v-chip>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</li>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { mdiDotsHorizontal } from '@mdi/js'
|
||||
import {
|
||||
ServerUpdateManagerStateGitRepo,
|
||||
ServerUpdateManagerStateGitRepoCommit,
|
||||
} from '@/store/server/updateManager/types'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
|
||||
@Component({
|
||||
components: { Panel },
|
||||
})
|
||||
export default class GitCommitsListDayCommit extends Mixins(BaseMixin) {
|
||||
mdiDotsHorizontal = mdiDotsHorizontal
|
||||
|
||||
@Prop({ required: true }) readonly commit!: ServerUpdateManagerStateGitRepoCommit
|
||||
@Prop({ required: true }) readonly repo!: ServerUpdateManagerStateGitRepo
|
||||
|
||||
showDetails = false
|
||||
|
||||
get title() {
|
||||
return this.commit.subject
|
||||
}
|
||||
|
||||
get message() {
|
||||
return this.commit.message
|
||||
}
|
||||
|
||||
get author() {
|
||||
return this.commit.author
|
||||
}
|
||||
|
||||
get commitFormatDate() {
|
||||
const commitDay = new Date(this.commit.date * 1000)
|
||||
commitDay.setHours(0, 0, 0, 0)
|
||||
const todayDay = new Date()
|
||||
todayDay.setHours(0, 0, 0, 0)
|
||||
const diff = Math.floor(todayDay.getTime() - commitDay.getTime()) / (1000 * 60 * 60 * 24)
|
||||
|
||||
if (diff === 0) {
|
||||
const diffHours = Math.floor((new Date().getTime() - this.commit.date * 1000) / (1000 * 60 * 60))
|
||||
|
||||
return this.$t('Machine.UpdatePanel.CommittedHoursAgo', { hours: diffHours })
|
||||
} else if (diff === 1) return this.$t('Machine.UpdatePanel.CommittedYesterday')
|
||||
else if (diff < 29) return this.$t('Machine.UpdatePanel.CommittedDaysAgo', { days: diff })
|
||||
else
|
||||
return this.$t('Machine.UpdatePanel.CommittedOnDate', {
|
||||
date: commitDay.toLocaleDateString(this.browserLocale, {
|
||||
year: 'numeric',
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
}),
|
||||
})
|
||||
}
|
||||
|
||||
get repo_name() {
|
||||
return this.repo.repo_name ?? this.repo.name ?? ''
|
||||
}
|
||||
|
||||
get commitHref() {
|
||||
return `https://github.com/${this.repo.owner}/${this.repo_name}/commit/${this.commit.sha}`
|
||||
}
|
||||
|
||||
get commitShortSha() {
|
||||
return this.commit.sha.substring(0, 6)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
li.commit {
|
||||
border-color: rgb(48, 54, 61);
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-bottom-width: 0;
|
||||
|
||||
&:first-child {
|
||||
border-top-left-radius: 6px;
|
||||
border-top-right-radius: 6px;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-left-radius: 6px;
|
||||
border-bottom-right-radius: 6px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,56 @@
|
||||
<template>
|
||||
<v-dialog v-model="boolShowDialog" persistent max-width="800">
|
||||
<panel
|
||||
:title="$t('Machine.UpdatePanel.UpgradeableSystemPackages')"
|
||||
:icon="mdiPackageVariantClosed"
|
||||
:margin-bottom="false"
|
||||
card-class="machine-update-system-packages-list-dialog">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="closeDialog">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col>
|
||||
<p>{{ $t('Machine.UpdatePanel.ThesePackagesCanBeUpgrade') }}</p>
|
||||
<p class="system-packages-list">{{ packagesList.join(', ') }}</p>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer />
|
||||
<v-btn text color="primary" @click="closeDialog">{{ $t('Machine.UpdatePanel.Close') }}</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { mdiCloseThick, mdiPackageVariantClosed } from '@mdi/js'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
|
||||
@Component({
|
||||
components: { Panel },
|
||||
})
|
||||
export default class SystemPackagesList extends Mixins(BaseMixin) {
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiPackageVariantClosed = mdiPackageVariantClosed
|
||||
|
||||
@Prop({ required: true }) readonly boolShowDialog!: boolean
|
||||
@Prop({ required: true }) readonly packagesList!: string[]
|
||||
|
||||
closeDialog() {
|
||||
this.$emit('close-dialog')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.system-packages-list {
|
||||
font-family: monospace;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,71 @@
|
||||
<template>
|
||||
<v-dialog v-model="boolShowDialog" persistent max-width="600">
|
||||
<panel
|
||||
:title="$t('Machine.UpdatePanel.AreYouSure')"
|
||||
:icon="mdiProgressQuestion"
|
||||
:margin-bottom="false"
|
||||
card-class="machine-update-hint-dialog">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="closeDialog">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col>
|
||||
<update-hint-alert :repo="repo" @open-commit-history="openCommitHistory" />
|
||||
<div>
|
||||
<v-checkbox
|
||||
v-model="checkboxUpdateQuestion"
|
||||
:label="$t('Machine.UpdatePanel.IUnderstandTheRisks')"
|
||||
hide-details />
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
<v-divider />
|
||||
<v-card-actions>
|
||||
<v-spacer />
|
||||
<v-btn text @click="closeDialog">{{ $t('Machine.UpdatePanel.Abort') }}</v-btn>
|
||||
<v-btn text color="primary" :disabled="!checkboxUpdateQuestion" @click="doUpdate">
|
||||
{{ $t('Machine.UpdatePanel.StartUpdate') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { ServerUpdateManagerStateGitRepo } from '@/store/server/updateManager/types'
|
||||
import { mdiProgressQuestion, mdiCloseThick } from '@mdi/js'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import GitCommitsListDay from '@/components/panels/Machine/UpdatePanel/GitCommitsListDay.vue'
|
||||
import UpdateHintAlert from '@/components/panels/Machine/UpdatePanel/UpdateHintAlert.vue'
|
||||
|
||||
@Component({
|
||||
components: { GitCommitsListDay, Panel, UpdateHintAlert },
|
||||
})
|
||||
export default class UpdateHint extends Mixins(BaseMixin) {
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiProgressQuestion = mdiProgressQuestion
|
||||
|
||||
checkboxUpdateQuestion = false
|
||||
|
||||
@Prop({ required: true }) readonly boolShowDialog!: boolean
|
||||
@Prop({ required: true }) readonly repo!: ServerUpdateManagerStateGitRepo
|
||||
|
||||
doUpdate() {
|
||||
this.$emit('do-update')
|
||||
}
|
||||
|
||||
openCommitHistory() {
|
||||
this.$emit('open-commit-history')
|
||||
}
|
||||
|
||||
closeDialog() {
|
||||
this.$emit('close-dialog')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,95 @@
|
||||
<template>
|
||||
<v-alert text dense border="left" color="orange" :icon="mdiAlertCircle">
|
||||
<template v-if="boolTitle">
|
||||
<strong>{{ $t('Machine.UpdatePanel.UpdateWarning', { name: formatName }) }}</strong>
|
||||
<br />
|
||||
</template>
|
||||
<p v-if="description1">{{ description1 }}</p>
|
||||
<p v-if="description2">{{ description2 }}</p>
|
||||
<div class="text-center">
|
||||
<v-btn
|
||||
v-if="configured_type === 'git_repo' && repo.commits_behind?.length"
|
||||
class="mx-2 mt-3 mt-sm-0"
|
||||
@click="openCommitHistory">
|
||||
<v-icon left small>{{ mdiEye }}</v-icon>
|
||||
{{ $t('Machine.UpdatePanel.CommitHistory') }}
|
||||
</v-btn>
|
||||
<v-btn v-if="externalLink" class="mx-2 mt-3 mt-sm-0" :href="externalLink" target="_blank">
|
||||
<v-icon left small>{{ mdiOpenInNew }}</v-icon>
|
||||
{{ externalLinkText }}
|
||||
</v-btn>
|
||||
</div>
|
||||
</v-alert>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { ServerUpdateManagerStateGitRepo } from '@/store/server/updateManager/types'
|
||||
import { mdiCloseThick, mdiAlertCircle, mdiEye, mdiOpenInNew } from '@mdi/js'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import GitCommitsListDay from '@/components/panels/Machine/UpdatePanel/GitCommitsListDay.vue'
|
||||
import { capitalize } from '@/plugins/helpers'
|
||||
|
||||
@Component({
|
||||
components: { GitCommitsListDay, Panel },
|
||||
})
|
||||
export default class UpdateHintAlert extends Mixins(BaseMixin) {
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiAlertCircle = mdiAlertCircle
|
||||
mdiEye = mdiEye
|
||||
mdiOpenInNew = mdiOpenInNew
|
||||
|
||||
@Prop({ required: true }) readonly repo!: ServerUpdateManagerStateGitRepo
|
||||
@Prop({ required: false, default: false }) readonly boolTitle!: boolean
|
||||
|
||||
get name() {
|
||||
return this.repo?.name ?? 'UNKNOWN'
|
||||
}
|
||||
|
||||
get formatName() {
|
||||
return capitalize(this.name)
|
||||
}
|
||||
|
||||
get configured_type() {
|
||||
return this.repo?.configured_type ?? 'UNKNOWN'
|
||||
}
|
||||
|
||||
get description1() {
|
||||
if (this.name === 'klipper') return this.$t('Machine.UpdatePanel.KlipperUpdateQuestionFirmware')
|
||||
if (this.name === 'moonraker') return this.$t('Machine.UpdatePanel.MoonrakerUpdateQuestion')
|
||||
if (this.configured_type === 'web') return this.$t('Machine.UpdatePanel.WebClientUpdateQuestion')
|
||||
|
||||
return this.$t('Machine.UpdatePanel.GenericUpdateQuestion')
|
||||
}
|
||||
|
||||
get description2() {
|
||||
if (this.name === 'klipper') return this.$t('Machine.UpdatePanel.KlipperUpdateQuestionConfig')
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
get repo_name() {
|
||||
return this.repo.repo_name ?? this.repo.name ?? ''
|
||||
}
|
||||
|
||||
get externalLink() {
|
||||
if (this.name === 'klipper') return '//www.klipper3d.org/Config_Changes.html'
|
||||
if (this.name === 'moonraker') return '//moonraker.readthedocs.io/en/latest/changelog/'
|
||||
if (this.repo?.configured_type === 'web')
|
||||
return `//github.com/${this.repo.owner}/${this.repo_name}/releases/tag/${this.repo.remote_version}`
|
||||
|
||||
return `//github.com/${this.repo.owner}/${this.repo_name}`
|
||||
}
|
||||
|
||||
get externalLinkText() {
|
||||
if (['klipper', 'moonraker'].includes(this.name)) return this.$t('Machine.UpdatePanel.ConfigChanges')
|
||||
|
||||
return this.$t('Machine.UpdatePanel.GitHubPage')
|
||||
}
|
||||
|
||||
openCommitHistory() {
|
||||
this.$emit('open-commit-history')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,105 @@
|
||||
<template>
|
||||
<v-dialog v-model="boolShowDialog" persistent max-width="600">
|
||||
<panel
|
||||
:title="$t('Machine.UpdatePanel.AreYouSure')"
|
||||
:icon="mdiProgressQuestion"
|
||||
:margin-bottom="false"
|
||||
card-class="machine-update-hint-dialog">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="closeDialog">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col>
|
||||
<update-hint-alert
|
||||
v-for="repo of filteredModules"
|
||||
:key="repo.name"
|
||||
:repo="repo.data"
|
||||
:bool-title="true"
|
||||
@open-commit-history="openCommitHistory(repo.data)" />
|
||||
<div>
|
||||
<v-checkbox
|
||||
v-model="checkboxUpdateQuestion"
|
||||
:label="$t('Machine.UpdatePanel.IUnderstandTheRisks')"
|
||||
hide-details />
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
<v-divider />
|
||||
<v-card-actions>
|
||||
<v-spacer />
|
||||
<v-btn text @click="closeDialog">{{ $t('Machine.UpdatePanel.Abort') }}</v-btn>
|
||||
<v-btn text color="primary" :disabled="!checkboxUpdateQuestion" @click="updateAll">
|
||||
{{ $t('Machine.UpdatePanel.StartUpdate') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
<git-commits-list
|
||||
:bool-show-dialog="boolShowCommitHistory"
|
||||
:repo="showCommitsRepo"
|
||||
@close-dialog="boolShowCommitHistory = false" />
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { ServerUpdateManagerStateGitRepo, ServerUpdateManagerStateGuiList } from '@/store/server/updateManager/types'
|
||||
import { mdiProgressQuestion, mdiCloseThick } from '@mdi/js'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import GitCommitsListDay from '@/components/panels/Machine/UpdatePanel/GitCommitsListDay.vue'
|
||||
import UpdateHintAlert from '@/components/panels/Machine/UpdatePanel/UpdateHintAlert.vue'
|
||||
import semver from 'semver'
|
||||
|
||||
@Component({
|
||||
components: { GitCommitsListDay, Panel, UpdateHintAlert },
|
||||
})
|
||||
export default class UpdateHintAll extends Mixins(BaseMixin) {
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiProgressQuestion = mdiProgressQuestion
|
||||
|
||||
checkboxUpdateQuestion = false
|
||||
boolShowCommitHistory = false
|
||||
showCommitsRepo: ServerUpdateManagerStateGitRepo | null = null
|
||||
|
||||
@Prop({ required: true }) readonly boolShowDialog!: boolean
|
||||
|
||||
get modules() {
|
||||
return this.$store.getters['server/updateManager/getUpdateManagerList'] ?? []
|
||||
}
|
||||
|
||||
get filteredModules() {
|
||||
return this.modules.filter((module: ServerUpdateManagerStateGuiList) => {
|
||||
// check git repos for updates
|
||||
if (module.type === 'git' && module.data?.commits_behind?.length) return true
|
||||
|
||||
// check client web for updates
|
||||
if (
|
||||
module.type === 'web' &&
|
||||
semver.valid(module.data?.remote_version) &&
|
||||
semver.valid(module.data?.version) &&
|
||||
semver.gt(module.data?.remote_version, module.data?.version)
|
||||
)
|
||||
return true
|
||||
|
||||
return false
|
||||
})
|
||||
}
|
||||
|
||||
openCommitHistory(repo: ServerUpdateManagerStateGitRepo) {
|
||||
this.showCommitsRepo = repo
|
||||
this.boolShowCommitHistory = true
|
||||
}
|
||||
|
||||
closeDialog() {
|
||||
this.$emit('close-dialog')
|
||||
}
|
||||
|
||||
updateAll() {
|
||||
this.$emit('update-all')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -30,7 +30,7 @@
|
||||
<v-divider class="mb-2"></v-divider>
|
||||
</template>
|
||||
<v-card-actions class="justify-center pb-3">
|
||||
<v-btn small href="https://docs.mainsail.xyz/configuration" target="_blank">
|
||||
<v-btn small href="https://docs.mainsail.xyz/setup/configuration" target="_blank">
|
||||
<v-icon small class="mr-1">{{ mdiInformation }}</v-icon>
|
||||
{{ $t('Panels.MinSettingsPanel.MoreInformation') }}
|
||||
</v-btn>
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -83,6 +83,12 @@
|
||||
<v-icon class="mr-1">{{ mdiPlaylistPlus }}</v-icon>
|
||||
{{ $t('Files.AddToQueue') }}
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
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)"
|
||||
@@ -106,7 +112,7 @@
|
||||
<v-icon class="mr-1">{{ mdiRenameBox }}</v-icon>
|
||||
{{ $t('Files.Rename') }}
|
||||
</v-list-item>
|
||||
<v-list-item class="red--text" @click="removeFile(contextMenu.item)">
|
||||
<v-list-item class="red--text" @click="deleteDialog = true">
|
||||
<v-icon class="mr-1" color="error">{{ mdiDelete }}</v-icon>
|
||||
{{ $t('Files.Delete') }}
|
||||
</v-list-item>
|
||||
@@ -114,7 +120,7 @@
|
||||
</v-menu>
|
||||
<v-dialog v-model="dialogRenameFile.show" :max-width="400">
|
||||
<panel
|
||||
:title="$t('Files.RenameFile').toString()"
|
||||
:title="$t('Files.RenameFile')"
|
||||
card-class="dashboard-files-rename-file-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -137,6 +143,79 @@
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
|
||||
<!-- CONFIRM DELETE FILE DIALOG -->
|
||||
<v-dialog v-model="deleteDialog" max-width="400">
|
||||
<panel :title="$t('Files.Delete')" card-class="gcode-files-delete-dialog" :margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="deleteDialog = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<p class="mb-0">
|
||||
{{ $t('Files.DeleteSingleFileQuestion', { name: filename }) }}
|
||||
</p>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="" text @click="deleteDialog = false">
|
||||
{{ $t('Files.Cancel') }}
|
||||
</v-btn>
|
||||
<v-btn color="error" text @click="removeFile">
|
||||
{{ $t('Files.Delete') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
|
||||
<v-dialog v-model="dialogAddBatchToQueue.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Files.AddToQueue')"
|
||||
card-class="gcode-files-add-to-queue-dialog"
|
||||
:icon="mdiPlaylistPlus"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="dialogAddBatchToQueue.show = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
<v-card-text>
|
||||
<v-text-field
|
||||
ref="inputFieldAddToQueueCount"
|
||||
v-model="dialogAddBatchToQueue.count"
|
||||
:label="$t('Files.Count')"
|
||||
required
|
||||
hide-spin-buttons
|
||||
type="number"
|
||||
:rules="countInputRules"
|
||||
@keyup.enter="addBatchToQueueAction">
|
||||
<template #append-outer>
|
||||
<div class="_spin_button_group">
|
||||
<v-btn class="mt-n3" icon plain small @click="dialogAddBatchToQueue.count++">
|
||||
<v-icon>{{ mdiChevronUp }}</v-icon>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
:disabled="dialogAddBatchToQueue.count <= 1"
|
||||
class="mb-n3"
|
||||
icon
|
||||
plain
|
||||
small
|
||||
@click="dialogAddBatchToQueue.count--">
|
||||
<v-icon>{{ mdiChevronDown }}</v-icon>
|
||||
</v-btn>
|
||||
</div>
|
||||
</template>
|
||||
</v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="" text @click="dialogAddBatchToQueue.show = false">{{ $t('Files.Cancel') }}</v-btn>
|
||||
<v-btn color="primary" text @click="addBatchToQueueAction">{{ $t('Files.AddToQueue') }}</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
@@ -148,6 +227,8 @@ 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,
|
||||
@@ -159,6 +240,7 @@ import {
|
||||
mdiDelete,
|
||||
mdiCloseThick,
|
||||
} from '@mdi/js'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
|
||||
interface dialogRenameObject {
|
||||
show: boolean
|
||||
@@ -166,12 +248,21 @@ interface dialogRenameObject {
|
||||
item: FileStateGcodefile
|
||||
}
|
||||
|
||||
interface dialogAddBatchToQueue {
|
||||
show: boolean
|
||||
count: number
|
||||
item: FileStateGcodefile
|
||||
}
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
Panel,
|
||||
StartPrintDialog,
|
||||
},
|
||||
})
|
||||
export default class StatusPanelGcodefiles extends Mixins(BaseMixin, ControlMixin) {
|
||||
mdiChevronDown = mdiChevronDown
|
||||
mdiChevronUp = mdiChevronUp
|
||||
mdiFile = mdiFile
|
||||
mdiPlay = mdiPlay
|
||||
mdiPlaylistPlus = mdiPlaylistPlus
|
||||
@@ -183,6 +274,7 @@ export default class StatusPanelGcodefiles extends Mixins(BaseMixin, ControlMixi
|
||||
mdiDelete = mdiDelete
|
||||
mdiCloseThick = mdiCloseThick
|
||||
|
||||
private deleteDialog = false
|
||||
private showDialogBool = false
|
||||
private dialogFile: FileStateGcodefile = {
|
||||
isDirectory: false,
|
||||
@@ -199,6 +291,7 @@ export default class StatusPanelGcodefiles extends Mixins(BaseMixin, ControlMixi
|
||||
last_status: null,
|
||||
last_start_time: null,
|
||||
last_total_duration: null,
|
||||
preheat_gcode: null,
|
||||
}
|
||||
private currentPath = ''
|
||||
private contentTdWidth = 100
|
||||
@@ -222,6 +315,17 @@ export default class StatusPanelGcodefiles extends Mixins(BaseMixin, ControlMixi
|
||||
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
|
||||
@@ -243,6 +347,11 @@ export default class StatusPanelGcodefiles extends Mixins(BaseMixin, ControlMixi
|
||||
return gcodes
|
||||
}
|
||||
|
||||
get filename() {
|
||||
const filename = this.contextMenu.item.filename.split('/')
|
||||
return filename[filename.length - 1]
|
||||
}
|
||||
|
||||
get styleContentTdWidth() {
|
||||
return `width: ${this.contentTdWidth}px;`
|
||||
}
|
||||
@@ -343,6 +452,26 @@ export default class StatusPanelGcodefiles extends Mixins(BaseMixin, ControlMixi
|
||||
this.$store.dispatch('server/jobQueue/addToQueue', [item.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
|
||||
}
|
||||
|
||||
view3D(item: FileStateGcodefile) {
|
||||
this.$router.push({ path: '/viewer', query: { filename: 'gcodes/' + item.filename } })
|
||||
}
|
||||
@@ -393,12 +522,14 @@ export default class StatusPanelGcodefiles extends Mixins(BaseMixin, ControlMixi
|
||||
)
|
||||
}
|
||||
|
||||
removeFile(item: FileStateGcodefile) {
|
||||
removeFile() {
|
||||
this.$socket.emit(
|
||||
'server.files.delete_file',
|
||||
{ path: 'gcodes/' + item.filename },
|
||||
{ path: 'gcodes/' + this.contextMenu.item.filename },
|
||||
{ action: 'files/getDeleteFile' }
|
||||
)
|
||||
|
||||
this.deleteDialog = false
|
||||
}
|
||||
|
||||
mounted() {
|
||||
@@ -419,8 +550,15 @@ export default class StatusPanelGcodefiles extends Mixins(BaseMixin, ControlMixi
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped>
|
||||
.filesGcodeCard {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
._spin_button_group {
|
||||
width: 24px;
|
||||
margin-top: -6px;
|
||||
margin-left: -6px;
|
||||
margin-bottom: -6px;
|
||||
}
|
||||
</style>
|
||||
@@ -5,77 +5,27 @@
|
||||
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 && !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">{{ 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 />
|
||||
@@ -85,14 +35,6 @@
|
||||
</template>
|
||||
</v-data-table>
|
||||
<resize-observer @notify="handleResize" />
|
||||
<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>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
@@ -101,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
|
||||
@@ -136,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 = ''
|
||||
@@ -163,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 = ''
|
||||
@@ -232,27 +134,10 @@ 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() {
|
||||
setTimeout(() => {
|
||||
this.calcContentTdWidth()
|
||||
|
||||
@@ -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>
|
||||
@@ -239,12 +239,15 @@ export default class StatusPanelPrintstatusPrinting extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
formatDuration(seconds: number) {
|
||||
let h = Math.floor(seconds / 3600)
|
||||
seconds %= 3600
|
||||
let m = ('0' + Math.floor(seconds / 60)).slice(-2)
|
||||
let s = ('0' + (seconds % 60).toFixed(0)).slice(-2)
|
||||
let prefix = seconds < 0 ? '-' : ''
|
||||
let absSeconds = Math.abs(seconds)
|
||||
|
||||
return h + ':' + m + ':' + s
|
||||
let h = Math.floor(absSeconds / 3600)
|
||||
absSeconds %= 3600
|
||||
let m = ('0' + Math.floor(absSeconds / 60)).slice(-2)
|
||||
let s = ('0' + (absSeconds % 60).toFixed(0)).slice(-2)
|
||||
|
||||
return prefix + h + ':' + m + ':' + s
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -34,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,13 +96,13 @@
|
||||
<v-divider class="my-0"></v-divider>
|
||||
<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>
|
||||
@@ -89,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,
|
||||
@@ -100,7 +133,10 @@ import {
|
||||
mdiStop,
|
||||
mdiMessageProcessingOutline,
|
||||
mdiCloseCircle,
|
||||
mdiLayersPlus,
|
||||
mdiDotsVertical,
|
||||
} from '@mdi/js'
|
||||
import { PrinterStateMacro } from '@/store/printer/types'
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
@@ -112,14 +148,18 @@ 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 boolShowPauseAtLayer = false
|
||||
|
||||
declare $refs: {
|
||||
bigThumbnail: any
|
||||
@@ -133,7 +173,7 @@ export default class StatusPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get jobsCount() {
|
||||
return this.jobs?.length ?? 0
|
||||
return this.$store.getters['server/jobQueue/getJobsCount'] ?? 0
|
||||
}
|
||||
|
||||
get current_filename() {
|
||||
@@ -145,7 +185,7 @@ export default class StatusPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get printPercent() {
|
||||
return Math.round(this.$store.getters['printer/getPrintPercent'] * 100)
|
||||
return Math.floor(this.$store.getters['printer/getPrintPercent'] * 100)
|
||||
}
|
||||
|
||||
get printerStateOutput() {
|
||||
@@ -173,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,
|
||||
},
|
||||
{
|
||||
@@ -181,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,
|
||||
},
|
||||
{
|
||||
@@ -189,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,
|
||||
},
|
||||
{
|
||||
@@ -213,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() {
|
||||
@@ -230,11 +289,62 @@ 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() {
|
||||
@@ -269,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' })
|
||||
}
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
<template>
|
||||
<responsive
|
||||
:breakpoints="{
|
||||
mobile: (el) => el.width <= 395,
|
||||
}">
|
||||
<template #default="{ el }">
|
||||
<v-simple-table class="temperature-panel-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="icon"> </th>
|
||||
<th class="name">{{ $t('Panels.TemperaturePanel.Name') }}</th>
|
||||
<th v-if="!el.is.mobile" class="state">
|
||||
{{ $t('Panels.TemperaturePanel.State') }}
|
||||
</th>
|
||||
<th class="current">
|
||||
{{ $t('Panels.TemperaturePanel.Current') }}
|
||||
</th>
|
||||
<th class="target">
|
||||
{{ $t('Panels.TemperaturePanel.Target') }}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<temperature-panel-list-item
|
||||
v-for="objectName in tempObjects"
|
||||
:key="objectName"
|
||||
:object-name="objectName"
|
||||
:is-responsive-mobile="el.is.mobile ?? false" />
|
||||
</tbody>
|
||||
</v-simple-table>
|
||||
</template>
|
||||
</responsive>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Component from 'vue-class-component'
|
||||
import { Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
|
||||
@Component
|
||||
export default class TemperaturePanelList extends Mixins(BaseMixin) {
|
||||
get available_heaters() {
|
||||
return this.$store.state.printer?.heaters?.available_heaters ?? []
|
||||
}
|
||||
|
||||
get filteredHeaters() {
|
||||
return this.available_heaters
|
||||
.filter((fullName: string) => {
|
||||
const splits = fullName.split(' ')
|
||||
let name = splits[0]
|
||||
if (splits.length > 1) name = splits[1]
|
||||
|
||||
return !name.startsWith('_')
|
||||
})
|
||||
.sort(this.sortObjectName)
|
||||
}
|
||||
|
||||
get available_sensors() {
|
||||
return this.$store.state.printer?.heaters?.available_sensors ?? []
|
||||
}
|
||||
|
||||
get temperature_fans() {
|
||||
return this.available_sensors
|
||||
.filter((name: string) => name.startsWith('temperature_fan') && !name.startsWith('temperature_fan _'))
|
||||
.sort(this.sortObjectName)
|
||||
}
|
||||
|
||||
get temperature_sensors() {
|
||||
return this.available_sensors
|
||||
.filter((fullName: string) => {
|
||||
if (this.available_heaters.includes(fullName)) return false
|
||||
if (this.temperature_fans.includes(fullName)) return false
|
||||
|
||||
const splits = fullName.split(' ')
|
||||
let name = splits[0]
|
||||
if (splits.length > 1) name = splits[1]
|
||||
|
||||
return !name.startsWith('_')
|
||||
})
|
||||
.sort(this.sortObjectName)
|
||||
}
|
||||
|
||||
get tempObjects() {
|
||||
return [...this.filteredHeaters, ...this.temperature_fans, ...this.temperature_sensors]
|
||||
}
|
||||
|
||||
sortObjectName(a: string, b: string) {
|
||||
const splitsA = a.split(' ')
|
||||
let nameA = splitsA[0]
|
||||
if (splitsA.length > 1) nameA = splitsA[1]
|
||||
nameA = nameA.toUpperCase()
|
||||
|
||||
const splitsB = b.split(' ')
|
||||
let nameB = splitsB[0]
|
||||
if (splitsB.length > 1) nameB = splitsB[1]
|
||||
nameB = nameB.toUpperCase()
|
||||
|
||||
if (nameA < nameB) return -1
|
||||
if (nameA > nameB) return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.temperature-panel-table th,
|
||||
.temperature-panel-table ::v-deep td {
|
||||
padding-top: 5px !important;
|
||||
padding-bottom: 5px !important;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
.temperature-panel-table ::v-deep tr:hover {
|
||||
background: none !important;
|
||||
}
|
||||
|
||||
.temperature-panel-table ::v-deep .icon {
|
||||
width: 24px;
|
||||
padding-right: 0 !important;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.temperature-panel-table ::v-deep .state {
|
||||
width: 100px;
|
||||
text-align: right !important;
|
||||
}
|
||||
|
||||
.temperature-panel-table ::v-deep .current {
|
||||
width: 100px;
|
||||
text-align: right !important;
|
||||
}
|
||||
|
||||
.temperature-panel-table ::v-deep .target {
|
||||
width: 140px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,280 @@
|
||||
<template>
|
||||
<tr>
|
||||
<td class="icon">
|
||||
<v-icon :color="iconColor" :class="iconClass" tabindex="-1" @click="showEditDialog = true">
|
||||
{{ icon }}
|
||||
</v-icon>
|
||||
</td>
|
||||
<td class="name">
|
||||
<span @click="showEditDialog = true">{{ formatName }}</span>
|
||||
</td>
|
||||
<td v-if="!isResponsiveMobile" class="state">
|
||||
<v-tooltip v-if="state !== null" top>
|
||||
<template #activator="{ on, attrs }">
|
||||
<div v-bind="attrs" v-on="on">{{ formatState }}</div>
|
||||
</template>
|
||||
<span>{{ $t('Panels.TemperaturePanel.Avg') }}: {{ avgState }} %</span>
|
||||
</v-tooltip>
|
||||
</td>
|
||||
<td class="current">
|
||||
<v-tooltip top :disabled="!(measured_min_temp !== null || measured_max_temp !== null)">
|
||||
<template #activator="{ on, attrs }">
|
||||
<span style="cursor: default" v-bind="attrs" v-on="on">
|
||||
{{ formatTemperature }}
|
||||
</span>
|
||||
</template>
|
||||
<span>
|
||||
{{ $t('Panels.TemperaturePanel.Max') }}: {{ measured_max_temp }}°C
|
||||
<br />
|
||||
{{ $t('Panels.TemperaturePanel.Min') }}: {{ measured_min_temp }}°C
|
||||
</span>
|
||||
</v-tooltip>
|
||||
<div v-if="rpm !== null">
|
||||
<small :class="rpmClass">{{ rpm }} RPM</small>
|
||||
</div>
|
||||
<temperature-panel-list-item-additional-sensor
|
||||
v-if="additionalSensorName"
|
||||
:object-name="objectName"
|
||||
:additional-object-name="additionalSensorName" />
|
||||
</td>
|
||||
<td class="target">
|
||||
<temperature-input
|
||||
v-if="command !== null"
|
||||
:name="name"
|
||||
:target="target"
|
||||
:presets="presets"
|
||||
:min_temp="min_temp"
|
||||
:max_temp="max_temp"
|
||||
:command="command"
|
||||
:attribute-name="commandAttributeName" />
|
||||
</td>
|
||||
<temperature-panel-list-item-edit
|
||||
:bool-show="showEditDialog"
|
||||
:object-name="objectName"
|
||||
:name="name"
|
||||
:format-name="formatName"
|
||||
:additional-sensor-name="additionalSensorName"
|
||||
:icon="icon"
|
||||
:color="color"
|
||||
@close-dialog="showEditDialog = false" />
|
||||
</tr>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Component from 'vue-class-component'
|
||||
import { Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { convertName } from '@/plugins/helpers'
|
||||
import {
|
||||
mdiFan,
|
||||
mdiFire,
|
||||
mdiPrinter3dNozzle,
|
||||
mdiPrinter3dNozzleAlert,
|
||||
mdiRadiator,
|
||||
mdiRadiatorDisabled,
|
||||
mdiThermometer,
|
||||
} from '@mdi/js'
|
||||
import { additionalSensors, opacityHeaterActive, opacityHeaterInactive } from '@/store/variables'
|
||||
|
||||
@Component
|
||||
export default class TemperaturePanelListItem extends Mixins(BaseMixin) {
|
||||
@Prop({ type: String, required: true }) readonly objectName!: string
|
||||
@Prop({ type: Boolean, required: true }) readonly isResponsiveMobile!: boolean
|
||||
|
||||
showEditDialog = false
|
||||
|
||||
get printerObject() {
|
||||
if (!(this.objectName in this.$store.state.printer)) return {}
|
||||
|
||||
return this.$store.state.printer[this.objectName]
|
||||
}
|
||||
|
||||
get printerObjectSettings() {
|
||||
// convert objectName to lowercase, because klipper only user lowercase in configfile.settings
|
||||
const lowerCaseObjectName = this.objectName.toLowerCase()
|
||||
|
||||
if (!(lowerCaseObjectName in (this.$store.state.printer?.configfile?.settings ?? {}))) return {}
|
||||
|
||||
return this.$store.state.printer?.configfile?.settings[lowerCaseObjectName]
|
||||
}
|
||||
|
||||
get name() {
|
||||
const splits = this.objectName.split(' ')
|
||||
if (splits.length === 1) return this.objectName
|
||||
|
||||
return splits[1]
|
||||
}
|
||||
|
||||
get formatName() {
|
||||
return convertName(this.name)
|
||||
}
|
||||
|
||||
get icon() {
|
||||
// handle extruder icons
|
||||
if (this.objectName.startsWith('extruder')) {
|
||||
if (this.printerObject.can_extrude ?? false) return mdiPrinter3dNozzle
|
||||
|
||||
return mdiPrinter3dNozzleAlert
|
||||
}
|
||||
|
||||
// show heater_bed icon
|
||||
if (this.objectName === 'heater_bed') {
|
||||
if (
|
||||
(this.temperature !== null && this.temperature > 50) ||
|
||||
(this.target && this.temperature && this.temperature > this.target - 5)
|
||||
)
|
||||
return mdiRadiator
|
||||
|
||||
return mdiRadiatorDisabled
|
||||
}
|
||||
|
||||
// show heater_generic icon
|
||||
if (this.objectName.startsWith('heater_generic')) return mdiFire
|
||||
|
||||
// show fan icon, if it is a fan
|
||||
if (this.isFan) return mdiFan
|
||||
|
||||
return mdiThermometer
|
||||
}
|
||||
|
||||
get color() {
|
||||
return this.$store.getters['printer/tempHistory/getDatasetColor'](this.objectName)
|
||||
}
|
||||
|
||||
get iconColor() {
|
||||
// set icon color to active, if no target exists (temperature_sensors) or a heater is active
|
||||
if (this.target === null || this.target > 0) return `${this.color}${opacityHeaterActive}`
|
||||
|
||||
return `${this.color}${opacityHeaterInactive}`
|
||||
}
|
||||
|
||||
get iconClass() {
|
||||
const classes = ['_no-focus-style', 'cursor-pointer']
|
||||
|
||||
// add icon animation, when it is a fan and state > 0
|
||||
if (this.isFan) {
|
||||
const disableFanAnimation = this.$store.state.gui?.uiSettings.disableFanAnimation ?? false
|
||||
|
||||
if (!disableFanAnimation && (this.state ?? 0) > 0) classes.push('icon-rotate')
|
||||
}
|
||||
|
||||
return classes
|
||||
}
|
||||
|
||||
get isFan() {
|
||||
return this.objectName.startsWith('temperature_fan')
|
||||
}
|
||||
|
||||
get state(): number | null {
|
||||
return this.printerObject.power ?? this.printerObject.speed ?? null
|
||||
}
|
||||
|
||||
get formatState() {
|
||||
if (this.state === null) return null
|
||||
if (this.target === 0 && this.state === 0) return 'off'
|
||||
|
||||
return `${Math.round(this.state * 100)} %`
|
||||
}
|
||||
|
||||
get avgPower() {
|
||||
return this.$store.getters['printer/tempHistory/getAvgPower'](this.name) ?? 0
|
||||
}
|
||||
|
||||
get avgSpeed() {
|
||||
return this.$store.getters['printer/tempHistory/getAvgSpeed'](this.name) ?? 0
|
||||
}
|
||||
|
||||
get avgState() {
|
||||
if ('power' in this.printerObject) return Math.round(this.avgPower)
|
||||
if ('speed' in this.printerObject) return Math.round(this.avgSpeed)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
get temperature(): number | null {
|
||||
return this.printerObject?.temperature ?? null
|
||||
}
|
||||
|
||||
get formatTemperature() {
|
||||
return `${this.temperature?.toFixed(1) ?? '--'}°C`
|
||||
}
|
||||
|
||||
get min_temp() {
|
||||
return parseInt(this.printerObjectSettings.min_temp ?? 0)
|
||||
}
|
||||
|
||||
get max_temp() {
|
||||
return parseInt(this.printerObjectSettings.max_temp ?? 0)
|
||||
}
|
||||
|
||||
get measured_min_temp() {
|
||||
return this.printerObject?.measured_min_temp?.toFixed(1) ?? null
|
||||
}
|
||||
|
||||
get measured_max_temp() {
|
||||
return this.printerObject?.measured_max_temp?.toFixed(1) ?? null
|
||||
}
|
||||
|
||||
get target() {
|
||||
return this.printerObject?.target ?? null
|
||||
}
|
||||
|
||||
get additionalSensorName() {
|
||||
if (this.objectName === 'z_thermal_adjust') return 'z_thermal_adjust'
|
||||
|
||||
const additionalSensorName = additionalSensors.find((sensorName) => {
|
||||
const objectName = `${sensorName} ${this.name}`
|
||||
|
||||
if (objectName in this.$store.state.printer) return true
|
||||
})
|
||||
|
||||
if (!additionalSensorName) return null
|
||||
|
||||
return `${additionalSensorName} ${this.name}`
|
||||
}
|
||||
|
||||
get rpm() {
|
||||
const rpm = this.printerObject.rpm ?? null
|
||||
|
||||
// return null when rpm doesn't exist
|
||||
if (rpm === null) return null
|
||||
|
||||
return parseInt(this.printerObject.rpm)
|
||||
}
|
||||
|
||||
get rpmClass() {
|
||||
if (this.rpm === 0 && (this.printerObject.speed ?? 0) > 0) return 'red--text'
|
||||
|
||||
return ''
|
||||
}
|
||||
|
||||
get presets() {
|
||||
return this.$store.getters['gui/presets/getPresetsFromHeater']({ name: this.objectName }) ?? []
|
||||
}
|
||||
|
||||
get command() {
|
||||
if (this.objectName.startsWith('temperature_fan')) return 'SET_TEMPERATURE_FAN_TARGET'
|
||||
if (this.objectName.startsWith('extruder') || this.objectName.startsWith('heater_'))
|
||||
return 'SET_HEATER_TEMPERATURE'
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
get commandAttributeName() {
|
||||
if (this.command === 'SET_HEATER_TEMPERATURE') return 'HEATER'
|
||||
if (this.command === 'SET_TEMPERATURE_FAN_TARGET') return 'TEMPERATURE_FAN'
|
||||
|
||||
return ''
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .v-icon._no-focus-style:focus::after {
|
||||
opacity: 0 !important;
|
||||
}
|
||||
|
||||
::v-deep .cursor-pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,34 @@
|
||||
<template>
|
||||
<div>
|
||||
<temperature-panel-list-item-additional-sensor-value
|
||||
v-for="keyName of additionalValues"
|
||||
:key="keyName"
|
||||
:printer-object="printerObject"
|
||||
:object-name="objectName"
|
||||
:key-name="keyName" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Component from 'vue-class-component'
|
||||
import { Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
|
||||
@Component
|
||||
export default class TemperaturePanelListItemAdditionalSensor extends Mixins(BaseMixin) {
|
||||
@Prop({ type: String, required: true }) readonly objectName!: string
|
||||
@Prop({ type: String, required: true }) readonly additionalObjectName!: string
|
||||
|
||||
get printerObject() {
|
||||
if (!(this.additionalObjectName in this.$store.state.printer)) return {}
|
||||
|
||||
return this.$store.state.printer[this.additionalObjectName]
|
||||
}
|
||||
|
||||
get additionalValues() {
|
||||
if (this.objectName === 'z_thermal_adjust') return ['current_z_adjust']
|
||||
|
||||
return Object.keys(this.printerObject).filter((key) => key !== 'temperature')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,70 @@
|
||||
<template>
|
||||
<div v-if="isVisible">
|
||||
<small>{{ formatValue }}</small>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Component from 'vue-class-component'
|
||||
import { Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
|
||||
@Component
|
||||
export default class TemperaturePanelListItemAdditionalSensorValue extends Mixins(BaseMixin) {
|
||||
@Prop({ type: Object, required: true }) readonly printerObject!: { [key: string]: number }
|
||||
@Prop({ type: String, required: true }) readonly objectName!: string
|
||||
@Prop({ type: String, required: true }) readonly keyName!: string
|
||||
|
||||
get value() {
|
||||
const value = this.printerObject[this.keyName] ?? null
|
||||
if (isNaN(value)) return null
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
get formatValue() {
|
||||
let value = this.value?.toFixed(1)
|
||||
if (this.value === null) value = '--'
|
||||
|
||||
// get unit
|
||||
let unit: string | null = null
|
||||
switch (this.keyName) {
|
||||
case 'pressure':
|
||||
unit = 'hPa'
|
||||
break
|
||||
case 'humidity':
|
||||
unit = '%'
|
||||
break
|
||||
case 'current_z_adjust':
|
||||
unit = 'mm'
|
||||
break
|
||||
}
|
||||
|
||||
// format value for current_z_adjust
|
||||
if (this.keyName === 'current_z_adjust' && this.value) {
|
||||
value = this.value.toFixed(3)
|
||||
|
||||
// convert z_adjust value if it is smaller than 0.1 to μm
|
||||
if (Math.abs(this.value) < 0.1) {
|
||||
value = Math.round(this.value * 1000).toString()
|
||||
unit = 'μm'
|
||||
}
|
||||
}
|
||||
|
||||
return unit ? `${value} ${unit}` : value
|
||||
}
|
||||
|
||||
get guiSetting() {
|
||||
return this.$store.getters['gui/getDatasetAdditionalSensorValue']({
|
||||
name: this.objectName,
|
||||
sensor: this.keyName,
|
||||
})
|
||||
}
|
||||
|
||||
get isVisible() {
|
||||
if (this.value === null) return false
|
||||
|
||||
return this.guiSetting
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,90 @@
|
||||
<template>
|
||||
<v-dialog v-model="boolShow" persistent :width="400">
|
||||
<panel :title="formatName" :icon="icon" card-class="temperature-edit-heater-dialog" :margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="closeDialog">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text class="pt-6">
|
||||
<temperature-panel-list-item-edit-chart-serie
|
||||
v-for="dataset in chartSeries"
|
||||
:key="dataset"
|
||||
:object-name="objectName"
|
||||
:serie-name="dataset" />
|
||||
<temperature-panel-list-item-edit-additional-sensor
|
||||
v-for="additionalSensor in additionalValues"
|
||||
:key="additionalSensor"
|
||||
:object-name="objectName"
|
||||
:additional-sensor="additionalSensor" />
|
||||
<v-row>
|
||||
<v-col class="col-12 text-center pb-0">
|
||||
<v-color-picker
|
||||
hide-mode-switch
|
||||
mode="hexa"
|
||||
:value="color"
|
||||
class="mx-auto"
|
||||
@update:color="setChartColor" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Component from 'vue-class-component'
|
||||
import { Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { mdiCloseThick } from '@mdi/js'
|
||||
import TemperaturePanelListItemEditChartSerie from '@/components/panels/Temperature/TemperaturePanelListItemEditChartSerie.vue'
|
||||
import TemperaturePanelListItemEditAdditionalSensor from '@/components/panels/Temperature/TemperaturePanelListItemEditAdditionalSensor.vue'
|
||||
import { Debounce } from 'vue-debounce-decorator'
|
||||
|
||||
@Component({
|
||||
components: { TemperaturePanelListItemEditAdditionalSensor, TemperaturePanelListItemEditChartSerie },
|
||||
})
|
||||
export default class TemperaturePanelListItemEdit extends Mixins(BaseMixin) {
|
||||
mdiCloseThick = mdiCloseThick
|
||||
|
||||
@Prop({ type: Boolean, required: true }) readonly boolShow!: boolean
|
||||
@Prop({ type: String, required: true }) readonly objectName!: string
|
||||
@Prop({ type: String, required: true }) readonly name!: string
|
||||
@Prop({ required: true }) readonly additionalSensorName!: string | null
|
||||
@Prop({ type: String, required: true }) readonly formatName!: string
|
||||
@Prop({ type: String, required: true }) readonly icon!: string
|
||||
@Prop({ type: String, required: true }) readonly color!: string
|
||||
|
||||
get chartSeries() {
|
||||
return this.$store.getters['printer/tempHistory/getSerieNames'](this.objectName) ?? []
|
||||
}
|
||||
|
||||
get printerObjectAdditionalSensor() {
|
||||
if (this.additionalSensorName === null || !(this.additionalSensorName in this.$store.state.printer)) return {}
|
||||
|
||||
return this.$store.state.printer[this.additionalSensorName]
|
||||
}
|
||||
|
||||
get additionalValues() {
|
||||
if (this.objectName === 'z_thermal_adjust') return ['current_z_adjust']
|
||||
|
||||
return Object.keys(this.printerObjectAdditionalSensor).filter((key) => key !== 'temperature')
|
||||
}
|
||||
|
||||
@Debounce(500)
|
||||
setChartColor(value: string | any): void {
|
||||
if (typeof value === 'object' && 'hex' in value) value = value.hex
|
||||
|
||||
this.$store.dispatch('gui/setChartColor', {
|
||||
objectName: this.objectName,
|
||||
value,
|
||||
})
|
||||
|
||||
this.$store.dispatch('printer/tempHistory/setColor', { name: this.objectName, value })
|
||||
}
|
||||
|
||||
closeDialog() {
|
||||
this.$emit('close-dialog')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<v-row>
|
||||
<v-col class="col-12 py-1">
|
||||
<v-checkbox v-model="value" :label="label" hide-details class="mt-0" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Component from 'vue-class-component'
|
||||
import { Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
|
||||
@Component
|
||||
export default class TemperaturePanelListItemEditAdditionalSensor extends Mixins(BaseMixin) {
|
||||
@Prop({ type: String, required: true }) readonly objectName!: string
|
||||
@Prop({ type: String, required: true }) readonly additionalSensor!: string
|
||||
|
||||
get value() {
|
||||
return this.$store.getters['gui/getDatasetAdditionalSensorValue']({
|
||||
name: this.objectName,
|
||||
type: this.additionalSensor,
|
||||
})
|
||||
}
|
||||
|
||||
set value(newVal) {
|
||||
this.$store.dispatch('gui/setDatasetAdditionalSensorStatus', {
|
||||
objectName: this.objectName,
|
||||
dataset: this.additionalSensor,
|
||||
value: newVal,
|
||||
})
|
||||
}
|
||||
|
||||
get label() {
|
||||
return this.$t('Panels.TemperaturePanel.ShowNameInList', {
|
||||
name: this.additionalSensor,
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<v-row>
|
||||
<v-col class="py-1">
|
||||
<v-checkbox v-model="value" :label="label" hide-details class="mt-0" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Component from 'vue-class-component'
|
||||
import { Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { capitalize } from '@/plugins/helpers'
|
||||
|
||||
@Component
|
||||
export default class TemperaturePanelListItemEditChartSerie extends Mixins(BaseMixin) {
|
||||
@Prop({ type: String, required: true }) readonly objectName!: string
|
||||
@Prop({ type: String, required: true }) readonly serieName!: string
|
||||
|
||||
get value() {
|
||||
return this.$store.getters['gui/getDatasetValue']({ name: this.objectName, type: this.serieName })
|
||||
}
|
||||
|
||||
get label() {
|
||||
return this.$t('Panels.TemperaturePanel.ShowNameInChart', {
|
||||
name: this.formatSerieName,
|
||||
})
|
||||
}
|
||||
|
||||
set value(newVal) {
|
||||
this.$store.dispatch('gui/setChartDatasetStatus', {
|
||||
objectName: this.objectName,
|
||||
dataset: this.serieName,
|
||||
value: newVal,
|
||||
})
|
||||
}
|
||||
|
||||
get formatSerieName() {
|
||||
return capitalize(this.serieName)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,113 @@
|
||||
<template>
|
||||
<div style="height: 100%">
|
||||
<v-menu v-if="presets.length" :offset-y="true" left>
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-btn
|
||||
text
|
||||
tile
|
||||
color="primary"
|
||||
v-bind="attrs"
|
||||
:disabled="['printing', 'paused'].includes(printer_state)"
|
||||
class="pa-1"
|
||||
v-on="on">
|
||||
<span class="d-none ml-1 d-md-block">{{ $t('Panels.TemperaturePanel.Presets') }}</span>
|
||||
<v-icon class="d-md-none">{{ mdiFire }}</v-icon>
|
||||
<v-icon>{{ mdiMenuDown }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-list dense class="py-0">
|
||||
<v-list-item v-for="(preset, index) of presets" :key="index" link @click="preheat(preset)">
|
||||
<div class="d-flex align-center _preset-title">
|
||||
<v-icon small class="mr-1">{{ mdiFire }}</v-icon>
|
||||
<span style="padding-top: 2px">{{ preset.name }}</span>
|
||||
</div>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
<v-divider class="_fix_transparency" />
|
||||
<v-list dense class="py-0">
|
||||
<v-list-item link @click="cooldown">
|
||||
<div class="d-flex align-center _preset-title">
|
||||
<v-icon small color="primary" class="mr-1">{{ mdiSnowflake }}</v-icon>
|
||||
<span class="primary--text">{{ $t('Panels.TemperaturePanel.Cooldown') }}</span>
|
||||
</div>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
<v-btn
|
||||
v-else
|
||||
:icon="$vuetify.breakpoint.smAndDown"
|
||||
:text="$vuetify.breakpoint.mdAndUp"
|
||||
tile
|
||||
color="primary"
|
||||
@click="cooldown">
|
||||
<v-icon small>{{ mdiSnowflake }}</v-icon>
|
||||
<span class="d-none ml-1 d-md-inline">{{ $t('Panels.TemperaturePanel.Cooldown') }}</span>
|
||||
</v-btn>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Component from 'vue-class-component'
|
||||
import { Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { GuiPresetsStatePreset } from '@/store/gui/presets/types'
|
||||
import { mdiFire, mdiMenuDown, mdiSnowflake } from '@mdi/js'
|
||||
|
||||
@Component
|
||||
export default class TemperaturePanelPresets extends Mixins(BaseMixin) {
|
||||
mdiFire = mdiFire
|
||||
mdiMenuDown = mdiMenuDown
|
||||
mdiSnowflake = mdiSnowflake
|
||||
|
||||
get presets(): GuiPresetsStatePreset[] {
|
||||
return this.$store.getters['gui/presets/getPresets'] ?? []
|
||||
}
|
||||
|
||||
get cooldownGcode(): string {
|
||||
return this.$store.getters['gui/presets/getCooldownGcode']
|
||||
}
|
||||
|
||||
preheat(preset: GuiPresetsStatePreset): void {
|
||||
for (const [name, attributes] of Object.entries(preset.values)) {
|
||||
if (attributes.bool) {
|
||||
let gcode = `SET_HEATER_TEMPERATURE HEATER=${name} TARGET=${attributes.value}`
|
||||
|
||||
if (attributes.type === 'temperature_fan') {
|
||||
const fanName = name.replace('temperature_fan ', '')
|
||||
gcode = `SET_TEMPERATURE_FAN_TARGET temperature_fan=${fanName} TARGET=${attributes.value}`
|
||||
}
|
||||
|
||||
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: gcode })
|
||||
}
|
||||
}
|
||||
|
||||
if (preset.gcode !== '') {
|
||||
setTimeout(() => {
|
||||
this.$store.dispatch('server/addEvent', { message: preset.gcode, type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: preset.gcode })
|
||||
}, 100)
|
||||
}
|
||||
}
|
||||
|
||||
cooldown(): void {
|
||||
this.$store.dispatch('server/addEvent', { message: this.cooldownGcode, type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: this.cooldownGcode })
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
._preset-title {
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/*
|
||||
workaround for fixing a transparency issue
|
||||
which is assumingly a vuetify bug
|
||||
*/
|
||||
._fix_transparency {
|
||||
background-color: #1e1e1e;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<v-menu :offset-y="true" :close-on-content-click="false" :title="$t('Panels.TemperaturePanel.SetupTemperatures')">
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-btn icon tile v-bind="attrs" v-on="on">
|
||||
<v-icon small>{{ mdiCog }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-list>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox
|
||||
v-model="boolTempchart"
|
||||
class="mt-0"
|
||||
hide-details
|
||||
:label="$t('Panels.TemperaturePanel.ShowChart')" />
|
||||
</v-list-item>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox
|
||||
v-model="autoscaleTempchart"
|
||||
class="mt-0"
|
||||
hide-details
|
||||
:label="$t('Panels.TemperaturePanel.AutoscaleChart')" />
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Component from 'vue-class-component'
|
||||
import { Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { mdiCog } from '@mdi/js'
|
||||
|
||||
@Component
|
||||
export default class TemperaturePanelSettings extends Mixins(BaseMixin) {
|
||||
mdiCog = mdiCog
|
||||
|
||||
get boolTempchart(): boolean {
|
||||
return this.$store.state.gui.view.tempchart.boolTempchart ?? false
|
||||
}
|
||||
|
||||
set boolTempchart(newVal: boolean) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'view.tempchart.boolTempchart', value: newVal })
|
||||
}
|
||||
|
||||
get autoscaleTempchart(): boolean {
|
||||
return this.$store.state.gui.view.tempchart.autoscale ?? false
|
||||
}
|
||||
|
||||
set autoscaleTempchart(newVal: boolean) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'view.tempchart.autoscale', value: newVal })
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,431 +1,49 @@
|
||||
<template>
|
||||
<div>
|
||||
<panel
|
||||
v-if="klipperReadyForGui"
|
||||
:icon="mdiThermometerLines"
|
||||
:title="$t('Panels.TemperaturePanel.Headline').toString()"
|
||||
:collapsible="true"
|
||||
card-class="temperature-panel">
|
||||
<!-- PRESET MENU -->
|
||||
<template #buttons>
|
||||
<v-menu v-if="presets.length" :offset-y="true" left title="Preheat">
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-btn
|
||||
text
|
||||
tile
|
||||
color="primary"
|
||||
v-bind="attrs"
|
||||
:disabled="['printing', 'paused'].includes(printer_state)"
|
||||
class="pa-1"
|
||||
v-on="on">
|
||||
<span class="d-none ml-1 d-md-block">{{ $t('Panels.TemperaturePanel.Presets') }}</span>
|
||||
<v-icon class="d-md-none">{{ mdiFire }}</v-icon>
|
||||
<v-icon>{{ mdiMenuDown }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-list dense class="py-0">
|
||||
<v-list-item v-for="preset of presets" :key="preset.index" link @click="preheat(preset)">
|
||||
<div class="d-flex align-center _preset-title">
|
||||
<v-icon small class="mr-1">{{ mdiFire }}</v-icon>
|
||||
<span style="padding-top: 2px">{{ preset.name }}</span>
|
||||
</div>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
<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">
|
||||
<v-icon small color="primary" class="mr-1">{{ mdiSnowflake }}</v-icon>
|
||||
<span class="primary--text">{{ $t('Panels.TemperaturePanel.Cooldown') }}</span>
|
||||
</div>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
<v-btn
|
||||
v-if="presets.length === 0"
|
||||
:icon="$vuetify.breakpoint.smAndDown"
|
||||
:text="$vuetify.breakpoint.mdAndUp"
|
||||
tile
|
||||
color="primary"
|
||||
@click="cooldown()">
|
||||
<v-icon small>{{ mdiSnowflake }}</v-icon>
|
||||
<span class="d-none ml-1 d-md-inline">{{ $t('Panels.TemperaturePanel.Cooldown') }}</span>
|
||||
</v-btn>
|
||||
<v-menu
|
||||
:offset-y="true"
|
||||
:close-on-content-click="false"
|
||||
:title="$t('Panels.TemperaturePanel.SetupTemperatures')">
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-btn icon tile v-bind="attrs" v-on="on">
|
||||
<v-icon small>{{ mdiCog }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-list>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox
|
||||
v-model="boolTempchart"
|
||||
class="mt-0"
|
||||
hide-details
|
||||
:label="$t('Panels.TemperaturePanel.ShowChart')"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox
|
||||
v-model="autoscaleTempchart"
|
||||
class="mt-0"
|
||||
hide-details
|
||||
:label="$t('Panels.TemperaturePanel.AutoscaleChart')"></v-checkbox>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
<panel
|
||||
v-if="klipperReadyForGui"
|
||||
:icon="mdiThermometerLines"
|
||||
:title="$t('Panels.TemperaturePanel.Headline')"
|
||||
:collapsible="true"
|
||||
card-class="temperature-panel">
|
||||
<template #buttons>
|
||||
<temperature-panel-presets />
|
||||
<temperature-panel-settings />
|
||||
</template>
|
||||
<v-card-text class="pa-0">
|
||||
<temperature-panel-list />
|
||||
<template v-if="boolTempchart">
|
||||
<v-divider class="my-0" />
|
||||
<temp-chart />
|
||||
</template>
|
||||
<v-card-text class="pa-0">
|
||||
<responsive
|
||||
:breakpoints="{
|
||||
mobile: (el) => el.width <= 395,
|
||||
}">
|
||||
<template #default="{ el }">
|
||||
<v-simple-table class="temperature-panel-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="icon"> </th>
|
||||
<th class="name">{{ $t('Panels.TemperaturePanel.Name') }}</th>
|
||||
<th v-if="!el.is.mobile" class="state">
|
||||
{{ $t('Panels.TemperaturePanel.State') }}
|
||||
</th>
|
||||
<th class="current">
|
||||
{{ $t('Panels.TemperaturePanel.Current') }}
|
||||
</th>
|
||||
<th class="target">
|
||||
{{ $t('Panels.TemperaturePanel.Target') }}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(object, index) in temperatureObjects" :key="index">
|
||||
<td class="icon">
|
||||
<v-icon
|
||||
:color="object.iconColor"
|
||||
:class="`_no-focus-style ${object.iconClass}`"
|
||||
style="cursor: pointer"
|
||||
tabindex="-1"
|
||||
@click="openHeater(object)">
|
||||
{{ object.icon }}
|
||||
</v-icon>
|
||||
</td>
|
||||
<td class="name">
|
||||
<span style="cursor: pointer" @click="openHeater(object)">
|
||||
{{ convertName(object.name) }}
|
||||
</span>
|
||||
</td>
|
||||
<td v-if="!el.is.mobile" class="state">
|
||||
<v-tooltip v-if="object.state !== null" top>
|
||||
<template #activator="{ on, attrs }">
|
||||
<div v-bind="attrs" v-on="on">
|
||||
{{ object.state }}
|
||||
</div>
|
||||
</template>
|
||||
<span>{{ $t('Panels.TemperaturePanel.Avg') }}: {{ object.avgState }}</span>
|
||||
</v-tooltip>
|
||||
</td>
|
||||
<td class="current">
|
||||
<v-tooltip
|
||||
top
|
||||
:disabled="
|
||||
!(
|
||||
object.measured_min_temp !== null ||
|
||||
object.measured_max_temp !== null
|
||||
)
|
||||
">
|
||||
<template #activator="{ on, attrs }">
|
||||
<span style="cursor: default" v-bind="attrs" v-on="on">
|
||||
{{ object.temperature.toFixed(1) }}°C
|
||||
</span>
|
||||
</template>
|
||||
<span>
|
||||
{{ $t('Panels.TemperaturePanel.Max') }}:
|
||||
{{ object.measured_max_temp }}°C
|
||||
<br />
|
||||
{{ $t('Panels.TemperaturePanel.Min') }}:
|
||||
{{ object.measured_min_temp }}°C
|
||||
</span>
|
||||
</v-tooltip>
|
||||
<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 }} RPM</small>
|
||||
</div>
|
||||
</td>
|
||||
<td class="target">
|
||||
<temperature-input
|
||||
v-if="object.command !== null"
|
||||
:name="object.name"
|
||||
:target="object.target"
|
||||
:presets="object.presets"
|
||||
:min_temp="object.min_temp"
|
||||
:max_temp="object.max_temp"
|
||||
:command="object.command"
|
||||
:attribute-name="object.commandAttributeName"></temperature-input>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</v-simple-table>
|
||||
</template>
|
||||
</responsive>
|
||||
</v-card-text>
|
||||
<v-card-text v-if="boolTempchart" class="pa-0 d-inline-block">
|
||||
<v-divider class="mt-0 mb-2"></v-divider>
|
||||
<v-row>
|
||||
<v-col class="py-0">
|
||||
<temp-chart></temp-chart>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
<!-- COLOR-PICKER -->
|
||||
<v-dialog v-model="editHeater.bool" persistent :width="400">
|
||||
<panel
|
||||
:title="convertName(editHeater.name)"
|
||||
:icon="editHeater.icon"
|
||||
card-class="temperature-edit-heater-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="editHeater.bool = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text class="pt-6">
|
||||
<v-row v-for="dataset in editHeater.chartSeries" :key="dataset">
|
||||
<v-col class="col-12 py-1">
|
||||
<v-checkbox
|
||||
v-model="editHeater['bool' + dataset.charAt(0).toUpperCase() + dataset.slice(1)]"
|
||||
:label="
|
||||
$t('Panels.TemperaturePanel.ShowNameInChart', {
|
||||
name: $t(`Panels.TemperaturePanel.Dataset.${capitalize(dataset)}`),
|
||||
})
|
||||
"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
@change="setVisible(dataset)"></v-checkbox>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-for="additionalSensor in editHeater.additionalSensors" :key="additionalSensor.name">
|
||||
<v-col class="col-12 py-1">
|
||||
<v-checkbox
|
||||
v-model="additionalSensor.bool"
|
||||
:label="$t('Panels.TemperaturePanel.ShowNameInList', { name: additionalSensor.name })"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
@change="setVisibleAdditionalSensor(additionalSensor)"></v-checkbox>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="col-12 text-center pb-0">
|
||||
<v-color-picker
|
||||
hide-mode-switch
|
||||
mode="hexa"
|
||||
:value="editHeater.color"
|
||||
class="mx-auto"
|
||||
@update:color="setChartColor"></v-color-picker>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Component from 'vue-class-component'
|
||||
import { Mixins } from 'vue-property-decorator'
|
||||
import { capitalize, convertName } from '@/plugins/helpers'
|
||||
import { Debounce } from 'vue-debounce-decorator'
|
||||
import { GuiPresetsStatePreset } from '@/store/gui/presets/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 { mdiCloseThick, mdiCog, mdiSnowflake, mdiFire, mdiMenuDown, mdiThermometerLines } from '@mdi/js'
|
||||
import { mdiCloseThick, mdiThermometerLines } from '@mdi/js'
|
||||
import TemperaturePanelPresets from '@/components/panels/Temperature/TemperaturePanelPresets.vue'
|
||||
|
||||
@Component({
|
||||
components: { Panel, TempChart, TemperatureInput, Responsive },
|
||||
components: { Panel, TempChart, TemperatureInput, Responsive, TemperaturePanelPresets },
|
||||
})
|
||||
export default class TemperaturePanel extends Mixins(BaseMixin, ControlMixin) {
|
||||
mdiSnowflake = mdiSnowflake
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiCog = mdiCog
|
||||
mdiFire = mdiFire
|
||||
mdiMenuDown = mdiMenuDown
|
||||
mdiThermometerLines = mdiThermometerLines
|
||||
|
||||
convertName = convertName
|
||||
capitalize = capitalize
|
||||
|
||||
private editHeater: any = {
|
||||
bool: false,
|
||||
name: '',
|
||||
icon: '',
|
||||
boolTemperature: false,
|
||||
boolTarget: false,
|
||||
boolPower: false,
|
||||
boolSpeed: false,
|
||||
additionalSensors: {},
|
||||
color: '',
|
||||
}
|
||||
|
||||
get presets(): GuiPresetsStatePreset[] {
|
||||
return this.$store.getters['gui/presets/getPresets'] ?? []
|
||||
}
|
||||
|
||||
get cooldownGcode(): string {
|
||||
return this.$store.getters['gui/presets/getCooldownGcode']
|
||||
}
|
||||
|
||||
get boolTempchart(): boolean {
|
||||
return this.$store.state.gui.view.tempchart.boolTempchart ?? false
|
||||
}
|
||||
|
||||
set boolTempchart(newVal: boolean) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'view.tempchart.boolTempchart', value: newVal })
|
||||
}
|
||||
|
||||
get autoscaleTempchart(): boolean {
|
||||
return this.$store.state.gui.view.tempchart.autoscale ?? false
|
||||
}
|
||||
|
||||
set autoscaleTempchart(newVal: boolean) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'view.tempchart.autoscale', value: newVal })
|
||||
}
|
||||
|
||||
get temperatureObjects() {
|
||||
return this.$store.getters['printer/getTemperatureObjects'] ?? []
|
||||
}
|
||||
|
||||
preheat(preset: GuiPresetsStatePreset): void {
|
||||
for (const [name, attributes] of Object.entries(preset.values)) {
|
||||
if (attributes.bool) {
|
||||
let gcode = `SET_HEATER_TEMPERATURE HEATER=${name} TARGET=${attributes.value}`
|
||||
|
||||
if (attributes.type === 'temperature_fan') {
|
||||
const fanName = name.replace('temperature_fan ', '')
|
||||
gcode = `SET_TEMPERATURE_FAN_TARGET temperature_fan=${fanName} TARGET=${attributes.value}`
|
||||
}
|
||||
|
||||
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: gcode })
|
||||
}
|
||||
}
|
||||
|
||||
if (preset.gcode !== '') {
|
||||
setTimeout(() => {
|
||||
this.$store.dispatch('server/addEvent', { message: preset.gcode, type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: preset.gcode })
|
||||
}, 100)
|
||||
}
|
||||
}
|
||||
|
||||
cooldown(): void {
|
||||
this.$store.dispatch('server/addEvent', { message: this.cooldownGcode, type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: this.cooldownGcode })
|
||||
}
|
||||
|
||||
openHeater(object: PrinterStateTemperatureObject): void {
|
||||
this.editHeater.name = object.name
|
||||
this.editHeater.icon = object.icon
|
||||
|
||||
this.editHeater.color = object.chartColor
|
||||
this.editHeater.chartSeries = 'chartSeries' in object ? object.chartSeries : []
|
||||
this.editHeater.boolTemperature = this.$store.getters['gui/getDatasetValue']({
|
||||
name: object.name,
|
||||
type: 'temperature',
|
||||
})
|
||||
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.additionalSensors = object.additionalSensors
|
||||
|
||||
this.editHeater.bool = true
|
||||
}
|
||||
|
||||
setVisible(type: string): void {
|
||||
const serieName = 'bool' + type.charAt(0).toUpperCase() + type.slice(1)
|
||||
const value = this.editHeater[serieName]
|
||||
|
||||
const name = 'view.tempchart.datasetSettings.' + this.editHeater.name + '.' + type
|
||||
this.$store.dispatch('gui/saveSetting', { name, value })
|
||||
}
|
||||
|
||||
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)
|
||||
setChartColor(value: string | any): void {
|
||||
if (typeof value === 'object' && 'hex' in value) value = value.hex
|
||||
this.$store.commit('printer/tempHistory/setColor', { name: this.editHeater.name, value: value })
|
||||
|
||||
const name = 'view.tempchart.datasetSettings.' + this.editHeater.name + '.color'
|
||||
this.$store.dispatch('gui/saveSetting', { name, value })
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.canvasjs-chart-tooltip > div {
|
||||
border-radius: 10px !important;
|
||||
}
|
||||
|
||||
._preset-title {
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.v-icon._no-focus-style:focus::after {
|
||||
opacity: 0 !important;
|
||||
}
|
||||
|
||||
.temperature-panel-table th,
|
||||
.temperature-panel-table td {
|
||||
padding-top: 5px !important;
|
||||
padding-bottom: 5px !important;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
.temperature-panel-table tr:hover {
|
||||
background: none !important;
|
||||
}
|
||||
|
||||
.temperature-panel-table .icon {
|
||||
width: 24px;
|
||||
padding-right: 0 !important;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.temperature-panel-table .state {
|
||||
width: 100px;
|
||||
text-align: right !important;
|
||||
}
|
||||
|
||||
.temperature-panel-table .current {
|
||||
width: 100px;
|
||||
text-align: right !important;
|
||||
}
|
||||
|
||||
.temperature-panel-table .target {
|
||||
width: 140px;
|
||||
}
|
||||
|
||||
/*
|
||||
workaround for fixing a transparency issue
|
||||
which is assumingly a vuetify bug
|
||||
*/
|
||||
._fix_transparency {
|
||||
background-color: #1e1e1e;
|
||||
}
|
||||
</style>
|
||||
@@ -1,21 +1,7 @@
|
||||
<style scoped>
|
||||
.v-data-table .v-data-table-header__icon {
|
||||
margin-left: 7px;
|
||||
}
|
||||
|
||||
.v-data-table th {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.v-data-table .file-list-cursor:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<panel
|
||||
:title="$t('Timelapse.TimelapseFiles').toString()"
|
||||
:title="$t('Timelapse.TimelapseFiles')"
|
||||
:icon="mdiFileDocumentMultipleOutline"
|
||||
card-class="timelapse-files-panel">
|
||||
<v-card-text>
|
||||
@@ -32,6 +18,15 @@
|
||||
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')"
|
||||
@@ -208,7 +203,7 @@
|
||||
<v-list-item
|
||||
v-if="!contextMenu.item.isDirectory && contextMenu.item.permissions.includes('w')"
|
||||
class="red--text"
|
||||
@click="removeFile">
|
||||
@click="deleteDialog = true">
|
||||
<v-icon class="mr-1" color="error">{{ mdiDelete }}</v-icon>
|
||||
{{ $t('Timelapse.Delete') }}
|
||||
</v-list-item>
|
||||
@@ -223,7 +218,7 @@
|
||||
</v-menu>
|
||||
<v-dialog v-model="dialogRenameFile.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Timelapse.RenameFile').toString()"
|
||||
:title="$t('Timelapse.RenameFile')"
|
||||
card-class="gcode-files-rename-file-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -238,7 +233,7 @@
|
||||
:label="$t('Timelapse.Name')"
|
||||
required
|
||||
:rules="nameInputRules"
|
||||
@update:error="isInvalidName = !isInvalidName"
|
||||
@update:error="(bool) => (isInvalidName = bool)"
|
||||
@keypress.enter="renameFileAction"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
@@ -252,7 +247,7 @@
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogCreateDirectory.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Timelapse.NewDirectory').toString()"
|
||||
:title="$t('Timelapse.NewDirectory')"
|
||||
card-class="gcode-files-new-directory-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -267,7 +262,7 @@
|
||||
:label="$t('Timelapse.Name')"
|
||||
required
|
||||
:rules="nameInputRules"
|
||||
@update:error="isInvalidName = !isInvalidName"
|
||||
@update:error="(bool) => (isInvalidName = bool)"
|
||||
@keypress.enter="createDirectoryAction"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
@@ -283,7 +278,7 @@
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogRenameDirectory.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Timelapse.RenameDirectory').toString()"
|
||||
:title="$t('Timelapse.RenameDirectory')"
|
||||
card-class="gcode-files-rename-directory-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -298,7 +293,7 @@
|
||||
:label="$t('Timelapse.Name')"
|
||||
required
|
||||
:rules="nameInputRules"
|
||||
@update:error="isInvalidName = !isInvalidName"
|
||||
@update:error="(bool) => (isInvalidName = bool)"
|
||||
@keyup.enter="renameDirectoryAction"></v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
@@ -314,7 +309,7 @@
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogDeleteDirectory.show" max-width="400">
|
||||
<panel
|
||||
:title="$t('Timelapse.DeleteDirectory').toString()"
|
||||
:title="$t('Timelapse.DeleteDirectory')"
|
||||
card-class="gcode-files-delete-directory-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
@@ -338,7 +333,7 @@
|
||||
</v-dialog>
|
||||
<v-dialog v-model="boolVideoDialog" :max-width="700">
|
||||
<panel
|
||||
:title="$t('Timelapse.Video').toString()"
|
||||
:title="$t('Timelapse.Video')"
|
||||
:icon="mdiFileVideo"
|
||||
card-class="timelapse-video-dialog"
|
||||
:margin-bottom="false">
|
||||
@@ -371,18 +366,47 @@
|
||||
</v-card-text>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
|
||||
<!-- CONFIRM DELETE SINGLE FILE DIALOG -->
|
||||
<v-dialog v-model="deleteDialog" max-width="400">
|
||||
<panel :title="$t('Timelapse.Delete')" card-class="timelapse-delete-dialog" :margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="deleteDialog = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<p class="mb-0">
|
||||
{{ $t('Timelapse.DeleteSingleFileQuestion', { name: contextMenu.item.filename }) }}
|
||||
</p>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="" text @click="deleteDialog = false">
|
||||
{{ $t('Timelapse.Cancel') }}
|
||||
</v-btn>
|
||||
<v-btn color="error" text @click="removeFile">
|
||||
{{ $t('Timelapse.Delete') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
|
||||
<!-- CONFIRM DELETE MULTIPLE FILES DIALOG -->
|
||||
<v-dialog v-model="deleteSelectedDialog" max-width="400">
|
||||
<panel
|
||||
:title="$t('Timelapse.Delete').toString()"
|
||||
card-class="timelapse-delete-selected-dialog"
|
||||
:margin-bottom="false">
|
||||
<panel :title="$t('Timelapse.Delete')" 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>
|
||||
<p v-if="selectedFiles.length === 1" class="mb-0">
|
||||
{{ $t('Timelapse.DeleteSingleFileQuestion', { name: selectedFiles[0].filename }) }}
|
||||
</p>
|
||||
<p v-else class="mb-0">
|
||||
{{ $t('Timelapse.DeleteSelectedQuestion', { count: selectedFiles.length }) }}
|
||||
</p>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
@@ -504,6 +528,7 @@ export default class TimelapseFilesPanel extends Mixins(BaseMixin) {
|
||||
},
|
||||
}
|
||||
|
||||
private deleteDialog = false
|
||||
private deleteSelectedDialog = false
|
||||
|
||||
private isInvalidName = true
|
||||
@@ -692,6 +717,46 @@ 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.slice(0, posLastPoint)
|
||||
@@ -788,6 +853,8 @@ export default class TimelapseFilesPanel extends Mixins(BaseMixin) {
|
||||
{ path: this.currentPath + '/' + previewFilename },
|
||||
{ action: 'files/getDeleteFile' }
|
||||
)
|
||||
|
||||
this.deleteDialog = false
|
||||
}
|
||||
|
||||
deleteDirectory(item: FileStateFile) {
|
||||
@@ -844,3 +911,17 @@ export default class TimelapseFilesPanel extends Mixins(BaseMixin) {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.v-data-table .v-data-table-header__icon {
|
||||
margin-left: 7px;
|
||||
}
|
||||
|
||||
.v-data-table th {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.v-data-table .file-list-cursor:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
@@ -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>
|
||||
@@ -6,7 +6,8 @@
|
||||
:icon="mdiWebcam"
|
||||
:title="$t('Panels.WebcamPanel.Headline')"
|
||||
:collapsible="$route.fullPath !== '/cam'"
|
||||
card-class="webcam-panel">
|
||||
card-class="webcam-panel"
|
||||
:margin-bottom="currentPage !== 'page'">
|
||||
<template v-if="webcams.length > 1" #buttons>
|
||||
<v-menu :offset-y="true" title="Webcam">
|
||||
<template #activator="{ on, attrs }">
|
||||
@@ -27,7 +28,7 @@
|
||||
<v-list-item-title>{{ $t('Panels.WebcamPanel.All') }}</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
<v-list-item v-for="webcam of webcams" :key="webcam.id" link @click="currentCamId = webcam.id">
|
||||
<v-list-item v-for="webcam of webcams" :key="webcam.name" link @click="currentCamId = webcam.name">
|
||||
<v-list-item-icon class="mr-2">
|
||||
<v-icon small class="mt-1">{{ convertWebcamIcon(webcam.icon) }}</v-icon>
|
||||
</v-list-item-icon>
|
||||
@@ -41,24 +42,7 @@
|
||||
<v-card-text v-if="webcams.length" class="px-0 py-0 content d-inline-block">
|
||||
<v-row>
|
||||
<v-col class="pb-0" style="position: relative">
|
||||
<template v-if="currentCam.service === 'grid'">
|
||||
<webcam-grid :webcams="webcams"></webcam-grid>
|
||||
</template>
|
||||
<template v-else-if="currentCam.service === 'mjpegstreamer'">
|
||||
<webcam-mjpegstreamer :cam-settings="currentCam"></webcam-mjpegstreamer>
|
||||
</template>
|
||||
<template v-else-if="currentCam.service === 'mjpegstreamer-adaptive'">
|
||||
<webcam-mjpegstreamer-adaptive :cam-settings="currentCam"></webcam-mjpegstreamer-adaptive>
|
||||
</template>
|
||||
<template v-else-if="currentCam.service === 'uv4l-mjpeg'">
|
||||
<webcam-uv4l-mjpeg :cam-settings="currentCam"></webcam-uv4l-mjpeg>
|
||||
</template>
|
||||
<template v-else-if="currentCam.service === 'ipstream'">
|
||||
<webcam-ipstreamer :cam-settings="currentCam"></webcam-ipstreamer>
|
||||
</template>
|
||||
<template v-else>
|
||||
<p class="text-center py-3 font-italic">{{ $t('Panels.WebcamPanel.UnknownWebcamService') }}</p>
|
||||
</template>
|
||||
<webcam-wrapper :webcam="currentCam" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
@@ -69,11 +53,6 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Mjpegstreamer from '@/components/webcams/Mjpegstreamer.vue'
|
||||
import MjpegstreamerAdaptive from '@/components/webcams/MjpegstreamerAdaptive.vue'
|
||||
import Ipstreamer from '@/components/webcams/Ipstreamer.vue'
|
||||
import Uv4lMjpeg from '@/components/webcams/Uv4lMjpeg.vue'
|
||||
import WebcamGrid from '@/components/webcams/WebcamGrid.vue'
|
||||
import Component from 'vue-class-component'
|
||||
import { Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '../mixins/base'
|
||||
@@ -85,11 +64,6 @@ import WebcamMixin from '@/components/mixins/webcam'
|
||||
@Component({
|
||||
components: {
|
||||
Panel,
|
||||
'webcam-mjpegstreamer': Mjpegstreamer,
|
||||
'webcam-mjpegstreamer-adaptive': MjpegstreamerAdaptive,
|
||||
'webcam-ipstreamer': Ipstreamer,
|
||||
'webcam-uv4l-mjpeg': Uv4lMjpeg,
|
||||
'webcam-grid': WebcamGrid,
|
||||
},
|
||||
})
|
||||
export default class WebcamPanel extends Mixins(BaseMixin, WebcamMixin) {
|
||||
@@ -103,13 +77,14 @@ export default class WebcamPanel extends Mixins(BaseMixin, WebcamMixin) {
|
||||
return this.$store.getters['gui/webcams/getWebcams']
|
||||
}
|
||||
|
||||
// id changed to name with the refactoring of using moonraker webcam API
|
||||
get currentCamId(): string {
|
||||
if (this.webcams.length === 1) return this.webcams[0].id ?? 'all'
|
||||
if (this.webcams.length === 1) return this.webcams[0].name ?? 'all'
|
||||
|
||||
let currentCamId = this.$store.state.gui.view.webcam.currentCam[this.currentPage ?? ''] ?? 'all'
|
||||
if (this.webcams.findIndex((webcam: GuiWebcamStateWebcam) => webcam.id === currentCamId) !== -1)
|
||||
if (this.webcams.findIndex((webcam: GuiWebcamStateWebcam) => webcam.name === currentCamId) !== -1)
|
||||
return currentCamId
|
||||
else if (currentCamId !== undefined && this.webcams.length === 1) return this.webcams[0].id ?? ''
|
||||
else if (currentCamId !== undefined && this.webcams.length === 1) return this.webcams[0].name ?? ''
|
||||
else return 'all'
|
||||
}
|
||||
|
||||
@@ -118,7 +93,7 @@ export default class WebcamPanel extends Mixins(BaseMixin, WebcamMixin) {
|
||||
}
|
||||
|
||||
get currentCam(): any {
|
||||
const cam = this.webcams.find((cam: GuiWebcamStateWebcam) => cam.id === this.currentCamId)
|
||||
const cam = this.webcams.find((cam: GuiWebcamStateWebcam) => cam.name === this.currentCamId)
|
||||
|
||||
return (
|
||||
cam ?? {
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<template>
|
||||
<settings-row :title="preset.name" :sub-title="subTitle">
|
||||
<v-btn small outlined class="ml-3" @click="editPreset">
|
||||
<v-icon left small>{{ mdiPencil }}</v-icon>
|
||||
{{ $t('Settings.Edit') }}
|
||||
</v-btn>
|
||||
<v-btn small outlined class="ml-3 minwidth-0 px-2" color="error" @click="deletePreset">
|
||||
<v-icon small>{{ mdiDelete }}</v-icon>
|
||||
</v-btn>
|
||||
</settings-row>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import SettingsRow from '@/components/settings/SettingsRow.vue'
|
||||
import { GuiPresetsStatePreset } from '@/store/gui/presets/types'
|
||||
import { convertName } from '@/plugins/helpers'
|
||||
import { mdiDelete, mdiPencil } from '@mdi/js'
|
||||
|
||||
@Component({
|
||||
components: { SettingsRow },
|
||||
})
|
||||
export default class PresetsEntry extends Mixins(BaseMixin) {
|
||||
mdiPencil = mdiPencil
|
||||
mdiDelete = mdiDelete
|
||||
|
||||
@Prop({ required: true }) readonly preset!: GuiPresetsStatePreset
|
||||
|
||||
get subTitle() {
|
||||
let output: string[] = []
|
||||
|
||||
Object.keys(this.preset.values).forEach((key: string) => {
|
||||
const values = this.preset.values[key]
|
||||
|
||||
if (values.bool) {
|
||||
const name = key.indexOf(' ') ? key.slice(key.indexOf(' ') + 1) : key
|
||||
|
||||
output.push(convertName(name) + ': ' + values.value + '°C')
|
||||
}
|
||||
})
|
||||
|
||||
if (this.preset.gcode) output.push(this.$t('Settings.PresetsTab.CustomGCode').toString())
|
||||
|
||||
return output.join(', ')
|
||||
}
|
||||
|
||||
editPreset() {
|
||||
this.$emit('edit', this.preset)
|
||||
}
|
||||
|
||||
deletePreset() {
|
||||
this.$store.dispatch('gui/presets/delete', this.preset.id)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,26 @@
|
||||
<template>
|
||||
<settings-row :title="$t('Settings.PresetsTab.Cooldown')">
|
||||
<v-btn small outlined class="ml-3" @click="editCooldown">
|
||||
<v-icon left small>{{ mdiPencil }}</v-icon>
|
||||
{{ $t('Settings.Edit') }}
|
||||
</v-btn>
|
||||
</settings-row>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import SettingsRow from '@/components/settings/SettingsRow.vue'
|
||||
import { mdiPencil } from '@mdi/js'
|
||||
|
||||
@Component({
|
||||
components: { SettingsRow },
|
||||
})
|
||||
export default class PresetsEntryCooldown extends Mixins(BaseMixin) {
|
||||
mdiPencil = mdiPencil
|
||||
|
||||
editCooldown() {
|
||||
this.$emit('edit')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,182 @@
|
||||
<template>
|
||||
<v-card flat>
|
||||
<v-form v-model="valid" @submit.prevent="savePreset">
|
||||
<v-card-title>{{ title }}</v-card-title>
|
||||
<v-card-text>
|
||||
<v-row v-if="boolInvalidMin" class="mt-3">
|
||||
<v-col class="py-0">
|
||||
<v-alert dense text type="error">{{ $t('Settings.PresetsTab.PresetInfo') }}</v-alert>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<settings-row :title="$t('Settings.PresetsTab.Name')">
|
||||
<v-text-field
|
||||
v-model="preset.name"
|
||||
:placeholder="$t('Settings.PresetsTab.PresetNamePlaceholder')"
|
||||
hide-details="auto"
|
||||
:rules="[rules.required, rules.unique]"
|
||||
dense
|
||||
outlined />
|
||||
</settings-row>
|
||||
<div v-for="(value, key) of preset.values" :key="key">
|
||||
<v-divider class="my-2" />
|
||||
<settings-row :title="converNameObject(key)">
|
||||
<v-checkbox v-model="value.bool" hide-details class="shrink mt-0" />
|
||||
<v-text-field
|
||||
v-model="value.value"
|
||||
hide-details="auto"
|
||||
:rules="[rules.invalid]"
|
||||
type="number"
|
||||
suffix="°C"
|
||||
dense
|
||||
outlined
|
||||
hide-spin-buttons
|
||||
@focus="$event.target.select()" />
|
||||
</settings-row>
|
||||
</div>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row :title="$t('Settings.PresetsTab.CustomGCode')">
|
||||
<v-textarea v-model="preset.gcode" outlined hide-details />
|
||||
</settings-row>
|
||||
</v-card-text>
|
||||
<v-card-actions class="d-flex justify-end">
|
||||
<v-btn text @click="closeForm">
|
||||
{{ $t('Settings.Cancel') }}
|
||||
</v-btn>
|
||||
<v-btn color="primary" text type="submit" :disabled="!valid">
|
||||
{{ storeButtonText }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-form>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import SettingsRow from '@/components/settings/SettingsRow.vue'
|
||||
import { GuiPresetsStatePreset } from '@/store/gui/presets/types'
|
||||
import { convertName } from '@/plugins/helpers'
|
||||
import { mdiDelete, mdiPencil } from '@mdi/js'
|
||||
|
||||
@Component({
|
||||
components: { SettingsRow },
|
||||
})
|
||||
export default class PresetsForm extends Mixins(BaseMixin) {
|
||||
mdiPencil = mdiPencil
|
||||
mdiDelete = mdiDelete
|
||||
|
||||
@Prop({ required: true }) readonly preset!: GuiPresetsStatePreset
|
||||
|
||||
valid = false
|
||||
boolInvalidMin = false
|
||||
|
||||
private rules = {
|
||||
required: (value: string) => value !== '' || this.$t('Settings.PresetsTab.ErrorNameRequired'),
|
||||
unique: (value: string) => !this.existsPresetName(value) || this.$t('Settings.PresetsTab.ErrorNameNotUnique'),
|
||||
invalid: (value: string) => parseFloat(value) >= 0 || this.$t('Settings.PresetsTab.ErrorInvalidValue'),
|
||||
}
|
||||
|
||||
get title() {
|
||||
if (this.preset.id === null) return this.$t('Settings.PresetsTab.CreateHeadline')
|
||||
|
||||
return this.$t('Settings.PresetsTab.EditHeadline')
|
||||
}
|
||||
|
||||
get storeButtonText() {
|
||||
if (this.preset.id === null) return this.$t('Settings.PresetsTab.StoreButton')
|
||||
|
||||
return this.$t('Settings.PresetsTab.UpdateButton')
|
||||
}
|
||||
|
||||
get presets() {
|
||||
return this.$store.getters['gui/presets/getPresets'] ?? []
|
||||
}
|
||||
|
||||
get available_heaters() {
|
||||
return (this.$store.state.printer?.heaters?.available_heaters ?? []).sort()
|
||||
}
|
||||
|
||||
get available_temperature_fans() {
|
||||
return (this.$store.state.printer?.heaters?.available_sensors ?? [])
|
||||
.filter((name: string) => name.startsWith('temperature_fan '))
|
||||
.sort()
|
||||
}
|
||||
|
||||
mounted() {
|
||||
const presetValues = Object.keys(this.preset.values)
|
||||
|
||||
// add missing heaters to preset
|
||||
this.available_heaters
|
||||
.filter((name: string) => !presetValues.includes(name))
|
||||
.forEach((name: string) => {
|
||||
this.preset.values[name] = {
|
||||
bool: false,
|
||||
type: 'heater',
|
||||
value: 0,
|
||||
}
|
||||
})
|
||||
|
||||
// add missing temperature_fans to preset
|
||||
this.available_temperature_fans
|
||||
.filter((name: string) => !presetValues.includes(name))
|
||||
.forEach((name: string) => {
|
||||
this.preset.values[name] = {
|
||||
bool: false,
|
||||
type: 'temperature_fan',
|
||||
value: 0,
|
||||
}
|
||||
})
|
||||
|
||||
// remove unused values from preset
|
||||
presetValues
|
||||
.filter(
|
||||
(name: string) =>
|
||||
!this.available_heaters.includes(name) && !this.available_temperature_fans.includes(name)
|
||||
)
|
||||
.forEach((name) => {
|
||||
delete this.preset.values[name]
|
||||
})
|
||||
}
|
||||
|
||||
existsPresetName(name: string) {
|
||||
return (
|
||||
this.presets.findIndex(
|
||||
(preset: GuiPresetsStatePreset) => preset.name === name && preset.id !== this.preset.id
|
||||
) !== -1
|
||||
)
|
||||
}
|
||||
|
||||
converNameObject(name: string) {
|
||||
return convertName(name.replace('temperature_fan ', ''))
|
||||
}
|
||||
|
||||
closeForm() {
|
||||
this.$emit('close')
|
||||
}
|
||||
|
||||
savePreset() {
|
||||
let setValues = 0
|
||||
for (const key of Object.keys(this.preset.values)) {
|
||||
if (this.preset.values[key].bool) setValues++
|
||||
}
|
||||
if (this.preset.gcode.length) setValues++
|
||||
|
||||
// stop here, when no values are set
|
||||
if (setValues === 0) {
|
||||
this.boolInvalidMin = true
|
||||
return
|
||||
}
|
||||
|
||||
// create new preset, if id === null
|
||||
if (this.preset.id === null) {
|
||||
this.$store.dispatch('gui/presets/store', { values: this.preset })
|
||||
this.closeForm()
|
||||
return
|
||||
}
|
||||
|
||||
// update existing preset
|
||||
this.$store.dispatch('gui/presets/update', { id: this.preset.id, values: this.preset })
|
||||
this.closeForm()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,52 @@
|
||||
<template>
|
||||
<v-card flat>
|
||||
<v-form @submit.prevent="saveCooldown">
|
||||
<v-card-title>{{ $t('Settings.PresetsTab.EditCooldown') }}</v-card-title>
|
||||
<v-card-text>
|
||||
<settings-row :title="$t('Settings.PresetsTab.CustomGCode')">
|
||||
<v-textarea v-model="gcode" outlined hide-details />
|
||||
</settings-row>
|
||||
</v-card-text>
|
||||
<v-card-actions class="d-flex justify-end">
|
||||
<v-btn text @click="closeForm">
|
||||
{{ $t('Settings.Cancel') }}
|
||||
</v-btn>
|
||||
<v-btn color="primary" text type="submit">
|
||||
{{ $t('Settings.PresetsTab.UpdateCooldown') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-form>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import SettingsRow from '@/components/settings/SettingsRow.vue'
|
||||
import { mdiDelete, mdiPencil } from '@mdi/js'
|
||||
|
||||
@Component({
|
||||
components: { SettingsRow },
|
||||
})
|
||||
export default class PresetsFormCooldown extends Mixins(BaseMixin) {
|
||||
mdiPencil = mdiPencil
|
||||
mdiDelete = mdiDelete
|
||||
|
||||
@Prop({ required: true }) readonly inputGcode!: string
|
||||
|
||||
gcode = ''
|
||||
|
||||
mounted() {
|
||||
this.gcode = this.inputGcode
|
||||
}
|
||||
|
||||
closeForm() {
|
||||
this.$emit('close')
|
||||
}
|
||||
|
||||
saveCooldown() {
|
||||
this.$store.dispatch('gui/presets/saveSetting', { name: 'cooldownGcode', value: this.gcode })
|
||||
this.closeForm()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -6,16 +6,23 @@
|
||||
:title="$t('Settings.EditorTab.UseEscToClose')"
|
||||
:sub-title="$t('Settings.EditorTab.UseEscToCloseDescription')"
|
||||
:dynamic-slot-width="true">
|
||||
<v-switch v-model="escToClose" hide-details class="mt-0"></v-switch>
|
||||
<v-switch v-model="escToClose" hide-details class="mt-0" />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.EditorTab.ConfirmUnsavedChanges')"
|
||||
:sub-title="$t('Settings.EditorTab.ConfirmUnsavedChangesDescription')"
|
||||
:dynamic-slot-width="true">
|
||||
<v-switch v-model="confirmUnsavedChanges" hide-details class="mt-0"></v-switch>
|
||||
<v-switch v-model="confirmUnsavedChanges" hide-details class="mt-0" />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.EditorTab.TabSize')"
|
||||
:sub-title="$t('Settings.EditorTab.TabSizeDescription')"
|
||||
:dynamic-slot-width="true">
|
||||
<v-select v-model="tabSize" :items="tabSizes" hide-details outlined dense attached />
|
||||
</settings-row>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.EditorTab.KlipperRestartMethod')"
|
||||
:sub-title="$t('Settings.EditorTab.KlipperRestartMethodDescription')">
|
||||
@@ -25,23 +32,8 @@
|
||||
hide-details
|
||||
outlined
|
||||
dense
|
||||
attached></v-select>
|
||||
attached />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<template v-if="availableMoonrakerInstances.length > 1">
|
||||
<settings-row
|
||||
:title="$t('Settings.EditorTab.MoonrakerRestartInstance')"
|
||||
:sub-title="$t('Settings.EditorTab.MoonrakerRestartInstanceDescription')">
|
||||
<v-select
|
||||
v-model="moonrakerRestartInstance"
|
||||
:items="availableMoonrakerInstances"
|
||||
hide-details
|
||||
outlined
|
||||
dense
|
||||
attached></v-select>
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
</template>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</div>
|
||||
@@ -67,6 +59,14 @@ export default class SettingsEditorTab extends Mixins(BaseMixin) {
|
||||
},
|
||||
]
|
||||
|
||||
get tabSizes() {
|
||||
const spaces = [2, 4, 6, 8]
|
||||
return spaces.map((space) => ({
|
||||
text: this.$t('Settings.EditorTab.Spaces', { count: space }),
|
||||
value: space,
|
||||
}))
|
||||
}
|
||||
|
||||
get escToClose() {
|
||||
return this.$store.state.gui.editor.escToClose
|
||||
}
|
||||
@@ -83,6 +83,14 @@ export default class SettingsEditorTab extends Mixins(BaseMixin) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'editor.confirmUnsavedChanges', value: newVal })
|
||||
}
|
||||
|
||||
get tabSize() {
|
||||
return this.$store.state.gui.editor.tabSize || 2
|
||||
}
|
||||
|
||||
set tabSize(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'editor.tabSize', value: newVal })
|
||||
}
|
||||
|
||||
get klipperRestartMethod() {
|
||||
return this.$store.state.gui.editor.klipperRestartMethod
|
||||
}
|
||||
@@ -90,19 +98,5 @@ export default class SettingsEditorTab extends Mixins(BaseMixin) {
|
||||
set klipperRestartMethod(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'editor.klipperRestartMethod', value: newVal })
|
||||
}
|
||||
|
||||
get moonrakerRestartInstance() {
|
||||
return this.$store.state.gui.editor.moonrakerRestartInstance
|
||||
}
|
||||
|
||||
set moonrakerRestartInstance(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'editor.moonrakerRestartInstance', value: newVal })
|
||||
}
|
||||
|
||||
get availableMoonrakerInstances() {
|
||||
const available_instances = this.$store.state.server.system_info?.available_services ?? []
|
||||
|
||||
return available_instances.filter((name: string) => name.startsWith('moonraker')).sort()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -2,55 +2,43 @@
|
||||
<div>
|
||||
<v-card flat>
|
||||
<v-card-text>
|
||||
<settings-row :title="$t('Settings.GeneralTab.PrinterName').toString()">
|
||||
<settings-row :title="$t('Settings.GeneralTab.PrinterName')">
|
||||
<v-text-field v-model="printerName" hide-details outlined dense></v-text-field>
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<settings-row :title="$t('Settings.GeneralTab.Language').toString()">
|
||||
<v-divider class="my-2" />
|
||||
<settings-row :title="$t('Settings.GeneralTab.Language')">
|
||||
<v-select
|
||||
v-model="currentLanguage"
|
||||
:items="availableLanguages"
|
||||
hide-details
|
||||
outlined
|
||||
dense
|
||||
attach></v-select>
|
||||
attach />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<settings-row :title="$t('Settings.GeneralTab.DateFormat').toString()">
|
||||
<v-select
|
||||
v-model="dateFormat"
|
||||
:items="dateFormatItems"
|
||||
hide-details
|
||||
outlined
|
||||
dense
|
||||
attach></v-select>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row :title="$t('Settings.GeneralTab.DateFormat')">
|
||||
<v-select v-model="dateFormat" :items="dateFormatItems" hide-details outlined dense attach />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<settings-row :title="$t('Settings.GeneralTab.TimeFormat').toString()">
|
||||
<v-select
|
||||
v-model="timeFormat"
|
||||
:items="timeFormatItems"
|
||||
hide-details
|
||||
outlined
|
||||
dense
|
||||
attach></v-select>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row :title="$t('Settings.GeneralTab.TimeFormat')">
|
||||
<v-select v-model="timeFormat" :items="timeFormatItems" hide-details outlined dense attach />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.GeneralTab.CalcPrintProgress').toString()"
|
||||
:sub-title="$t('Settings.GeneralTab.CalcPrintProgressDescription').toString()">
|
||||
:title="$t('Settings.GeneralTab.CalcPrintProgress')"
|
||||
:sub-title="$t('Settings.GeneralTab.CalcPrintProgressDescription')">
|
||||
<v-select
|
||||
v-model="calcPrintProgress"
|
||||
:items="calcPrintProgressItems"
|
||||
hide-details
|
||||
dense
|
||||
outlined
|
||||
attach></v-select>
|
||||
attach />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.GeneralTab.CalcEstimateTime').toString()"
|
||||
:sub-title="$t('Settings.GeneralTab.CalcEstimateTimeDescription').toString()">
|
||||
:title="$t('Settings.GeneralTab.CalcEstimateTime')"
|
||||
:sub-title="$t('Settings.GeneralTab.CalcEstimateTimeDescription')">
|
||||
<v-select
|
||||
v-model="calcEstimateTime"
|
||||
:items="calcEstimateItems"
|
||||
@@ -58,12 +46,12 @@
|
||||
hide-details
|
||||
dense
|
||||
outlined
|
||||
attach></v-select>
|
||||
attach />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.GeneralTab.CalcEtaTime').toString()"
|
||||
:sub-title="$t('Settings.GeneralTab.CalcEtaTimeDescription').toString()">
|
||||
:title="$t('Settings.GeneralTab.CalcEtaTime')"
|
||||
:sub-title="$t('Settings.GeneralTab.CalcEtaTimeDescription')">
|
||||
<v-select
|
||||
v-model="calcEtaTime"
|
||||
:items="calcEtaTimeItems"
|
||||
@@ -71,10 +59,10 @@
|
||||
hide-details
|
||||
dense
|
||||
outlined
|
||||
attach></v-select>
|
||||
attach />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<settings-row :title="$t('Settings.GeneralTab.MoonrakerDb').toString()" :dynamic-slot-width="true">
|
||||
<v-divider class="my-2" />
|
||||
<settings-row :title="$t('Settings.GeneralTab.MainsailSettingsMoonrakerDb')" :dynamic-slot-width="true">
|
||||
<input
|
||||
ref="uploadBackupFile"
|
||||
type="file"
|
||||
@@ -88,8 +76,8 @@
|
||||
{{ $t('Settings.GeneralTab.Restore') }}
|
||||
</v-btn>
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<settings-row :title="$t('Settings.GeneralTab.FactoryReset').toString()" :dynamic-slot-width="true">
|
||||
<v-divider class="my-2" />
|
||||
<settings-row :title="$t('Settings.GeneralTab.FactoryReset')" :dynamic-slot-width="true">
|
||||
<v-btn color="error" small @click="resetMainsail">
|
||||
{{ $t('Settings.GeneralTab.FactoryReset') }}
|
||||
</v-btn>
|
||||
@@ -98,7 +86,7 @@
|
||||
</v-card>
|
||||
<v-dialog v-model="dialogBackupMainsail" persistent :width="360">
|
||||
<panel
|
||||
:title="$t('Settings.GeneralTab.Backup').toString()"
|
||||
:title="$t('Settings.GeneralTab.Backup')"
|
||||
card-class="mainsail-backup-dialog"
|
||||
:margin-bottom="false"
|
||||
:icon="mdiHelpCircle">
|
||||
@@ -121,20 +109,14 @@
|
||||
:label="db.label"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
@change="changeNamespace(db.name)"></v-checkbox>
|
||||
@change="changeNamespace(db.name)" />
|
||||
</template>
|
||||
<v-checkbox
|
||||
v-if="availableNamespaces.includes('timelapse')"
|
||||
:label="$t('Settings.GeneralTab.DbTimelapseSettings')"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
@change="changeNamespace('timelapse')"></v-checkbox>
|
||||
<v-checkbox
|
||||
v-if="availableNamespaces.includes('webcams')"
|
||||
:label="$t('Settings.GeneralTab.DbWebcams')"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
@change="changeNamespace('webcams')"></v-checkbox>
|
||||
@change="changeNamespace('timelapse')" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
@@ -149,7 +131,7 @@
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogResetMainsail" persistent :width="360">
|
||||
<panel
|
||||
:title="$t('Settings.GeneralTab.FactoryReset').toString()"
|
||||
:title="$t('Settings.GeneralTab.FactoryReset')"
|
||||
card-class="factory-reset-dialog"
|
||||
:margin-bottom="false"
|
||||
:icon="mdiHelpCircle">
|
||||
@@ -172,32 +154,26 @@
|
||||
:label="db.label"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
@change="changeNamespace(db.name)"></v-checkbox>
|
||||
@change="changeNamespace(db.name)" />
|
||||
</template>
|
||||
<v-checkbox
|
||||
v-if="availableNamespaces.includes('timelapse')"
|
||||
:label="$t('Settings.GeneralTab.DbTimelapseSettings')"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
@change="changeNamespace('timelapse')"></v-checkbox>
|
||||
<v-checkbox
|
||||
v-if="availableNamespaces.includes('webcams')"
|
||||
:label="$t('Settings.GeneralTab.DbWebcams')"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
@change="changeNamespace('webcams')"></v-checkbox>
|
||||
@change="changeNamespace('timelapse')" />
|
||||
<v-checkbox
|
||||
v-if="moonrakerComponents.includes('history')"
|
||||
:label="$t('Settings.GeneralTab.DbHistoryJobs')"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
@change="changeNamespace('history_jobs')"></v-checkbox>
|
||||
@change="changeNamespace('history_jobs')" />
|
||||
<v-checkbox
|
||||
v-if="moonrakerComponents.includes('history')"
|
||||
:label="$t('Settings.GeneralTab.DbHistoryTotals')"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
@change="changeNamespace('history_totals')"></v-checkbox>
|
||||
@change="changeNamespace('history_totals')" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
@@ -215,7 +191,7 @@
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogRestoreMainsail" persistent :width="360">
|
||||
<panel
|
||||
:title="$t('Settings.GeneralTab.Restore').toString()"
|
||||
:title="$t('Settings.GeneralTab.Restore')"
|
||||
card-class="factory-reset-dialog"
|
||||
:margin-bottom="false"
|
||||
:icon="mdiHelpCircle">
|
||||
@@ -238,7 +214,7 @@
|
||||
:label="db.label"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
@change="changeNamespace(db.name)"></v-checkbox>
|
||||
@change="changeNamespace(db.name)" />
|
||||
</template>
|
||||
</v-col>
|
||||
</v-row>
|
||||
@@ -291,63 +267,59 @@ export default class SettingsGeneralTab extends Mixins(BaseMixin) {
|
||||
return [
|
||||
{
|
||||
name: 'general',
|
||||
label: this.$t('Settings.GeneralTab.General').toString(),
|
||||
label: this.$t('Settings.GeneralTab.General'),
|
||||
},
|
||||
{
|
||||
name: 'console',
|
||||
label: this.$t('Settings.ConsoleTab.Console').toString(),
|
||||
label: this.$t('Settings.ConsoleTab.Console'),
|
||||
},
|
||||
{
|
||||
name: 'control',
|
||||
label: this.$t('Settings.ControlTab.Control').toString(),
|
||||
label: this.$t('Settings.ControlTab.Control'),
|
||||
},
|
||||
{
|
||||
name: 'dashboard',
|
||||
label: this.$t('Settings.DashboardTab.Dashboard').toString(),
|
||||
label: this.$t('Settings.DashboardTab.Dashboard'),
|
||||
},
|
||||
{
|
||||
name: 'editor',
|
||||
label: this.$t('Settings.EditorTab.Editor').toString(),
|
||||
label: this.$t('Settings.EditorTab.Editor'),
|
||||
},
|
||||
{
|
||||
name: 'gcodeViewer',
|
||||
label: this.$t('Settings.GCodeViewerTab.GCodeViewer').toString(),
|
||||
label: this.$t('Settings.GCodeViewerTab.GCodeViewer'),
|
||||
},
|
||||
{
|
||||
name: 'gcodehistory',
|
||||
label: this.$t('Settings.GeneralTab.DbConsoleHistory').toString(),
|
||||
label: this.$t('Settings.GeneralTab.DbConsoleHistory'),
|
||||
},
|
||||
{
|
||||
name: 'macros',
|
||||
label: this.$t('Settings.MacrosTab.Macros').toString(),
|
||||
label: this.$t('Settings.MacrosTab.Macros'),
|
||||
},
|
||||
{
|
||||
name: 'notifications',
|
||||
label: this.$t('App.Notifications.Notifications').toString(),
|
||||
label: this.$t('App.Notifications.Notifications'),
|
||||
},
|
||||
{
|
||||
name: 'presets',
|
||||
label: this.$t('Settings.PresetsTab.PreheatPresets').toString(),
|
||||
label: this.$t('Settings.PresetsTab.PreheatPresets'),
|
||||
},
|
||||
{
|
||||
name: 'remoteprinters',
|
||||
label: this.$t('Settings.RemotePrintersTab.RemotePrinters').toString(),
|
||||
label: this.$t('Settings.RemotePrintersTab.RemotePrinters'),
|
||||
},
|
||||
{
|
||||
name: 'timelapse',
|
||||
label: this.$t('Settings.TimelapseTab.Timelapse').toString(),
|
||||
label: this.$t('Settings.TimelapseTab.Timelapse'),
|
||||
},
|
||||
{
|
||||
name: 'uiSettings',
|
||||
label: this.$t('Settings.UiSettingsTab.UiSettings').toString(),
|
||||
label: this.$t('Settings.UiSettingsTab.UiSettings'),
|
||||
},
|
||||
{
|
||||
name: 'view',
|
||||
label: this.$t('Settings.GeneralTab.DbView').toString(),
|
||||
},
|
||||
{
|
||||
name: 'webcams',
|
||||
label: this.$t('Settings.WebcamsTab.Webcams').toString(),
|
||||
label: this.$t('Settings.GeneralTab.DbView'),
|
||||
},
|
||||
]
|
||||
}
|
||||
@@ -429,13 +401,13 @@ export default class SettingsGeneralTab extends Mixins(BaseMixin) {
|
||||
value: '24hours',
|
||||
text: this.$t('Settings.GeneralTab.24hours', {
|
||||
time: date.toLocaleTimeString(userLocale, { hour: '2-digit', minute: '2-digit', hourCycle: 'h23' }),
|
||||
}).toString(),
|
||||
}),
|
||||
},
|
||||
{
|
||||
value: '12hours',
|
||||
text: this.$t('Settings.GeneralTab.12hours', {
|
||||
time: date.toLocaleTimeString(userLocale, { hour: '2-digit', minute: '2-digit', hourCycle: 'h12' }),
|
||||
}).toString(),
|
||||
}),
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-card-text>
|
||||
<h3 class="text-h5 mb-3">{{ $t('Settings.NavigationTab.Navigation') }}</h3>
|
||||
<draggable v-model="sortableNaviPoints" handle=".handle" ghost-class="ghost" group="navigation-points">
|
||||
<settings-navigation-tab-item
|
||||
v-for="(naviPoint, index) in sortableNaviPoints"
|
||||
:key="index"
|
||||
class="dragable-item my-2 mx-0"
|
||||
:navi-point="naviPoint" />
|
||||
</draggable>
|
||||
</v-card-text>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import NavigationMixin, { NaviPoint } from '@/components/mixins/navigation'
|
||||
import SettingsRow from '@/components/settings/SettingsRow.vue'
|
||||
import draggable from 'vuedraggable'
|
||||
import SettingsNavigationTabItem from '@/components/settings/SettingsNavigationTabItem.vue'
|
||||
|
||||
@Component({
|
||||
components: { SettingsNavigationTabItem, SettingsRow, draggable },
|
||||
})
|
||||
export default class SettingsNavigationTab extends Mixins(NavigationMixin, BaseMixin) {
|
||||
get sortableNaviPoints() {
|
||||
return this.naviPoints.filter((naviPoint) => naviPoint.position > 0)
|
||||
}
|
||||
|
||||
set sortableNaviPoints(newVal: NaviPoint[]) {
|
||||
// update store with new positions
|
||||
newVal.forEach((naviPoint, index) => {
|
||||
this.$store.dispatch('gui/navigation/updatePos', {
|
||||
type: naviPoint.type,
|
||||
title: naviPoint.title,
|
||||
visible: naviPoint.visible,
|
||||
position: index + 1,
|
||||
})
|
||||
})
|
||||
|
||||
// upload to moonraker db
|
||||
this.$store.dispatch('gui/navigation/upload')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.dragable-item {
|
||||
background-color: #282828;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,62 @@
|
||||
<template>
|
||||
<v-row class="dragable-item my-2 mx-0">
|
||||
<v-col class="col-auto pr-0 d-flex py-2">
|
||||
<v-icon class="handle">{{ mdiDragVertical }}</v-icon>
|
||||
</v-col>
|
||||
<v-col class="py-2">
|
||||
<settings-row :title="title" :sub-title="subtitle" :dynamic-slot-width="true">
|
||||
<v-icon :color="checkboxColor" @click="changeVisibility" v-html="checkboxIcon" />
|
||||
</settings-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import NavigationMixin, { NaviPoint } from '@/components/mixins/navigation'
|
||||
import SettingsRow from '@/components/settings/SettingsRow.vue'
|
||||
import draggable from 'vuedraggable'
|
||||
import { mdiDragVertical, mdiCheckboxMarked, mdiCheckboxBlankOutline } from '@mdi/js'
|
||||
|
||||
@Component({
|
||||
components: { SettingsRow, draggable },
|
||||
})
|
||||
export default class SettingsNavigationTab extends Mixins(NavigationMixin, BaseMixin) {
|
||||
mdiDragVertical = mdiDragVertical
|
||||
|
||||
@Prop({ type: Object, required: true }) naviPoint!: NaviPoint
|
||||
|
||||
get title() {
|
||||
return this.naviPoint.title
|
||||
}
|
||||
|
||||
get subtitle() {
|
||||
if (this.naviPoint.type === 'link') return `URL: ${this.naviPoint.href ?? 'Unknown'}`
|
||||
|
||||
return undefined
|
||||
}
|
||||
|
||||
get checkboxColor() {
|
||||
if (this.naviPoint.visible) return 'primary'
|
||||
|
||||
return 'grey lighten-1'
|
||||
}
|
||||
|
||||
get checkboxIcon() {
|
||||
if (this.naviPoint.visible) return mdiCheckboxMarked
|
||||
|
||||
return mdiCheckboxBlankOutline
|
||||
}
|
||||
|
||||
changeVisibility() {
|
||||
this.$store.dispatch('gui/navigation/changeVisibility', this.naviPoint)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.dragable-item {
|
||||
background-color: #282828;
|
||||
}
|
||||
</style>
|
||||
@@ -1,336 +1,69 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-card v-if="!form.bool && !cooldownForm.bool" flat>
|
||||
<presets-form v-if="boolForm" :preset="formPreset" @close="boolForm = false" />
|
||||
<presets-form-cooldown
|
||||
v-else-if="boolFormCooldown"
|
||||
:input-gcode="cooldownGcode"
|
||||
@close="boolFormCooldown = false" />
|
||||
<v-card v-else flat>
|
||||
<v-card-text>
|
||||
<h3 class="text-h5 mb-3">{{ $t('Settings.PresetsTab.PreheatPresets') }}</h3>
|
||||
<div v-for="(preset, key) in presets" :key="preset.index">
|
||||
<v-divider v-if="key" class="my-2"></v-divider>
|
||||
<settings-row :title="preset.name" :sub-title="getSubTitle(preset)">
|
||||
<v-btn small outlined class="ml-3" @click="editPreset(preset)">
|
||||
<v-icon left small>{{ mdiPencil }}</v-icon>
|
||||
{{ $t('Settings.Edit') }}
|
||||
</v-btn>
|
||||
<v-btn
|
||||
small
|
||||
outlined
|
||||
class="ml-3 minwidth-0 px-2"
|
||||
color="error"
|
||||
@click="deletePreset(preset.id)">
|
||||
<v-icon small>{{ mdiDelete }}</v-icon>
|
||||
</v-btn>
|
||||
</settings-row>
|
||||
<v-divider v-if="key" class="my-2" />
|
||||
<presets-entry :preset="preset" @edit="edit" />
|
||||
</div>
|
||||
<v-divider v-if="presets.length" class="my-2"></v-divider>
|
||||
<settings-row :title="$t('Settings.PresetsTab.Cooldown').toString()">
|
||||
<v-btn small outlined class="ml-3" @click="editCooldown">
|
||||
<v-icon left small>{{ mdiPencil }}</v-icon>
|
||||
{{ $t('Settings.Edit') }}
|
||||
</v-btn>
|
||||
</settings-row>
|
||||
<v-divider v-if="presets.length" class="my-2" />
|
||||
<presets-entry-cooldown @edit="boolFormCooldown = true" />
|
||||
</v-card-text>
|
||||
<v-card-actions class="d-flex justify-end">
|
||||
<v-btn text color="primary" @click="createPreset">{{ $t('Settings.PresetsTab.AddPreset') }}</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
<v-card v-else-if="form.bool" flat>
|
||||
<v-form v-model="form.valid" @submit.prevent="savePreset">
|
||||
<v-card-title>
|
||||
{{
|
||||
form.id === null
|
||||
? $t('Settings.PresetsTab.CreateHeadline')
|
||||
: $t('Settings.PresetsTab.EditHeadline')
|
||||
}}
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<v-row v-if="form.boolInvalidMin" class="mt-3">
|
||||
<v-col class="py-0">
|
||||
<v-alert dense text type="error">{{ $t('Settings.PresetsTab.PresetInfo') }}</v-alert>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<settings-row :title="$t('Settings.PresetsTab.Name').toString()">
|
||||
<v-text-field
|
||||
v-model="form.name"
|
||||
:placeholder="$t('Settings.PresetsTab.PresetNamePlaceholder')"
|
||||
hide-details="auto"
|
||||
:rules="[rules.required, rules.unique]"
|
||||
:append-icon="form.name !== '' ? mdiCloseCircle : {}"
|
||||
dense
|
||||
outlined
|
||||
@click:append="form.name !== '' ? (form.name = '') : {}"></v-text-field>
|
||||
</settings-row>
|
||||
<div v-for="heater of heaters" :key="heater.name">
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<settings-row :title="convertName(heater.name)">
|
||||
<v-checkbox
|
||||
v-model="form.values[heater.name].bool"
|
||||
hide-details
|
||||
class="shrink mt-0"></v-checkbox>
|
||||
<v-text-field
|
||||
v-model="form.values[heater.name].value"
|
||||
hide-details="auto"
|
||||
:rules="[rules.invalid]"
|
||||
type="number"
|
||||
suffix="°C"
|
||||
dense
|
||||
outlined
|
||||
hide-spin-buttons
|
||||
@focus="$event.target.select()"></v-text-field>
|
||||
</settings-row>
|
||||
</div>
|
||||
<div v-for="fan of temperatureFans" :key="'temperature_fan ' + fan.name">
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<settings-row :title="convertName(fan.name)">
|
||||
<v-checkbox
|
||||
v-model="form.values['temperature_fan ' + fan.name].bool"
|
||||
hide-details
|
||||
class="shrink mt-0"></v-checkbox>
|
||||
<v-text-field
|
||||
v-model="form.values['temperature_fan ' + fan.name].value"
|
||||
hide-details="auto"
|
||||
:rules="[rules.invalid]"
|
||||
type="number"
|
||||
suffix="°C"
|
||||
dense
|
||||
outlined
|
||||
hide-spin-buttons
|
||||
@focus="$event.target.select()"></v-text-field>
|
||||
</settings-row>
|
||||
</div>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<settings-row :title="$t('Settings.PresetsTab.CustomGCode').toString()">
|
||||
<v-textarea v-model="form.gcode" outlined hide-details></v-textarea>
|
||||
</settings-row>
|
||||
</v-card-text>
|
||||
<v-card-actions class="d-flex justify-end">
|
||||
<v-btn text @click="form.bool = false">
|
||||
{{ $t('Settings.Cancel') }}
|
||||
</v-btn>
|
||||
<v-btn color="primary" text type="submit" :disabled="!form.valid">
|
||||
{{
|
||||
form.id === null
|
||||
? $t('Settings.PresetsTab.StoreButton')
|
||||
: $t('Settings.PresetsTab.UpdateButton')
|
||||
}}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-form>
|
||||
</v-card>
|
||||
<v-card v-else-if="cooldownForm.bool" flat>
|
||||
<v-form v-model="cooldownForm.valid" @submit.prevent="saveCooldown">
|
||||
<v-card-title>{{ $t('Settings.PresetsTab.EditCooldown') }}</v-card-title>
|
||||
<v-card-text>
|
||||
<settings-row :title="$t('Settings.PresetsTab.CustomGCode').toString()">
|
||||
<v-textarea v-model="cooldownForm.gcode" outlined hide-details></v-textarea>
|
||||
</settings-row>
|
||||
</v-card-text>
|
||||
<v-card-actions class="d-flex justify-end">
|
||||
<v-btn text @click="cooldownForm.bool = false">
|
||||
{{ $t('Settings.Cancel') }}
|
||||
</v-btn>
|
||||
<v-btn color="primary" text type="submit">
|
||||
{{ $t('Settings.PresetsTab.UpdateCooldown') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-form>
|
||||
</v-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { convertName } from '@/plugins/helpers'
|
||||
import { Component, Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '../mixins/base'
|
||||
import SettingsRow from '@/components/settings/SettingsRow.vue'
|
||||
import { GuiPresetsStatePreset } from '@/store/gui/presets/types'
|
||||
import { mdiDelete, mdiPencil, mdiCloseCircle } from '@mdi/js'
|
||||
|
||||
interface presetForm {
|
||||
bool: boolean
|
||||
valid: boolean
|
||||
name: string
|
||||
gcode: string
|
||||
id: string | null
|
||||
boolInvalidMin: boolean
|
||||
values: {
|
||||
[key: string]: {
|
||||
bool: boolean
|
||||
value: number
|
||||
type: 'heater' | 'temperature_fan'
|
||||
}
|
||||
}
|
||||
}
|
||||
import { mdiDelete, mdiPencil } from '@mdi/js'
|
||||
import PresetsEntry from '@/components/settings/Presets/PresetsEntry.vue'
|
||||
import PresetsEntryCooldown from '@/components/settings/Presets/PresetsEntryCooldown.vue'
|
||||
import PresetsForm from '@/components/settings/Presets/PresetsForm.vue'
|
||||
|
||||
@Component({
|
||||
components: { SettingsRow },
|
||||
components: { PresetsForm, PresetsEntryCooldown, PresetsEntry, SettingsRow },
|
||||
})
|
||||
export default class SettingsPresetsTab extends Mixins(BaseMixin) {
|
||||
mdiPencil = mdiPencil
|
||||
mdiDelete = mdiDelete
|
||||
mdiCloseCircle = mdiCloseCircle
|
||||
|
||||
convertName = convertName
|
||||
boolForm = false
|
||||
boolFormCooldown = false
|
||||
|
||||
private form: presetForm = {
|
||||
bool: false,
|
||||
valid: false,
|
||||
name: '',
|
||||
gcode: '',
|
||||
id: null,
|
||||
boolInvalidMin: false,
|
||||
values: {},
|
||||
}
|
||||
|
||||
private cooldownForm = {
|
||||
bool: false,
|
||||
valid: false,
|
||||
gcode: '',
|
||||
}
|
||||
|
||||
private rules = {
|
||||
required: (value: string) => value !== '' || this.$t('Settings.PresetsTab.ErrorNameRequired'),
|
||||
unique: (value: string) => !this.existsPresetName(value) || this.$t('Settings.PresetsTab.ErrorNameNotUnique'),
|
||||
invalid: (value: string) => parseFloat(value) >= 0 || this.$t('Settings.PresetsTab.ErrorInvalidValue'),
|
||||
}
|
||||
formPreset: GuiPresetsStatePreset = {} as GuiPresetsStatePreset
|
||||
|
||||
get presets() {
|
||||
return this.$store.getters['gui/presets/getPresets'] ?? []
|
||||
}
|
||||
|
||||
get heaters() {
|
||||
return this.$store.getters['printer/getHeaters'] ?? []
|
||||
}
|
||||
|
||||
get temperatureFans() {
|
||||
return this.$store.getters['printer/getTemperatureFans'] ?? []
|
||||
}
|
||||
|
||||
get cooldownGcode() {
|
||||
return this.$store.getters['gui/presets/getCooldownGcode']
|
||||
}
|
||||
|
||||
existsPresetName(name: string) {
|
||||
return (
|
||||
this.presets.findIndex(
|
||||
(preset: GuiPresetsStatePreset) => preset.name === name && preset.id !== this.form.id
|
||||
) !== -1
|
||||
)
|
||||
}
|
||||
|
||||
getSubTitle(preset: GuiPresetsStatePreset) {
|
||||
let output: string[] = []
|
||||
|
||||
Object.keys(preset.values).forEach((key: string) => {
|
||||
const values = preset.values[key]
|
||||
|
||||
if (values.bool) {
|
||||
const name = key.indexOf(' ') ? key.slice(key.indexOf(' ') + 1) : key
|
||||
|
||||
output.push(this.convertName(name) + ': ' + values.value + '°C')
|
||||
}
|
||||
})
|
||||
|
||||
if (preset.gcode) output.push(this.$t('Settings.PresetsTab.CustomGCode').toString())
|
||||
|
||||
return output.join(', ')
|
||||
}
|
||||
|
||||
createPreset() {
|
||||
this.clearForm()
|
||||
this.form.bool = true
|
||||
this.formPreset.id = null
|
||||
this.formPreset.name = ''
|
||||
this.formPreset.values = {}
|
||||
this.formPreset.gcode = ''
|
||||
|
||||
this.boolForm = true
|
||||
}
|
||||
|
||||
clearForm() {
|
||||
this.form.bool = false
|
||||
this.form.id = null
|
||||
this.form.name = ''
|
||||
this.form.gcode = ''
|
||||
this.form.boolInvalidMin = false
|
||||
this.form.values = {}
|
||||
|
||||
for (const heater of this.heaters) {
|
||||
this.form.values[heater.name] = {
|
||||
bool: true,
|
||||
value: 0,
|
||||
type: 'heater',
|
||||
}
|
||||
}
|
||||
|
||||
for (const fan of this.temperatureFans) {
|
||||
this.form.values['temperature_fan ' + fan.name] = {
|
||||
bool: true,
|
||||
value: 0,
|
||||
type: 'temperature_fan',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
editPreset(preset: GuiPresetsStatePreset) {
|
||||
this.form.name = preset.name
|
||||
this.form.id = preset.id ?? null
|
||||
this.form.gcode = preset.gcode
|
||||
this.form.values = {}
|
||||
|
||||
for (const heater of this.heaters) {
|
||||
if (heater.name in preset.values) this.form.values[heater.name] = { ...preset.values[heater.name] }
|
||||
else
|
||||
this.form.values[heater.name] = {
|
||||
bool: false,
|
||||
value: 0,
|
||||
type: 'heater',
|
||||
}
|
||||
}
|
||||
|
||||
for (const fan of this.temperatureFans) {
|
||||
if ('temperature_fan ' + fan.name in preset.values)
|
||||
this.form.values['temperature_fan ' + fan.name] = { ...preset.values['temperature_fan ' + fan.name] }
|
||||
else
|
||||
this.form.values['temperature_fan ' + fan.name] = {
|
||||
bool: false,
|
||||
value: 0,
|
||||
type: 'temperature_fan',
|
||||
}
|
||||
}
|
||||
|
||||
this.form.bool = true
|
||||
}
|
||||
|
||||
savePreset() {
|
||||
let setValues = 0
|
||||
for (const key of Object.keys(this.form.values)) {
|
||||
if (this.form.values[key].bool) setValues++
|
||||
}
|
||||
if (this.form.gcode.length) setValues++
|
||||
|
||||
if (setValues === 0) this.form.boolInvalidMin = true
|
||||
else if (this.form.valid) {
|
||||
const preset: GuiPresetsStatePreset = {
|
||||
name: this.form.name,
|
||||
gcode: this.form.gcode,
|
||||
values: this.form.values,
|
||||
}
|
||||
|
||||
if (this.form.id !== null) {
|
||||
this.$store.dispatch('gui/presets/update', { id: this.form.id, values: preset })
|
||||
} else this.$store.dispatch('gui/presets/store', { values: preset })
|
||||
|
||||
this.clearForm()
|
||||
}
|
||||
}
|
||||
|
||||
editCooldown() {
|
||||
this.cooldownForm.gcode = this.cooldownGcode
|
||||
this.cooldownForm.bool = true
|
||||
}
|
||||
|
||||
saveCooldown() {
|
||||
if (this.cooldownForm.valid) {
|
||||
this.$store.dispatch('gui/presets/saveSetting', { name: 'cooldownGcode', value: this.cooldownForm.gcode })
|
||||
this.cooldownForm.bool = false
|
||||
}
|
||||
}
|
||||
|
||||
deletePreset(id: string) {
|
||||
this.$store.dispatch('gui/presets/delete', id)
|
||||
edit(preset: GuiPresetsStatePreset) {
|
||||
this.formPreset = { ...preset }
|
||||
this.boolForm = true
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -3,7 +3,7 @@
|
||||
<v-col :class="firstColClasses">
|
||||
<v-row class="d-flex flex-row">
|
||||
<v-col v-if="loading" class="col-auto d-flex justify-center align-center pr-0">
|
||||
<v-progress-circular indeterminate color="primary" :size="24"></v-progress-circular>
|
||||
<v-progress-circular indeterminate color="primary" :size="24" />
|
||||
</v-col>
|
||||
<v-col v-else-if="icon" class="col-auto d-flex justify-center align-center pr-0">
|
||||
<v-icon>{{ icon }}</v-icon>
|
||||
@@ -15,7 +15,7 @@
|
||||
</v-row>
|
||||
</v-col>
|
||||
<v-col :class="secondColClasses">
|
||||
<slot></slot>
|
||||
<slot />
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
@@ -23,6 +23,7 @@
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '../mixins/base'
|
||||
import { TranslateResult } from 'vue-i18n'
|
||||
|
||||
@Component
|
||||
export default class SettingsRow extends Mixins(BaseMixin) {
|
||||
@@ -33,10 +34,10 @@ export default class SettingsRow extends Mixins(BaseMixin) {
|
||||
declare readonly icon: string
|
||||
|
||||
@Prop({ required: true })
|
||||
declare readonly title: string
|
||||
declare readonly title: string | TranslateResult
|
||||
|
||||
@Prop({ required: false })
|
||||
declare readonly subTitle: string
|
||||
declare readonly subTitle: string | TranslateResult
|
||||
|
||||
@Prop({ required: false, default: false })
|
||||
declare readonly dynamicSlotWidth: boolean
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
v-model="enabled"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
:disabled="blockedsettings.includes('enabled')"></v-switch>
|
||||
:disabled="blockedsettings.includes('enabled')" />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.Autorender')"
|
||||
:sub-title="$t('Settings.TimelapseTab.AutorenderDescription')"
|
||||
@@ -22,9 +22,9 @@
|
||||
v-model="autorender"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
:disabled="blockedsettings.includes('autorender')"></v-switch>
|
||||
:disabled="blockedsettings.includes('autorender')" />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.Camera')"
|
||||
:sub-title="$t('Settings.TimelapseTab.CameraDescription')">
|
||||
@@ -34,10 +34,9 @@
|
||||
hide-details
|
||||
outlined
|
||||
dense
|
||||
:disabled="blockedsettings.includes('camera') || blockedsettings.includes('snapshoturl')"
|
||||
attach></v-select>
|
||||
:disabled="blockedsettings.includes('camera') || blockedsettings.includes('snapshoturl')" />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.Mode')"
|
||||
:sub-title="$t('Settings.TimelapseTab.ModeDescription')">
|
||||
@@ -47,11 +46,10 @@
|
||||
hide-details
|
||||
outlined
|
||||
dense
|
||||
:disabled="blockedsettings.includes('modeOptions')"
|
||||
attach></v-select>
|
||||
:disabled="blockedsettings.includes('modeOptions')" />
|
||||
</settings-row>
|
||||
<template v-if="mode === 'hyperlapse'">
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.HyperlapseCycle')"
|
||||
:sub-title="$t('Settings.TimelapseTab.HyperlapseCycleDescription')">
|
||||
@@ -63,10 +61,10 @@
|
||||
outlined
|
||||
dense
|
||||
:disabled="blockedsettings.includes('hyperlapseCycle')"
|
||||
hide-spin-buttons></v-text-field>
|
||||
hide-spin-buttons />
|
||||
</settings-row>
|
||||
</template>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.PreviewImage')"
|
||||
:sub-title="$t('Settings.TimelapseTab.PreviewImageDescription')"
|
||||
@@ -75,9 +73,9 @@
|
||||
v-model="previewimage"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
:disabled="blockedsettings.includes('previewimage')"></v-switch>
|
||||
:disabled="blockedsettings.includes('previewimage')" />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.SaveFrames')"
|
||||
:sub-title="$t('Settings.TimelapseTab.SaveFramesDescription')"
|
||||
@@ -86,9 +84,9 @@
|
||||
v-model="saveframes"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
:disabled="blockedsettings.includes('saveframes')"></v-switch>
|
||||
:disabled="blockedsettings.includes('saveframes')" />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.StreamDelayCompensation')"
|
||||
:sub-title="$t('Settings.TimelapseTab.StreamDelayCompensationDescription')">
|
||||
@@ -100,9 +98,9 @@
|
||||
hide-details="auto"
|
||||
outlined
|
||||
dense
|
||||
:disabled="blockedsettings.includes('stream_delay_compensation')"></v-text-field>
|
||||
:disabled="blockedsettings.includes('stream_delay_compensation')" />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.GcodeVerbose')"
|
||||
:sub-title="$t('Settings.TimelapseTab.GcodeVerboseDescription')"
|
||||
@@ -111,9 +109,9 @@
|
||||
v-model="gcode_verbose"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
:disabled="blockedsettings.includes('gcode_verbose')"></v-switch>
|
||||
:disabled="blockedsettings.includes('gcode_verbose')" />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<h3 class="text-h5 mt-6 mb-3">{{ $t('Settings.TimelapseTab.Parkhead') }}</h3>
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.Parkhead')"
|
||||
@@ -123,10 +121,10 @@
|
||||
v-model="parkhead"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
:disabled="blockedsettings.includes('parkhead')"></v-switch>
|
||||
:disabled="blockedsettings.includes('parkhead')" />
|
||||
</settings-row>
|
||||
<template v-if="parkhead">
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.Parkpos')"
|
||||
:sub-title="$t('Settings.TimelapseTab.ParkposDescription')">
|
||||
@@ -136,11 +134,10 @@
|
||||
hide-details
|
||||
outlined
|
||||
dense
|
||||
:disabled="blockedsettings.includes('parkposOptions')"
|
||||
attach></v-select>
|
||||
:disabled="blockedsettings.includes('parkposOptions')" />
|
||||
</settings-row>
|
||||
<template v-if="parkpos === 'custom'">
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<template v-if="['x_only', 'custom'].includes(parkpos)">
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.PosX')"
|
||||
:sub-title="$t('Settings.TimelapseTab.PosXDescription')">
|
||||
@@ -152,9 +149,11 @@
|
||||
outlined
|
||||
dense
|
||||
:disabled="blockedsettings.includes('park_custom_pos_x')"
|
||||
hide-spin-buttons></v-text-field>
|
||||
hide-spin-buttons />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
</template>
|
||||
<template v-if="['y_only', 'custom'].includes(parkpos)">
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.PosY')"
|
||||
:sub-title="$t('Settings.TimelapseTab.PosYDescription')">
|
||||
@@ -166,9 +165,11 @@
|
||||
outlined
|
||||
dense
|
||||
:disabled="blockedsettings.includes('park_custom_pos_y')"
|
||||
hide-spin-buttons></v-text-field>
|
||||
hide-spin-buttons />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
</template>
|
||||
<template v-if="['x_only', 'y_only', 'custom'].includes(parkpos)">
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.PosDZ')"
|
||||
:sub-title="$t('Settings.TimelapseTab.PosDZDescription')">
|
||||
@@ -180,10 +181,10 @@
|
||||
outlined
|
||||
dense
|
||||
:disabled="blockedsettings.includes('park_custom_pos_dz')"
|
||||
hide-spin-buttons></v-text-field>
|
||||
hide-spin-buttons />
|
||||
</settings-row>
|
||||
</template>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.TravelSpeed')"
|
||||
:sub-title="$t('Settings.TimelapseTab.TravelSpeedDescription')">
|
||||
@@ -195,9 +196,9 @@
|
||||
outlined
|
||||
dense
|
||||
:disabled="blockedsettings.includes('park_travel_speed')"
|
||||
hide-spin-buttons></v-text-field>
|
||||
hide-spin-buttons />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.FwRetract')"
|
||||
:sub-title="$t('Settings.TimelapseTab.FwRetractDescription')"
|
||||
@@ -206,10 +207,10 @@
|
||||
v-model="fw_retract"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
:disabled="blockedsettings.includes('fw_retract')"></v-switch>
|
||||
:disabled="blockedsettings.includes('fw_retract')" />
|
||||
</settings-row>
|
||||
<template v-if="!fw_retract">
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.RetractSpeed')"
|
||||
:sub-title="$t('Settings.TimelapseTab.RetractSpeedDescription')">
|
||||
@@ -221,9 +222,9 @@
|
||||
outlined
|
||||
dense
|
||||
:disabled="blockedsettings.includes('park_retract_speed')"
|
||||
hide-spin-buttons></v-text-field>
|
||||
hide-spin-buttons />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.RetractDistance')"
|
||||
:sub-title="$t('Settings.TimelapseTab.RetractDistanceDescription')">
|
||||
@@ -235,9 +236,9 @@
|
||||
outlined
|
||||
dense
|
||||
:disabled="blockedsettings.includes('park_retract_distance')"
|
||||
hide-spin-buttons></v-text-field>
|
||||
hide-spin-buttons />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.UnretractSpeed')"
|
||||
:sub-title="$t('Settings.TimelapseTab.UnretractSpeedDescription')">
|
||||
@@ -249,9 +250,9 @@
|
||||
outlined
|
||||
dense
|
||||
:disabled="blockedsettings.includes('park_extrude_speed')"
|
||||
hide-spin-buttons></v-text-field>
|
||||
hide-spin-buttons />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.UnretractDistance')"
|
||||
:sub-title="$t('Settings.TimelapseTab.UnretractDistanceDescription')">
|
||||
@@ -263,10 +264,10 @@
|
||||
outlined
|
||||
dense
|
||||
:disabled="blockedsettings.includes('park_extrude_distance')"
|
||||
hide-spin-buttons></v-text-field>
|
||||
hide-spin-buttons />
|
||||
</settings-row>
|
||||
</template>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.ParkTime')"
|
||||
:sub-title="$t('Settings.TimelapseTab.ParkTimeDescription')">
|
||||
@@ -278,10 +279,10 @@
|
||||
step="0.1"
|
||||
outlined
|
||||
dense
|
||||
:disabled="blockedsettings.includes('park_time')"></v-text-field>
|
||||
:disabled="blockedsettings.includes('park_time')" />
|
||||
</settings-row>
|
||||
</template>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<h3 class="text-h5 mt-6 mb-3">{{ $t('Settings.TimelapseTab.RenderingOptions') }}</h3>
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.VariableFps')"
|
||||
@@ -291,10 +292,10 @@
|
||||
v-model="variable_fps"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
:disabled="blockedsettings.includes('variable_fps')"></v-switch>
|
||||
:disabled="blockedsettings.includes('variable_fps')" />
|
||||
</settings-row>
|
||||
<template v-if="variable_fps">
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.Targetlength')"
|
||||
:sub-title="$t('Settings.TimelapseTab.TargetlengthDescription')">
|
||||
@@ -306,9 +307,9 @@
|
||||
outlined
|
||||
dense
|
||||
:disabled="blockedsettings.includes('targetlength')"
|
||||
hide-spin-buttons></v-text-field>
|
||||
hide-spin-buttons />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.VariableFpsMin')"
|
||||
:sub-title="$t('Settings.TimelapseTab.VariableFpsMinDescription')">
|
||||
@@ -320,9 +321,9 @@
|
||||
outlined
|
||||
dense
|
||||
:disabled="blockedsettings.includes('variable_fps_min')"
|
||||
hide-spin-buttons></v-text-field>
|
||||
hide-spin-buttons />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.VariableFpsMax')"
|
||||
:sub-title="$t('Settings.TimelapseTab.VariableFpsMaxDescription')">
|
||||
@@ -334,11 +335,11 @@
|
||||
outlined
|
||||
dense
|
||||
:disabled="blockedsettings.includes('variable_fps_max')"
|
||||
hide-spin-buttons></v-text-field>
|
||||
hide-spin-buttons />
|
||||
</settings-row>
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.OutputFramerate')"
|
||||
:sub-title="$t('Settings.TimelapseTab.OutputFramerateDescription')">
|
||||
@@ -350,10 +351,10 @@
|
||||
outlined
|
||||
dense
|
||||
:disabled="blockedsettings.includes('output_framerate')"
|
||||
hide-spin-buttons></v-text-field>
|
||||
hide-spin-buttons />
|
||||
</settings-row>
|
||||
</template>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.duplicatelastframe')"
|
||||
:sub-title="$t('Settings.TimelapseTab.duplicatelastframeDescription')">
|
||||
@@ -364,9 +365,9 @@
|
||||
outlined
|
||||
dense
|
||||
:disabled="blockedsettings.includes('duplicatelastframe')"
|
||||
hide-spin-buttons></v-text-field>
|
||||
hide-spin-buttons />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.ConstantRateFactor')"
|
||||
:sub-title="$t('Settings.TimelapseTab.ConstantRateFactorDescription')">
|
||||
@@ -377,9 +378,9 @@
|
||||
outlined
|
||||
dense
|
||||
:disabled="blockedsettings.includes('constant_rate_factor')"
|
||||
hide-spin-buttons></v-text-field>
|
||||
hide-spin-buttons />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.Pixelformat')"
|
||||
:sub-title="$t('Settings.TimelapseTab.PixelformatDescription')">
|
||||
@@ -389,9 +390,9 @@
|
||||
hide-details="auto"
|
||||
outlined
|
||||
dense
|
||||
:disabled="blockedsettings.includes('pixelformat')"></v-text-field>
|
||||
:disabled="blockedsettings.includes('pixelformat')" />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.TimeFormatCode')"
|
||||
:sub-title="$t('Settings.TimelapseTab.TimeFormatCodeDescription')">
|
||||
@@ -401,9 +402,9 @@
|
||||
hide-details="auto"
|
||||
outlined
|
||||
dense
|
||||
:disabled="blockedsettings.includes('time_format_code')"></v-text-field>
|
||||
:disabled="blockedsettings.includes('time_format_code')" />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.TimelapseTab.Extraoutputparams')"
|
||||
:sub-title="$t('Settings.TimelapseTab.ExtraoutputparamsDescription')">
|
||||
@@ -413,7 +414,7 @@
|
||||
hide-details="auto"
|
||||
outlined
|
||||
dense
|
||||
:disabled="blockedsettings.includes('extraoutputparams')"></v-text-field>
|
||||
:disabled="blockedsettings.includes('extraoutputparams')" />
|
||||
</settings-row>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
@@ -463,6 +464,14 @@ export default class SettingsTimelapseTab extends Mixins(BaseMixin) {
|
||||
text: 'back_right',
|
||||
value: 'back_right',
|
||||
},
|
||||
{
|
||||
text: 'x_only',
|
||||
value: 'x_only',
|
||||
},
|
||||
{
|
||||
text: 'y_only',
|
||||
value: 'y_only',
|
||||
},
|
||||
{
|
||||
text: 'custom',
|
||||
value: 'custom',
|
||||
@@ -474,11 +483,11 @@ export default class SettingsTimelapseTab extends Mixins(BaseMixin) {
|
||||
const output: any = []
|
||||
|
||||
webcams
|
||||
.filter((webcam: GuiWebcamStateWebcam) => webcam.urlSnapshot !== '')
|
||||
.filter((webcam: GuiWebcamStateWebcam) => webcam.snapshot_url !== '')
|
||||
.forEach((webcam: GuiWebcamStateWebcam) => {
|
||||
output.push({
|
||||
text: webcam.name,
|
||||
value: webcam.id,
|
||||
value: webcam.name,
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
</v-btn>
|
||||
<v-menu bottom left offset-y :close-on-content-click="false">
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-btn v-bind="attrs" :color="logoColor" class="minwidth-0 px-5" small v-on="on"></v-btn>
|
||||
<v-btn v-bind="attrs" :color="logoColor" class="minwidth-0 px-5" small v-on="on" />
|
||||
</template>
|
||||
<v-color-picker
|
||||
:value="logoColor"
|
||||
@@ -22,7 +22,7 @@
|
||||
@update:color="updateLogoColor"></v-color-picker>
|
||||
</v-menu>
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row :title="$t('Settings.UiSettingsTab.Primary').toString()">
|
||||
<v-btn
|
||||
v-if="primaryColor.toLowerCase() !== defaultPrimaryColor.toLowerCase()"
|
||||
@@ -34,16 +34,16 @@
|
||||
</v-btn>
|
||||
<v-menu bottom left offset-y :close-on-content-click="false">
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-btn v-bind="attrs" :color="primaryColor" class="minwidth-0 px-5" small v-on="on"></v-btn>
|
||||
<v-btn v-bind="attrs" :color="primaryColor" class="minwidth-0 px-5" small v-on="on" />
|
||||
</template>
|
||||
<v-color-picker
|
||||
:value="primaryColor"
|
||||
hide-mode-switch
|
||||
mode="rgba"
|
||||
@update:color="updatePrimaryColor"></v-color-picker>
|
||||
@update:color="updatePrimaryColor" />
|
||||
</v-menu>
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.UiSettingsTab.GcodeThumbnails').toString()"
|
||||
:sub-title="$t('Settings.UiSettingsTab.GcodeThumbnailsDescription').toString()"
|
||||
@@ -52,37 +52,33 @@
|
||||
outlined
|
||||
small
|
||||
color="primary"
|
||||
href="https://docs.mainsail.xyz/quicktips/thumbnails"
|
||||
href="https://docs.mainsail.xyz/overview/features/thumbnails"
|
||||
target="_blank">
|
||||
{{ $t('Settings.UiSettingsTab.Guide') }}
|
||||
{{ $t('Settings.UiSettingsTab.Guide').toString() }}
|
||||
</v-btn>
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.UiSettingsTab.BoolBigThumbnail').toString()"
|
||||
:sub-title="$t('Settings.UiSettingsTab.BoolBigThumbnailDescription').toString()"
|
||||
:dynamic-slot-width="true">
|
||||
<v-switch v-model="boolBigThumbnail" hide-details class="mt-0"></v-switch>
|
||||
<v-switch v-model="boolBigThumbnail" hide-details class="mt-0" />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<settings-row :title="$t('Settings.UiSettingsTab.ShowWebcamInNavigation').toString()">
|
||||
<v-switch v-model="boolWebcamInNavigation" hide-details class="mt-0"></v-switch>
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.UiSettingsTab.DisplayCANCEL_PRINT').toString()"
|
||||
:sub-title="$t('Settings.UiSettingsTab.DisplayCANCEL_PRINTDescription').toString()"
|
||||
:dynamic-slot-width="true">
|
||||
<v-switch v-model="displayCancelPrint" hide-details class="mt-0"></v-switch>
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.UiSettingsTab.LockSliders').toString()"
|
||||
:sub-title="$t('Settings.UiSettingsTab.LockSlidersDescription').toString()"
|
||||
:dynamic-slot-width="true">
|
||||
<v-switch v-model="lockSliders" hide-details class="mt-0"></v-switch>
|
||||
<v-switch v-model="lockSliders" hide-details class="mt-0" />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<v-expand-transition>
|
||||
<settings-row
|
||||
v-show="lockSliders"
|
||||
@@ -103,24 +99,24 @@
|
||||
hide-details
|
||||
outlined
|
||||
dense
|
||||
hide-spin-buttons></v-text-field>
|
||||
hide-spin-buttons />
|
||||
</settings-row>
|
||||
</v-expand-transition>
|
||||
<v-divider v-show="lockSliders" class="my-2"></v-divider>
|
||||
<v-divider v-show="lockSliders" class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.UiSettingsTab.ConfirmOnEmergencyStop').toString()"
|
||||
:sub-title="$t('Settings.UiSettingsTab.ConfirmOnEmergencyStopDescription').toString()"
|
||||
:dynamic-slot-width="true">
|
||||
<v-switch v-model="confirmOnEmergencyStop" hide-details class="mt-0"></v-switch>
|
||||
<v-switch v-model="confirmOnEmergencyStop" hide-details class="mt-0" />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.UiSettingsTab.ConfirmOnPowerDeviceChange').toString()"
|
||||
:sub-title="$t('Settings.UiSettingsTab.ConfirmOnPowerDeviceChangeDescription').toString()"
|
||||
:dynamic-slot-width="true">
|
||||
<v-switch v-model="confirmOnPowerDeviceChange" hide-details class="mt-0"></v-switch>
|
||||
<v-switch v-model="confirmOnPowerDeviceChange" hide-details class="mt-0" />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.UiSettingsTab.NavigationStyle').toString()"
|
||||
:sub-title="$t('Settings.UiSettingsTab.NavigationStyleDescription').toString()">
|
||||
@@ -130,15 +126,81 @@
|
||||
class="mt-0"
|
||||
hide-details
|
||||
outlined
|
||||
attach
|
||||
dense></v-select>
|
||||
dense />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.UiSettingsTab.BoolHideUploadAndPrintButton').toString()"
|
||||
:sub-title="$t('Settings.UiSettingsTab.BoolHideUploadAndPrintButtonDescription').toString()"
|
||||
:dynamic-slot-width="true">
|
||||
<v-switch v-model="boolHideUploadAndPrintButton" hide-details class="mt-0"></v-switch>
|
||||
<v-switch v-model="boolHideUploadAndPrintButton" hide-details class="mt-0" />
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<settings-row
|
||||
:title="$t('Settings.UiSettingsTab.PowerDeviceName').toString()"
|
||||
:sub-title="$t('Settings.UiSettingsTab.PowerDeviceNameDescription').toString()"
|
||||
:dynamic-slot-width="true">
|
||||
<v-select
|
||||
v-model="powerDeviceName"
|
||||
:items="powerDeviceOptions"
|
||||
class="mt-0"
|
||||
hide-details
|
||||
outlined
|
||||
dense />
|
||||
</settings-row>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.UiSettingsTab.HideSaveConfigButtonForBedMesh').toString()"
|
||||
:sub-title="$t('Settings.UiSettingsTab.HideSaveConfigButtonForBedMeshDescription').toString()"
|
||||
:dynamic-slot-width="true">
|
||||
<v-switch v-model="hideSaveConfigForBedMash" hide-details class="mt-0" />
|
||||
</settings-row>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.UiSettingsTab.DisableFanAnimation').toString()"
|
||||
:sub-title="$t('Settings.UiSettingsTab.DisableFanAnimationDescription').toString()"
|
||||
:dynamic-slot-width="true">
|
||||
<v-switch v-model="disableFanAnimation" hide-details class="mt-0" />
|
||||
</settings-row>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.UiSettingsTab.ManualProbeDialog').toString()"
|
||||
:sub-title="$t('Settings.UiSettingsTab.ManualProbeDialogDescription').toString()"
|
||||
:dynamic-slot-width="true">
|
||||
<v-switch v-model="boolManualProbeDialog" hide-details class="mt-0" />
|
||||
</settings-row>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.UiSettingsTab.BedScrewsDialog').toString()"
|
||||
:sub-title="$t('Settings.UiSettingsTab.BedScrewsDialogDescription').toString()"
|
||||
:dynamic-slot-width="true">
|
||||
<v-switch v-model="boolBedScrewsDialog" hide-details class="mt-0" />
|
||||
</settings-row>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.UiSettingsTab.ScrewsTiltAdjustDialog').toString()"
|
||||
:sub-title="$t('Settings.UiSettingsTab.ScrewsTiltAdjustDialogDescription').toString()"
|
||||
:dynamic-slot-width="true">
|
||||
<v-switch v-model="boolScrewsTiltAdjustDialog" hide-details class="mt-0" />
|
||||
</settings-row>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.UiSettingsTab.TempchartHeight').toString()"
|
||||
:sub-title="$t('Settings.UiSettingsTab.TempchartHeightDescription').toString()">
|
||||
<v-slider
|
||||
v-model.lazy="tempchartHeight"
|
||||
hide-details
|
||||
:min="100"
|
||||
:max="500"
|
||||
:step="1"
|
||||
:label="tempchartHeight + 'px'" />
|
||||
</settings-row>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.UiSettingsTab.HideUpdateWarnings').toString()"
|
||||
:sub-title="$t('Settings.UiSettingsTab.HideUpdateWarningsDescription').toString()"
|
||||
:dynamic-slot-width="true">
|
||||
<v-switch v-model="hideUpdateWarnings" hide-details class="mt-0" />
|
||||
</settings-row>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
@@ -153,6 +215,7 @@ import SettingsRow from '@/components/settings/SettingsRow.vue'
|
||||
import { defaultLogoColor, defaultPrimaryColor } from '@/store/variables'
|
||||
import { Debounce } from 'vue-debounce-decorator'
|
||||
import { mdiRestart, mdiTimerOutline } from '@mdi/js'
|
||||
import { ServerPowerStateDevice } from '@/store/server/power/types'
|
||||
|
||||
@Component({
|
||||
components: { SettingsRow },
|
||||
@@ -188,14 +251,6 @@ export default class SettingsUiSettingsTab extends Mixins(BaseMixin) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'uiSettings.boolBigThumbnail', value: newVal })
|
||||
}
|
||||
|
||||
get boolWebcamInNavigation() {
|
||||
return this.$store.state.gui.uiSettings.boolWebcamNavi ?? false
|
||||
}
|
||||
|
||||
set boolWebcamInNavigation(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'uiSettings.boolWebcamNavi', value: newVal })
|
||||
}
|
||||
|
||||
get displayCancelPrint() {
|
||||
return this.$store.state.gui.uiSettings.displayCancelPrint
|
||||
}
|
||||
@@ -271,6 +326,96 @@ export default class SettingsUiSettingsTab extends Mixins(BaseMixin) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'uiSettings.boolHideUploadAndPrintButton', value: newVal })
|
||||
}
|
||||
|
||||
get powerDevices() {
|
||||
return this.$store.getters['server/power/getDevices'] ?? []
|
||||
}
|
||||
|
||||
get autoPowerDevice() {
|
||||
const autoIndex = this.powerDevices.findIndex((device: ServerPowerStateDevice) => device.device === 'printer')
|
||||
if (autoIndex === -1) return '--'
|
||||
|
||||
return this.powerDevices[autoIndex].device
|
||||
}
|
||||
|
||||
get powerDeviceName() {
|
||||
return this.$store.state.gui.uiSettings.powerDeviceName ?? null
|
||||
}
|
||||
|
||||
set powerDeviceName(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'uiSettings.powerDeviceName', value: newVal })
|
||||
}
|
||||
|
||||
get powerDeviceOptions() {
|
||||
const items: { text: string; value: string | null }[] = [
|
||||
{ text: `Auto (${this.autoPowerDevice})`, value: null },
|
||||
]
|
||||
|
||||
this.powerDevices.forEach((device: ServerPowerStateDevice) => {
|
||||
items.push({
|
||||
text: `${device.device} (${device.type})`,
|
||||
value: device.device.toString(),
|
||||
})
|
||||
})
|
||||
|
||||
return items
|
||||
}
|
||||
|
||||
get hideSaveConfigForBedMash() {
|
||||
return this.$store.state.gui.uiSettings.hideSaveConfigForBedMash ?? false
|
||||
}
|
||||
|
||||
set hideSaveConfigForBedMash(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'uiSettings.hideSaveConfigForBedMash', value: newVal })
|
||||
}
|
||||
|
||||
get disableFanAnimation() {
|
||||
return this.$store.state.gui.uiSettings.disableFanAnimation ?? false
|
||||
}
|
||||
|
||||
set disableFanAnimation(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'uiSettings.disableFanAnimation', value: newVal })
|
||||
}
|
||||
|
||||
get boolManualProbeDialog() {
|
||||
return this.$store.state.gui.uiSettings.boolManualProbeDialog ?? true
|
||||
}
|
||||
|
||||
set boolManualProbeDialog(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'uiSettings.boolManualProbeDialog', value: newVal })
|
||||
}
|
||||
|
||||
get boolBedScrewsDialog() {
|
||||
return this.$store.state.gui.uiSettings.boolBedScrewsDialog ?? true
|
||||
}
|
||||
|
||||
set boolBedScrewsDialog(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'uiSettings.boolBedScrewsDialog', value: newVal })
|
||||
}
|
||||
|
||||
get boolScrewsTiltAdjustDialog() {
|
||||
return this.$store.state.gui.uiSettings.boolScrewsTiltAdjustDialog ?? true
|
||||
}
|
||||
|
||||
set boolScrewsTiltAdjustDialog(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'uiSettings.boolScrewsTiltAdjustDialog', value: newVal })
|
||||
}
|
||||
|
||||
get tempchartHeight() {
|
||||
return this.$store.state.gui.uiSettings.tempchartHeight ?? 250
|
||||
}
|
||||
|
||||
set tempchartHeight(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'uiSettings.tempchartHeight', value: newVal })
|
||||
}
|
||||
|
||||
get hideUpdateWarnings() {
|
||||
return this.$store.state.gui.uiSettings.hideUpdateWarnings ?? false
|
||||
}
|
||||
|
||||
set hideUpdateWarnings(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'uiSettings.hideUpdateWarnings', value: newVal })
|
||||
}
|
||||
|
||||
clearColorObject(color: any): string {
|
||||
if (typeof color === 'object' && 'hex' in color) color = color.hex
|
||||
if (color.length > 7) color = color.substr(0, 7)
|
||||
|
||||
@@ -1,213 +1,25 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-card v-if="!form.bool" flat>
|
||||
<v-card v-if="!boolForm" flat>
|
||||
<v-card-text>
|
||||
<h3 class="text-h5 mb-3">{{ $t('Settings.WebcamsTab.Webcams') }}</h3>
|
||||
<div v-for="webcam in webcams" :key="webcam.id">
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<settings-row
|
||||
:title="webcam.name"
|
||||
:icon="convertWebcamIcon(webcam.icon)"
|
||||
:sub-title="getSubtitle(webcam)">
|
||||
<v-btn small outlined @click="editWebcam(webcam)">
|
||||
<v-icon small left>{{ mdiPencil }}</v-icon>
|
||||
{{ $t('Settings.Edit') }}
|
||||
</v-btn>
|
||||
<v-btn
|
||||
small
|
||||
outlined
|
||||
class="ml-3 minwidth-0 px-2"
|
||||
color="error"
|
||||
@click="deleteWebcam(webcam.id)">
|
||||
<v-icon small>{{ mdiDelete }}</v-icon>
|
||||
</v-btn>
|
||||
</settings-row>
|
||||
</div>
|
||||
<webcam-list-entry
|
||||
v-for="(webcam, index) in webcams"
|
||||
:key="webcam.name"
|
||||
:webcam="webcam"
|
||||
:bool-border-top="index > 0"
|
||||
@edit-webcam="editWebcam" />
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-btn v-if="existCrowsnestConf" text color="primary" @click="openCrowsnestConf">
|
||||
{{ $t('Settings.WebcamsTab.EditCrowsnestConf') }}
|
||||
</v-btn>
|
||||
<v-spacer></v-spacer>
|
||||
<v-spacer />
|
||||
<v-btn text color="primary" @click="createWebcam">{{ $t('Settings.WebcamsTab.AddWebcam') }}</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
<v-card v-else flat>
|
||||
<v-form ref="webcamForm" v-model="form.valid" @submit.prevent="saveWebcam">
|
||||
<v-card-title>
|
||||
{{
|
||||
form.id === null ? $t('Settings.WebcamsTab.CreateWebcam') : $t('Settings.WebcamsTab.EditWebcam')
|
||||
}}
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col class="col-12 col-sm-6">
|
||||
<v-row>
|
||||
<v-col class="d-flex">
|
||||
<v-item-group>
|
||||
<v-menu :offset-y="true" title="Icon">
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-btn
|
||||
class="px-2 mr-2 _transition _menu-button"
|
||||
color="transparent"
|
||||
v-bind="attrs"
|
||||
elevation="0"
|
||||
:ripple="false"
|
||||
v-on="on"
|
||||
@blur="selectIcon = !selectIcon"
|
||||
@focus="selectIcon = !selectIcon">
|
||||
<v-icon>{{ convertWebcamIcon(form.icon) }}</v-icon>
|
||||
<v-icon
|
||||
:class="!selectIcon ? '' : '_rotate-180'"
|
||||
:color="!selectIcon ? '' : 'primary'"
|
||||
class="pl-1 mr-n2">
|
||||
{{ mdiMenuDown }}
|
||||
</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-list dense class="py-0">
|
||||
<v-list-item
|
||||
v-for="icon of iconItems"
|
||||
:key="icon.value"
|
||||
link
|
||||
@click="setFormIcon(icon.value)">
|
||||
<v-list-item-icon class="mr-2">
|
||||
<v-icon small class="mt-1">
|
||||
{{ convertWebcamIcon(icon.value) }}
|
||||
</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title v-text="icon.text"></v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</v-item-group>
|
||||
<v-text-field
|
||||
v-model="form.name"
|
||||
:label="$t('Settings.WebcamsTab.Name')"
|
||||
hide-details="auto"
|
||||
outlined
|
||||
:rules="[rules.required, rules.unique]"
|
||||
class="_webcam-settings-name-field"
|
||||
dense></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="py-2">
|
||||
<v-text-field
|
||||
v-model="form.urlStream"
|
||||
:label="$t('Settings.WebcamsTab.UrlStream')"
|
||||
hide-details="auto"
|
||||
outlined
|
||||
dense
|
||||
:rules="
|
||||
form.service !== 'mjpegstreamer-adaptive' ? [rules.required] : []
|
||||
"></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="py-2">
|
||||
<v-text-field
|
||||
v-model="form.urlSnapshot"
|
||||
:label="$t('Settings.WebcamsTab.UrlSnapshot')"
|
||||
hide-details="auto"
|
||||
outlined
|
||||
dense
|
||||
:rules="
|
||||
form.service === 'mjpegstreamer-adaptive' ? [rules.required] : []
|
||||
"></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="py-2">
|
||||
<v-select
|
||||
v-model="form.service"
|
||||
:items="serviceItems"
|
||||
hide-details
|
||||
outlined
|
||||
dense
|
||||
:label="$t('Settings.WebcamsTab.Service')"
|
||||
attach></v-select>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-if="form.service === 'mjpegstreamer-adaptive'">
|
||||
<v-col class="py-2 col-6">
|
||||
<v-text-field
|
||||
v-model="form.targetFps"
|
||||
outlined
|
||||
dense
|
||||
hide-details
|
||||
:label="$t('Settings.WebcamsTab.TargetFPS')"></v-text-field>
|
||||
</v-col>
|
||||
<v-col class="py-2 col-6">
|
||||
<v-select
|
||||
v-model="form.rotate"
|
||||
:items="rotateItems"
|
||||
outlined
|
||||
dense
|
||||
hide-details
|
||||
:label="$t('Settings.WebcamsTab.Rotate')"></v-select>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="pt-1 pb-3">
|
||||
<div class="v-label v-label--active theme--dark text-subtitle-1">
|
||||
{{ $t('Settings.WebcamsTab.FlipWebcam') }}
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="mt-0">
|
||||
<v-col class="py-0">
|
||||
<v-checkbox
|
||||
v-model="form.flipX"
|
||||
class="mt-1"
|
||||
hide-details
|
||||
:label="$t('Settings.WebcamsTab.Horizontally')"></v-checkbox>
|
||||
</v-col>
|
||||
<v-col class="py-0">
|
||||
<v-checkbox
|
||||
v-model="form.flipY"
|
||||
class="mt-1"
|
||||
hide-details
|
||||
:label="$t('Settings.WebcamsTab.Vertically')"></v-checkbox>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
<v-col class="col-12 col-sm-6 text-center" align-self="center">
|
||||
<template v-if="form.service === 'mjpegstreamer'">
|
||||
<webcam-mjpegstreamer :cam-settings="form"></webcam-mjpegstreamer>
|
||||
</template>
|
||||
<template v-else-if="form.service === 'mjpegstreamer-adaptive'">
|
||||
<webcam-mjpegstreamer-adaptive :cam-settings="form"></webcam-mjpegstreamer-adaptive>
|
||||
</template>
|
||||
<template v-else-if="form.service === 'uv4l-mjpeg'">
|
||||
<webcam-uv4l-mjpeg :cam-settings="form"></webcam-uv4l-mjpeg>
|
||||
</template>
|
||||
<template v-else-if="form.service === 'ipstream'">
|
||||
<webcam-ipstreamer :cam-settings="form"></webcam-ipstreamer>
|
||||
</template>
|
||||
<template v-else>
|
||||
<p class="text-center py-3 font-italic">
|
||||
{{ $t('Panels.WebcamPanel.UnknownWebcamService') }}
|
||||
</p>
|
||||
</template>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
<v-card-actions class="d-flex justify-end">
|
||||
<v-btn text @click="form.bool = false">
|
||||
{{ $t('Settings.Cancel') }}
|
||||
</v-btn>
|
||||
<v-btn color="primary" text type="submit" :disabled="!form.name">
|
||||
{{
|
||||
form.id === null
|
||||
? $t('Settings.WebcamsTab.SaveWebcam')
|
||||
: $t('Settings.WebcamsTab.UpdateWebcam')
|
||||
}}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-form>
|
||||
<webcam-form :webcam="formWebcam" :type="typeForm" @close="closeForm" />
|
||||
</v-card>
|
||||
</div>
|
||||
</template>
|
||||
@@ -216,112 +28,30 @@
|
||||
import { Component, Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '../mixins/base'
|
||||
import SettingsRow from '@/components/settings/SettingsRow.vue'
|
||||
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
|
||||
import Mjpegstreamer from '@/components/webcams/Mjpegstreamer.vue'
|
||||
import MjpegstreamerAdaptive from '@/components/webcams/MjpegstreamerAdaptive.vue'
|
||||
import Uv4lMjpeg from '@/components/webcams/Uv4lMjpeg.vue'
|
||||
import Ipstreamer from '@/components/webcams/Ipstreamer.vue'
|
||||
import { mdiMenuDown, mdiDelete, mdiPencil, mdiWebcam } from '@mdi/js'
|
||||
import { mdiDelete, mdiPencil } from '@mdi/js'
|
||||
import WebcamMixin from '@/components/mixins/webcam'
|
||||
import { FileStateFile } from '@/store/files/types'
|
||||
|
||||
interface webcamForm {
|
||||
bool: boolean
|
||||
id: string | null
|
||||
valid: boolean
|
||||
name: string
|
||||
icon: string
|
||||
service: string
|
||||
targetFps: number
|
||||
urlStream: string
|
||||
urlSnapshot: string
|
||||
rotate: number
|
||||
flipX: boolean
|
||||
flipY: boolean
|
||||
}
|
||||
import WebcamForm from '@/components/settings/Webcams/WebcamForm.vue'
|
||||
import WebcamListEntry from '@/components/settings/Webcams/WebcamListEntry.vue'
|
||||
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
SettingsRow,
|
||||
'webcam-mjpegstreamer': Mjpegstreamer,
|
||||
'webcam-mjpegstreamer-adaptive': MjpegstreamerAdaptive,
|
||||
'webcam-uv4l-mjpeg': Uv4lMjpeg,
|
||||
'webcam-ipstreamer': Ipstreamer,
|
||||
WebcamForm,
|
||||
WebcamListEntry,
|
||||
},
|
||||
})
|
||||
export default class SettingsWebcamsTab extends Mixins(BaseMixin, WebcamMixin) {
|
||||
mdiPencil = mdiPencil
|
||||
mdiDelete = mdiDelete
|
||||
mdiMenuDown = mdiMenuDown
|
||||
|
||||
private selectIcon: boolean = false
|
||||
|
||||
private form: webcamForm = {
|
||||
bool: false,
|
||||
id: null,
|
||||
valid: false,
|
||||
name: '',
|
||||
icon: '',
|
||||
service: '',
|
||||
targetFps: 15,
|
||||
urlStream: '',
|
||||
urlSnapshot: '',
|
||||
rotate: 0,
|
||||
flipX: false,
|
||||
flipY: false,
|
||||
}
|
||||
|
||||
private rules = {
|
||||
required: (value: string) => value !== '' || this.$t('Settings.WebcamsTab.Required'),
|
||||
unique: (value: string) => !this.existsWebcamName(value) || this.$t('Settings.WebcamsTab.NameAlreadyExists'),
|
||||
}
|
||||
|
||||
private rotateItems = [
|
||||
{ value: 0, text: '0°' },
|
||||
{ value: 90, text: '90°' },
|
||||
{ value: 180, text: '180°' },
|
||||
{ value: 270, text: '270°' },
|
||||
]
|
||||
|
||||
declare $refs: {
|
||||
webcamForm: any
|
||||
}
|
||||
private boolForm = false
|
||||
private typeForm: 'create' | 'edit' = 'create'
|
||||
private formWebcam: GuiWebcamStateWebcam = {} as GuiWebcamStateWebcam
|
||||
|
||||
get webcams() {
|
||||
return this.$store.getters['gui/webcams/getWebcams'] ?? []
|
||||
}
|
||||
|
||||
get iconItems() {
|
||||
return [
|
||||
{ value: 'mdiPrinter3d', text: this.$t('Settings.WebcamsTab.IconPrinter') },
|
||||
{ value: 'mdiPrinter3dNozzle', text: this.$t('Settings.WebcamsTab.IconNozzle') },
|
||||
{ value: 'mdiRadiatorDisabled', text: this.$t('Settings.WebcamsTab.IconBed') },
|
||||
{ value: 'mdiWebcam', text: this.$t('Settings.WebcamsTab.IconCam') },
|
||||
{ value: 'mdiAlbum', text: this.$t('Settings.WebcamsTab.IconFilament') },
|
||||
{ value: 'mdiDoor', text: this.$t('Settings.WebcamsTab.IconDoor') },
|
||||
{ value: 'mdiRaspberryPi', text: this.$t('Settings.WebcamsTab.IconMcu') },
|
||||
{ value: 'mdiCampfire', text: this.$t('Settings.WebcamsTab.IconHot') },
|
||||
]
|
||||
}
|
||||
|
||||
get serviceItems() {
|
||||
return [
|
||||
{ value: 'mjpegstreamer', text: this.$t('Settings.WebcamsTab.Mjpegstreamer') },
|
||||
{ value: 'mjpegstreamer-adaptive', text: this.$t('Settings.WebcamsTab.MjpegstreamerAdaptive') },
|
||||
{ value: 'uv4l-mjpeg', text: this.$t('Settings.WebcamsTab.Uv4lMjpeg') },
|
||||
{ value: 'ipstream', text: this.$t('Settings.WebcamsTab.Ipstream') },
|
||||
]
|
||||
}
|
||||
|
||||
get webcamStyle() {
|
||||
let transforms = ''
|
||||
if (this.form.flipX) transforms += ' scaleX(-1)'
|
||||
if (this.form.flipY) transforms += ' scaleY(-1)'
|
||||
if (transforms.trimLeft().length) {
|
||||
return { transform: transforms.trimLeft() }
|
||||
}
|
||||
|
||||
return ''
|
||||
return this.$store.state.gui.webcams.webcams ?? []
|
||||
}
|
||||
|
||||
get configfiles() {
|
||||
@@ -336,87 +66,6 @@ export default class SettingsWebcamsTab extends Mixins(BaseMixin, WebcamMixin) {
|
||||
return this.configfiles.findIndex((file: FileStateFile) => file.filename === 'crowsnest.conf') !== -1
|
||||
}
|
||||
|
||||
getSubtitle(webcam: GuiWebcamStateWebcam) {
|
||||
return 'URL: ' + (webcam.service === 'mjpegstreamer-adaptive' ? webcam.urlSnapshot : webcam.urlStream)
|
||||
}
|
||||
|
||||
existsWebcamName(name: string) {
|
||||
return (
|
||||
this.webcams.findIndex(
|
||||
(webcam: GuiWebcamStateWebcam) => webcam.name === name && webcam.id !== this.form.id
|
||||
) !== -1
|
||||
)
|
||||
}
|
||||
|
||||
createWebcam() {
|
||||
this.clearDialog()
|
||||
|
||||
this.form.bool = true
|
||||
}
|
||||
|
||||
editWebcam(webcam: GuiWebcamStateWebcam) {
|
||||
this.form.id = webcam.id ?? null
|
||||
this.form.name = webcam.name
|
||||
this.form.icon = webcam.icon
|
||||
this.form.service = webcam.service
|
||||
this.form.targetFps = webcam.targetFps
|
||||
this.form.urlStream = webcam.urlStream
|
||||
this.form.urlSnapshot = webcam.urlSnapshot
|
||||
this.form.rotate = webcam.rotate ?? 0
|
||||
this.form.flipX = webcam.flipX
|
||||
this.form.flipY = webcam.flipY
|
||||
|
||||
this.form.bool = true
|
||||
this.form.valid = false
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.$refs.webcamForm?.validate()
|
||||
})
|
||||
}
|
||||
|
||||
saveWebcam() {
|
||||
if (this.form.valid) {
|
||||
const values = {
|
||||
name: this.form.name,
|
||||
icon: this.form.icon,
|
||||
service: this.form.service,
|
||||
targetFps: this.form.targetFps,
|
||||
urlStream: this.form.urlStream,
|
||||
urlSnapshot: this.form.urlSnapshot,
|
||||
rotate: this.form.rotate,
|
||||
flipX: this.form.flipX,
|
||||
flipY: this.form.flipY,
|
||||
}
|
||||
|
||||
if (this.form.id !== null) this.$store.dispatch('gui/webcams/update', { id: this.form.id, values: values })
|
||||
else this.$store.dispatch('gui/webcams/store', { values })
|
||||
|
||||
this.clearDialog()
|
||||
}
|
||||
}
|
||||
|
||||
deleteWebcam(id: string) {
|
||||
this.$store.dispatch('gui/webcams/delete', id)
|
||||
}
|
||||
|
||||
clearDialog() {
|
||||
this.form.bool = false
|
||||
this.form.id = null
|
||||
this.form.name = ''
|
||||
this.form.icon = mdiWebcam
|
||||
this.form.service = 'mjpegstreamer-adaptive'
|
||||
this.form.targetFps = 15
|
||||
this.form.urlStream = '/webcam/?action=stream'
|
||||
this.form.urlSnapshot = '/webcam/?action=snapshot'
|
||||
this.form.rotate = 0
|
||||
this.form.flipX = false
|
||||
this.form.flipY = false
|
||||
}
|
||||
|
||||
setFormIcon(icon: string) {
|
||||
this.form.icon = icon
|
||||
}
|
||||
|
||||
openCrowsnestConf() {
|
||||
this.$store.dispatch('editor/openFile', {
|
||||
root: 'config',
|
||||
@@ -426,36 +75,35 @@ export default class SettingsWebcamsTab extends Mixins(BaseMixin, WebcamMixin) {
|
||||
permissions: this.crowsnestConf?.permissions,
|
||||
})
|
||||
}
|
||||
|
||||
createWebcam() {
|
||||
this.formWebcam = {
|
||||
name: '',
|
||||
enabled: true,
|
||||
icon: 'mdiWebcam',
|
||||
service: 'mjpegstreamer-adaptive',
|
||||
target_fps: 15,
|
||||
target_fps_idle: 15,
|
||||
stream_url: '/webcam/?action=stream',
|
||||
snapshot_url: '/webcam/?action=snapshot',
|
||||
rotation: 0,
|
||||
flip_horizontal: false,
|
||||
flip_vertical: false,
|
||||
extra_data: {},
|
||||
}
|
||||
|
||||
this.typeForm = 'create'
|
||||
this.boolForm = true
|
||||
}
|
||||
|
||||
closeForm() {
|
||||
this.boolForm = false
|
||||
}
|
||||
|
||||
editWebcam(webcam: GuiWebcamStateWebcam) {
|
||||
this.formWebcam = { ...webcam }
|
||||
this.typeForm = 'edit'
|
||||
this.boolForm = true
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
._transition i::before {
|
||||
transition: transform 500ms;
|
||||
}
|
||||
._rotate-180:before {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.v-item-group {
|
||||
button:hover::before,
|
||||
button:focus::before {
|
||||
opacity: 0 !important;
|
||||
}
|
||||
._menu-button {
|
||||
height: 40px;
|
||||
width: 62px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.25) !important;
|
||||
}
|
||||
._menu-button:hover {
|
||||
border-color: rgba(255, 255, 255, 1) !important;
|
||||
}
|
||||
._menu-button:focus {
|
||||
border: 2px solid var(--color-primary) !important;
|
||||
}
|
||||
}
|
||||
|
||||
._webcam-settings-name-field ::v-deep .v-text-field__details {
|
||||
margin-bottom: -12px !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,324 @@
|
||||
<template>
|
||||
<v-form ref="webcamForm" v-model="valid" @submit.prevent="submit">
|
||||
<v-card-title>{{ title }}</v-card-title>
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col class="col-12 col-sm-6">
|
||||
<v-row>
|
||||
<v-col class="d-flex">
|
||||
<v-item-group>
|
||||
<v-menu v-model="selectIcon" :offset-y="true" title="Icon">
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-btn
|
||||
class="px-2 mr-2 _transition _menu-button"
|
||||
color="transparent"
|
||||
v-bind="attrs"
|
||||
elevation="0"
|
||||
:ripple="false"
|
||||
v-on="on">
|
||||
<v-icon>{{ convertWebcamIcon(webcam.icon) }}</v-icon>
|
||||
<v-icon :class="classIconButtonArrow" class="pl-1 mr-n2">
|
||||
{{ mdiMenuDown }}
|
||||
</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-list dense class="py-0">
|
||||
<v-list-item
|
||||
v-for="icon of iconItems"
|
||||
:key="icon.value"
|
||||
link
|
||||
@click="webcam.icon = icon.value">
|
||||
<v-list-item-icon class="mr-2">
|
||||
<v-icon small class="mt-1">
|
||||
{{ convertWebcamIcon(icon.value) }}
|
||||
</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title v-text="icon.text" />
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</v-item-group>
|
||||
<v-text-field
|
||||
v-model="webcam.name"
|
||||
:label="$t('Settings.WebcamsTab.Name')"
|
||||
hide-details="auto"
|
||||
outlined
|
||||
:rules="[rules.required, rules.unique]"
|
||||
class="_webcam-settings-name-field"
|
||||
dense />
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="py-2">
|
||||
<v-text-field
|
||||
v-model="webcam.stream_url"
|
||||
:label="$t('Settings.WebcamsTab.UrlStream')"
|
||||
hide-details="auto"
|
||||
outlined
|
||||
dense
|
||||
:rules="rulesStreamUrl" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="py-2">
|
||||
<v-text-field
|
||||
v-model="webcam.snapshot_url"
|
||||
:label="$t('Settings.WebcamsTab.UrlSnapshot')"
|
||||
hide-details="auto"
|
||||
outlined
|
||||
dense
|
||||
:rules="rulesSnapshotUrl" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="py-2">
|
||||
<v-select
|
||||
v-model="webcam.service"
|
||||
:items="serviceItems"
|
||||
hide-details
|
||||
outlined
|
||||
dense
|
||||
:label="$t('Settings.WebcamsTab.Service')" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-if="['mjpegstreamer-adaptive', 'jmuxer-stream'].includes(webcam.service)">
|
||||
<v-col class="py-2 col-6">
|
||||
<v-text-field
|
||||
v-model="webcam.target_fps"
|
||||
outlined
|
||||
dense
|
||||
hide-details
|
||||
:label="$t('Settings.WebcamsTab.TargetFPS')" />
|
||||
</v-col>
|
||||
<v-col class="py-2 col-6">
|
||||
<v-select
|
||||
v-model="webcam.rotation"
|
||||
:items="rotationItems"
|
||||
outlined
|
||||
dense
|
||||
hide-details
|
||||
:label="$t('Settings.WebcamsTab.Rotate')" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="pt-1 pb-3">
|
||||
<div class="v-label v-label--active theme--dark text-subtitle-1">
|
||||
{{ $t('Settings.WebcamsTab.FlipWebcam') }}
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="mt-0">
|
||||
<v-col class="py-0">
|
||||
<v-checkbox
|
||||
v-model="webcam.flip_horizontal"
|
||||
class="mt-1"
|
||||
hide-details
|
||||
:label="$t('Settings.WebcamsTab.Horizontally')" />
|
||||
</v-col>
|
||||
<v-col class="py-0">
|
||||
<v-checkbox
|
||||
v-model="webcam.flip_vertical"
|
||||
class="mt-1"
|
||||
hide-details
|
||||
:label="$t('Settings.WebcamsTab.Vertically')" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
<v-col class="col-12 col-sm-6 text-center" align-self="center">
|
||||
<webcam-wrapper :webcam="webcam" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
<v-card-actions class="d-flex justify-end">
|
||||
<v-btn text @click="closeForm">{{ $t('Settings.Cancel') }}</v-btn>
|
||||
<v-btn color="primary" text type="submit" :disabled="!valid">{{ actionButtonText }}</v-btn>
|
||||
</v-card-actions>
|
||||
</v-form>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import SettingsRow from '@/components/settings/SettingsRow.vue'
|
||||
import { mdiDelete, mdiPencil, mdiMenuDown } from '@mdi/js'
|
||||
import WebcamMixin from '@/components/mixins/webcam'
|
||||
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
SettingsRow,
|
||||
},
|
||||
})
|
||||
export default class WebcamForm extends Mixins(BaseMixin, WebcamMixin) {
|
||||
mdiPencil = mdiPencil
|
||||
mdiDelete = mdiDelete
|
||||
mdiMenuDown = mdiMenuDown
|
||||
|
||||
@Prop({ type: Object, required: true }) private webcam!: GuiWebcamStateWebcam
|
||||
@Prop({ type: String, default: 'create' }) readonly type!: 'create' | 'edit'
|
||||
|
||||
private selectIcon = false
|
||||
private valid = false
|
||||
private oldWebcamName = ''
|
||||
|
||||
private rules = {
|
||||
required: (value: string) => value !== '' || this.$t('Settings.WebcamsTab.Required'),
|
||||
unique: (value: string) => !this.existsWebcamName(value) || this.$t('Settings.WebcamsTab.NameAlreadyExists'),
|
||||
}
|
||||
|
||||
get webcams() {
|
||||
return this.$store.state.gui.webcams?.webcams ?? []
|
||||
}
|
||||
|
||||
get title() {
|
||||
if (this.type === 'create') return this.$t('Settings.WebcamsTab.CreateWebcam')
|
||||
|
||||
return this.$t('Settings.WebcamsTab.EditWebcam')
|
||||
}
|
||||
|
||||
get actionButtonText() {
|
||||
if (this.type === 'create') return this.$t('Settings.WebcamsTab.SaveWebcam')
|
||||
|
||||
return this.$t('Settings.WebcamsTab.UpdateWebcam')
|
||||
}
|
||||
|
||||
get rotationItems() {
|
||||
const options = [0, 90, 180, 270]
|
||||
const output: { value: number; text: string }[] = []
|
||||
|
||||
options.forEach((value: number) => {
|
||||
output.push({ value, text: `${value}°` })
|
||||
})
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
get rulesStreamUrl() {
|
||||
let rules = []
|
||||
|
||||
if (this.webcam.service !== 'mjpegstreamer-adaptive') {
|
||||
rules.push(this.rules.required)
|
||||
}
|
||||
|
||||
return rules
|
||||
}
|
||||
|
||||
get rulesSnapshotUrl() {
|
||||
let rules = []
|
||||
|
||||
if (this.webcam.service === 'mjpegstreamer-adaptive') {
|
||||
rules.push(this.rules.required)
|
||||
}
|
||||
|
||||
return rules
|
||||
}
|
||||
|
||||
get serviceItems() {
|
||||
return [
|
||||
{ value: 'mjpegstreamer', text: this.$t('Settings.WebcamsTab.Mjpegstreamer') },
|
||||
{ value: 'mjpegstreamer-adaptive', text: this.$t('Settings.WebcamsTab.MjpegstreamerAdaptive') },
|
||||
{ value: 'uv4l-mjpeg', text: this.$t('Settings.WebcamsTab.Uv4lMjpeg') },
|
||||
{ value: 'ipstream', text: this.$t('Settings.WebcamsTab.Ipstream') },
|
||||
{ value: 'webrtc-camerastreamer', text: this.$t('Settings.WebcamsTab.WebrtcCameraStreamer') },
|
||||
{ value: 'webrtc-mediamtx', text: this.$t('Settings.WebcamsTab.WebrtcMediaMTX') },
|
||||
{ value: 'hlsstream', text: this.$t('Settings.WebcamsTab.Hlsstream') },
|
||||
{ value: 'jmuxer-stream', text: this.$t('Settings.WebcamsTab.JMuxerStream') },
|
||||
{ value: 'webrtc-janus', text: this.$t('Settings.WebcamsTab.WebrtcJanus') },
|
||||
]
|
||||
}
|
||||
|
||||
get iconItems() {
|
||||
return [
|
||||
{ value: 'mdiPrinter3d', text: this.$t('Settings.WebcamsTab.IconPrinter') },
|
||||
{ value: 'mdiPrinter3dNozzle', text: this.$t('Settings.WebcamsTab.IconNozzle') },
|
||||
{ value: 'mdiRadiatorDisabled', text: this.$t('Settings.WebcamsTab.IconBed') },
|
||||
{ value: 'mdiWebcam', text: this.$t('Settings.WebcamsTab.IconCam') },
|
||||
{ value: 'mdiAlbum', text: this.$t('Settings.WebcamsTab.IconFilament') },
|
||||
{ value: 'mdiDoor', text: this.$t('Settings.WebcamsTab.IconDoor') },
|
||||
{ value: 'mdiRaspberryPi', text: this.$t('Settings.WebcamsTab.IconMcu') },
|
||||
{ value: 'mdiCampfire', text: this.$t('Settings.WebcamsTab.IconHot') },
|
||||
]
|
||||
}
|
||||
|
||||
get classIconButtonArrow() {
|
||||
let classes = ['_transition']
|
||||
|
||||
if (this.selectIcon) classes.push('_rotate-180')
|
||||
|
||||
return classes
|
||||
}
|
||||
|
||||
mounted() {
|
||||
this.oldWebcamName = this.webcam.name
|
||||
}
|
||||
|
||||
existsWebcamName(name: string) {
|
||||
name = name.toLowerCase().trim()
|
||||
|
||||
const count =
|
||||
this.webcams.find((webcam: GuiWebcamStateWebcam) => webcam.name.toLowerCase().trim() === name)?.length ?? 0
|
||||
|
||||
// If we are creating a new webcam, we only want to check if the name already exists
|
||||
if (this.type === 'create') return count !== 0
|
||||
|
||||
// If we are editing a webcam, we want to check if the name only exists once (the one we are editing)
|
||||
return count >= 1
|
||||
}
|
||||
|
||||
submit() {
|
||||
if (this.type === 'create') {
|
||||
this.save()
|
||||
return
|
||||
}
|
||||
|
||||
this.update()
|
||||
}
|
||||
|
||||
async save() {
|
||||
await this.$store.dispatch('gui/webcams/store', this.webcam)
|
||||
this.$emit('close')
|
||||
}
|
||||
|
||||
async update() {
|
||||
await this.$store.dispatch('gui/webcams/update', { webcam: this.webcam, oldWebcamName: this.oldWebcamName })
|
||||
this.$emit('close')
|
||||
}
|
||||
|
||||
closeForm() {
|
||||
this.$emit('close')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep ._transition svg {
|
||||
transition: transform 500ms;
|
||||
}
|
||||
::v-deep ._rotate-180 svg {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.v-item-group {
|
||||
button:hover::before,
|
||||
button:focus::before {
|
||||
opacity: 0 !important;
|
||||
}
|
||||
._menu-button {
|
||||
height: 40px;
|
||||
width: 62px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.25) !important;
|
||||
}
|
||||
._menu-button:hover {
|
||||
border-color: rgba(255, 255, 255, 1) !important;
|
||||
}
|
||||
._menu-button:focus {
|
||||
border: 2px solid var(--color-primary) !important;
|
||||
}
|
||||
}
|
||||
|
||||
._webcam-settings-name-field ::v-deep .v-text-field__details {
|
||||
margin-bottom: -12px !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,73 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-divider v-if="boolBorderTop" class="my-2" />
|
||||
<settings-row :title="webcam.name" :icon="icon" :sub-title="subtitle">
|
||||
<template v-if="webcam.source === 'database'">
|
||||
<v-btn
|
||||
class="minwidth-0 px-2"
|
||||
small
|
||||
outlined
|
||||
:color="webcam.enabled ? '' : 'secondary'"
|
||||
@click="toogleStatus">
|
||||
<v-icon small>{{ mdiLightbulbOutline }}</v-icon>
|
||||
</v-btn>
|
||||
<v-btn class="ml-3" small outlined @click="edit">
|
||||
<v-icon small left>{{ mdiPencil }}</v-icon>
|
||||
{{ $t('Settings.Edit') }}
|
||||
</v-btn>
|
||||
<v-btn small outlined class="ml-3 minwidth-0 px-2" color="error" @click="deleteWebcam">
|
||||
<v-icon small>{{ mdiDelete }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
</settings-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import SettingsRow from '@/components/settings/SettingsRow.vue'
|
||||
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
|
||||
import { mdiDelete, mdiPencil, mdiLightbulbOutline } from '@mdi/js'
|
||||
import WebcamMixin from '@/components/mixins/webcam'
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
SettingsRow,
|
||||
},
|
||||
})
|
||||
export default class WebcamListEntry extends Mixins(BaseMixin, WebcamMixin) {
|
||||
mdiPencil = mdiPencil
|
||||
mdiDelete = mdiDelete
|
||||
mdiLightbulbOutline = mdiLightbulbOutline
|
||||
|
||||
@Prop({ type: Object, default: () => {} }) private webcam!: GuiWebcamStateWebcam
|
||||
@Prop({ type: Boolean, default: false }) private boolBorderTop!: boolean
|
||||
|
||||
get icon() {
|
||||
return this.convertWebcamIcon(this.webcam.icon)
|
||||
}
|
||||
|
||||
get subtitle() {
|
||||
if (this.webcam.service === 'mjpegstreamer-adaptive') return `URL: ${this.webcam.snapshot_url}`
|
||||
|
||||
return `URL: ${this.webcam.stream_url}`
|
||||
}
|
||||
|
||||
toogleStatus() {
|
||||
let webcam = { ...this.webcam }
|
||||
webcam.enabled = !webcam.enabled
|
||||
this.$store.dispatch('gui/webcams/update', { webcam: webcam, oldWebcamName: webcam.name })
|
||||
}
|
||||
|
||||
edit() {
|
||||
this.$emit('edit-webcam', this.webcam)
|
||||
}
|
||||
|
||||
deleteWebcam() {
|
||||
this.$store.dispatch('gui/webcams/delete', this.webcam.name)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
+45
-43
@@ -1,37 +1,3 @@
|
||||
<style lang="scss" scoped>
|
||||
.expanded header.v-toolbar {
|
||||
border-bottom-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
|
||||
.btn-collapsible > * {
|
||||
will-change: transform;
|
||||
transition: transform 500ms;
|
||||
}
|
||||
.icon-rotate-90 {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
.v-card.panel .v-toolbar__content {
|
||||
padding-right: 0;
|
||||
}
|
||||
.v-card.panel .v-toolbar__content .subheading {
|
||||
user-select: none;
|
||||
}
|
||||
.panel-toolbar {
|
||||
overflow-y: hidden;
|
||||
}
|
||||
.panel-toolbar .v-btn {
|
||||
height: 100% !important;
|
||||
max-height: none;
|
||||
}
|
||||
.panel-toolbar .v-btn.v-btn--icon {
|
||||
width: var(--panel-toolbar-icon-btn-width) !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-card
|
||||
:class="'panel ' + cardClass + ' ' + (marginBottom ? 'mb-3 mb-md-6' : '') + ' ' + (!expand ? 'expanded' : '')"
|
||||
@@ -43,17 +9,17 @@
|
||||
:class="getToolbarClass"
|
||||
:height="panelToolbarHeight"
|
||||
class="panel-toolbar">
|
||||
<slot name="buttons-left"></slot>
|
||||
<slot name="buttons-left" />
|
||||
<v-toolbar-title class="d-flex align-center">
|
||||
<slot v-if="hasIconSlot" name="icon"></slot>
|
||||
<slot v-if="hasIconSlot" name="icon" />
|
||||
<v-icon v-if="icon !== null && !hasIconSlot" left>{{ icon }}</v-icon>
|
||||
<span v-if="title" class="subheading">{{ title }}</span>
|
||||
</v-toolbar-title>
|
||||
<slot name="buttons-title"></slot>
|
||||
<v-spacer></v-spacer>
|
||||
<slot name="buttons-title" />
|
||||
<v-spacer />
|
||||
<v-toolbar-items v-show="hasButtonsSlot || collapsible">
|
||||
<div v-if="expand || !hideButtonsOnCollapse" class="d-flex align-center">
|
||||
<slot name="buttons"></slot>
|
||||
<slot name="buttons" />
|
||||
</div>
|
||||
<v-btn v-if="collapsible" icon class="btn-collapsible" :ripple="true" @click="expand = !expand">
|
||||
<v-icon :class="expand ? '' : 'icon-rotate-90'">{{ mdiChevronDown }}</v-icon>
|
||||
@@ -62,7 +28,7 @@
|
||||
</v-toolbar>
|
||||
<v-expand-transition>
|
||||
<div v-show="expand || !collapsible">
|
||||
<slot></slot>
|
||||
<slot />
|
||||
</div>
|
||||
</v-expand-transition>
|
||||
</v-card>
|
||||
@@ -73,16 +39,16 @@ import Component from 'vue-class-component'
|
||||
import { Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { panelToolbarHeight } from '@/store/variables'
|
||||
import { mdiChevronDown, mdiChevronUp } from '@mdi/js'
|
||||
import { mdiChevronDown } from '@mdi/js'
|
||||
import { TranslateResult } from 'vue-i18n'
|
||||
|
||||
@Component
|
||||
export default class Panel extends Mixins(BaseMixin) {
|
||||
mdiChevronUp = mdiChevronUp
|
||||
mdiChevronDown = mdiChevronDown
|
||||
panelToolbarHeight = panelToolbarHeight
|
||||
|
||||
@Prop({ default: null }) declare readonly icon: string | null
|
||||
@Prop({ required: true, default: '' }) declare readonly title: string
|
||||
@Prop({ required: true, default: '' }) declare readonly title: string | TranslateResult
|
||||
@Prop({ default: false }) declare readonly collapsible: boolean
|
||||
@Prop({ required: true }) declare readonly cardClass: string
|
||||
@Prop({ default: '' }) declare readonly toolbarColor: string
|
||||
@@ -116,3 +82,39 @@ export default class Panel extends Mixins(BaseMixin) {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.expanded header.v-toolbar {
|
||||
border-bottom-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
|
||||
.btn-collapsible > * {
|
||||
will-change: transform;
|
||||
transition: transform 500ms;
|
||||
}
|
||||
.icon-rotate-90 {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
.panel-toolbar {
|
||||
overflow-y: hidden;
|
||||
}
|
||||
|
||||
::v-deep .panel-toolbar .v-btn {
|
||||
height: 100% !important;
|
||||
max-height: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
.v-card.panel .v-toolbar__content {
|
||||
padding-right: 0;
|
||||
}
|
||||
.v-card.panel .v-toolbar__content .subheading {
|
||||
user-select: none;
|
||||
}
|
||||
.panel-toolbar .v-btn.v-btn--icon {
|
||||
width: var(--panel-toolbar-icon-btn-width) !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,89 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-tooltip right :open-delay="500" :disabled="navigationStyle !== 'iconsOnly'">
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-list-item
|
||||
router
|
||||
:to="to"
|
||||
:href="href"
|
||||
:target="target"
|
||||
class="small-list-item"
|
||||
v-bind="attrs"
|
||||
v-on="on">
|
||||
<v-list-item-icon class="my-3 mr-3 menu-item-icon">
|
||||
<v-icon>{{ icon }}</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title tile class="menu-item-title">
|
||||
{{ title }}
|
||||
</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
</template>
|
||||
<span>{{ title }}</span>
|
||||
</v-tooltip>
|
||||
<v-divider v-if="borderBottom" class="my-1" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Component from 'vue-class-component'
|
||||
import { Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { NaviPoint } from '@/components/mixins/navigation'
|
||||
|
||||
@Component
|
||||
export default class SidebarItem extends Mixins(BaseMixin) {
|
||||
@Prop({ type: Object, required: true }) item!: NaviPoint
|
||||
|
||||
get navigationStyle() {
|
||||
return this.$store.state.gui.uiSettings.navigationStyle
|
||||
}
|
||||
|
||||
get icon() {
|
||||
return this.item.icon
|
||||
}
|
||||
|
||||
get title() {
|
||||
return this.item.title
|
||||
}
|
||||
|
||||
get to() {
|
||||
return this.item.to ?? undefined
|
||||
}
|
||||
|
||||
get href() {
|
||||
return this.item.href ?? undefined
|
||||
}
|
||||
|
||||
get target() {
|
||||
return this.item.target ?? undefined
|
||||
}
|
||||
|
||||
get borderBottom() {
|
||||
return this.item.to === '/allPrinters'
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.small-list-item {
|
||||
height: var(--sidebar-menu-item-height);
|
||||
}
|
||||
|
||||
.active-nav-item {
|
||||
border-right: 4px solid var(--v-primary-base);
|
||||
}
|
||||
|
||||
.menu-item-icon {
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.menu-item-title {
|
||||
line-height: 30px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
opacity: 0.85;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,111 @@
|
||||
<template>
|
||||
<div class="d-flex justify-center">
|
||||
<video
|
||||
ref="video"
|
||||
v-observe-visibility="visibilityChanged"
|
||||
autoplay
|
||||
muted
|
||||
:style="webcamStyle"
|
||||
class="webcamImage" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import Hls from 'hls.js'
|
||||
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
|
||||
import WebcamMixin from '@/components/mixins/webcam'
|
||||
|
||||
@Component
|
||||
export default class Hlsstreamer extends Mixins(BaseMixin, WebcamMixin) {
|
||||
private aspectRatio: null | number = null
|
||||
private isVisible = true
|
||||
private hls: Hls | null = null
|
||||
|
||||
@Prop({ required: true }) readonly camSettings!: GuiWebcamStateWebcam
|
||||
@Prop({ default: null }) readonly printerUrl!: string | null
|
||||
|
||||
declare $refs: {
|
||||
video: HTMLVideoElement
|
||||
}
|
||||
|
||||
get url() {
|
||||
return this.convertUrl(this.camSettings?.stream_url, this.printerUrl)
|
||||
}
|
||||
|
||||
get webcamStyle() {
|
||||
const output = {
|
||||
transform: this.generateTransform(
|
||||
this.camSettings.flip_horizontal ?? false,
|
||||
this.camSettings.flip_vertical ?? false,
|
||||
this.camSettings.rotation ?? 0
|
||||
),
|
||||
aspectRatio: 16 / 9,
|
||||
maxHeight: window.innerHeight - 155 + 'px',
|
||||
maxWidth: 'auto',
|
||||
}
|
||||
|
||||
if (this.aspectRatio) {
|
||||
output.aspectRatio = this.aspectRatio
|
||||
output.maxWidth = (window.innerHeight - 155) * this.aspectRatio + 'px'
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
visibilityChanged(isVisible: boolean) {
|
||||
this.isVisible = isVisible
|
||||
}
|
||||
|
||||
mounted() {
|
||||
this.play()
|
||||
|
||||
const video = this.$refs.video
|
||||
video.onplaying = () => {
|
||||
this.aspectRatio = video.videoWidth / video.videoHeight
|
||||
}
|
||||
}
|
||||
|
||||
updated() {
|
||||
this.play()
|
||||
}
|
||||
|
||||
play() {
|
||||
const video = this.$refs.video
|
||||
|
||||
if (Hls.isSupported()) {
|
||||
this.hls?.destroy()
|
||||
|
||||
this.hls = new Hls({
|
||||
enableWorker: true,
|
||||
lowLatencyMode: true,
|
||||
maxLiveSyncPlaybackRate: 2,
|
||||
liveSyncDuration: 0.5,
|
||||
liveMaxLatencyDuration: 2,
|
||||
backBufferLength: 5,
|
||||
})
|
||||
this.hls.loadSource(this.url)
|
||||
this.hls.attachMedia(video)
|
||||
this.hls.on(Hls.Events.MANIFEST_PARSED, () => {
|
||||
video.play()
|
||||
})
|
||||
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
||||
fetch(this.url).then(() => {
|
||||
video.src = this.url
|
||||
video.play()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
beforeUnmount() {
|
||||
this.hls?.destroy()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.webcamImage {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -1,9 +1,3 @@
|
||||
<style scoped>
|
||||
.webcamImage {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<video v-observe-visibility="visibilityChanged" :src="url" autoplay :style="webcamStyle" class="webcamImage" />
|
||||
</template>
|
||||
@@ -11,30 +5,28 @@
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
|
||||
import WebcamMixin from '@/components/mixins/webcam'
|
||||
|
||||
@Component
|
||||
export default class Ipstreamer extends Mixins(BaseMixin) {
|
||||
export default class Ipstreamer extends Mixins(BaseMixin, WebcamMixin) {
|
||||
private isVisible = true
|
||||
|
||||
@Prop({ required: true })
|
||||
camSettings: any
|
||||
|
||||
@Prop()
|
||||
printerUrl: string | undefined
|
||||
@Prop({ required: true }) readonly camSettings!: GuiWebcamStateWebcam
|
||||
@Prop({ default: null }) readonly printerUrl!: string | null
|
||||
|
||||
get url() {
|
||||
if (!this.isVisible) return ''
|
||||
|
||||
return this.camSettings.urlStream || ''
|
||||
return this.convertUrl(this.camSettings?.stream_url, this.printerUrl)
|
||||
}
|
||||
|
||||
get webcamStyle() {
|
||||
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 {
|
||||
transform: this.generateTransform(
|
||||
this.camSettings.flip_horizontal ?? false,
|
||||
this.camSettings.flip_vertical ?? false,
|
||||
this.camSettings.rotation ?? 0
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
visibilityChanged(isVisible: boolean) {
|
||||
@@ -42,3 +34,9 @@ export default class Ipstreamer extends Mixins(BaseMixin) {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.webcamImage {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,114 @@
|
||||
<template>
|
||||
<div>
|
||||
<video ref="video" autoplay :style="webcamStyle" class="webcamImage" />
|
||||
<v-row v-if="status !== 'connected'">
|
||||
<v-col class="_webcam_jmuxer_output text-center d-flex flex-column justify-center align-center">
|
||||
<v-progress-circular v-if="status === 'connecting'" indeterminate color="primary" class="mb-3" />
|
||||
<span class="mt-3">{{ status }}</span>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import JMuxer from 'jmuxer'
|
||||
import { Component, Mixins, Prop, Watch } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
|
||||
import WebcamMixin from '@/components/mixins/webcam'
|
||||
|
||||
@Component
|
||||
export default class JMuxerStreamer extends Mixins(BaseMixin, WebcamMixin) {
|
||||
private jmuxer: JMuxer | null = null
|
||||
private status: string = 'connecting'
|
||||
|
||||
@Prop({ required: true }) readonly camSettings!: GuiWebcamStateWebcam
|
||||
@Prop({ default: null }) readonly printerUrl!: string | null
|
||||
|
||||
declare $refs: {
|
||||
video: HTMLVideoElement
|
||||
}
|
||||
|
||||
get url() {
|
||||
return this.convertUrl(this.camSettings?.stream_url, this.printerUrl)
|
||||
}
|
||||
|
||||
get webcamStyle() {
|
||||
return {
|
||||
transform: this.generateTransform(
|
||||
this.camSettings.flip_horizontal ?? false,
|
||||
this.camSettings.flip_vertical ?? false,
|
||||
this.camSettings.rotation ?? 0
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
mounted() {
|
||||
this.play()
|
||||
}
|
||||
|
||||
play() {
|
||||
this.status = 'connecting'
|
||||
this.jmuxer?.destroy()
|
||||
|
||||
// Only websocket streams supported
|
||||
if (!this.url.startsWith('ws://') && !this.url.startsWith('wss://')) {
|
||||
console.error('jmuxer error: only websocket streams supported (ws://.. or wss://..)')
|
||||
this.status = 'error'
|
||||
return
|
||||
}
|
||||
|
||||
const video = this.$refs.video
|
||||
const targetFps = this.camSettings.target_fps || 10
|
||||
|
||||
this.jmuxer = new JMuxer({
|
||||
node: video,
|
||||
mode: 'video',
|
||||
flushingTime: 0,
|
||||
fps: targetFps,
|
||||
// debug: true,
|
||||
onReady: (data: any) => {
|
||||
this.status = 'connected'
|
||||
console.log('jmuxer ready:', data)
|
||||
},
|
||||
onError: (data: any) => {
|
||||
this.status = 'error'
|
||||
console.log('jmuxer error:', data)
|
||||
},
|
||||
})
|
||||
|
||||
const ws = new WebSocket(this.url)
|
||||
ws.binaryType = 'arraybuffer'
|
||||
ws.addEventListener('message', (event) => {
|
||||
this.jmuxer?.feed({
|
||||
video: new Uint8Array(event.data),
|
||||
})
|
||||
})
|
||||
|
||||
ws.addEventListener('error', (event) => {
|
||||
this.status = 'error'
|
||||
console.log('jmuxer ws error:', event)
|
||||
})
|
||||
}
|
||||
|
||||
beforeUnmount() {
|
||||
this.jmuxer?.destroy()
|
||||
}
|
||||
|
||||
@Watch('camSettings', { deep: true })
|
||||
onCamSettingsChanged() {
|
||||
// restart stream, when camSettings change
|
||||
this.play()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.webcamImage {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
._webcam_jmuxer_output {
|
||||
aspect-ratio: calc(3 / 2);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,150 @@
|
||||
<template>
|
||||
<div>
|
||||
<video
|
||||
v-show="status === 'started'"
|
||||
ref="stream"
|
||||
class="webcamStream"
|
||||
:style="webcamStyle"
|
||||
autoplay
|
||||
muted
|
||||
playsinline
|
||||
@playing="updateAspectRatio" />
|
||||
<v-row v-if="status !== 'started'">
|
||||
<v-col class="_webcam_webrtc_output text-center d-flex flex-column justify-center align-center">
|
||||
<v-progress-circular v-if="status === 'connecting'" indeterminate color="primary" class="mb-3" />
|
||||
<span class="mt-3">{{ status }}</span>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop, Ref, Watch } from 'vue-property-decorator'
|
||||
import { JanusJs, JanusSession, JanusStreamingPlugin } from 'typed_janus_js'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { ConstructorOptions } from 'typed_janus_js/src/interfaces/janus'
|
||||
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
|
||||
import WebcamMixin from '@/components/mixins/webcam'
|
||||
|
||||
@Component
|
||||
export default class JanusStreamer extends Mixins(BaseMixin, WebcamMixin) {
|
||||
private janusClient: JanusJs | null = null
|
||||
private session: JanusSession | null = null
|
||||
private handle: JanusStreamingPlugin | null = null
|
||||
private useStun = false
|
||||
private aspectRatio: null | number = null
|
||||
private status: string = 'connecting'
|
||||
|
||||
@Prop({ required: true }) readonly camSettings!: GuiWebcamStateWebcam
|
||||
@Prop({ default: null }) declare readonly printerUrl: string | null
|
||||
@Ref() declare stream: HTMLVideoElement
|
||||
|
||||
get url() {
|
||||
const baseUrl = this.camSettings.stream_url
|
||||
let url = new URL(baseUrl, this.printerUrl === null ? this.hostUrl.toString() : this.printerUrl)
|
||||
url.port = '8188'
|
||||
url.protocol = this.printerUrl?.startsWith('https') ? 'wss' : 'ws'
|
||||
|
||||
if (baseUrl.startsWith('ws') || baseUrl.startsWith('http')) {
|
||||
url = new URL(baseUrl)
|
||||
const pathnameParts = url.pathname.split('/')
|
||||
url.pathname = pathnameParts.slice(0, pathnameParts.length - 1).join('/')
|
||||
}
|
||||
|
||||
return url
|
||||
}
|
||||
|
||||
get streamId() {
|
||||
const pathnameParts = new URL(this.camSettings.stream_url).pathname.split('/')
|
||||
return pathnameParts[pathnameParts.length - 1]
|
||||
}
|
||||
|
||||
get webcamStyle() {
|
||||
const output = {
|
||||
transform: this.generateTransform(
|
||||
this.camSettings.flip_horizontal ?? false,
|
||||
this.camSettings.flip_vertical ?? false,
|
||||
this.camSettings.rotation ?? 0
|
||||
),
|
||||
aspectRatio: 16 / 9,
|
||||
}
|
||||
|
||||
if (this.aspectRatio) output.aspectRatio = this.aspectRatio
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
get streamConfig() {
|
||||
let config: ConstructorOptions = {
|
||||
server: this.url.toString(),
|
||||
}
|
||||
|
||||
if (this.useStun) {
|
||||
config.iceServers = [{ urls: ['stun:stun.l.google.com:19302'] }]
|
||||
}
|
||||
|
||||
return config
|
||||
}
|
||||
|
||||
async startStream() {
|
||||
this.janusClient = new JanusJs(this.streamConfig)
|
||||
await this.janusClient.init({ debug: false })
|
||||
this.session = await this.janusClient.createSession()
|
||||
this.handle = await this.session.attach<JanusStreamingPlugin>(JanusStreamingPlugin, {})
|
||||
this.handle?.onMessage.subscribe(async ({ message, jsep }) => {
|
||||
if (message?.result?.status) {
|
||||
this.status = message.result.status
|
||||
}
|
||||
if (jsep) {
|
||||
const answer = await this.handle?.createAnswer({ jsep })
|
||||
this.handle?.send({ message: { request: 'start' }, jsep: answer })
|
||||
}
|
||||
})
|
||||
const remoteStream = new MediaStream()
|
||||
JanusJs.attachMediaStream(this.stream as HTMLMediaElement, remoteStream)
|
||||
this.handle?.onRemoteTrack.subscribe(({ on, track }) => {
|
||||
if (on) remoteStream.addTrack(track)
|
||||
else remoteStream.removeTrack(track)
|
||||
})
|
||||
this.handle.onIceState.subscribe((value) => {
|
||||
console.log(`ICE state changed to ${value}`)
|
||||
})
|
||||
this.handle.onError.subscribe((value) => {
|
||||
this.status = `errored: ${JSON.stringify(value)}`
|
||||
})
|
||||
await this.handle.send({ message: { request: 'watch', id: parseInt(this.streamId!) } })
|
||||
}
|
||||
|
||||
mounted() {
|
||||
this.startStream()
|
||||
}
|
||||
|
||||
updateAspectRatio() {
|
||||
this.aspectRatio = this.stream.videoWidth / this.stream.videoHeight
|
||||
}
|
||||
|
||||
beforeDestroy() {
|
||||
this.session?.destroy({})
|
||||
}
|
||||
|
||||
@Watch('url')
|
||||
async changedUrl() {
|
||||
await this.session?.destroy({})
|
||||
await this.startStream()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.webcamStream {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
._webcam_webrtc_output {
|
||||
aspect-ratio: calc(3 / 2);
|
||||
}
|
||||
|
||||
video {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -1,22 +1,5 @@
|
||||
<style scoped>
|
||||
.webcamImage {
|
||||
width: 100%;
|
||||
background: lightgray;
|
||||
}
|
||||
|
||||
.webcamFpsOutput {
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
bottom: 6px;
|
||||
right: 0;
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
padding: 3px 10px;
|
||||
border-top-left-radius: 5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div style="position: relative">
|
||||
<div style="position: relative" class="d-flex justify-center">
|
||||
<img
|
||||
ref="image"
|
||||
v-observe-visibility="viewportVisibilityChanged"
|
||||
@@ -31,27 +14,28 @@
|
||||
import Component from 'vue-class-component'
|
||||
import { Mixins, Prop, Watch } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
|
||||
import WebcamMixin from '@/components/mixins/webcam'
|
||||
|
||||
const CONTENT_LENGTH = 'content-length'
|
||||
const TYPE_JPEG = 'image/jpeg'
|
||||
|
||||
@Component
|
||||
export default class Mjpegstreamer extends Mixins(BaseMixin) {
|
||||
export default class Mjpegstreamer extends Mixins(BaseMixin, WebcamMixin) {
|
||||
private currentFPS = 0
|
||||
private streamState = false
|
||||
private aspectRatio: null | number = null
|
||||
private timerFPS: number | null = null
|
||||
private timerRestart: number | null = null
|
||||
// eslint-disable-next-line no-undef
|
||||
private timerFPS: NodeJS.Timeout | null = null
|
||||
// eslint-disable-next-line no-undef
|
||||
private timerRestart: NodeJS.Timeout | null = null
|
||||
private stream: ReadableStream | null = null
|
||||
private controller: AbortController | null = null
|
||||
private isVisibleViewport = false
|
||||
private isVisibleDocument = true
|
||||
|
||||
@Prop({ required: true })
|
||||
camSettings: any
|
||||
|
||||
@Prop()
|
||||
printerUrl: string | undefined
|
||||
@Prop({ required: true }) readonly camSettings!: GuiWebcamStateWebcam
|
||||
@Prop({ default: null }) readonly printerUrl!: string | null
|
||||
|
||||
@Prop({ default: true }) declare showFps: boolean
|
||||
|
||||
@@ -61,25 +45,25 @@ export default class Mjpegstreamer extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get url() {
|
||||
const baseUrl = this.camSettings.urlStream
|
||||
let url = new URL(baseUrl, this.printerUrl === undefined ? this.hostUrl.toString() : this.printerUrl)
|
||||
if (baseUrl.startsWith('http') || baseUrl.startsWith('://')) url = new URL(baseUrl)
|
||||
|
||||
return decodeURIComponent(url.toString())
|
||||
return this.convertUrl(this.camSettings?.stream_url, this.printerUrl)
|
||||
}
|
||||
|
||||
get webcamStyle() {
|
||||
const output = {
|
||||
transform: 'none',
|
||||
transform: this.generateTransform(
|
||||
this.camSettings.flip_horizontal ?? false,
|
||||
this.camSettings.flip_vertical ?? false,
|
||||
this.camSettings.rotation ?? 0
|
||||
),
|
||||
aspectRatio: 16 / 9,
|
||||
maxHeight: window.innerHeight - 155 + 'px',
|
||||
maxWidth: 'auto',
|
||||
}
|
||||
|
||||
let transforms = ''
|
||||
if ('flipX' in this.camSettings && this.camSettings.flipX) transforms += ' scaleX(-1)'
|
||||
if ('flipX' in this.camSettings && this.camSettings.flipY) transforms += ' scaleY(-1)'
|
||||
if (transforms.trimStart().length) output.transform = transforms.trimStart()
|
||||
|
||||
if (this.aspectRatio) output.aspectRatio = this.aspectRatio
|
||||
if (this.aspectRatio) {
|
||||
output.aspectRatio = this.aspectRatio
|
||||
output.maxWidth = (window.innerHeight - 155) * this.aspectRatio + 'px'
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
@@ -252,3 +236,20 @@ export default class Mjpegstreamer extends Mixins(BaseMixin) {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.webcamImage {
|
||||
width: 100%;
|
||||
background: lightgray;
|
||||
}
|
||||
|
||||
.webcamFpsOutput {
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
padding: 3px 10px;
|
||||
border-top-left-radius: 5px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,21 +1,5 @@
|
||||
<style scoped>
|
||||
.webcamImage {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.webcamFpsOutput {
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
bottom: 6px;
|
||||
right: 0;
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
padding: 3px 10px;
|
||||
border-top-left-radius: 5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div style="position: relative">
|
||||
<div style="position: relative" class="d-flex justify-center">
|
||||
<div v-if="!isLoaded" class="text-center py-5">
|
||||
<v-progress-circular indeterminate color="primary"></v-progress-circular>
|
||||
</div>
|
||||
@@ -36,15 +20,18 @@
|
||||
import Component from 'vue-class-component'
|
||||
import { Mixins, Prop, Watch } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
|
||||
import WebcamMixin from '@/components/mixins/webcam'
|
||||
|
||||
@Component
|
||||
export default class MjpegstreamerAdaptive extends Mixins(BaseMixin) {
|
||||
export default class MjpegstreamerAdaptive extends Mixins(BaseMixin, WebcamMixin) {
|
||||
private refresh = Math.ceil(Math.random() * Math.pow(10, 12))
|
||||
private isVisible = true
|
||||
private isVisibleDocument = true
|
||||
private isVisibleViewport = false
|
||||
private isLoaded = true
|
||||
private timer: number | undefined = undefined
|
||||
// eslint-disable-next-line no-undef
|
||||
private timer: NodeJS.Timeout | undefined = undefined
|
||||
|
||||
private request_start_time = performance.now()
|
||||
private start_time = performance.now()
|
||||
@@ -59,23 +46,26 @@ export default class MjpegstreamerAdaptive extends Mixins(BaseMixin) {
|
||||
mjpegstreamerAdaptive: any
|
||||
}
|
||||
|
||||
@Prop({ required: true }) declare camSettings: any
|
||||
@Prop() declare printerUrl: string | undefined
|
||||
@Prop({ required: true }) declare camSettings: GuiWebcamStateWebcam
|
||||
@Prop({ default: null }) readonly printerUrl!: string | null
|
||||
@Prop({ default: true }) declare showFps: boolean
|
||||
|
||||
get webcamStyle() {
|
||||
const output = {
|
||||
transform: 'none',
|
||||
transform: this.generateTransform(
|
||||
this.camSettings.flip_horizontal ?? false,
|
||||
this.camSettings.flip_vertical ?? false,
|
||||
this.camSettings.rotation ?? 0
|
||||
),
|
||||
aspectRatio: 16 / 9,
|
||||
maxHeight: window.innerHeight - 155 + 'px',
|
||||
maxWidth: 'auto',
|
||||
}
|
||||
|
||||
let transforms = ''
|
||||
if (this.camSettings.flipX ?? false) transforms += ' scaleX(-1)'
|
||||
if (this.camSettings.flipY ?? false) transforms += ' scaleY(-1)'
|
||||
if ((this.camSettings.rotate ?? 0) === 180) transforms += ' rotate(180deg)'
|
||||
if (transforms.trimStart().length) output.transform = transforms.trimStart()
|
||||
|
||||
if (this.aspectRatio) output.aspectRatio = this.aspectRatio
|
||||
if (this.aspectRatio) {
|
||||
output.aspectRatio = this.aspectRatio
|
||||
output.maxWidth = (window.innerHeight - 155) * this.aspectRatio + 'px'
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
@@ -85,7 +75,7 @@ export default class MjpegstreamerAdaptive extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get rotate() {
|
||||
return [90, 270].includes(this.camSettings.rotate ?? 0)
|
||||
return [90, 270].includes(this.camSettings.rotation ?? 0)
|
||||
}
|
||||
|
||||
refreshFrame() {
|
||||
@@ -96,9 +86,9 @@ export default class MjpegstreamerAdaptive extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
async setFrame() {
|
||||
const baseUrl = this.camSettings.urlSnapshot
|
||||
const baseUrl = this.camSettings.snapshot_url
|
||||
|
||||
let url = new URL(baseUrl, this.printerUrl === undefined ? this.hostUrl.toString() : this.printerUrl)
|
||||
let url = new URL(baseUrl, this.printerUrl === null ? this.hostUrl.toString() : this.printerUrl)
|
||||
if (baseUrl.startsWith('http') || baseUrl.startsWith('://')) url = new URL(baseUrl)
|
||||
|
||||
url.searchParams.append('bypassCache', this.refresh.toString())
|
||||
@@ -114,10 +104,10 @@ export default class MjpegstreamerAdaptive extends Mixins(BaseMixin) {
|
||||
canvas.width = canvas.clientWidth
|
||||
if (this.rotate) {
|
||||
if (this.aspectRatio === null) this.aspectRatio = frame.height / frame.width
|
||||
canvas.height = canvas.clientWidth / (frame.height / frame.width)
|
||||
canvas.height = canvas.clientWidth / this.aspectRatio
|
||||
} else {
|
||||
if (this.aspectRatio === null) this.aspectRatio = frame.width / frame.height
|
||||
canvas.height = canvas.clientWidth * (frame.width / frame.height)
|
||||
canvas.height = canvas.clientWidth * this.aspectRatio
|
||||
}
|
||||
|
||||
if (this.rotate) {
|
||||
@@ -125,7 +115,7 @@ export default class MjpegstreamerAdaptive extends Mixins(BaseMixin) {
|
||||
const x = canvas.width / 2
|
||||
const y = canvas.height / 2
|
||||
ctx.translate(x, y)
|
||||
ctx.rotate((this.camSettings.rotate * Math.PI) / 180)
|
||||
ctx.rotate((this.camSettings.rotation * Math.PI) / 180)
|
||||
await ctx?.drawImage(
|
||||
frame,
|
||||
(-frame.width / 2) * scale,
|
||||
@@ -133,7 +123,7 @@ export default class MjpegstreamerAdaptive extends Mixins(BaseMixin) {
|
||||
frame.width * scale,
|
||||
frame.height * scale
|
||||
)
|
||||
ctx.rotate(-((this.camSettings.rotate * Math.PI) / 180))
|
||||
ctx.rotate(-((this.camSettings.rotation * Math.PI) / 180))
|
||||
ctx.translate(-x, -y)
|
||||
} else await ctx?.drawImage(frame, 0, 0, frame.width, frame.height, 0, 0, canvas.width, canvas.height)
|
||||
|
||||
@@ -148,7 +138,7 @@ export default class MjpegstreamerAdaptive extends Mixins(BaseMixin) {
|
||||
onLoad() {
|
||||
this.isLoaded = true
|
||||
|
||||
const targetFps = this.camSettings.targetFps || 10
|
||||
const targetFps = this.camSettings.target_fps || 10
|
||||
const end_time = performance.now()
|
||||
const current_time = end_time - this.start_time
|
||||
this.time = this.time * this.time_smoothing + current_time * (1.0 - this.time_smoothing)
|
||||
@@ -223,3 +213,19 @@ export default class MjpegstreamerAdaptive extends Mixins(BaseMixin) {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.webcamImage {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.webcamFpsOutput {
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
padding: 3px 10px;
|
||||
border-top-left-radius: 5px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,58 +1,54 @@
|
||||
<style scoped>
|
||||
.webcamImage {
|
||||
width: 100%;
|
||||
background: lightgray;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<img
|
||||
ref="webcamUv4lMjpegImage"
|
||||
v-observe-visibility="viewportVisibilityChanged"
|
||||
:style="webcamStyle"
|
||||
class="webcamImage"
|
||||
@load="onload" />
|
||||
<div class="d-flex justify-center">
|
||||
<img
|
||||
ref="webcamUv4lMjpegImage"
|
||||
v-observe-visibility="viewportVisibilityChanged"
|
||||
:style="webcamStyle"
|
||||
class="webcamImage"
|
||||
@load="onload" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop, Watch } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
|
||||
import WebcamMixin from '@/components/mixins/webcam'
|
||||
|
||||
@Component
|
||||
export default class Uv4lMjpeg extends Mixins(BaseMixin) {
|
||||
export default class Uv4lMjpeg extends Mixins(BaseMixin, WebcamMixin) {
|
||||
private aspectRatio: null | number = null
|
||||
private isVisible = false
|
||||
private isVisibleViewport = false
|
||||
private isVisibleDocument = true
|
||||
|
||||
@Prop({ required: true }) declare readonly camSettings: GuiWebcamStateWebcam
|
||||
@Prop() declare printerUrl: string | undefined
|
||||
@Prop({ default: null }) readonly printerUrl!: string | null
|
||||
|
||||
declare $refs: {
|
||||
webcamUv4lMjpegImage: HTMLImageElement
|
||||
}
|
||||
|
||||
get url() {
|
||||
const baseUrl = this.camSettings.urlStream
|
||||
let url = new URL(baseUrl, this.printerUrl === undefined ? this.hostUrl.toString() : this.printerUrl)
|
||||
if (baseUrl.startsWith('http') || baseUrl.startsWith('://')) url = new URL(baseUrl)
|
||||
|
||||
return decodeURIComponent(url.toString())
|
||||
return this.convertUrl(this.camSettings?.stream_url, this.printerUrl)
|
||||
}
|
||||
|
||||
get webcamStyle() {
|
||||
const output = {
|
||||
transform: 'none',
|
||||
transform: this.generateTransform(
|
||||
this.camSettings.flip_horizontal ?? false,
|
||||
this.camSettings.flip_vertical ?? false,
|
||||
this.camSettings.rotation ?? 0
|
||||
),
|
||||
aspectRatio: 16 / 9,
|
||||
maxHeight: window.innerHeight - 155 + 'px',
|
||||
maxWidth: 'auto',
|
||||
}
|
||||
|
||||
let transforms = ''
|
||||
if ('flipX' in this.camSettings && this.camSettings.flipX) transforms += ' scaleX(-1)'
|
||||
if ('flipX' in this.camSettings && this.camSettings.flipY) transforms += ' scaleY(-1)'
|
||||
if (transforms.trimStart().length) output.transform = transforms.trimStart()
|
||||
|
||||
if (this.aspectRatio) output.aspectRatio = this.aspectRatio
|
||||
if (this.aspectRatio) {
|
||||
output.aspectRatio = this.aspectRatio
|
||||
output.maxWidth = (window.innerHeight - 155) * this.aspectRatio + 'px'
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
@@ -116,3 +112,10 @@ export default class Uv4lMjpeg extends Mixins(BaseMixin) {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.webcamImage {
|
||||
width: 100%;
|
||||
background: lightgray;
|
||||
}
|
||||
</style>
|
||||
@@ -1,47 +0,0 @@
|
||||
<style></style>
|
||||
|
||||
<template>
|
||||
<v-container v-if="webcams" fluid class="pb-4">
|
||||
<v-row dense>
|
||||
<v-col v-for="webcam in webcams" :key="webcam.id" cols="6">
|
||||
<template v-if="webcam.service === 'mjpegstreamer'">
|
||||
<webcam-mjpegstreamer :cam-settings="webcam"></webcam-mjpegstreamer>
|
||||
</template>
|
||||
<template v-else-if="webcam.service === 'mjpegstreamer-adaptive'">
|
||||
<webcam-mjpegstreamer-adaptive :cam-settings="webcam"></webcam-mjpegstreamer-adaptive>
|
||||
</template>
|
||||
<template v-else-if="webcam.service === 'uv4l-mjpeg'">
|
||||
<webcam-uv4l-mjpeg :cam-settings="webcam"></webcam-uv4l-mjpeg>
|
||||
</template>
|
||||
<template v-else-if="webcam.service === 'ipstream'">
|
||||
<webcam-ipstreamer :cam-settings="webcam"></webcam-ipstreamer>
|
||||
</template>
|
||||
<template v-else>
|
||||
<p class="text-center py-3 font-italic">{{ $t('Panels.WebcamPanel.UnknownWebcamService') }}</p>
|
||||
</template>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import Mjpegstreamer from '@/components/webcams/Mjpegstreamer.vue'
|
||||
import MjpegstreamerAdaptive from '@/components/webcams/MjpegstreamerAdaptive.vue'
|
||||
import Uv4lMjpeg from '@/components/webcams/Uv4lMjpeg.vue'
|
||||
import Ipstreamer from '@/components/webcams/Ipstreamer.vue'
|
||||
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
'webcam-mjpegstreamer': Mjpegstreamer,
|
||||
'webcam-mjpegstreamer-adaptive': MjpegstreamerAdaptive,
|
||||
'webcam-uv4l-mjpeg': Uv4lMjpeg,
|
||||
'webcam-ipstreamer': Ipstreamer,
|
||||
},
|
||||
})
|
||||
export default class WebcamGrid extends Mixins(BaseMixin) {
|
||||
@Prop() declare readonly webcams: GuiWebcamStateWebcam[]
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,41 @@
|
||||
<template>
|
||||
<div>
|
||||
<template v-if="webcam.service === 'grid'">
|
||||
<v-container v-if="webcams" fluid class="pb-4">
|
||||
<v-row dense>
|
||||
<v-col v-for="gridWebcam in webcams" :key="gridWebcam.name" cols="6">
|
||||
<webcam-wrapper-item :webcam="gridWebcam" :printer-url="printerUrl" :show-fps="showFps" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</template>
|
||||
<template v-else>
|
||||
<webcam-wrapper-item :webcam="webcam" :printer-url="printerUrl" :show-fps="showFps" />
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Component from 'vue-class-component'
|
||||
import { Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
|
||||
import WebcamWrapperItem from '@/components/webcams/WebcamWrapperItem.vue'
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
WebcamWrapperItem,
|
||||
},
|
||||
})
|
||||
export default class WebcamWrapper extends Mixins(BaseMixin) {
|
||||
@Prop({ type: Object, required: true }) webcam!: GuiWebcamStateWebcam
|
||||
@Prop({ type: Boolean, default: true }) showFps!: Boolean
|
||||
@Prop({ type: String, default: null }) printerUrl!: string | null
|
||||
|
||||
get webcams(): GuiWebcamStateWebcam[] {
|
||||
return this.$store.getters['gui/webcams/getWebcams']
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
@@ -0,0 +1,66 @@
|
||||
<template>
|
||||
<div>
|
||||
<template v-if="service === 'mjpegstreamer'">
|
||||
<mjpegstreamer :cam-settings="webcam" :show-fps="showFps" :printer-url="printerUrl" />
|
||||
</template>
|
||||
<template v-else-if="service === 'mjpegstreamer-adaptive'">
|
||||
<mjpegstreamer-adaptive :cam-settings="webcam" :show-fps="showFps" :printer-url="printerUrl" />
|
||||
</template>
|
||||
<template v-else-if="service === 'uv4l-mjpeg'">
|
||||
<uv4l-mjpeg :cam-settings="webcam" :printer-url="printerUrl" />
|
||||
</template>
|
||||
<template v-else-if="service === 'ipstream'">
|
||||
<ipstreamer :cam-settings="webcam" :printer-url="printerUrl" />
|
||||
</template>
|
||||
<template v-else-if="service === 'hlsstream'">
|
||||
<hlsstreamer :cam-settings="webcam" :printer-url="printerUrl" />
|
||||
</template>
|
||||
<template v-else-if="service === 'jmuxer-stream'">
|
||||
<j-muxer-stream :cam-settings="webcam" :printer-url="printerUrl" />
|
||||
</template>
|
||||
<template v-else-if="service === 'webrtc-camerastreamer'">
|
||||
<webrtc-camera-streamer :cam-settings="webcam" :printer-url="printerUrl" />
|
||||
</template>
|
||||
<template v-else-if="service === 'webrtc-janus'">
|
||||
<janus-streamer :cam-settings="webcam" :printer-url="printerUrl" />
|
||||
</template>
|
||||
<template v-else-if="service === 'webrtc-mediamtx'">
|
||||
<webrtc-media-m-t-x :cam-settings="webcam" :printer-url="printerUrl" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<p class="text-center py-3 font-italic">{{ $t('Panels.WebcamPanel.UnknownWebcamService') }}</p>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Component from 'vue-class-component'
|
||||
import { Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
Hlsstreamer: () => import('@/components/webcams/Hlsstreamer.vue'),
|
||||
Ipstreamer: () => import('@/components/webcams/Ipstreamer.vue'),
|
||||
JanusStreamer: () => import('@/components/webcams/JanusStreamer.vue'),
|
||||
JMuxerStream: () => import('@/components/webcams/JMuxerStream.vue'),
|
||||
Mjpegstreamer: () => import('@/components/webcams/Mjpegstreamer.vue'),
|
||||
MjpegstreamerAdaptive: () => import('@/components/webcams/MjpegstreamerAdaptive.vue'),
|
||||
Uv4lMjpeg: () => import('@/components/webcams/Uv4lMjpeg.vue'),
|
||||
WebrtcCameraStreamer: () => import('@/components/webcams/WebrtcCameraStreamer.vue'),
|
||||
WebrtcMediaMTX: () => import('@/components/webcams/WebrtcMediaMTX.vue'),
|
||||
},
|
||||
})
|
||||
export default class WebcamWrapperItem extends Mixins(BaseMixin) {
|
||||
@Prop({ type: Object, required: true }) webcam!: GuiWebcamStateWebcam
|
||||
@Prop({ type: Boolean, default: true }) showFps!: Boolean
|
||||
@Prop({ default: null }) printerUrl!: string | null
|
||||
|
||||
get service() {
|
||||
return this.webcam?.service ?? 'unknown'
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
@@ -0,0 +1,183 @@
|
||||
<template>
|
||||
<div>
|
||||
<video
|
||||
v-show="status === 'connected'"
|
||||
ref="stream"
|
||||
class="webcamStream"
|
||||
:style="webcamStyle"
|
||||
autoplay
|
||||
muted
|
||||
playsinline />
|
||||
<v-row v-if="status !== 'connected'">
|
||||
<v-col class="_webcam_webrtc_output text-center d-flex flex-column justify-center align-center">
|
||||
<v-progress-circular v-if="status === 'connecting'" indeterminate color="primary" class="mb-3" />
|
||||
<span class="mt-3">{{ status }}</span>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop, Ref, Watch } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
|
||||
import WebcamMixin from '@/components/mixins/webcam'
|
||||
|
||||
@Component
|
||||
export default class WebrtcCameraStreamer extends Mixins(BaseMixin, WebcamMixin) {
|
||||
private pc: RTCPeerConnection | null = null
|
||||
private useStun = false
|
||||
private remote_pc_id: string | null = null
|
||||
private aspectRatio: null | number = null
|
||||
private status: string = 'connecting'
|
||||
|
||||
@Prop({ required: true }) readonly camSettings!: GuiWebcamStateWebcam
|
||||
@Prop({ default: null }) declare readonly printerUrl: string | null
|
||||
@Ref() declare stream: HTMLVideoElement
|
||||
|
||||
get url() {
|
||||
const baseUrl = this.camSettings.stream_url
|
||||
let url = new URL(baseUrl, this.printerUrl === null ? this.hostUrl.toString() : this.printerUrl)
|
||||
url.port = this.hostPort.toString()
|
||||
|
||||
if (baseUrl.startsWith('http') || baseUrl.startsWith('://')) url = new URL(baseUrl)
|
||||
|
||||
return decodeURIComponent(url.toString())
|
||||
}
|
||||
|
||||
get webcamStyle() {
|
||||
const output = {
|
||||
transform: this.generateTransform(
|
||||
this.camSettings.flip_horizontal ?? false,
|
||||
this.camSettings.flip_vertical ?? false,
|
||||
this.camSettings.rotation ?? 0
|
||||
),
|
||||
aspectRatio: 16 / 9,
|
||||
}
|
||||
|
||||
if (this.aspectRatio) output.aspectRatio = this.aspectRatio
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
startStream() {
|
||||
const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1
|
||||
const requestIceServers = this.useStun ? [{ urls: ['stun:stun.l.google.com:19302'] }] : null
|
||||
|
||||
// This WebRTC signaling pattern is designed for camera-streamer, a common webcam server the supports WebRTC.
|
||||
fetch(this.url, {
|
||||
body: JSON.stringify({
|
||||
type: 'request',
|
||||
iceServers: requestIceServers,
|
||||
}),
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
method: 'POST',
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then((answer) => {
|
||||
let peerConnectionConfig: any = {
|
||||
sdpSemantics: 'unified-plan',
|
||||
}
|
||||
// It's important to set any ICE servers returned, which could include servers we requested or servers
|
||||
// setup by the server. But note that older versions of camera-streamer won't return this property.
|
||||
if (answer.iceServers) {
|
||||
peerConnectionConfig.iceServers = answer.iceServers
|
||||
}
|
||||
this.pc = new RTCPeerConnection(peerConnectionConfig)
|
||||
this.pc.addTransceiver('video', { direction: 'recvonly' })
|
||||
this.pc.addEventListener(
|
||||
'track',
|
||||
(evt) => {
|
||||
if (evt.track.kind == 'video' && this.$refs.stream) {
|
||||
// @ts-ignore
|
||||
this.$refs.stream.srcObject = evt.streams[0]
|
||||
}
|
||||
},
|
||||
false
|
||||
)
|
||||
this.pc.addEventListener('connectionstatechange', () => {
|
||||
this.status = (this.pc?.connectionState ?? '').toString()
|
||||
if (['failed', 'disconnected'].includes(this.status)) {
|
||||
setTimeout(async () => {
|
||||
await this.pc?.close()
|
||||
this.startStream()
|
||||
}, 500)
|
||||
}
|
||||
})
|
||||
this.pc.addEventListener('icecandidate', (e) => {
|
||||
if (e.candidate) {
|
||||
return fetch(this.url, {
|
||||
body: JSON.stringify({
|
||||
type: 'remote_candidate',
|
||||
id: this.remote_pc_id,
|
||||
candidates: [e.candidate],
|
||||
}),
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
method: 'POST',
|
||||
}).catch(function (error) {
|
||||
window.console.error(error)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
this.remote_pc_id = answer.id
|
||||
return this.pc?.setRemoteDescription(answer)
|
||||
})
|
||||
.then(() => this.pc?.createAnswer())
|
||||
.then((answer) => this.pc?.setLocalDescription(answer))
|
||||
.then(() => {
|
||||
const offer = this.pc?.localDescription
|
||||
return fetch(this.url, {
|
||||
body: JSON.stringify({
|
||||
type: offer?.type,
|
||||
id: this.remote_pc_id,
|
||||
sdp: offer?.sdp,
|
||||
}),
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
method: 'POST',
|
||||
})
|
||||
})
|
||||
.then((response: any) => {
|
||||
if (isFirefox) this.status = 'connected'
|
||||
return response.json()
|
||||
})
|
||||
.catch(function (e) {
|
||||
window.console.error(e)
|
||||
})
|
||||
}
|
||||
|
||||
mounted() {
|
||||
this.startStream()
|
||||
}
|
||||
|
||||
beforeDestroy() {
|
||||
this.pc?.close()
|
||||
}
|
||||
|
||||
@Watch('url')
|
||||
async changedUrl() {
|
||||
await this.pc?.close()
|
||||
this.startStream()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.webcamStream {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
._webcam_webrtc_output {
|
||||
aspect-ratio: calc(3 / 2);
|
||||
}
|
||||
|
||||
video {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,240 @@
|
||||
<template>
|
||||
<div>
|
||||
<video
|
||||
v-show="status === 'connected'"
|
||||
ref="video"
|
||||
:style="webcamStyle"
|
||||
class="webcamImage"
|
||||
autoplay
|
||||
playsinline
|
||||
muted />
|
||||
<v-row v-if="status !== 'connected'">
|
||||
<v-col class="_webcam_webrtc_output text-center d-flex flex-column justify-center align-center">
|
||||
<v-progress-circular v-if="status === 'connecting'" indeterminate color="primary" class="mb-3" />
|
||||
<span class="mt-3">{{ status }}</span>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop, Ref, Watch } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
|
||||
import WebcamMixin from '@/components/mixins/webcam'
|
||||
|
||||
@Component
|
||||
export default class WebrtcRTSPSimpleServer extends Mixins(BaseMixin, WebcamMixin) {
|
||||
@Prop({ required: true }) readonly camSettings!: GuiWebcamStateWebcam
|
||||
@Prop({ default: null }) readonly printerUrl!: string | null
|
||||
@Ref() declare video: HTMLVideoElement
|
||||
|
||||
// webrtc player vars
|
||||
private terminated: boolean = false
|
||||
private ws: WebSocket | null = null
|
||||
private pc: RTCPeerConnection | null = null
|
||||
private restartTimeoutTimer: any = null
|
||||
private status: string = 'connecting'
|
||||
|
||||
// stop the video and close the streams if the component is going to be destroyed so we don't leave hanging streams
|
||||
beforeDestroy() {
|
||||
this.terminate()
|
||||
|
||||
// clear any potentially open restart timeout
|
||||
if (this.restartTimeoutTimer) {
|
||||
clearTimeout(this.restartTimeoutTimer)
|
||||
}
|
||||
}
|
||||
|
||||
get webcamStyle() {
|
||||
return {
|
||||
transform: this.generateTransform(
|
||||
this.camSettings.flip_horizontal ?? false,
|
||||
this.camSettings.flip_vertical ?? false,
|
||||
this.camSettings.rotation ?? 0
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
get url() {
|
||||
let baseUrl = this.camSettings.stream_url
|
||||
if (baseUrl.startsWith('http')) {
|
||||
baseUrl = baseUrl.replace('http', 'ws') + 'ws'
|
||||
}
|
||||
|
||||
return this.convertUrl(baseUrl, this.printerUrl)
|
||||
}
|
||||
|
||||
// stop and restart the video if the url changes
|
||||
@Watch('url')
|
||||
changedUrl() {
|
||||
this.terminate()
|
||||
this.start()
|
||||
}
|
||||
|
||||
get expanded(): boolean {
|
||||
return this.$store.getters['gui/getPanelExpand']('webcam-panel', this.viewport) ?? false
|
||||
}
|
||||
|
||||
// start or stop the video when the expand state changes
|
||||
@Watch('expanded', { immediate: true })
|
||||
expandChanged(newExpanded: boolean): void {
|
||||
if (!newExpanded) {
|
||||
this.terminate()
|
||||
return
|
||||
}
|
||||
|
||||
this.start()
|
||||
}
|
||||
|
||||
// webrtc player methods
|
||||
// adapated from sample player in https://github.com/mrlt8/docker-wyze-bridge
|
||||
start() {
|
||||
// unterminate we're starting again.
|
||||
this.terminated = false
|
||||
|
||||
// clear any potentially open restart timeout
|
||||
if (this.restartTimeoutTimer) {
|
||||
clearTimeout(this.restartTimeoutTimer)
|
||||
this.restartTimeoutTimer = null
|
||||
}
|
||||
|
||||
window.console.log('[webcam-rtspsimpleserver] web socket connecting')
|
||||
|
||||
// test if the url is valid
|
||||
try {
|
||||
const url = new URL(this.url)
|
||||
|
||||
// break if url protocol is not ws
|
||||
if (!url.protocol.startsWith('ws')) {
|
||||
console.log('[webcam-rtspsimpleserver] invalid URL (no ws protocol)')
|
||||
return
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('[webcam-rtspsimpleserver] invalid URL')
|
||||
return
|
||||
}
|
||||
|
||||
// open websocket connection
|
||||
this.ws = new WebSocket(this.url)
|
||||
|
||||
this.ws.onerror = (event) => {
|
||||
window.console.log('[webcam-rtspsimpleserver] websocket error', event)
|
||||
this.ws?.close()
|
||||
this.ws = null
|
||||
}
|
||||
|
||||
this.ws.onclose = (event) => {
|
||||
console.log('[webcam-rtspsimpleserver] websocket closed', event)
|
||||
this.ws = null
|
||||
this.scheduleRestart()
|
||||
}
|
||||
|
||||
this.ws.onmessage = (msg: MessageEvent) => this.webRtcOnIceServers(msg)
|
||||
}
|
||||
|
||||
terminate() {
|
||||
this.terminated = true
|
||||
|
||||
try {
|
||||
this.video.pause()
|
||||
} catch (err) {
|
||||
// ignore -- make sure we close down the sockets anyway
|
||||
}
|
||||
|
||||
this.ws?.close()
|
||||
this.pc?.close()
|
||||
}
|
||||
|
||||
webRtcOnIceServers(msg: MessageEvent) {
|
||||
if (this.ws === null) return
|
||||
|
||||
const iceServers = JSON.parse(msg.data)
|
||||
this.pc = new RTCPeerConnection({
|
||||
iceServers,
|
||||
})
|
||||
|
||||
this.ws.onmessage = (msg: MessageEvent) => this.webRtcOnRemoteDescription(msg)
|
||||
this.pc.onicecandidate = (evt: RTCPeerConnectionIceEvent) => this.webRtcOnIceCandidate(evt)
|
||||
|
||||
this.pc.oniceconnectionstatechange = () => {
|
||||
if (this.pc === null) return
|
||||
|
||||
window.console.log('[webcam-rtspsimpleserver] peer connection state:', this.pc.iceConnectionState)
|
||||
|
||||
this.status = (this.pc?.iceConnectionState ?? '').toString()
|
||||
|
||||
if (['failed', 'disconnected'].includes(this.status)) {
|
||||
this.scheduleRestart()
|
||||
}
|
||||
}
|
||||
|
||||
this.pc.ontrack = (evt: RTCTrackEvent) => {
|
||||
window.console.log('[webcam-rtspsimpleserver] new track ' + evt.track.kind)
|
||||
this.video.srcObject = evt.streams[0]
|
||||
}
|
||||
|
||||
const direction = 'sendrecv'
|
||||
this.pc.addTransceiver('video', { direction })
|
||||
this.pc.addTransceiver('audio', { direction })
|
||||
|
||||
this.pc.createOffer().then((desc: any) => {
|
||||
if (this.pc === null || this.ws === null) return
|
||||
|
||||
this.pc.setLocalDescription(desc)
|
||||
|
||||
window.console.log('[webcam-rtspsimpleserver] sending offer')
|
||||
this.ws.send(JSON.stringify(desc))
|
||||
})
|
||||
}
|
||||
|
||||
webRtcOnRemoteDescription(msg: any) {
|
||||
if (this.pc === null || this.ws === null) return
|
||||
|
||||
this.pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(msg.data)))
|
||||
this.ws.onmessage = (msg: any) => this.webRtcOnRemoteCandidate(msg)
|
||||
}
|
||||
|
||||
webRtcOnIceCandidate(evt: RTCPeerConnectionIceEvent) {
|
||||
if (this.ws === null) return
|
||||
|
||||
if (evt.candidate?.candidate !== '') {
|
||||
this.ws.send(JSON.stringify(evt.candidate))
|
||||
}
|
||||
}
|
||||
|
||||
webRtcOnRemoteCandidate(msg: any) {
|
||||
if (this.pc === null) return
|
||||
|
||||
this.pc.addIceCandidate(JSON.parse(msg.data))
|
||||
}
|
||||
|
||||
scheduleRestart() {
|
||||
this.ws?.close()
|
||||
this.ws = null
|
||||
|
||||
this.pc?.close()
|
||||
this.pc = null
|
||||
|
||||
if (this.terminated) return
|
||||
|
||||
this.restartTimeoutTimer = setTimeout(() => {
|
||||
this.start()
|
||||
}, 2000)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.webcamImage {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
._webcam_webrtc_output {
|
||||
aspect-ratio: calc(3 / 2);
|
||||
}
|
||||
|
||||
video {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
Loaded 100 of 172 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user