获取远程的工作区列表
(currentAuth model.Auth, cliRunningEnv workspace.CliRunningEvnEnum, allowStatuses []apiResponse.WorkspaceStatusEnum)
| 168 | |
| 169 | // 获取远程的工作区列表 |
| 170 | func getServerWorkspaces(currentAuth model.Auth, |
| 171 | cliRunningEnv workspace.CliRunningEvnEnum, allowStatuses []apiResponse.WorkspaceStatusEnum) ( |
| 172 | []workspace.WorkspaceInfo, error) { |
| 173 | var startedServerWorkspaces []workspace.WorkspaceInfo |
| 174 | serverWorkSpaces, err := workspace.GetServerWorkspaceList(currentAuth, cliRunningEnv) |
| 175 | for _, item := range serverWorkSpaces { |
| 176 | // k8s 工作区不进行connect |
| 177 | if item.Mode == workspace.WorkingMode_K8s { |
| 178 | continue |
| 179 | } |
| 180 | |
| 181 | // 是否包含在过滤状态中 |
| 182 | if len(allowStatuses) > 0 { |
| 183 | isContain := false |
| 184 | for _, filterItem := range allowStatuses { |
| 185 | if filterItem == item.ServerWorkSpace.Status { |
| 186 | isContain = true |
| 187 | break |
| 188 | } |
| 189 | } |
| 190 | if !isContain { |
| 191 | continue |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | // 添加到已启动工作区列表 |
| 196 | startedServerWorkspaces = append(startedServerWorkspaces, item) |
| 197 | } |
| 198 | |
| 199 | return startedServerWorkspaces, err |
| 200 | } |
| 201 | |
| 202 | // go routine 启动所有工作区 |
| 203 | func connect(startedServerWorkspaces []workspace.WorkspaceInfo, cmd *cobra.Command, args []string, LoginUrl string) { |