import { at } from 'lodash' ; import cfg from 'teleport/config' ; import { displayDateTime } from 'shared/services/loc' ; import { Cluster } from './types' ; export default function makeCluster ( json ) { const [ clusterId , lastConnected , status , nodeCount , publicURL , authVersion , proxyVersion , ] = at ( json , [ 'name' , 'lastConnected' , 'status' , 'nodeCount' , 'publicURL' , 'authVersion' , 'proxyVersion' , ] ) ; const connectedText = displayDateTime ( lastConnected ) ; return { clusterId , lastConnected : new Date ( lastConnected ) , connectedText , status , url : cfg . getClusterRoute ( clusterId ) , authVersion , nodeCount , publicURL , proxyVersion , } ; } export const StatusEnum = { OFFLINE : 'offline' , ONLINE : 'online' , } ;