Add last_used_at field to cluster Agent token

Scope

Provide the information on GraphQL for

  • the token last_used_at as part of the token list
  • an agent level max(last_used_at) computed in the backend

We can make the translation from last_used_at to status in JS-land.

Definition of Done

See discussion from issue: #321885 (closed)

  • Add last_used_at field the to the rails database and Clusters::AgentToken model
  • Build a process (similar to the Ci::Runner#heartbeat process) where last_used_at is updated during each kas interaction
  • Update GraphQL: add field last_used_at
  • Add index for last_used_at since GraphQl should sort tokens by last_used_at instead of created_at
  • Update GraphQl sorting
  • Add last_used_at field to UI token table
Edited by Tiger Watson