From f4cc37732bda92a904c3c8617f3ef6ab5edb7f29 Mon Sep 17 00:00:00 2001 From: Jonathan Cobb Date: Sat, 1 Feb 2020 17:51:21 -0500 Subject: [PATCH] fix button message defaults, allow sortable actions --- .../model/app/config/AppConfigAction.java | 3 +- .../service/message/AppMessageService.java | 13 +++--- .../bubble_block/bubbleApp_bubbleBlock.json | 42 +++++++++++-------- bubble-web | 2 +- 4 files changed, 36 insertions(+), 24 deletions(-) diff --git a/bubble-server/src/main/java/bubble/model/app/config/AppConfigAction.java b/bubble-server/src/main/java/bubble/model/app/config/AppConfigAction.java index 9cc5fafc..d7c829f4 100644 --- a/bubble-server/src/main/java/bubble/model/app/config/AppConfigAction.java +++ b/bubble-server/src/main/java/bubble/model/app/config/AppConfigAction.java @@ -11,8 +11,9 @@ public class AppConfigAction { @Getter @Setter private AppConfigScope scope = AppConfigScope.item; @Getter @Setter private String when; @Getter @Setter private String view; + @Getter @Setter private Integer index = 0; - @Getter @Setter private AppDataField[] params; + @Getter @Setter private String[] params; public boolean hasParams () { return !empty(params); } @Getter @Setter private String button; diff --git a/bubble-server/src/main/java/bubble/service/message/AppMessageService.java b/bubble-server/src/main/java/bubble/service/message/AppMessageService.java index ea713054..d2ce41d6 100644 --- a/bubble-server/src/main/java/bubble/service/message/AppMessageService.java +++ b/bubble-server/src/main/java/bubble/service/message/AppMessageService.java @@ -100,17 +100,20 @@ public class AppMessageService { if (configView.hasActions()) { for (AppConfigAction action : configView.getActions()) { - final String actionKey = cfgKeyPrefix + MSG_SUFFIX_ACTION + action.getName(); - if (!props.containsKey(actionKey)) props.setProperty(actionKey, action.getName()); + final String actionName = action.getName(); + final String actionKey = cfgKeyPrefix + MSG_SUFFIX_ACTION + actionName; + if (!props.containsKey(actionKey)) props.setProperty(actionKey, actionName); + final String buttonKey = cfgKeyPrefix + MSG_SUFFIX_BUTTON + actionName; if (action.hasButton()) { - final String buttonKey = cfgKeyPrefix + MSG_SUFFIX_BUTTON + action.getName(); if (!props.containsKey(buttonKey)) props.setProperty(buttonKey, action.getButton()); + } else { + props.setProperty(buttonKey, props.getProperty(cfgKeyPrefix+MSG_SUFFIX_ACTION+ actionName)); } if (action.hasParams()) { - for (AppDataField param : action.getParams()) { - ensureFieldNameAndDescription(props, cfgKeyPrefix, param.getName()); + for (String param : action.getParams()) { + ensureFieldNameAndDescription(props, cfgKeyPrefix, param); } } } diff --git a/bubble-server/src/main/resources/models/apps/bubble_block/bubbleApp_bubbleBlock.json b/bubble-server/src/main/resources/models/apps/bubble_block/bubbleApp_bubbleBlock.json index 9f43d8f7..6a2b987b 100644 --- a/bubble-server/src/main/resources/models/apps/bubble_block/bubbleApp_bubbleBlock.json +++ b/bubble-server/src/main/resources/models/apps/bubble_block/bubbleApp_bubbleBlock.json @@ -28,6 +28,7 @@ {"name": "name"}, {"name": "description", "control": "textarea"}, {"name": "url", "type": "http_url"}, + {"name": "testUrl", "type": "http_url"}, {"name": "tags"}, {"name": "enabled", "type": "flag"}, {"name": "rule"} @@ -38,14 +39,19 @@ "root": "true", "fields": ["name", "description", "url", "enabled", "tagString"], "actions": [ - {"name": "enableList", "when": "!item.enabled"}, - {"name": "disableList", "when": "item.enabled"}, - {"name": "manageList", "view": "manageList"}, - {"name": "removeList"}, + {"name": "enableList", "when": "!item.enabled", "index": 10}, + {"name": "disableList", "when": "item.enabled", "index": 20}, + {"name": "manageList", "view": "manageList", "index": 30}, + {"name": "removeList", "index": 40}, { - "name": "createList", "scope": "app", "view": "manageList", - "params": [{"name": "url", "type": "http_url"}], + "name": "createList", "scope": "app", "view": "manageList", "index": 10, + "params": ["url"], "button": "createList" + }, + { + "name": "testUrl", "scope": "app", "index": 20, + "params": ["testUrl"], + "button": "testUrl" } ] }, { @@ -53,26 +59,26 @@ "scope": "item", "fields": ["name", "description", "url", "tags", "enabled"], "actions": [ - {"name": "enableList", "when": "!item.enabled"}, - {"name": "disableList", "when": "item.enabled"}, - {"name": "removeList"}, - {"name": "updateList"}, - {"name": "manageListRules"} + {"name": "updateList", "index": 10}, + {"name": "enableList", "when": "!item.enabled", "index": 20}, + {"name": "disableList", "when": "item.enabled", "index": 30}, + {"name": "manageListRules", "view": "manageRules", "index": 40}, + {"name": "removeList", "index": 50} ] }, { "name": "manageRules", "scope": "item", "fields": ["rule"], "actions": [ - {"name": "removeRule"}, + {"name": "removeRule", "index": 10}, { - "name": "createRule", - "params": [{"name": "url", "type": "http_url"}], + "name": "createRule", "scope": "app", "index": 10, + "params": ["url"], "button": "createRule" }, { - "name": "testUrl", - "params": [{"name": "url", "type": "http_url"}], + "name": "testUrl", "scope": "app", "index": 20, + "params": ["testUrl"], "button": "testUrl" } ] @@ -143,9 +149,11 @@ {"name": "config.field.url.description", "value": "URL of the Filter List"}, {"name": "config.field.tagString", "value": "Tags"}, {"name": "config.field.tags", "value": "Tags"}, - {"name": "config.field.tags.description", "value": "A comma-separated list of tags: "}, + {"name": "config.field.tags.description", "value": "A comma-separated list of tags"}, {"name": "config.field.enabled", "value": "Enabled"}, {"name": "config.field.rule", "value": "Rule"}, + {"name": "config.field.testUrl", "value": "Test URL"}, + {"name": "config.field.testUrl.description", "value": "URL to check against filters"}, {"name": "config.action.enableList", "value": "Enable"}, {"name": "config.action.disableList", "value": "Disable"}, diff --git a/bubble-web b/bubble-web index 3244ea33..88b12bd4 160000 --- a/bubble-web +++ b/bubble-web @@ -1 +1 @@ -Subproject commit 3244ea3346f1ab804d9f8cfcca045dbfbc93f575 +Subproject commit 88b12bd4be622c1c839550686b944ff6dff3be26