[rhmessaging-commits] rhmessaging commits: r4276 - mgmt/newdata/cumin/python/cumin/grid.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Sat Sep 11 17:02:19 EDT 2010


Author: eallen
Date: 2010-09-11 17:02:19 -0400 (Sat, 11 Sep 2010)
New Revision: 4276

Modified:
   mgmt/newdata/cumin/python/cumin/grid/job.py
   mgmt/newdata/cumin/python/cumin/grid/job.strings
Log:
Fix for BZ 632614. Now displaying an error message if the GetJobSummaries qmf call returns with an exception.

Modified: mgmt/newdata/cumin/python/cumin/grid/job.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/job.py	2010-09-10 18:59:26 UTC (rev 4275)
+++ mgmt/newdata/cumin/python/cumin/grid/job.py	2010-09-11 21:02:19 UTC (rev 4276)
@@ -107,18 +107,18 @@
 
         submission = values["obj"]
         results = self.app.model.get_submission_job_summaries(submission)
-        #TODO: handle error status and create an invok message
 
         if isinstance(results.data, dict):
-            rows = super(JobSummariesAdapter, self).process_results(results.data)
+            rows = self.process_results(results.data)
         elif isinstance(results.data, list):
-            rows = self.process_results(results.data)
+            rows = self.process_list_results(results.data)
         else:
             rows = []
         page = rows[first_index:last_index]
-        return page
 
-    def process_results(self, results):
+        return page, results
+
+    def process_list_results(self, results):
         # the results for this call is a list
         records = list()
 
@@ -182,6 +182,10 @@
         self.job_id_column.visible = False
         self.add_column(self.job_id_column)
 
+        self.error_tmpl = WidgetTemplate(self, "error_html")
+        self.qmf_response = Attribute(app, "qmf_response")
+        self.add_attribute(self.qmf_response)
+
         JobSelectionHold(app, self, "held")
         JobSelectionRelease(app, self, "released")
         JobSelectionRemove(app, self, "removed")
@@ -199,6 +203,30 @@
     def render_title(self, session):
         return "Jobs"
 
+    def do_render(self, session):
+        # determine if there is an error getting the data
+        # and show an error message
+        self.get_data(session)
+        qmf_response = self.qmf_response.get(session)
+        if qmf_response.exception:
+            writer = Writer()
+            msg = "The data is not available at this time. <br/>%s" % str(qmf_response.exception.message)
+            self.error_tmpl.render(writer, session, msg)
+            return writer.to_string()
+
+        return super(JobSelector, self).do_render(session)
+
+    def get_data(self, session):
+        values = self.get_data_values(session)
+        options = self.get_data_options(session)
+
+        results, qmf_response = self.adapter.get_data(values, options)
+        self.qmf_response.set(session, qmf_response)
+        return results
+
+    def render_error_msg(self, session, msg):
+        return msg
+
     def get_data_values(self, session):
         values = super(JobSelector, self).get_data_values(session)
 

Modified: mgmt/newdata/cumin/python/cumin/grid/job.strings
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/job.strings	2010-09-10 18:59:26 UTC (rev 4275)
+++ mgmt/newdata/cumin/python/cumin/grid/job.strings	2010-09-11 21:02:19 UTC (rev 4276)
@@ -172,3 +172,12 @@
 <textarea id="{id}" name="job_output" class="job_output" rows="20" cols="80">
  {loading}
 </textarea>
+
+[JobSelector.error_html]
+<div id="{id}">
+    <div class="TaskInvocationSet">
+        <ul>
+            <li>{error_msg}</li>
+        </ul>
+    </div>
+</div>



More information about the rhmessaging-commits mailing list