( agentVersion: string, serverVersion: string, agentAPIVersion: string, serverAPIVersion: string, )
| 99 | } |
| 100 | |
| 101 | export const getDisplayVersionStatus = ( |
| 102 | agentVersion: string, |
| 103 | serverVersion: string, |
| 104 | agentAPIVersion: string, |
| 105 | serverAPIVersion: string, |
| 106 | ): { displayVersion: string; status: agentVersionStatus } => { |
| 107 | // APIVersions only have major.minor so coerce them to major.minor.0, so we can use semver.major() |
| 108 | const a = semver.coerce(agentAPIVersion); |
| 109 | const s = semver.coerce(serverAPIVersion); |
| 110 | let status = agentVersionStatus.Updated; |
| 111 | if ( |
| 112 | semver.valid(agentVersion) && |
| 113 | semver.valid(serverVersion) && |
| 114 | semver.lt(agentVersion, serverVersion) |
| 115 | ) { |
| 116 | status = agentVersionStatus.Outdated; |
| 117 | } |
| 118 | // deprecated overrides and implies Outdated |
| 119 | if (a !== null && s !== null && semver.major(a) < semver.major(s)) { |
| 120 | status = agentVersionStatus.Deprecated; |
| 121 | } |
| 122 | const displayVersion = agentVersion || DisplayAgentVersionLanguage.unknown; |
| 123 | return { |
| 124 | displayVersion: displayVersion, |
| 125 | status: status, |
| 126 | }; |
| 127 | }; |
| 128 | |
| 129 | export const isWorkspaceOn = (workspace: TypesGen.Workspace): boolean => { |
| 130 | const transition = workspace.latest_build.transition; |
no test coverage detected