From 6a7db458c61464ba1e6c2a3b781b7c34157b1360 Mon Sep 17 00:00:00 2001 From: = Date: Wed, 15 Jul 2020 10:28:23 +0200 Subject: [PATCH 1/3] send dati softkeys --- .../components/paddle/paddle.ts | 16 +++--- .../components/paddle/paddle.vue | 54 ++++++++++--------- .../components/paddle/softkey.ts | 9 ++++ .../components/paddle/softkey.vue | 3 +- Thermo.Active/wwwroot/src/services/hub.ts | 2 + .../wwwroot/src/store/machineInfo.store.ts | 9 ---- .../wwwroot/src/store/machineStatus.store.ts | 9 ++++ 7 files changed, 61 insertions(+), 41 deletions(-) diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/components/paddle/paddle.ts b/Thermo.Active/wwwroot/src/app_modules_thermo/components/paddle/paddle.ts index 5bfbda3c..c17d48f9 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/components/paddle/paddle.ts +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/components/paddle/paddle.ts @@ -32,7 +32,7 @@ export default class Paddle extends Vue { return this.softKeys[id]; } - get allSoftKeys() { + get allSoftKeys(): SoftKeysConfigurationModel[] { var result = []; for (const key in this.softKeys) { const element = this.softKeys[key]; @@ -45,8 +45,12 @@ export default class Paddle extends Vue { return store.state.machineInfo.softkeysFavorites; } - getSoftKeyById(id: number) { - return machineInfoStore.getters.getSoftkey(id); + get Favourites(): SoftKeysConfigurationModel[] { + return this.favourites.map(i => this.getSoftKeyById(i) as SoftKeysConfigurationModel) + } + + getSoftKeyById(id: number): SoftKeysConfigurationModel { + return this.allSoftKeys.find(i => i.id == id); } isFavourite(id: number) { @@ -81,13 +85,11 @@ export default class Paddle extends Vue { } getSoftKeyStatus(id) { - var sk = this.$store.getters.getSoftKeyStatus(id); - if (sk) - return sk.value; - return false; + return this.$store.getters.getSoftKeyStatus(id); } async toggleFavourite(id: number, add: boolean) { + if (add) await dataService.AddUserSoftkeyFavorite(id) else diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/components/paddle/paddle.vue b/Thermo.Active/wwwroot/src/app_modules_thermo/components/paddle/paddle.vue index 928db334..e9078d8a 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/components/paddle/paddle.vue +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/components/paddle/paddle.vue @@ -12,18 +12,21 @@
{{'preferred-softkeys' | localize("Soft Keys")}}
- +
@@ -39,18 +42,21 @@
{{'preferred-softkeys' | localize("Tutte")}}
- +
diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/components/paddle/softkey.ts b/Thermo.Active/wwwroot/src/app_modules_thermo/components/paddle/softkey.ts index 0aaa455c..8c76853d 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/components/paddle/softkey.ts +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/components/paddle/softkey.ts @@ -12,11 +12,20 @@ export default class SoftKey extends Vue { @Prop({ default: 0 }) type: number; + @Prop({ default: false }) + value: boolean; + @Prop({ default: false }) configMode: boolean; @Prop({ default: false }) isFavourite: boolean; + doclick() { + if (!this.configMode && this.type != 0) this.$emit('click'); + } + + get Checked() { return this.value; } + set Checked(value: boolean) { this.$emit("input", value); this.$emit("checkChanged") } } \ No newline at end of file diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/components/paddle/softkey.vue b/Thermo.Active/wwwroot/src/app_modules_thermo/components/paddle/softkey.vue index 189cec22..1974d3f8 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/components/paddle/softkey.vue +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/components/paddle/softkey.vue @@ -1,9 +1,10 @@ diff --git a/Thermo.Active/wwwroot/src/services/hub.ts b/Thermo.Active/wwwroot/src/services/hub.ts index 48c79536..dcdd6500 100644 --- a/Thermo.Active/wwwroot/src/services/hub.ts +++ b/Thermo.Active/wwwroot/src/services/hub.ts @@ -23,6 +23,7 @@ import { ToolingService } from "./toolingService"; import { CONFIGURATION } from "@/config"; import { recipeActions } from "@/store/recipe.store"; import { prodActions } from "@/store/prod.store"; +import { Model } from "vue-property-decorator"; declare let $: any; declare let cmsClient: any; @@ -242,6 +243,7 @@ export class Hub { } private static userSoftKeyChanged(status) { + for (const k in status) { if (status.hasOwnProperty(k)) { machineStatusActions.setSoftKeyStatus(store, status[k] as SoftKeyModel); diff --git a/Thermo.Active/wwwroot/src/store/machineInfo.store.ts b/Thermo.Active/wwwroot/src/store/machineInfo.store.ts index dd4f16ad..e10c7a1f 100644 --- a/Thermo.Active/wwwroot/src/store/machineInfo.store.ts +++ b/Thermo.Active/wwwroot/src/store/machineInfo.store.ts @@ -92,15 +92,6 @@ export const machineInfoStore = { } } return null; - }, - getSoftkey: state => id => { - for (const key in state.softKeys) { - if (state.softKeys.hasOwnProperty(key)) { - const element = state.softKeys[key]; - if (element.id == id) return element; - } - } - return null; } }, mutations: { diff --git a/Thermo.Active/wwwroot/src/store/machineStatus.store.ts b/Thermo.Active/wwwroot/src/store/machineStatus.store.ts index 76f89d0b..7761c997 100644 --- a/Thermo.Active/wwwroot/src/store/machineStatus.store.ts +++ b/Thermo.Active/wwwroot/src/store/machineStatus.store.ts @@ -1,4 +1,5 @@ import { Factory, messageService } from "@/_base"; +import Vue from "vue"; // Check if declare let cmsClient: any; @@ -182,6 +183,14 @@ export const machineStatusStore = { } }, SetSoftKeyStatus(store, model: any) { + if (!store._softKeys.has(model.id)) + store._softKeys.set(model.id, model); + else { + let g = store._softKeys.get(model.id); + for (const key in model) { + Vue.set(g, key, model[key]) + } + } store._softKeys.set(model.id, model); store.softKeys = Array.from(store._softKeys.values()); }, From 5b7bdaeb27edd90f118737171beea09931aee264 Mon Sep 17 00:00:00 2001 From: = Date: Wed, 15 Jul 2020 10:30:41 +0200 Subject: [PATCH 2/3] fix confirmation dialog --- .../wwwroot/assets/styles/base/paddle.less | 1 + Thermo.Active/wwwroot/assets/styles/style.css | 1 + .../components/paddle/paddle.vue | 21 +++++++++---------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Thermo.Active/wwwroot/assets/styles/base/paddle.less b/Thermo.Active/wwwroot/assets/styles/base/paddle.less index 71720491..636f3ec0 100644 --- a/Thermo.Active/wwwroot/assets/styles/base/paddle.less +++ b/Thermo.Active/wwwroot/assets/styles/base/paddle.less @@ -75,6 +75,7 @@ display: grid; grid-template-rows: 50px 1fr 50px; padding: 1rem; + position: relative; header { display: flex; diff --git a/Thermo.Active/wwwroot/assets/styles/style.css b/Thermo.Active/wwwroot/assets/styles/style.css index 7b5f1bd0..85dee545 100644 --- a/Thermo.Active/wwwroot/assets/styles/style.css +++ b/Thermo.Active/wwwroot/assets/styles/style.css @@ -4812,6 +4812,7 @@ article .box .body { display: grid; grid-template-rows: 50px 1fr 50px; padding: 1rem; + position: relative; } .paddle section header { display: flex; diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/components/paddle/paddle.vue b/Thermo.Active/wwwroot/src/app_modules_thermo/components/paddle/paddle.vue index e9078d8a..93739101 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/components/paddle/paddle.vue +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/components/paddle/paddle.vue @@ -37,6 +37,16 @@
+
@@ -60,17 +70,6 @@
- -