changeset 2647:73d7d95dd75e jobs

removal of internal job information
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 31 May 2018 17:45:09 +0200
parents 740983056f9e
children e1893d31652a
files Core/JobsEngine/JobInfo.cpp Core/JobsEngine/JobInfo.h Core/JobsEngine/JobStatus.cpp Core/JobsEngine/JobStatus.h OrthancExplorer/explorer.js OrthancServer/OrthancRestApi/OrthancRestSystem.cpp
diffstat 6 files changed, 12 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/Core/JobsEngine/JobInfo.cpp	Thu May 31 17:30:22 2018 +0200
+++ b/Core/JobsEngine/JobInfo.cpp	Thu May 31 17:45:09 2018 +0200
@@ -119,8 +119,7 @@
   }
 
 
-  void JobInfo::Serialize(Json::Value& target,
-                          bool includeInternalContent) const
+  void JobInfo::Format(Json::Value& target) const
   {
     target = Json::objectValue;
     target["ID"] = id_;
@@ -134,12 +133,7 @@
     target["Progress"] = boost::math::iround(status_.GetProgress() * 100.0f);
 
     target["Type"] = status_.GetJobType();
-    target["PublicContent"] = status_.GetPublicContent();
-
-    if (includeInternalContent)
-    {
-      target["InternalContent"] = status_.GetInternalContent();
-    }
+    target["Content"] = status_.GetPublicContent();
 
     if (HasEstimatedTimeOfArrival())
     {
--- a/Core/JobsEngine/JobInfo.h	Thu May 31 17:30:22 2018 +0200
+++ b/Core/JobsEngine/JobInfo.h	Thu May 31 17:45:09 2018 +0200
@@ -115,7 +115,6 @@
       return status_;
     }
 
-    void Serialize(Json::Value& target,
-                   bool includeInternalContent) const;
+    void Format(Json::Value& target) const;
   };
 }
--- a/Core/JobsEngine/JobStatus.cpp	Thu May 31 17:30:22 2018 +0200
+++ b/Core/JobsEngine/JobStatus.cpp	Thu May 31 17:45:09 2018 +0200
@@ -40,8 +40,7 @@
     errorCode_(ErrorCode_InternalError),
     progress_(0),
     jobType_("Invalid"),
-    publicContent_(Json::objectValue),
-    internalContent_(Json::objectValue)
+    publicContent_(Json::objectValue)
   {
   }
 
@@ -50,8 +49,7 @@
                        IJob& job) :
     errorCode_(code),
     progress_(job.GetProgress()),
-    publicContent_(Json::objectValue),
-    internalContent_(Json::objectValue)
+    publicContent_(Json::objectValue)
   {
     if (progress_ < 0)
     {
@@ -65,6 +63,5 @@
 
     job.GetJobType(jobType_);
     job.GetPublicContent(publicContent_);
-    job.GetInternalContent(internalContent_);
   }
 }
--- a/Core/JobsEngine/JobStatus.h	Thu May 31 17:30:22 2018 +0200
+++ b/Core/JobsEngine/JobStatus.h	Thu May 31 17:45:09 2018 +0200
@@ -44,7 +44,6 @@
     float          progress_;
     std::string    jobType_;
     Json::Value    publicContent_;
-    Json::Value    internalContent_;
 
   public:
     JobStatus();
@@ -76,10 +75,5 @@
     {
       return publicContent_;
     }
-
-    const Json::Value& GetInternalContent() const
-    {
-      return internalContent_;
-    }
   };
 }
--- a/OrthancExplorer/explorer.js	Thu May 31 17:30:22 2018 +0200
+++ b/OrthancExplorer/explorer.js	Thu May 31 17:45:09 2018 +0200
@@ -1227,8 +1227,8 @@
         item.append($('<h1>').text(job.Type));
         item.append($('<span>').addClass('ui-li-count').text(job.State));
         AddJobField(item, 'ID: ', job.ID);
-        AddJobField(item, 'Local AET: ', job.PublicContent.LocalAet);
-        AddJobField(item, 'Remote AET: ', job.PublicContent.RemoteAet);
+        AddJobField(item, 'Local AET: ', job.Content.LocalAet);
+        AddJobField(item, 'Remote AET: ', job.Content.RemoteAet);
         AddJobDateField(item, 'Creation time: ', job.CreationTime);
         AddJobDateField(item, 'Completion time: ', job.CompletionTime);
         AddJobDateField(item, 'ETA: ', job.EstimatedTimeOfArrival);
@@ -1280,7 +1280,7 @@
               i == 'EstimatedTimeOfArrival') {
             AddJobDateField(block, i + ': ', job[i]);
           } else if (i != 'InternalContent' &&
-                     i != 'PublicContent' &&
+                     i != 'Content' &&
                      i != 'Timestamp') {
             AddJobField(block, i + ': ', job[i]);
           }
@@ -1294,8 +1294,8 @@
 
         var block = $('<li>');
 
-        for (var item in job.PublicContent) {
-          var value = job.PublicContent[item];
+        for (var item in job.Content) {
+          var value = job.Content[item];
           if (typeof value !== 'string') {
             value = JSON.stringify(value);
           }
--- a/OrthancServer/OrthancRestApi/OrthancRestSystem.cpp	Thu May 31 17:30:22 2018 +0200
+++ b/OrthancServer/OrthancRestApi/OrthancRestSystem.cpp	Thu May 31 17:45:09 2018 +0200
@@ -276,7 +276,6 @@
   static void ListJobs(RestApiGetCall& call)
   {
     bool expand = call.HasArgument("expand");
-    bool internal = call.HasArgument("internal");
 
     Json::Value v = Json::arrayValue;
 
@@ -292,7 +291,7 @@
         if (OrthancRestApi::GetContext(call).GetJobsEngine().GetRegistry().GetJobInfo(info, *it))
         {
           Json::Value tmp;
-          info.Serialize(tmp, internal);
+          info.Format(tmp);
           v.append(tmp);
         }
       }
@@ -308,13 +307,12 @@
   static void GetJobInfo(RestApiGetCall& call)
   {
     std::string id = call.GetUriComponent("id", "");
-    bool internal = call.HasArgument("internal");
 
     JobInfo info;
     if (OrthancRestApi::GetContext(call).GetJobsEngine().GetRegistry().GetJobInfo(info, id))
     {
       Json::Value json;
-      info.Serialize(json, internal);
+      info.Format(json);
       call.GetOutput().AnswerJson(json);
     }
   }