@flightctl/ui-components 0.4.0 → 0.5.0-rc2

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 (384) hide show
  1. package/dist/src/components/DetailsPage/DetailsPageActions.d.ts +11 -4
  2. package/dist/src/components/DetailsPage/DetailsPageActions.d.ts.map +1 -1
  3. package/dist/src/components/DetailsPage/DetailsPageActions.js +15 -4
  4. package/dist/src/components/DetailsPage/DetailsPageActions.js.map +1 -1
  5. package/dist/src/components/DetailsPage/Tables/ApplicationsTable.js +1 -1
  6. package/dist/src/components/DetailsPage/Tables/ApplicationsTable.js.map +1 -1
  7. package/dist/src/components/Device/DeviceDetails/DeviceApplications.d.ts +1 -1
  8. package/dist/src/components/Device/DeviceDetails/DeviceApplications.d.ts.map +1 -1
  9. package/dist/src/components/Device/DeviceDetails/DeviceApplications.js +2 -2
  10. package/dist/src/components/Device/DeviceDetails/DeviceApplications.js.map +1 -1
  11. package/dist/src/components/Device/DeviceDetails/DeviceDetailsPage.d.ts.map +1 -1
  12. package/dist/src/components/Device/DeviceDetails/DeviceDetailsPage.js +22 -15
  13. package/dist/src/components/Device/DeviceDetails/DeviceDetailsPage.js.map +1 -1
  14. package/dist/src/components/Device/DeviceDetails/DeviceDetailsTab.d.ts.map +1 -1
  15. package/dist/src/components/Device/DeviceDetails/DeviceDetailsTab.js +42 -39
  16. package/dist/src/components/Device/DeviceDetails/DeviceDetailsTab.js.map +1 -1
  17. package/dist/src/components/Device/DeviceDetails/DeviceDetailsTabContent/StatusContent.d.ts +7 -0
  18. package/dist/src/components/Device/DeviceDetails/DeviceDetailsTabContent/StatusContent.d.ts.map +1 -0
  19. package/dist/src/components/Device/DeviceDetails/DeviceDetailsTabContent/StatusContent.js +41 -0
  20. package/dist/src/components/Device/DeviceDetails/DeviceDetailsTabContent/StatusContent.js.map +1 -0
  21. package/dist/src/components/Device/DeviceDetails/DeviceDetailsTabContent/SystemResourcesContent.d.ts +7 -0
  22. package/dist/src/components/Device/DeviceDetails/DeviceDetailsTabContent/SystemResourcesContent.d.ts.map +1 -0
  23. package/dist/src/components/Device/DeviceDetails/DeviceDetailsTabContent/SystemResourcesContent.js +30 -0
  24. package/dist/src/components/Device/DeviceDetails/DeviceDetailsTabContent/SystemResourcesContent.js.map +1 -0
  25. package/dist/src/components/Device/DeviceDetails/TerminalTab.d.ts.map +1 -1
  26. package/dist/src/components/Device/DeviceDetails/TerminalTab.js +1 -1
  27. package/dist/src/components/Device/DeviceDetails/TerminalTab.js.map +1 -1
  28. package/dist/src/components/Device/DevicesPage/DecommissionedDeviceTableRow.d.ts +16 -0
  29. package/dist/src/components/Device/DevicesPage/DecommissionedDeviceTableRow.d.ts.map +1 -0
  30. package/dist/src/components/Device/DevicesPage/DecommissionedDeviceTableRow.js +57 -0
  31. package/dist/src/components/Device/DevicesPage/DecommissionedDeviceTableRow.js.map +1 -0
  32. package/dist/src/components/Device/DevicesPage/DecommissionedDevicesTable.d.ts +16 -0
  33. package/dist/src/components/Device/DevicesPage/DecommissionedDevicesTable.d.ts.map +1 -0
  34. package/dist/src/components/Device/DevicesPage/DecommissionedDevicesTable.js +73 -0
  35. package/dist/src/components/Device/DevicesPage/DecommissionedDevicesTable.js.map +1 -0
  36. package/dist/src/components/Device/DevicesPage/DeviceNameOnlyToolbarFilter.d.ts +10 -0
  37. package/dist/src/components/Device/DevicesPage/DeviceNameOnlyToolbarFilter.d.ts.map +1 -0
  38. package/dist/src/components/Device/DevicesPage/DeviceNameOnlyToolbarFilter.js +19 -0
  39. package/dist/src/components/Device/DevicesPage/DeviceNameOnlyToolbarFilter.js.map +1 -0
  40. package/dist/src/components/Device/DevicesPage/DevicesEmptyStates.d.ts +8 -0
  41. package/dist/src/components/Device/DevicesPage/DevicesEmptyStates.d.ts.map +1 -0
  42. package/dist/src/components/Device/DevicesPage/DevicesEmptyStates.js +34 -0
  43. package/dist/src/components/Device/DevicesPage/DevicesEmptyStates.js.map +1 -0
  44. package/dist/src/components/Device/DevicesPage/DevicesPage.d.ts +0 -22
  45. package/dist/src/components/Device/DevicesPage/DevicesPage.d.ts.map +1 -1
  46. package/dist/src/components/Device/DevicesPage/DevicesPage.js +9 -92
  47. package/dist/src/components/Device/DevicesPage/DevicesPage.js.map +1 -1
  48. package/dist/src/components/Device/DevicesPage/EnrolledDeviceTableRow.d.ts +16 -0
  49. package/dist/src/components/Device/DevicesPage/EnrolledDeviceTableRow.d.ts.map +1 -0
  50. package/dist/src/components/Device/DevicesPage/{DeviceTableRow.js → EnrolledDeviceTableRow.js} +9 -13
  51. package/dist/src/components/Device/DevicesPage/EnrolledDeviceTableRow.js.map +1 -0
  52. package/dist/src/components/Device/DevicesPage/EnrolledDevicesTable.d.ts +23 -0
  53. package/dist/src/components/Device/DevicesPage/EnrolledDevicesTable.d.ts.map +1 -0
  54. package/dist/src/components/Device/DevicesPage/EnrolledDevicesTable.js +99 -0
  55. package/dist/src/components/Device/DevicesPage/EnrolledDevicesTable.js.map +1 -0
  56. package/dist/src/components/Device/DevicesPage/useDevices.d.ts +2 -0
  57. package/dist/src/components/Device/DevicesPage/useDevices.d.ts.map +1 -1
  58. package/dist/src/components/Device/DevicesPage/useDevices.js +16 -1
  59. package/dist/src/components/Device/DevicesPage/useDevices.js.map +1 -1
  60. package/dist/src/components/Device/EditDeviceWizard/EditDeviceWizard.d.ts.map +1 -1
  61. package/dist/src/components/Device/EditDeviceWizard/EditDeviceWizard.js +5 -3
  62. package/dist/src/components/Device/EditDeviceWizard/EditDeviceWizard.js.map +1 -1
  63. package/dist/src/components/Device/EditDeviceWizard/EditDeviceWizardNav.js +1 -1
  64. package/dist/src/components/Device/EditDeviceWizard/EditDeviceWizardNav.js.map +1 -1
  65. package/dist/src/components/Device/EditDeviceWizard/steps/ApplicationTemplates.d.ts.map +1 -1
  66. package/dist/src/components/Device/EditDeviceWizard/steps/ApplicationTemplates.js +2 -2
  67. package/dist/src/components/Device/EditDeviceWizard/steps/ApplicationTemplates.js.map +1 -1
  68. package/dist/src/components/Device/EditDeviceWizard/steps/ConfigInlineTemplateForm.d.ts.map +1 -1
  69. package/dist/src/components/Device/EditDeviceWizard/steps/ConfigInlineTemplateForm.js +1 -1
  70. package/dist/src/components/Device/EditDeviceWizard/steps/ConfigInlineTemplateForm.js.map +1 -1
  71. package/dist/src/components/Device/EditDeviceWizard/steps/ConfigurationTemplates.d.ts.map +1 -1
  72. package/dist/src/components/Device/EditDeviceWizard/steps/ConfigurationTemplates.js +1 -1
  73. package/dist/src/components/Device/EditDeviceWizard/steps/ConfigurationTemplates.js.map +1 -1
  74. package/dist/src/components/Device/EditDeviceWizard/steps/ReviewDeviceStep.d.ts.map +1 -1
  75. package/dist/src/components/Device/EditDeviceWizard/steps/ReviewDeviceStep.js +7 -7
  76. package/dist/src/components/Device/EditDeviceWizard/steps/ReviewDeviceStep.js.map +1 -1
  77. package/dist/src/components/Device/EditDeviceWizard/steps/ReviewUpdatePolicy.d.ts +9 -0
  78. package/dist/src/components/Device/EditDeviceWizard/steps/ReviewUpdatePolicy.d.ts.map +1 -0
  79. package/dist/src/components/Device/EditDeviceWizard/steps/ReviewUpdatePolicy.js +37 -0
  80. package/dist/src/components/Device/EditDeviceWizard/steps/ReviewUpdatePolicy.js.map +1 -0
  81. package/dist/src/components/Device/EditDeviceWizard/steps/SystemdUnitsForm.d.ts.map +1 -1
  82. package/dist/src/components/Device/EditDeviceWizard/steps/SystemdUnitsForm.js +6 -4
  83. package/dist/src/components/Device/EditDeviceWizard/steps/SystemdUnitsForm.js.map +1 -1
  84. package/dist/src/components/Device/EditDeviceWizard/utils.d.ts +1 -1
  85. package/dist/src/components/EnrollmentRequest/EnrollmentRequestDetails/EnrollmentRequestDetails.d.ts.map +1 -1
  86. package/dist/src/components/EnrollmentRequest/EnrollmentRequestDetails/EnrollmentRequestDetails.js +4 -13
  87. package/dist/src/components/EnrollmentRequest/EnrollmentRequestDetails/EnrollmentRequestDetails.js.map +1 -1
  88. package/dist/src/components/EnrollmentRequest/EnrollmentRequestList.js +2 -2
  89. package/dist/src/components/EnrollmentRequest/EnrollmentRequestList.js.map +1 -1
  90. package/dist/src/components/EnrollmentRequest/EnrollmentRequestTableRow.d.ts +2 -2
  91. package/dist/src/components/EnrollmentRequest/EnrollmentRequestTableRow.d.ts.map +1 -1
  92. package/dist/src/components/EnrollmentRequest/useEnrollmentRequests.d.ts +2 -2
  93. package/dist/src/components/EnrollmentRequest/useEnrollmentRequests.d.ts.map +1 -1
  94. package/dist/src/components/EnrollmentRequest/useEnrollmentRequests.js.map +1 -1
  95. package/dist/src/components/Fleet/CreateFleet/CreateFleetWizard.d.ts.map +1 -1
  96. package/dist/src/components/Fleet/CreateFleet/CreateFleetWizard.js +32 -3
  97. package/dist/src/components/Fleet/CreateFleet/CreateFleetWizard.js.map +1 -1
  98. package/dist/src/components/Fleet/CreateFleet/CreateFleetWizardFooter.d.ts.map +1 -1
  99. package/dist/src/components/Fleet/CreateFleet/CreateFleetWizardFooter.js +4 -0
  100. package/dist/src/components/Fleet/CreateFleet/CreateFleetWizardFooter.js.map +1 -1
  101. package/dist/src/components/Fleet/CreateFleet/fleetSpecUtils.d.ts +26 -0
  102. package/dist/src/components/Fleet/CreateFleet/fleetSpecUtils.d.ts.map +1 -0
  103. package/dist/src/components/Fleet/CreateFleet/fleetSpecUtils.js +63 -0
  104. package/dist/src/components/Fleet/CreateFleet/fleetSpecUtils.js.map +1 -0
  105. package/dist/src/components/Fleet/CreateFleet/steps/ReviewStep.d.ts.map +1 -1
  106. package/dist/src/components/Fleet/CreateFleet/steps/ReviewStep.js +19 -10
  107. package/dist/src/components/Fleet/CreateFleet/steps/ReviewStep.js.map +1 -1
  108. package/dist/src/components/Fleet/CreateFleet/steps/UpdateConfirmChangesModal.d.ts +9 -0
  109. package/dist/src/components/Fleet/CreateFleet/steps/UpdateConfirmChangesModal.d.ts.map +1 -0
  110. package/dist/src/components/Fleet/CreateFleet/steps/UpdateConfirmChangesModal.js +52 -0
  111. package/dist/src/components/Fleet/CreateFleet/steps/UpdateConfirmChangesModal.js.map +1 -0
  112. package/dist/src/components/Fleet/CreateFleet/steps/UpdatePolicyStep.d.ts +8 -0
  113. package/dist/src/components/Fleet/CreateFleet/steps/UpdatePolicyStep.d.ts.map +1 -0
  114. package/dist/src/components/Fleet/CreateFleet/steps/UpdatePolicyStep.js +95 -0
  115. package/dist/src/components/Fleet/CreateFleet/steps/UpdatePolicyStep.js.map +1 -0
  116. package/dist/src/components/Fleet/CreateFleet/steps/UpdateStepDisruptionBudget.d.ts +4 -0
  117. package/dist/src/components/Fleet/CreateFleet/steps/UpdateStepDisruptionBudget.d.ts.map +1 -0
  118. package/dist/src/components/Fleet/CreateFleet/steps/UpdateStepDisruptionBudget.js +31 -0
  119. package/dist/src/components/Fleet/CreateFleet/steps/UpdateStepDisruptionBudget.js.map +1 -0
  120. package/dist/src/components/Fleet/CreateFleet/steps/UpdateStepRolloutPolicy.d.ts +4 -0
  121. package/dist/src/components/Fleet/CreateFleet/steps/UpdateStepRolloutPolicy.d.ts.map +1 -0
  122. package/dist/src/components/Fleet/CreateFleet/steps/UpdateStepRolloutPolicy.js +78 -0
  123. package/dist/src/components/Fleet/CreateFleet/steps/UpdateStepRolloutPolicy.js.map +1 -0
  124. package/dist/src/components/Fleet/CreateFleet/types.d.ts +21 -0
  125. package/dist/src/components/Fleet/CreateFleet/types.d.ts.map +1 -1
  126. package/dist/src/components/Fleet/CreateFleet/types.js +6 -0
  127. package/dist/src/components/Fleet/CreateFleet/types.js.map +1 -1
  128. package/dist/src/components/Fleet/CreateFleet/utils.d.ts.map +1 -1
  129. package/dist/src/components/Fleet/CreateFleet/utils.js +15 -1
  130. package/dist/src/components/Fleet/CreateFleet/utils.js.map +1 -1
  131. package/dist/src/components/Fleet/FleetDetails/FleetDetailsContent.d.ts.map +1 -1
  132. package/dist/src/components/Fleet/FleetDetails/FleetDetailsContent.js +9 -7
  133. package/dist/src/components/Fleet/FleetDetails/FleetDetailsContent.js.map +1 -1
  134. package/dist/src/components/Fleet/FleetDetails/FleetDevicesCharts.d.ts +9 -0
  135. package/dist/src/components/Fleet/FleetDetails/FleetDevicesCharts.d.ts.map +1 -0
  136. package/dist/src/components/Fleet/FleetDetails/{FleetDevices.js → FleetDevicesCharts.js} +4 -4
  137. package/dist/src/components/Fleet/FleetDetails/FleetDevicesCharts.js.map +1 -0
  138. package/dist/src/components/Fleet/FleetDetails/FleetDevicesCount.d.ts +10 -0
  139. package/dist/src/components/Fleet/FleetDetails/FleetDevicesCount.d.ts.map +1 -0
  140. package/dist/src/components/Fleet/FleetDetails/FleetDevicesCount.js +30 -0
  141. package/dist/src/components/Fleet/FleetDetails/FleetDevicesCount.js.map +1 -0
  142. package/dist/src/components/Fleet/FleetResourceSyncs.js +2 -2
  143. package/dist/src/components/Fleet/FleetResourceSyncs.js.map +1 -1
  144. package/dist/src/components/Fleet/FleetRow.d.ts.map +1 -1
  145. package/dist/src/components/Fleet/FleetRow.js +7 -5
  146. package/dist/src/components/Fleet/FleetRow.js.map +1 -1
  147. package/dist/src/components/Fleet/FleetsPage.js +2 -2
  148. package/dist/src/components/Fleet/FleetsPage.js.map +1 -1
  149. package/dist/src/components/Fleet/useFleets.d.ts +3 -3
  150. package/dist/src/components/Fleet/useFleets.d.ts.map +1 -1
  151. package/dist/src/components/Fleet/useFleets.js +3 -3
  152. package/dist/src/components/Fleet/useFleets.js.map +1 -1
  153. package/dist/src/components/ListPage/ListPage.d.ts.map +1 -1
  154. package/dist/src/components/ListPage/ListPage.js +6 -1
  155. package/dist/src/components/ListPage/ListPage.js.map +1 -1
  156. package/dist/src/components/ListPage/ListPageActions.d.ts +8 -15
  157. package/dist/src/components/ListPage/ListPageActions.d.ts.map +1 -1
  158. package/dist/src/components/ListPage/ListPageActions.js +25 -5
  159. package/dist/src/components/ListPage/ListPageActions.js.map +1 -1
  160. package/dist/src/components/ListPage/types.d.ts +11 -11
  161. package/dist/src/components/ListPage/types.d.ts.map +1 -1
  162. package/dist/src/components/OverviewPage/Cards/Status/DeviceStatusChart.d.ts.map +1 -1
  163. package/dist/src/components/OverviewPage/Cards/Status/DeviceStatusChart.js +0 -1
  164. package/dist/src/components/OverviewPage/Cards/Status/DeviceStatusChart.js.map +1 -1
  165. package/dist/src/components/OverviewPage/OverviewPage.d.ts.map +1 -1
  166. package/dist/src/components/OverviewPage/OverviewPage.js +6 -1
  167. package/dist/src/components/OverviewPage/OverviewPage.js.map +1 -1
  168. package/dist/src/components/Repository/RepositoryDetails/RepositoryResourceSyncsCard.js +1 -1
  169. package/dist/src/components/Repository/RepositoryDetails/RepositoryResourceSyncsCard.js.map +1 -1
  170. package/dist/src/components/Repository/useRepositories.d.ts +2 -2
  171. package/dist/src/components/Repository/useRepositories.d.ts.map +1 -1
  172. package/dist/src/components/Repository/useRepositories.js.map +1 -1
  173. package/dist/src/components/ResourceSync/RepositoryResourceSyncList.js +2 -2
  174. package/dist/src/components/ResourceSync/RepositoryResourceSyncList.js.map +1 -1
  175. package/dist/src/components/Status/DeviceLifecycleStatus.d.ts +7 -0
  176. package/dist/src/components/Status/DeviceLifecycleStatus.d.ts.map +1 -0
  177. package/dist/src/components/Status/DeviceLifecycleStatus.js +25 -0
  178. package/dist/src/components/Status/DeviceLifecycleStatus.js.map +1 -0
  179. package/dist/src/components/Status/StatusDisplay.d.ts +1 -1
  180. package/dist/src/components/Status/StatusDisplay.d.ts.map +1 -1
  181. package/dist/src/components/Status/StatusDisplay.js +3 -3
  182. package/dist/src/components/Status/StatusDisplay.js.map +1 -1
  183. package/dist/src/components/Table/Table.d.ts.map +1 -1
  184. package/dist/src/components/Table/Table.js +2 -2
  185. package/dist/src/components/Table/Table.js.map +1 -1
  186. package/dist/src/components/Table/TablePagination.d.ts +4 -3
  187. package/dist/src/components/Table/TablePagination.d.ts.map +1 -1
  188. package/dist/src/components/Table/TablePagination.js +6 -5
  189. package/dist/src/components/Table/TablePagination.js.map +1 -1
  190. package/dist/src/components/common/EditableLabelControl.d.ts.map +1 -1
  191. package/dist/src/components/common/EditableLabelControl.js +5 -7
  192. package/dist/src/components/common/EditableLabelControl.js.map +1 -1
  193. package/dist/src/components/common/TechPreviewBadge.d.ts +4 -0
  194. package/dist/src/components/common/TechPreviewBadge.d.ts.map +1 -0
  195. package/dist/src/components/common/TechPreviewBadge.js +23 -0
  196. package/dist/src/components/common/TechPreviewBadge.js.map +1 -0
  197. package/dist/src/components/form/LabelsField.d.ts.map +1 -1
  198. package/dist/src/components/form/LabelsField.js +4 -1
  199. package/dist/src/components/form/LabelsField.js.map +1 -1
  200. package/dist/src/components/form/NumberField.d.ts +10 -0
  201. package/dist/src/components/form/NumberField.d.ts.map +1 -0
  202. package/dist/src/components/form/NumberField.js +51 -0
  203. package/dist/src/components/form/NumberField.js.map +1 -0
  204. package/dist/src/components/form/TextListField.d.ts +12 -0
  205. package/dist/src/components/form/TextListField.d.ts.map +1 -0
  206. package/dist/src/components/form/TextListField.js +46 -0
  207. package/dist/src/components/form/TextListField.js.map +1 -0
  208. package/dist/src/components/form/validations.d.ts +34 -6
  209. package/dist/src/components/form/validations.d.ts.map +1 -1
  210. package/dist/src/components/form/validations.js +78 -4
  211. package/dist/src/components/form/validations.js.map +1 -1
  212. package/dist/src/components/modals/DecommissionModal/DecommissionModal.d.ts +9 -0
  213. package/dist/src/components/modals/DecommissionModal/DecommissionModal.d.ts.map +1 -0
  214. package/dist/src/components/modals/DecommissionModal/DecommissionModal.js +51 -0
  215. package/dist/src/components/modals/DecommissionModal/DecommissionModal.js.map +1 -0
  216. package/dist/src/components/modals/EditLabelsModal/EditLabelsForm.d.ts +4 -2
  217. package/dist/src/components/modals/EditLabelsModal/EditLabelsForm.d.ts.map +1 -1
  218. package/dist/src/components/modals/EditLabelsModal/EditLabelsForm.js +11 -4
  219. package/dist/src/components/modals/EditLabelsModal/EditLabelsForm.js.map +1 -1
  220. package/dist/src/components/modals/massModals/MassDecommissionDeviceModal/MassDecommissionDeviceModal.d.ts +10 -0
  221. package/dist/src/components/modals/massModals/MassDecommissionDeviceModal/MassDecommissionDeviceModal.d.ts.map +1 -0
  222. package/dist/src/components/modals/massModals/MassDecommissionDeviceModal/MassDecommissionDeviceModal.js +67 -0
  223. package/dist/src/components/modals/massModals/MassDecommissionDeviceModal/MassDecommissionDeviceModal.js.map +1 -0
  224. package/dist/src/constants.d.ts +1 -1
  225. package/dist/src/constants.d.ts.map +1 -1
  226. package/dist/src/constants.js +1 -1
  227. package/dist/src/constants.js.map +1 -1
  228. package/dist/src/hooks/useAppContext.d.ts +1 -1
  229. package/dist/src/hooks/useAppContext.d.ts.map +1 -1
  230. package/dist/src/hooks/useFetch.d.ts +1 -1
  231. package/dist/src/hooks/useFetchPeriodically.js +10 -10
  232. package/dist/src/hooks/useFetchPeriodically.js.map +1 -1
  233. package/dist/src/hooks/useTablePagination.d.ts +5 -3
  234. package/dist/src/hooks/useTablePagination.d.ts.map +1 -1
  235. package/dist/src/hooks/useTablePagination.js +9 -5
  236. package/dist/src/hooks/useTablePagination.js.map +1 -1
  237. package/dist/src/hooks/useWebSocket.d.ts +1 -1
  238. package/dist/src/hooks/useWebSocket.js +4 -4
  239. package/dist/src/hooks/useWebSocket.js.map +1 -1
  240. package/dist/src/links.d.ts +1 -0
  241. package/dist/src/links.d.ts.map +1 -1
  242. package/dist/src/links.js +2 -1
  243. package/dist/src/links.js.map +1 -1
  244. package/dist/src/types/rbac.d.ts +3 -1
  245. package/dist/src/types/rbac.d.ts.map +1 -1
  246. package/dist/src/types/rbac.js +2 -0
  247. package/dist/src/types/rbac.js.map +1 -1
  248. package/dist/src/utils/api.d.ts +3 -6
  249. package/dist/src/utils/api.d.ts.map +1 -1
  250. package/dist/src/utils/api.js.map +1 -1
  251. package/dist/src/utils/apiCalls.d.ts +2 -0
  252. package/dist/src/utils/apiCalls.d.ts.map +1 -0
  253. package/dist/src/utils/apiCalls.js +23 -0
  254. package/dist/src/utils/apiCalls.js.map +1 -0
  255. package/dist/src/utils/devices.d.ts +6 -3
  256. package/dist/src/utils/devices.d.ts.map +1 -1
  257. package/dist/src/utils/devices.js +20 -1
  258. package/dist/src/utils/devices.js.map +1 -1
  259. package/dist/src/utils/patch.d.ts +4 -1
  260. package/dist/src/utils/patch.d.ts.map +1 -1
  261. package/dist/src/utils/patch.js +166 -9
  262. package/dist/src/utils/patch.js.map +1 -1
  263. package/dist/src/utils/status/common.js +13 -12
  264. package/dist/src/utils/status/common.js.map +1 -1
  265. package/dist/src/utils/status/devices.d.ts +3 -3
  266. package/dist/src/utils/status/devices.d.ts.map +1 -1
  267. package/dist/src/utils/status/devices.js +40 -5
  268. package/dist/src/utils/status/devices.js.map +1 -1
  269. package/dist/src/utils/status/fleet.d.ts +4 -4
  270. package/dist/src/utils/status/fleet.d.ts.map +1 -1
  271. package/dist/src/utils/status/fleet.js +15 -2
  272. package/dist/src/utils/status/fleet.js.map +1 -1
  273. package/dist/src/utils/tooltip.d.ts +7 -0
  274. package/dist/src/utils/tooltip.d.ts.map +1 -0
  275. package/dist/src/utils/tooltip.js +6 -0
  276. package/dist/src/utils/tooltip.js.map +1 -0
  277. package/package.json +1 -1
  278. package/src/components/DetailsPage/DetailsPageActions.tsx +34 -6
  279. package/src/components/DetailsPage/Tables/ApplicationsTable.tsx +1 -1
  280. package/src/components/Device/DeviceDetails/DeviceApplications.tsx +3 -3
  281. package/src/components/Device/DeviceDetails/DeviceDetailsPage.tsx +53 -34
  282. package/src/components/Device/DeviceDetails/DeviceDetailsTab.tsx +71 -54
  283. package/src/components/Device/DeviceDetails/DeviceDetailsTabContent/StatusContent.tsx +75 -0
  284. package/src/components/Device/DeviceDetails/DeviceDetailsTabContent/SystemResourcesContent.tsx +47 -0
  285. package/src/components/Device/DeviceDetails/TerminalTab.tsx +1 -4
  286. package/src/components/Device/DevicesPage/DecommissionedDeviceTableRow.tsx +89 -0
  287. package/src/components/Device/DevicesPage/DecommissionedDevicesTable.tsx +156 -0
  288. package/src/components/Device/DevicesPage/DeviceNameOnlyToolbarFilter.tsx +30 -0
  289. package/src/components/Device/DevicesPage/DevicesEmptyStates.tsx +46 -0
  290. package/src/components/Device/DevicesPage/DevicesPage.tsx +45 -215
  291. package/src/components/Device/DevicesPage/{DeviceTableRow.tsx → EnrolledDeviceTableRow.tsx} +16 -20
  292. package/src/components/Device/DevicesPage/EnrolledDevicesTable.tsx +208 -0
  293. package/src/components/Device/DevicesPage/useDevices.ts +21 -1
  294. package/src/components/Device/EditDeviceWizard/EditDeviceWizard.tsx +6 -3
  295. package/src/components/Device/EditDeviceWizard/EditDeviceWizardNav.tsx +1 -1
  296. package/src/components/Device/EditDeviceWizard/steps/ApplicationTemplates.tsx +2 -0
  297. package/src/components/Device/EditDeviceWizard/steps/ConfigInlineTemplateForm.tsx +1 -0
  298. package/src/components/Device/EditDeviceWizard/steps/ConfigurationTemplates.tsx +1 -0
  299. package/src/components/Device/EditDeviceWizard/steps/ReviewDeviceStep.tsx +27 -19
  300. package/src/components/Device/EditDeviceWizard/steps/ReviewUpdatePolicy.tsx +55 -0
  301. package/src/components/Device/EditDeviceWizard/steps/SystemdUnitsForm.tsx +9 -7
  302. package/src/components/EnrollmentRequest/EnrollmentRequestDetails/EnrollmentRequestDetails.tsx +10 -36
  303. package/src/components/EnrollmentRequest/EnrollmentRequestList.tsx +2 -2
  304. package/src/components/EnrollmentRequest/EnrollmentRequestTableRow.tsx +2 -2
  305. package/src/components/EnrollmentRequest/useEnrollmentRequests.ts +3 -2
  306. package/src/components/Fleet/CreateFleet/CreateFleetWizard.tsx +46 -5
  307. package/src/components/Fleet/CreateFleet/CreateFleetWizardFooter.tsx +4 -0
  308. package/src/components/Fleet/CreateFleet/fleetSpecUtils.ts +62 -0
  309. package/src/components/Fleet/CreateFleet/steps/ReviewStep.tsx +65 -30
  310. package/src/components/Fleet/CreateFleet/steps/UpdateConfirmChangesModal.tsx +87 -0
  311. package/src/components/Fleet/CreateFleet/steps/UpdatePolicyStep.tsx +155 -0
  312. package/src/components/Fleet/CreateFleet/steps/UpdateStepDisruptionBudget.tsx +87 -0
  313. package/src/components/Fleet/CreateFleet/steps/UpdateStepRolloutPolicy.tsx +190 -0
  314. package/src/components/Fleet/CreateFleet/types.ts +25 -0
  315. package/src/components/Fleet/CreateFleet/utils.ts +20 -1
  316. package/src/components/Fleet/FleetDetails/FleetDetailsContent.tsx +10 -7
  317. package/src/components/Fleet/FleetDetails/{FleetDevices.tsx → FleetDevicesCharts.tsx} +4 -4
  318. package/src/components/Fleet/FleetDetails/FleetDevicesCount.tsx +53 -0
  319. package/src/components/Fleet/FleetResourceSyncs.tsx +2 -2
  320. package/src/components/Fleet/FleetRow.tsx +12 -4
  321. package/src/components/Fleet/FleetsPage.tsx +2 -2
  322. package/src/components/Fleet/useFleets.ts +7 -7
  323. package/src/components/ListPage/ListPage.tsx +12 -4
  324. package/src/components/ListPage/ListPageActions.tsx +50 -16
  325. package/src/components/ListPage/types.ts +8 -8
  326. package/src/components/OverviewPage/Cards/Status/DeviceStatusChart.tsx +0 -1
  327. package/src/components/OverviewPage/OverviewPage.tsx +12 -4
  328. package/src/components/Repository/RepositoryDetails/RepositoryResourceSyncsCard.tsx +1 -1
  329. package/src/components/Repository/useRepositories.ts +2 -2
  330. package/src/components/ResourceSync/RepositoryResourceSyncList.tsx +2 -2
  331. package/src/components/Status/DeviceLifecycleStatus.tsx +33 -0
  332. package/src/components/Status/StatusDisplay.tsx +4 -4
  333. package/src/components/Table/Table.tsx +2 -1
  334. package/src/components/Table/TablePagination.tsx +9 -7
  335. package/src/components/common/EditableLabelControl.tsx +7 -6
  336. package/src/components/common/TechPreviewBadge.tsx +43 -0
  337. package/src/components/form/LabelsField.tsx +4 -1
  338. package/src/components/form/NumberField.tsx +78 -0
  339. package/src/components/form/TextListField.tsx +82 -0
  340. package/src/components/form/validations.ts +103 -10
  341. package/src/components/modals/DecommissionModal/DecommissionModal.tsx +95 -0
  342. package/src/components/modals/EditLabelsModal/EditLabelsForm.tsx +9 -8
  343. package/src/components/modals/massModals/MassDecommissionDeviceModal/MassDecommissionDeviceModal.tsx +130 -0
  344. package/src/constants.ts +1 -1
  345. package/src/hooks/useAppContext.tsx +1 -1
  346. package/src/hooks/useFetchPeriodically.ts +11 -11
  347. package/src/hooks/{useTablePagination.tsx → useTablePagination.ts} +13 -7
  348. package/src/hooks/useWebSocket.ts +4 -4
  349. package/src/links.ts +2 -0
  350. package/src/types/rbac.ts +2 -0
  351. package/src/utils/api.ts +13 -6
  352. package/src/utils/apiCalls.ts +15 -0
  353. package/src/utils/devices.ts +21 -3
  354. package/src/utils/patch.ts +182 -8
  355. package/src/utils/status/common.ts +8 -8
  356. package/src/utils/status/devices.ts +39 -8
  357. package/src/utils/status/fleet.ts +21 -6
  358. package/src/utils/tooltip.ts +2 -0
  359. package/dist/src/components/DetailsPage/Tables/IntegrityDetails.d.ts +0 -8
  360. package/dist/src/components/DetailsPage/Tables/IntegrityDetails.d.ts.map +0 -1
  361. package/dist/src/components/DetailsPage/Tables/IntegrityDetails.js +0 -23
  362. package/dist/src/components/DetailsPage/Tables/IntegrityDetails.js.map +0 -1
  363. package/dist/src/components/Device/DevicesPage/DeviceTableRow.d.ts +0 -16
  364. package/dist/src/components/Device/DevicesPage/DeviceTableRow.d.ts.map +0 -1
  365. package/dist/src/components/Device/DevicesPage/DeviceTableRow.js.map +0 -1
  366. package/dist/src/components/Fleet/FleetDetails/FleetDevices.d.ts +0 -9
  367. package/dist/src/components/Fleet/FleetDetails/FleetDevices.d.ts.map +0 -1
  368. package/dist/src/components/Fleet/FleetDetails/FleetDevices.js.map +0 -1
  369. package/dist/src/components/Fleet/FleetDetails/FleetDevicesLink.d.ts +0 -7
  370. package/dist/src/components/Fleet/FleetDetails/FleetDevicesLink.d.ts.map +0 -1
  371. package/dist/src/components/Fleet/FleetDetails/FleetDevicesLink.js +0 -13
  372. package/dist/src/components/Fleet/FleetDetails/FleetDevicesLink.js.map +0 -1
  373. package/dist/src/components/Status/IntegrityStatus.d.ts +0 -7
  374. package/dist/src/components/Status/IntegrityStatus.d.ts.map +0 -1
  375. package/dist/src/components/Status/IntegrityStatus.js +0 -17
  376. package/dist/src/components/Status/IntegrityStatus.js.map +0 -1
  377. package/dist/src/utils/status/integrity.d.ts +0 -5
  378. package/dist/src/utils/status/integrity.d.ts.map +0 -1
  379. package/dist/src/utils/status/integrity.js +0 -28
  380. package/dist/src/utils/status/integrity.js.map +0 -1
  381. package/src/components/DetailsPage/Tables/IntegrityDetails.tsx +0 -44
  382. package/src/components/Fleet/FleetDetails/FleetDevicesLink.tsx +0 -16
  383. package/src/components/Status/IntegrityStatus.tsx +0 -19
  384. package/src/utils/status/integrity.ts +0 -26
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { FlightControlQuery } from '../types/extraTypes';
3
- import { getQueryStringHash, getRequestQueryString, isApiQuery } from '../utils/api';
3
+ import { getQueryStringHash, getRequestQueryString } from '../utils/api';
4
4
 
5
5
  import { useFetch } from './useFetch';
6
6
 
@@ -18,11 +18,10 @@ export const useFetchPeriodically = <R>(
18
18
  const ref = React.useRef(0);
19
19
  const prevResolvedQueryHash = React.useRef<string>();
20
20
 
21
- const { get, getMetrics } = useFetch();
21
+ const { get } = useFetch();
22
22
 
23
23
  // When the query parameters change, the hash will too. We must perform a refetch outside the timeout loop
24
24
  const queryStringHash = getQueryStringHash(query);
25
- const isAPI = isApiQuery(query);
26
25
 
27
26
  // Callback that generates the updated query for refreshes. It may provide updated values for parameters such as from/to for metric queries
28
27
  const getRequestQuery = React.useCallback(() => getRequestQueryString(query), [query]);
@@ -40,18 +39,19 @@ export const useFetchPeriodically = <R>(
40
39
  setIsUpdating(true);
41
40
  }
42
41
 
43
- const fetchFn = isAPI ? get : getMetrics;
44
- const data = await fetchFn(requestQuery, abortController.signal);
42
+ const data = (await get<R>(requestQuery, abortController.signal)) as R;
45
43
  if (isLoading) {
46
44
  setIsLoading(false);
47
45
  }
48
46
  setIsUpdating(false);
49
- // eslint-disable-next-line
50
- setData(isAPI ? data : (data as any).data.result);
51
- setError(undefined);
52
- if (isAPI && onFetchComplete) {
53
- onFetchComplete(data as R);
47
+
48
+ if (onFetchComplete) {
49
+ onFetchComplete(data); // Data might be mutated at this point
50
+ setData(data);
51
+ } else {
52
+ setData(data);
54
53
  }
54
+ setError(undefined);
55
55
  } catch (err) {
56
56
  // aborting fetch trows 'AbortError', we can ignore it
57
57
  if (abortController.signal.aborted) {
@@ -78,7 +78,7 @@ export const useFetchPeriodically = <R>(
78
78
  abortController?.abort();
79
79
  };
80
80
  // eslint-disable-next-line
81
- }, [get, getMetrics, forceUpdate, queryStringHash, isAPI]);
81
+ }, [get, forceUpdate, queryStringHash]);
82
82
 
83
83
  const refetch = React.useCallback(() => setForceUpdate((val) => val + 1), []);
84
84
 
@@ -3,15 +3,17 @@ import * as React from 'react';
3
3
  import { ApiList } from '../utils/api';
4
4
  import { PAGE_SIZE } from '../constants';
5
5
 
6
- export type PaginationDetails = {
7
- onPageFetched: (list: ApiList<unknown>) => void;
6
+ export type PaginationDetails<T extends ApiList> = {
7
+ onPageFetched: (data: T) => void;
8
8
  currentPage: number;
9
9
  setCurrentPage: (page: number) => void;
10
10
  nextContinue: string;
11
11
  itemCount: number;
12
12
  };
13
13
 
14
- export const useTablePagination = (): PaginationDetails => {
14
+ type ProcessData<T> = (data: T) => void;
15
+
16
+ export const useTablePagination = <T extends ApiList>(processor?: ProcessData<T>): PaginationDetails<T> => {
15
17
  const [currentPage, setCurrentPage] = React.useState<number>(1);
16
18
  const [continueTokens, setContinueTokens] = React.useState<string[]>([]);
17
19
  const [itemCount, setItemCount] = React.useState<number>(0);
@@ -19,11 +21,15 @@ export const useTablePagination = (): PaginationDetails => {
19
21
  const nextContinue = currentPage <= 1 ? '' : continueTokens[currentPage - 2];
20
22
 
21
23
  const onPageFetched = React.useCallback(
22
- (apiList: ApiList<unknown>) => {
24
+ (data: T) => {
25
+ if (processor) {
26
+ // Can mutate the data
27
+ processor(data);
28
+ }
23
29
  const prevItems = (currentPage - 1) * PAGE_SIZE;
24
- setItemCount(prevItems + (apiList?.items.length || 0) + (apiList.metadata.remainingItemCount || 0));
30
+ setItemCount(prevItems + (data?.items.length || 0) + (data.metadata.remainingItemCount || 0));
25
31
 
26
- const nextToken = apiList.metadata?.continue || '';
32
+ const nextToken = data.metadata?.continue || '';
27
33
  if (currentPage === 1) {
28
34
  // Always reset the list when at first page
29
35
  setContinueTokens([nextToken]);
@@ -37,7 +43,7 @@ export const useTablePagination = (): PaginationDetails => {
37
43
  );
38
44
  }
39
45
  },
40
- [setContinueTokens, continueTokens, setItemCount, currentPage],
46
+ [setContinueTokens, continueTokens, setItemCount, currentPage, processor],
41
47
  );
42
48
 
43
49
  return { onPageFetched, currentPage, setCurrentPage, nextContinue, itemCount };
@@ -3,7 +3,7 @@ import { useTranslation } from './useTranslation';
3
3
  import { useAppContext } from './useAppContext';
4
4
 
5
5
  export const useWebSocket = <T>(
6
- endpoint: string,
6
+ deviceId: string,
7
7
  onMsgReceived: (msg: T) => Promise<void>,
8
8
  ): {
9
9
  sendMessage: (msg: string) => void;
@@ -30,8 +30,8 @@ export const useWebSocket = <T>(
30
30
  try {
31
31
  setIsConnecting(true);
32
32
  setIsClosed(false);
33
- const { wsEndpoint, protocols } = getWsEndpoint();
34
- const ws = new WebSocket(`${wsEndpoint}${endpoint}`, protocols);
33
+ const { wsEndpoint, protocols } = getWsEndpoint(deviceId);
34
+ const ws = new WebSocket(wsEndpoint, protocols);
35
35
  ws.addEventListener('open', () => setIsConnecting(false));
36
36
  ws.addEventListener('close', () => setIsClosed(true));
37
37
  ws.addEventListener('error', (evt) => {
@@ -48,7 +48,7 @@ export const useWebSocket = <T>(
48
48
  wsRef.current?.close();
49
49
  wsRef.current = undefined;
50
50
  };
51
- }, [endpoint, t, getWsEndpoint, reset]);
51
+ }, [deviceId, t, getWsEndpoint, reset]);
52
52
 
53
53
  const reconnect = React.useCallback(() => {
54
54
  wsRef.current?.close();
package/src/links.ts CHANGED
@@ -3,3 +3,5 @@ export const CREATING_APPLICATIONS_LINK =
3
3
 
4
4
  export const USING_TEMPLATE_VARIABLES_LINK =
5
5
  'https://github.com/flightctl/flightctl/blob/main/docs/user/managing-fleets.md#defining-device-templates';
6
+
7
+ export const TECH_PREVIEW_LEVEL_LINK = 'https://access.redhat.com/support/offerings/techpreview';
package/src/types/rbac.ts CHANGED
@@ -5,12 +5,14 @@ export enum VERB {
5
5
  GET = 'get',
6
6
  PATCH = 'patch',
7
7
  POST = 'post',
8
+ UPDATE = 'update',
8
9
  }
9
10
 
10
11
  export enum RESOURCE {
11
12
  FLEET = 'fleets',
12
13
  DEVICE = 'devices',
13
14
  DEVICE_CONSOLE = 'devices/console',
15
+ DEVICE_DECOMMISSION = 'devices/decommission',
14
16
  REPOSITORY = 'repositories',
15
17
  RESOURCE_SYNC = 'resourcesyncs',
16
18
  ENROLLMENT_REQUEST = 'enrollmentrequests',
package/src/utils/api.ts CHANGED
@@ -1,4 +1,14 @@
1
- import { Condition, ConditionStatus, ConditionType, ListMeta, ObjectMeta } from '@flightctl/types';
1
+ import {
2
+ Condition,
3
+ ConditionStatus,
4
+ ConditionType,
5
+ DeviceList,
6
+ EnrollmentRequestList,
7
+ FleetList,
8
+ ObjectMeta,
9
+ RepositoryList,
10
+ ResourceSyncList,
11
+ } from '@flightctl/types';
2
12
 
3
13
  import { AnnotationType, ApiQuery, FlightControlQuery, MetricsQuery } from '../types/extraTypes';
4
14
  import { getPeriodTimestamps } from '../utils/metrics';
@@ -42,12 +52,9 @@ const getRequestQueryString = (queryObj: FlightControlQuery) => {
42
52
  return getMetricsQueryString(queryObj);
43
53
  };
44
54
 
45
- export interface ApiList<R> {
46
- items: Array<R>;
47
- metadata: ListMeta;
48
- }
55
+ export type ApiList = EnrollmentRequestList | DeviceList | FleetList | RepositoryList | ResourceSyncList;
49
56
 
50
- const getApiListCount = <T>(listResponse: ApiList<T> | undefined): number | undefined => {
57
+ const getApiListCount = (listResponse: ApiList | undefined): number | undefined => {
51
58
  if (listResponse === undefined) {
52
59
  return undefined;
53
60
  }
@@ -0,0 +1,15 @@
1
+ export const getErrorMsgFromApiResponse = async (response: Response): Promise<string> => {
2
+ let errorText = '';
3
+ try {
4
+ const msg = await response.text();
5
+ try {
6
+ const json = JSON.parse(msg) as { message: string };
7
+ errorText = json.message;
8
+ } catch (e) {
9
+ errorText = msg;
10
+ }
11
+ } catch (e) {
12
+ //ignore
13
+ }
14
+ return `Error ${response.status}: ${response.statusText}${errorText ? `: ${errorText}` : ''}`;
15
+ };
@@ -1,10 +1,28 @@
1
- import { ObjectMeta } from '@flightctl/types';
1
+ import { Device, ObjectMeta } from '@flightctl/types';
2
+ import { TFunction } from 'react-i18next';
2
3
 
3
4
  const deviceFleetRegExp = /^Fleet\/(?<fleetName>.*)$/;
4
5
 
5
- const getDeviceFleet = (metadata: ObjectMeta) => {
6
+ export const getDeviceFleet = (metadata: ObjectMeta) => {
6
7
  const match = deviceFleetRegExp.exec(metadata.owner || '');
7
8
  return match?.groups?.fleetName || null;
8
9
  };
9
10
 
10
- export { getDeviceFleet };
11
+ export const isDeviceEnrolled = (dev: Device) => !dev.spec?.decommissioning?.target;
12
+
13
+ export const getEditDisabledReason = (device: Device, t: TFunction) => {
14
+ if (getDeviceFleet(device.metadata)) {
15
+ return t('Device is bound to a fleet and its configurations cannot be edited.');
16
+ }
17
+ if (!isDeviceEnrolled(device)) {
18
+ return t('Device already started decommissioning and cannot be edited.');
19
+ }
20
+ return undefined;
21
+ };
22
+
23
+ export const getDecommissionDisabledReason = (device: Device, t: TFunction) => {
24
+ if (!isDeviceEnrolled(device)) {
25
+ return t('Device decommissioning already started.');
26
+ }
27
+ return undefined;
28
+ };
@@ -1,11 +1,16 @@
1
- import { ApplicationSpec, PatchRequest } from '@flightctl/types';
1
+ import { ApplicationSpec, BatchSequence, DisruptionBudget, PatchRequest, RolloutPolicy } from '@flightctl/types';
2
2
  import isNil from 'lodash/isNil';
3
- import isEqual from 'lodash/isEqual';
4
- import differenceWith from 'lodash/differenceWith';
5
3
 
6
4
  import { FlightCtlLabel } from '../types/extraTypes';
7
5
  import { toAPILabel } from './labels';
8
6
  import { ApplicationFormSpec } from '../components/Device/EditDeviceWizard/types';
7
+ import {
8
+ BatchForm,
9
+ BatchLimitType,
10
+ DisruptionBudgetForm,
11
+ FleetFormValues,
12
+ RolloutPolicyForm,
13
+ } from '../components/Fleet/CreateFleet/types';
9
14
 
10
15
  export const appendJSONPatch = <V = unknown>({
11
16
  patches,
@@ -38,6 +43,15 @@ export const appendJSONPatch = <V = unknown>({
38
43
  });
39
44
  };
40
45
 
46
+ const listsHaveDifferences = (arr1: string[], arr2: string[]) => {
47
+ if (arr1.length !== arr2.length) {
48
+ return true;
49
+ }
50
+ return arr1.some((item1, index) => {
51
+ return arr2[index] !== item1;
52
+ });
53
+ };
54
+
41
55
  export const getStringListPatches = (
42
56
  path: string,
43
57
  currentList: string[],
@@ -60,18 +74,178 @@ export const getStringListPatches = (
60
74
  op: 'add',
61
75
  value: valueBuilder(newList),
62
76
  });
63
- } else {
64
- const hasDifferentItems = differenceWith(currentList, newList, isEqual).length > 0;
77
+ } else if (newLen !== curLen || listsHaveDifferences(currentList, newList)) {
78
+ patches.push({
79
+ path,
80
+ op: 'replace',
81
+ value: valueBuilder(newList),
82
+ });
83
+ }
84
+
85
+ return patches;
86
+ };
65
87
 
66
- if (newLen !== curLen || hasDifferentItems) {
88
+ const toApiLimit = (formBatch: BatchForm) => {
89
+ if (!formBatch.limit) {
90
+ return undefined;
91
+ }
92
+ return formBatch.limitType === BatchLimitType.BatchLimitPercent ? `${formBatch.limit}%` : formBatch.limit;
93
+ };
94
+
95
+ const toApiDuration = (minutes: number) => {
96
+ const hours = minutes / 60;
97
+ if (hours % 1 === 0) {
98
+ return `${hours}h`;
99
+ }
100
+ return `${minutes}m`;
101
+ };
102
+
103
+ const toApiDeviceSelection = (policyForm: RolloutPolicyForm): BatchSequence => ({
104
+ strategy: 'BatchSequence',
105
+ sequence: policyForm.batches.map((formBatch) => {
106
+ return {
107
+ limit: toApiLimit(formBatch),
108
+ successThreshold: formBatch.successThreshold ? `${formBatch.successThreshold}%` : undefined,
109
+ selector: {
110
+ matchLabels: toAPILabel(formBatch.selector || []),
111
+ },
112
+ };
113
+ }),
114
+ });
115
+
116
+ const toApiDisruptionBudget = (disruptionValues: DisruptionBudgetForm) => {
117
+ const data: DisruptionBudget = {
118
+ groupBy: disruptionValues.groupBy || [],
119
+ };
120
+ if (typeof disruptionValues.minAvailable === 'number') {
121
+ data.minAvailable = disruptionValues.minAvailable;
122
+ }
123
+ if (typeof disruptionValues.maxUnavailable === 'number') {
124
+ data.maxUnavailable = disruptionValues.maxUnavailable;
125
+ }
126
+
127
+ return data;
128
+ };
129
+
130
+ export const getRolloutPolicyData = ({ rolloutPolicy, disruptionBudget }: FleetFormValues) => {
131
+ const newRolloutPolicy: RolloutPolicy = {};
132
+ if (rolloutPolicy.isAdvanced) {
133
+ newRolloutPolicy.defaultUpdateTimeout = toApiDuration(rolloutPolicy.updateTimeout);
134
+ newRolloutPolicy.deviceSelection = toApiDeviceSelection(rolloutPolicy);
135
+ }
136
+ if (disruptionBudget.isAdvanced) {
137
+ newRolloutPolicy.disruptionBudget = toApiDisruptionBudget(disruptionBudget);
138
+ }
139
+ return newRolloutPolicy;
140
+ };
141
+
142
+ export const getRolloutPolicyPatches = (
143
+ currentPolicy: RolloutPolicy | undefined,
144
+ fleetValues: FleetFormValues,
145
+ ): PatchRequest => {
146
+ const currentBatches = currentPolicy?.deviceSelection?.sequence || [];
147
+ const currentDisruption = currentPolicy?.disruptionBudget;
148
+
149
+ const hadAdvancedSettings = currentBatches.length > 0 || !!currentDisruption;
150
+ const wantsAdvancedSettings = fleetValues.rolloutPolicy.isAdvanced || fleetValues.disruptionBudget.isAdvanced;
151
+ const updatedPolicy = fleetValues.rolloutPolicy;
152
+
153
+ if (hadAdvancedSettings !== wantsAdvancedSettings) {
154
+ return wantsAdvancedSettings
155
+ ? [
156
+ {
157
+ op: 'add',
158
+ path: '/spec/rolloutPolicy',
159
+ value: getRolloutPolicyData(fleetValues),
160
+ },
161
+ ]
162
+ : [
163
+ {
164
+ op: 'remove',
165
+ path: '/spec/rolloutPolicy',
166
+ },
167
+ ];
168
+ }
169
+
170
+ const patches: PatchRequest = [];
171
+ if (fleetValues.rolloutPolicy.isAdvanced) {
172
+ // The timeout will be always expressed in minutes
173
+ if ((currentPolicy?.defaultUpdateTimeout || '') !== (updatedPolicy.updateTimeout || '')) {
174
+ appendJSONPatch({
175
+ patches,
176
+ originalValue: currentPolicy?.defaultUpdateTimeout,
177
+ newValue: toApiDuration(updatedPolicy.updateTimeout),
178
+ path: '/spec/rolloutPolicy/defaultUpdateTimeout',
179
+ });
180
+ }
181
+ if (currentBatches.length === updatedPolicy.batches.length) {
182
+ const hasBatchChanges = currentBatches.some((batch, index) => {
183
+ // The format of the numbers is different, we must convert them for comparison
184
+ const updatedBatch = updatedPolicy.batches[index];
185
+ if ((batch.limit || 0) !== (toApiLimit(updatedBatch) || 0)) {
186
+ return true;
187
+ }
188
+ const updatedThreshold = updatedBatch.successThreshold ? `${updatedBatch.successThreshold}%` : 0;
189
+ if (updatedThreshold !== (batch.successThreshold || 0)) {
190
+ return true;
191
+ }
192
+ const labelPatches = getLabelPatches('labels', batch.selector?.matchLabels || {}, updatedBatch.selector);
193
+ if (labelPatches.length > 0) {
194
+ return true;
195
+ }
196
+ return false;
197
+ });
198
+ if (hasBatchChanges) {
199
+ patches.push({
200
+ path: '/spec/rolloutPolicy/deviceSelection',
201
+ op: 'replace',
202
+ value: toApiDeviceSelection(updatedPolicy),
203
+ });
204
+ }
205
+ } else {
67
206
  patches.push({
68
- path,
207
+ path: '/spec/rolloutPolicy/deviceSelection',
69
208
  op: 'replace',
70
- value: valueBuilder(newList),
209
+ value: toApiDeviceSelection(updatedPolicy),
71
210
  });
72
211
  }
212
+ } else if (currentBatches.length > 0) {
213
+ patches.push({
214
+ path: '/spec/rolloutPolicy/deviceSelection',
215
+ op: 'remove',
216
+ });
217
+ patches.push({
218
+ path: '/spec/rolloutPolicy/defaultUpdateTimeout',
219
+ op: 'remove',
220
+ });
73
221
  }
74
222
 
223
+ if (fleetValues.disruptionBudget.isAdvanced) {
224
+ const hasMinChanged = (currentDisruption?.minAvailable || '') !== (fleetValues.disruptionBudget.minAvailable || '');
225
+ const hasMaxChanged =
226
+ (currentDisruption?.maxUnavailable || '') !== (fleetValues.disruptionBudget.maxUnavailable || '');
227
+
228
+ const hasChanges =
229
+ hasMinChanged ||
230
+ hasMaxChanged ||
231
+ listsHaveDifferences(currentDisruption?.groupBy || [], fleetValues.disruptionBudget.groupBy || []);
232
+
233
+ if (hasChanges) {
234
+ appendJSONPatch({
235
+ path: '/spec/rolloutPolicy/disruptionBudget',
236
+ patches,
237
+ originalValue: currentDisruption,
238
+ newValue: fleetValues.disruptionBudget.isAdvanced
239
+ ? toApiDisruptionBudget(fleetValues.disruptionBudget)
240
+ : undefined,
241
+ });
242
+ }
243
+ } else if (currentDisruption?.minAvailable || currentDisruption?.maxUnavailable) {
244
+ patches.push({
245
+ path: '/spec/rolloutPolicy/disruptionBudget',
246
+ op: 'remove',
247
+ });
248
+ }
75
249
  return patches;
76
250
  };
77
251
 
@@ -6,12 +6,12 @@ import { ExclamationTriangleIcon } from '@patternfly/react-icons/dist/js/icons/e
6
6
  import { CheckCircleIcon } from '@patternfly/react-icons/dist/js/icons/check-circle-icon';
7
7
  import { OutlinedQuestionCircleIcon } from '@patternfly/react-icons/dist/js/icons/outlined-question-circle-icon';
8
8
 
9
- import { global_warning_color_100 as warningColor } from '@patternfly/react-tokens/dist/js/global_warning_color_100';
10
- import { global_danger_color_100 as dangerColor } from '@patternfly/react-tokens/dist/js/global_danger_color_100';
11
- import { global_success_color_100 as successColor } from '@patternfly/react-tokens/dist/js/global_success_color_100';
12
- import { global_disabled_color_100 as unknownColor } from '@patternfly/react-tokens/dist/js/global_disabled_color_100';
13
- import { global_active_color_100 as activeColor } from '@patternfly/react-tokens/dist/js/global_active_color_100';
14
- import { global_palette_black_1000 as blackColor } from '@patternfly/react-tokens/dist/js/global_palette_black_1000';
9
+ import warningColor from '@patternfly/react-tokens/dist/js/global_warning_color_100';
10
+ import dangerColor from '@patternfly/react-tokens/dist/js/global_danger_color_100';
11
+ import successColor from '@patternfly/react-tokens/dist/js/global_success_color_100';
12
+ import disabledColor from '@patternfly/react-tokens/dist/js/global_disabled_color_100';
13
+ import activeColor from '@patternfly/react-tokens/dist/js/global_active_color_100';
14
+ import defaultColor from '@patternfly/react-tokens/dist/js/global_palette_black_1000';
15
15
 
16
16
  export type StatusLevel = 'custom' | 'info' | 'success' | 'warning' | 'danger' | 'unknown';
17
17
 
@@ -61,10 +61,10 @@ export const getDefaultStatusColor = (level: StatusLevel) => {
61
61
  color = successColor.value;
62
62
  break;
63
63
  case 'custom':
64
- color = blackColor.value;
64
+ color = defaultColor.value;
65
65
  break;
66
66
  default:
67
- color = unknownColor.value;
67
+ color = disabledColor.value;
68
68
  break;
69
69
  }
70
70
  return color;
@@ -1,13 +1,14 @@
1
1
  import { TFunction } from 'react-i18next';
2
2
  import { PowerOffIcon } from '@patternfly/react-icons/dist/js/icons';
3
+ import BanIcon from '@patternfly/react-icons/dist/js/icons/ban-icon';
3
4
 
4
5
  import {
5
6
  ApplicationsSummaryStatusType,
6
7
  DeviceSummaryStatus as BEDeviceSummaryStatus,
7
- DeviceApplicationsSummaryStatus,
8
+ Device,
8
9
  DeviceIntegrityStatusSummaryType,
10
+ DeviceLifecycleStatusType,
9
11
  DeviceSummaryStatusType,
10
- DeviceUpdatedStatus,
11
12
  DeviceUpdatedStatusType,
12
13
  } from '@flightctl/types';
13
14
  import { StatusItem } from './common';
@@ -30,13 +31,19 @@ export type DeviceSummaryStatus =
30
31
  export const getDeviceSummaryStatus = (deviceStatus?: BEDeviceSummaryStatus): DeviceSummaryStatusType =>
31
32
  deviceStatus?.status || DeviceSummaryStatusType.DeviceSummaryStatusUnknown;
32
33
 
33
- export const getApplicationSummaryStatus = (
34
- appSummaryStatus?: DeviceApplicationsSummaryStatus,
35
- ): ApplicationsSummaryStatusType =>
36
- appSummaryStatus?.status || ApplicationsSummaryStatusType.ApplicationsSummaryStatusUnknown;
34
+ export const getDeviceLifecycleStatus = (device: Device): DeviceLifecycleStatusType => {
35
+ const lifecycleStatus = device.status?.lifecycle?.status || DeviceLifecycleStatusType.DeviceLifecycleStatusEnrolled;
36
+ const isDecomStatus = [
37
+ DeviceLifecycleStatusType.DeviceLifecycleStatusDecommissioning,
38
+ DeviceLifecycleStatusType.DeviceLifecycleStatusDecommissioned,
39
+ ].includes(lifecycleStatus);
37
40
 
38
- export const getSystemUpdateStatus = (updatedStatus?: DeviceUpdatedStatus): DeviceUpdatedStatusType =>
39
- updatedStatus?.status || DeviceUpdatedStatusType.DeviceUpdatedStatusUnknown;
41
+ if (!isDecomStatus && device.spec?.decommissioning?.target) {
42
+ return DeviceLifecycleStatusType.DeviceLifecycleStatusDecommissioning;
43
+ }
44
+
45
+ return lifecycleStatus;
46
+ };
40
47
 
41
48
  export const getDeviceStatusItems = (t: TFunction): StatusItem<DeviceSummaryStatusType>[] => [
42
49
  {
@@ -72,4 +79,28 @@ export const getDeviceStatusItems = (t: TFunction): StatusItem<DeviceSummaryStat
72
79
  },
73
80
  ];
74
81
 
82
+ export const getDeviceLifecycleStatusItems = (t: TFunction): StatusItem<DeviceLifecycleStatusType>[] => [
83
+ {
84
+ id: DeviceLifecycleStatusType.DeviceLifecycleStatusDecommissioned,
85
+ label: t('Decommissioned'),
86
+ level: 'unknown',
87
+ customIcon: BanIcon,
88
+ },
89
+ {
90
+ id: DeviceLifecycleStatusType.DeviceLifecycleStatusDecommissioning,
91
+ label: t('Decommissioning'),
92
+ level: 'warning',
93
+ },
94
+ {
95
+ id: DeviceLifecycleStatusType.DeviceLifecycleStatusUnknown,
96
+ label: t('Unknown'),
97
+ level: 'unknown',
98
+ },
99
+ {
100
+ id: DeviceLifecycleStatusType.DeviceLifecycleStatusEnrolled,
101
+ label: t('Enrolled'),
102
+ level: 'success',
103
+ },
104
+ ];
105
+
75
106
  export const deviceStatusOrder = getDeviceStatusItems((s: string) => s).map((item) => item.id);
@@ -1,18 +1,21 @@
1
- import { ConditionStatus, ConditionType, Fleet } from '@flightctl/types';
2
- import { FleetConditionType } from '../../types/extraTypes';
3
1
  import { TFunction } from 'i18next';
2
+
3
+ import { Condition, ConditionStatus, ConditionType, Fleet } from '@flightctl/types';
4
+ import { FleetConditionType } from '../../types/extraTypes';
4
5
  import { getConditionMessage } from '../error';
5
6
 
6
- const fleetStatusLabels = (t: TFunction) => ({
7
+ const FLEET_ROLLOUT_FAILED_REASON = 'Suspended';
8
+
9
+ export const fleetStatusLabels = (t: TFunction) => ({
7
10
  [ConditionType.FleetOverlappingSelectors]: t('Selectors overlap'),
8
11
  [ConditionType.FleetValid]: t('Valid'),
9
12
  Invalid: t('Invalid'),
10
13
  SyncPending: t('Sync pending'),
11
14
  });
12
15
 
13
- const getFleetSyncStatus = (
16
+ export const getFleetSyncStatus = (
14
17
  fleet: Fleet,
15
- t: TFunction = (s: string) => s,
18
+ t: TFunction,
16
19
  ): {
17
20
  status: FleetConditionType;
18
21
  message: string | undefined;
@@ -44,4 +47,16 @@ const getFleetSyncStatus = (
44
47
  };
45
48
  };
46
49
 
47
- export { getFleetSyncStatus, fleetStatusLabels };
50
+ const isFleetRolloutFailedCondition = (condition: Condition) =>
51
+ condition.type === ConditionType.FleetRolloutInProgress &&
52
+ condition.status === ConditionStatus.ConditionStatusFalse &&
53
+ condition.reason === FLEET_ROLLOUT_FAILED_REASON;
54
+
55
+ export const getFleetRolloutStatusWarning = (fleet: Fleet, t: TFunction) => {
56
+ const failedRolloutCondition = fleet.status?.conditions?.find(isFleetRolloutFailedCondition);
57
+
58
+ if (failedRolloutCondition) {
59
+ return getConditionMessage(failedRolloutCondition) || t('Last rollout did not complete successfully');
60
+ }
61
+ return undefined;
62
+ };
@@ -0,0 +1,2 @@
1
+ export const getDisabledTooltipProps = (disabledReason: string | undefined) =>
2
+ disabledReason ? { isAriaDisabled: true, tooltipProps: { content: disabledReason } } : undefined;
@@ -1,8 +0,0 @@
1
- import * as React from 'react';
2
- import { DeviceIntegrityStatus } from '@flightctl/types';
3
- type IntegrityDetailsProps = {
4
- integrity?: DeviceIntegrityStatus;
5
- };
6
- declare const IntegrityDetails: ({ integrity }: IntegrityDetailsProps) => React.JSX.Element;
7
- export default IntegrityDetails;
8
- //# sourceMappingURL=IntegrityDetails.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IntegrityDetails.d.ts","sourceRoot":"","sources":["../../../../../src/components/DetailsPage/Tables/IntegrityDetails.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAKzD,KAAK,qBAAqB,GAAG;IAC3B,SAAS,CAAC,EAAE,qBAAqB,CAAC;CACnC,CAAC;AAEF,QAAA,MAAM,gBAAgB,kBAAmB,qBAAqB,sBAwB7D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const React = tslib_1.__importStar(require("react"));
5
- const react_core_1 = require("@patternfly/react-core");
6
- const useTranslation_1 = require("../../../hooks/useTranslation");
7
- const IntegrityStatus_1 = tslib_1.__importDefault(require("../../Status/IntegrityStatus"));
8
- const FlightCtlDescriptionList_1 = tslib_1.__importDefault(require("../../common/FlightCtlDescriptionList"));
9
- const IntegrityDetails = ({ integrity }) => {
10
- const { t } = (0, useTranslation_1.useTranslation)();
11
- const info = integrity === null || integrity === void 0 ? void 0 : integrity.summary.info;
12
- const status = integrity === null || integrity === void 0 ? void 0 : integrity.summary.status;
13
- return info || status ? (React.createElement(FlightCtlDescriptionList_1.default, { columnModifier: { lg: '3Col' } },
14
- status && (React.createElement(react_core_1.DescriptionListGroup, null,
15
- React.createElement(react_core_1.DescriptionListTerm, null, t('Status')),
16
- React.createElement(react_core_1.DescriptionListDescription, null,
17
- React.createElement(IntegrityStatus_1.default, { status: status })))),
18
- info && (React.createElement(react_core_1.DescriptionListGroup, null,
19
- React.createElement(react_core_1.DescriptionListTerm, null, t('Details')),
20
- React.createElement(react_core_1.DescriptionListDescription, null, info))))) : (React.createElement(react_core_1.Bullseye, null, t('No system integrity details found.')));
21
- };
22
- exports.default = IntegrityDetails;
23
- //# sourceMappingURL=IntegrityDetails.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IntegrityDetails.js","sourceRoot":"","sources":["../../../../../src/components/DetailsPage/Tables/IntegrityDetails.tsx"],"names":[],"mappings":";;;AAAA,qDAA+B;AAC/B,uDAKgC;AAGhC,kEAA+D;AAC/D,2FAA2D;AAC3D,6GAAiF;AAMjF,MAAM,gBAAgB,GAAG,CAAC,EAAE,SAAS,EAAyB,EAAE,EAAE;IAChE,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,+BAAc,GAAE,CAAC;IAC/B,MAAM,IAAI,GAAG,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,OAAO,CAAC,IAAI,CAAC;IACrC,MAAM,MAAM,GAAG,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,OAAO,CAAC,MAAM,CAAC;IACzC,OAAO,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,CACtB,oBAAC,kCAA4B,IAAC,cAAc,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE;QACzD,MAAM,IAAI,CACT,oBAAC,iCAAoB;YACnB,oBAAC,gCAAmB,QAAE,CAAC,CAAC,QAAQ,CAAC,CAAuB;YACxD,oBAAC,uCAA0B;gBACzB,oBAAC,yBAAe,IAAC,MAAM,EAAE,MAAM,GAAI,CACR,CACR,CACxB;QACA,IAAI,IAAI,CACP,oBAAC,iCAAoB;YACnB,oBAAC,gCAAmB,QAAE,CAAC,CAAC,SAAS,CAAC,CAAuB;YACzD,oBAAC,uCAA0B,QAAE,IAAI,CAA8B,CAC1C,CACxB,CAC4B,CAChC,CAAC,CAAC,CAAC,CACF,oBAAC,qBAAQ,QAAE,CAAC,CAAC,oCAAoC,CAAC,CAAY,CAC/D,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,gBAAgB,CAAC"}