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