Skip to content

Commit

Permalink
Merge pull request Countly#2160 from waiterZen/hooks-incoming-data-bug
Browse files Browse the repository at this point in the history
Hooks incoming data bug
  • Loading branch information
ar2rsawseen authored Nov 29, 2021
2 parents 83c8cb3 + 804eb4c commit 402f5a8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 14 deletions.
38 changes: 27 additions & 11 deletions plugins/hooks/api/parts/triggers/incoming_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,36 @@ class IncomingDataTrigger {
*/
register() {
InternalEvents.forEach((e) => {
plugins.register(e, (/*obj*/) => {
/*const ob = JSON.parse(JSON.stringify(obj));
console.log(e, ob, "?##33333433");
if (e === '/plugins/drill') {
const hooksData = {
params: {...ob.params}
plugins.register(e, (obj) => {
try {
const ob = {
params: {
app_user: JSON.parse(JSON.stringify(obj.params.app_user)),
app_id: common.db.ObjectID(obj.params.app_id.toString()),
req: {
header: JSON.parse(JSON.stringify(obj.params.req.headers || {})),
},
ip_address: obj.params.ip_address,
qstring: JSON.parse(JSON.stringify(obj.params.qstring || {})),
},
events: JSON.parse(JSON.stringify(obj.events || [])),
};
if (ob.events) {
hooksData.params.qstring.events = ob.events;
log.d(e, ob, "[Incoming data capture]");
if (e === '/plugins/drill') {
const hooksData = {
params: {...ob.params}
};
if (ob.events) {
hooksData.params.qstring.events = ob.events;
}
this.process(e, hooksData);
return;
}
this.process(e, hooksData);
return;
this.process(e, ob);
}
catch (err) {
console.log(err);
}
this.process(e, ob);*/
});
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@
},
"HTTPEffect": {
name: jQuery.i18n.map["hooks.HTTPEffect"],
init: function() {
init: function(dom) {
var methods = [
{value: "get", name: jQuery.i18n.map["hooks.http-method-get"]},
{value: "post", name: jQuery.i18n.map["hooks.http-method-post"]},
];
$(".http-effect-method-dropdown").clySelectSetItems(methods);
$(".http-effect-method-dropdown").clySelectSetSelection(methods[0].value, methods[0].name);
$(dom).find(".http-effect-method-dropdown").clySelectSetItems(methods);
$(dom).find(".http-effect-method-dropdown").clySelectSetSelection(methods[0].value, methods[0].name);
},
getValidConfig: function(dom) {
var url = $(dom).find("#http-effect-url").val();
Expand Down

0 comments on commit 402f5a8

Please sign in to comment.