Skip to content

Commit 1e77f43

Browse files
committed
impl: check if Coder version is in range
- compare if version is in between min&max supported versions of Coder - resolves #113
1 parent e3fec1c commit 1e77f43

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

src/main/kotlin/com/coder/gateway/CoderSupportedVersions.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import org.jetbrains.annotations.PropertyKey
99
private const val BUNDLE = "version.CoderSupportedVersions"
1010

1111
object CoderSupportedVersions : DynamicBundle(BUNDLE) {
12+
val minCompatibleCoderVersion = CoderSemVer.parse(message("minCompatibleCoderVersion"))
1213
val maxCompatibleCoderVersion = CoderSemVer.parse(message("maxCompatibleCoderVersion"))
1314

1415
@JvmStatic

src/main/kotlin/com/coder/gateway/sdk/CoderSemVer.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class CoderSemVer(private val major: Long = 0, private val minor: Long = 0, priv
99
require(patch >= 0) { "Coder minor version must be a positive number" }
1010
}
1111

12+
fun isInClosedRange(start: CoderSemVer, endInclusive: CoderSemVer) = this in start..endInclusive
1213
fun isCompatibleWith(other: CoderSemVer): Boolean {
1314
// in the initial development phase minor changes when there are API incompatibilities
1415
if (this.major == 0L) {

src/main/kotlin/com/coder/gateway/views/steps/CoderWorkspacesStepView.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,7 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
325325
}
326326
} else {
327327
val coderVersion = CoderSemVer.parse(coderClient.buildVersion)
328-
val testedCoderVersion = CoderSupportedVersions.maxCompatibleCoderVersion
329-
330-
if (!testedCoderVersion.isCompatibleWith(coderVersion)) {
328+
if (!coderVersion.isInClosedRange(CoderSupportedVersions.minCompatibleCoderVersion, CoderSupportedVersions.maxCompatibleCoderVersion)) {
331329
notificationBanner.apply {
332330
component.isVisible = true
333331
showWarning(CoderGatewayBundle.message("gateway.connector.view.coder.workspaces.unsupported.coder.version", coderClient.buildVersion))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
minCompatibleCoderVersion=0.12.9
12
maxCompatibleCoderVersion=0.13.1

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy