From 471ec1370cbf57ec536ede5c5ad4f6c3480291e4 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 10 Sep 2024 22:53:14 +0200 Subject: [PATCH] [Procedure Editor] Added support for conditions and nested blocks. --- .../src/components/Action/ActionTile.vue | 13 + .../src/components/Action/ActionsBlock.vue | 195 ++++++ .../src/components/Action/ActionsList.vue | 623 ++++++++++++++---- .../src/components/Action/ActionsListItem.vue | 172 ++--- .../webapp/src/components/Action/AddTile.vue | 57 ++ .../src/components/Action/ConditionBlock.vue | 219 ++++++ .../src/components/Action/ConditionEditor.vue | 104 +++ .../src/components/Action/ConditionTile.vue | 216 ++++++ .../src/components/Action/EndBlockTile.vue | 64 ++ .../webapp/src/components/Action/ListItem.vue | 206 ++++++ .../webapp/src/components/Action/Mixin.vue | 36 + .../components/Procedure/ProcedureEditor.vue | 56 +- .../webapp/src/components/elements/Tile.vue | 175 +++++ .../components/panels/Entities/IconEditor.vue | 7 +- .../components/panels/Entities/Procedure.vue | 8 + 15 files changed, 1881 insertions(+), 270 deletions(-) create mode 100644 platypush/backend/http/webapp/src/components/Action/ActionsBlock.vue create mode 100644 platypush/backend/http/webapp/src/components/Action/AddTile.vue create mode 100644 platypush/backend/http/webapp/src/components/Action/ConditionBlock.vue create mode 100644 platypush/backend/http/webapp/src/components/Action/ConditionEditor.vue create mode 100644 platypush/backend/http/webapp/src/components/Action/ConditionTile.vue create mode 100644 platypush/backend/http/webapp/src/components/Action/EndBlockTile.vue create mode 100644 platypush/backend/http/webapp/src/components/Action/ListItem.vue create mode 100644 platypush/backend/http/webapp/src/components/Action/Mixin.vue create mode 100644 platypush/backend/http/webapp/src/components/elements/Tile.vue diff --git a/platypush/backend/http/webapp/src/components/Action/ActionTile.vue b/platypush/backend/http/webapp/src/components/Action/ActionTile.vue index 65d9266994..e2bdca33d7 100644 --- a/platypush/backend/http/webapp/src/components/Action/ActionTile.vue +++ b/platypush/backend/http/webapp/src/components/Action/ActionTile.vue @@ -1,6 +1,7 @@ + + + + diff --git a/platypush/backend/http/webapp/src/components/Action/ActionsList.vue b/platypush/backend/http/webapp/src/components/Action/ActionsList.vue index c224fa6961..84a9371b9c 100644 --- a/platypush/backend/http/webapp/src/components/Action/ActionsList.vue +++ b/platypush/backend/http/webapp/src/components/Action/ActionsList.vue @@ -1,28 +1,57 @@ @@ -30,17 +59,68 @@ diff --git a/platypush/backend/http/webapp/src/components/Action/ActionsListItem.vue b/platypush/backend/http/webapp/src/components/Action/ActionsListItem.vue index 61cbc1e1f0..ba3979efcf 100644 --- a/platypush/backend/http/webapp/src/components/Action/ActionsListItem.vue +++ b/platypush/backend/http/webapp/src/components/Action/ActionsListItem.vue @@ -1,68 +1,25 @@ - - diff --git a/platypush/backend/http/webapp/src/components/Action/AddTile.vue b/platypush/backend/http/webapp/src/components/Action/AddTile.vue new file mode 100644 index 0000000000..24caaf58d1 --- /dev/null +++ b/platypush/backend/http/webapp/src/components/Action/AddTile.vue @@ -0,0 +1,57 @@ + + + + + diff --git a/platypush/backend/http/webapp/src/components/Action/ConditionBlock.vue b/platypush/backend/http/webapp/src/components/Action/ConditionBlock.vue new file mode 100644 index 0000000000..d0f6f6e0cc --- /dev/null +++ b/platypush/backend/http/webapp/src/components/Action/ConditionBlock.vue @@ -0,0 +1,219 @@ + + + + + diff --git a/platypush/backend/http/webapp/src/components/Action/ConditionEditor.vue b/platypush/backend/http/webapp/src/components/Action/ConditionEditor.vue new file mode 100644 index 0000000000..583a8fbc1a --- /dev/null +++ b/platypush/backend/http/webapp/src/components/Action/ConditionEditor.vue @@ -0,0 +1,104 @@ + + + + + diff --git a/platypush/backend/http/webapp/src/components/Action/ConditionTile.vue b/platypush/backend/http/webapp/src/components/Action/ConditionTile.vue new file mode 100644 index 0000000000..c88bf4c0ed --- /dev/null +++ b/platypush/backend/http/webapp/src/components/Action/ConditionTile.vue @@ -0,0 +1,216 @@ + + + + + diff --git a/platypush/backend/http/webapp/src/components/Action/EndBlockTile.vue b/platypush/backend/http/webapp/src/components/Action/EndBlockTile.vue new file mode 100644 index 0000000000..4ae3cee4ab --- /dev/null +++ b/platypush/backend/http/webapp/src/components/Action/EndBlockTile.vue @@ -0,0 +1,64 @@ + + + diff --git a/platypush/backend/http/webapp/src/components/Action/ListItem.vue b/platypush/backend/http/webapp/src/components/Action/ListItem.vue new file mode 100644 index 0000000000..f9354f8696 --- /dev/null +++ b/platypush/backend/http/webapp/src/components/Action/ListItem.vue @@ -0,0 +1,206 @@ + + + + + diff --git a/platypush/backend/http/webapp/src/components/Action/Mixin.vue b/platypush/backend/http/webapp/src/components/Action/Mixin.vue new file mode 100644 index 0000000000..48a9eacba0 --- /dev/null +++ b/platypush/backend/http/webapp/src/components/Action/Mixin.vue @@ -0,0 +1,36 @@ + diff --git a/platypush/backend/http/webapp/src/components/Procedure/ProcedureEditor.vue b/platypush/backend/http/webapp/src/components/Procedure/ProcedureEditor.vue index 6a0e910e12..1e9558bf5c 100644 --- a/platypush/backend/http/webapp/src/components/Procedure/ProcedureEditor.vue +++ b/platypush/backend/http/webapp/src/components/Procedure/ProcedureEditor.vue @@ -64,7 +64,7 @@ + @input="onActionsEdit" /> @@ -176,7 +176,7 @@ ({...a})), - args: [...(this.value?.args || [])], - meta: {...(this.value?.meta || {})}, + ...value, + actions: value.actions?.map(a => ({...a})), + args: [...(value?.args || [])], + meta: {...(value?.meta || {})}, } }, }, diff --git a/platypush/backend/http/webapp/src/components/elements/Tile.vue b/platypush/backend/http/webapp/src/components/elements/Tile.vue new file mode 100644 index 0000000000..a1d6ef7ef8 --- /dev/null +++ b/platypush/backend/http/webapp/src/components/elements/Tile.vue @@ -0,0 +1,175 @@ + + + + + diff --git a/platypush/backend/http/webapp/src/components/panels/Entities/IconEditor.vue b/platypush/backend/http/webapp/src/components/panels/Entities/IconEditor.vue index a547fb0e68..54ab29fbce 100644 --- a/platypush/backend/http/webapp/src/components/panels/Entities/IconEditor.vue +++ b/platypush/backend/http/webapp/src/components/panels/Entities/IconEditor.vue @@ -160,7 +160,12 @@ export default { watch: { editIcon() { - this.newIcon = (this.entity.meta?.icon?.['class'] || this.entity.meta?.icon?.url)?.trim() + this.newIcon = ( + this.entity.meta?.icon?.url || + this.entity.meta?.icon?.['class'] || + this.currentIcon.url || + this.currentIcon.class + )?.trim() }, newIcon() { diff --git a/platypush/backend/http/webapp/src/components/panels/Entities/Procedure.vue b/platypush/backend/http/webapp/src/components/panels/Entities/Procedure.vue index 988d266411..69dac41ca8 100644 --- a/platypush/backend/http/webapp/src/components/panels/Entities/Procedure.vue +++ b/platypush/backend/http/webapp/src/components/panels/Entities/Procedure.vue @@ -133,6 +133,10 @@ +
+ +
+
Actions
@@ -212,6 +216,7 @@ import ConfirmDialog from "@/components/elements/ConfirmDialog"; import EntityMixin from "./EntityMixin" import EntityIcon from "./EntityIcon" import FileEditor from "@/components/File/EditorModal"; +import IconEditor from "@/components/panels/Entities/IconEditor"; import ProcedureEditor from "@/components/Procedure/ProcedureEditorModal" import Response from "@/components/Action/Response" @@ -220,6 +225,7 @@ export default { ConfirmDialog, EntityIcon, FileEditor, + IconEditor, ProcedureEditor, Response, }, @@ -658,6 +664,8 @@ $icon-width: 2em; } .value { + text-align: right; + @include until($tablet) { width: 100%; }