@@ -13,8 +13,11 @@ class RuntimeType < Types::BaseObject
1313 field :namespace , Types ::NamespaceType , null : true , description : 'The parent namespace for the runtime'
1414 field :projects , Types ::NamespaceProjectType . connection_type , null : false ,
1515 description : 'Projects associated with the runtime'
16- field :status , Types ::RuntimeStatusType , null : false , description : 'The status of the runtime' ,
17- method : :ensure_runtime_status!
16+ field :status , Types ::RuntimeConnectionStatusEnum , null : false , description : 'The status of the runtime'
17+
18+ field :statuses , Types ::RuntimeStatusType . connection_type , null : false ,
19+ description : 'Statuses of the runtime' ,
20+ method : :runtime_statuses
1821 field :token , String , null : true , description : 'Token belonging to the runtime, only present on creation'
1922
2023 expose_abilities %i[
@@ -26,6 +29,17 @@ class RuntimeType < Types::BaseObject
2629 id_field Runtime
2730 timestamps
2831
32+ # If the last heartbeat was within the last 10 minutes, consider the runtime as 'running'
33+ def status
34+ last_heartbeat = object . last_heartbeat
35+
36+ if last_heartbeat && last_heartbeat >= 10 . minutes . ago
37+ :connected
38+ else
39+ :disconnected
40+ end
41+ end
42+
2943 def token
3044 object . token if object . token_previously_changed?
3145 end
0 commit comments