@flightctl/ui-components 0.5.1 → 0.6.0-rc1
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.
- package/dist/src/components/DetailsPage/DetailsPage.d.ts +3 -2
- package/dist/src/components/DetailsPage/DetailsPage.d.ts.map +1 -1
- package/dist/src/components/DetailsPage/DetailsPage.js +2 -2
- package/dist/src/components/DetailsPage/DetailsPage.js.map +1 -1
- package/dist/src/components/DetailsPage/Tables/ApplicationsTable.d.ts.map +1 -1
- package/dist/src/components/DetailsPage/Tables/ApplicationsTable.js +5 -3
- package/dist/src/components/DetailsPage/Tables/ApplicationsTable.js.map +1 -1
- package/dist/src/components/Device/AddDeviceModal/AddDeviceModal.d.ts.map +1 -1
- package/dist/src/components/Device/AddDeviceModal/AddDeviceModal.js +4 -5
- package/dist/src/components/Device/AddDeviceModal/AddDeviceModal.js.map +1 -1
- package/dist/src/components/Device/DeviceDetails/DeviceAliasEdit.d.ts +10 -0
- package/dist/src/components/Device/DeviceDetails/DeviceAliasEdit.d.ts.map +1 -0
- package/dist/src/components/Device/DeviceDetails/DeviceAliasEdit.js +110 -0
- package/dist/src/components/Device/DeviceDetails/DeviceAliasEdit.js.map +1 -0
- package/dist/src/components/Device/DeviceDetails/DeviceApplications.d.ts.map +1 -1
- package/dist/src/components/Device/DeviceDetails/DeviceApplications.js +7 -1
- package/dist/src/components/Device/DeviceDetails/DeviceApplications.js.map +1 -1
- package/dist/src/components/Device/DeviceDetails/DeviceDetailsPage.d.ts.map +1 -1
- package/dist/src/components/Device/DeviceDetails/DeviceDetailsPage.js +9 -6
- package/dist/src/components/Device/DeviceDetails/DeviceDetailsPage.js.map +1 -1
- package/dist/src/components/Device/DeviceDetails/DeviceDetailsTab.d.ts.map +1 -1
- package/dist/src/components/Device/DeviceDetails/DeviceDetailsTab.js +1 -1
- package/dist/src/components/Device/DeviceDetails/DeviceDetailsTab.js.map +1 -1
- package/dist/src/components/Device/DeviceDetails/DeviceDetailsTabContent/StatusContent.d.ts.map +1 -1
- package/dist/src/components/Device/DeviceDetails/DeviceDetailsTabContent/StatusContent.js +3 -3
- package/dist/src/components/Device/DeviceDetails/DeviceDetailsTabContent/StatusContent.js.map +1 -1
- package/dist/src/components/Device/DeviceDetails/DeviceDetailsTabContent/SystemResourcesContent.js +3 -3
- package/dist/src/components/Device/DeviceDetails/TerminalTab.d.ts.map +1 -1
- package/dist/src/components/Device/DeviceDetails/TerminalTab.js +34 -3
- package/dist/src/components/Device/DeviceDetails/TerminalTab.js.map +1 -1
- package/dist/src/components/Device/DevicesPage/DecommissionedDevicesTable.d.ts.map +1 -1
- package/dist/src/components/Device/DevicesPage/DecommissionedDevicesTable.js +1 -1
- package/dist/src/components/Device/DevicesPage/DecommissionedDevicesTable.js.map +1 -1
- package/dist/src/components/Device/DevicesPage/DeviceToolbarFilters.d.ts.map +1 -1
- package/dist/src/components/Device/DevicesPage/DeviceToolbarFilters.js +35 -30
- package/dist/src/components/Device/DevicesPage/DeviceToolbarFilters.js.map +1 -1
- package/dist/src/components/Device/DevicesPage/DevicesPage.d.ts.map +1 -1
- package/dist/src/components/Device/DevicesPage/DevicesPage.js +11 -2
- package/dist/src/components/Device/DevicesPage/DevicesPage.js.map +1 -1
- package/dist/src/components/Device/DevicesPage/EnrolledDevicesTable.d.ts.map +1 -1
- package/dist/src/components/Device/DevicesPage/EnrolledDevicesTable.js +14 -11
- package/dist/src/components/Device/DevicesPage/EnrolledDevicesTable.js.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/EditDeviceWizard.d.ts.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/EditDeviceWizard.js +9 -2
- package/dist/src/components/Device/EditDeviceWizard/EditDeviceWizard.js.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/EditDeviceWizardFooter.d.ts.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/EditDeviceWizardFooter.js +21 -6
- package/dist/src/components/Device/EditDeviceWizard/EditDeviceWizardFooter.js.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/EditDeviceWizardNav.d.ts.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/EditDeviceWizardNav.js +11 -4
- package/dist/src/components/Device/EditDeviceWizard/EditDeviceWizardNav.js.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/deviceSpecUtils.d.ts +6 -5
- package/dist/src/components/Device/EditDeviceWizard/deviceSpecUtils.d.ts.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/deviceSpecUtils.js +123 -10
- package/dist/src/components/Device/EditDeviceWizard/deviceSpecUtils.js.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/steps/ApplicationImageForm.d.ts +8 -0
- package/dist/src/components/Device/EditDeviceWizard/steps/ApplicationImageForm.d.ts.map +1 -0
- package/dist/src/components/Device/EditDeviceWizard/steps/ApplicationImageForm.js +19 -0
- package/dist/src/components/Device/EditDeviceWizard/steps/ApplicationImageForm.js.map +1 -0
- package/dist/src/components/Device/EditDeviceWizard/steps/ApplicationInlineForm.d.ts +8 -0
- package/dist/src/components/Device/EditDeviceWizard/steps/ApplicationInlineForm.d.ts.map +1 -0
- package/dist/src/components/Device/EditDeviceWizard/steps/ApplicationInlineForm.js +49 -0
- package/dist/src/components/Device/EditDeviceWizard/steps/ApplicationInlineForm.js.map +1 -0
- package/dist/src/components/Device/EditDeviceWizard/steps/ApplicationTemplates.d.ts.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/steps/ApplicationTemplates.js +52 -19
- package/dist/src/components/Device/EditDeviceWizard/steps/ApplicationTemplates.js.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/steps/ConfigInlineTemplateForm.d.ts.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/steps/ConfigInlineTemplateForm.js +13 -16
- package/dist/src/components/Device/EditDeviceWizard/steps/ConfigInlineTemplateForm.js.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/steps/ConfigK8sSecretTemplateForm.d.ts.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/steps/ConfigK8sSecretTemplateForm.js.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/steps/ConfigWithRepositoryTemplateForm.d.ts.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/steps/ConfigWithRepositoryTemplateForm.js +5 -5
- package/dist/src/components/Device/EditDeviceWizard/steps/ConfigWithRepositoryTemplateForm.js.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/steps/ConfigurationTemplates.d.ts.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/steps/ConfigurationTemplates.js +2 -2
- package/dist/src/components/Device/EditDeviceWizard/steps/ConfigurationTemplates.js.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/steps/DeviceTemplateStep.d.ts +1 -1
- package/dist/src/components/Device/EditDeviceWizard/steps/DeviceTemplateStep.d.ts.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/steps/DeviceTemplateStep.js +16 -16
- package/dist/src/components/Device/EditDeviceWizard/steps/DeviceTemplateStep.js.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/steps/DeviceUpdateStep.d.ts +8 -0
- package/dist/src/components/Device/EditDeviceWizard/steps/DeviceUpdateStep.d.ts.map +1 -0
- package/dist/src/components/Device/EditDeviceWizard/steps/DeviceUpdateStep.js +58 -0
- package/dist/src/components/Device/EditDeviceWizard/steps/DeviceUpdateStep.js.map +1 -0
- package/dist/src/components/Device/EditDeviceWizard/steps/GeneralInfoStep.d.ts +1 -1
- package/dist/src/components/Device/EditDeviceWizard/steps/GeneralInfoStep.d.ts.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/steps/ReviewApplications.d.ts +2 -2
- package/dist/src/components/Device/EditDeviceWizard/steps/ReviewApplications.d.ts.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/steps/ReviewApplications.js +17 -12
- package/dist/src/components/Device/EditDeviceWizard/steps/ReviewApplications.js.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/steps/ReviewDeviceStep.js +1 -1
- package/dist/src/components/Device/EditDeviceWizard/steps/ReviewTrackedSystemdServices.d.ts +2 -4
- package/dist/src/components/Device/EditDeviceWizard/steps/ReviewTrackedSystemdServices.d.ts.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/steps/ReviewTrackedSystemdServices.js.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/steps/ReviewUpdatePolicy.d.ts +1 -1
- package/dist/src/components/Device/EditDeviceWizard/steps/ReviewUpdatePolicy.d.ts.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/steps/ReviewUpdatePolicy.js.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/utils.d.ts +29 -3
- package/dist/src/components/Device/EditDeviceWizard/utils.d.ts.map +1 -1
- package/dist/src/components/Device/EditDeviceWizard/utils.js +8 -7
- package/dist/src/components/Device/EditDeviceWizard/utils.js.map +1 -1
- package/dist/src/components/Device/SystemdUnitsModal/SystemdUnitsModal.d.ts.map +1 -1
- package/dist/src/components/Device/SystemdUnitsModal/SystemdUnitsModal.js.map +1 -1
- package/dist/src/components/Device/SystemdUnitsModal/TrackSystemdUnitsForm.d.ts +1 -4
- package/dist/src/components/Device/SystemdUnitsModal/TrackSystemdUnitsForm.d.ts.map +1 -1
- package/dist/src/components/Device/SystemdUnitsModal/TrackSystemdUnitsForm.js.map +1 -1
- package/dist/src/components/EnrollmentRequest/EnrollmentRequestDetails/EnrollmentRequestDetails.d.ts.map +1 -1
- package/dist/src/components/EnrollmentRequest/EnrollmentRequestDetails/EnrollmentRequestDetails.js +5 -5
- package/dist/src/components/EnrollmentRequest/EnrollmentRequestDetails/EnrollmentRequestDetails.js.map +1 -1
- package/dist/src/components/EnrollmentRequest/EnrollmentRequestList.d.ts +2 -1
- package/dist/src/components/EnrollmentRequest/EnrollmentRequestList.d.ts.map +1 -1
- package/dist/src/components/EnrollmentRequest/EnrollmentRequestList.js +19 -11
- package/dist/src/components/EnrollmentRequest/EnrollmentRequestList.js.map +1 -1
- package/dist/src/components/EnrollmentRequest/EnrollmentRequestTableRow.d.ts.map +1 -1
- package/dist/src/components/EnrollmentRequest/EnrollmentRequestTableRow.js +5 -1
- package/dist/src/components/EnrollmentRequest/EnrollmentRequestTableRow.js.map +1 -1
- package/dist/src/components/EnrollmentRequest/useEnrollmentRequests.d.ts +2 -1
- package/dist/src/components/EnrollmentRequest/useEnrollmentRequests.d.ts.map +1 -1
- package/dist/src/components/EnrollmentRequest/useEnrollmentRequests.js +8 -4
- package/dist/src/components/EnrollmentRequest/useEnrollmentRequests.js.map +1 -1
- package/dist/src/components/Fleet/CreateFleet/CreateFleetWizard.d.ts.map +1 -1
- package/dist/src/components/Fleet/CreateFleet/CreateFleetWizard.js +2 -2
- package/dist/src/components/Fleet/CreateFleet/CreateFleetWizard.js.map +1 -1
- package/dist/src/components/Fleet/CreateFleet/CreateFleetWizardFooter.d.ts.map +1 -1
- package/dist/src/components/Fleet/CreateFleet/CreateFleetWizardFooter.js +8 -1
- package/dist/src/components/Fleet/CreateFleet/CreateFleetWizardFooter.js.map +1 -1
- package/dist/src/components/Fleet/CreateFleet/fleetSpecUtils.d.ts +19 -2
- package/dist/src/components/Fleet/CreateFleet/fleetSpecUtils.d.ts.map +1 -1
- package/dist/src/components/Fleet/CreateFleet/fleetSpecUtils.js +53 -18
- package/dist/src/components/Fleet/CreateFleet/fleetSpecUtils.js.map +1 -1
- package/dist/src/components/Fleet/CreateFleet/steps/DeviceLabelSelector.js +1 -1
- package/dist/src/components/Fleet/CreateFleet/steps/DeviceLabelSelector.js.map +1 -1
- package/dist/src/components/Fleet/CreateFleet/steps/GeneralInfoStep.d.ts +1 -1
- package/dist/src/components/Fleet/CreateFleet/steps/GeneralInfoStep.d.ts.map +1 -1
- package/dist/src/components/Fleet/CreateFleet/steps/GeneralInfoStep.js +1 -2
- package/dist/src/components/Fleet/CreateFleet/steps/GeneralInfoStep.js.map +1 -1
- package/dist/src/components/Fleet/CreateFleet/steps/ReviewStep.js +1 -1
- package/dist/src/components/Fleet/CreateFleet/steps/UpdateConfirmChangesModal.d.ts +1 -1
- package/dist/src/components/Fleet/CreateFleet/steps/UpdateConfirmChangesModal.d.ts.map +1 -1
- package/dist/src/components/Fleet/CreateFleet/steps/UpdateConfirmChangesModal.js +9 -0
- package/dist/src/components/Fleet/CreateFleet/steps/UpdateConfirmChangesModal.js.map +1 -1
- package/dist/src/components/Fleet/CreateFleet/steps/UpdatePolicyStep.d.ts +1 -1
- package/dist/src/components/Fleet/CreateFleet/steps/UpdatePolicyStep.d.ts.map +1 -1
- package/dist/src/components/Fleet/CreateFleet/steps/UpdatePolicyStep.js +22 -9
- package/dist/src/components/Fleet/CreateFleet/steps/UpdatePolicyStep.js.map +1 -1
- package/dist/src/components/Fleet/CreateFleet/steps/UpdateStepDisruptionBudget.d.ts.map +1 -1
- package/dist/src/components/Fleet/CreateFleet/steps/UpdateStepDisruptionBudget.js +4 -4
- package/dist/src/components/Fleet/CreateFleet/steps/UpdateStepDisruptionBudget.js.map +1 -1
- package/dist/src/components/Fleet/CreateFleet/steps/UpdateStepRolloutPolicy.d.ts.map +1 -1
- package/dist/src/components/Fleet/CreateFleet/steps/UpdateStepRolloutPolicy.js +5 -5
- package/dist/src/components/Fleet/CreateFleet/steps/UpdateStepRolloutPolicy.js.map +1 -1
- package/dist/src/components/Fleet/CreateFleet/steps/UpdateStepUpdatePolicy.css +3 -0
- package/dist/src/components/Fleet/CreateFleet/steps/UpdateStepUpdatePolicy.d.ts +9 -0
- package/dist/src/components/Fleet/CreateFleet/steps/UpdateStepUpdatePolicy.d.ts.map +1 -0
- package/dist/src/components/Fleet/CreateFleet/steps/UpdateStepUpdatePolicy.js +127 -0
- package/dist/src/components/Fleet/CreateFleet/steps/UpdateStepUpdatePolicy.js.map +1 -0
- package/dist/src/components/Fleet/CreateFleet/utils.d.ts +1 -1
- package/dist/src/components/Fleet/CreateFleet/utils.d.ts.map +1 -1
- package/dist/src/components/Fleet/CreateFleet/utils.js +13 -4
- package/dist/src/components/Fleet/CreateFleet/utils.js.map +1 -1
- package/dist/src/components/Fleet/FleetsPage.d.ts.map +1 -1
- package/dist/src/components/Fleet/FleetsPage.js +8 -12
- package/dist/src/components/Fleet/FleetsPage.js.map +1 -1
- package/dist/src/components/Fleet/ImportFleetWizard/steps/ResourceSyncStep.js +1 -1
- package/dist/src/components/Fleet/ImportFleetWizard/steps/ResourceSyncStep.js.map +1 -1
- package/dist/src/components/ListPage/ListPage.d.ts +1 -0
- package/dist/src/components/ListPage/ListPage.d.ts.map +1 -1
- package/dist/src/components/ListPage/ListPage.js +3 -3
- package/dist/src/components/ListPage/ListPage.js.map +1 -1
- package/dist/src/components/Masthead/CommandLineToolsPage.d.ts +4 -0
- package/dist/src/components/Masthead/CommandLineToolsPage.d.ts.map +1 -0
- package/dist/src/components/Masthead/CommandLineToolsPage.js +90 -0
- package/dist/src/components/Masthead/CommandLineToolsPage.js.map +1 -0
- package/dist/src/components/Masthead/UserPreferencesModal.d.ts.map +1 -0
- package/dist/src/components/Masthead/UserPreferencesModal.js.map +1 -0
- package/dist/src/components/Masthead/UserPreferencesProvider.d.ts.map +1 -0
- package/dist/src/components/Masthead/UserPreferencesProvider.js.map +1 -0
- package/dist/src/components/OverviewPage/Cards/Status/StatusCard.js +3 -3
- package/dist/src/components/OverviewPage/Cards/Status/StatusCard.js.map +1 -1
- package/dist/src/components/OverviewPage/Cards/Tasks/TasksCard.d.ts +4 -0
- package/dist/src/components/OverviewPage/Cards/Tasks/TasksCard.d.ts.map +1 -0
- package/dist/src/components/OverviewPage/Cards/{ToDo/ToDoCard.js → Tasks/TasksCard.js} +4 -4
- package/dist/src/components/OverviewPage/Cards/Tasks/TasksCard.js.map +1 -0
- package/dist/src/components/OverviewPage/Overview.js +2 -2
- package/dist/src/components/OverviewPage/Overview.js.map +1 -1
- package/dist/src/components/Repository/CreateRepository/CreateRepositoryForm.d.ts.map +1 -1
- package/dist/src/components/Repository/CreateRepository/CreateRepositoryForm.js +6 -5
- package/dist/src/components/Repository/CreateRepository/CreateRepositoryForm.js.map +1 -1
- package/dist/src/components/Repository/CreateRepository/CreateResourceSyncsForm.d.ts.map +1 -1
- package/dist/src/components/Repository/CreateRepository/CreateResourceSyncsForm.js +3 -3
- package/dist/src/components/Repository/CreateRepository/CreateResourceSyncsForm.js.map +1 -1
- package/dist/src/components/Repository/CreateRepository/utils.d.ts.map +1 -1
- package/dist/src/components/Repository/CreateRepository/utils.js +4 -1
- package/dist/src/components/Repository/CreateRepository/utils.js.map +1 -1
- package/dist/src/components/Repository/RepositoryDetails/RepositoryResourceSyncsCard.d.ts.map +1 -1
- package/dist/src/components/Repository/RepositoryDetails/RepositoryResourceSyncsCard.js +1 -1
- package/dist/src/components/Repository/RepositoryDetails/RepositoryResourceSyncsCard.js.map +1 -1
- package/dist/src/components/Repository/RepositoryList.d.ts.map +1 -1
- package/dist/src/components/Repository/RepositoryList.js +3 -11
- package/dist/src/components/Repository/RepositoryList.js.map +1 -1
- package/dist/src/components/ResourceSync/RepositoryResourceSyncList.d.ts.map +1 -1
- package/dist/src/components/ResourceSync/RepositoryResourceSyncList.js +3 -6
- package/dist/src/components/ResourceSync/RepositoryResourceSyncList.js.map +1 -1
- package/dist/src/components/Status/DeviceResourceStatus.js +3 -3
- package/dist/src/components/Status/utils.d.ts.map +1 -1
- package/dist/src/components/Status/utils.js +3 -3
- package/dist/src/components/Status/utils.js.map +1 -1
- package/dist/src/components/Table/Table.d.ts +2 -1
- package/dist/src/components/Table/Table.d.ts.map +1 -1
- package/dist/src/components/Table/Table.js +9 -5
- package/dist/src/components/Table/Table.js.map +1 -1
- package/dist/src/components/Table/TablePagination.d.ts.map +1 -1
- package/dist/src/components/Table/TablePagination.js +1 -1
- package/dist/src/components/Table/TablePagination.js.map +1 -1
- package/dist/src/components/Terminal/Terminal.d.ts +1 -1
- package/dist/src/components/Terminal/Terminal.d.ts.map +1 -1
- package/dist/src/components/Terminal/Terminal.js +10 -3
- package/dist/src/components/Terminal/Terminal.js.map +1 -1
- package/dist/src/components/charts/DonutChart.js +1 -1
- package/dist/src/components/charts/DonutChart.js.map +1 -1
- package/dist/src/components/common/LeaveFormConfirmation.js +1 -1
- package/dist/src/components/common/LeaveFormConfirmation.js.map +1 -1
- package/dist/src/components/common/WithHelperText.d.ts +10 -5
- package/dist/src/components/common/WithHelperText.d.ts.map +1 -1
- package/dist/src/components/common/WithHelperText.js +13 -8
- package/dist/src/components/common/WithHelperText.js.map +1 -1
- package/dist/src/components/form/CheckboxField.d.ts +6 -3
- package/dist/src/components/form/CheckboxField.d.ts.map +1 -1
- package/dist/src/components/form/CheckboxField.js +20 -1
- package/dist/src/components/form/CheckboxField.js.map +1 -1
- package/dist/src/components/form/FormSelectTypeahead.d.ts +3 -3
- package/dist/src/components/form/FormSelectTypeahead.d.ts.map +1 -1
- package/dist/src/components/form/FormSelectTypeahead.js +43 -53
- package/dist/src/components/form/FormSelectTypeahead.js.map +1 -1
- package/dist/src/components/form/RichValidationTextField.d.ts +1 -1
- package/dist/src/components/form/RichValidationTextField.d.ts.map +1 -1
- package/dist/src/components/form/RichValidationTextField.js +8 -4
- package/dist/src/components/form/RichValidationTextField.js.map +1 -1
- package/dist/src/components/form/validations.d.ts +44 -4
- package/dist/src/components/form/validations.d.ts.map +1 -1
- package/dist/src/components/form/validations.js +148 -25
- package/dist/src/components/form/validations.js.map +1 -1
- package/dist/src/components/modals/ApproveDeviceModal/ApproveDeviceForm.js +5 -3
- package/dist/src/components/modals/ApproveDeviceModal/ApproveDeviceForm.js.map +1 -1
- package/dist/src/components/modals/ApproveDeviceModal/ApproveDeviceModal.d.ts.map +1 -1
- package/dist/src/components/modals/ApproveDeviceModal/ApproveDeviceModal.js +3 -2
- package/dist/src/components/modals/ApproveDeviceModal/ApproveDeviceModal.js.map +1 -1
- package/dist/src/components/modals/EditLabelsModal/EditLabelsForm.d.ts.map +1 -1
- package/dist/src/components/modals/EditLabelsModal/EditLabelsForm.js +7 -12
- package/dist/src/components/modals/EditLabelsModal/EditLabelsForm.js.map +1 -1
- package/dist/src/components/modals/massModals/MassDecommissionDeviceModal/MassDecommissionDeviceModal.js +4 -4
- package/dist/src/components/modals/massModals/MassDecommissionDeviceModal/MassDecommissionDeviceModal.js.map +1 -1
- package/dist/src/components/modals/massModals/MassDeleteDeviceModal/MassDeleteDeviceModal.js +4 -4
- package/dist/src/components/modals/massModals/MassDeleteDeviceModal/MassDeleteDeviceModal.js.map +1 -1
- package/dist/src/components/modals/massModals/MassDeleteFleetModal/MassDeleteFleetModal.js +2 -2
- package/dist/src/components/modals/massModals/MassDeleteFleetModal/MassDeleteFleetModal.js.map +1 -1
- package/dist/src/components/modals/massModals/MassDeleteRepositoryModal/MassDeleteRepositoryModal.js +2 -2
- package/dist/src/components/modals/massModals/MassDeleteRepositoryModal/MassDeleteRepositoryModal.js.map +1 -1
- package/dist/src/hooks/timeZones.d.ts +3 -0
- package/dist/src/hooks/timeZones.d.ts.map +1 -0
- package/dist/src/hooks/timeZones.js +607 -0
- package/dist/src/hooks/timeZones.js.map +1 -0
- package/dist/src/hooks/useAppContext.d.ts +14 -8
- package/dist/src/hooks/useAppContext.d.ts.map +1 -1
- package/dist/src/hooks/useAppContext.js +13 -6
- package/dist/src/hooks/useAppContext.js.map +1 -1
- package/dist/src/hooks/useFetch.d.ts +3 -5
- package/dist/src/hooks/useFetch.d.ts.map +1 -1
- package/dist/src/hooks/useFetch.js +3 -2
- package/dist/src/hooks/useFetch.js.map +1 -1
- package/dist/src/hooks/useNavigate.d.ts +2 -1
- package/dist/src/hooks/useNavigate.d.ts.map +1 -1
- package/dist/src/hooks/useNavigate.js +1 -0
- package/dist/src/hooks/useNavigate.js.map +1 -1
- package/dist/src/hooks/useTimeZones.d.ts +4 -0
- package/dist/src/hooks/useTimeZones.d.ts.map +1 -0
- package/dist/src/hooks/useTimeZones.js +22 -0
- package/dist/src/hooks/useTimeZones.js.map +1 -0
- package/dist/src/hooks/useWebSocket.d.ts +6 -2
- package/dist/src/hooks/useWebSocket.d.ts.map +1 -1
- package/dist/src/hooks/useWebSocket.js +22 -7
- package/dist/src/hooks/useWebSocket.js.map +1 -1
- package/dist/src/links.d.ts +3 -0
- package/dist/src/links.d.ts.map +1 -1
- package/dist/src/links.js +10 -3
- package/dist/src/links.js.map +1 -1
- package/dist/src/types/deviceSpec.d.ts +93 -5
- package/dist/src/types/deviceSpec.d.ts.map +1 -1
- package/dist/src/types/deviceSpec.js +28 -2
- package/dist/src/types/deviceSpec.js.map +1 -1
- package/dist/src/types/extraTypes.d.ts +19 -1
- package/dist/src/types/extraTypes.d.ts.map +1 -1
- package/dist/src/types/extraTypes.js.map +1 -1
- package/dist/src/utils/labels.d.ts +1 -0
- package/dist/src/utils/labels.d.ts.map +1 -1
- package/dist/src/utils/labels.js +9 -2
- package/dist/src/utils/labels.js.map +1 -1
- package/dist/src/utils/patch.d.ts +13 -5
- package/dist/src/utils/patch.d.ts.map +1 -1
- package/dist/src/utils/patch.js +115 -71
- package/dist/src/utils/patch.js.map +1 -1
- package/dist/src/utils/query.d.ts +1 -0
- package/dist/src/utils/query.d.ts.map +1 -1
- package/dist/src/utils/query.js +10 -3
- package/dist/src/utils/query.js.map +1 -1
- package/dist/src/utils/search.d.ts +6 -0
- package/dist/src/utils/search.d.ts.map +1 -1
- package/dist/src/utils/search.js +9 -1
- package/dist/src/utils/search.js.map +1 -1
- package/dist/src/utils/time.d.ts +31 -0
- package/dist/src/utils/time.d.ts.map +1 -0
- package/dist/src/utils/time.js +134 -0
- package/dist/src/utils/time.js.map +1 -0
- package/package.json +1 -4
- package/src/components/DetailsPage/DetailsPage.tsx +6 -4
- package/src/components/DetailsPage/Tables/ApplicationsTable.tsx +6 -3
- package/src/components/Device/AddDeviceModal/AddDeviceModal.tsx +4 -13
- package/src/components/Device/DeviceDetails/DeviceAliasEdit.tsx +180 -0
- package/src/components/Device/DeviceDetails/DeviceApplications.tsx +8 -1
- package/src/components/Device/DeviceDetails/DeviceDetailsPage.tsx +21 -5
- package/src/components/Device/DeviceDetails/DeviceDetailsTab.tsx +3 -4
- package/src/components/Device/DeviceDetails/DeviceDetailsTabContent/StatusContent.tsx +7 -10
- package/src/components/Device/DeviceDetails/DeviceDetailsTabContent/SystemResourcesContent.tsx +3 -3
- package/src/components/Device/DeviceDetails/TerminalTab.tsx +43 -5
- package/src/components/Device/DevicesPage/DecommissionedDevicesTable.tsx +2 -1
- package/src/components/Device/DevicesPage/DeviceToolbarFilters.tsx +66 -38
- package/src/components/Device/DevicesPage/DevicesPage.tsx +11 -2
- package/src/components/Device/DevicesPage/EnrolledDevicesTable.tsx +16 -11
- package/src/components/Device/EditDeviceWizard/EditDeviceWizard.tsx +11 -2
- package/src/components/Device/EditDeviceWizard/EditDeviceWizardFooter.tsx +22 -6
- package/src/components/Device/EditDeviceWizard/EditDeviceWizardNav.tsx +15 -2
- package/src/components/Device/EditDeviceWizard/deviceSpecUtils.ts +147 -14
- package/src/components/Device/EditDeviceWizard/steps/ApplicationImageForm.tsx +28 -0
- package/src/components/Device/EditDeviceWizard/steps/ApplicationInlineForm.tsx +94 -0
- package/src/components/Device/EditDeviceWizard/steps/ApplicationTemplates.tsx +81 -50
- package/src/components/Device/EditDeviceWizard/steps/ConfigInlineTemplateForm.tsx +23 -28
- package/src/components/Device/EditDeviceWizard/steps/ConfigK8sSecretTemplateForm.tsx +1 -2
- package/src/components/Device/EditDeviceWizard/steps/ConfigWithRepositoryTemplateForm.tsx +18 -39
- package/src/components/Device/EditDeviceWizard/steps/ConfigurationTemplates.tsx +8 -14
- package/src/components/Device/EditDeviceWizard/steps/DeviceTemplateStep.tsx +26 -39
- package/src/components/Device/EditDeviceWizard/steps/DeviceUpdateStep.tsx +88 -0
- package/src/components/Device/EditDeviceWizard/steps/GeneralInfoStep.tsx +1 -1
- package/src/components/Device/EditDeviceWizard/steps/ReviewApplications.tsx +18 -19
- package/src/components/Device/EditDeviceWizard/steps/ReviewDeviceStep.tsx +3 -3
- package/src/components/Device/EditDeviceWizard/steps/ReviewTrackedSystemdServices.tsx +2 -2
- package/src/components/Device/EditDeviceWizard/steps/ReviewUpdatePolicy.tsx +2 -1
- package/src/components/Device/EditDeviceWizard/steps/SystemdUnitsForm.tsx +1 -1
- package/src/components/Device/EditDeviceWizard/utils.ts +16 -9
- package/src/components/Device/SystemdUnitsModal/SystemdUnitsModal.tsx +7 -6
- package/src/components/Device/SystemdUnitsModal/TrackSystemdUnitsForm.tsx +1 -5
- package/src/components/EnrollmentRequest/EnrollmentRequestDetails/EnrollmentRequestDetails.tsx +7 -9
- package/src/components/EnrollmentRequest/EnrollmentRequestList.tsx +30 -17
- package/src/components/EnrollmentRequest/EnrollmentRequestTableRow.tsx +5 -1
- package/src/components/EnrollmentRequest/useEnrollmentRequests.ts +12 -4
- package/src/components/Fleet/CreateFleet/CreateFleetWizard.tsx +4 -3
- package/src/components/Fleet/CreateFleet/CreateFleetWizardFooter.tsx +9 -2
- package/src/components/Fleet/CreateFleet/fleetSpecUtils.ts +51 -17
- package/src/components/Fleet/CreateFleet/steps/DeviceLabelSelector.tsx +1 -1
- package/src/components/Fleet/CreateFleet/steps/GeneralInfoStep.tsx +2 -13
- package/src/components/Fleet/CreateFleet/steps/ReviewStep.tsx +3 -3
- package/src/components/Fleet/CreateFleet/steps/UpdateConfirmChangesModal.tsx +10 -1
- package/src/components/Fleet/CreateFleet/steps/UpdatePolicyStep.tsx +49 -16
- package/src/components/Fleet/CreateFleet/steps/UpdateStepDisruptionBudget.tsx +18 -33
- package/src/components/Fleet/CreateFleet/steps/UpdateStepRolloutPolicy.tsx +14 -24
- package/src/components/Fleet/CreateFleet/steps/UpdateStepUpdatePolicy.css +3 -0
- package/src/components/Fleet/CreateFleet/steps/UpdateStepUpdatePolicy.tsx +246 -0
- package/src/components/Fleet/CreateFleet/utils.ts +23 -7
- package/src/components/Fleet/FleetsPage.tsx +15 -17
- package/src/components/Fleet/ImportFleetWizard/steps/ResourceSyncStep.tsx +1 -1
- package/src/components/ListPage/ListPage.tsx +7 -4
- package/src/components/Masthead/CommandLineToolsPage.tsx +179 -0
- package/src/components/OverviewPage/Cards/Status/StatusCard.tsx +6 -6
- package/src/components/OverviewPage/Cards/{ToDo/ToDoCard.tsx → Tasks/TasksCard.tsx} +3 -3
- package/src/components/OverviewPage/Overview.tsx +2 -2
- package/src/components/Repository/CreateRepository/CreateRepositoryForm.tsx +11 -26
- package/src/components/Repository/CreateRepository/CreateResourceSyncsForm.tsx +8 -17
- package/src/components/Repository/CreateRepository/utils.ts +4 -1
- package/src/components/Repository/RepositoryDetails/RepositoryResourceSyncsCard.tsx +3 -4
- package/src/components/Repository/RepositoryList.tsx +9 -16
- package/src/components/ResourceSync/RepositoryResourceSyncList.tsx +7 -11
- package/src/components/Status/DeviceResourceStatus.tsx +4 -4
- package/src/components/Status/utils.ts +3 -5
- package/src/components/Table/Table.tsx +32 -9
- package/src/components/Table/TablePagination.tsx +0 -1
- package/src/components/Terminal/Terminal.tsx +10 -4
- package/src/components/charts/DonutChart.tsx +2 -2
- package/src/components/common/LeaveFormConfirmation.tsx +2 -2
- package/src/components/common/WithHelperText.tsx +53 -21
- package/src/components/form/CheckboxField.tsx +28 -3
- package/src/components/form/FormSelectTypeahead.tsx +53 -80
- package/src/components/form/RichValidationTextField.tsx +73 -62
- package/src/components/form/validations.ts +207 -28
- package/src/components/modals/ApproveDeviceModal/ApproveDeviceForm.tsx +5 -5
- package/src/components/modals/ApproveDeviceModal/ApproveDeviceModal.tsx +3 -2
- package/src/components/modals/EditLabelsModal/EditLabelsForm.tsx +9 -20
- package/src/components/modals/massModals/MassDecommissionDeviceModal/MassDecommissionDeviceModal.tsx +2 -2
- package/src/components/modals/massModals/MassDeleteDeviceModal/MassDeleteDeviceModal.tsx +2 -2
- package/src/components/modals/massModals/MassDeleteFleetModal/MassDeleteFleetModal.tsx +2 -2
- package/src/components/modals/massModals/MassDeleteRepositoryModal/MassDeleteRepositoryModal.tsx +2 -2
- package/src/hooks/timeZones.ts +606 -0
- package/src/hooks/useAppContext.tsx +20 -10
- package/src/hooks/useFetch.ts +3 -2
- package/src/hooks/useNavigate.tsx +1 -0
- package/src/hooks/useTimeZones.ts +26 -0
- package/src/hooks/useWebSocket.ts +29 -7
- package/src/links.ts +13 -4
- package/src/types/deviceSpec.ts +118 -2
- package/src/types/extraTypes.ts +33 -1
- package/src/utils/labels.ts +7 -1
- package/src/utils/patch.ts +126 -72
- package/src/utils/query.ts +13 -4
- package/src/utils/search.ts +8 -0
- package/src/utils/time.ts +147 -0
- package/dist/jest.config.d.ts +0 -12
- package/dist/jest.config.d.ts.map +0 -1
- package/dist/jest.config.js +0 -24
- package/dist/jest.config.js.map +0 -1
- package/dist/src/components/DetailsPage/DetailsPage.spec.d.ts +0 -2
- package/dist/src/components/DetailsPage/DetailsPage.spec.d.ts.map +0 -1
- package/dist/src/components/DetailsPage/DetailsPage.spec.js +0 -81
- package/dist/src/components/DetailsPage/DetailsPage.spec.js.map +0 -1
- package/dist/src/components/Device/EditDeviceWizard/types.d.ts +0 -23
- package/dist/src/components/Device/EditDeviceWizard/types.d.ts.map +0 -1
- package/dist/src/components/Device/EditDeviceWizard/types.js +0 -3
- package/dist/src/components/Device/EditDeviceWizard/types.js.map +0 -1
- package/dist/src/components/Fleet/CreateFleet/types.d.ts +0 -29
- package/dist/src/components/Fleet/CreateFleet/types.d.ts.map +0 -1
- package/dist/src/components/Fleet/CreateFleet/types.js +0 -9
- package/dist/src/components/Fleet/CreateFleet/types.js.map +0 -1
- package/dist/src/components/OverviewPage/Cards/ToDo/ToDoCard.d.ts +0 -4
- package/dist/src/components/OverviewPage/Cards/ToDo/ToDoCard.d.ts.map +0 -1
- package/dist/src/components/OverviewPage/Cards/ToDo/ToDoCard.js.map +0 -1
- package/dist/src/components/UserPreferences/UserPreferencesModal.d.ts.map +0 -1
- package/dist/src/components/UserPreferences/UserPreferencesModal.js.map +0 -1
- package/dist/src/components/UserPreferences/UserPreferencesProvider.d.ts.map +0 -1
- package/dist/src/components/UserPreferences/UserPreferencesProvider.js.map +0 -1
- package/dist/src/setupTests.d.ts +0 -2
- package/dist/src/setupTests.d.ts.map +0 -1
- package/dist/src/setupTests.js +0 -24
- package/dist/src/setupTests.js.map +0 -1
- package/dist/src/tests/test-utils.d.ts +0 -7
- package/dist/src/tests/test-utils.d.ts.map +0 -1
- package/dist/src/tests/test-utils.js +0 -21
- package/dist/src/tests/test-utils.js.map +0 -1
- package/src/components/DetailsPage/DetailsPage.spec.tsx +0 -128
- package/src/components/Device/EditDeviceWizard/types.ts +0 -22
- package/src/components/Fleet/CreateFleet/types.ts +0 -33
- package/src/setupTests.ts +0 -21
- package/src/tests/test-utils.tsx +0 -21
- /package/dist/src/components/{UserPreferences → Masthead}/UserPreferencesModal.d.ts +0 -0
- /package/dist/src/components/{UserPreferences → Masthead}/UserPreferencesModal.js +0 -0
- /package/dist/src/components/{UserPreferences → Masthead}/UserPreferencesProvider.d.ts +0 -0
- /package/dist/src/components/{UserPreferences → Masthead}/UserPreferencesProvider.js +0 -0
- /package/src/components/{UserPreferences → Masthead}/UserPreferencesModal.tsx +0 -0
- /package/src/components/{UserPreferences → Masthead}/UserPreferencesProvider.tsx +0 -0
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
useSearchParams,
|
|
14
14
|
} from 'react-router-dom';
|
|
15
15
|
import { PatchRequest } from '@flightctl/types';
|
|
16
|
+
import { CliArtifactsResponse } from '@flightctl/ui-components/src/types/extraTypes';
|
|
16
17
|
import { ROUTE } from './useNavigate';
|
|
17
18
|
import { RESOURCE, VERB } from '../types/rbac';
|
|
18
19
|
|
|
@@ -33,17 +34,26 @@ export const appRoutes = {
|
|
|
33
34
|
[ROUTE.RESOURCE_SYNC_DETAILS]: '/devicemanagement/resourcesyncs',
|
|
34
35
|
[ROUTE.ENROLLMENT_REQUESTS]: '/devicemanagement/enrollmentrequests',
|
|
35
36
|
[ROUTE.ENROLLMENT_REQUEST_DETAILS]: '/devicemanagement/enrollmentrequests',
|
|
37
|
+
[ROUTE.COMMAND_LINE_TOOLS]: '/command-line-tools',
|
|
36
38
|
};
|
|
37
39
|
|
|
38
40
|
export type NavLinkFC = React.FC<{ to: string; children: (props: { isActive: boolean }) => React.ReactNode }>;
|
|
39
41
|
export type PromptFC = React.FC<{ message: string }>;
|
|
42
|
+
export enum FlightCtlApp {
|
|
43
|
+
STANDALONE = 'standalone',
|
|
44
|
+
OCP = 'ocp',
|
|
45
|
+
AAP = 'aap',
|
|
46
|
+
}
|
|
40
47
|
|
|
41
48
|
export type AppContextProps = {
|
|
42
|
-
appType:
|
|
49
|
+
appType: FlightCtlApp;
|
|
43
50
|
user?: string; // auth?.user?.profile.preferred_username
|
|
44
51
|
i18n: {
|
|
45
52
|
transNamespace?: string;
|
|
46
53
|
};
|
|
54
|
+
settings: {
|
|
55
|
+
isRHEM?: boolean;
|
|
56
|
+
};
|
|
47
57
|
router: {
|
|
48
58
|
useNavigate: () => RouterNavigateFunction;
|
|
49
59
|
Link: typeof Link;
|
|
@@ -59,7 +69,7 @@ export type AppContextProps = {
|
|
|
59
69
|
Prompt?: PromptFC;
|
|
60
70
|
};
|
|
61
71
|
fetch: {
|
|
62
|
-
getWsEndpoint: (deviceId: string) =>
|
|
72
|
+
getWsEndpoint: (deviceId: string) => string;
|
|
63
73
|
get: <R>(kind: string, abortSignal?: AbortSignal) => Promise<R>;
|
|
64
74
|
post: <R>(kind: string, data: R, abortSignal?: AbortSignal) => Promise<R>;
|
|
65
75
|
put: <R>(kind: string, data: R, abortSignal?: AbortSignal) => Promise<R>;
|
|
@@ -67,13 +77,16 @@ export type AppContextProps = {
|
|
|
67
77
|
patch: <R>(kind: string, patches: PatchRequest, abortSignal?: AbortSignal) => Promise<R>;
|
|
68
78
|
checkPermissions: (resource: RESOURCE, verb: VERB) => Promise<boolean>;
|
|
69
79
|
};
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
80
|
+
// Extra fetch functions
|
|
81
|
+
getMetrics?: <R>(query: string, abortSignal?: AbortSignal) => Promise<R>;
|
|
82
|
+
getCliArtifacts?: (abortSignal?: AbortSignal) => Promise<CliArtifactsResponse>;
|
|
73
83
|
};
|
|
74
84
|
|
|
75
85
|
export const AppContext = React.createContext<AppContextProps>({
|
|
76
|
-
appType:
|
|
86
|
+
appType: FlightCtlApp.STANDALONE,
|
|
87
|
+
settings: {
|
|
88
|
+
isRHEM: false,
|
|
89
|
+
},
|
|
77
90
|
router: {
|
|
78
91
|
useNavigate,
|
|
79
92
|
Link,
|
|
@@ -92,7 +105,7 @@ export const AppContext = React.createContext<AppContextProps>({
|
|
|
92
105
|
},
|
|
93
106
|
/* eslint-disable */
|
|
94
107
|
fetch: {
|
|
95
|
-
getWsEndpoint: () =>
|
|
108
|
+
getWsEndpoint: () => '',
|
|
96
109
|
get: async () => ({}) as any,
|
|
97
110
|
post: async () => ({}) as any,
|
|
98
111
|
put: async () => ({}) as any,
|
|
@@ -100,9 +113,6 @@ export const AppContext = React.createContext<AppContextProps>({
|
|
|
100
113
|
patch: async () => ({}) as any,
|
|
101
114
|
checkPermissions: async () => true,
|
|
102
115
|
},
|
|
103
|
-
metrics: {
|
|
104
|
-
get: async () => ({}) as any,
|
|
105
|
-
},
|
|
106
116
|
/* eslint-enable */
|
|
107
117
|
});
|
|
108
118
|
|
package/src/hooks/useFetch.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { useAppContext } from './useAppContext';
|
|
2
2
|
|
|
3
3
|
export const useFetch = () => {
|
|
4
|
-
const { fetch,
|
|
4
|
+
const { fetch, getCliArtifacts, getMetrics } = useAppContext();
|
|
5
5
|
|
|
6
6
|
return {
|
|
7
7
|
...fetch,
|
|
8
|
-
|
|
8
|
+
getCliArtifacts,
|
|
9
|
+
getMetrics,
|
|
9
10
|
};
|
|
10
11
|
};
|
|
@@ -24,6 +24,7 @@ export enum ROUTE {
|
|
|
24
24
|
RESOURCE_SYNC_DETAILS = 'RESOURCE_SYNC_DETAILS',
|
|
25
25
|
ENROLLMENT_REQUESTS = 'ENROLLMENT_REQUESTS',
|
|
26
26
|
ENROLLMENT_REQUEST_DETAILS = 'ENROLLMENT_REQUEST_DETAILS',
|
|
27
|
+
COMMAND_LINE_TOOLS = 'COMMAND_LINE_TOOLS',
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export type RouteWithPostfix =
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type TimeZoneMap = Record<string, string>;
|
|
4
|
+
|
|
5
|
+
// Hook allows us to only load the timeZones when they are being used
|
|
6
|
+
const useTimeZones = () => {
|
|
7
|
+
const [zones, setZones] = React.useState<TimeZoneMap>({});
|
|
8
|
+
|
|
9
|
+
React.useEffect(() => {
|
|
10
|
+
const loadZones = async () => {
|
|
11
|
+
const timeZones = (await import('./timeZones')).default;
|
|
12
|
+
|
|
13
|
+
const filledZones = Object.entries(timeZones).reduce((finalMap, [name, offset]) => {
|
|
14
|
+
finalMap[name] = `(GMT ${offset}) ${name}`;
|
|
15
|
+
return finalMap;
|
|
16
|
+
}, {} as TimeZoneMap);
|
|
17
|
+
|
|
18
|
+
setZones(filledZones);
|
|
19
|
+
};
|
|
20
|
+
void loadZones();
|
|
21
|
+
}, []);
|
|
22
|
+
|
|
23
|
+
return zones;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default useTimeZones;
|
|
@@ -2,11 +2,26 @@ import * as React from 'react';
|
|
|
2
2
|
import { useTranslation } from './useTranslation';
|
|
3
3
|
import { useAppContext } from './useAppContext';
|
|
4
4
|
|
|
5
|
+
const msgToBytes = (msg: string, resize?: boolean) => {
|
|
6
|
+
const encoder = new TextEncoder();
|
|
7
|
+
const encodedData = encoder.encode(msg);
|
|
8
|
+
const result = new Uint8Array(encodedData.length + 1);
|
|
9
|
+
result[0] = resize ? 0x4 : 0x00;
|
|
10
|
+
result.set(encodedData, 1);
|
|
11
|
+
return result;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type WsMetadata = {
|
|
15
|
+
tty: boolean;
|
|
16
|
+
term: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
5
19
|
export const useWebSocket = <T>(
|
|
6
20
|
deviceId: string,
|
|
7
21
|
onMsgReceived: (msg: T) => Promise<void>,
|
|
22
|
+
wsMetadata: WsMetadata,
|
|
8
23
|
): {
|
|
9
|
-
sendMessage: (msg: string) => void;
|
|
24
|
+
sendMessage: (msg: string, resize?: boolean) => void;
|
|
10
25
|
isConnecting: boolean;
|
|
11
26
|
isClosed: boolean;
|
|
12
27
|
error: unknown;
|
|
@@ -22,18 +37,25 @@ export const useWebSocket = <T>(
|
|
|
22
37
|
const [error, setError] = React.useState<unknown>();
|
|
23
38
|
const [reset, setReset] = React.useState<number>(0);
|
|
24
39
|
|
|
25
|
-
const sendMessage = React.useCallback((data: string) => {
|
|
26
|
-
wsRef.current?.send(data);
|
|
40
|
+
const sendMessage = React.useCallback((data: string, resize?: boolean) => {
|
|
41
|
+
wsRef.current?.send(msgToBytes(data, resize));
|
|
27
42
|
}, []);
|
|
28
43
|
|
|
29
44
|
React.useEffect(() => {
|
|
30
45
|
try {
|
|
31
46
|
setIsConnecting(true);
|
|
32
47
|
setIsClosed(false);
|
|
33
|
-
const
|
|
34
|
-
const
|
|
48
|
+
const wsEndpoint = getWsEndpoint(deviceId);
|
|
49
|
+
const wsMeta = JSON.stringify(wsMetadata);
|
|
50
|
+
const params = new URLSearchParams({
|
|
51
|
+
metadata: wsMeta,
|
|
52
|
+
});
|
|
53
|
+
const ws = new WebSocket(`${wsEndpoint}?${params.toString()}`, 'v5.channel.k8s.io');
|
|
35
54
|
ws.addEventListener('open', () => setIsConnecting(false));
|
|
36
|
-
ws.addEventListener('close', () =>
|
|
55
|
+
ws.addEventListener('close', () => {
|
|
56
|
+
setIsClosed(true);
|
|
57
|
+
wsRef.current = undefined;
|
|
58
|
+
});
|
|
37
59
|
ws.addEventListener('error', (evt) => {
|
|
38
60
|
// eslint-disable-next-line no-console
|
|
39
61
|
console.error('Error creating websocket:', evt);
|
|
@@ -48,7 +70,7 @@ export const useWebSocket = <T>(
|
|
|
48
70
|
wsRef.current?.close();
|
|
49
71
|
wsRef.current = undefined;
|
|
50
72
|
};
|
|
51
|
-
}, [deviceId, t, getWsEndpoint, reset]);
|
|
73
|
+
}, [deviceId, t, getWsEndpoint, reset, wsMetadata]);
|
|
52
74
|
|
|
53
75
|
const reconnect = React.useCallback(() => {
|
|
54
76
|
wsRef.current?.close();
|
package/src/links.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
'https://github.com/flightctl/flightctl/blob/main/docs/user/managing-devices.md#creating-applications';
|
|
1
|
+
const baseDocsRepoUrl = 'https://github.com/flightctl/flightctl/blob/main/docs';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
// Links to the fLightctl upstream docs
|
|
4
|
+
export const CREATING_APPLICATIONS_LINK = `${baseDocsRepoUrl}/user/managing-devices.md#creating-applications`;
|
|
6
5
|
|
|
6
|
+
export const USING_TEMPLATE_VARIABLES_LINK = `${baseDocsRepoUrl}/user/managing-fleets.md#defining-device-templates`;
|
|
7
|
+
|
|
8
|
+
export const ADDING_NEW_DEVICES_LINK = `${baseDocsRepoUrl}/user/getting-started.md#building-a-bootable-container-image-including-the-flight-control-agent`;
|
|
9
|
+
|
|
10
|
+
export const CREATE_ACM_REPOSITORY = `${baseDocsRepoUrl}/user/registering-microshift-devices-acm.md#creating-the-acm-registration-repository`;
|
|
11
|
+
|
|
12
|
+
// Links to other flightctl upstream resources
|
|
13
|
+
export const DEMO_REPOSITORY_URL = 'https://github.com/flightctl/flightctl-demos';
|
|
14
|
+
|
|
15
|
+
// Links to general Red Hat docs
|
|
7
16
|
export const TECH_PREVIEW_LEVEL_LINK = 'https://access.redhat.com/support/offerings/techpreview';
|
package/src/types/deviceSpec.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ConfigProviderSpec,
|
|
3
|
+
DisruptionBudget,
|
|
3
4
|
GitConfigProviderSpec,
|
|
4
5
|
HttpConfigProviderSpec,
|
|
6
|
+
ImageApplicationProviderSpec,
|
|
7
|
+
InlineApplicationProviderSpec,
|
|
5
8
|
InlineConfigProviderSpec,
|
|
6
9
|
KubernetesSecretProviderSpec,
|
|
7
10
|
} from '@flightctl/types';
|
|
11
|
+
import { FlightCtlLabel } from './extraTypes';
|
|
12
|
+
import { UpdateScheduleMode } from '../utils/time';
|
|
13
|
+
import { ApplicationProviderSpecFixed } from './extraTypes';
|
|
8
14
|
|
|
9
15
|
export enum ConfigType {
|
|
10
16
|
GIT = 'git',
|
|
@@ -26,6 +32,33 @@ export type GitConfigTemplate = ConfigTemplate & {
|
|
|
26
32
|
mountPath?: string;
|
|
27
33
|
};
|
|
28
34
|
|
|
35
|
+
export enum AppSpecType {
|
|
36
|
+
OCI_IMAGE = 'image',
|
|
37
|
+
INLINE = 'inline',
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
type InlineContent = {
|
|
41
|
+
content?: string;
|
|
42
|
+
path: string;
|
|
43
|
+
base64?: boolean;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
type AppBase = {
|
|
47
|
+
specType: AppSpecType;
|
|
48
|
+
// appType: AppType - commented out for now, since it only accepts one value ("compose")
|
|
49
|
+
name?: string;
|
|
50
|
+
variables: { name: string; value: string }[];
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export type InlineAppForm = AppBase & {
|
|
54
|
+
name: string; // name can only be optional for image applications
|
|
55
|
+
files: InlineContent[];
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export type ImageAppForm = AppBase & {
|
|
59
|
+
image: string;
|
|
60
|
+
};
|
|
61
|
+
|
|
29
62
|
export const isGitConfigTemplate = (configTemplate: ConfigTemplate): configTemplate is GitConfigTemplate =>
|
|
30
63
|
configTemplate.type === ConfigType.GIT;
|
|
31
64
|
|
|
@@ -43,7 +76,25 @@ export type RepoConfig = GitConfigProviderSpec | HttpConfigProviderSpec;
|
|
|
43
76
|
export const isRepoConfig = (config: ConfigSourceProvider): config is RepoConfig =>
|
|
44
77
|
isGitProviderSpec(config) || isHttpProviderSpec(config);
|
|
45
78
|
|
|
46
|
-
|
|
79
|
+
export type AppForm = ImageAppForm | InlineAppForm;
|
|
80
|
+
|
|
81
|
+
export const isInlineAppProvider = (app: ApplicationProviderSpecFixed): app is InlineApplicationProviderSpec =>
|
|
82
|
+
'inline' in app;
|
|
83
|
+
export const isImageAppProvider = (app: ApplicationProviderSpecFixed): app is ImageApplicationProviderSpec =>
|
|
84
|
+
'image' in app;
|
|
85
|
+
|
|
86
|
+
export const isImageAppForm = (app: AppBase): app is ImageAppForm => app.specType === AppSpecType.OCI_IMAGE;
|
|
87
|
+
export const isInlineAppForm = (app: AppBase): app is InlineAppForm => app.specType === AppSpecType.INLINE;
|
|
88
|
+
|
|
89
|
+
const hasTemplateVariables = (str: string) => /{{.+?}}/.test(str);
|
|
90
|
+
|
|
91
|
+
export const getAppIdentifier = (app: AppForm) => {
|
|
92
|
+
if (isImageAppForm(app)) {
|
|
93
|
+
return app.name || app.image;
|
|
94
|
+
}
|
|
95
|
+
// Name is mandatory for inline applications
|
|
96
|
+
return app.name;
|
|
97
|
+
};
|
|
47
98
|
|
|
48
99
|
export const getConfigFullRepoUrl = (config: RepoConfig, repositoryUrl: string) => {
|
|
49
100
|
let relativePath: string = '';
|
|
@@ -84,7 +135,7 @@ export const isKubeProviderSpec = (providerSpec: ConfigProviderSpec): providerSp
|
|
|
84
135
|
|
|
85
136
|
export type InlineConfigTemplate = ConfigTemplate & {
|
|
86
137
|
type: ConfigType.INLINE;
|
|
87
|
-
files: Array<
|
|
138
|
+
files: Array<InlineContent & { permissions?: string; user?: string; group?: string }>;
|
|
88
139
|
};
|
|
89
140
|
|
|
90
141
|
export const isInlineConfigTemplate = (configTemplate: ConfigTemplate): configTemplate is InlineConfigTemplate =>
|
|
@@ -108,3 +159,68 @@ export const isHttpProviderSpec = (providerSpec: ConfigProviderSpec): providerSp
|
|
|
108
159
|
'httpRef' in providerSpec;
|
|
109
160
|
|
|
110
161
|
export type SpecConfigTemplate = GitConfigTemplate | HttpConfigTemplate | KubeSecretTemplate | InlineConfigTemplate;
|
|
162
|
+
export type SystemdUnitFormValue = {
|
|
163
|
+
pattern: string;
|
|
164
|
+
exists: boolean;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export type DeviceSpecConfigFormValues = {
|
|
168
|
+
osImage?: string;
|
|
169
|
+
configTemplates: SpecConfigTemplate[];
|
|
170
|
+
applications: AppForm[];
|
|
171
|
+
systemdUnits: SystemdUnitFormValue[];
|
|
172
|
+
updatePolicy: UpdatePolicyForm;
|
|
173
|
+
registerMicroShift: boolean;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export type EditDeviceFormValues = DeviceSpecConfigFormValues & {
|
|
177
|
+
deviceAlias: string;
|
|
178
|
+
labels: FlightCtlLabel[];
|
|
179
|
+
fleetMatch: string;
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
export type FleetFormValues = DeviceSpecConfigFormValues & {
|
|
183
|
+
name: string;
|
|
184
|
+
fleetLabels: FlightCtlLabel[];
|
|
185
|
+
labels: FlightCtlLabel[];
|
|
186
|
+
rolloutPolicy: RolloutPolicyForm;
|
|
187
|
+
disruptionBudget: DisruptionBudgetForm;
|
|
188
|
+
updatePolicy: UpdatePolicyForm;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
export enum BatchLimitType {
|
|
192
|
+
BatchLimitPercent = 'percent',
|
|
193
|
+
BatchLimitAbsoluteNumber = 'value',
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export type BatchForm = {
|
|
197
|
+
selector: FlightCtlLabel[];
|
|
198
|
+
limit?: number;
|
|
199
|
+
limitType: BatchLimitType;
|
|
200
|
+
successThreshold?: number;
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
export type RolloutPolicyForm = {
|
|
204
|
+
isAdvanced: boolean;
|
|
205
|
+
updateTimeout: number;
|
|
206
|
+
batches: BatchForm[];
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
export type DisruptionBudgetForm = DisruptionBudget & {
|
|
210
|
+
isAdvanced: boolean;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export type UpdatePolicyForm = {
|
|
214
|
+
isAdvanced: boolean;
|
|
215
|
+
downloadAndInstallDiffer: boolean;
|
|
216
|
+
downloadStartsAt?: string;
|
|
217
|
+
downloadEndsAt?: string;
|
|
218
|
+
downloadScheduleMode: UpdateScheduleMode;
|
|
219
|
+
downloadWeekDays: boolean[];
|
|
220
|
+
downloadTimeZone: string;
|
|
221
|
+
installStartsAt?: string;
|
|
222
|
+
installEndsAt?: string;
|
|
223
|
+
installScheduleMode: UpdateScheduleMode;
|
|
224
|
+
installWeekDays: boolean[];
|
|
225
|
+
installTimeZone: string;
|
|
226
|
+
};
|
package/src/types/extraTypes.ts
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
AppType,
|
|
3
|
+
ApplicationEnvVars,
|
|
4
|
+
ConditionType,
|
|
5
|
+
Device,
|
|
6
|
+
EnrollmentRequest,
|
|
7
|
+
FileContent,
|
|
8
|
+
Fleet,
|
|
9
|
+
ImageApplicationProviderSpec,
|
|
10
|
+
RelativePath,
|
|
11
|
+
ResourceSync,
|
|
12
|
+
} from '@flightctl/types';
|
|
2
13
|
|
|
3
14
|
export enum FlightControlMetrics {
|
|
4
15
|
ACTIVE_AGENT_COUNT_METRIC = 'flightctl_devicesimulator_active_agent_count',
|
|
@@ -50,3 +61,24 @@ export const isEnrollmentRequest = (resource: Device | EnrollmentRequest): resou
|
|
|
50
61
|
export type AnnotationType = DeviceAnnotation; // Add more types when they are added to the API
|
|
51
62
|
|
|
52
63
|
export const isFleet = (resource: ResourceSync | Fleet): resource is Fleet => resource.kind === 'Fleet';
|
|
64
|
+
|
|
65
|
+
// ApplicationProviderSpec's definition for inline files adds a Record<string, any>. We use the fixed types to get full Typescript checks for the field
|
|
66
|
+
export type InlineApplicationFileFixed = FileContent & RelativePath;
|
|
67
|
+
|
|
68
|
+
// "FixedApplicationProviderSpec" will need to be manually adjusted whenever the API definition changes
|
|
69
|
+
export type ApplicationProviderSpecFixed = ApplicationEnvVars & {
|
|
70
|
+
name?: string;
|
|
71
|
+
appType?: AppType;
|
|
72
|
+
} & (ImageApplicationProviderSpec | { inline: InlineApplicationFileFixed[] });
|
|
73
|
+
|
|
74
|
+
type CliArtifact = {
|
|
75
|
+
os: string;
|
|
76
|
+
arch: string;
|
|
77
|
+
filename: string;
|
|
78
|
+
sha256: string;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export type CliArtifactsResponse = {
|
|
82
|
+
baseUrl: string;
|
|
83
|
+
artifacts: CliArtifact[];
|
|
84
|
+
};
|
package/src/utils/labels.ts
CHANGED
|
@@ -22,8 +22,14 @@ export const toAPILabel = (labels: FlightCtlLabel[]): Record<string, string> =>
|
|
|
22
22
|
{} as Record<string, string>,
|
|
23
23
|
);
|
|
24
24
|
|
|
25
|
-
// Used to force the API to perform an exact match check for labels
|
|
26
25
|
export const labelToExactApiMatchString = (label: FlightCtlLabel) => `${label.key}=${label.value || ''}`;
|
|
26
|
+
export const textToPartialApiMatchString = (text: string) => {
|
|
27
|
+
if (text.includes('=')) {
|
|
28
|
+
const [key, value] = text.split('=');
|
|
29
|
+
return value ? `metadata.labels.key=${key},metadata.labels.value contains ${value}` : `metadata.label.key=${key}`;
|
|
30
|
+
}
|
|
31
|
+
return `metadata.labels.keyOrValue contains ${text}`;
|
|
32
|
+
};
|
|
27
33
|
|
|
28
34
|
export const labelToString = (label: FlightCtlLabel) => `${label.key}${label.value ? `=${label.value}` : ''}`;
|
|
29
35
|
|
package/src/utils/patch.ts
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
BatchSequence,
|
|
3
|
+
DeviceUpdatePolicySpec,
|
|
4
|
+
DisruptionBudget,
|
|
5
|
+
PatchRequest,
|
|
6
|
+
RolloutPolicy,
|
|
7
|
+
UpdateSchedule,
|
|
8
|
+
} from '@flightctl/types';
|
|
2
9
|
import isNil from 'lodash/isNil';
|
|
3
10
|
|
|
4
11
|
import { FlightCtlLabel } from '../types/extraTypes';
|
|
5
12
|
import { toAPILabel } from './labels';
|
|
6
|
-
import { ApplicationFormSpec } from '../components/Device/EditDeviceWizard/types';
|
|
7
13
|
import {
|
|
8
14
|
BatchForm,
|
|
9
15
|
BatchLimitType,
|
|
10
16
|
DisruptionBudgetForm,
|
|
11
17
|
FleetFormValues,
|
|
12
18
|
RolloutPolicyForm,
|
|
13
|
-
|
|
19
|
+
UpdatePolicyForm,
|
|
20
|
+
} from '../types/deviceSpec';
|
|
21
|
+
import { getStartGraceDuration, getUpdateCronExpression, localDeviceTimezone } from './time';
|
|
14
22
|
|
|
15
23
|
export const appendJSONPatch = <V = unknown>({
|
|
16
24
|
patches,
|
|
@@ -127,6 +135,112 @@ const toApiDisruptionBudget = (disruptionValues: DisruptionBudgetForm) => {
|
|
|
127
135
|
return data;
|
|
128
136
|
};
|
|
129
137
|
|
|
138
|
+
export const schedulesAreEqual = (a: UpdateSchedule | undefined, b: UpdateSchedule | undefined) => {
|
|
139
|
+
if (!a && !b) {
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
if (!a || !b) {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
if (a.at !== b.at) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
if ((a.timeZone || localDeviceTimezone) !== (b.timeZone || localDeviceTimezone)) {
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
return (a.startGraceDuration || '0s') === (b.startGraceDuration || '0s');
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export const updatePolicyFormToApi = (form: Required<UpdatePolicyForm>) => {
|
|
155
|
+
const downloadSchedule = {
|
|
156
|
+
at: getUpdateCronExpression(form.downloadStartsAt, form.downloadScheduleMode, form.downloadWeekDays),
|
|
157
|
+
startGraceDuration: getStartGraceDuration(form.downloadStartsAt, form.downloadEndsAt),
|
|
158
|
+
timeZone: form.downloadTimeZone === localDeviceTimezone ? undefined : form.downloadTimeZone,
|
|
159
|
+
};
|
|
160
|
+
let updateSchedule: UpdateSchedule;
|
|
161
|
+
if (form.downloadAndInstallDiffer) {
|
|
162
|
+
updateSchedule = {
|
|
163
|
+
at: getUpdateCronExpression(form.installStartsAt, form.installScheduleMode, form.installWeekDays),
|
|
164
|
+
startGraceDuration: getStartGraceDuration(form.installStartsAt, form.installEndsAt),
|
|
165
|
+
timeZone: form.installTimeZone === localDeviceTimezone ? undefined : form.installTimeZone,
|
|
166
|
+
};
|
|
167
|
+
} else {
|
|
168
|
+
updateSchedule = { ...downloadSchedule };
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
downloadSchedule,
|
|
172
|
+
updateSchedule,
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export const getUpdatePolicyPatches = (
|
|
177
|
+
basePath: string,
|
|
178
|
+
currentPolicy: DeviceUpdatePolicySpec | undefined,
|
|
179
|
+
form: Required<UpdatePolicyForm>,
|
|
180
|
+
): PatchRequest => {
|
|
181
|
+
// Switching from basic mode to advanced or viceversa
|
|
182
|
+
if (!currentPolicy) {
|
|
183
|
+
return form.isAdvanced
|
|
184
|
+
? ([
|
|
185
|
+
{
|
|
186
|
+
op: 'add',
|
|
187
|
+
path: basePath,
|
|
188
|
+
value: updatePolicyFormToApi(form),
|
|
189
|
+
},
|
|
190
|
+
] as PatchRequest)
|
|
191
|
+
: [];
|
|
192
|
+
} else if (!form.isAdvanced) {
|
|
193
|
+
return [
|
|
194
|
+
{
|
|
195
|
+
op: 'remove',
|
|
196
|
+
path: basePath,
|
|
197
|
+
},
|
|
198
|
+
] as PatchRequest;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Making changes to existing advaced settings
|
|
202
|
+
const updatePatches: PatchRequest = [];
|
|
203
|
+
const { downloadSchedule: newDownloadSched, updateSchedule: newInstallSched } = updatePolicyFormToApi(form);
|
|
204
|
+
if (!schedulesAreEqual(currentPolicy.downloadSchedule, newDownloadSched)) {
|
|
205
|
+
if (form.downloadAndInstallDiffer) {
|
|
206
|
+
updatePatches.push({
|
|
207
|
+
op: currentPolicy.downloadSchedule ? 'replace' : 'add',
|
|
208
|
+
path: `${basePath}/downloadSchedule`,
|
|
209
|
+
value: newDownloadSched,
|
|
210
|
+
});
|
|
211
|
+
} else {
|
|
212
|
+
updatePatches.push({
|
|
213
|
+
op: 'replace',
|
|
214
|
+
path: basePath,
|
|
215
|
+
value: {
|
|
216
|
+
downloadSchedule: newDownloadSched,
|
|
217
|
+
updateSchedule: newInstallSched,
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
} else if (!form.downloadAndInstallDiffer) {
|
|
222
|
+
// DownloadSchedule did not change. Check if they just unchecked "useDifferent" and updateSchedule must be changed?
|
|
223
|
+
if (!schedulesAreEqual(currentPolicy.updateSchedule, newDownloadSched)) {
|
|
224
|
+
// Important: we are using downloadSchedule here since we don't copy settings from download to update when
|
|
225
|
+
// the checkbox for "useDifferent" is unchecked
|
|
226
|
+
updatePatches.push({
|
|
227
|
+
op: currentPolicy.updateSchedule ? 'replace' : 'add',
|
|
228
|
+
path: `${basePath}/updateSchedule`,
|
|
229
|
+
value: newDownloadSched,
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
if (form.downloadAndInstallDiffer && !schedulesAreEqual(currentPolicy.updateSchedule, newInstallSched)) {
|
|
234
|
+
updatePatches.push({
|
|
235
|
+
op: currentPolicy.updateSchedule ? 'replace' : 'add',
|
|
236
|
+
path: `${basePath}/updateSchedule`,
|
|
237
|
+
value: newInstallSched,
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return updatePatches;
|
|
242
|
+
};
|
|
243
|
+
|
|
130
244
|
export const getRolloutPolicyData = ({ rolloutPolicy, disruptionBudget }: FleetFormValues) => {
|
|
131
245
|
const newRolloutPolicy: RolloutPolicy = {};
|
|
132
246
|
if (rolloutPolicy.isAdvanced) {
|
|
@@ -301,76 +415,16 @@ export const getLabelPatches = (
|
|
|
301
415
|
return patches;
|
|
302
416
|
};
|
|
303
417
|
|
|
304
|
-
export const
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
}, {});
|
|
309
|
-
|
|
310
|
-
return app.name
|
|
311
|
-
? {
|
|
312
|
-
name: app.name,
|
|
313
|
-
image: app.image,
|
|
314
|
-
envVars,
|
|
315
|
-
}
|
|
316
|
-
: {
|
|
317
|
-
// Name must not be sent, otherwise the API expects it to have a value
|
|
318
|
-
image: app.image,
|
|
319
|
-
envVars,
|
|
320
|
-
};
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
export const getApplicationPatches = (
|
|
324
|
-
basePath: string,
|
|
325
|
-
currentApps: ApplicationSpec[],
|
|
326
|
-
updatedApps: ApplicationFormSpec[],
|
|
418
|
+
export const getDeviceLabelPatches = (
|
|
419
|
+
currentLabels: Record<string, string>,
|
|
420
|
+
newLabels: FlightCtlLabel[],
|
|
421
|
+
newAlias?: string,
|
|
327
422
|
) => {
|
|
328
|
-
|
|
423
|
+
let allNewLabels = newLabels;
|
|
329
424
|
|
|
330
|
-
const
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
// First apps(s) have been added
|
|
334
|
-
patches.push({
|
|
335
|
-
path: `${basePath}/applications`,
|
|
336
|
-
op: 'add',
|
|
337
|
-
value: updatedApps.map(toAPIApplication),
|
|
338
|
-
});
|
|
339
|
-
} else if (currentLen > 0 && newLen === 0) {
|
|
340
|
-
// Last app(s) have been removed
|
|
341
|
-
patches.push({
|
|
342
|
-
path: `${basePath}/applications`,
|
|
343
|
-
op: 'remove',
|
|
344
|
-
});
|
|
345
|
-
} else if (currentLen !== newLen) {
|
|
346
|
-
patches.push({
|
|
347
|
-
path: `${basePath}/applications`,
|
|
348
|
-
op: 'replace',
|
|
349
|
-
value: updatedApps.map(toAPIApplication),
|
|
350
|
-
});
|
|
351
|
-
} else {
|
|
352
|
-
const needsPatch = currentApps.some((currentApp, index) => {
|
|
353
|
-
const updatedApp = updatedApps[index];
|
|
354
|
-
if (updatedApp.name !== currentApp.name || updatedApp.image !== currentApp.image) {
|
|
355
|
-
return true;
|
|
356
|
-
}
|
|
357
|
-
const currentVars = Object.entries(currentApp.envVars || {});
|
|
358
|
-
if (currentVars.length !== updatedApp.variables.length) {
|
|
359
|
-
return true;
|
|
360
|
-
}
|
|
361
|
-
return updatedApp.variables.some((variable) => {
|
|
362
|
-
const currentValue = currentApp.envVars ? currentApp.envVars[variable.name] : undefined;
|
|
363
|
-
return !currentValue || currentValue !== variable.value;
|
|
364
|
-
});
|
|
365
|
-
});
|
|
366
|
-
if (needsPatch) {
|
|
367
|
-
patches.push({
|
|
368
|
-
path: `${basePath}/applications`,
|
|
369
|
-
op: 'replace',
|
|
370
|
-
value: updatedApps.map(toAPIApplication),
|
|
371
|
-
});
|
|
372
|
-
}
|
|
425
|
+
const currentAlias = newAlias || currentLabels['alias']; // The "alias" label is not allowed for devices, we need to add it back
|
|
426
|
+
if (currentAlias) {
|
|
427
|
+
allNewLabels = newLabels.concat([{ key: 'alias', value: currentAlias }]);
|
|
373
428
|
}
|
|
374
|
-
|
|
375
|
-
return patches;
|
|
429
|
+
return getLabelPatches('/metadata/labels', currentLabels, allNewLabels);
|
|
376
430
|
};
|