@@ -690,86 +690,57 @@ class CoderWorkspacesStepView(val setNextButtonEnabled: (Boolean) -> Unit) : Cod
690
690
}
691
691
692
692
private fun Workspace.toAgentModels (): Set <WorkspaceAgentModel > {
693
- return when (this .latestBuild.resources.size) {
694
- 0 -> {
695
- val wm = WorkspaceAgentModel (
696
- this .id,
697
- this .name,
698
- this .name,
699
- this .templateID,
700
- this .templateName,
701
- this .templateIcon,
702
- null ,
703
- WorkspaceVersionStatus .from(this ),
704
- WorkspaceAndAgentStatus .from(this ),
705
- this .latestBuild.transition,
706
- null ,
707
- null ,
708
- null
709
- )
710
- cs.launch(Dispatchers .IO ) {
711
- wm.templateIcon = iconDownloader.load(wm.templateIconPath, wm.name)
712
- withContext(Dispatchers .Main ) {
713
- tableOfWorkspaces.updateUI()
714
- }
693
+ val wam = this .latestBuild.resources.filter { it.agents != null }.flatMap { it.agents!! }.map { agent ->
694
+ val workspaceWithAgentName = " ${this .name} .${agent.name} "
695
+ val wm = WorkspaceAgentModel (
696
+ this .id,
697
+ this .name,
698
+ workspaceWithAgentName,
699
+ this .templateID,
700
+ this .templateName,
701
+ this .templateIcon,
702
+ null ,
703
+ WorkspaceVersionStatus .from(this ),
704
+ WorkspaceAndAgentStatus .from(this , agent),
705
+ this .latestBuild.transition,
706
+ OS .from(agent.operatingSystem),
707
+ Arch .from(agent.architecture),
708
+ agent.expandedDirectory ? : agent.directory,
709
+ )
710
+ cs.launch(Dispatchers .IO ) {
711
+ wm.templateIcon = iconDownloader.load(wm.templateIconPath, wm.name)
712
+ withContext(Dispatchers .Main ) {
713
+ tableOfWorkspaces.updateUI()
715
714
}
716
- setOf (wm)
717
715
}
718
-
719
- else -> {
720
- val wam = this .latestBuild.resources.filter { it.agents != null }.flatMap { it.agents!! }.map { agent ->
721
- val workspaceWithAgentName = " ${this .name} .${agent.name} "
722
- val wm = WorkspaceAgentModel (
723
- this .id,
724
- this .name,
725
- workspaceWithAgentName,
726
- this .templateID,
727
- this .templateName,
728
- this .templateIcon,
729
- null ,
730
- WorkspaceVersionStatus .from(this ),
731
- WorkspaceAndAgentStatus .from(this , agent),
732
- this .latestBuild.transition,
733
- OS .from(agent.operatingSystem),
734
- Arch .from(agent.architecture),
735
- agent.expandedDirectory ? : agent.directory,
736
- )
737
- cs.launch(Dispatchers .IO ) {
738
- wm.templateIcon = iconDownloader.load(wm.templateIconPath, wm.name)
739
- withContext(Dispatchers .Main ) {
740
- tableOfWorkspaces.updateUI()
741
- }
742
- }
743
- wm
744
- }.toSet()
745
-
746
- if (wam.isNullOrEmpty()) {
747
- val wm = WorkspaceAgentModel (
748
- this .id,
749
- this .name,
750
- this .name,
751
- this .templateID,
752
- this .templateName,
753
- this .templateIcon,
754
- null ,
755
- WorkspaceVersionStatus .from(this ),
756
- WorkspaceAndAgentStatus .from(this ),
757
- this .latestBuild.transition,
758
- null ,
759
- null ,
760
- null
761
- )
762
- cs.launch(Dispatchers .IO ) {
763
- wm.templateIcon = iconDownloader.load(wm.templateIconPath, wm.name)
764
- withContext(Dispatchers .Main ) {
765
- tableOfWorkspaces.updateUI()
766
- }
767
- }
768
- return setOf (wm)
716
+ wm
717
+ }.toSet()
718
+
719
+ if (wam.isNullOrEmpty()) {
720
+ val wm = WorkspaceAgentModel (
721
+ this .id,
722
+ this .name,
723
+ this .name,
724
+ this .templateID,
725
+ this .templateName,
726
+ this .templateIcon,
727
+ null ,
728
+ WorkspaceVersionStatus .from(this ),
729
+ WorkspaceAndAgentStatus .from(this ),
730
+ this .latestBuild.transition,
731
+ null ,
732
+ null ,
733
+ null
734
+ )
735
+ cs.launch(Dispatchers .IO ) {
736
+ wm.templateIcon = iconDownloader.load(wm.templateIconPath, wm.name)
737
+ withContext(Dispatchers .Main ) {
738
+ tableOfWorkspaces.updateUI()
769
739
}
770
- return wam
771
740
}
741
+ return setOf (wm)
772
742
}
743
+ return wam
773
744
}
774
745
775
746
override fun onPrevious () {
0 commit comments