Skip to content

Commit 03feac0

Browse files
committed
addSubJob
1 parent 28e8a63 commit 03feac0

File tree

2 files changed

+12
-8
lines changed
  • services/static-webserver/client/source/class/osparc

2 files changed

+12
-8
lines changed

services/static-webserver/client/source/class/osparc/data/Job.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ qx.Class.define("osparc.data.Job", {
2323

2424
this.set({
2525
projectUuid: jobData["projectUuid"],
26-
state: jobData["state"],
26+
state: jobData["state"] || "UNKNOWN",
2727
submittedAt: jobData["submittedAt"] ? new Date(jobData["submittedAt"]) : null,
2828
startedAt: jobData["startedAt"] ? new Date(jobData["startedAt"]) : null,
2929
endedAt: jobData["endedAt"] ? new Date(jobData["endedAt"]) : null,
@@ -76,13 +76,14 @@ qx.Class.define("osparc.data.Job", {
7676

7777
info: {
7878
check: "Object",
79-
nullable: false,
79+
nullable: true,
8080
init: null,
8181
},
8282
},
8383

8484
statics: {
8585
STATUS_LABELS: {
86+
"UNKNOWN": "Unknown",
8687
"NOT_STARTED": "Not Started",
8788
"PUBLISHED": "Published",
8889
"PENDING": "Pending",

services/static-webserver/client/source/class/osparc/store/Jobs.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,16 @@ qx.Class.define("osparc.store.Jobs", {
103103
},
104104

105105
addSubJob: function(subJobData) {
106-
const jobs = this.getJobs();
107-
const jobFound = jobs.find(job => job.getProjectUuid() === subJobData["projectUuid"]);
108-
if (jobFound) {
109-
const subJob = jobFound.addSubJob(subJobData);
110-
return subJob;
106+
let job = this.getJob(subJobData["projectUuid"]);
107+
if (!job) {
108+
const jobs = this.getJobs();
109+
const unknownJob = new osparc.data.Job({
110+
"projectUuid": subJobData["projectUuid"],
111+
});
112+
jobs.push(unknownJob);
111113
}
112-
return null;
114+
const subJob = job.addSubJob(subJobData);
115+
return subJob;
113116
},
114117

115118
getJob: function(projectUuid) {

0 commit comments

Comments
 (0)