@@ -1917,32 +1917,30 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
19171917 } ,
19181918
19191919 __exportStudy : function ( studyData ) {
1920- const exportTask = new osparc . task . Export ( studyData ) ;
1921- exportTask . start ( ) ;
1922- exportTask . setSubtitle ( this . tr ( "Preparing files" ) ) ;
1920+ const exportTaskUI = new osparc . task . Export ( studyData ) ;
1921+ osparc . task . TasksContainer . getInstance ( ) . addTaskUI ( exportTaskUI ) ;
1922+ exportTaskUI . setSubtitle ( this . tr ( "Preparing files" ) ) ;
19231923 const text = this . tr ( "Exporting process started and added to the background tasks" ) ;
19241924 osparc . FlashMessenger . logAs ( text , "INFO" ) ;
19251925
19261926 const url = window . location . href + "v0/projects/" + studyData [ "uuid" ] + ":xport" ;
19271927 const progressCB = ( ) => {
19281928 const textSuccess = this . tr ( "Download started" ) ;
1929- exportTask . setSubtitle ( textSuccess ) ;
1929+ exportTaskUI . setSubtitle ( textSuccess ) ;
19301930 } ;
19311931 osparc . utils . Utils . downloadLink ( url , "POST" , null , progressCB )
19321932 . catch ( err => {
19331933 const msg = osparc . data . Resources . getErrorMsg ( JSON . parse ( err . response ) ) || this . tr ( "Something went wrong while exporting the study" ) ;
19341934 osparc . FlashMessenger . logError ( err , msg ) ;
19351935 } )
1936- . finally ( ( ) => {
1937- exportTask . stop ( ) ;
1938- } ) ;
1936+ . finally ( ( ) => osparc . task . TasksContainer . getInstance ( ) . removeTaskUI ( exportTaskUI ) ) ;
19391937 } ,
19401938
19411939 __importStudy : function ( file ) {
19421940 const uploadingLabel = this . tr ( "Uploading file" ) ;
1943- const importTask = new osparc . task . Import ( ) ;
1944- importTask . start ( ) ;
1945- importTask . setSubtitle ( uploadingLabel ) ;
1941+ const importTaskUI = new osparc . task . Import ( ) ;
1942+ osparc . task . TasksContainer . getInstance ( ) . addTaskUI ( importTaskUI ) ;
1943+ importTaskUI . setSubtitle ( uploadingLabel ) ;
19461944
19471945 const text = this . tr ( "Importing process started and added to the background tasks" ) ;
19481946 osparc . FlashMessenger . logAs ( text , "INFO" ) ;
@@ -1970,7 +1968,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
19701968 if ( percentComplete === 100 ) {
19711969 const processingLabel = this . tr ( "Processing study" ) ;
19721970 importingStudyCard . getChildControl ( "state-label" ) . setValue ( processingLabel ) ;
1973- importTask . setSubtitle ( processingLabel ) ;
1971+ importTaskUI . setSubtitle ( processingLabel ) ;
19741972 importingStudyCard . getChildControl ( "progress-bar" ) . exclude ( ) ;
19751973 }
19761974 } else {
@@ -1982,7 +1980,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
19821980 if ( req . status == 200 ) {
19831981 const processingLabel = this . tr ( "Processing study" ) ;
19841982 importingStudyCard . getChildControl ( "state-label" ) . setValue ( processingLabel ) ;
1985- importTask . setSubtitle ( processingLabel ) ;
1983+ importTaskUI . setSubtitle ( processingLabel ) ;
19861984 importingStudyCard . getChildControl ( "progress-bar" ) . exclude ( ) ;
19871985 const data = JSON . parse ( req . responseText ) ;
19881986 const params = {
@@ -1994,26 +1992,26 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
19941992 . then ( studyData => this . _updateStudyData ( studyData ) )
19951993 . catch ( err => osparc . FlashMessenger . logError ( err , this . tr ( "Something went wrong while fetching the study" ) ) )
19961994 . finally ( ( ) => {
1997- importTask . stop ( ) ;
1995+ osparc . task . TasksContainer . getInstance ( ) . removeTaskUI ( importTaskUI ) ;
19981996 this . _resourcesContainer . removeNonResourceCard ( importingStudyCard ) ;
19991997 } ) ;
20001998 } else if ( req . status == 400 ) {
2001- importTask . stop ( ) ;
1999+ osparc . task . TasksContainer . getInstance ( ) . removeTaskUI ( importTaskUI ) ;
20022000 this . _resourcesContainer . removeNonResourceCard ( importingStudyCard ) ;
20032001 const msg = osparc . data . Resources . getErrorMsg ( JSON . parse ( req . response ) ) || this . tr ( "Something went wrong while importing the study" ) ;
20042002 osparc . FlashMessenger . logError ( msg ) ;
20052003 }
20062004 } ) ;
20072005 req . addEventListener ( "error" , e => {
20082006 // transferFailed
2009- importTask . stop ( ) ;
2007+ osparc . task . TasksContainer . getInstance ( ) . removeTaskUI ( importTaskUI ) ;
20102008 this . _resourcesContainer . removeNonResourceCard ( importingStudyCard ) ;
20112009 const msg = osparc . data . Resources . getErrorMsg ( e ) || this . tr ( "Something went wrong while importing the study" ) ;
20122010 osparc . FlashMessenger . logError ( msg ) ;
20132011 } ) ;
20142012 req . addEventListener ( "abort" , e => {
20152013 // transferAborted
2016- importTask . stop ( ) ;
2014+ osparc . task . TasksContainer . getInstance ( ) . removeTaskUI ( importTaskUI ) ;
20172015 this . _resourcesContainer . removeNonResourceCard ( importingStudyCard ) ;
20182016 const msg = osparc . data . Resources . getErrorMsg ( e ) || this . tr ( "Something went wrong while importing the study" ) ;
20192017 osparc . FlashMessenger . logError ( msg ) ;
@@ -2139,7 +2137,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
21392137 __taskDuplicateReceived : function ( task , studyName ) {
21402138 const duplicateTaskUI = new osparc . task . Duplicate ( studyName ) ;
21412139 duplicateTaskUI . setTask ( task ) ;
2142- duplicateTaskUI . start ( ) ;
2140+ osparc . task . TasksContainer . getInstance ( ) . addTaskUI ( duplicateTaskUI ) ;
21432141 const duplicatingStudyCard = this . __createDuplicateCard ( studyName ) ;
21442142 duplicatingStudyCard . setTask ( task ) ;
21452143 duplicatingStudyCard . subscribeToFilterGroup ( "searchBarFilter" ) ;
@@ -2152,7 +2150,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
21522150 if ( msg ) {
21532151 osparc . FlashMessenger . logAs ( msg , msgLevel ) ;
21542152 }
2155- taskUI . stop ( ) ;
2153+ osparc . task . TasksContainer . getInstance ( ) . removeTaskUI ( taskUI ) ;
21562154 this . _resourcesContainer . removeNonResourceCard ( duplicatingStudyCard ) ;
21572155 } ;
21582156
0 commit comments