Skip to content

Commit 6334829

Browse files
Merge pull request #5975 from Countly/hooks-remote-config-addition
[hooks] Added remote config changes to internal actions
2 parents a465031 + cc22f25 commit 6334829

File tree

4 files changed

+54
-2
lines changed

4 files changed

+54
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
## Version xx.xx.xx
1+
## Version 24.05.XX
22
Features:
3+
- [hooks] Added remote config changes to internal actions
34
- [system-utility] New endpoint: /take-heap-snapshot.
45
- [system-utility] Using nodejs fs to write profiler files instead of gridfs.
56

plugins/hooks/api/parts/triggers/internal_event.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,19 @@ class InternalEventTrigger {
212212
}
213213
break;
214214
}
215+
case "/i/remote-config/add-parameter":
216+
case "/i/remote-config/update-parameter":
217+
case "/i/remote-config/remove-parameter":
218+
case "/i/remote-config/add-condition":
219+
case "/i/remote-config/update-condition":
220+
case "/i/remote-config/remove-condition":
221+
utils.updateRuleTriggerTime(rule._id);
222+
this.pipeline({
223+
params: ob,
224+
rule: rule,
225+
eventType,
226+
});
227+
break;
215228
case "/alerts/trigger": {
216229
this.pipeline({
217230
params: ob,
@@ -255,4 +268,10 @@ const InternalEvents = [
255268
"/i/app_users/delete",
256269
"/hooks/trigger",
257270
"/alerts/trigger",
258-
];
271+
"/i/remote-config/add-parameter",
272+
"/i/remote-config/update-parameter",
273+
"/i/remote-config/remove-parameter",
274+
"/i/remote-config/add-condition",
275+
"/i/remote-config/update-condition",
276+
"/i/remote-config/remove-condition",
277+
];

plugins/hooks/frontend/public/javascripts/countly.views.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,12 @@
402402
{value: "/systemlogs", label: "/systemlogs"},
403403
{value: "/crashes/new", label: "/crashes/new"},
404404
{value: "/hooks/trigger", label: "/hooks/trigger"},
405+
{value: "/i/remote-config/add-parameter", label: "/i/remote-config/add-parameter"},
406+
{value: "/i/remote-config/update-parameter", label: "/i/remote-config/update-parameter"},
407+
{value: "/i/remote-config/remove-parameter", label: "/i/remote-config/remove-parameter"},
408+
{value: "/i/remote-config/add-condition", label: "/i/remote-config/add-condition"},
409+
{value: "/i/remote-config/update-condition", label: "/i/remote-config/update-condition"},
410+
{value: "/i/remote-config/remove-condition", label: "/i/remote-config/remove-condition"},
405411
{value: "/alerts/trigger", label: "/alerts/trigger"}
406412
],
407413
cohortOptions: [],

plugins/remote-config/api/api.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,11 @@ plugins.setConfigs("remote-config", {
440440
}
441441
return common.returnMessage(params, 500, message);
442442
}
443+
444+
plugins.dispatch("/i/remote-config/add-parameter", {
445+
params: parameter
446+
});
447+
443448
if (params.internal) {
444449
return true;
445450
}
@@ -967,6 +972,10 @@ plugins.setConfigs("remote-config", {
967972
return common.returnMessage(params, 500, message);
968973
}
969974

975+
plugins.dispatch("/i/remote-config/update-parameter", {
976+
params: parameter
977+
});
978+
970979
return common.returnMessage(params, 200);
971980
});
972981
}
@@ -1089,6 +1098,9 @@ plugins.setConfigs("remote-config", {
10891098
common.outDb.collection(collectionName).remove({_id: common.outDb.ObjectID(parameterId)}, function(removeErr) {
10901099
if (!removeErr) {
10911100
plugins.dispatch("/systemlogs", {params: params, action: "rc_parameter_removed", data: parameter});
1101+
plugins.dispatch("/i/remote-config/remove-parameter", {
1102+
params: parameter
1103+
});
10921104
return common.returnMessage(params, 200, 'Success');
10931105
}
10941106

@@ -1175,6 +1187,9 @@ plugins.setConfigs("remote-config", {
11751187
}
11761188

11771189
var conditionId = result && result[1] || null;
1190+
plugins.dispatch("/i/remote-config/add-condition", {
1191+
params: condition
1192+
});
11781193
if (params.internal) {
11791194
return conditionId;
11801195
}
@@ -1353,6 +1368,10 @@ plugins.setConfigs("remote-config", {
13531368
return common.returnMessage(params, 500, message);
13541369
}
13551370

1371+
plugins.dispatch("/i/remote-config/update-condition", {
1372+
params: condition
1373+
});
1374+
13561375
return common.returnMessage(params, 200);
13571376
});
13581377

@@ -1396,6 +1415,13 @@ plugins.setConfigs("remote-config", {
13961415

13971416
async.parallel(asyncTasks, function(err) {
13981417
if (!err) {
1418+
plugins.dispatch("/i/remote-config/remove-condition", {
1419+
params: {
1420+
conditionId: conditionId,
1421+
appId: appId,
1422+
ts: Date.now()
1423+
}
1424+
});
13991425
return common.returnMessage(params, 200, 'Success');
14001426
}
14011427

0 commit comments

Comments
 (0)