@spinnaker/cloudfoundry 0.0.0-main-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. package/CHANGELOG.md +1085 -0
  2. package/LICENSE.txt +203 -0
  3. package/dist/cf.module.d.ts +24 -0
  4. package/dist/cf.settings.d.ts +7 -0
  5. package/dist/common/applicationName.validator.d.ts +1 -0
  6. package/dist/deploymentStrategy/CloudFoundryDeploymentStrategySelector.d.ts +21 -0
  7. package/dist/deploymentStrategy/strategies/redblack/redblack.strategy.d.ts +10 -0
  8. package/dist/deploymentStrategy/strategies/rollingredblack/AdditionalFields.d.ts +22 -0
  9. package/dist/domain/ICloudFoundryAccount.d.ts +7 -0
  10. package/dist/domain/ICloudFoundryApplication.d.ts +4 -0
  11. package/dist/domain/ICloudFoundryCluster.d.ts +5 -0
  12. package/dist/domain/ICloudFoundryDroplet.d.ts +19 -0
  13. package/dist/domain/ICloudFoundryInstance.d.ts +4 -0
  14. package/dist/domain/ICloudFoundryLoadBalancer.d.ts +25 -0
  15. package/dist/domain/ICloudFoundryServerGroup.d.ts +41 -0
  16. package/dist/domain/ICloudFoundrySpace.d.ts +9 -0
  17. package/dist/domain/index.d.ts +8 -0
  18. package/dist/help/cloudfoundry.help.d.ts +1 -0
  19. package/dist/image/image.reader.cf.d.ts +4 -0
  20. package/dist/index.d.ts +6 -0
  21. package/dist/index.js +5929 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/instance/details/CloudFoundryInstanceActions.d.ts +11 -0
  24. package/dist/instance/details/CloudFoundryInstanceDetails.d.ts +23 -0
  25. package/dist/instance/details/index.d.ts +1 -0
  26. package/dist/instance/details/sections/CloudFoundryInstanceDetailsSection.d.ts +9 -0
  27. package/dist/instance/details/sections/index.d.ts +1 -0
  28. package/dist/loadBalancer/configure/CloudFoundryMapLoadBalancerModal.d.ts +33 -0
  29. package/dist/loadBalancer/configure/loadBalancerDetails.d.ts +32 -0
  30. package/dist/loadBalancer/details/CloudFoundryLoadBalancerActions.d.ts +10 -0
  31. package/dist/loadBalancer/details/CloudFoundryLoadBalancerDetails.d.ts +26 -0
  32. package/dist/loadBalancer/details/index.d.ts +1 -0
  33. package/dist/loadBalancer/details/sections/CloudFoundryLoadBalancerDetailsSection.d.ts +9 -0
  34. package/dist/loadBalancer/details/sections/CloudFoundryLoadBalancerLinksSection.d.ts +9 -0
  35. package/dist/loadBalancer/details/sections/CloudFoundryLoadBalancerStatusSection.d.ts +9 -0
  36. package/dist/loadBalancer/details/sections/index.d.ts +3 -0
  37. package/dist/loadBalancer/index.d.ts +3 -0
  38. package/dist/loadBalancer/loadBalancer.transformer.d.ts +25 -0
  39. package/dist/pipeline/config/validation/cfTargetImpedance.validator.d.ts +9 -0
  40. package/dist/pipeline/config/validation/instanceSize.validator.d.ts +15 -0
  41. package/dist/pipeline/config/validation/requiredRoutes.validator.d.ts +4 -0
  42. package/dist/pipeline/stages/bakeCloudFoundryManifest/BakeCloudFoundryManifestConfig.d.ts +7 -0
  43. package/dist/pipeline/stages/bakeCloudFoundryManifest/BakeCloudFoundryManifestConfigForm.d.ts +13 -0
  44. package/dist/pipeline/stages/bakeCloudFoundryManifest/BakeCloudFoundryManifestDetailsTab.d.ts +6 -0
  45. package/dist/pipeline/stages/bakeCloudFoundryManifest/bakeCloudFoundryManifestStage.d.ts +1 -0
  46. package/dist/pipeline/stages/cloneServerGroup/CloudFoundryCloneServerGroupStageConfig.d.ts +11 -0
  47. package/dist/pipeline/stages/cloneServerGroup/cloudFoundryCloneServerGroupStage.module.d.ts +1 -0
  48. package/dist/pipeline/stages/createServiceBindings/CloudFoundryCreateServiceBindingsConfig.d.ts +9 -0
  49. package/dist/pipeline/stages/createServiceBindings/CloudFoundryCreateServiceBindingsStageConfigForm.d.ts +26 -0
  50. package/dist/pipeline/stages/createServiceBindings/cloudFoundryCreateServiceBindingsStage.d.ts +1 -0
  51. package/dist/pipeline/stages/createServiceKey/CloudFoundryCreateServiceKeyStageConfig.d.ts +19 -0
  52. package/dist/pipeline/stages/createServiceKey/cloudFoundryCreateServiceKeyStage.module.d.ts +1 -0
  53. package/dist/pipeline/stages/deleteServiceBindings/CloudFoundryDeleteServiceBindingsConfig.d.ts +10 -0
  54. package/dist/pipeline/stages/deleteServiceBindings/CloudFoundryDeleteServiceBindingsStageConfigForm.d.ts +20 -0
  55. package/dist/pipeline/stages/deleteServiceBindings/cloudFoundryDeleteServiceBindingsStage.d.ts +1 -0
  56. package/dist/pipeline/stages/deleteServiceKey/CloudFoundryDeleteServiceKeyStageConfig.d.ts +19 -0
  57. package/dist/pipeline/stages/deleteServiceKey/cloudFoundryDeleteServiceKeyStage.module.d.ts +1 -0
  58. package/dist/pipeline/stages/deployService/CloudFoundryDeployServiceStageConfig.d.ts +24 -0
  59. package/dist/pipeline/stages/deployService/CreateServiceInstanceDirectInput.d.ts +29 -0
  60. package/dist/pipeline/stages/deployService/CreateUserProvidedInput.d.ts +19 -0
  61. package/dist/pipeline/stages/deployService/ICloudFoundryServiceManifestSource.d.ts +24 -0
  62. package/dist/pipeline/stages/deployService/ServiceTagsInput.d.ts +17 -0
  63. package/dist/pipeline/stages/deployService/cloudFoundryDeployServiceStage.module.d.ts +1 -0
  64. package/dist/pipeline/stages/destroyAsg/cloudFoundryDestroyAsgStage.module.d.ts +1 -0
  65. package/dist/pipeline/stages/destroyService/CloudFoundryDestroyServiceStageConfig.d.ts +5 -0
  66. package/dist/pipeline/stages/destroyService/CloudFoundryDestroyServiceStageConfigForm.d.ts +19 -0
  67. package/dist/pipeline/stages/destroyService/cloudFoundryDestroyServiceStage.module.d.ts +1 -0
  68. package/dist/pipeline/stages/disableAsg/cloudFoundryDisableAsgStage.module.d.ts +1 -0
  69. package/dist/pipeline/stages/enableAsg/cloudFoundryEnableAsgStage.module.d.ts +1 -0
  70. package/dist/pipeline/stages/mapLoadBalancers/cloudFoundryMapLoadBalancersStage.module.d.ts +1 -0
  71. package/dist/pipeline/stages/resizeAsg/CloudFoundryResizeAsgStageConfig.d.ts +17 -0
  72. package/dist/pipeline/stages/resizeAsg/cloudFoundryResizeAsgStage.module.d.ts +1 -0
  73. package/dist/pipeline/stages/rollbackCluster/CloudFoundryRollbackClusterStageConfig.d.ts +17 -0
  74. package/dist/pipeline/stages/rollbackCluster/cloudFoundryRollbackClusterStage.module.d.ts +1 -0
  75. package/dist/pipeline/stages/runJob/CloudFoundryRunJobStageConfig.d.ts +14 -0
  76. package/dist/pipeline/stages/runJob/RunJobExecutionDetails.d.ts +6 -0
  77. package/dist/pipeline/stages/runJob/cloudFoundryRunJob.module.d.ts +1 -0
  78. package/dist/pipeline/stages/shareService/CloudFoundryShareServiceExecutionDetails.d.ts +6 -0
  79. package/dist/pipeline/stages/shareService/CloudFoundryShareServiceStageConfig.d.ts +21 -0
  80. package/dist/pipeline/stages/shareService/cloudFoundryShareServiceStage.module.d.ts +1 -0
  81. package/dist/pipeline/stages/unmapLoadBalancers/cloudFoundryUnmapLoadBalancersStage.module.d.ts +1 -0
  82. package/dist/pipeline/stages/unshareService/CloudFoundryUnshareServiceExecutionDetails.d.ts +6 -0
  83. package/dist/pipeline/stages/unshareService/CloudFoundryUnshareServiceStageConfig.d.ts +18 -0
  84. package/dist/pipeline/stages/unshareService/cloudFoundryUnshareServiceStage.module.d.ts +1 -0
  85. package/dist/presentation/forms/index.d.ts +2 -0
  86. package/dist/presentation/forms/inputs/FormikConfigField.d.ts +10 -0
  87. package/dist/presentation/forms/inputs/index.d.ts +1 -0
  88. package/dist/presentation/forms/serverGroup/Buildpacks.d.ts +8 -0
  89. package/dist/presentation/forms/serverGroup/EnvironmentVariables.d.ts +8 -0
  90. package/dist/presentation/forms/serverGroup/HealthCheck.d.ts +12 -0
  91. package/dist/presentation/forms/serverGroup/InstanceParameters.d.ts +12 -0
  92. package/dist/presentation/forms/serverGroup/Routes.d.ts +10 -0
  93. package/dist/presentation/forms/serverGroup/Services.d.ts +5 -0
  94. package/dist/presentation/forms/serverGroup/index.d.ts +6 -0
  95. package/dist/presentation/index.d.ts +3 -0
  96. package/dist/presentation/pipeline/index.d.ts +1 -0
  97. package/dist/presentation/pipeline/stages/CloudFoundryAsgStageConfig.d.ts +14 -0
  98. package/dist/presentation/pipeline/stages/CloudFoundryLoadBalancersExecutionDetails.d.ts +6 -0
  99. package/dist/presentation/pipeline/stages/CloudFoundryLoadBalancersStageConfig.d.ts +25 -0
  100. package/dist/presentation/pipeline/stages/CloudFoundryServiceExecutionDetails.d.ts +6 -0
  101. package/dist/presentation/pipeline/stages/CloudFoundryServiceKeyExecutionDetails.d.ts +6 -0
  102. package/dist/presentation/pipeline/stages/index.d.ts +5 -0
  103. package/dist/presentation/widgets/accountRegionClusterSelector/AccountRegionClusterSelector.d.ts +33 -0
  104. package/dist/presentation/widgets/accountRegionClusterSelector/FormikAccountRegionClusterSelector.d.ts +32 -0
  105. package/dist/presentation/widgets/accountRegionClusterSelector/index.d.ts +2 -0
  106. package/dist/presentation/widgets/index.d.ts +1 -0
  107. package/dist/presentation/widgets/recentLogs/CloudFoundryRecentLogs.d.ts +27 -0
  108. package/dist/routeDomains/index.d.ts +1 -0
  109. package/dist/routeDomains/routeDomainSelectField.d.ts +15 -0
  110. package/dist/serverGroup/configure/index.d.ts +4 -0
  111. package/dist/serverGroup/configure/serverGroupCommandBuilder.service.cf.d.ts +12 -0
  112. package/dist/serverGroup/configure/serverGroupCommandBuilderShim.service.cf.d.ts +14 -0
  113. package/dist/serverGroup/configure/serverGroupConfigurationModel.cf.d.ts +65 -0
  114. package/dist/serverGroup/configure/wizard/CreateServerGroupModal.d.ts +31 -0
  115. package/dist/serverGroup/configure/wizard/ServerGroupTemplateSelection.d.ts +16 -0
  116. package/dist/serverGroup/configure/wizard/sections/artifactSettings/ArtifactSettings.cf.d.ts +17 -0
  117. package/dist/serverGroup/configure/wizard/sections/artifactSettings/ConstantArtifactSettings.cf.d.ts +11 -0
  118. package/dist/serverGroup/configure/wizard/sections/basicSettings/BasicSettings.cf.d.ts +24 -0
  119. package/dist/serverGroup/configure/wizard/sections/cloneSettings/CloneSettings.cf.d.ts +21 -0
  120. package/dist/serverGroup/configure/wizard/sections/configurationSettings/ConfigurationSettings.cf.d.ts +22 -0
  121. package/dist/serverGroup/details/cfServerGroupDetailsGetter.d.ts +4 -0
  122. package/dist/serverGroup/details/cloudFoundryServerGroupActions.d.ts +24 -0
  123. package/dist/serverGroup/details/mapLoadBalancers/CloudFoundryMapLoadBalancersModal.d.ts +28 -0
  124. package/dist/serverGroup/details/mapLoadBalancers/CloudFoundryUnmapLoadBalancersModal.d.ts +28 -0
  125. package/dist/serverGroup/details/resize/CloudFoundryResizeServerGroupModal.d.ts +37 -0
  126. package/dist/serverGroup/details/rollback/CloudFoundryRollbackServerGroupModal.d.ts +36 -0
  127. package/dist/serverGroup/details/sections/ApplicationManagerSection.d.ts +6 -0
  128. package/dist/serverGroup/details/sections/BoundServicesSection.d.ts +6 -0
  129. package/dist/serverGroup/details/sections/BuildSection.d.ts +6 -0
  130. package/dist/serverGroup/details/sections/EnvironmentVariablesSection.d.ts +6 -0
  131. package/dist/serverGroup/details/sections/HealthCheckSection.d.ts +6 -0
  132. package/dist/serverGroup/details/sections/ICloudFoundryServerGroupDetailsSectionProps.d.ts +5 -0
  133. package/dist/serverGroup/details/sections/MetricsSection.d.ts +6 -0
  134. package/dist/serverGroup/details/sections/PackageSection.d.ts +6 -0
  135. package/dist/serverGroup/details/sections/ServerGroupInformationSection.d.ts +6 -0
  136. package/dist/serverGroup/details/sections/ServerGroupSizingSection.d.ts +6 -0
  137. package/dist/serverGroup/details/sections/index.d.ts +9 -0
  138. package/dist/serverGroup/index.d.ts +5 -0
  139. package/dist/serverGroup/serverGroup.transformer.d.ts +10 -0
  140. package/package.json +52 -0
  141. package/src/cf.module.ts +85 -0
  142. package/src/cf.settings.ts +14 -0
  143. package/src/common/applicationName.validator.ts +43 -0
  144. package/src/common/cloudFoundry.less +16 -0
  145. package/src/deploymentStrategy/CloudFoundryDeploymentStrategySelector.tsx +175 -0
  146. package/src/deploymentStrategy/strategies/redblack/redblack.strategy.ts +11 -0
  147. package/src/deploymentStrategy/strategies/rollingredblack/AdditionalFields.tsx +161 -0
  148. package/src/domain/ICloudFoundryAccount.ts +9 -0
  149. package/src/domain/ICloudFoundryApplication.ts +5 -0
  150. package/src/domain/ICloudFoundryCluster.ts +6 -0
  151. package/src/domain/ICloudFoundryDroplet.ts +22 -0
  152. package/src/domain/ICloudFoundryInstance.ts +5 -0
  153. package/src/domain/ICloudFoundryLoadBalancer.ts +29 -0
  154. package/src/domain/ICloudFoundryServerGroup.ts +47 -0
  155. package/src/domain/ICloudFoundrySpace.ts +10 -0
  156. package/src/domain/index.ts +8 -0
  157. package/src/help/cloudfoundry.help.ts +31 -0
  158. package/src/image/image.reader.cf.ts +17 -0
  159. package/src/index.ts +7 -0
  160. package/src/instance/details/CloudFoundryInstanceActions.tsx +59 -0
  161. package/src/instance/details/CloudFoundryInstanceDetails.tsx +154 -0
  162. package/src/instance/details/index.ts +1 -0
  163. package/src/instance/details/sections/CloudFoundryInstanceDetailsSection.tsx +49 -0
  164. package/src/instance/details/sections/index.ts +1 -0
  165. package/src/loadBalancer/configure/CloudFoundryMapLoadBalancerModal.tsx +210 -0
  166. package/src/loadBalancer/configure/loadBalancerDetails.tsx +228 -0
  167. package/src/loadBalancer/details/CloudFoundryLoadBalancerActions.tsx +61 -0
  168. package/src/loadBalancer/details/CloudFoundryLoadBalancerDetails.tsx +148 -0
  169. package/src/loadBalancer/details/index.ts +1 -0
  170. package/src/loadBalancer/details/sections/CloudFoundryLoadBalancerDetailsSection.tsx +63 -0
  171. package/src/loadBalancer/details/sections/CloudFoundryLoadBalancerLinksSection.tsx +34 -0
  172. package/src/loadBalancer/details/sections/CloudFoundryLoadBalancerStatusSection.tsx +27 -0
  173. package/src/loadBalancer/details/sections/index.ts +3 -0
  174. package/src/loadBalancer/index.ts +3 -0
  175. package/src/loadBalancer/loadBalancer.transformer.ts +144 -0
  176. package/src/logo/cf.icon.svg +12 -0
  177. package/src/logo/cf.logo.less +5 -0
  178. package/src/logo/cf.logo.svg +12 -0
  179. package/src/pipeline/config/validation/cfTargetImpedance.validator.ts +60 -0
  180. package/src/pipeline/config/validation/instanceSize.validator.ts +66 -0
  181. package/src/pipeline/config/validation/requiredRoutes.validator.ts +26 -0
  182. package/src/pipeline/stages/bakeCloudFoundryManifest/BakeCloudFoundryManifestConfig.tsx +62 -0
  183. package/src/pipeline/stages/bakeCloudFoundryManifest/BakeCloudFoundryManifestConfigForm.tsx +174 -0
  184. package/src/pipeline/stages/bakeCloudFoundryManifest/BakeCloudFoundryManifestDetailsTab.tsx +35 -0
  185. package/src/pipeline/stages/bakeCloudFoundryManifest/bakeCloudFoundryManifestConfig.spec.tsx +80 -0
  186. package/src/pipeline/stages/bakeCloudFoundryManifest/bakeCloudFoundryManifestStage.ts +35 -0
  187. package/src/pipeline/stages/cloneServerGroup/CloudFoundryCloneServerGroupStageConfig.tsx +113 -0
  188. package/src/pipeline/stages/cloneServerGroup/cloudFoundryCloneServerGroupStage.module.ts +14 -0
  189. package/src/pipeline/stages/createServiceBindings/CloudFoundryCreateServiceBindingsConfig.spec.tsx +35 -0
  190. package/src/pipeline/stages/createServiceBindings/CloudFoundryCreateServiceBindingsConfig.tsx +69 -0
  191. package/src/pipeline/stages/createServiceBindings/CloudFoundryCreateServiceBindingsStageConfigForm.tsx +230 -0
  192. package/src/pipeline/stages/createServiceBindings/cloudFoundryCreateServiceBindingsStage.ts +19 -0
  193. package/src/pipeline/stages/createServiceBindings/cloudFoundryCreateServiceBindingsStageForm.spec.tsx +50 -0
  194. package/src/pipeline/stages/createServiceKey/CloudFoundryCreateServiceKeyStageConfig.tsx +116 -0
  195. package/src/pipeline/stages/createServiceKey/cloudFoundryCreateServiceKeyStage.module.ts +21 -0
  196. package/src/pipeline/stages/deleteServiceBindings/CloudFoundryDeleteServiceBindingsConfig.tsx +69 -0
  197. package/src/pipeline/stages/deleteServiceBindings/CloudFoundryDeleteServiceBindingsStageConfigForm.tsx +158 -0
  198. package/src/pipeline/stages/deleteServiceBindings/cloudFoundryDeleteServiceBindingsStage.ts +19 -0
  199. package/src/pipeline/stages/deleteServiceBindings/cloudFoundryDeleteServiceBindingsStageForm.spec.tsx +49 -0
  200. package/src/pipeline/stages/deleteServiceKey/CloudFoundryDeleteServiceKeyStageConfig.tsx +116 -0
  201. package/src/pipeline/stages/deleteServiceKey/cloudFoundryDeleteServiceKeyStage.module.ts +22 -0
  202. package/src/pipeline/stages/deployService/CloudFoundryDeployServiceStageConfig.tsx +198 -0
  203. package/src/pipeline/stages/deployService/CreateServiceInstanceDirectInput.tsx +164 -0
  204. package/src/pipeline/stages/deployService/CreateUserProvidedInput.tsx +116 -0
  205. package/src/pipeline/stages/deployService/ICloudFoundryServiceManifestSource.ts +27 -0
  206. package/src/pipeline/stages/deployService/ServiceTagsInput.tsx +89 -0
  207. package/src/pipeline/stages/deployService/cloudFoundryDeployServiceStage.module.ts +153 -0
  208. package/src/pipeline/stages/deployService/cloudfoundryDeployServiceStage.less +12 -0
  209. package/src/pipeline/stages/destroyAsg/cloudFoundryDestroyAsgStage.module.ts +23 -0
  210. package/src/pipeline/stages/destroyService/CloudFoundryDestroyServiceStageConfig.tsx +46 -0
  211. package/src/pipeline/stages/destroyService/CloudFoundryDestroyServiceStageConfigForm.tsx +134 -0
  212. package/src/pipeline/stages/destroyService/cloudFoundryDestroyServiceStage.module.ts +20 -0
  213. package/src/pipeline/stages/disableAsg/cloudFoundryDisableAsgStage.module.ts +18 -0
  214. package/src/pipeline/stages/enableAsg/cloudFoundryEnableAsgStage.module.ts +18 -0
  215. package/src/pipeline/stages/mapLoadBalancers/cloudFoundryMapLoadBalancersStage.module.ts +21 -0
  216. package/src/pipeline/stages/resizeAsg/CloudFoundryResizeAsgStageConfig.tsx +148 -0
  217. package/src/pipeline/stages/resizeAsg/cloudFoundryResizeAsgStage.module.ts +52 -0
  218. package/src/pipeline/stages/rollbackCluster/CloudFoundryRollbackClusterStageConfig.tsx +90 -0
  219. package/src/pipeline/stages/rollbackCluster/cloudFoundryRollbackClusterStage.module.ts +19 -0
  220. package/src/pipeline/stages/runJob/CloudFoundryRunJobStageConfig.tsx +100 -0
  221. package/src/pipeline/stages/runJob/RunJobExecutionDetails.tsx +62 -0
  222. package/src/pipeline/stages/runJob/cloudFoundryRunJob.module.ts +24 -0
  223. package/src/pipeline/stages/shareService/CloudFoundryShareServiceExecutionDetails.tsx +52 -0
  224. package/src/pipeline/stages/shareService/CloudFoundryShareServiceStageConfig.tsx +141 -0
  225. package/src/pipeline/stages/shareService/cloudFoundryShareServiceStage.module.ts +21 -0
  226. package/src/pipeline/stages/unmapLoadBalancers/cloudFoundryUnmapLoadBalancersStage.module.ts +21 -0
  227. package/src/pipeline/stages/unshareService/CloudFoundryUnshareServiceExecutionDetails.tsx +46 -0
  228. package/src/pipeline/stages/unshareService/CloudFoundryUnshareServiceStageConfig.tsx +114 -0
  229. package/src/pipeline/stages/unshareService/cloudFoundryUnshareServiceStage.module.ts +21 -0
  230. package/src/presentation/forms/index.ts +2 -0
  231. package/src/presentation/forms/inputs/FormikConfigField.tsx +28 -0
  232. package/src/presentation/forms/inputs/index.ts +1 -0
  233. package/src/presentation/forms/serverGroup/Buildpacks.tsx +69 -0
  234. package/src/presentation/forms/serverGroup/EnvironmentVariables.tsx +94 -0
  235. package/src/presentation/forms/serverGroup/HealthCheck.tsx +57 -0
  236. package/src/presentation/forms/serverGroup/InstanceParameters.tsx +63 -0
  237. package/src/presentation/forms/serverGroup/Routes.tsx +74 -0
  238. package/src/presentation/forms/serverGroup/Services.tsx +62 -0
  239. package/src/presentation/forms/serverGroup/index.ts +6 -0
  240. package/src/presentation/index.ts +3 -0
  241. package/src/presentation/pipeline/index.ts +1 -0
  242. package/src/presentation/pipeline/stages/CloudFoundryAsgStageConfig.tsx +67 -0
  243. package/src/presentation/pipeline/stages/CloudFoundryLoadBalancersExecutionDetails.tsx +53 -0
  244. package/src/presentation/pipeline/stages/CloudFoundryLoadBalancersStageConfig.tsx +116 -0
  245. package/src/presentation/pipeline/stages/CloudFoundryServiceExecutionDetails.tsx +46 -0
  246. package/src/presentation/pipeline/stages/CloudFoundryServiceKeyExecutionDetails.tsx +52 -0
  247. package/src/presentation/pipeline/stages/index.ts +5 -0
  248. package/src/presentation/widgets/accountRegionClusterSelector/AccountRegionClusterSelector.spec.tsx +385 -0
  249. package/src/presentation/widgets/accountRegionClusterSelector/AccountRegionClusterSelector.tsx +231 -0
  250. package/src/presentation/widgets/accountRegionClusterSelector/FormikAccountRegionClusterSelector.tsx +164 -0
  251. package/src/presentation/widgets/accountRegionClusterSelector/index.ts +2 -0
  252. package/src/presentation/widgets/index.ts +1 -0
  253. package/src/presentation/widgets/recentLogs/CloudFoundryRecentLogs.tsx +112 -0
  254. package/src/routeDomains/index.ts +1 -0
  255. package/src/routeDomains/routeDomainSelectField.tsx +48 -0
  256. package/src/serverGroup/configure/index.ts +4 -0
  257. package/src/serverGroup/configure/serverGroupCommandBuilder.service.cf.ts +168 -0
  258. package/src/serverGroup/configure/serverGroupCommandBuilderShim.service.cf.ts +64 -0
  259. package/src/serverGroup/configure/serverGroupConfigurationModel.cf.ts +77 -0
  260. package/src/serverGroup/configure/wizard/CreateServerGroupModal.tsx +194 -0
  261. package/src/serverGroup/configure/wizard/ServerGroupTemplateSelection.tsx +55 -0
  262. package/src/serverGroup/configure/wizard/sections/artifactSettings/ArtifactSettings.cf.tsx +78 -0
  263. package/src/serverGroup/configure/wizard/sections/artifactSettings/ConstantArtifactSettings.cf.tsx +49 -0
  264. package/src/serverGroup/configure/wizard/sections/basicSettings/BasicSettings.cf.tsx +163 -0
  265. package/src/serverGroup/configure/wizard/sections/cloneSettings/CloneSettings.cf.tsx +101 -0
  266. package/src/serverGroup/configure/wizard/sections/configurationSettings/ConfigurationSettings.cf.tsx +230 -0
  267. package/src/serverGroup/configure/wizard/serverGroup.less +3 -0
  268. package/src/serverGroup/details/cfServerGroupDetailsGetter.ts +60 -0
  269. package/src/serverGroup/details/cloudFoundryServerGroupActions.tsx +365 -0
  270. package/src/serverGroup/details/mapLoadBalancers/CloudFoundryMapLoadBalancersModal.tsx +137 -0
  271. package/src/serverGroup/details/mapLoadBalancers/CloudFoundryUnmapLoadBalancersModal.tsx +137 -0
  272. package/src/serverGroup/details/resize/CloudFoundryResizeServerGroupModal.tsx +232 -0
  273. package/src/serverGroup/details/rollback/CloudFoundryRollbackServerGroupModal.tsx +179 -0
  274. package/src/serverGroup/details/sections/ApplicationManagerSection.tsx +28 -0
  275. package/src/serverGroup/details/sections/BoundServicesSection.tsx +39 -0
  276. package/src/serverGroup/details/sections/BuildSection.tsx +61 -0
  277. package/src/serverGroup/details/sections/EnvironmentVariablesSection.tsx +34 -0
  278. package/src/serverGroup/details/sections/HealthCheckSection.tsx +28 -0
  279. package/src/serverGroup/details/sections/ICloudFoundryServerGroupDetailsSectionProps.ts +6 -0
  280. package/src/serverGroup/details/sections/MetricsSection.tsx +28 -0
  281. package/src/serverGroup/details/sections/PackageSection.tsx +27 -0
  282. package/src/serverGroup/details/sections/ServerGroupInformationSection.tsx +58 -0
  283. package/src/serverGroup/details/sections/ServerGroupSizingSection.tsx +27 -0
  284. package/src/serverGroup/details/sections/index.ts +9 -0
  285. package/src/serverGroup/index.ts +5 -0
  286. package/src/serverGroup/serverGroup.transformer.ts +42 -0
@@ -0,0 +1,52 @@
1
+ import { get } from 'lodash';
2
+ import React from 'react';
3
+
4
+ import type { IExecutionDetailsSectionProps } from '@spinnaker/core';
5
+ import { AccountTag, ExecutionDetailsSection, StageExecutionLogs, StageFailureMessage } from '@spinnaker/core';
6
+
7
+ export function CloudFoundryServiceKeyExecutionDetails(props: IExecutionDetailsSectionProps) {
8
+ const { stage } = props;
9
+ const { context } = stage;
10
+ const account = get(context, 'service.account', undefined);
11
+ const region = get(context, 'service.region', undefined);
12
+ const serviceInstanceName = get(context, 'serviceInstanceName', undefined);
13
+ const serviceKeyName = get(context, 'serviceKeyName', undefined);
14
+ return (
15
+ <ExecutionDetailsSection name={props.name} current={props.current}>
16
+ <div className="step-section-details">
17
+ <div className="row">
18
+ <div className="col-md-12">
19
+ <dl className="dl-horizontal">
20
+ <dt>Account</dt>
21
+ <dd>
22
+ <AccountTag account={account} />
23
+ </dd>
24
+ <dt>Region</dt>
25
+ <dd>
26
+ {region}
27
+ <br />
28
+ </dd>
29
+ <dt>Service Instance Name</dt>
30
+ <dd>
31
+ {serviceInstanceName}
32
+ <br />
33
+ </dd>
34
+ <dt>Service Key Name</dt>
35
+ <dd>
36
+ {serviceKeyName}
37
+ <br />
38
+ </dd>
39
+ </dl>
40
+ </div>
41
+ </div>
42
+ </div>
43
+ <StageFailureMessage stage={props.stage} message={props.stage.failureMessage} />
44
+ <StageExecutionLogs stage={props.stage} />
45
+ </ExecutionDetailsSection>
46
+ );
47
+ }
48
+
49
+ // eslint-disable-next-line
50
+ export namespace CloudFoundryServiceKeyExecutionDetails {
51
+ export const title = 'cloudfoundryServiceKeyConfig';
52
+ }
@@ -0,0 +1,5 @@
1
+ export * from './CloudFoundryAsgStageConfig';
2
+ export * from './CloudFoundryLoadBalancersExecutionDetails';
3
+ export * from './CloudFoundryLoadBalancersStageConfig';
4
+ export * from './CloudFoundryServiceExecutionDetails';
5
+ export * from './CloudFoundryServiceKeyExecutionDetails';
@@ -0,0 +1,385 @@
1
+ import type { IScope } from 'angular';
2
+ import { mock, noop } from 'angular';
3
+ import { mount, shallow } from 'enzyme';
4
+ import React from 'react';
5
+
6
+ import type { Application, ApplicationDataSource, IMoniker, IServerGroup } from '@spinnaker/core';
7
+ import { ApplicationModelBuilder, REACT_MODULE } from '@spinnaker/core';
8
+
9
+ import type { IAccountRegionClusterSelectorProps } from './AccountRegionClusterSelector';
10
+ import { AccountRegionClusterSelector } from './AccountRegionClusterSelector';
11
+
12
+ describe('<AccountRegionClusterSelector />', () => {
13
+ let $scope: IScope;
14
+ let application: Application;
15
+
16
+ function createServerGroup(account: string, cluster: string, name: string, region: string): IServerGroup {
17
+ return {
18
+ account,
19
+ cloudProvider: 'cloud-provider',
20
+ cluster,
21
+ name,
22
+ region,
23
+ instances: [{ health: null, id: 'instance-id', launchTime: 0, name: 'instance-name', zone: 'GMT' }],
24
+ instanceCounts: { up: 1, down: 0, starting: 0, succeeded: 1, failed: 0, unknown: 0, outOfService: 0 },
25
+ moniker: { app: 'my-app', cluster, detail: 'my-detail', stack: 'my-stack', sequence: 1 },
26
+ } as IServerGroup;
27
+ }
28
+
29
+ beforeEach(mock.module(REACT_MODULE));
30
+ beforeEach(
31
+ mock.inject(($rootScope: IScope) => {
32
+ $scope = $rootScope.$new();
33
+ application = ApplicationModelBuilder.createApplicationForTests('app', {
34
+ key: 'serverGroups',
35
+ loaded: true,
36
+ data: [
37
+ createServerGroup('account-name-one', 'app-stack-detailOne', 'app', 'region-one'),
38
+ createServerGroup('account-name-two', 'app-stack-detailTwo', 'app', 'region-two'),
39
+ createServerGroup('account-name-one', 'app-stack-detailOne', 'app', 'region-three'),
40
+ createServerGroup('account-name-one', 'app-stack-detailThree', 'app', 'region-one'),
41
+ createServerGroup('account-name-one', 'app-stack-detailFour', 'app', 'region-three'),
42
+ createServerGroup('account-name-one', 'app-stack-detailFive', 'app', 'region-two'),
43
+ ],
44
+ defaultData: [] as IServerGroup[],
45
+ } as ApplicationDataSource<IServerGroup[]>);
46
+ }),
47
+ );
48
+
49
+ it('initializes properly with provided component', () => {
50
+ const accountRegionClusterProps: IAccountRegionClusterSelectorProps = {
51
+ accounts: [
52
+ {
53
+ accountId: 'account-id-one',
54
+ name: 'account-name-one',
55
+ requiredGroupMembership: [],
56
+ type: 'account-type',
57
+ },
58
+ ],
59
+ application,
60
+ cloudProvider: 'cloud-provider',
61
+ onComponentUpdate: noop,
62
+ component: {
63
+ credentials: 'account-name-one',
64
+ regions: ['region-one'],
65
+ },
66
+ };
67
+
68
+ const component = shallow<AccountRegionClusterSelector>(
69
+ <AccountRegionClusterSelector {...accountRegionClusterProps} />,
70
+ );
71
+ $scope.$digest();
72
+
73
+ expect(component.state().availableRegions.length).toBe(3, 'number of available regions does not match');
74
+ expect(component.state().availableRegions).toContain('region-one');
75
+ expect(component.state().availableRegions).toContain('region-two');
76
+ expect(component.state().availableRegions).toContain('region-three');
77
+ expect(component.state().clusters.length).toBe(2, 'number of clusters does not match');
78
+ expect(component.state().clusters).toContain('app-stack-detailOne');
79
+ expect(component.state().clusters).toContain('app-stack-detailThree');
80
+ expect(component.state().clusterField).toBe('cluster');
81
+ expect(component.state().componentName).toBe('');
82
+ });
83
+
84
+ it('retrieves the correct list of regions when account is changed', () => {
85
+ let credentials = '';
86
+ let region = 'SHOULD-CHANGE';
87
+ let regions = ['SHOULD-CHANGE'];
88
+ let cluster = 'SHOULD-CHANGE';
89
+ const accountRegionClusterProps: IAccountRegionClusterSelectorProps = {
90
+ accounts: [
91
+ {
92
+ accountId: 'account-id-two',
93
+ name: 'account-name-two',
94
+ requiredGroupMembership: [],
95
+ type: 'account-type',
96
+ },
97
+ {
98
+ accountId: 'account-id-one',
99
+ name: 'account-name-one',
100
+ requiredGroupMembership: [],
101
+ type: 'account-type',
102
+ },
103
+ ],
104
+ application,
105
+ cloudProvider: 'cloud-provider',
106
+ onComponentUpdate: (value: any) => {
107
+ credentials = value.credentials;
108
+ region = value.region;
109
+ regions = value.regions;
110
+ cluster = value.cluster;
111
+ },
112
+ component: {
113
+ credentials: 'account-name-one',
114
+ regions: ['region-one'],
115
+ },
116
+ };
117
+
118
+ const component = mount<AccountRegionClusterSelector>(
119
+ <AccountRegionClusterSelector {...accountRegionClusterProps} />,
120
+ );
121
+ $scope.$digest();
122
+
123
+ expect(component.state().availableRegions.length).toBe(3, 'number of available regions does not match');
124
+ expect(component.state().availableRegions).toContain('region-one');
125
+ expect(component.state().availableRegions).toContain('region-two');
126
+ expect(component.state().availableRegions).toContain('region-three');
127
+ expect(component.state().clusters.length).toBe(2, 'number of clusters does not match');
128
+ expect(component.state().clusters).toContain('app-stack-detailOne');
129
+ expect(component.state().clusters).toContain('app-stack-detailThree');
130
+
131
+ const accountSelectComponent = component.find('Select[name="credentials"] .Select-control input');
132
+ accountSelectComponent.simulate('mouseDown');
133
+ accountSelectComponent.simulate('change', { target: { value: 'account-name-two' } });
134
+ accountSelectComponent.simulate('keyDown', { keyCode: 9, key: 'Tab' });
135
+ $scope.$digest();
136
+
137
+ expect(component.state().availableRegions.length).toBe(1, 'number of available regions does not match');
138
+ expect(component.state().availableRegions).toContain('region-two');
139
+ expect(component.state().clusters.length).toBe(0, 'number of clusters does not match');
140
+ expect(region).toEqual('', 'selected region is not cleared');
141
+ expect(regions.length).toBe(0, 'selected regions list is not cleared');
142
+ expect(credentials).toContain('account-name-two');
143
+ expect(cluster).toBeUndefined('selected cluster is not cleared');
144
+ });
145
+
146
+ it('retrieves the correct list of clusters when the selector is multi-region and the region is changed', () => {
147
+ let regions: string[] = [];
148
+ let cluster = 'SHOULD-CHANGE';
149
+ const accountRegionClusterProps: IAccountRegionClusterSelectorProps = {
150
+ accounts: [
151
+ {
152
+ accountId: 'account-id-two',
153
+ name: 'account-name-two',
154
+ requiredGroupMembership: [],
155
+ type: 'account-type',
156
+ },
157
+ {
158
+ accountId: 'account-id-one',
159
+ name: 'account-name-one',
160
+ requiredGroupMembership: [],
161
+ type: 'account-type',
162
+ },
163
+ ],
164
+ application,
165
+ cloudProvider: 'cloud-provider',
166
+ clusterField: 'newCluster',
167
+ onComponentUpdate: (value: any) => {
168
+ regions = value.regions;
169
+ cluster = value.newCluster;
170
+ },
171
+ component: {
172
+ credentials: 'account-name-one',
173
+ regions: ['region-one'],
174
+ },
175
+ };
176
+
177
+ const component = mount<AccountRegionClusterSelector>(
178
+ <AccountRegionClusterSelector {...accountRegionClusterProps} />,
179
+ );
180
+ $scope.$digest();
181
+
182
+ expect(component.state().availableRegions.length).toBe(3, 'number of available regions does not match');
183
+ expect(component.state().availableRegions).toContain('region-one');
184
+ expect(component.state().availableRegions).toContain('region-two');
185
+ expect(component.state().availableRegions).toContain('region-three');
186
+ expect(component.state().clusters.length).toBe(2, 'number of clusters does not match');
187
+ expect(component.state().clusters).toContain('app-stack-detailOne');
188
+ expect(component.state().clusters).toContain('app-stack-detailThree');
189
+
190
+ const accountSelectComponent = component.find('Select[name="regions"] .Select-control input');
191
+ accountSelectComponent.simulate('mouseDown');
192
+ accountSelectComponent.simulate('change', { target: { value: 'region-three' } });
193
+ accountSelectComponent.simulate('keyDown', { keyCode: 9, key: 'Tab' });
194
+ $scope.$digest();
195
+
196
+ expect(component.state().clusters.length).toBe(3, 'number of clusters does not match');
197
+ expect(component.state().clusters).toContain('app-stack-detailOne');
198
+ expect(component.state().clusters).toContain('app-stack-detailThree');
199
+ expect(component.state().clusters).toContain('app-stack-detailFour');
200
+ expect(cluster).toBeUndefined('selected cluster is not cleared');
201
+ expect(regions.length).toBe(2);
202
+ expect(regions).toContain('region-one');
203
+ expect(regions).toContain('region-three');
204
+ });
205
+
206
+ it('retrieves the correct list of clusters on startup and the selector is single-region', () => {
207
+ const accountRegionClusterProps: IAccountRegionClusterSelectorProps = {
208
+ accounts: [
209
+ {
210
+ accountId: 'account-id-two',
211
+ name: 'account-name-two',
212
+ requiredGroupMembership: [],
213
+ type: 'account-type',
214
+ },
215
+ {
216
+ accountId: 'account-id-one',
217
+ name: 'account-name-one',
218
+ requiredGroupMembership: [],
219
+ type: 'account-type',
220
+ },
221
+ ],
222
+ application,
223
+ cloudProvider: 'cloud-provider',
224
+ onComponentUpdate: (_value: any) => {},
225
+ component: {
226
+ cluster: 'app-stack-detailOne',
227
+ credentials: 'account-name-one',
228
+ region: 'region-one',
229
+ },
230
+ isSingleRegion: true,
231
+ };
232
+
233
+ const component = mount<AccountRegionClusterSelector>(
234
+ <AccountRegionClusterSelector {...accountRegionClusterProps} />,
235
+ );
236
+ $scope.$digest();
237
+
238
+ expect(component.state().availableRegions.length).toBe(3, 'number of available regions does not match');
239
+ expect(component.state().availableRegions).toContain('region-one');
240
+ expect(component.state().availableRegions).toContain('region-two');
241
+ expect(component.state().availableRegions).toContain('region-three');
242
+ expect(component.state().clusters.length).toBe(2, 'number of clusters does not match');
243
+ expect(component.state().clusters).toContain('app-stack-detailOne');
244
+ expect(component.state().clusters).toContain('app-stack-detailThree');
245
+ });
246
+
247
+ it('the cluster value is updated in the component when cluster is changed', () => {
248
+ let cluster = '';
249
+ let moniker: IMoniker = { app: '' };
250
+ const accountRegionClusterProps: IAccountRegionClusterSelectorProps = {
251
+ accounts: [
252
+ {
253
+ accountId: 'account-id-two',
254
+ name: 'account-name-two',
255
+ requiredGroupMembership: [],
256
+ type: 'account-type',
257
+ },
258
+ {
259
+ accountId: 'account-id-one',
260
+ name: 'account-name-one',
261
+ requiredGroupMembership: [],
262
+ type: 'account-type',
263
+ },
264
+ ],
265
+ application,
266
+ cloudProvider: 'cloud-provider',
267
+ clusterField: 'newCluster',
268
+ onComponentUpdate: (value: any) => {
269
+ cluster = value.newCluster;
270
+ moniker = value.moniker;
271
+ },
272
+ component: {
273
+ cluster: 'app-stack-detailOne',
274
+ credentials: 'account-name-one',
275
+ regions: ['region-one'],
276
+ },
277
+ };
278
+
279
+ const expectedMoniker = {
280
+ app: 'my-app',
281
+ cluster: 'app-stack-detailThree',
282
+ detail: 'my-detail',
283
+ stack: 'my-stack',
284
+ sequence: null,
285
+ } as IMoniker;
286
+
287
+ const component = mount<AccountRegionClusterSelector>(
288
+ <AccountRegionClusterSelector {...accountRegionClusterProps} />,
289
+ );
290
+ $scope.$digest();
291
+
292
+ expect(component.state().availableRegions.length).toBe(3, 'number of available regions does not match');
293
+ expect(component.state().availableRegions).toContain('region-one');
294
+ expect(component.state().availableRegions).toContain('region-two');
295
+ expect(component.state().availableRegions).toContain('region-three');
296
+ expect(component.state().clusters.length).toBe(2, 'number of clusters does not match');
297
+ expect(component.state().clusters).toContain('app-stack-detailOne');
298
+ expect(component.state().clusters).toContain('app-stack-detailThree');
299
+
300
+ const clusterSelectComponent = component.find('Select[name="newCluster"] .Select-control input');
301
+ clusterSelectComponent.simulate('mouseDown');
302
+ clusterSelectComponent.simulate('change', { target: { value: 'app-stack-detailThree' } });
303
+ clusterSelectComponent.simulate('keyDown', { keyCode: 9, key: 'Tab' });
304
+ $scope.$digest();
305
+
306
+ expect(cluster).toBe('app-stack-detailThree');
307
+ expect(moniker).toEqual(expectedMoniker);
308
+ });
309
+
310
+ it('the cluster value is updated in the component when cluster is changed to freeform value', () => {
311
+ let cluster = '';
312
+ let moniker: IMoniker = { app: '' };
313
+ const accountRegionClusterProps: IAccountRegionClusterSelectorProps = {
314
+ accounts: [
315
+ {
316
+ accountId: 'account-id-two',
317
+ name: 'account-name-two',
318
+ requiredGroupMembership: [],
319
+ type: 'account-type',
320
+ },
321
+ {
322
+ accountId: 'account-id-one',
323
+ name: 'account-name-one',
324
+ requiredGroupMembership: [],
325
+ type: 'account-type',
326
+ },
327
+ ],
328
+ application,
329
+ cloudProvider: 'cloud-provider',
330
+ clusterField: 'newCluster',
331
+ onComponentUpdate: (value: any) => {
332
+ cluster = value.newCluster;
333
+ moniker = value.moniker;
334
+ },
335
+ component: {
336
+ cluster: 'app-stack-detailOne',
337
+ credentials: 'account-name-one',
338
+ regions: ['region-one'],
339
+ },
340
+ };
341
+
342
+ const component = mount<AccountRegionClusterSelector>(
343
+ <AccountRegionClusterSelector {...accountRegionClusterProps} />,
344
+ );
345
+ $scope.$digest();
346
+
347
+ const clusterSelectComponent = component.find('Select[name="newCluster"] .Select-control input');
348
+ clusterSelectComponent.simulate('mouseDown');
349
+ clusterSelectComponent.simulate('change', { target: { value: 'app-stack-freeform' } });
350
+ clusterSelectComponent.simulate('keyDown', { keyCode: 9, key: 'Tab' });
351
+ $scope.$digest();
352
+
353
+ expect(cluster).toBe('app-stack-freeform');
354
+ expect(moniker).toBeUndefined();
355
+ expect(component.state().clusters).toContain('app-stack-freeform');
356
+ });
357
+
358
+ it('initialize with form names', () => {
359
+ const accountRegionClusterProps: IAccountRegionClusterSelectorProps = {
360
+ accounts: [
361
+ {
362
+ accountId: 'account-id-one',
363
+ name: 'account-name-one',
364
+ requiredGroupMembership: [],
365
+ type: 'account-type',
366
+ },
367
+ ],
368
+ application,
369
+ cloudProvider: 'cloud-provider',
370
+ onComponentUpdate: noop,
371
+ componentName: 'form',
372
+ component: {
373
+ credentials: 'account-name-one',
374
+ regions: ['region-one'],
375
+ },
376
+ };
377
+
378
+ const component = shallow(<AccountRegionClusterSelector {...accountRegionClusterProps} />);
379
+ $scope.$digest();
380
+
381
+ expect(component.find('Select[name="form.credentials"]').length).toBe(1, 'select for account not found');
382
+ expect(component.find('Select[name="form.regions"]').length).toBe(1, 'select for regions not found');
383
+ expect(component.find('StageConfigField [name="form.cluster"]').length).toBe(1, 'select for cluster not found');
384
+ });
385
+ });
@@ -0,0 +1,231 @@
1
+ import { first, isNil, uniq } from 'lodash';
2
+ import React from 'react';
3
+ import type { Option } from 'react-select';
4
+ import Select, { Creatable } from 'react-select';
5
+ import { from as observableFrom, Subject } from 'rxjs';
6
+ import { takeUntil } from 'rxjs/operators';
7
+
8
+ import type { Application, IAccount, IMoniker, IServerGroup, IServerGroupFilter } from '@spinnaker/core';
9
+ import { AppListExtractor, StageConfigField } from '@spinnaker/core';
10
+
11
+ export interface IAccountRegionClusterSelectorProps {
12
+ accounts: IAccount[];
13
+ application: Application;
14
+ cloudProvider: string;
15
+ clusterField?: string;
16
+ component: any;
17
+ componentName?: string;
18
+ isSingleRegion?: boolean;
19
+ onComponentUpdate?: (component: any) => void;
20
+ }
21
+
22
+ export interface IAccountRegionClusterSelectorState {
23
+ [k: string]: any;
24
+
25
+ availableRegions: string[];
26
+ clusterField: string;
27
+ clusters: string[];
28
+ componentName: string;
29
+ }
30
+
31
+ export class AccountRegionClusterSelector extends React.Component<
32
+ IAccountRegionClusterSelectorProps,
33
+ IAccountRegionClusterSelectorState
34
+ > {
35
+ private destroy$ = new Subject();
36
+
37
+ constructor(props: IAccountRegionClusterSelectorProps) {
38
+ super(props);
39
+ const clusterField = props.clusterField || 'cluster';
40
+ this.state = {
41
+ availableRegions: [],
42
+ cloudProvider: props.cloudProvider,
43
+ clusterField: clusterField,
44
+ clusters: [],
45
+ componentName: props.componentName || '',
46
+ [clusterField]: props.component[clusterField],
47
+ };
48
+ }
49
+
50
+ public componentDidMount(): void {
51
+ this.setRegionList(this.props.component.credentials);
52
+ this.setClusterList(
53
+ this.props.component.credentials,
54
+ this.props.isSingleRegion ? [this.props.component.region] : this.props.component.regions,
55
+ );
56
+ }
57
+
58
+ public componentWillUnmount(): void {
59
+ this.destroy$.next();
60
+ }
61
+
62
+ private setRegionList = (credentials: string): void => {
63
+ const { application } = this.props;
64
+ const accountFilter: IServerGroupFilter = (serverGroup: IServerGroup) =>
65
+ serverGroup ? serverGroup.account === credentials : true;
66
+ observableFrom(application.ready())
67
+ .pipe(takeUntil(this.destroy$))
68
+ .subscribe(() => {
69
+ const availableRegions = AppListExtractor.getRegions([application], accountFilter);
70
+ availableRegions.sort();
71
+ this.setState({ availableRegions });
72
+ });
73
+ };
74
+
75
+ private setClusterList = (credentials: string, regions: string[]): void => {
76
+ const { application } = this.props;
77
+ observableFrom(application.ready())
78
+ .pipe(takeUntil(this.destroy$))
79
+ .subscribe(() => {
80
+ const clusterFilter = AppListExtractor.clusterFilterForCredentialsAndRegion(credentials, regions);
81
+ const clusters = AppListExtractor.getClusters([application], clusterFilter);
82
+
83
+ const clusterField = this.props.component[this.state.clusterField];
84
+ if (clusterField && !clusters.includes(clusterField)) {
85
+ clusters.push(clusterField);
86
+ }
87
+ this.setState({ clusters });
88
+ });
89
+ };
90
+
91
+ public onAccountUpdate = (option: Option<string>): void => {
92
+ const credentials = option.value;
93
+ this.setRegionList(credentials);
94
+ this.setClusterList(credentials, []);
95
+ this.props.onComponentUpdate &&
96
+ this.props.onComponentUpdate({
97
+ ...this.props.component,
98
+ credentials,
99
+ region: '',
100
+ regions: [],
101
+ [this.state.clusterField]: undefined,
102
+ });
103
+ };
104
+
105
+ public onRegionsUpdate = (option: Option<string>): void => {
106
+ const regions = option.map((o: Option) => o.value);
107
+ this.setClusterList(this.props.component.credentials, regions);
108
+ this.props.onComponentUpdate &&
109
+ this.props.onComponentUpdate({
110
+ ...this.props.component,
111
+ regions,
112
+ [this.state.clusterField]: undefined,
113
+ });
114
+ };
115
+
116
+ public onRegionUpdate = (option: Option<string>): void => {
117
+ const region = option.value;
118
+ this.setClusterList(this.props.component.credentials, [region]);
119
+ this.props.onComponentUpdate &&
120
+ this.props.onComponentUpdate({
121
+ ...this.props.component,
122
+ region,
123
+ [this.state.clusterField]: undefined,
124
+ });
125
+ };
126
+
127
+ public onClusterUpdate = (option: Option<string>): void => {
128
+ const clusterName = option.value;
129
+ const filterByCluster = AppListExtractor.monikerClusterNameFilter(clusterName);
130
+ const clusterMoniker = first(uniq(AppListExtractor.getMonikers([this.props.application], filterByCluster)));
131
+ let moniker: IMoniker;
132
+
133
+ if (isNil(clusterMoniker)) {
134
+ // remove the moniker from the stage if one doesn't exist.
135
+ moniker = undefined;
136
+ } else {
137
+ // clusters don't contain sequences, so null it out.
138
+ clusterMoniker.sequence = null;
139
+ moniker = clusterMoniker;
140
+ }
141
+
142
+ if (option.className) {
143
+ const clusters = this.state.clusters;
144
+ clusters.push(clusterName);
145
+ this.setState(clusters);
146
+ }
147
+
148
+ this.props.onComponentUpdate &&
149
+ this.props.onComponentUpdate({
150
+ ...this.props.component,
151
+ [this.state.clusterField]: clusterName,
152
+ moniker,
153
+ });
154
+ };
155
+
156
+ public render() {
157
+ const { accounts, isSingleRegion, component } = this.props;
158
+ const { availableRegions, clusters, clusterField, componentName } = this.state;
159
+ return (
160
+ <>
161
+ <StageConfigField label="Account">
162
+ <Select
163
+ name={componentName ? `${componentName}.credentials` : 'credentials'}
164
+ options={
165
+ accounts &&
166
+ accounts.map((acc: IAccount) => ({
167
+ label: acc.name,
168
+ value: acc.name,
169
+ }))
170
+ }
171
+ clearable={false}
172
+ value={component.credentials}
173
+ onChange={this.onAccountUpdate}
174
+ />
175
+ </StageConfigField>
176
+
177
+ {!isSingleRegion && (
178
+ <StageConfigField label="Region">
179
+ <Select
180
+ name={componentName ? `${componentName}.regions` : 'regions'}
181
+ options={
182
+ availableRegions &&
183
+ availableRegions.map((r: string) => ({
184
+ label: r,
185
+ value: r,
186
+ }))
187
+ }
188
+ multi={true}
189
+ clearable={false}
190
+ value={component.regions}
191
+ onChange={this.onRegionsUpdate}
192
+ />
193
+ </StageConfigField>
194
+ )}
195
+ {isSingleRegion && (
196
+ <StageConfigField label="Region">
197
+ <Select
198
+ name={componentName ? `${componentName}.region` : 'region'}
199
+ options={
200
+ availableRegions &&
201
+ availableRegions.map((r: string) => ({
202
+ label: r,
203
+ value: r,
204
+ }))
205
+ }
206
+ multi={false}
207
+ clearable={false}
208
+ value={component.region}
209
+ onChange={this.onRegionUpdate}
210
+ />
211
+ </StageConfigField>
212
+ )}
213
+ <StageConfigField label="Cluster" helpKey={'pipeline.config.findAmi.cluster'}>
214
+ <Creatable
215
+ name={componentName ? `${componentName}.${clusterField}` : `${clusterField}`}
216
+ options={
217
+ clusters &&
218
+ clusters.map((c: string) => ({
219
+ label: c,
220
+ value: c,
221
+ }))
222
+ }
223
+ clearable={false}
224
+ value={component[clusterField]}
225
+ onChange={this.onClusterUpdate}
226
+ />
227
+ </StageConfigField>
228
+ </>
229
+ );
230
+ }
231
+ }