@@ -44,6 +44,20 @@ $(document).ready(function(){
4444 time_24hr :true ,
4545 allowInput :false
4646 } ) ;
47+ $ ( "#clean_up_age" ) . flatpickr ( {
48+ dateFormat :"Y-m-d H:i:S" ,
49+ enableTime :true ,
50+ enableSeconds :true ,
51+ time_24hr :true ,
52+ allowInput :false
53+ } ) ;
54+ $ ( "#transmission_age" ) . flatpickr ( {
55+ dateFormat :"Y-m-d H:i:S" ,
56+ enableTime :true ,
57+ enableSeconds :true ,
58+ time_24hr :true ,
59+ allowInput :false
60+ } ) ;
4761 orgEdgexFoundry . supportNotification . loadNotificationList ( ) ;
4862 orgEdgexFoundry . supportNotification . loadSubscriptionList ( ) ;
4963 orgEdgexFoundry . supportNotification . loadTransmissionList ( ) ;
@@ -90,6 +104,7 @@ orgEdgexFoundry.supportNotification = (function(){
90104 commitSubscriptionChannelBtn : null ,
91105 cancelAddOrUpdateSubscriptionChannelBtn :null ,
92106
107+ toCleanUp : null ,
93108 cleanUp : null ,
94109 deleteNotificationBySlug : null ,
95110 toDeleteTransmission : null ,
@@ -218,6 +233,12 @@ orgEdgexFoundry.supportNotification = (function(){
218233 $ ( "#edgex-support-notification-list table tfoot" ) . show ( ) ;
219234 }
220235
236+ SupportNotification . prototype . toCleanUp = function ( ) {
237+ $ ( '#clean_up_model' ) . modal ( {
238+ backdrop : "static"
239+ } ) ;
240+ }
241+
221242 SupportNotification . prototype . cleanUp = function ( ) {
222243 bootbox . confirm ( {
223244 buttons : {
@@ -234,8 +255,17 @@ orgEdgexFoundry.supportNotification = (function(){
234255 message : 'This operation will delete all the notifications if the current timestamp minus their last modification timestamp is less than a default age setting, and the corresponding transmissions will also be deleted. Are you sure to delete this data? The operation is not recoverable!' ,
235256 callback : function ( result ) {
236257 if ( result ) {
258+ var clean_up_age = $ ( "#clean_up_age" ) . val ( ) ;
259+ if ( ! clean_up_age ) {
260+ clean_up_age = new Date ( ) . valueOf ( )
261+ } else {
262+ clean_up_age = new Date ( clean_up_age ) . valueOf ( ) ;
263+ }
264+ console . log ( new Date ( ) . valueOf ( ) )
265+ console . log ( clean_up_age )
266+ console . log ( new Date ( ) . valueOf ( ) - 1600134667000 < clean_up_age )
237267 $ . ajax ( {
238- url :'/support-notification/api/v1/cleanup' ,
268+ url :'/support-notification/api/v1/cleanup/age/' + clean_up_age ,
239269 type :'DELETE' ,
240270 success : function ( ) {
241271 bootbox . alert ( {
@@ -848,6 +878,13 @@ orgEdgexFoundry.supportNotification = (function(){
848878 message : 'Delete all the transmissions by Status. Are you sure to delete this data? The operation is not recoverable!' ,
849879 callback : function ( result ) {
850880 if ( result ) {
881+ var transmission_age = $ ( "#transmission_age" ) . val ( ) ;
882+ if ( ! transmission_age ) {
883+ transmission_age = new Date ( ) . valueOf ( )
884+ } else {
885+ transmission_age = new Date ( transmission_age ) . valueOf ( ) ;
886+ }
887+
851888 var statusArr = $ ( '#transstatus' ) . val ( ) ;
852889 if ( statusArr == null || statusArr == '' || statusArr . length == 0 ) {
853890 bootbox . alert ( {
@@ -859,7 +896,7 @@ orgEdgexFoundry.supportNotification = (function(){
859896 }
860897 for ( var i = 0 ; i < statusArr . length ; i ++ ) {
861898 $ . ajax ( {
862- url :'/support-notification/api/v1/transmission/' + statusArr [ i ] + '/age/10000' ,
899+ url :'/support-notification/api/v1/transmission/' + statusArr [ i ] + '/age/' + transmission_age ,
863900 type :'DELETE' ,
864901 error : function ( ) {
865902 bootbox . alert ( {
0 commit comments