Skip to content

Commit 405ee2d

Browse files
committed
renaming
1 parent 7def8e5 commit 405ee2d

File tree

4 files changed

+20
-32
lines changed

4 files changed

+20
-32
lines changed

services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -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

services/static-webserver/client/source/class/osparc/dashboard/TemplateBrowser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ qx.Class.define("osparc.dashboard.TemplateBrowser", {
351351
if (msg) {
352352
osparc.FlashMessenger.logAs(msg, msgLevel);
353353
}
354-
taskUI.stop();
354+
osparc.task.TasksContainer.getInstance().removeTaskUI(taskUI);
355355
this._resourcesContainer.removeNonResourceCard(toTemplateCard);
356356
};
357357

@@ -393,7 +393,7 @@ qx.Class.define("osparc.dashboard.TemplateBrowser", {
393393
taskToTemplateReceived: function(task, studyName) {
394394
const toTemplateTaskUI = new osparc.task.ToTemplate(studyName);
395395
toTemplateTaskUI.setTask(task);
396-
toTemplateTaskUI.start();
396+
osparc.task.TasksContainer.getInstance().addTaskUI(toTemplateTaskUI);
397397
const toTemplateCard = this.__createToTemplateCard(studyName);
398398
toTemplateCard.setTask(task);
399399
this.__attachToTemplateEventHandler(task, toTemplateTaskUI, toTemplateCard);

services/static-webserver/client/source/class/osparc/task/TaskUI.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -133,16 +133,6 @@ qx.Class.define("osparc.task.TaskUI", {
133133
}, this);
134134
},
135135

136-
start: function() {
137-
const tasks = osparc.task.TasksContainer.getInstance();
138-
tasks.addTask(this);
139-
},
140-
141-
stop: function() {
142-
const tasks = osparc.task.TasksContainer.getInstance();
143-
tasks.removeTask(this);
144-
},
145-
146136
setIcon: function(source) {
147137
this.getChildControl("icon").getContentElement().removeClass("rotate");
148138
this.getChildControl("icon").setSource(source);

services/static-webserver/client/source/class/osparc/task/TasksContainer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ qx.Class.define("osparc.task.TasksContainer", {
3939
__tasks: null,
4040
__tasksContainer: null,
4141

42-
addTask: function(task) {
42+
addTaskUI: function(task) {
4343
this.__tasks.push(task);
4444
this.__tasksContainer.addAt(task, 0);
4545
},
4646

47-
removeTask: function(task) {
47+
removeTaskUI: function(task) {
4848
if (this.__tasks.indexOf(task) > -1) {
4949
this.__tasks.remove(task);
5050
}

0 commit comments

Comments
 (0)