Skip to content

Commit 2c57272

Browse files
authored
Merge branch 'master' into ar2rsawseen/master
2 parents 6fbf6f3 + 626008a commit 2c57272

File tree

18 files changed

+500
-296
lines changed

18 files changed

+500
-296
lines changed

CHANGELOG.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,39 @@
1-
## Version 24.05.xx
1+
## Version 24.05.XX
2+
Features:
3+
- [hooks] Added remote config changes to internal actions
4+
- [system-utility] New endpoint: /take-heap-snapshot.
5+
- [system-utility] Using nodejs fs to write profiler files instead of gridfs.
6+
Fixes:
7+
- [drill] Fix for UI error when push plugin is not enabled
8+
9+
Enterprise fixes:
10+
- [drill] Fixed empty events list in drill section
11+
12+
## Version 24.05.22
13+
Features:
14+
- [core] Add self tracking capability
215

16+
Fixes:
17+
- [push] Using apns-id header as message result in debug mode
18+
- [server-stats] Fix data point calculation in job
19+
- [TopEventsJob] preserver previous state if overwriting fails
20+
- [ui] scroll top on step changes in drawers
21+
22+
Enterprise fixes:
23+
- [drill] Encoding url component before changing history state
24+
- [drill] [license] Update license loader to enable supplying db client
25+
- [users] Format data points displayed in user sidebar
26+
- [cohorts] Unescape drill texts in cohort component
27+
328
Dependencies:
429
- Bump fs-extra from 11.2.0 to 11.3.0
530
- Bump nodemailer from 6.9.16 to 6.10.0
631

7-
## Version 24.05.21
32+
Enterprise Dependencies:
33+
- Bump nanoid in /plugins/cognito from 2.1.11 to 3.3.8
34+
- Bump shortid in /plugins/cognito from 2.2.16 to 2.2.17
835

36+
## Version 24.05.21
937
Fixes:
1038
- [core] Fixed a bug causing events to not being loaded when there's an escaped character in the event name
1139
- [core] Fixed a bug that was causing drill to crash when there's a percentage symbol in the event name

api/jobs/topEvents.js

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ class TopEventsJob extends job.Job {
1919
/**
2020
* TopEvents initialize function
2121
*/
22-
init() {
23-
this.getAllApps();
22+
async init() {
23+
return this.getAllApps();
2424
}
2525

2626
/**
@@ -144,6 +144,7 @@ class TopEventsJob extends job.Job {
144144
}
145145
catch (error) {
146146
log.e("TopEvents Job has a error: ", error);
147+
throw error;
147148
}
148149
}
149150

@@ -157,7 +158,18 @@ class TopEventsJob extends job.Job {
157158
const encodedData = this.encodeEvents(data);
158159
const timeSecond = this.timeSecond();
159160
const currentPeriood = this.mutatePeriod(period);
160-
await new Promise((res, rej) => common.db.collection(TopEventsJob.COLLECTION_NAME).insert({ app_id: _id, ts: timeSecond, period: currentPeriood, data: encodedData, totalCount: totalCount, prevTotalCount: prevTotalCount, totalSum: totalSum, prevTotalSum: prevTotalSum, totalDuration: totalDuration, prevTotalDuration: prevTotalDuration, prevSessionCount: sessionData.prevSessionCount, totalSessionCount: sessionData.totalSessionCount, prevUsersCount: usersData.prevUsersCount, totalUsersCount: usersData.totalUsersCount }, (error, records) => !error && records ? res(records) : rej(error)));
161+
await new Promise((res, rej) => common.db.collection(TopEventsJob.COLLECTION_NAME).findOneAndReplace(
162+
{
163+
app_id: _id, period: currentPeriood,
164+
},
165+
{
166+
app_id: _id, ts: timeSecond, period: currentPeriood, data: encodedData, totalCount: totalCount, prevTotalCount: prevTotalCount, totalSum: totalSum, prevTotalSum: prevTotalSum, totalDuration: totalDuration, prevTotalDuration: prevTotalDuration, prevSessionCount: sessionData.prevSessionCount, totalSessionCount: sessionData.totalSessionCount, prevUsersCount: usersData.prevUsersCount, totalUsersCount: usersData.totalUsersCount
167+
},
168+
{
169+
upsert: true
170+
},
171+
(error, records) => !error && records ? res(records) : rej(error))
172+
);
161173
}
162174

163175
/**
@@ -169,7 +181,6 @@ class TopEventsJob extends job.Job {
169181
const getEvents = await new Promise((res, rej) => common.db.collection("events").findOne({ _id: app._id }, (errorEvents, result) => errorEvents ? rej(errorEvents) : res(result)));
170182
if (getEvents && 'list' in getEvents) {
171183
const eventMap = this.eventsFilter(getEvents.list);
172-
await new Promise((res, rej) => common.db.collection(TopEventsJob.COLLECTION_NAME).remove({ app_id: app._id }, (error, result) => error ? rej(error) : res(result)));
173184
if (eventMap && eventMap instanceof Array) {
174185
for (const period of TopEventsJob.PERIODS) {
175186
const data = {};
@@ -211,9 +222,14 @@ class TopEventsJob extends job.Job {
211222
* @param {Db} db connection
212223
* @param {done} done callback
213224
*/
214-
run(db, done) {
215-
this.init();
216-
done();
225+
async run(db, done) {
226+
try {
227+
await this.init();
228+
done();
229+
}
230+
catch (error) {
231+
done(error);
232+
}
217233
}
218234
}
219235

frontend/express/public/javascripts/countly/vue/components/helpers.js

Lines changed: 74 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global Vue, CV, app, countlyEvent, countlyGlobal, countlyAuth, VueJsonPretty, ElementTiptapPlugin, countlyCommon CountlyHelpers*/
1+
/* global Vue, CV, $, app, countlyEvent, countlyGlobal, countlyAuth, VueJsonPretty, ElementTiptapPlugin, countlyCommon CountlyHelpers*/
22

33
(function(countlyVue) {
44

@@ -575,32 +575,36 @@
575575

576576
Vue.component("cly-event-select", countlyBaseComponent.extend({
577577
mixins: [countlyVue.mixins.i18n],
578-
template: '<cly-select-x\
579-
:test-id="testId"\
580-
pop-class="cly-event-select"\
581-
all-placeholder="All Events"\
582-
search-placeholder="Search in Events"\
583-
placeholder="Select Event"\
584-
:disabled="disabled"\
585-
:hide-default-tabs="true"\
586-
:options="availableEvents"\
587-
:hide-all-options-tab="true"\
588-
:single-option-settings="singleOptionSettings"\
589-
:adaptive-length="adaptiveLength"\
590-
:arrow="arrow"\
591-
:width="width"\
592-
v-bind="$attrs"\
593-
v-on="$listeners">\
594-
<template v-slot:header="selectScope">\
595-
<h4 class="color-cool-gray-100 bu-mb-2" v-if="hasTitle">{{title}}</h4>\
596-
<el-radio-group\
597-
:value="selectScope.activeTabId"\
598-
@input="selectScope.updateTab"\
599-
size="small">\
600-
<el-radio-button :test-id="testId + \'-tab-\' + idx" v-for="(tab,idx) in selectScope.tabs" :key="tab.name" :label="tab.name">{{tab.label}}</el-radio-button>\
601-
</el-radio-group>\
602-
</template>\
603-
</cly-select-x>',
578+
template: '<div class="cly-event-select">\
579+
<cly-select-x\
580+
:test-id="testId"\
581+
pop-class="cly-event-select"\
582+
all-placeholder="All Events"\
583+
search-placeholder="Search in Events"\
584+
placeholder="Select Event"\
585+
:disabled="disabled"\
586+
:hide-default-tabs="true"\
587+
:options="availableEvents"\
588+
:hide-all-options-tab="true"\
589+
:single-option-settings="singleOptionSettings"\
590+
:adaptive-length="adaptiveLength"\
591+
:arrow="arrow"\
592+
:width="width"\
593+
v-bind="$attrs"\
594+
v-if="!isLoading"\
595+
v-on="$listeners">\
596+
<template v-slot:header="selectScope">\
597+
<h4 class="color-cool-gray-100 bu-mb-2" v-if="hasTitle">{{title}}</h4>\
598+
<el-radio-group\
599+
:value="selectScope.activeTabId"\
600+
@input="selectScope.updateTab"\
601+
size="small">\
602+
<el-radio-button :test-id="testId + \'-tab-\' + idx" v-for="(tab,idx) in selectScope.tabs" :key="tab.name" :label="tab.name">{{tab.label}}</el-radio-button>\
603+
</el-radio-group>\
604+
</template>\
605+
</cly-select-x>\
606+
<div v-else class="cly-event-select__loading el-loading-spinner"><i class="el-icon-loading bu-mr-2"></i><p class="el-loading-text">Loading...</p></div>\
607+
</div>',
604608
props: {
605609
blacklistedEvents: {
606610
type: Array,
@@ -621,16 +625,20 @@
621625
singleOptionSettings: {
622626
autoPick: true,
623627
hideList: true
624-
}
628+
},
629+
availableEvents: [],
630+
isLoading: false
625631
};
626632
},
627633
computed: {
628634
hasTitle: function() {
629635
return !!this.title;
630-
},
631-
availableEvents: function() {
636+
}
637+
},
638+
methods: {
639+
prepareAvailableEvents: function() {
632640
var self = this;
633-
var availableEvents = [
641+
var preparedEventList = [
634642
{
635643
"label": this.i18n('sidebar.analytics.sessions'),
636644
"name": "[CLY]_session",
@@ -643,7 +651,7 @@
643651
}
644652
];
645653
if (countlyGlobal.plugins.indexOf('views') !== -1) {
646-
availableEvents.push({
654+
preparedEventList.push({
647655
"label": this.i18n('internal-events.[CLY]_view'),
648656
"name": "[CLY]_view",
649657
"options": [ { label: this.i18n('internal-events.[CLY]_view'), value: '[CLY]_view' } ]
@@ -660,7 +668,7 @@
660668
feedbackOptions.push({ label: this.i18n('internal-events.[CLY]_survey'), value: '[CLY]_survey' });
661669
}
662670
if (feedbackOptions.length > 0) {
663-
availableEvents.push({
671+
preparedEventList.push({
664672
"label": this.i18n("sidebar.feedback"),
665673
"name": "feedback",
666674
"options": feedbackOptions
@@ -669,15 +677,15 @@
669677

670678

671679
if (countlyGlobal.plugins.indexOf('compliance-hub') !== -1) {
672-
availableEvents.push({
680+
preparedEventList.push({
673681
"label": this.i18n('internal-events.[CLY]_consent'),
674682
"name": "[CLY]_consent",
675683
"options": [ { label: this.i18n('internal-events.[CLY]_consent'), value: '[CLY]_consent' } ]
676684
});
677685
}
678686

679687
if (countlyGlobal.plugins.indexOf('crashes') !== -1) {
680-
availableEvents.push({
688+
preparedEventList.push({
681689
"label": this.i18n('internal-events.[CLY]_crash'),
682690
"name": "[CLY]_crash",
683691
"options": [ { label: this.i18n('internal-events.[CLY]_crash'), value: '[CLY]_crash' } ]
@@ -692,7 +700,7 @@
692700
{ label: this.i18n('internal-events.[CLY]_push_sent'), value: '[CLY]_push_sent' }
693701
]
694702
});*/
695-
availableEvents.push({
703+
preparedEventList.push({
696704
"label": 'Push Actioned',
697705
"name": "[CLY]_push_action",
698706
"options": [
@@ -707,26 +715,40 @@
707715
// "noChild": true
708716
// }
709717

710-
if (this.selectedApp) {
711-
countlyEvent.getEventsForApps([this.selectedApp], function(eData) {
712-
availableEvents[1].options = eData.map(function(e) {
713-
return {label: countlyCommon.unescapeHtml(e.name), value: e.value};
718+
return new Promise(function(resolve) {
719+
if (this.selectedApp) {
720+
self.isLoading = true;
721+
countlyEvent.getEventsForApps([this.selectedApp], function(eData) {
722+
preparedEventList[1].options = eData.map(function(e) {
723+
return {label: countlyCommon.unescapeHtml(e.name), value: e.value};
724+
});
714725
});
715-
});
716-
}
717-
else {
718-
availableEvents[1].options = countlyEvent.getEvents().map(function(event) {
719-
return {label: countlyCommon.unescapeHtml(event.name), value: event.key};
720-
});
721-
}
722-
723-
availableEvents = availableEvents.filter(function(evt) {
724-
return !(self.blacklistedEvents.includes(evt.name));
726+
preparedEventList = preparedEventList.filter(function(evt) {
727+
return !(self.blacklistedEvents.includes(evt.name));
728+
});
729+
self.isLoading = false;
730+
resolve(preparedEventList);
731+
}
732+
else {
733+
self.isLoading = true;
734+
$.when(countlyEvent.refreshEvents()).then(function() {
735+
const events = countlyEvent.getEvents();
736+
preparedEventList[1].options = events.map(function(event) {
737+
return {label: countlyCommon.unescapeHtml(event.name), value: event.key};
738+
});
739+
preparedEventList = preparedEventList.filter(function(evt) {
740+
return !(self.blacklistedEvents.includes(evt.name));
741+
});
742+
self.isLoading = false;
743+
resolve(preparedEventList);
744+
});
745+
}
725746
});
726-
727-
return availableEvents;
728747
}
729748
},
749+
created: async function() {
750+
this.availableEvents = await this.prepareAvailableEvents();
751+
}
730752
}));
731753

732754
Vue.component("cly-paginate", countlyBaseComponent.extend({

frontend/express/public/stylesheets/vue/clyvue.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4180,4 +4180,13 @@
41804180
margin-left: 10px;
41814181
}
41824182
}
4183+
}
4184+
4185+
.cly-event-select {
4186+
&__loading {
4187+
display: flex;
4188+
margin-top:0;
4189+
position: unset;
4190+
top:0;
4191+
}
41834192
}

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/push/api/send/platforms/i.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ class APN extends Base {
708708
status = headers[':status'];
709709
// self.log.d('%d: status %d: %j', i, status, self.session.state);
710710
if (status === 200) {
711-
const apnsUniqueId = headers["apns-unique-id"];
711+
const apnsUniqueId = headers["apns-id"] ?? headers["apns-unique-id"];
712712
oks.push({ p: p._id, r: apnsUniqueId });
713713
stream.destroy();
714714
streamDone();

0 commit comments

Comments
 (0)