File tree Expand file tree Collapse file tree 4 files changed +195
-141
lines changed
plugins/alerts/frontend/public Expand file tree Collapse file tree 4 files changed +195
-141
lines changed Original file line number Diff line number Diff line change 11## Version 24.05.46
2+ Fixes:
3+ - [ alerts] Add alert interval validation in the frontend
4+
25Enterprise Fixes:
36- [ concurrent_users] Fix email check for alert
47
Original file line number Diff line number Diff line change 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 : [
411427 return ;
412428 }
413429 } ,
430+ filteredEmailOptions : function ( ) {
431+ if ( ! countlyGlobal . plugins . includes ( "groups" ) ) {
432+ return this . emailOptions . filter (
433+ ( option ) => option . value !== "toGroup"
434+ ) ;
435+ }
436+ return this . emailOptions ;
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+ } ,
414451 } ,
415452 props : {
416453 placeholder : { type : String , default : "Select" } ,
Original file line number Diff line number Diff line change 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 {
335341 border-radius : 4px ;
336342 background-position : center ;
337343 display : inline-block ;
338- }
344+ }
You can’t perform that action at this time.
0 commit comments