+ @proxied.priority
+ end
+
+ # For the following properties, use value from the @container if exists
+ # This applies to a ContainerRequest with container_uuid
+
+ def started_at
+ t = get_combined(:started_at)
+ t = Time.parse(t) if (t.is_a? String)
+ t
+ end
+
+ def modified_at
+ t = get_combined(:modified_at)
+ t = Time.parse(t) if (t.is_a? String)
+ t
+ end
+
+ def finished_at
+ t = get_combined(:finished_at)
+ t = Time.parse(t) if (t.is_a? String)
+ t
+ end
+
+ def state_label
+ if get(:state) == 'Final' && get(:state, @container) != 'Complete'
+ # Request was finalized before its container started (or the
+ # container was cancelled)
+ return 'Cancelled'
+ end
+ state = get(:state, @container) || get(:state, @proxied)
+ case state
+ when 'Locked', 'Queued'
+ if priority == 0
+ 'On hold'
+ else
+ 'Queued'
+ end
+ when 'Complete'
+ if exit_code == 0
+ state
+ else
+ 'Failed'
+ end
+ when 'Running'
+ if runtime_status[:error]
+ 'Failing'
+ elsif runtime_status[:warning]
+ 'Warning'
+ else
+ state
+ end
+ else
+ # Cancelled, or Uncommitted (no container assigned)
+ state
+ end
+ end
+
+ def runtime_status
+ return get(:runtime_status, @container) || get(:runtime_status, @proxied)
+ end
+
+ def state_bootstrap_class
+ case state_label
+ when 'Failing'
+ 'danger'
+ when 'Warning'
+ 'warning'
+ else
+ super
+ end
+ end
+
+ def exit_code
+ get_combined(:exit_code)
+ end
+
+ def docker_image
+ get_combined(:container_image)
+ end
+
+ def runtime_constraints
+ get_combined(:runtime_constraints)