Skip to content

Commit 2920a8a

Browse files
authored
Merge branch 'master' into anna/master
2 parents bcba2a3 + 8ad9940 commit 2920a8a

File tree

6 files changed

+269
-154
lines changed

6 files changed

+269
-154
lines changed

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
## Version 25.03.X
1+
## Version 25.03.28
2+
Fixes:
3+
- [alerts] Add alert interval validation in the frontend
4+
- [events] Correctly navigate to event groupmin events menu
5+
26
Enterprise Fixes:
7+
- [applications] Ensure application management list reorders after create/update
38
- [concurrent_users] Fix email check for alert
4-
9+
- [dashboards] Keep dashboard sidebar sorted alphabetically after additions
10+
- [data-manager] Correctly show last triggered for events if data masking is enabled
511

612
## Version 25.03.27
713
Fixes:

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

Lines changed: 60 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,12 @@
5959
value: id
6060
};
6161
});
62-
if (countlyGlobal.member.appSortList) {
63-
appList = this.sortBy(appList, countlyGlobal.member.appSortList);
62+
var sortList = (countlyGlobal.member && countlyGlobal.member.appSortList) || [];
63+
if (sortList.length) {
64+
appList = this.sortBy(appList, sortList);
6465
}
6566
else {
66-
appList.sort(function(a, b) {
67-
return a.label > b.label && 1 || -1;
68-
});
67+
appList.sort(this.sortAppOptionsAlphabetically);
6968
}
7069
var app_id = this.$route.params.app_id || countlyCommon.ACTIVE_APP_ID;
7170
return {
@@ -340,6 +339,56 @@
340339
}
341340
}
342341
},
342+
getAppListItemId: function(option) {
343+
if (!option) {
344+
return "";
345+
}
346+
347+
return (option._id || option.value || option.id || option.app_id || "") + "";
348+
},
349+
sortAppOptionsAlphabetically: function(optionA, optionB) {
350+
var labelA = (optionA.label || "").toLowerCase();
351+
var labelB = (optionB.label || "").toLowerCase();
352+
353+
if (labelA < labelB) {
354+
return -1;
355+
}
356+
357+
if (labelA > labelB) {
358+
return 1;
359+
}
360+
361+
var valueA = (optionA.value || "").toLowerCase();
362+
var valueB = (optionB.value || "").toLowerCase();
363+
364+
if (valueA < valueB) {
365+
return -1;
366+
}
367+
368+
if (valueA > valueB) {
369+
return 1;
370+
}
371+
372+
return 0;
373+
},
374+
applyAppListOrdering: function() {
375+
if (!Array.isArray(this.appList)) {
376+
return;
377+
}
378+
379+
var sortList = (countlyGlobal.member && countlyGlobal.member.appSortList) || [];
380+
var currentList = this.appList.slice();
381+
var orderedList;
382+
383+
if (sortList.length) {
384+
orderedList = this.sortBy(currentList, sortList);
385+
}
386+
else {
387+
orderedList = currentList.sort(this.sortAppOptionsAlphabetically);
388+
}
389+
390+
this.appList = orderedList;
391+
},
343392
sortBy: function(arrayToSort, sortList) {
344393
if (!sortList.length) {
345394
return arrayToSort;
@@ -349,9 +398,10 @@
349398
retArr = [];
350399
var i;
351400
for (i = 0; i < arrayToSort.length; i++) {
352-
var objId = arrayToSort[i]._id + "";
353-
if (sortList.indexOf(objId) !== -1) {
354-
tmpArr[sortList.indexOf(objId)] = arrayToSort[i];
401+
var objId = this.getAppListItemId(arrayToSort[i]);
402+
var desiredIndex = sortList.indexOf(objId);
403+
if (desiredIndex !== -1) {
404+
tmpArr[desiredIndex] = arrayToSort[i];
355405
}
356406
}
357407

@@ -392,6 +442,7 @@
392442
value: data._id + "",
393443
label: data.name
394444
});
445+
self.applyAppListOrdering();
395446
self.$store.dispatch("countlyCommon/addToAllApps", data);
396447
self.$store.dispatch("countlyCommon/updateActiveApp", data._id + "");
397448
countlyCommon.setActiveApp(data._id);
@@ -459,6 +510,7 @@
459510
break;
460511
}
461512
}
513+
self.applyAppListOrdering();
462514
self.discardForm();
463515
CountlyHelpers.notify({
464516
title: jQuery.i18n.map["configs.changed"],

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

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,29 @@
77
countlyCommon,
88
app,
99
countlyAuth,
10+
countlyPlugins,
1011
CV,
1112
groupsModel,
1213
_,
14+
VeeValidate,
1315
*/
1416
(function() {
1517
var ALERTS_FEATURE_NAME = "alerts";
1618

19+
VeeValidate.extend('alert_interval', function(inpValue, args) {
20+
var min = parseInt(args[0] || 0, 10);
21+
var max = parseInt(args[1] || 60, 10);
22+
var valid = parseInt(inpValue, 10) >= min && inpValue <= max;
23+
24+
if (valid) {
25+
return {
26+
valid: valid,
27+
};
28+
}
29+
30+
return 'Alert interval has to be between ' + min + ' and ' + max;
31+
});
32+
1733
var AlertDrawer = countlyVue.views.BaseView.extend({
1834
template: "#alert-drawer",
1935
mixins: [
@@ -418,7 +434,20 @@
418434
);
419435
}
420436
return this.emailOptions;
421-
}
437+
},
438+
alertIntervalValidationRules: function() {
439+
var rule = 'required';
440+
441+
if (this.$refs.drawerData.editedObject.alertDataType === 'onlineUsers') {
442+
var concurrentUserConfig = countlyPlugins.getConfigsData().concurrent_users || {};
443+
var concurrentAlertIntervalMin = concurrentUserConfig.alert_interval || 3;
444+
var concurrentAlertIntervalMax = Math.min(concurrentAlertIntervalMin + 60, 90);
445+
446+
rule += '|alert_interval:' + concurrentAlertIntervalMin + ',' + concurrentAlertIntervalMax;
447+
}
448+
449+
return rule;
450+
},
422451
},
423452
props: {
424453
placeholder: { type: String, default: "Select" },

plugins/alerts/frontend/public/stylesheets/vue-main.scss

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@
143143
.alert-drawer-trigger-input {
144144
width: 48px;
145145
}
146+
147+
.is-error {
148+
.alert-drawer-trigger-input {
149+
background-color: #FBECE5 !important;
150+
}
151+
}
146152

147153
.no-spinner::-webkit-inner-spin-button,
148154
.no-spinner::-webkit-outer-spin-button {
@@ -335,4 +341,4 @@
335341
border-radius: 4px;
336342
background-position: center;
337343
display: inline-block;
338-
}
344+
}

0 commit comments

Comments
 (0)