@flightctl/ui-components 1.1.0-rc1 → 1.1.0-rc3

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 (306) hide show
  1. package/dist/src/components/Repository/CreateRepository/CreateRepositoryForm.css +5 -1
  2. package/dist/types/imagebuilder/index.d.ts +2 -0
  3. package/dist/types/imagebuilder/index.d.ts.map +1 -1
  4. package/dist/types/imagebuilder/index.js +3 -1
  5. package/dist/types/imagebuilder/index.js.map +1 -1
  6. package/dist/types/imagebuilder/models/ApiVersion.d.ts +8 -0
  7. package/dist/types/imagebuilder/models/ApiVersion.d.ts.map +1 -0
  8. package/dist/types/imagebuilder/models/ApiVersion.js +16 -0
  9. package/dist/types/imagebuilder/models/ApiVersion.js.map +1 -0
  10. package/dist/types/imagebuilder/models/ImageBuild.d.ts +2 -4
  11. package/dist/types/imagebuilder/models/ImageBuild.d.ts.map +1 -1
  12. package/dist/types/imagebuilder/models/ImageBuildList.d.ts +2 -4
  13. package/dist/types/imagebuilder/models/ImageBuildList.d.ts.map +1 -1
  14. package/dist/types/imagebuilder/models/ImageExport.d.ts +2 -4
  15. package/dist/types/imagebuilder/models/ImageExport.d.ts.map +1 -1
  16. package/dist/types/imagebuilder/models/ImageExportList.d.ts +2 -4
  17. package/dist/types/imagebuilder/models/ImageExportList.d.ts.map +1 -1
  18. package/dist/types/imagebuilder/models/Status.d.ts +28 -0
  19. package/dist/types/imagebuilder/models/Status.d.ts.map +1 -0
  20. package/dist/types/imagebuilder/models/Status.js +3 -0
  21. package/dist/types/imagebuilder/models/Status.js.map +1 -0
  22. package/dist/types/index.d.ts +8 -0
  23. package/dist/types/index.d.ts.map +1 -1
  24. package/dist/types/index.js +3 -1
  25. package/dist/types/index.js.map +1 -1
  26. package/dist/types/models/ApiVersion.d.ts +9 -0
  27. package/dist/types/models/ApiVersion.d.ts.map +1 -0
  28. package/dist/types/models/ApiVersion.js +17 -0
  29. package/dist/types/models/ApiVersion.js.map +1 -0
  30. package/dist/types/models/ApplicationProviderBase.d.ts +12 -0
  31. package/dist/types/models/ApplicationProviderBase.d.ts.map +1 -0
  32. package/dist/types/models/ApplicationProviderBase.js +3 -0
  33. package/dist/types/models/ApplicationProviderBase.js.map +1 -0
  34. package/dist/types/models/ApplicationProviderSpec.d.ts +5 -15
  35. package/dist/types/models/ApplicationProviderSpec.d.ts.map +1 -1
  36. package/dist/types/models/ApplicationUser.d.ts +7 -0
  37. package/dist/types/models/ApplicationUser.d.ts.map +1 -0
  38. package/dist/types/models/ApplicationUser.js +3 -0
  39. package/dist/types/models/ApplicationUser.js.map +1 -0
  40. package/dist/types/models/AuthConfig.d.ts +2 -4
  41. package/dist/types/models/AuthConfig.d.ts.map +1 -1
  42. package/dist/types/models/AuthProvider.d.ts +2 -4
  43. package/dist/types/models/AuthProvider.d.ts.map +1 -1
  44. package/dist/types/models/AuthProviderList.d.ts +2 -4
  45. package/dist/types/models/AuthProviderList.d.ts.map +1 -1
  46. package/dist/types/models/CertificateSigningRequest.d.ts +2 -4
  47. package/dist/types/models/CertificateSigningRequest.d.ts.map +1 -1
  48. package/dist/types/models/CertificateSigningRequestList.d.ts +2 -4
  49. package/dist/types/models/CertificateSigningRequestList.d.ts.map +1 -1
  50. package/dist/types/models/ComposeApplication.d.ts +7 -0
  51. package/dist/types/models/ComposeApplication.d.ts.map +1 -0
  52. package/dist/types/models/ComposeApplication.js +3 -0
  53. package/dist/types/models/ComposeApplication.js.map +1 -0
  54. package/dist/types/models/ContainerApplication.d.ts +18 -0
  55. package/dist/types/models/ContainerApplication.d.ts.map +1 -0
  56. package/dist/types/models/ContainerApplication.js +3 -0
  57. package/dist/types/models/ContainerApplication.js.map +1 -0
  58. package/dist/types/models/ContainerApplicationProperties.d.ts +13 -0
  59. package/dist/types/models/ContainerApplicationProperties.d.ts.map +1 -0
  60. package/dist/types/models/ContainerApplicationProperties.js +3 -0
  61. package/dist/types/models/ContainerApplicationProperties.js.map +1 -0
  62. package/dist/types/models/Device.d.ts +2 -4
  63. package/dist/types/models/Device.d.ts.map +1 -1
  64. package/dist/types/models/DeviceList.d.ts +2 -4
  65. package/dist/types/models/DeviceList.d.ts.map +1 -1
  66. package/dist/types/models/EnrollmentRequest.d.ts +2 -4
  67. package/dist/types/models/EnrollmentRequest.d.ts.map +1 -1
  68. package/dist/types/models/EnrollmentRequestList.d.ts +2 -4
  69. package/dist/types/models/EnrollmentRequestList.d.ts.map +1 -1
  70. package/dist/types/models/Event.d.ts +2 -4
  71. package/dist/types/models/Event.d.ts.map +1 -1
  72. package/dist/types/models/Event.js.map +1 -1
  73. package/dist/types/models/EventList.d.ts +2 -4
  74. package/dist/types/models/EventList.d.ts.map +1 -1
  75. package/dist/types/models/Fleet.d.ts +2 -4
  76. package/dist/types/models/Fleet.d.ts.map +1 -1
  77. package/dist/types/models/FleetList.d.ts +2 -4
  78. package/dist/types/models/FleetList.d.ts.map +1 -1
  79. package/dist/types/models/HelmApplication.d.ts +20 -0
  80. package/dist/types/models/HelmApplication.d.ts.map +1 -0
  81. package/dist/types/models/HelmApplication.js +3 -0
  82. package/dist/types/models/HelmApplication.js.map +1 -0
  83. package/dist/types/models/ImageApplicationProviderSpec.d.ts +2 -22
  84. package/dist/types/models/ImageApplicationProviderSpec.d.ts.map +1 -1
  85. package/dist/types/models/InlineApplicationProviderSpec.d.ts +2 -3
  86. package/dist/types/models/InlineApplicationProviderSpec.d.ts.map +1 -1
  87. package/dist/types/models/Organization.d.ts +2 -4
  88. package/dist/types/models/Organization.d.ts.map +1 -1
  89. package/dist/types/models/OrganizationList.d.ts +2 -4
  90. package/dist/types/models/OrganizationList.d.ts.map +1 -1
  91. package/dist/types/models/QuadletApplication.d.ts +8 -0
  92. package/dist/types/models/QuadletApplication.d.ts.map +1 -0
  93. package/dist/types/models/QuadletApplication.js +3 -0
  94. package/dist/types/models/QuadletApplication.js.map +1 -0
  95. package/dist/types/models/Repository.d.ts +2 -4
  96. package/dist/types/models/Repository.d.ts.map +1 -1
  97. package/dist/types/models/RepositoryList.d.ts +2 -4
  98. package/dist/types/models/RepositoryList.d.ts.map +1 -1
  99. package/dist/types/models/ResourceSync.d.ts +2 -4
  100. package/dist/types/models/ResourceSync.d.ts.map +1 -1
  101. package/dist/types/models/ResourceSyncList.d.ts +2 -4
  102. package/dist/types/models/ResourceSyncList.d.ts.map +1 -1
  103. package/dist/types/models/Status.d.ts +2 -4
  104. package/dist/types/models/Status.d.ts.map +1 -1
  105. package/dist/types/models/TemplateVersion.d.ts +2 -4
  106. package/dist/types/models/TemplateVersion.d.ts.map +1 -1
  107. package/dist/types/models/TemplateVersionList.d.ts +2 -4
  108. package/dist/types/models/TemplateVersionList.d.ts.map +1 -1
  109. package/dist/ui-components/src/components/AuthProvider/CreateAuthProvider/utils.d.ts.map +1 -1
  110. package/dist/ui-components/src/components/AuthProvider/CreateAuthProvider/utils.js +51 -51
  111. package/dist/ui-components/src/components/AuthProvider/CreateAuthProvider/utils.js.map +1 -1
  112. package/dist/ui-components/src/components/DetailsPage/Tables/ApplicationsTable.js +1 -1
  113. package/dist/ui-components/src/components/DetailsPage/Tables/ApplicationsTable.js.map +1 -1
  114. package/dist/ui-components/src/components/Device/DeviceDetails/DeviceDetailsPage.d.ts.map +1 -1
  115. package/dist/ui-components/src/components/Device/DeviceDetails/DeviceDetailsPage.js +5 -4
  116. package/dist/ui-components/src/components/Device/DeviceDetails/DeviceDetailsPage.js.map +1 -1
  117. package/dist/ui-components/src/components/Device/DeviceDetails/TerminalTab.d.ts.map +1 -1
  118. package/dist/ui-components/src/components/Device/DeviceDetails/TerminalTab.js +5 -1
  119. package/dist/ui-components/src/components/Device/DeviceDetails/TerminalTab.js.map +1 -1
  120. package/dist/ui-components/src/components/Device/EditDeviceWizard/deviceSpecUtils.d.ts +3 -3
  121. package/dist/ui-components/src/components/Device/EditDeviceWizard/deviceSpecUtils.d.ts.map +1 -1
  122. package/dist/ui-components/src/components/Device/EditDeviceWizard/deviceSpecUtils.js +310 -363
  123. package/dist/ui-components/src/components/Device/EditDeviceWizard/deviceSpecUtils.js.map +1 -1
  124. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationContainerForm.d.ts +1 -3
  125. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationContainerForm.d.ts.map +1 -1
  126. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationContainerForm.js +18 -19
  127. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationContainerForm.js.map +1 -1
  128. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationHelmForm.d.ts +1 -3
  129. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationHelmForm.d.ts.map +1 -1
  130. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationHelmForm.js +5 -4
  131. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationHelmForm.js.map +1 -1
  132. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationImageForm.d.ts +1 -3
  133. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationImageForm.d.ts.map +1 -1
  134. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationImageForm.js +2 -2
  135. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationImageForm.js.map +1 -1
  136. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationInlineForm.d.ts +3 -3
  137. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationInlineForm.d.ts.map +1 -1
  138. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationInlineForm.js +20 -23
  139. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationInlineForm.js.map +1 -1
  140. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationIntegritySettings.js +3 -3
  141. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationIntegritySettings.js.map +1 -1
  142. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationTemplates.d.ts.map +1 -1
  143. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationTemplates.js +25 -45
  144. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationTemplates.js.map +1 -1
  145. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationVariablesForm.d.ts +8 -0
  146. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationVariablesForm.d.ts.map +1 -0
  147. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationVariablesForm.js +37 -0
  148. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationVariablesForm.js.map +1 -0
  149. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationVolumeForm.d.ts +1 -3
  150. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationVolumeForm.d.ts.map +1 -1
  151. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationVolumeForm.js +5 -8
  152. package/dist/ui-components/src/components/Device/EditDeviceWizard/steps/ApplicationVolumeForm.js.map +1 -1
  153. package/dist/ui-components/src/components/Device/EditDeviceWizard/utils.d.ts +18 -18
  154. package/dist/ui-components/src/components/ErrorAlert/ErrorAlert.d.ts +4 -2
  155. package/dist/ui-components/src/components/ErrorAlert/ErrorAlert.d.ts.map +1 -1
  156. package/dist/ui-components/src/components/ErrorAlert/ErrorAlert.js +2 -2
  157. package/dist/ui-components/src/components/ErrorAlert/ErrorAlert.js.map +1 -1
  158. package/dist/ui-components/src/components/Fleet/CreateFleet/utils.d.ts +1 -1
  159. package/dist/ui-components/src/components/Fleet/CreateFleet/utils.d.ts.map +1 -1
  160. package/dist/ui-components/src/components/Fleet/CreateFleet/utils.js +3 -3
  161. package/dist/ui-components/src/components/Fleet/CreateFleet/utils.js.map +1 -1
  162. package/dist/ui-components/src/components/Fleet/ImportFleetWizard/steps/RepositoryStep.d.ts.map +1 -1
  163. package/dist/ui-components/src/components/Fleet/ImportFleetWizard/steps/RepositoryStep.js +3 -1
  164. package/dist/ui-components/src/components/Fleet/ImportFleetWizard/steps/RepositoryStep.js.map +1 -1
  165. package/dist/ui-components/src/components/ImageBuilds/CancelImageBuildModal/CancelImageBuildModal.d.ts +7 -0
  166. package/dist/ui-components/src/components/ImageBuilds/CancelImageBuildModal/CancelImageBuildModal.d.ts.map +1 -0
  167. package/dist/ui-components/src/components/ImageBuilds/CancelImageBuildModal/CancelImageBuildModal.js +40 -0
  168. package/dist/ui-components/src/components/ImageBuilds/CancelImageBuildModal/CancelImageBuildModal.js.map +1 -0
  169. package/dist/ui-components/src/components/ImageBuilds/ConfirmImageExportModal/ConfirmImageExportModal.d.ts +8 -0
  170. package/dist/ui-components/src/components/ImageBuilds/ConfirmImageExportModal/ConfirmImageExportModal.d.ts.map +1 -0
  171. package/dist/ui-components/src/components/ImageBuilds/ConfirmImageExportModal/ConfirmImageExportModal.js +37 -0
  172. package/dist/ui-components/src/components/ImageBuilds/ConfirmImageExportModal/ConfirmImageExportModal.js.map +1 -0
  173. package/dist/ui-components/src/components/ImageBuilds/CreateImageBuildWizard/CreateImageBuildWizard.d.ts.map +1 -1
  174. package/dist/ui-components/src/components/ImageBuilds/CreateImageBuildWizard/CreateImageBuildWizard.js +4 -3
  175. package/dist/ui-components/src/components/ImageBuilds/CreateImageBuildWizard/CreateImageBuildWizard.js.map +1 -1
  176. package/dist/ui-components/src/components/ImageBuilds/CreateImageBuildWizard/steps/OutputImageStep.js +1 -1
  177. package/dist/ui-components/src/components/ImageBuilds/CreateImageBuildWizard/steps/OutputImageStep.js.map +1 -1
  178. package/dist/ui-components/src/components/ImageBuilds/CreateImageBuildWizard/steps/RegistrationStep.d.ts.map +1 -1
  179. package/dist/ui-components/src/components/ImageBuilds/CreateImageBuildWizard/steps/RegistrationStep.js +13 -10
  180. package/dist/ui-components/src/components/ImageBuilds/CreateImageBuildWizard/steps/RegistrationStep.js.map +1 -1
  181. package/dist/ui-components/src/components/ImageBuilds/CreateImageBuildWizard/steps/ReviewStep.d.ts.map +1 -1
  182. package/dist/ui-components/src/components/ImageBuilds/CreateImageBuildWizard/steps/ReviewStep.js +4 -2
  183. package/dist/ui-components/src/components/ImageBuilds/CreateImageBuildWizard/steps/ReviewStep.js.map +1 -1
  184. package/dist/ui-components/src/components/ImageBuilds/CreateImageBuildWizard/steps/SourceImageStep.d.ts.map +1 -1
  185. package/dist/ui-components/src/components/ImageBuilds/CreateImageBuildWizard/steps/SourceImageStep.js +7 -1
  186. package/dist/ui-components/src/components/ImageBuilds/CreateImageBuildWizard/steps/SourceImageStep.js.map +1 -1
  187. package/dist/ui-components/src/components/ImageBuilds/CreateImageBuildWizard/types.d.ts +3 -5
  188. package/dist/ui-components/src/components/ImageBuilds/CreateImageBuildWizard/types.d.ts.map +1 -1
  189. package/dist/ui-components/src/components/ImageBuilds/CreateImageBuildWizard/utils.d.ts +3 -2
  190. package/dist/ui-components/src/components/ImageBuilds/CreateImageBuildWizard/utils.d.ts.map +1 -1
  191. package/dist/ui-components/src/components/ImageBuilds/CreateImageBuildWizard/utils.js +139 -34
  192. package/dist/ui-components/src/components/ImageBuilds/CreateImageBuildWizard/utils.js.map +1 -1
  193. package/dist/ui-components/src/components/ImageBuilds/ImageBuildDetails/ImageBuildDetailsPage.d.ts.map +1 -1
  194. package/dist/ui-components/src/components/ImageBuilds/ImageBuildDetails/ImageBuildDetailsPage.js +23 -12
  195. package/dist/ui-components/src/components/ImageBuilds/ImageBuildDetails/ImageBuildDetailsPage.js.map +1 -1
  196. package/dist/ui-components/src/components/ImageBuilds/ImageBuildDetails/ImageBuildExportsGallery.d.ts.map +1 -1
  197. package/dist/ui-components/src/components/ImageBuilds/ImageBuildDetails/ImageBuildExportsGallery.js +115 -39
  198. package/dist/ui-components/src/components/ImageBuilds/ImageBuildDetails/ImageBuildExportsGallery.js.map +1 -1
  199. package/dist/ui-components/src/components/ImageBuilds/ImageBuildDetails/ImageBuildLogsTab.d.ts +1 -0
  200. package/dist/ui-components/src/components/ImageBuilds/ImageBuildDetails/ImageBuildLogsTab.d.ts.map +1 -1
  201. package/dist/ui-components/src/components/ImageBuilds/ImageBuildDetails/ImageBuildLogsTab.js +17 -18
  202. package/dist/ui-components/src/components/ImageBuilds/ImageBuildDetails/ImageBuildLogsTab.js.map +1 -1
  203. package/dist/ui-components/src/components/ImageBuilds/ImageBuildRow.d.ts +5 -2
  204. package/dist/ui-components/src/components/ImageBuilds/ImageBuildRow.d.ts.map +1 -1
  205. package/dist/ui-components/src/components/ImageBuilds/ImageBuildRow.js +22 -12
  206. package/dist/ui-components/src/components/ImageBuilds/ImageBuildRow.js.map +1 -1
  207. package/dist/ui-components/src/components/ImageBuilds/ImageBuildsPage.d.ts.map +1 -1
  208. package/dist/ui-components/src/components/ImageBuilds/ImageBuildsPage.js +17 -8
  209. package/dist/ui-components/src/components/ImageBuilds/ImageBuildsPage.js.map +1 -1
  210. package/dist/ui-components/src/components/ImageBuilds/ImageExportCards.d.ts +10 -9
  211. package/dist/ui-components/src/components/ImageBuilds/ImageExportCards.d.ts.map +1 -1
  212. package/dist/ui-components/src/components/ImageBuilds/ImageExportCards.js +122 -26
  213. package/dist/ui-components/src/components/ImageBuilds/ImageExportCards.js.map +1 -1
  214. package/dist/ui-components/src/components/Repository/CreateRepository/CreateRepositoryForm.d.ts +2 -1
  215. package/dist/ui-components/src/components/Repository/CreateRepository/CreateRepositoryForm.d.ts.map +1 -1
  216. package/dist/ui-components/src/components/Repository/CreateRepository/CreateRepositoryForm.js +10 -4
  217. package/dist/ui-components/src/components/Repository/CreateRepository/CreateRepositoryForm.js.map +1 -1
  218. package/dist/ui-components/src/components/Repository/CreateRepository/utils.d.ts.map +1 -1
  219. package/dist/ui-components/src/components/Repository/CreateRepository/utils.js +3 -4
  220. package/dist/ui-components/src/components/Repository/CreateRepository/utils.js.map +1 -1
  221. package/dist/ui-components/src/components/form/RepositorySelect.d.ts.map +1 -1
  222. package/dist/ui-components/src/components/form/RepositorySelect.js +1 -1
  223. package/dist/ui-components/src/components/form/RepositorySelect.js.map +1 -1
  224. package/dist/ui-components/src/components/form/UploadField.d.ts.map +1 -1
  225. package/dist/ui-components/src/components/form/UploadField.js +25 -16
  226. package/dist/ui-components/src/components/form/UploadField.js.map +1 -1
  227. package/dist/ui-components/src/components/form/validations.d.ts +25 -18
  228. package/dist/ui-components/src/components/form/validations.d.ts.map +1 -1
  229. package/dist/ui-components/src/components/form/validations.js +79 -33
  230. package/dist/ui-components/src/components/form/validations.js.map +1 -1
  231. package/dist/ui-components/src/components/modals/CreateRepositoryModal/CreateRepositoryModal.d.ts +2 -1
  232. package/dist/ui-components/src/components/modals/CreateRepositoryModal/CreateRepositoryModal.d.ts.map +1 -1
  233. package/dist/ui-components/src/components/modals/CreateRepositoryModal/CreateRepositoryModal.js +2 -2
  234. package/dist/ui-components/src/components/modals/CreateRepositoryModal/CreateRepositoryModal.js.map +1 -1
  235. package/dist/ui-components/src/constants.d.ts +5 -6
  236. package/dist/ui-components/src/constants.d.ts.map +1 -1
  237. package/dist/ui-components/src/constants.js +19 -11
  238. package/dist/ui-components/src/constants.js.map +1 -1
  239. package/dist/ui-components/src/hooks/useWebSocket.d.ts.map +1 -1
  240. package/dist/ui-components/src/hooks/useWebSocket.js +25 -4
  241. package/dist/ui-components/src/hooks/useWebSocket.js.map +1 -1
  242. package/dist/ui-components/src/types/deviceSpec.d.ts +44 -76
  243. package/dist/ui-components/src/types/deviceSpec.d.ts.map +1 -1
  244. package/dist/ui-components/src/types/deviceSpec.js +13 -26
  245. package/dist/ui-components/src/types/deviceSpec.js.map +1 -1
  246. package/dist/ui-components/src/types/extraTypes.d.ts +1 -7
  247. package/dist/ui-components/src/types/extraTypes.d.ts.map +1 -1
  248. package/dist/ui-components/src/types/extraTypes.js.map +1 -1
  249. package/dist/ui-components/src/types/rbac.d.ts +7 -1
  250. package/dist/ui-components/src/types/rbac.d.ts.map +1 -1
  251. package/dist/ui-components/src/types/rbac.js +6 -0
  252. package/dist/ui-components/src/types/rbac.js.map +1 -1
  253. package/dist/ui-components/src/utils/imageBuilds.d.ts +1 -0
  254. package/dist/ui-components/src/utils/imageBuilds.d.ts.map +1 -1
  255. package/dist/ui-components/src/utils/imageBuilds.js +20 -29
  256. package/dist/ui-components/src/utils/imageBuilds.js.map +1 -1
  257. package/dist/ui-components/src/utils/search.d.ts +2 -1
  258. package/dist/ui-components/src/utils/search.d.ts.map +1 -1
  259. package/dist/ui-components/src/utils/search.js +2 -2
  260. package/dist/ui-components/src/utils/search.js.map +1 -1
  261. package/package.json +2 -2
  262. package/src/components/AuthProvider/CreateAuthProvider/utils.ts +2 -2
  263. package/src/components/DetailsPage/Tables/ApplicationsTable.tsx +2 -2
  264. package/src/components/Device/DeviceDetails/DeviceDetailsPage.tsx +10 -4
  265. package/src/components/Device/DeviceDetails/TerminalTab.tsx +9 -1
  266. package/src/components/Device/EditDeviceWizard/deviceSpecUtils.ts +361 -425
  267. package/src/components/Device/EditDeviceWizard/steps/ApplicationContainerForm.tsx +19 -29
  268. package/src/components/Device/EditDeviceWizard/steps/ApplicationHelmForm.tsx +5 -13
  269. package/src/components/Device/EditDeviceWizard/steps/ApplicationImageForm.tsx +2 -16
  270. package/src/components/Device/EditDeviceWizard/steps/ApplicationInlineForm.tsx +8 -7
  271. package/src/components/Device/EditDeviceWizard/steps/ApplicationIntegritySettings.tsx +5 -5
  272. package/src/components/Device/EditDeviceWizard/steps/ApplicationTemplates.tsx +29 -101
  273. package/src/components/Device/EditDeviceWizard/steps/ApplicationVariablesForm.tsx +87 -0
  274. package/src/components/Device/EditDeviceWizard/steps/ApplicationVolumeForm.tsx +5 -10
  275. package/src/components/ErrorAlert/ErrorAlert.tsx +13 -3
  276. package/src/components/Fleet/CreateFleet/utils.ts +4 -5
  277. package/src/components/Fleet/ImportFleetWizard/steps/RepositoryStep.tsx +11 -8
  278. package/src/components/ImageBuilds/CancelImageBuildModal/CancelImageBuildModal.tsx +81 -0
  279. package/src/components/ImageBuilds/ConfirmImageExportModal/ConfirmImageExportModal.tsx +61 -0
  280. package/src/components/ImageBuilds/CreateImageBuildWizard/CreateImageBuildWizard.tsx +8 -3
  281. package/src/components/ImageBuilds/CreateImageBuildWizard/steps/OutputImageStep.tsx +1 -1
  282. package/src/components/ImageBuilds/CreateImageBuildWizard/steps/RegistrationStep.tsx +18 -10
  283. package/src/components/ImageBuilds/CreateImageBuildWizard/steps/ReviewStep.tsx +5 -1
  284. package/src/components/ImageBuilds/CreateImageBuildWizard/steps/SourceImageStep.tsx +13 -1
  285. package/src/components/ImageBuilds/CreateImageBuildWizard/types.ts +3 -6
  286. package/src/components/ImageBuilds/CreateImageBuildWizard/utils.ts +161 -37
  287. package/src/components/ImageBuilds/ImageBuildDetails/ImageBuildDetailsPage.tsx +36 -17
  288. package/src/components/ImageBuilds/ImageBuildDetails/ImageBuildExportsGallery.tsx +131 -44
  289. package/src/components/ImageBuilds/ImageBuildDetails/ImageBuildLogsTab.tsx +22 -26
  290. package/src/components/ImageBuilds/ImageBuildRow.tsx +41 -20
  291. package/src/components/ImageBuilds/ImageBuildsPage.tsx +34 -15
  292. package/src/components/ImageBuilds/ImageExportCards.tsx +198 -80
  293. package/src/components/Repository/CreateRepository/CreateRepositoryForm.css +5 -1
  294. package/src/components/Repository/CreateRepository/CreateRepositoryForm.tsx +14 -4
  295. package/src/components/Repository/CreateRepository/utils.ts +4 -4
  296. package/src/components/form/RepositorySelect.tsx +1 -0
  297. package/src/components/form/UploadField.tsx +29 -30
  298. package/src/components/form/validations.ts +156 -106
  299. package/src/components/modals/CreateRepositoryModal/CreateRepositoryModal.tsx +3 -1
  300. package/src/constants.ts +19 -6
  301. package/src/hooks/useWebSocket.ts +25 -3
  302. package/src/types/deviceSpec.ts +68 -108
  303. package/src/types/extraTypes.ts +2 -12
  304. package/src/types/rbac.ts +6 -0
  305. package/src/utils/imageBuilds.ts +22 -32
  306. package/src/utils/search.ts +2 -2
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { TFunction } from 'react-i18next';
2
3
  import {
3
4
  Alert,
4
5
  AlertActionCloseButton,
@@ -10,9 +11,14 @@ import {
10
11
  CardHeader,
11
12
  Content,
12
13
  ContentVariants,
14
+ Dropdown,
15
+ DropdownItem,
16
+ DropdownList,
13
17
  Flex,
14
18
  FlexItem,
15
19
  Icon,
20
+ MenuToggle,
21
+ MenuToggleElement,
16
22
  Stack,
17
23
  StackItem,
18
24
  } from '@patternfly/react-core';
@@ -20,17 +26,91 @@ import { VirtualMachineIcon } from '@patternfly/react-icons/dist/js/icons/virtua
20
26
  import { CloudSecurityIcon } from '@patternfly/react-icons/dist/js/icons/cloud-security-icon';
21
27
  import { ServerGroupIcon } from '@patternfly/react-icons/dist/js/icons/server-group-icon';
22
28
  import { BuilderImageIcon } from '@patternfly/react-icons/dist/js/icons/builder-image-icon';
29
+ import { InfoCircleIcon } from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
23
30
 
24
31
  import { ExportFormatType, ImageExport, ImageExportConditionReason } from '@flightctl/types/imagebuilder';
25
32
  import { getExportFormatDescription, getExportFormatLabel, getImageExportStatusReason } from '../../utils/imageBuilds';
26
33
  import { getDateDisplay } from '../../utils/dates';
27
34
  import { useTranslation } from '../../hooks/useTranslation';
35
+ import WithTooltip from '../common/WithTooltip';
36
+ import ConfirmImageExportActionModal, {
37
+ ConfirmImageExportAction,
38
+ } from './ConfirmImageExportModal/ConfirmImageExportModal';
28
39
  import { ImageExportStatusDisplay } from './ImageBuildAndExportStatus';
29
- import { useAppContext } from '../../hooks/useAppContext';
30
- import { ROUTE } from '../../hooks/useNavigate';
31
40
 
32
41
  import './ImageExportCards.css';
33
42
 
43
+ export type ImageExportAction = 'cancel' | 'delete' | 'viewLogs' | 'download' | 'retry' | 'rebuild' | 'createExport';
44
+
45
+ const getActionsForStatus = (
46
+ format: ExportFormatType,
47
+ exportReason: ImageExportConditionReason | undefined,
48
+ actionPermissions: ImageExportAction[],
49
+ ): ImageExportAction[] => {
50
+ const actions: ImageExportAction[] = [];
51
+ switch (exportReason) {
52
+ case ImageExportConditionReason.ImageExportConditionReasonPending:
53
+ actions.push('cancel', 'delete');
54
+ break;
55
+ case ImageExportConditionReason.ImageExportConditionReasonConverting:
56
+ case ImageExportConditionReason.ImageExportConditionReasonPushing:
57
+ actions.push('cancel', 'viewLogs');
58
+ break;
59
+ case ImageExportConditionReason.ImageExportConditionReasonCompleted:
60
+ if (format !== ExportFormatType.ExportFormatTypeQCOW2DiskContainer) {
61
+ actions.push('download');
62
+ }
63
+ actions.push('viewLogs', 'delete', 'rebuild');
64
+ break;
65
+ case ImageExportConditionReason.ImageExportConditionReasonFailed:
66
+ case ImageExportConditionReason.ImageExportConditionReasonCanceled:
67
+ actions.push('retry', 'viewLogs', 'delete');
68
+ break;
69
+ case ImageExportConditionReason.ImageExportConditionReasonCanceling:
70
+ actions.push('viewLogs');
71
+ break;
72
+ default:
73
+ actions.push('createExport');
74
+ break;
75
+ }
76
+ return actions.filter((action) => actionPermissions.includes(action));
77
+ };
78
+
79
+ const getErrorTitle = (t: TFunction, action: ImageExportAction) => {
80
+ switch (action) {
81
+ case 'createExport':
82
+ return t("We couldn't export your image");
83
+ case 'download':
84
+ return t("We couldn't download your image");
85
+ case 'cancel':
86
+ return t("We couldn't cancel your image export");
87
+ case 'delete':
88
+ return t("We couldn't delete your image export");
89
+ default:
90
+ return t("We couldn't perform the action you requested");
91
+ }
92
+ };
93
+
94
+ const getActionTitle = (t: TFunction, action: ImageExportAction, inProgress: boolean) => {
95
+ switch (action) {
96
+ case 'cancel':
97
+ return inProgress ? t('Canceling...') : t('Cancel');
98
+ case 'delete':
99
+ return inProgress ? t('Deleting...') : t('Delete');
100
+ case 'viewLogs':
101
+ return t('View logs');
102
+ case 'download':
103
+ return inProgress ? t('Downloading...') : t('Download');
104
+ case 'retry':
105
+ return inProgress ? t('Retrying...') : t('Retry');
106
+ case 'rebuild':
107
+ return inProgress ? t('Rebuilding...') : t('Rebuild');
108
+ case 'createExport':
109
+ return inProgress ? t('Exporting...') : t('Export image');
110
+ default:
111
+ return t('Actions');
112
+ }
113
+ };
34
114
  const iconMap: Record<ExportFormatType, React.ReactElement> = {
35
115
  [ExportFormatType.ExportFormatTypeVMDK]: <VirtualMachineIcon />,
36
116
  [ExportFormatType.ExportFormatTypeQCOW2]: <CloudSecurityIcon />,
@@ -39,17 +119,14 @@ const iconMap: Record<ExportFormatType, React.ReactElement> = {
39
119
  };
40
120
 
41
121
  export type ImageExportFormatCardProps = {
42
- imageBuildId: string;
43
122
  imageReference: string | undefined;
44
123
  format: ExportFormatType;
45
- error?: { message: string; mode: 'export' | 'download' } | null;
46
124
  imageExport?: ImageExport;
47
- onExportImage: (format: ExportFormatType) => void;
48
- onDownload: (format: ExportFormatType) => void;
125
+ actionPermissions: ImageExportAction[];
126
+ activeAction: ImageExportAction | undefined;
127
+ onCardAction: ({ format, action }: { format: ExportFormatType; action: ImageExportAction }) => void;
128
+ error?: { message: string; action: ImageExportAction } | null;
49
129
  onDismissError: VoidFunction;
50
- isCreating: boolean;
51
- isDownloading?: boolean;
52
- isDisabled?: boolean;
53
130
  };
54
131
 
55
132
  type SelectImageBuildExportCardProps = {
@@ -60,11 +137,8 @@ type SelectImageBuildExportCardProps = {
60
137
 
61
138
  export const SelectImageBuildExportCard = ({ format, isChecked, onToggle }: SelectImageBuildExportCardProps) => {
62
139
  const { t } = useTranslation();
63
-
64
- const title = getExportFormatLabel(t, format);
65
- const description = getExportFormatDescription(t, format);
66
-
67
140
  const id = `export-format-${format}`;
141
+
68
142
  return (
69
143
  <Card id={id} isSelectable isSelected={isChecked} className="fctl-imageexport-card">
70
144
  <CardHeader
@@ -81,43 +155,91 @@ export const SelectImageBuildExportCard = ({ format, isChecked, onToggle }: Sele
81
155
  </FlexItem>
82
156
  <FlexItem>
83
157
  <Content>
84
- <Content component={ContentVariants.h2}>{title}</Content>
158
+ <Content component={ContentVariants.h2}>{getExportFormatLabel(t, format)}</Content>
85
159
  </Content>
86
160
  </FlexItem>
87
161
  </Flex>
88
162
  </CardHeader>
89
- <CardBody>{description}</CardBody>
163
+ <CardBody>{getExportFormatDescription(t, format)}</CardBody>
90
164
  </Card>
91
165
  );
92
166
  };
93
167
 
94
168
  export const ViewImageBuildExportCard = ({
95
- imageBuildId,
96
169
  format,
97
170
  imageExport,
98
171
  imageReference,
99
- onExportImage,
100
- onDownload,
101
- onDismissError,
102
- isCreating = false,
103
- isDownloading = false,
104
- isDisabled = false,
172
+ actionPermissions,
173
+ onCardAction,
174
+ activeAction,
105
175
  error,
176
+ onDismissError,
106
177
  }: ImageExportFormatCardProps) => {
107
178
  const { t } = useTranslation();
108
- const {
109
- router: { useNavigate: useRouterNavigate, appRoutes },
110
- } = useAppContext();
111
- const routerNavigate = useRouterNavigate();
179
+ const [actionsDropdownOpen, setActionsDropdownOpen] = React.useState(false);
180
+ const [pendingConfirmAction, setPendingConfirmAction] = React.useState<ConfirmImageExportAction>();
112
181
  const exists = !!imageExport;
113
-
114
182
  const exportReason = exists ? getImageExportStatusReason(imageExport) : undefined;
115
- const title = getExportFormatLabel(t, format);
116
- const description = getExportFormatDescription(t, format);
117
183
 
118
- const handleViewLogs = () => {
119
- const baseRoute = appRoutes[ROUTE.IMAGE_BUILD_DETAILS];
120
- routerNavigate(`${baseRoute}/${imageBuildId}/logs`);
184
+ const handleCardAction = (action: ImageExportAction) => {
185
+ if (
186
+ action === 'cancel' ||
187
+ action === 'delete' ||
188
+ (action === 'rebuild' && exportReason === ImageExportConditionReason.ImageExportConditionReasonCompleted)
189
+ ) {
190
+ setPendingConfirmAction(action);
191
+ } else {
192
+ onCardAction({ format, action });
193
+ }
194
+ };
195
+
196
+ const handleConfirmAction = (isConfirmed: boolean) => {
197
+ if (pendingConfirmAction && isConfirmed) {
198
+ onCardAction({ format, action: pendingConfirmAction });
199
+ }
200
+ setPendingConfirmAction(undefined);
201
+ };
202
+
203
+ const { primaryAction, remainingActions } = React.useMemo(() => {
204
+ const allActions = getActionsForStatus(format, exportReason, actionPermissions);
205
+ const primaryAction = allActions.length > 0 ? allActions[0] : undefined;
206
+ const remainingActions = allActions.length > 1 ? allActions.slice(1) : [];
207
+ return { primaryAction, remainingActions };
208
+ }, [format, exportReason, actionPermissions]);
209
+
210
+ const renderActionButton = (exportAction: ImageExportAction, variant: 'primary' | 'secondary' = 'secondary') => {
211
+ const isDisabled = activeAction !== undefined;
212
+ const isLoading = exportAction === activeAction;
213
+
214
+ return (
215
+ <Button
216
+ variant={variant}
217
+ onClick={() => handleCardAction(exportAction)}
218
+ isDisabled={isDisabled}
219
+ isLoading={isLoading}
220
+ >
221
+ {getActionTitle(t, exportAction, isLoading)}
222
+ </Button>
223
+ );
224
+ };
225
+
226
+ const renderDropdownItem = (exportAction: ImageExportAction) => {
227
+ const isDisabled = activeAction !== undefined;
228
+ const isLoading = exportAction === activeAction;
229
+
230
+ return (
231
+ <DropdownItem
232
+ key={exportAction}
233
+ onClick={() => {
234
+ setActionsDropdownOpen(false);
235
+ handleCardAction(exportAction);
236
+ }}
237
+ isDisabled={isDisabled}
238
+ isLoading={isLoading}
239
+ >
240
+ {getActionTitle(t, exportAction, false)}
241
+ </DropdownItem>
242
+ );
121
243
  };
122
244
 
123
245
  return (
@@ -147,58 +269,53 @@ export const ViewImageBuildExportCard = ({
147
269
  </Flex>
148
270
  </FlexItem>
149
271
  <FlexItem>
150
- <Content>
151
- <Content component={ContentVariants.h2}>{title}</Content>
152
- </Content>
272
+ <Flex gap={{ default: 'gapSm' }}>
273
+ <FlexItem>
274
+ <Content component={ContentVariants.h2}>{getExportFormatLabel(t, format)}</Content>
275
+ </FlexItem>
276
+ {imageExport?.metadata?.name && (
277
+ <FlexItem>
278
+ <WithTooltip showTooltip content={imageExport.metadata.name}>
279
+ <InfoCircleIcon />
280
+ </WithTooltip>
281
+ </FlexItem>
282
+ )}
283
+ </Flex>
153
284
  </FlexItem>
154
285
  </Flex>
155
286
  </CardHeader>
156
- <CardBody>{description}</CardBody>
287
+ <CardBody>{getExportFormatDescription(t, format)}</CardBody>
157
288
  <CardFooter>
158
289
  <Stack hasGutter>
159
290
  <StackItem>
160
- <Flex>
161
- {exportReason === ImageExportConditionReason.ImageExportConditionReasonFailed && (
162
- <FlexItem>
163
- <Button
164
- variant="primary"
165
- onClick={() => onExportImage(format)}
166
- isDisabled={isDisabled}
167
- isLoading={isCreating}
168
- >
169
- {t('Retry')}
170
- </Button>
171
- </FlexItem>
172
- )}
173
- {exportReason === ImageExportConditionReason.ImageExportConditionReasonCompleted && (
174
- <FlexItem>
175
- <Button
176
- variant="secondary"
177
- onClick={() => onDownload(format)}
178
- isDisabled={isDisabled || isDownloading}
179
- isLoading={isDownloading}
180
- >
181
- {isDownloading ? t('Downloading...') : t('Download')}
182
- </Button>
183
- </FlexItem>
184
- )}
185
- <FlexItem>
186
- {exists ? (
187
- <Button variant="secondary" onClick={handleViewLogs}>
188
- {t('View logs')}
189
- </Button>
190
- ) : (
191
- <Button
192
- variant="secondary"
193
- onClick={() => onExportImage(format)}
194
- isDisabled={isDisabled}
195
- isLoading={isCreating}
196
- >
197
- {t('Export image')}
198
- </Button>
291
+ {primaryAction && (
292
+ <Flex>
293
+ <FlexItem>{renderActionButton(primaryAction)}</FlexItem>
294
+ {remainingActions.length === 1 && <FlexItem>{renderActionButton(remainingActions[0])}</FlexItem>}
295
+ {remainingActions.length > 1 && (
296
+ <FlexItem>
297
+ <Dropdown
298
+ isOpen={actionsDropdownOpen}
299
+ onSelect={() => setActionsDropdownOpen(false)}
300
+ onOpenChange={(isOpen: boolean) => setActionsDropdownOpen(isOpen)}
301
+ toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
302
+ <MenuToggle
303
+ ref={toggleRef}
304
+ isExpanded={actionsDropdownOpen}
305
+ onClick={() => setActionsDropdownOpen(!actionsDropdownOpen)}
306
+ variant="secondary"
307
+ isDisabled={activeAction !== undefined}
308
+ >
309
+ {t('Actions')}
310
+ </MenuToggle>
311
+ )}
312
+ >
313
+ <DropdownList>{remainingActions.map((actionKey) => renderDropdownItem(actionKey))}</DropdownList>
314
+ </Dropdown>
315
+ </FlexItem>
199
316
  )}
200
- </FlexItem>
201
- </Flex>
317
+ </Flex>
318
+ )}
202
319
  </StackItem>
203
320
  <StackItem>
204
321
  <Content component={ContentVariants.small}>
@@ -209,9 +326,7 @@ export const ViewImageBuildExportCard = ({
209
326
  <AlertGroup isToast>
210
327
  <Alert
211
328
  variant="danger"
212
- title={
213
- error.mode === 'export' ? t("We couldn't export your image") : t("We couldn't download your image")
214
- }
329
+ title={getErrorTitle(t, error.action)}
215
330
  actionClose={<AlertActionCloseButton onClose={onDismissError} />}
216
331
  >
217
332
  {t('Something went wrong on our end. Please review the error details and try again.')}
@@ -221,6 +336,9 @@ export const ViewImageBuildExportCard = ({
221
336
  )}
222
337
  </Stack>
223
338
  </CardFooter>
339
+ {pendingConfirmAction && (
340
+ <ConfirmImageExportActionModal action={pendingConfirmAction} onClose={handleConfirmAction} />
341
+ )}
224
342
  </Card>
225
343
  );
226
344
  };
@@ -3,5 +3,9 @@
3
3
  }
4
4
 
5
5
  .fctl-create-repo__adv-section--nested {
6
- margin-left: 1.5rem;
6
+ margin-left: 1.5rem;
7
+ }
8
+
9
+ .fctl-create-repo__rs-checkbox {
10
+ --pf-v6-c-check__input--TranslateY: 0.75rem;
7
11
  }
@@ -402,6 +402,7 @@ const CreateRepositoryFormContent = ({ isEdit, isReadOnly, onClose, children }:
402
402
  {showResourceSyncs && canCreateRS && (
403
403
  <Checkbox
404
404
  id="use-resource-syncs"
405
+ className="fctl-create-repo__rs-checkbox"
405
406
  label={
406
407
  <LabelWithHelperText
407
408
  label={t('Use resource syncs')}
@@ -438,6 +439,8 @@ export type CreateRepositoryFormProps = {
438
439
  onSuccess: (repository: Repository) => void;
439
440
  repository?: Repository;
440
441
  resourceSyncs?: ResourceSync[];
442
+ // If provided, the repository submission will be blocked if the validation fails
443
+ validateBefore?: (repo: Repository) => string | undefined;
441
444
  options?: {
442
445
  isReadOnly?: boolean;
443
446
  canUseResourceSyncs?: boolean;
@@ -446,13 +449,14 @@ export type CreateRepositoryFormProps = {
446
449
  };
447
450
  };
448
451
 
449
- const CreateRepositoryForm: React.FC<CreateRepositoryFormProps> = ({
452
+ const CreateRepositoryForm = ({
450
453
  repository,
451
454
  resourceSyncs,
455
+ validateBefore,
452
456
  options,
453
457
  onClose,
454
458
  onSuccess,
455
- }) => {
459
+ }: CreateRepositoryFormProps) => {
456
460
  const [errors, setErrors] = React.useState<string[]>();
457
461
  const { patch, remove, post } = useFetch();
458
462
  const { t } = useTranslation();
@@ -512,8 +516,14 @@ const CreateRepositoryForm: React.FC<CreateRepositoryFormProps> = ({
512
516
  setErrors([getErrorMessage(e)]);
513
517
  }
514
518
  } else {
519
+ const repoToCreate = getRepository(values);
520
+ const validationError = validateBefore?.(repoToCreate);
521
+ if (validationError) {
522
+ setErrors([validationError]);
523
+ return;
524
+ }
515
525
  try {
516
- const repo = await post<Repository>('repositories', getRepository(values));
526
+ const repo = await post<Repository>('repositories', repoToCreate);
517
527
  if (values.useResourceSyncs) {
518
528
  const resourceSyncPromises = values.resourceSyncs.map((rs) =>
519
529
  post<ResourceSync>('resourcesyncs', getResourceSync(values.name, rs)),
@@ -533,7 +543,7 @@ const CreateRepositoryForm: React.FC<CreateRepositoryFormProps> = ({
533
543
  >
534
544
  <CreateRepositoryFormContent isEdit={!!repository} onClose={onClose} isReadOnly={!!options?.isReadOnly}>
535
545
  {errors?.length && (
536
- <Alert isInline variant="danger" title={t('An error occurred')}>
546
+ <Alert isInline variant="danger" title={t('Repository could not be saved')}>
537
547
  {errors.map((e, index) => (
538
548
  <div key={index}>{e}</div>
539
549
  ))}
@@ -1,6 +1,7 @@
1
1
  import * as Yup from 'yup';
2
2
  import { TFunction } from 'i18next';
3
3
  import {
4
+ ApiVersion,
4
5
  DockerAuth,
5
6
  GitRepoSpec,
6
7
  HttpConfig,
@@ -16,7 +17,6 @@ import {
16
17
  } from '@flightctl/types';
17
18
 
18
19
  import { RepositoryFormValues, ResourceSyncFormValue } from './types';
19
- import { API_VERSION } from '../../../constants';
20
20
  import { getErrorMessage } from '../../../utils/error';
21
21
  import { appendJSONPatch } from '../../../utils/patch';
22
22
  import { MAX_TARGET_REVISION_LENGTH, maxLengthString, validKubernetesDnsSubdomain } from '../../form/validations';
@@ -779,7 +779,7 @@ export const getRepository = (values: Omit<RepositoryFormValues, 'useResourceSyn
779
779
  }
780
780
 
781
781
  return {
782
- apiVersion: API_VERSION,
782
+ apiVersion: ApiVersion.ApiVersionV1beta1,
783
783
  kind: 'Repository',
784
784
  metadata: {
785
785
  name: values.name,
@@ -877,7 +877,7 @@ export const getRepository = (values: Omit<RepositoryFormValues, 'useResourceSyn
877
877
  }
878
878
 
879
879
  return {
880
- apiVersion: API_VERSION,
880
+ apiVersion: ApiVersion.ApiVersionV1beta1,
881
881
  kind: 'Repository',
882
882
  metadata: {
883
883
  name: values.name,
@@ -888,7 +888,7 @@ export const getRepository = (values: Omit<RepositoryFormValues, 'useResourceSyn
888
888
 
889
889
  export const getResourceSync = (repositoryId: string, values: ResourceSyncFormValue): ResourceSync => {
890
890
  return {
891
- apiVersion: API_VERSION,
891
+ apiVersion: ApiVersion.ApiVersionV1beta1,
892
892
  kind: 'ResourceSync',
893
893
  metadata: {
894
894
  name: values.name,
@@ -214,6 +214,7 @@ const RepositorySelect = ({
214
214
  type={repoType}
215
215
  onClose={() => setCreateRepoModalOpen(false)}
216
216
  onSuccess={handleCreateRepository}
217
+ validateBeforeCreate={validateRepoSelection}
217
218
  />
218
219
  )}
219
220
  </>
@@ -15,44 +15,38 @@ type UploadFieldProps = {
15
15
  maxFileBytes?: number;
16
16
  };
17
17
 
18
- const UploadHelperText = ({
18
+ const ONE_MB = 1024 * 1024;
19
+
20
+ const UploadMaxFileSizeHelperText = ({ maxFileBytes }: { maxFileBytes: number }) => {
21
+ const { t } = useTranslation();
22
+
23
+ const showKB = maxFileBytes < ONE_MB;
24
+ const maxFileSize = maxFileBytes / (showKB ? 1024 : ONE_MB);
25
+
26
+ const helperText = showKB
27
+ ? t('Max file size {{ maxFileSize }} KB', { maxFileSize })
28
+ : t('Max file size {{ maxFileSize }} MB', { maxFileSize });
29
+
30
+ return <DefaultHelperText helperText={helperText} />;
31
+ };
32
+
33
+ const UploadErrorHelperText = ({
19
34
  meta,
20
35
  isUploading,
21
36
  isRejected,
22
- maxFileBytes,
23
37
  }: {
24
38
  meta?: FieldMetaProps<unknown>;
25
39
  isUploading: boolean;
26
40
  isRejected: boolean;
27
- maxFileBytes?: number;
28
41
  }) => {
29
42
  const { t } = useTranslation();
30
43
 
31
- const maxFileMB = (maxFileBytes || 0) / (1024 * 1024);
32
-
33
- const defaultContent = maxFileBytes ? (
34
- <DefaultHelperText helperText={t('Max file size {{ maxFileSize }} MB', { maxFileSize: maxFileMB })} />
35
- ) : null;
36
44
  if (isRejected) {
37
- return (
38
- <>
39
- {defaultContent}
40
- <ErrorHelperText
41
- error={t('Content exceeds max file size of {{ maxFileSize }} MB', {
42
- maxFileSize: maxFileMB,
43
- })}
44
- />
45
- </>
46
- );
45
+ return <ErrorHelperText error={t('File exceeds maximum allowed size.')} />;
47
46
  } else if (!isUploading && !!meta?.error) {
48
- return (
49
- <>
50
- {defaultContent}
51
- <ErrorHelperText meta={meta} />
52
- </>
53
- );
47
+ return <ErrorHelperText meta={meta} />;
54
48
  }
55
- return defaultContent;
49
+ return null;
56
50
  };
57
51
 
58
52
  const UploadField = ({ ariaLabel, maxFileBytes, isRequired, name }: UploadFieldProps) => {
@@ -83,8 +77,9 @@ const UploadField = ({ ariaLabel, maxFileBytes, isRequired, name }: UploadFieldP
83
77
  }
84
78
  }
85
79
 
86
- void setValue(file);
80
+ // To prevent timing issues with validations, we must touch the field before we set the new value
87
81
  void setTouched(true);
82
+ void setValue(file, true);
88
83
  setIsRejected(false);
89
84
  };
90
85
 
@@ -105,7 +100,9 @@ const UploadField = ({ ariaLabel, maxFileBytes, isRequired, name }: UploadFieldP
105
100
  onDataChange={handleFileChange}
106
101
  onTextChange={handleFileChange}
107
102
  onFileInputChange={(_event, file) => {
108
- if (!maxFileBytes || file.size <= maxFileBytes) {
103
+ if (maxFileBytes && file.size > maxFileBytes) {
104
+ handleFileRejected(true);
105
+ } else {
109
106
  setFilename(file.name);
110
107
  setIsRejected(false);
111
108
  }
@@ -122,12 +119,14 @@ const UploadField = ({ ariaLabel, maxFileBytes, isRequired, name }: UploadFieldP
122
119
  }}
123
120
  onClearClick={() => {
124
121
  setFilename('');
122
+ if (!isRequired) {
123
+ void setTouched(false);
124
+ }
125
125
  void setValue('');
126
- void setTouched(false);
127
126
  }}
128
127
  />
129
-
130
- <UploadHelperText maxFileBytes={maxFileBytes} meta={meta} isUploading={isFileUploading} isRejected={isRejected} />
128
+ {maxFileBytes && <UploadMaxFileSizeHelperText maxFileBytes={maxFileBytes} />}
129
+ <UploadErrorHelperText meta={meta} isUploading={isFileUploading} isRejected={isRejected} />
131
130
  </FormGroup>
132
131
  );
133
132
  };