Skip to content

Commit cb46b98

Browse files
committed
fix: show component icon for workspace name
- instead of template name
1 parent c6a5c62 commit cb46b98

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class TemplateIconDownloader {
1515
private val coderClient: CoderRestClientService = service()
1616
private val cache = mutableMapOf<Pair<String, String>, Icon>()
1717

18-
fun load(path: String, templateName: String): Icon {
18+
fun load(path: String, workspaceName: String): Icon {
1919
var url: URL? = null
2020
if (path.startsWith("http")) {
2121
url = path.toURL()
@@ -24,19 +24,19 @@ class TemplateIconDownloader {
2424
}
2525

2626
if (url != null) {
27-
val cachedIcon = cache[Pair(templateName, path)]
27+
val cachedIcon = cache[Pair(workspaceName, path)]
2828
if (cachedIcon != null) {
2929
return cachedIcon
3030
}
3131
var img = ImageLoader.loadFromUrl(url)
3232
if (img != null) {
3333
val icon = IconUtil.toRetinaAwareIcon(Scalr.resize(ImageUtil.toBufferedImage(img), Scalr.Method.ULTRA_QUALITY, 32))
34-
cache[Pair(templateName, path)] = icon
34+
cache[Pair(workspaceName, path)] = icon
3535
return icon
3636
}
3737
}
3838

39-
return iconForChar(templateName.lowercase().first())
39+
return iconForChar(workspaceName.lowercase().first())
4040
}
4141

4242
private fun iconForChar(c: Char) = when (c) {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
523523
null
524524
)
525525
cs.launch(Dispatchers.IO) {
526-
wm.templateIcon = iconDownloader.load(wm.templateIconPath, wm.templateName)
526+
wm.templateIcon = iconDownloader.load(wm.templateIconPath, wm.name)
527527
withContext(Dispatchers.Main) {
528528
tableOfWorkspaces.updateUI()
529529
}
@@ -550,7 +550,7 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
550550
agent.directory
551551
)
552552
cs.launch(Dispatchers.IO) {
553-
wm.templateIcon = iconDownloader.load(wm.templateIconPath, wm.templateName)
553+
wm.templateIcon = iconDownloader.load(wm.templateIconPath, wm.name)
554554
withContext(Dispatchers.Main) {
555555
tableOfWorkspaces.updateUI()
556556
}
@@ -575,7 +575,7 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
575575
null
576576
)
577577
cs.launch(Dispatchers.IO) {
578-
wm.templateIcon = iconDownloader.load(wm.templateIconPath, wm.templateName)
578+
wm.templateIcon = iconDownloader.load(wm.templateIconPath, wm.name)
579579
withContext(Dispatchers.Main) {
580580
tableOfWorkspaces.updateUI()
581581
}

0 commit comments

Comments
 (0)