diff --git a/platypush/backend/http/webapp/src/components/Action/ActionEditor.vue b/platypush/backend/http/webapp/src/components/Action/ActionEditor.vue
index 3a5c88ef24..c5af4ea465 100644
--- a/platypush/backend/http/webapp/src/components/Action/ActionEditor.vue
+++ b/platypush/backend/http/webapp/src/components/Action/ActionEditor.vue
@@ -5,11 +5,13 @@
-
-
-
+
@@ -107,7 +109,7 @@ import ActionArgs from "./ActionArgs"
import ActionDoc from "./ActionDoc"
import Autocomplete from "@/components/elements/Autocomplete"
import Loading from "@/components/Loading"
-import Modal from "@/components/Modal";
+import Modal from "@/components/Modal"
import Response from "./Response"
import Tab from "@/components/elements/Tab"
import Tabs from "@/components/elements/Tabs"
@@ -127,6 +129,12 @@ export default {
Tabs,
},
+ props: {
+ value: {
+ type: Object,
+ },
+ },
+
data() {
return {
loading: false,
@@ -295,8 +303,14 @@ export default {
}
},
- async updateAction(actionName) {
- if (actionName === this.action.name)
+ async updateAction(actionName, params) {
+ let {force, args, extraArgs} = params || {}
+ if (!args)
+ args = {}
+ if (!extraArgs)
+ extraArgs = []
+
+ if (actionName === this.action.name && !force)
return
this.action.name = actionName
@@ -312,15 +326,15 @@ export default {
try {
this.action = {
...this.actions[this.action.name],
- args: Object.entries(this.actions[this.action.name].args).reduce((args, entry) => {
- args[entry[0]] = {
+ args: Object.entries(this.actions[this.action.name].args).reduce((a, entry) => {
+ a[entry[0]] = {
...entry[1],
- value: entry[1].default,
+ value: args?.[entry[0]] ?? entry[1].default,
}
- return args
+ return a
}, {}),
- extraArgs: [],
+ extraArgs: extraArgs || [],
}
} finally {
this.docLoading = false
@@ -450,10 +464,35 @@ export default {
window.open(event.target.getAttribute('href', '_blank'))
}
},
+
+ onValueChanged(value) {
+ value = value || this.value
+ if (!value)
+ return
+
+ const action = value.name || value.action
+ this.$nextTick(() => {
+ this.updateAction(action, {
+ force: true,
+ args: value.args || {},
+ extraArgs: value.extraArgs || [],
+ })
+ })
+ },
},
- mounted() {
- this.refresh()
+ watch: {
+ value: {
+ immediate: true,
+ handler(value) {
+ this.onValueChanged(value)
+ },
+ },
+ },
+
+ async mounted() {
+ await this.refresh()
+ await this.onValueChanged()
},
}
@@ -506,5 +545,21 @@ export default {
}
}
}
+
+ .curl-modal-container {
+ :deep(.modal) {
+ .content {
+ width: 100%;
+ }
+
+ .content .body {
+ height: auto;
+ }
+
+ .output {
+ border-radius: 0;
+ }
+ }
+ }
}