@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,230 @@
1
+ import type { FormikProps } from 'formik';
2
+ import React from 'react';
3
+
4
+ import type { IArtifact, IExpectedArtifact, IPipeline, IStage, IWizardPageComponent } from '@spinnaker/core';
5
+ import { ArtifactTypePatterns, RadioButtonInput, StageArtifactSelector } from '@spinnaker/core';
6
+ import type { ICloudFoundryEnvVar } from '../../../../../domain';
7
+ import {
8
+ Buildpacks,
9
+ EnvironmentVariables,
10
+ FormikConfigField,
11
+ HealthCheck,
12
+ InstanceParameters,
13
+ Routes,
14
+ Services,
15
+ } from '../../../../../presentation';
16
+
17
+ import type {
18
+ ICloudFoundryCreateServerGroupCommand,
19
+ ICloudFoundryManifest,
20
+ } from '../../../serverGroupConfigurationModel.cf';
21
+
22
+ export interface ICloudFoundryServerGroupConfigurationSettingsProps {
23
+ formik: FormikProps<ICloudFoundryCreateServerGroupCommand>;
24
+ stage: IStage;
25
+ pipeline: IPipeline;
26
+ }
27
+
28
+ export class CloudFoundryServerGroupConfigurationSettings
29
+ extends React.Component<ICloudFoundryServerGroupConfigurationSettingsProps>
30
+ implements IWizardPageComponent<ICloudFoundryServerGroupConfigurationSettingsProps> {
31
+ public static LABEL = 'Configuration';
32
+
33
+ private defaultDirectManifest: ICloudFoundryManifest = {
34
+ direct: {
35
+ memory: '1024M',
36
+ diskQuota: '1024M',
37
+ instances: 1,
38
+ buildpacks: [],
39
+ healthCheckType: 'port',
40
+ routes: [],
41
+ environment: [],
42
+ services: [],
43
+ },
44
+ };
45
+
46
+ private excludedArtifactTypePatterns = [
47
+ ArtifactTypePatterns.KUBERNETES,
48
+ ArtifactTypePatterns.DOCKER_IMAGE,
49
+ ArtifactTypePatterns.FRONT50_PIPELINE_TEMPLATE,
50
+ ];
51
+
52
+ private manifestSourceUpdated = (source: string): void => {
53
+ switch (source) {
54
+ case 'artifact':
55
+ this.props.formik.setFieldValue('manifest', {});
56
+ this.capacityUpdated('1');
57
+ break;
58
+ case 'direct':
59
+ this.props.formik.setFieldValue('manifest', this.defaultDirectManifest);
60
+ break;
61
+ }
62
+ };
63
+
64
+ private capacityUpdated = (capacity: string): void => {
65
+ this.props.formik.setFieldValue('capacity.min', capacity);
66
+ this.props.formik.setFieldValue('capacity.max', capacity);
67
+ this.props.formik.setFieldValue('capacity.desired', capacity);
68
+ };
69
+
70
+ private getArtifactInput = (): JSX.Element => {
71
+ const { formik, stage, pipeline } = this.props;
72
+ const manifest = formik.values.manifest;
73
+ return (
74
+ <div className="form-group">
75
+ <div className="col-md-11">
76
+ <div className="StandardFieldLayout flex-container-h margin-between-lg">
77
+ <div className="flex-grow">
78
+ <StageArtifactSelector
79
+ pipeline={pipeline}
80
+ stage={stage}
81
+ expectedArtifactId={manifest && manifest.artifactId}
82
+ artifact={manifest && manifest.artifact}
83
+ onExpectedArtifactSelected={this.onExpectedArtifactSelected}
84
+ onArtifactEdited={this.onArtifactChanged}
85
+ excludedArtifactTypePatterns={this.excludedArtifactTypePatterns}
86
+ renderLabel={(field: React.ReactNode) => {
87
+ return <FormikConfigField label={'Artifact'}>{field}</FormikConfigField>;
88
+ }}
89
+ />
90
+ </div>
91
+ </div>
92
+ </div>
93
+ </div>
94
+ );
95
+ };
96
+
97
+ private onExpectedArtifactSelected = (expectedArtifact: IExpectedArtifact): void => {
98
+ this.props.formik.setFieldValue('manifest', { artifactId: expectedArtifact.id });
99
+ };
100
+
101
+ private onArtifactChanged = (artifact: IArtifact): void => {
102
+ this.props.formik.setFieldValue('manifest', { artifact: artifact });
103
+ };
104
+
105
+ private getDirectInput = (): JSX.Element => {
106
+ const m = this.props.formik.values.manifest.direct;
107
+ return (
108
+ <div>
109
+ {
110
+ <InstanceParameters
111
+ diskQuotaFieldName={'manifest.direct.diskQuota'}
112
+ instancesFieldName={'manifest.direct.instances'}
113
+ memoryFieldName={'manifest.direct.memory'}
114
+ />
115
+ }
116
+ {<Buildpacks fieldName="manifest.direct.buildpacks" />}
117
+ {
118
+ <HealthCheck
119
+ healthCheckHttpEndpointFieldName={'manifest.direct.healthCheckHttpEndpoint'}
120
+ healthCheckType={m.healthCheckType}
121
+ healthCheckTypeFieldName={'manifest.direct.healthCheckType'}
122
+ />
123
+ }
124
+ {<Routes fieldName="manifest.direct.routes" />}
125
+ {<EnvironmentVariables fieldName="manifest.direct.environment" />}
126
+ {<Services fieldName="manifest.direct.services" />}
127
+ </div>
128
+ );
129
+ };
130
+
131
+ public render(): JSX.Element {
132
+ const manifest = this.props.formik.values.manifest;
133
+ const direct = manifest && !!manifest.direct;
134
+ return (
135
+ <>
136
+ <div className="form-group">
137
+ <div className="col-md-11">
138
+ <div className="StandardFieldLayout flex-container-h baseline margin-between-lg">
139
+ <div className="sm-label-right">Source Type</div>
140
+ <div className="flex-grow">
141
+ <RadioButtonInput
142
+ inline={true}
143
+ value={direct ? 'direct' : 'artifact'}
144
+ options={[
145
+ { label: 'Artifact', value: 'artifact' },
146
+ { label: 'Form', value: 'direct' },
147
+ ]}
148
+ onChange={(e: any) => this.manifestSourceUpdated(e.target.value)}
149
+ />
150
+ </div>
151
+ </div>
152
+ </div>
153
+ </div>
154
+ {direct ? this.getDirectInput() : this.getArtifactInput()}
155
+ </>
156
+ );
157
+ }
158
+
159
+ public validate(_props: ICloudFoundryServerGroupConfigurationSettingsProps) {
160
+ const errors = {} as any;
161
+ const isStorageSize = (value: string) => /\d+[MG]/.test(value);
162
+
163
+ if (!this.props.formik.values.manifest) {
164
+ errors.manifest = 'No manifest information provided';
165
+ return errors;
166
+ }
167
+
168
+ const direct = this.props.formik.values.manifest.direct;
169
+ if (direct) {
170
+ if (!isStorageSize(direct.memory)) {
171
+ errors.manifest = errors.manifest || {};
172
+ errors.manifest.memory = `Provide a size (e.g.: 256M, 1G)`;
173
+ }
174
+ if (!isStorageSize(direct.diskQuota)) {
175
+ errors.manifest = errors.manifest || {};
176
+ errors.manifest.diskQuota = `Provide a size (e.g.: 256M, 1G)`;
177
+ }
178
+ if (direct.routes) {
179
+ const routeErrors = direct.routes.map((route: string) => {
180
+ const regex = /^([-\w]+)\.([-.\w]+)(:\d+)?([-/\w]+)?$/gm;
181
+ if (route && regex.exec(route) === null) {
182
+ return `A route did not match the expected format "host.some.domain[:9999][/some/path]"`;
183
+ }
184
+ return null;
185
+ });
186
+ if (routeErrors.some((val: string) => !!val)) {
187
+ errors.manifest = errors.manifest || {};
188
+ errors.manifest.routes = routeErrors;
189
+ }
190
+ }
191
+ if (direct.environment) {
192
+ const existingKeys: string[] = [];
193
+ const envErrors = direct.environment.map((e: ICloudFoundryEnvVar) => {
194
+ let myErrors: any;
195
+ if (e.key) {
196
+ const validKeyRegex = /^\w+$/g;
197
+ if (!validKeyRegex.exec(e.key)) {
198
+ myErrors = {
199
+ key: `This field must be alphanumeric`,
200
+ };
201
+ } else {
202
+ if (existingKeys.filter((key) => key === e.key).length > 0) {
203
+ myErrors = {
204
+ key: `Duplicate variable name`,
205
+ };
206
+ } else {
207
+ existingKeys.push(e.key);
208
+ }
209
+ }
210
+ }
211
+ return myErrors;
212
+ });
213
+ if (envErrors.some((val: string) => !!val)) {
214
+ errors.manifest = errors.manifest || {};
215
+ errors.manifest.environment = envErrors;
216
+ }
217
+ }
218
+ } else {
219
+ const { manifest } = this.props.formik.values;
220
+ if (
221
+ !manifest ||
222
+ !((manifest.artifact && manifest.artifact.type && manifest.artifact.reference) || manifest.artifactId)
223
+ ) {
224
+ errors.manifest = 'Manifest artifact information is required';
225
+ }
226
+ }
227
+
228
+ return errors;
229
+ }
230
+ }
@@ -0,0 +1,3 @@
1
+ .cloudfoundry-react-select {
2
+ width: 100%;
3
+ }
@@ -0,0 +1,60 @@
1
+ import { isEmpty } from 'lodash';
2
+ import { Observable } from 'rxjs';
3
+
4
+ import type { IServerGroupDetailsProps } from '@spinnaker/core';
5
+ import { ServerGroupReader } from '@spinnaker/core';
6
+ import type { ICloudFoundryLoadBalancer, ICloudFoundryServerGroup } from '../../domain';
7
+
8
+ function extractServerGroupSummary(props: IServerGroupDetailsProps): PromiseLike<ICloudFoundryServerGroup> {
9
+ const { app, serverGroup } = props;
10
+ return app.ready().then(() => {
11
+ let summary: ICloudFoundryServerGroup = app.serverGroups.data.find((toCheck: ICloudFoundryServerGroup) => {
12
+ return (
13
+ toCheck.name === serverGroup.name &&
14
+ toCheck.account === serverGroup.accountId &&
15
+ toCheck.region === serverGroup.region
16
+ );
17
+ });
18
+ if (!summary) {
19
+ app.loadBalancers.data.some((loadBalancer: ICloudFoundryLoadBalancer) => {
20
+ if (loadBalancer.account === serverGroup.accountId && loadBalancer.region === serverGroup.region) {
21
+ return loadBalancer.serverGroups.some((possibleServerGroup) => {
22
+ if (possibleServerGroup.name === serverGroup.name) {
23
+ summary = possibleServerGroup;
24
+ return true;
25
+ }
26
+ return false;
27
+ });
28
+ }
29
+ return false;
30
+ });
31
+ }
32
+ return summary;
33
+ });
34
+ }
35
+
36
+ export function cfServerGroupDetailsGetter(
37
+ props: IServerGroupDetailsProps,
38
+ autoClose: () => void,
39
+ ): Observable<ICloudFoundryServerGroup> {
40
+ const { app, serverGroup: serverGroupInfo } = props;
41
+ return new Observable<ICloudFoundryServerGroup>((observer) => {
42
+ extractServerGroupSummary(props).then((summary) => {
43
+ ServerGroupReader.getServerGroup(
44
+ app.name,
45
+ serverGroupInfo.accountId,
46
+ serverGroupInfo.region,
47
+ serverGroupInfo.name,
48
+ ).then((serverGroup: ICloudFoundryServerGroup) => {
49
+ // it's possible the summary was not found because the clusters are still loading
50
+ Object.assign(serverGroup, summary, { account: serverGroupInfo.accountId });
51
+
52
+ if (!isEmpty(serverGroup)) {
53
+ observer.next(serverGroup);
54
+ } else {
55
+ autoClose();
56
+ }
57
+ }, autoClose);
58
+ }, autoClose);
59
+ });
60
+ }
@@ -0,0 +1,365 @@
1
+ import { filter, find, get, orderBy } from 'lodash';
2
+ import React from 'react';
3
+ import { Dropdown, Tooltip } from 'react-bootstrap';
4
+
5
+ import type { IOwnerOption, IServerGroupActionsProps, IServerGroupJob } from '@spinnaker/core';
6
+ import {
7
+ AddEntityTagLinks,
8
+ ClusterTargetBuilder,
9
+ ConfirmationModalService,
10
+ ReactInjector,
11
+ ServerGroupWarningMessageService,
12
+ SETTINGS,
13
+ } from '@spinnaker/core';
14
+
15
+ import { CloudFoundryServerGroupCommandBuilder } from '../configure';
16
+ import { CloudFoundryCreateServerGroupModal } from '../configure/wizard/CreateServerGroupModal';
17
+ import type { ICloudFoundryServerGroup } from '../../domain';
18
+ import { CloudFoundryMapLoadBalancersModal } from './mapLoadBalancers/CloudFoundryMapLoadBalancersModal';
19
+ import { CloudFoundryUnmapLoadBalancersModal } from './mapLoadBalancers/CloudFoundryUnmapLoadBalancersModal';
20
+ import { CloudFoundryResizeServerGroupModal } from './resize/CloudFoundryResizeServerGroupModal';
21
+ import { CloudFoundryRollbackServerGroupModal } from './rollback/CloudFoundryRollbackServerGroupModal';
22
+
23
+ export interface ICloudFoundryServerGroupActionsProps extends IServerGroupActionsProps {
24
+ serverGroup: ICloudFoundryServerGroup;
25
+ }
26
+
27
+ export interface ICloudFoundryServerGroupJob extends IServerGroupJob {
28
+ serverGroupId: string;
29
+ }
30
+
31
+ export class CloudFoundryServerGroupActions extends React.Component<ICloudFoundryServerGroupActionsProps> {
32
+ private isEnableLocked(): boolean {
33
+ if (this.props.serverGroup.isDisabled) {
34
+ const resizeTasks = (this.props.serverGroup.runningTasks || []).filter((task) =>
35
+ get(task, 'execution.stages', []).some((stage) => stage.type === 'resizeServerGroup'),
36
+ );
37
+ if (resizeTasks.length) {
38
+ return true;
39
+ }
40
+ }
41
+ return false;
42
+ }
43
+
44
+ private isRollbackEnabled(): boolean {
45
+ const { app, serverGroup } = this.props;
46
+
47
+ if (!serverGroup.isDisabled) {
48
+ // enabled server groups are always a candidate for rollback
49
+ return true;
50
+ }
51
+
52
+ // if the server group selected for rollback is disabled, ensure that at least one enabled server group exists
53
+ return app
54
+ .getDataSource('serverGroups')
55
+ .data.some(
56
+ (g: ICloudFoundryServerGroup) =>
57
+ g.cluster === serverGroup.cluster &&
58
+ g.region === serverGroup.region &&
59
+ g.account === serverGroup.account &&
60
+ !g.isDisabled,
61
+ );
62
+ }
63
+
64
+ private hasDisabledInstances(): boolean {
65
+ // server group may have disabled instances (out of service) but NOT itself be disabled
66
+ return this.props.serverGroup.isDisabled || get(this.props.serverGroup, 'instanceCounts.outOfService', 0) > 0;
67
+ }
68
+
69
+ private destroyServerGroup = (): void => {
70
+ const { app, serverGroup } = this.props;
71
+
72
+ const stateParams = {
73
+ name: serverGroup.name,
74
+ accountId: serverGroup.account,
75
+ region: serverGroup.region,
76
+ };
77
+
78
+ const taskMonitor = {
79
+ application: app,
80
+ title: 'Destroying ' + serverGroup.name,
81
+ onTaskComplete: () => {
82
+ if (ReactInjector.$state.includes('**.serverGroup', stateParams)) {
83
+ ReactInjector.$state.go('^');
84
+ }
85
+ },
86
+ };
87
+
88
+ const submitMethod = (params: ICloudFoundryServerGroupJob) => {
89
+ params.serverGroupName = serverGroup.name;
90
+ return ReactInjector.serverGroupWriter.destroyServerGroup(serverGroup, app, params);
91
+ };
92
+
93
+ const confirmationModalParams = {
94
+ header: 'Really destroy ' + serverGroup.name + '?',
95
+ buttonText: 'Destroy ' + serverGroup.name,
96
+ account: serverGroup.account,
97
+ taskMonitorConfig: taskMonitor,
98
+ interestingHealthProviderNames: undefined as string[],
99
+ submitMethod,
100
+ askForReason: true,
101
+ platformHealthOnlyShowOverride: app.attributes.platformHealthOnlyShowOverride,
102
+ platformHealthType: 'Cloud Foundry',
103
+ };
104
+
105
+ ServerGroupWarningMessageService.addDestroyWarningMessage(app, serverGroup, confirmationModalParams);
106
+
107
+ if (app.attributes.platformHealthOnlyShowOverride && app.attributes.platformHealthOnly) {
108
+ confirmationModalParams.interestingHealthProviderNames = ['Cloud Foundry'];
109
+ }
110
+
111
+ ConfirmationModalService.confirm(confirmationModalParams);
112
+ };
113
+
114
+ private disableServerGroup = (): void => {
115
+ const { app, serverGroup } = this.props;
116
+ const taskMonitor = {
117
+ application: app,
118
+ title: 'Disabling ' + serverGroup.name,
119
+ };
120
+
121
+ const submitMethod = (params: ICloudFoundryServerGroupJob) => {
122
+ params.serverGroupName = serverGroup.name;
123
+ return ReactInjector.serverGroupWriter.disableServerGroup(serverGroup, app.name, params);
124
+ };
125
+
126
+ const confirmationModalParams = {
127
+ header: 'Really disable ' + serverGroup.name + '?',
128
+ buttonText: 'Disable ' + serverGroup.name,
129
+ account: serverGroup.account,
130
+ interestingHealthProviderNames: undefined as string[],
131
+ taskMonitorConfig: taskMonitor,
132
+ platformHealthOnlyShowOverride: app.attributes.platformHealthOnlyShowOverride,
133
+ platformHealthType: 'Cloud Foundry',
134
+ submitMethod,
135
+ askForReason: true,
136
+ };
137
+
138
+ ServerGroupWarningMessageService.addDisableWarningMessage(app, serverGroup, confirmationModalParams);
139
+
140
+ if (app.attributes.platformHealthOnlyShowOverride && app.attributes.platformHealthOnly) {
141
+ confirmationModalParams.interestingHealthProviderNames = ['Cloud Foundry'];
142
+ }
143
+
144
+ ConfirmationModalService.confirm(confirmationModalParams);
145
+ };
146
+
147
+ private enableServerGroup = (): void => {
148
+ if (!this.isRollbackEnabled()) {
149
+ this.showEnableServerGroupModal();
150
+ return;
151
+ }
152
+
153
+ const confirmationModalParams = {
154
+ header: 'Rolling back?',
155
+ body: `Spinnaker provides an orchestrated rollback feature to carefully restore a different version of this
156
+ server group. Do you want to use the orchestrated rollback?`,
157
+ buttonText: `Yes, let's start the orchestrated rollback`,
158
+ cancelButtonText: 'No, I just want to enable the server group',
159
+ };
160
+
161
+ ConfirmationModalService.confirm(confirmationModalParams)
162
+ .then(() => this.rollbackServerGroup())
163
+ .catch(({ source }) => {
164
+ // don't show the enable modal if the user cancels with the header button
165
+ if (source === 'footer') {
166
+ this.showEnableServerGroupModal();
167
+ }
168
+ });
169
+ };
170
+
171
+ private showEnableServerGroupModal(): void {
172
+ const { app, serverGroup } = this.props;
173
+
174
+ const taskMonitor = {
175
+ application: app,
176
+ title: 'Enabling ' + serverGroup.name,
177
+ };
178
+
179
+ const submitMethod = (params: ICloudFoundryServerGroupJob) => {
180
+ params.serverGroupName = serverGroup.name;
181
+ return ReactInjector.serverGroupWriter.enableServerGroup(serverGroup, app, params);
182
+ };
183
+
184
+ const confirmationModalParams = {
185
+ header: 'Really enable ' + serverGroup.name + '?',
186
+ buttonText: 'Enable ' + serverGroup.name,
187
+ account: serverGroup.account,
188
+ interestingHealthProviderNames: undefined as string[],
189
+ taskMonitorConfig: taskMonitor,
190
+ platformHealthOnlyShowOverride: app.attributes.platformHealthOnlyShowOverride,
191
+ platformHealthType: 'Cloud Foundry',
192
+ submitMethod,
193
+ askForReason: true,
194
+ };
195
+
196
+ if (app.attributes.platformHealthOnlyShowOverride && app.attributes.platformHealthOnly) {
197
+ confirmationModalParams.interestingHealthProviderNames = ['Cloud Foundry'];
198
+ }
199
+
200
+ ConfirmationModalService.confirm(confirmationModalParams);
201
+ }
202
+
203
+ private rollbackServerGroup = (): void => {
204
+ const { app } = this.props;
205
+
206
+ let serverGroup: ICloudFoundryServerGroup = this.props.serverGroup;
207
+ let previousServerGroup: ICloudFoundryServerGroup;
208
+ let allServerGroups = (app.serverGroups.data as ICloudFoundryServerGroup[]).filter(
209
+ (g) => g.cluster === serverGroup.cluster && g.region === serverGroup.region && g.account === serverGroup.account,
210
+ );
211
+
212
+ if (serverGroup.isDisabled) {
213
+ // if the selected server group is disabled, it represents the server group that should be _rolled back to_
214
+ previousServerGroup = serverGroup;
215
+
216
+ /*
217
+ * Find an existing server group to rollback, prefer the largest enabled server group.
218
+ *
219
+ * isRollbackEnabled() ensures that at least one enabled server group exists.
220
+ */
221
+ serverGroup = orderBy(
222
+ allServerGroups.filter((g: ICloudFoundryServerGroup) => g.name !== previousServerGroup.name && !g.isDisabled),
223
+ ['instanceCounts.total', 'createdTime'],
224
+ ['desc', 'desc'],
225
+ )[0] as ICloudFoundryServerGroup;
226
+ }
227
+
228
+ // the set of all server groups should not include the server group selected for rollback
229
+ allServerGroups = allServerGroups.filter((g) => g.name !== serverGroup.name);
230
+
231
+ if (allServerGroups.length === 1 && !previousServerGroup) {
232
+ // if there is only one other server group, default to it being the rollback target
233
+ previousServerGroup = allServerGroups[0];
234
+ }
235
+ const cluster = find(app.clusters, {
236
+ name: serverGroup.cluster,
237
+ account: serverGroup.account,
238
+ serverGroups: [],
239
+ });
240
+ const disabledServerGroups: ICloudFoundryServerGroup[] = filter(cluster.serverGroups, {
241
+ isDisabled: true,
242
+ region: serverGroup.region,
243
+ }) as ICloudFoundryServerGroup[];
244
+
245
+ CloudFoundryRollbackServerGroupModal.show({
246
+ serverGroup,
247
+ previousServerGroup,
248
+ disabledServerGroups: disabledServerGroups.sort((a, b) => b.name.localeCompare(a.name)),
249
+ allServerGroups: allServerGroups.sort((a, b) => b.name.localeCompare(a.name)),
250
+ application: app,
251
+ });
252
+ };
253
+
254
+ private resizeServerGroup = (): void => {
255
+ const { app, serverGroup } = this.props;
256
+ CloudFoundryResizeServerGroupModal.show({ application: app, serverGroup });
257
+ };
258
+
259
+ private mapServerGroupToLoadBalancers = (): void => {
260
+ const { app, serverGroup } = this.props;
261
+ CloudFoundryMapLoadBalancersModal.show({ application: app, serverGroup });
262
+ };
263
+
264
+ private unmapServerGroupFromLoadBalancers = (): void => {
265
+ const { app, serverGroup } = this.props;
266
+ CloudFoundryUnmapLoadBalancersModal.show({ application: app, serverGroup });
267
+ };
268
+
269
+ private cloneServerGroup = (): void => {
270
+ const { app, serverGroup } = this.props;
271
+ const command = CloudFoundryServerGroupCommandBuilder.buildServerGroupCommandFromExisting(app, serverGroup);
272
+ const title = `Clone ${serverGroup.name}`;
273
+ CloudFoundryCreateServerGroupModal.show({
274
+ application: app,
275
+ command,
276
+ isSourceConstant: true,
277
+ serverGroup,
278
+ title,
279
+ });
280
+ };
281
+
282
+ public render(): JSX.Element {
283
+ const { app, serverGroup } = this.props;
284
+ const { loadBalancers } = serverGroup;
285
+ const showEntityTags = SETTINGS.feature && SETTINGS.feature.entityTags;
286
+ const entityTagTargets: IOwnerOption[] = ClusterTargetBuilder.buildClusterTargets(serverGroup);
287
+
288
+ return (
289
+ <Dropdown className="dropdown" id="server-group-actions-dropdown">
290
+ <Dropdown.Toggle className="btn btn-sm btn-primary dropdown-toggle">Server Group Actions</Dropdown.Toggle>
291
+ <Dropdown.Menu className="dropdown-menu">
292
+ {this.isRollbackEnabled() && (
293
+ <li>
294
+ <a className="clickable" onClick={this.rollbackServerGroup}>
295
+ Rollback
296
+ </a>
297
+ </li>
298
+ )}
299
+ {this.isRollbackEnabled() && <li role="presentation" className="divider" />}
300
+ <li>
301
+ <a className="clickable" onClick={this.resizeServerGroup}>
302
+ Resize
303
+ </a>
304
+ </li>
305
+ {!serverGroup.isDisabled && (
306
+ <li>
307
+ <a className="clickable" onClick={this.disableServerGroup}>
308
+ Disable
309
+ </a>
310
+ </li>
311
+ )}
312
+ {this.hasDisabledInstances() && !this.isEnableLocked() && (
313
+ <li>
314
+ <a className="clickable" onClick={this.enableServerGroup}>
315
+ Enable
316
+ </a>
317
+ </li>
318
+ )}
319
+ {this.isEnableLocked() && (
320
+ <li className="disabled">
321
+ <Tooltip value="Cannot enable this server group until resize operation completes" placement="left">
322
+ <a>
323
+ <span className="small glyphicon glyphicon-lock" /> Enable
324
+ </a>
325
+ </Tooltip>
326
+ </li>
327
+ )}
328
+ <li>
329
+ <a className="clickable" onClick={this.destroyServerGroup}>
330
+ Destroy
331
+ </a>
332
+ </li>
333
+ <li>
334
+ <a className="clickable" onClick={this.cloneServerGroup}>
335
+ Clone
336
+ </a>
337
+ </li>
338
+ {!serverGroup.isDisabled && (
339
+ <li>
340
+ <a className="clickable" onClick={this.mapServerGroupToLoadBalancers}>
341
+ Map Load Balancer
342
+ </a>
343
+ </li>
344
+ )}
345
+ {!serverGroup.isDisabled && loadBalancers && !!loadBalancers.length && (
346
+ <li>
347
+ <a className="clickable" onClick={this.unmapServerGroupFromLoadBalancers}>
348
+ Unmap Load Balancer
349
+ </a>
350
+ </li>
351
+ )}
352
+ {showEntityTags && (
353
+ <AddEntityTagLinks
354
+ component={serverGroup}
355
+ application={app}
356
+ entityType="serverGroup"
357
+ ownerOptions={entityTagTargets}
358
+ onUpdate={() => app.serverGroups.refresh()}
359
+ />
360
+ )}
361
+ </Dropdown.Menu>
362
+ </Dropdown>
363
+ );
364
+ }
365
+ }