@@ -1124,7 +1124,19 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
11241124 osparc . utils . Utils . setIdToWidget ( trashButton , "deleteStudiesBtn" ) ;
11251125 trashButton . addListener ( "execute" , ( ) => {
11261126 const selection = this . _resourcesContainer . getSelection ( ) ;
1127- this . __trashStudies ( selection . map ( button => this . __getStudyData ( button . getUuid ( ) , false ) ) , false ) ;
1127+ const preferencesSettings = osparc . Preferences . getInstance ( ) ;
1128+ if ( preferencesSettings . getConfirmDeleteStudy ( ) ) {
1129+ const win = this . __createConfirmTrashWindow ( selection . map ( button => button . getTitle ( ) ) ) ;
1130+ win . center ( ) ;
1131+ win . open ( ) ;
1132+ win . addListener ( "close" , ( ) => {
1133+ if ( win . getConfirmed ( ) ) {
1134+ this . __trashStudies ( selection . map ( button => this . __getStudyData ( button . getUuid ( ) , false ) ) , false ) ;
1135+ }
1136+ } , this ) ;
1137+ } else {
1138+ this . __trashStudies ( selection . map ( button => this . __getStudyData ( button . getUuid ( ) , false ) ) , false ) ;
1139+ }
11281140 } , this ) ;
11291141 return trashButton ;
11301142 } ,
@@ -1802,30 +1814,25 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
18021814 studiesData . forEach ( studyData => this . __doDeleteStudy ( studyData ) ) ;
18031815 } ,
18041816
1805- __deleteConfirmationWindow : function ( msg , studyNames ) {
1817+ __createConfirmTrashWindow : function ( studyNames ) {
1818+ let msg = this . tr ( "Are you sure you want to move to the trash" ) ;
18061819 const studiesText = osparc . product . Utils . getStudyAlias ( { plural : true } ) ;
1807- msg += ( studyNames . length > 1 ? ` ${ studyNames . length } ${ studiesText } ?` : ` <b>${ studyNames [ 0 ] } </b>?` ) ;
1820+ msg += ( studyNames . length > 1 ? ` ${ studyNames . length } ${ studiesText } ?` : ` <b>${ studyNames [ 0 ] } </b>?` ) ;
1821+ const trashDays = osparc . store . StaticInfo . getInstance ( ) . getTrashRetentionDays ( ) ;
1822+ msg += "<br><br>" + this . tr ( `They will be permanently deleted after ${ trashDays } days.` ) ;
18081823 const confirmationWin = new osparc . ui . window . Confirmation ( msg ) . set ( {
1809- confirmText : this . tr ( "Trash" ) ,
1810- confirmAction : "delete"
1811- } ) ;
1812- osparc . utils . Utils . setIdToWidget ( confirmationWin . getConfirmButton ( ) , "confirmDeleteStudyBtn" ) ;
1813- return confirmationWin ;
1814- } ,
1815-
1816- __createConfirmTrashWindow : function ( studyNames ) {
1817- const rUSure = this . tr ( "Are you sure you want to move to the trash" ) ;
1818- const confirmationWin = this . __deleteConfirmationWindow ( rUSure , studyNames ) . set ( {
1819- confirmText : this . tr ( "Trash" ) ,
1824+ confirmText : this . tr ( "Move to Trash" ) ,
18201825 confirmAction : "delete"
18211826 } ) ;
18221827 osparc . utils . Utils . setIdToWidget ( confirmationWin . getConfirmButton ( ) , "confirmDeleteStudyBtn" ) ;
18231828 return confirmationWin ;
18241829 } ,
18251830
18261831 __createConfirmDeleteWindow : function ( studyNames ) {
1827- const rUSure = this . tr ( "Are you sure you want to delete" ) ;
1828- const confirmationWin = this . __deleteConfirmationWindow ( rUSure , studyNames ) . set ( {
1832+ let msg = this . tr ( "Are you sure you want to delete" ) ;
1833+ const studiesText = osparc . product . Utils . getStudyAlias ( { plural : true } ) ;
1834+ msg += ( studyNames . length > 1 ? ` ${ studyNames . length } ${ studiesText } ?` : ` <b>${ studyNames [ 0 ] } </b>?` ) ;
1835+ const confirmationWin = new osparc . ui . window . Confirmation ( msg ) . set ( {
18291836 confirmText : this . tr ( "Delete" ) ,
18301837 confirmAction : "delete"
18311838 } ) ;
0 commit comments