File tree Expand file tree Collapse file tree 5 files changed +36
-1
lines changed Expand file tree Collapse file tree 5 files changed +36
-1
lines changed Original file line number Diff line number Diff line change 1+ ## Version 25.x.x
2+ Features:
3+ - [ alerts] alerts table default order should be by creation time newest at the top
4+
15## Version 24.12.x
26
37Fixes:
Original file line number Diff line number Diff line change 1+ // Script that adds creation date for existing alerts.
2+
3+ const pluginManager = require ( '../../../plugins/pluginManager.js' ) ;
4+
5+ pluginManager . dbConnection ( ) . then ( async ( countlyDb ) => {
6+ try {
7+ await countlyDb . collection ( 'alerts' ) . updateMany (
8+ { createdAt : { $exists : false } } ,
9+ [
10+ {
11+ $set : {
12+ createdAt : { $toDouble : { $toDate : "$_id" } }
13+ }
14+ }
15+ ]
16+ ) ;
17+ console . log ( "Finished adding creation date for existing alerts." ) ;
18+ }
19+ catch ( error ) {
20+ console . log ( `Error adding creation date for existing alerts: ${ error } ` ) ;
21+ }
22+ finally {
23+ countlyDb . close ( ) ;
24+ }
25+ } ) ;
Original file line number Diff line number Diff line change @@ -229,6 +229,9 @@ const PERIOD_TO_TEXT_EXPRESSION_MAPPER = {
229229 }
230230 } ) ;
231231 }
232+ if ( ! alertConfig . _id ) {
233+ alertConfig . createdAt = new Date ( ) . getTime ( ) ;
234+ }
232235 alertConfig . createdBy = params . member . _id ;
233236 return common . db . collection ( "alerts" ) . insert (
234237 alertConfig ,
Original file line number Diff line number Diff line change 503503 enabled : alertsList [ i ] . enabled || false ,
504504 createdByUser :
505505 alertsList [ i ] . createdByUser || "" ,
506+ createdAt : alertsList [ i ] . createdAt || "" ,
506507 _canUpdate : countlyAuth . validateUpdate (
507508 FEATURE_NAME ,
508509 countlyGlobal . member ,
Original file line number Diff line number Diff line change 4444 class = "cly-vue-alerts-table"
4545 :tracked-fields = "localTableTrackedFields"
4646 :rows = "tableRows"
47- :resizable = "false" >
47+ :resizable = "false"
48+ :default - sort = "{prop: 'createdAt', order: 'descending'}"
49+ >
4850 < template v-slot :header-left = "scope" >
4951 < div class = "alerts-table-app-selector" >
5052 < cly-select-x
You can’t perform that action at this time.
0 commit comments