Skip to content

Commit 1d0e42b

Browse files
authored
Merge pull request #5749 from Countly/SER-1897
[SER-1897] [FIX] Add option to select features to populate
2 parents 0fc41e9 + 6c759b3 commit 1d0e42b

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

frontend/express/public/core/onboarding/javascripts/countly.views.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
countlyPopulator.setStartTime(countlyCommon.periodObj.start / 1000);
100100
countlyPopulator.setEndTime(countlyCommon.periodObj.end / 1000);
101101
countlyPopulator.setSelectedTemplate(selectedAppTemplate);
102+
countlyPopulator.setSelectedFeatures("all");
102103
countlyPopulator.getTemplate(selectedAppTemplate, function(template) {
103104
countlyPopulator.generateUsers(10, template);
104105
self.populatorProgress = 0;

plugins/populator/frontend/public/javascripts/countly.models.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,10 +1106,13 @@
11061106
if (template && template.events && template.events.length) {
11071107
events = events.concat(this.getEvent(null, template.events[0]));
11081108
}
1109-
req = {timestamp: this.ts, begin_session: 1, metrics: this.metrics, user_details: this.userdetails, events: events, apm: this.getTrace(), ignore_cooldown: '1'};
1109+
req = {timestamp: this.ts, begin_session: 1, metrics: this.metrics, user_details: this.userdetails, events: events, ignore_cooldown: '1'};
11101110
req.events = req.events.concat(this.getHeatmapEvents());
11111111
req.events = req.events.concat(this.getFeedbackEvents());
11121112
req.events = req.events.concat(this.getScrollmapEvents());
1113+
if (_featuresToPopulate.includes("performance-monitoring")) {
1114+
req.apm = this.getTrace();
1115+
}
11131116
}
11141117
else {
11151118
events = this.getEvent("[CLY]_view", template && template.events && template.events["[CLY]_view"], this.ts, true)
@@ -1120,7 +1123,10 @@
11201123
if (template && template.events && template.events.length) {
11211124
events = events.concat(this.getEvent(null, template.events[0]));
11221125
}
1123-
req = {timestamp: this.ts, begin_session: 1, events: events, apm: this.getTrace(), ignore_cooldown: '1'};
1126+
req = {timestamp: this.ts, begin_session: 1, events: events, ignore_cooldown: '1'};
1127+
if (_featuresToPopulate.includes("performance-monitoring")) {
1128+
req.apm = this.getTrace();
1129+
}
11241130
}
11251131

11261132
if (Math.random() > 0.10) {
@@ -1130,7 +1136,7 @@
11301136
req[this.platform.toLowerCase() + "_token"] = randomString(8);
11311137
}
11321138

1133-
if (Math.random() > 0.50) {
1139+
if (Math.random() > 0.50 && _featuresToPopulate.includes("crashes")) {
11341140
req.crash = this.getCrash();
11351141
}
11361142

@@ -1336,6 +1342,7 @@
13361342
var abExampleCount = 1;
13371343
var abExampleName = "Pricing";
13381344
var _templateType = '';
1345+
var _allFeatures = ["ab-testing", "attribution", "cohorts", "crashes", "funnels", "performance-monitoring", "push", "star-rating", "surveys"];
13391346
var _featuresToPopulate = [];
13401347
var runCount = 0;
13411348
var completedRequestCount = 0;
@@ -2518,7 +2525,7 @@
25182525
}
25192526
}
25202527

2521-
if (countlyGlobal.plugins.indexOf('crash_symbolication') !== -1 && countlyAuth.validateCreate('crash_symbolication') && _featuresToPopulate.includes("crash_symbolication")) {
2528+
if (countlyGlobal.plugins.indexOf('crash_symbolication') !== -1 && countlyAuth.validateCreate('crash_symbolication') && _featuresToPopulate.includes("crashes")) {
25222529
const crashPlatforms = Object.keys(crashSymbolVersions).filter(key => crashSymbolVersions[key].length);
25232530

25242531

@@ -2592,7 +2599,7 @@
25922599
};
25932600

25942601
countlyPopulator.setSelectedFeatures = function(value) {
2595-
_featuresToPopulate = value;
2602+
_featuresToPopulate = (value === "all") ? _allFeatures : value;
25962603
};
25972604

25982605
countlyPopulator.getTemplate = function(templateId, callback) {

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,23 @@
4949
];
5050
},
5151
availableFeatures: function() {
52-
const plugins = [
52+
var plugins = [
5353
{value: "ab-testing", label: CV.i18n("ab-testing.title")},
5454
{value: "attribution", label: CV.i18n("attribution.title")},
5555
{value: "cohorts", label: CV.i18n("cohorts.cohorts")},
56-
{value: "crash_symbolication", label: CV.i18n("crash_symbolication.title")},
56+
{value: "crashes", label: CV.i18n(countlyGlobal.apps[countlyCommon.ACTIVE_APP_ID] && countlyGlobal.apps[countlyCommon.ACTIVE_APP_ID].type === "web" ? "web.crashes.title" : "crashes.title")},
5757
{value: "funnels", label: CV.i18n("funnels.plugin-title")},
58-
{value: "push", label: CV.i18n("push-notification.title")},
58+
{value: "performance-monitoring", label: CV.i18n("performance-monitoring.title")},
5959
{value: "star-rating", label: CV.i18n("star-rating.plugin-title")},
6060
{value: "surveys", label: CV.i18n("surveys.plugin-title")},
6161
];
62+
if (countlyGlobal.apps[countlyCommon.ACTIVE_APP_ID] && countlyGlobal.apps[countlyCommon.ACTIVE_APP_ID].type === "mobile") {
63+
plugins.push({value: "push", label: CV.i18n("push-notification.title")});
64+
}
6265
return plugins.filter(function(plugin) {
6366
return CountlyHelpers.isPluginEnabled(plugin.value);
67+
}).sort(function(a, b) {
68+
return a.label.localeCompare(b.label);
6469
});
6570
}
6671
},

0 commit comments

Comments
 (0)