MCPcopy Index your code
hub / github.com/coder/coder / getDisplayVersionStatus

Function getDisplayVersionStatus

site/src/utils/workspace.tsx:101–127  ·  view source on GitHub ↗
(
	agentVersion: string,
	serverVersion: string,
	agentAPIVersion: string,
	serverAPIVersion: string,
)

Source from the content-addressed store, hash-verified

99}
100
101export 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
129export const isWorkspaceOn = (workspace: TypesGen.Workspace): boolean => {
130 const transition = workspace.latest_build.transition;

Callers 2

AgentVersionFunction · 0.90
workspace.test.tsFile · 0.90

Calls 1

validMethod · 0.45

Tested by

no test coverage detected