Skip to content

Commit 61c33ec

Browse files
authored
Merge branch 'next' into SER-1897
2 parents e270fab + ba0e681 commit 61c33ec

File tree

24 files changed

+326
-53
lines changed

24 files changed

+326
-53
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ Enterprise Features:
3535
- [users] UI improvements
3636
- [views] Added a quick transition to drill
3737

38+
## Version 24.05.17
39+
Fixes:
40+
- [push] Improved ability to observe push related errors
41+
42+
Enterprise fixes:
43+
- [cohorts] Fixed issues with nightly cleanup
44+
- [data-manager] Fixed UI bug where rules were not visible when editing "Merge by regex" transformations
45+
- [drill] Fixed wrong pie chart label tooltip in dashboard widget
46+
- [flows] Fixed bug in case of null data in schema
47+
- [nps] Fixed bug in the editor where the "internal name" field was not mandatory
48+
- [ratings] Fixed UI bug where "Internal name" was not a mandatory field
49+
3850
## Version 24.05.16
3951
Fixes:
4052
- [core] Replaced "Users" with "Sessions" label on technology home widgets

api/api.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ plugins.connectToAllDatabases().then(function() {
313313
jobs.job('api:clearAutoTasks').replace().schedule('every 1 day');
314314
jobs.job('api:task').replace().schedule('every 5 minutes');
315315
jobs.job('api:userMerge').replace().schedule('every 10 minutes');
316+
jobs.job("api:ttlCleanup").replace().schedule("every 1 minute");
316317
//jobs.job('api:appExpire').replace().schedule('every 1 day');
317318
}, 10000);
318319

api/jobs/ttlCleanup.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
const plugins = require("../../plugins/pluginManager.js");
2+
const common = require('../utils/common');
3+
const job = require("../parts/jobs/job.js");
4+
const log = require("../utils/log.js")("job:ttlCleanup");
5+
6+
/**
7+
* Class for job of cleaning expired records inside ttl collections
8+
*/
9+
class TTLCleanup extends job.Job {
10+
/**
11+
* Run the job
12+
*/
13+
async run() {
14+
log.d("Started running TTL clean up job");
15+
for (let i = 0; i < plugins.ttlCollections.length; i++) {
16+
const {
17+
db = "countly",
18+
collection,
19+
property,
20+
expireAfterSeconds = 0
21+
} = plugins.ttlCollections[i];
22+
let dbInstance;
23+
switch (db) {
24+
case "countly": dbInstance = common.db; break;
25+
case "countly_drill": dbInstance = common.drillDb; break;
26+
case "countly_out": dbInstance = common.outDb; break;
27+
}
28+
if (!dbInstance) {
29+
log.e("Invalid db selection:", db);
30+
continue;
31+
}
32+
33+
log.d("Started cleaning up", collection);
34+
const result = await dbInstance.collection(collection).deleteMany({
35+
[property]: {
36+
$lte: new Date(Date.now() - expireAfterSeconds * 1000)
37+
}
38+
});
39+
log.d("Finished cleaning up", result.deletedCount, "records from", collection);
40+
41+
// Sleep 1 second to prevent sending too many deleteMany queries
42+
await new Promise(res => setTimeout(res, 1000));
43+
}
44+
log.d("Finished running TTL clean up job");
45+
}
46+
}
47+
48+
module.exports = TTLCleanup;

bin/scripts/expire-data/delete_custom_events_regex.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77

88

9-
const { ObjectId } = require('mongodb');
109
const pluginManager = require('../../../plugins/pluginManager.js');
1110
const common = require('../../../api/utils/common.js');
1211
const drillCommon = require('../../../plugins/drill/api/common.js');
@@ -25,7 +24,7 @@ Promise.all([pluginManager.dbConnection("countly"), pluginManager.dbConnection("
2524

2625
//GET APP
2726
try {
28-
const app = await countlyDb.collection("apps").findOne({_id: ObjectId(APP_ID)}, {_id: 1, name: 1});
27+
const app = await countlyDb.collection("apps").findOne({_id: countlyDb.ObjectID(APP_ID)}, {_id: 1, name: 1});
2928
console.log("App:", app.name);
3029
//GET EVENTS
3130
var events = [];
@@ -51,6 +50,27 @@ Promise.all([pluginManager.dbConnection("countly"), pluginManager.dbConnection("
5150
}
5251
]).toArray();
5352
events = events.length ? events[0].list : [];
53+
const metaEvents = await drillDb.collection("drill_meta").aggregate([
54+
{
55+
$match: {
56+
'app_id': app._id + "",
57+
"type": "e",
58+
"e": { $regex: regex, $options: CASE_INSENSITIVE ? "i" : "", $nin: events }
59+
}
60+
},
61+
{
62+
$group: {
63+
_id: "$e"
64+
}
65+
},
66+
{
67+
$project: {
68+
_id: 0,
69+
e: "$_id"
70+
}
71+
}
72+
]).toArray();
73+
events = events.concat(metaEvents.map(e => e.e));
5474
}
5575
catch (err) {
5676
close("Invalid regex");
@@ -86,6 +106,7 @@ Promise.all([pluginManager.dbConnection("countly"), pluginManager.dbConnection("
86106
close(err);
87107
}
88108

109+
89110
async function deleteDrillEvents(appId, events) {
90111
for (let i = 0; i < events.length; i++) {
91112
var collectionName = drillCommon.getCollectionName(events[i], appId);

frontend/express/app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,7 @@ Promise.all([plugins.dbConnection(countlyConfig), plugins.dbConnection("countly_
974974
timezones: timezones,
975975
countlyTypeName: COUNTLY_NAMED_TYPE,
976976
countlyTypeTrack: COUNTLY_TRACK_TYPE,
977+
countlyTypeCE: COUNTLY_TYPE_CE,
977978
countly_tracking,
978979
countly_domain,
979980
frontend_app: versionInfo.frontend_app || 'e70ec21cbe19e799472dfaee0adb9223516d238f',

frontend/express/public/core/app-management/javascripts/countly.views.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,10 @@
392392
label: data.name
393393
});
394394
self.$store.dispatch("countlyCommon/addToAllApps", data);
395+
self.$store.dispatch("countlyCommon/updateActiveApp", data._id + "");
395396
if (self.firstApp) {
396397
countlyCommon.ACTIVE_APP_ID = data._id + "";
397398
app.onAppManagementSwitch(data._id + "", data && data.type || "mobile");
398-
self.$store.dispatch("countlyCommon/updateActiveApp", data._id + "");
399399
app.initSidebar();
400400
}
401401
self.firstApp = self.checkIfFirst();

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,9 @@
742742
},
743743
helpCenterTarget: function() {
744744
return this.enableGuides ? '_self' : "_blank";
745+
},
746+
isCommunityEdition: function() {
747+
return countlyGlobal.countlyTypeCE;
745748
}
746749
},
747750
methods: {
@@ -894,6 +897,12 @@
894897

895898
return menu;
896899
});
900+
},
901+
handleButtonClick: function() {
902+
CountlyHelpers.goTo({
903+
url: "https://flex.countly.com",
904+
isExternalLink: true
905+
});
897906
}
898907
},
899908
mounted: function() {

frontend/express/public/javascripts/countly/vue/templates/sidebar/sidebar.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,18 @@
4242
<analytics-menu ref="analytics" v-show="visibleSidebarMenu === 'analytics'"></analytics-menu>
4343
<management-menu ref="management" v-show="visibleSidebarMenu === 'management'" @management-menu-ready="onManagementMenuReady"></management-menu>
4444
<component :ref="item.name" v-for="item in components" :is="item.component" v-show="visibleSidebarMenu === item.name" :key="item.name"></component>
45-
<a :href="countlySidebarVersionPath"><div class="cly-vue-sidebar__version" data-test-id="sidebar-menu-version"> {{versionInfo}} </div></a>
45+
<div v-if="isCommunityEdition" class="cly-vue-sidebar__version" data-test-id="sidebar-menu-version">
46+
<div class="cly-vue-sidebar__version__banner">
47+
<div class="text">{{i18n('sidebar.banner.text')}}</div>
48+
<div class="text bu-has-text-weight-medium">{{i18n('sidebar.banner.upgrade')}}</div>
49+
<el-button class="button" type="success" @click="handleButtonClick">{{i18n('sidebar.banner.upgrade-button')}}</el-button>
50+
</div>
51+
</div>
52+
<a v-else :href="countlySidebarVersionPath">
53+
<div class="cly-vue-sidebar__version" data-test-id="sidebar-menu-version">
54+
{{versionInfo}}
55+
</div>
56+
</a>
4657
</div>
4758
</transition>
4859
</div>

frontend/express/public/localization/dashboard/dashboard.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,9 @@ sidebar.dashboard-tooltip = Dashboards
440440
sidebar.main-menu = Main Menu
441441
sidebar.my-profile = My Profile
442442
sidebar.copy-api-key-success-message = Api Key has been copied to clipboard!
443+
sidebar.banner.text = You are using a free plan.
444+
sidebar.banner.upgrade = Upgrade and get more.
445+
sidebar.banner.upgrade-button = Manage your plan
443446

444447
#dashboard
445448
dashboard.apply = Apply

frontend/express/public/stylesheets/styles/blocks/_sidebar.scss

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,26 @@ $bg-color: #24292e;
378378
width: 224px;
379379
font-size: 10px;
380380
background-color: #24292e;
381+
382+
&__banner {
383+
background-color: #191C20;
384+
display: flex;
385+
flex-direction: column;
386+
align-items: center;
387+
justify-content: center;
388+
border-radius: 4px;
389+
padding: 16px;
390+
margin-bottom: 30%;
391+
cursor: default;
392+
.text {
393+
font-size: 14px;
394+
color: #fff;
395+
}
396+
.button {
397+
width: 100%;
398+
margin-top: 12px;
399+
}
400+
}
381401
}
382402

383403
.cly-icon {

0 commit comments

Comments
 (0)