airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [airavata-django-portal] branch master updated: Bug fix: most recent job status is last one
Date Wed, 19 Sep 2018 18:01:32 GMT
This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git


The following commit(s) were added to refs/heads/master by this push:
     new d6daad6  Bug fix: most recent job status is last one
d6daad6 is described below

commit d6daad60bfd85e0b3007a1d338a4c064915f437f
Author: Marcus Christie <machrist@iu.edu>
AuthorDate: Wed Sep 19 14:01:21 2018 -0400

    Bug fix: most recent job status is last one
---
 .../static/django_airavata_api/js/models/Job.js    | 76 ++++++++++++----------
 1 file changed, 40 insertions(+), 36 deletions(-)

diff --git a/django_airavata/apps/api/static/django_airavata_api/js/models/Job.js b/django_airavata/apps/api/static/django_airavata_api/js/models/Job.js
index 3359d7d..707c98b 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/models/Job.js
+++ b/django_airavata/apps/api/static/django_airavata_api/js/models/Job.js
@@ -1,47 +1,51 @@
-import BaseModel from './BaseModel';
-import JobStatus from './JobStatus';
+import BaseModel from "./BaseModel";
+import JobStatus from "./JobStatus";
 
 const FIELDS = [
-     'jobId',
-     'taskId',
-     'processId',
-     'jobDescription',
-     {
-         name: 'creationTime',
-         type: 'date',
-     },
-     {
-         name: 'jobStatuses',
-         type: JobStatus,
-         list: true,
-     },
-     'computeResourceConsumed',
-     'jobName',
-     'workingDir',
-     'stdOut',
-     'stdErr',
-     'exitCode',
+  "jobId",
+  "taskId",
+  "processId",
+  "jobDescription",
+  {
+    name: "creationTime",
+    type: "date"
+  },
+  {
+    name: "jobStatuses",
+    type: JobStatus,
+    list: true
+  },
+  "computeResourceConsumed",
+  "jobName",
+  "workingDir",
+  "stdOut",
+  "stdErr",
+  "exitCode"
 ];
 
 export default class Job extends BaseModel {
-    constructor(data = {}) {
-        super(FIELDS, data);
-    }
+  constructor(data = {}) {
+    super(FIELDS, data);
+  }
 
-    // get the first job status
-    get jobStatus() {
-        return (this.jobStatuses && this.jobStatuses.length > 0) ? this.jobStatuses[0]
: null;
+  // get the first job status
+  get latestJobStatus() {
+    if (this.jobStatuses && this.jobStatuses.length > 0) {
+      return this.jobStatuses[this.jobStatuses.length - 1];
+    } else {
+      return null;
     }
+  }
 
-    get jobStatusStateName() {
-        return this.jobStatus ? this.jobStatus.jobState.name : null;
-    }
+  get jobStatusStateName() {
+    return this.latestJobStatus ? this.latestJobStatus.jobState.name : null;
+  }
 
-    get jobStatusTimeOfStateChange() {
-        return this.jobStatus ? this.jobStatus.timeOfStateChange : null;
-    }
+  get jobStatusTimeOfStateChange() {
+    return this.latestJobStatus ? this.latestJobStatus.timeOfStateChange : null;
+  }
 
-    get jobStatusReason() {
-        return this.jobStatus ? this.jobStatus.reason : null;
-    }
+  get jobStatusReason() {
+    return this.latestJobStatus ? this.latestJobStatus.reason : null;
+  }
 }


Mime
View raw message