- {{ $t("App.Hello") }}
+ {{ $t("App.Hello") }}
{{ $t("App.PleaseRememberToAdd") }}{{ currentUrl }} {{ $t("App.InMoonrakerConf") }}
{{ $t("App.YouCanFindMore") }} {{ $t("App.Remotemode") }}.
@@ -187,30 +187,27 @@ export default {
hostname: state => state.socket.hostname,
port: state => state.socket.port,
}),
- ...mapGetters([
- "farm/countPrinters",
- "farm/getPrinters"
- ]),
+ ...mapGetters({
+ countPrinters: "farm/countPrinters",
+ printers: "farm/getPrinters",
+ getPrinterName: "farm/getPrinterName",
+ }),
...mapActions({
readPrinters: "farm/readStoredPrinters"
}),
- currentUrl: {
- get() {
- return "http://"+window.location.hostname+(window.location.port !== 80 && window.location.port !== '' ? ':'+window.location.port : '')
- }
+ currentUrl() {
+ return "http://"+window.location.hostname+(window.location.port !== 80 && window.location.port !== '' ? ':'+window.location.port : '')
},
- showCorsInfo: {
- get() {
- if (this["farm/countPrinters"]) {
- for (const [ ,printer] of Object.entries(this["farm/getPrinters"])) {
- if (!printer.socket.isConnected) return true
- }
-
- return false
+ showCorsInfo() {
+ if (this.countPrinters) {
+ for (const [ ,printer] of Object.entries(this.printers)) {
+ if (!printer.socket.isConnected) return true
}
- return true
+ return false
}
+
+ return true
}
},
methods: {
@@ -227,8 +224,8 @@ export default {
this.$store.dispatch("farm/savePrinters")
},
editPrinter(index) {
- this.dialogEditPrinter.hostname = this["farm/getPrinters"][index].socket.hostname
- this.dialogEditPrinter.port = this["farm/getPrinters"][index].socket.port
+ this.dialogEditPrinter.hostname = this.printers[index].socket.hostname
+ this.dialogEditPrinter.port = this.printers[index].socket.port
this.dialogEditPrinter.index = index
this.dialogEditPrinter.bool = true
},
@@ -264,7 +261,7 @@ export default {
this.$store.dispatch('socket/setData', { connectingFailed: false })
},
checkPrinters() {
- Object.entries(this['farm/getPrinters']).forEach(([key, printer]) => {
+ Object.entries(this.printers).forEach(([key, printer]) => {
if (!printer.socket.isConnected && !printer.socket.isConnecting) {
this.$store.dispatch('farm/'+key+'/connect')
}
diff --git a/src/store/farm/index.js b/src/store/farm/index.js
index 97824d10..562b95bb 100644
--- a/src/store/farm/index.js
+++ b/src/store/farm/index.js
@@ -12,7 +12,7 @@ export default {
getPrinters: state => {
return state
},
- getPrinterName: (getters) => (namespace) => {
+ getPrinterName: (state, getters) => (namespace) => {
return getters[namespace+"/getPrinterName"]
}
},